diff --git a/Gruntfile.js b/Gruntfile.js index 1f1f46d42..883ef36d6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -98,6 +98,16 @@ module.exports = function (grunt) { dest: 'docs/resource.css' }, + bundleJs:{ + src: ['docs/core.js','docs/base.js','docs/case.js','docs/widget.js'], + dest: 'docs/bundle.js' + }, + + bundleCss:{ + src: ['docs/core.css','docs/base.css','docs/widget.css'], + dest: 'docs/bundle.css' + }, + demoJs: { src: ['demo/version.js', 'demo/app.js', 'demo/js/**/*.js', 'demo/config.js'], dest: 'docs/demo.js' diff --git a/bi/base.css b/bi/base.css index e30476362..1e6e4b8f4 100644 --- a/bi/base.css +++ b/bi/base.css @@ -873,6 +873,14 @@ li.CodeMirror-hint-active { overflow-x: hidden; overflow-y: hidden; white-space: nowrap; + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ word-break: break-word; } .bi-bubble { diff --git a/bi/base.js b/bi/base.js index 7e2f494d7..13c386850 100644 --- a/bi/base.js +++ b/bi/base.js @@ -478,6 +478,7 @@ BI.Text = BI.inherit(BI.Single, { textAlign: "left", whiteSpace: "normal", lineHeight: null, + handler: null,//如果传入handler,表示处理文字的点击事件,不是区域的 hgap: 0, vgap: 0, lgap: 0, @@ -491,39 +492,25 @@ BI.Text = BI.inherit(BI.Single, { _init: function () { BI.Text.superclass._init.apply(this, arguments); - var o = this.options; - this.text = BI.createWidget({ - type: "bi.layout", - cls: "bi-text" - }); - BI.createWidget({ - type: "bi.default", - element: this, - items: [this.text] - }); - if (BI.isKey(o.text)) { - this.setText(o.text); - } else if (BI.isKey(o.value)) { - this.setText(o.value); - } + var self = this, o = this.options; if (o.hgap + o.lgap > 0) { - this.text.element.css({ - "margin-left": o.hgap + o.lgap + "px" + this.element.css({ + "padding-left": o.hgap + o.lgap + "px" }) } if (o.hgap + o.rgap > 0) { - this.text.element.css({ - "margin-right": o.hgap + o.rgap + "px" + this.element.css({ + "padding-right": o.hgap + o.rgap + "px" }) } if (o.vgap + o.tgap > 0) { - this.text.element.css({ - "margin-top": o.vgap + o.tgap + "px" + this.element.css({ + "padding-top": o.vgap + o.tgap + "px" }) } if (o.vgap + o.bgap > 0) { - this.text.element.css({ - "margin-bottom": o.vgap + o.bgap + "px" + this.element.css({ + "padding-bottom": o.vgap + o.bgap + "px" }) } if (BI.isNumber(o.height)) { @@ -532,14 +519,31 @@ BI.Text = BI.inherit(BI.Single, { if (BI.isNumber(o.lineHeight)) { this.element.css({"lineHeight": o.lineHeight + "px"}); } - this.text.element.css({ - "textAlign": o.textAlign, - "whiteSpace": o.whiteSpace - }); this.element.css({ "textAlign": o.textAlign, "whiteSpace": o.whiteSpace }); + if (o.handler) { + this.text = BI.createWidget({ + type: "bi.layout", + tagName: 'span' + }); + this.text.element.click(function () { + o.handler(self.getValue()); + }); + BI.createWidget({ + type: "bi.default", + element: this, + items: [this.text] + }); + } else { + this.text = this; + } + if (BI.isKey(o.text)) { + this.setText(o.text); + } else if (BI.isKey(o.value)) { + this.setText(o.value); + } if (BI.isKey(o.keyword)) { this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); } @@ -803,6 +807,9 @@ BI.BasicButton = BI.inherit(BI.Single, { _trigger: function () { var o = this.options; + if(!this.isEnabled()){ + return; + } if (!this.isDisableSelected()) { this.isForceSelected() ? this.setSelected(true) : (this.isForceNotSelected() ? this.setSelected(false) : @@ -1516,7 +1523,6 @@ BI.TreeView = BI.inherit(BI.Pane, { _init: function () { BI.TreeView.superclass._init.apply(this, arguments); this._stop = false; - this.container = BI.createWidget(); this._createTree(); this.tip = BI.createWidget({ @@ -1529,7 +1535,7 @@ BI.TreeView = BI.inherit(BI.Pane, { scrollable: true, scrolly: false, element: this, - items: [this.container, this.tip] + items: [this.tip] }); }, @@ -1548,7 +1554,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }); BI.createWidget({ type: "bi.default", - element: this.container, + element: this.element, items: [this.tree] }); }, @@ -1943,6 +1949,7 @@ BI.TreeView = BI.inherit(BI.Pane, { setNode(child.children); }); } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); @@ -16341,9 +16348,9 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { BI.Button.superclass._init.apply(this, arguments); var o = this.options, self = this; if (BI.isNumber(o.height) && !o.clear && !o.block) { - this.element.css({height: o.height - 2, lineHeight: (o.height - 2) + 'px'}); + this.element.css({height: o.height + "px", lineHeight: o.height + "px"}); } else { - this.element.css({lineHeight: o.height + 'px'}); + this.element.css({lineHeight: o.height + "px"}); } if (BI.isKey(o.iconClass)) { this.icon = BI.createWidget({ @@ -16396,8 +16403,8 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { if (o.clear === true) { this.element.addClass("clear"); } - if (o.minWidth > 2) { - this.element.css({"min-width": o.minWidth - 2 + "px"}); + if (o.minWidth > 0) { + this.element.css({"min-width": o.minWidth + "px"}); } }, diff --git a/bi/core.js b/bi/core.js index 219e5e21e..ef4cfda05 100644 --- a/bi/core.js +++ b/bi/core.js @@ -3123,6 +3123,11 @@ if (!window.BI) { } else { return _numberFormat((-text) + "", format.substr(numMod + 1)); } + } else { + //兼容格式处理负数的情况(copy:fr-jquery.format.js) + if (+text < 0 && format.charAt(0) !== '-') { + return _numberFormat((-text) + "", '-' + format); + } } var tp = text.split('.'), fp = format.split('.'), tleft = tp[0] || '', fleft = fp[0] || '', @@ -5830,16 +5835,12 @@ BI.View = BI.inherit(BI.V, { this.off(); } });(function () { - - var kv = {}; // alex:键(编辑器简称,如text)值(也是一个字符串,如FR.TextEditor)对 + var kv = {}; BI.shortcut = function (xtype, cls) { if (kv[xtype] != null) { throw ("shortcut:[" + xtype + "] has been registed"); } kv[xtype] = cls; - _.extend(cls.prototype, { - xtype: xtype - }) }; // 根据配置属性生成widget @@ -5848,9 +5849,6 @@ BI.View = BI.inherit(BI.V, { return new (new Function('return ' + config['classType'] + ';')())(config); } - if (!config.type) { - - } var xtype = config.type.toLowerCase(); var cls = kv[xtype]; return new cls(config); @@ -9348,6 +9346,10 @@ $.extend(BI, { ? entry : entry.value }; + + p.has = function (key) { + return this._keymap[key] != null; + } })();; !(function () { var MD5 = function (hexcase) { @@ -9944,22 +9946,7 @@ $.extend(BI, { }); } } -})();if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { - -} else { - Set = function () { - this.set = {} - }; - Set.prototype.has = function (key) { - return this.set[key] !== undefined; - }; - Set.prototype.add = function (key) { - this.set[key] = 1 - }; - Set.prototype.clear = function () { - this.set = {} - }; -}; +})();; (function () { var clamp = function (value, min, max) { if (value < min) { @@ -10656,359 +10643,360 @@ BI.Region.prototype = { pos.push(this.y + this.h / 2); return pos; } -};; -!(function (BI) { - - if (BI.isIE()) { - XMLSerializer = null; - DOMParser = null; - } - - - var XML = { - Document: { - NodeType: { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 - } - } - }; - - XML.ResultType = { - single: 'single', - array: 'array' - }; - - XML.fromString = function (xmlStr) { - try { - var parser = new DOMParser(); - return parser.parseFromString(xmlStr, "text/xml"); - } catch (e) { - var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; - for (var i = 0; i < arrMSXML.length; i++) { - try { - var xmlDoc = new ActiveXObject(arrMSXML[i]); - xmlDoc.setProperty("SelectionLanguage", "XPath"); - xmlDoc.async = false; - xmlDoc.loadXML(xmlStr); - return xmlDoc; - } catch (xmlError) { - } - } - } - }; - - XML.toString = function (xmlNode) { - if (!BI.isIE()) { - var xmlSerializer = new XMLSerializer(); - return xmlSerializer.serializeToString(xmlNode); - } else - return xmlNode.xml; - }; - - XML.getNSResolver = function (str) { - if (!str) { - return null; - } - var list = str.split(' '); - var namespaces = {}; - for (var i = 0; i < list.length; i++) { - var pair = list[i].split('='); - var fix = BI.trim(pair[0]).replace("xmlns:", ""); - namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); - } - return function (prefix) { - return namespaces[prefix]; - }; - }; - - XML.eval = function (context, xpathExp, resultType, namespaces) { - if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { - return XML.eval2(context, xpathExp, resultType, namespaces); - } else { - if (BI.isIE()) { - namespaces = namespaces ? namespaces : ""; - var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; - doc.setProperty("SelectionNamespaces", namespaces); - var result; - if (resultType == this.ResultType.single) { - result = context.selectSingleNode(xpathExp); - } else { - result = context.selectNodes(xpathExp) || []; - } - doc.setProperty("SelectionNamespaces", ""); - return result; - } else { - var node = context; - var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; - var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; - var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); - - if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { - return col.singleNodeValue; - } else { - var thisColMemb = col.iterateNext(); - var rowsCol = []; - while (thisColMemb) { - rowsCol[rowsCol.length] = thisColMemb; - thisColMemb = col.iterateNext(); - } - return rowsCol; - } - } - } - }; - - XML.eval2 = function (context, xpathExp, resultType, namespaces) { - if (resultType !== "single" && resultType !== undefined && resultType !== null) { - throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); - } - - if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { - return context; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs, i; - if (xpathExp.indexOf("/") != -1) { - var items = xpathExp.split("/"); - var isAbs = xpathExp.substring(0, 1) == "/"; - for (i = 0; i < items.length; i++) { - var item = items[i]; - if (item === "") { - continue; - } else { - var next = null; - var ii = i + 1; - for (; ii < items.length; ii++) { - if (next === null) { - next = items[ii]; - } else { - next = next + "/" + items[ii]; - } - } - - if (item == ".") { - return this.eval(context, next, resultType); - - } else if (item == "..") { - return this.eval2(context.parentNode, next, resultType); - - } else if (item == "*") { - if (isAbs) { - return this.eval2(context, next, resultType); - - } else { - childs = context.childNodes; - for (var j = 0; j < childs.length; j++) { - var tmp = this.eval2(childs[j], next, resultType); - if (tmp !== null) { - return tmp; - } - } - return null; - } - - } else { - if (isAbs) { - if (context.nodeName == item) { - return this.eval2(context, next, resultType); - } else { - return null; - } - } else { - var child = this.getChildByName(context, item); - if (child !== null) { - return this.eval2(child, next, resultType); - } else { - return null; - } - - } - } - - } - } - - return null; - - } else { - if ("text()" == xpathExp) { - childs = context.childNodes; - for (i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.TEXT) { - return childs[i]; - } - } - return null; - } else { - return this.getChildByName(context, xpathExp); - } - } - }; - - XML.getChildByName = function (context, name) { - if (context === null || context === undefined || name === null || name === undefined) { - return null; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs = context.childNodes; - for (var i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { - return childs[i]; - } - } - - return null; - }; - - XML.appendChildren = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - if (isBefore && finded[i].firstNode) { - this._insertBefore(finded[i], nodes, finded[i].firstNode); - } else { - for (var j = 0; j < nodes.length; j++) { - finded[i].appendChild(nodes[j]); - } - } - } - return count; - }; - - XML.removeNodes = function (context, xpathExp) { - var nodes = this.eval(context, xpathExp); - for (var i = 0; i < nodes.length; i++) { - nodes[i].parentNode.removeChild(nodes[i]); - } - }; - - XML._insertBefore = function (parent, newchildren, refchild) { - for (var i = 0; i < newchildren.length; i++) { - parent.insertBefore(newchildren[i], refchild); - } - }; - - XML.insertNodes = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; - this._insertBefore(finded[i].parentNode, nodes, refnode); - } - return count; - }; - - XML.replaceNodes = function (context, xpathExp, nodes) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = finded[i]; - var parent = refnode.parentNode; - this._insertBefore(parent, nodes, refnode); - parent.removeChild(refnode); - } - return count; - }; - - XML.setNodeText = function (context, xpathExp, text) { - var finded = this.eval(context, xpathExp, this.ResultType.single); - if (finded === null) { - return; - } - if (finded.nodeType == XML.Document.NodeType.ELEMENT) { - var textNode = this.eval(finded, "./text()", this.ResultType.single); - if (!textNode) { - textNode = finded.ownerDocument.createTextNode(""); - finded.appendChild(textNode); - } - textNode.nodeValue = text; - } else { - finded.nodeValue = text; - } - return; - }; - - XML.getNodeText = function (context, xpathExp, defaultValue) { - var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; - if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { - finded = this.eval(finded, "./text()", this.ResultType.single); - } - return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; - }; - - XML.Namespaces = { - XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", - XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", - XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", - XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', - XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', - XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', - XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', - XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', - XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', - XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', - XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', - XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', - JUSTEPSCHEMA: "http://www.justep.com/xbiz#", - RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - JUSTEP: "http://www.justep.com/x5#", - 'get': function (type) { - type = type ? type.toLowerCase() : "string"; - if ("string" == type) { - return XML.Namespaces.XMLSCHEMA_STRING; - } - else if ("integer" == type) { - return XML.Namespaces.XMLSCHEMA_INTEGER; - } - else if ("long" == type) { - return XML.Namespaces.XMLSCHEMA_LONG; - } - else if ("float" == type) { - return XML.Namespaces.XMLSCHEMA_FLOAT; - } - else if ("double" == type) { - return XML.Namespaces.XMLSCHEMA_DOUBLE; - } - else if ("decimal" == type) { - return XML.Namespaces.XMLSCHEMA_DECIMAL; - } - else if ("date" == type) { - return XML.Namespaces.XMLSCHEMA_DATE; - } - else if ("time" == type) { - return XML.Namespaces.XMLSCHEMA_TIME; - } - else if ("datetime" == type) { - return XML.Namespaces.XMLSCHEMA_DATETIME; - } - else if ("boolean" == type) { - return XML.Namespaces.XMLSCHEMA_BOOLEAN; - } - } - }; -})(BI);BI.BehaviorFactory = { +};// ; +// !(function (BI) { +// +// if (BI.isIE()) { +// XMLSerializer = null; +// DOMParser = null; +// } +// +// +// var XML = { +// Document: { +// NodeType: { +// ELEMENT: 1, +// ATTRIBUTE: 2, +// TEXT: 3, +// CDATA_SECTION: 4, +// ENTITY_REFERENCE: 5, +// ENTITY: 6, +// PROCESSING_INSTRUCTION: 7, +// COMMENT: 8, +// DOCUMENT: 9, +// DOCUMENT_TYPE: 10, +// DOCUMENT_FRAGMENT: 11, +// NOTATION: 12 +// } +// } +// }; +// +// XML.ResultType = { +// single: 'single', +// array: 'array' +// }; +// +// XML.fromString = function (xmlStr) { +// try { +// var parser = new DOMParser(); +// return parser.parseFromString(xmlStr, "text/xml"); +// } catch (e) { +// var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; +// for (var i = 0; i < arrMSXML.length; i++) { +// try { +// var xmlDoc = new ActiveXObject(arrMSXML[i]); +// xmlDoc.setProperty("SelectionLanguage", "XPath"); +// xmlDoc.async = false; +// xmlDoc.loadXML(xmlStr); +// return xmlDoc; +// } catch (xmlError) { +// } +// } +// } +// }; +// +// XML.toString = function (xmlNode) { +// if (!BI.isIE()) { +// var xmlSerializer = new XMLSerializer(); +// return xmlSerializer.serializeToString(xmlNode); +// } else +// return xmlNode.xml; +// }; +// +// XML.getNSResolver = function (str) { +// if (!str) { +// return null; +// } +// var list = str.split(' '); +// var namespaces = {}; +// for (var i = 0; i < list.length; i++) { +// var pair = list[i].split('='); +// var fix = BI.trim(pair[0]).replace("xmlns:", ""); +// namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); +// } +// return function (prefix) { +// return namespaces[prefix]; +// }; +// }; +// +// XML.eval = function (context, xpathExp, resultType, namespaces) { +// if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { +// return XML.eval2(context, xpathExp, resultType, namespaces); +// } else { +// if (BI.isIE()) { +// namespaces = namespaces ? namespaces : ""; +// var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; +// doc.setProperty("SelectionNamespaces", namespaces); +// var result; +// if (resultType == this.ResultType.single) { +// result = context.selectSingleNode(xpathExp); +// } else { +// result = context.selectNodes(xpathExp) || []; +// } +// doc.setProperty("SelectionNamespaces", ""); +// return result; +// } else { +// var node = context; +// var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; +// var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; +// var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); +// +// if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { +// return col.singleNodeValue; +// } else { +// var thisColMemb = col.iterateNext(); +// var rowsCol = []; +// while (thisColMemb) { +// rowsCol[rowsCol.length] = thisColMemb; +// thisColMemb = col.iterateNext(); +// } +// return rowsCol; +// } +// } +// } +// }; +// +// XML.eval2 = function (context, xpathExp, resultType, namespaces) { +// if (resultType !== "single" && resultType !== undefined && resultType !== null) { +// throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); +// } +// +// if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { +// return context; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs, i; +// if (xpathExp.indexOf("/") != -1) { +// var items = xpathExp.split("/"); +// var isAbs = xpathExp.substring(0, 1) == "/"; +// for (i = 0; i < items.length; i++) { +// var item = items[i]; +// if (item === "") { +// continue; +// } else { +// var next = null; +// var ii = i + 1; +// for (; ii < items.length; ii++) { +// if (next === null) { +// next = items[ii]; +// } else { +// next = next + "/" + items[ii]; +// } +// } +// +// if (item == ".") { +// return this.eval(context, next, resultType); +// +// } else if (item == "..") { +// return this.eval2(context.parentNode, next, resultType); +// +// } else if (item == "*") { +// if (isAbs) { +// return this.eval2(context, next, resultType); +// +// } else { +// childs = context.childNodes; +// for (var j = 0; j < childs.length; j++) { +// var tmp = this.eval2(childs[j], next, resultType); +// if (tmp !== null) { +// return tmp; +// } +// } +// return null; +// } +// +// } else { +// if (isAbs) { +// if (context.nodeName == item) { +// return this.eval2(context, next, resultType); +// } else { +// return null; +// } +// } else { +// var child = this.getChildByName(context, item); +// if (child !== null) { +// return this.eval2(child, next, resultType); +// } else { +// return null; +// } +// +// } +// } +// +// } +// } +// +// return null; +// +// } else { +// if ("text()" == xpathExp) { +// childs = context.childNodes; +// for (i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.TEXT) { +// return childs[i]; +// } +// } +// return null; +// } else { +// return this.getChildByName(context, xpathExp); +// } +// } +// }; +// +// XML.getChildByName = function (context, name) { +// if (context === null || context === undefined || name === null || name === undefined) { +// return null; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs = context.childNodes; +// for (var i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { +// return childs[i]; +// } +// } +// +// return null; +// }; +// +// XML.appendChildren = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// if (isBefore && finded[i].firstNode) { +// this._insertBefore(finded[i], nodes, finded[i].firstNode); +// } else { +// for (var j = 0; j < nodes.length; j++) { +// finded[i].appendChild(nodes[j]); +// } +// } +// } +// return count; +// }; +// +// XML.removeNodes = function (context, xpathExp) { +// var nodes = this.eval(context, xpathExp); +// for (var i = 0; i < nodes.length; i++) { +// nodes[i].parentNode.removeChild(nodes[i]); +// } +// }; +// +// XML._insertBefore = function (parent, newchildren, refchild) { +// for (var i = 0; i < newchildren.length; i++) { +// parent.insertBefore(newchildren[i], refchild); +// } +// }; +// +// XML.insertNodes = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; +// this._insertBefore(finded[i].parentNode, nodes, refnode); +// } +// return count; +// }; +// +// XML.replaceNodes = function (context, xpathExp, nodes) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = finded[i]; +// var parent = refnode.parentNode; +// this._insertBefore(parent, nodes, refnode); +// parent.removeChild(refnode); +// } +// return count; +// }; +// +// XML.setNodeText = function (context, xpathExp, text) { +// var finded = this.eval(context, xpathExp, this.ResultType.single); +// if (finded === null) { +// return; +// } +// if (finded.nodeType == XML.Document.NodeType.ELEMENT) { +// var textNode = this.eval(finded, "./text()", this.ResultType.single); +// if (!textNode) { +// textNode = finded.ownerDocument.createTextNode(""); +// finded.appendChild(textNode); +// } +// textNode.nodeValue = text; +// } else { +// finded.nodeValue = text; +// } +// return; +// }; +// +// XML.getNodeText = function (context, xpathExp, defaultValue) { +// var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; +// if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { +// finded = this.eval(finded, "./text()", this.ResultType.single); +// } +// return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; +// }; +// +// XML.Namespaces = { +// XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", +// XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", +// XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", +// XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', +// XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', +// XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', +// XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', +// XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', +// XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', +// XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', +// XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', +// XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', +// JUSTEPSCHEMA: "http://www.justep.com/xbiz#", +// RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", +// JUSTEP: "http://www.justep.com/x5#", +// 'get': function (type) { +// type = type ? type.toLowerCase() : "string"; +// if ("string" == type) { +// return XML.Namespaces.XMLSCHEMA_STRING; +// } +// else if ("integer" == type) { +// return XML.Namespaces.XMLSCHEMA_INTEGER; +// } +// else if ("long" == type) { +// return XML.Namespaces.XMLSCHEMA_LONG; +// } +// else if ("float" == type) { +// return XML.Namespaces.XMLSCHEMA_FLOAT; +// } +// else if ("double" == type) { +// return XML.Namespaces.XMLSCHEMA_DOUBLE; +// } +// else if ("decimal" == type) { +// return XML.Namespaces.XMLSCHEMA_DECIMAL; +// } +// else if ("date" == type) { +// return XML.Namespaces.XMLSCHEMA_DATE; +// } +// else if ("time" == type) { +// return XML.Namespaces.XMLSCHEMA_TIME; +// } +// else if ("datetime" == type) { +// return XML.Namespaces.XMLSCHEMA_DATETIME; +// } +// else if ("boolean" == type) { +// return XML.Namespaces.XMLSCHEMA_BOOLEAN; +// } +// } +// }; +// })(BI); +BI.BehaviorFactory = { createBehavior: function(key, options){ var behavior; switch (key){ diff --git a/bi/polyfill.js b/bi/polyfill.js index f493c89a5..f67d79a6e 100644 --- a/bi/polyfill.js +++ b/bi/polyfill.js @@ -1,34 +1,101 @@ -if(![].indexOf){ - /** - * 检查指定的值是否在数组中 - * @param {Object} o 要检查的值 - * @return {Number} o在数组中的索引(如果不在数组中则返回-1) - */ - Array.prototype.indexOf = function (o) { - for (var i = 0, len = this.length; i < len; i++) { - if (_.isEqual(o, this[i])) { - return i; +// Production steps of ECMA-262, Edition 5, 15.4.4.14 +// Reference: http://es5.github.io/#x15.4.4.14 +if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function (searchElement, fromIndex) { + + var k; + + // 1. Let o be the result of calling ToObject passing + // the this value as the argument. + if (this == null) { + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let lenValue be the result of calling the Get + // internal method of o with the argument "length". + // 3. Let len be ToUint32(lenValue). + var len = o.length >>> 0; + + // 4. If len is 0, return -1. + if (len === 0) { + return -1; + } + + // 5. If argument fromIndex was passed let n be + // ToInteger(fromIndex); else let n be 0. + var n = fromIndex | 0; + + // 6. If n >= len, return -1. + if (n >= len) { + return -1; + } + + // 7. If n >= 0, then Let k be n. + // 8. Else, n<0, Let k be len - abs(n). + // If k is less than 0, then let k be 0. + k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); + + // 9. Repeat, while k < len + while (k < len) { + // a. Let Pk be ToString(k). + // This is implicit for LHS operands of the in operator + // b. Let kPresent be the result of calling the + // HasProperty internal method of o with argument Pk. + // This step can be combined with c + // c. If kPresent is true, then + // i. Let elementK be the result of calling the Get + // internal method of o with the argument ToString(k). + // ii. Let same be the result of applying the + // Strict Equality Comparison Algorithm to + // searchElement and elementK. + // iii. If same is true, return k. + if (k in o && o[k] === searchElement) { + return k; } + k++; } return -1; - } + }; } -if(![].lastIndexOf){ - /** - * 检查指定的值是否在数组中 - * ie67不支持数组的这个方法 - * @param {Object} o 要检查的值 - * @return {Number} o在数组中的索引(如果不在数组中则返回-1) - */ - Array.prototype.lastIndexOf = function (o) { - for (var len = this.length, i = len - 1; i >= 0; i--) { - if (_.isEqual(o, this[i])) { - return i; +if (!Array.prototype.lastIndexOf) { + Array.prototype.lastIndexOf = function (searchElement /*, fromIndex*/) { + 'use strict'; + + if (this === void 0 || this === null) { + throw new TypeError(); + } + + var n, k, + t = Object(this), + len = t.length >>> 0; + if (len === 0) { + return -1; + } + + n = len - 1; + if (arguments.length > 1) { + n = Number(arguments[1]); + if (n != n) { + n = 0; + } + else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) { + n = (n > 0 || -1) * Math.floor(Math.abs(n)); + } + } + + for (k = n >= 0 + ? Math.min(n, len - 1) + : len - Math.abs(n); k >= 0; k--) { + if (k in t && t[k] === searchElement) { + return k; } } return -1; - } -}/** + }; +} +/** * 特殊情况 * Created by wang on 15/6/23. */ @@ -60,8 +127,23 @@ window.localStorage || (window.localStorage = { clear: function () { this.items = {}; } -});//修复ie9下sort方法的bug -!function (window) { +});if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { + +} else { + Set = function () { + this.set = {} + }; + Set.prototype.has = function (key) { + return this.set[key] !== undefined; + }; + Set.prototype.add = function (key) { + this.set[key] = 1 + }; + Set.prototype.clear = function () { + this.set = {} + }; +}//修复ie9下sort方法的bug +;!function (window) { var ua = window.navigator.userAgent.toLowerCase(), reg = /msie|applewebkit.+safari/; if (reg.test(ua)) { diff --git a/bi/widget.js b/bi/widget.js index 9799dd01a..2812c570b 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -5502,6 +5502,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { var self = this, o = this.options; this.editor = BI.createWidget({ type: "bi.sign_editor", + height: o.height, value: this._alertInEditorValue(o.value), errorText: BI.i18nText("BI-Please_Input_Natural_Number"), validationChecker: function(v){ @@ -5549,7 +5550,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { el: this.bottomBtn }] }, - width: 30 + width: 23 }] }); }, @@ -14632,12 +14633,6 @@ BI.SequenceTable = BI.inherit(BI.Widget, { _populate: function () { var o = this.options; - this.sequence.attr({ - items: o.items, - header: o.header, - crossItems: o.crossItems, - crossHeader: o.crossHeader - }); if (o.showSequence === true) { this.sequence.setVisible(true); this.table.element.css("left", "60px"); diff --git a/docs/base.css b/docs/base.css index e30476362..1e6e4b8f4 100644 --- a/docs/base.css +++ b/docs/base.css @@ -873,6 +873,14 @@ li.CodeMirror-hint-active { overflow-x: hidden; overflow-y: hidden; white-space: nowrap; + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ word-break: break-word; } .bi-bubble { diff --git a/docs/base.js b/docs/base.js index 7e2f494d7..13c386850 100644 --- a/docs/base.js +++ b/docs/base.js @@ -478,6 +478,7 @@ BI.Text = BI.inherit(BI.Single, { textAlign: "left", whiteSpace: "normal", lineHeight: null, + handler: null,//如果传入handler,表示处理文字的点击事件,不是区域的 hgap: 0, vgap: 0, lgap: 0, @@ -491,39 +492,25 @@ BI.Text = BI.inherit(BI.Single, { _init: function () { BI.Text.superclass._init.apply(this, arguments); - var o = this.options; - this.text = BI.createWidget({ - type: "bi.layout", - cls: "bi-text" - }); - BI.createWidget({ - type: "bi.default", - element: this, - items: [this.text] - }); - if (BI.isKey(o.text)) { - this.setText(o.text); - } else if (BI.isKey(o.value)) { - this.setText(o.value); - } + var self = this, o = this.options; if (o.hgap + o.lgap > 0) { - this.text.element.css({ - "margin-left": o.hgap + o.lgap + "px" + this.element.css({ + "padding-left": o.hgap + o.lgap + "px" }) } if (o.hgap + o.rgap > 0) { - this.text.element.css({ - "margin-right": o.hgap + o.rgap + "px" + this.element.css({ + "padding-right": o.hgap + o.rgap + "px" }) } if (o.vgap + o.tgap > 0) { - this.text.element.css({ - "margin-top": o.vgap + o.tgap + "px" + this.element.css({ + "padding-top": o.vgap + o.tgap + "px" }) } if (o.vgap + o.bgap > 0) { - this.text.element.css({ - "margin-bottom": o.vgap + o.bgap + "px" + this.element.css({ + "padding-bottom": o.vgap + o.bgap + "px" }) } if (BI.isNumber(o.height)) { @@ -532,14 +519,31 @@ BI.Text = BI.inherit(BI.Single, { if (BI.isNumber(o.lineHeight)) { this.element.css({"lineHeight": o.lineHeight + "px"}); } - this.text.element.css({ - "textAlign": o.textAlign, - "whiteSpace": o.whiteSpace - }); this.element.css({ "textAlign": o.textAlign, "whiteSpace": o.whiteSpace }); + if (o.handler) { + this.text = BI.createWidget({ + type: "bi.layout", + tagName: 'span' + }); + this.text.element.click(function () { + o.handler(self.getValue()); + }); + BI.createWidget({ + type: "bi.default", + element: this, + items: [this.text] + }); + } else { + this.text = this; + } + if (BI.isKey(o.text)) { + this.setText(o.text); + } else if (BI.isKey(o.value)) { + this.setText(o.value); + } if (BI.isKey(o.keyword)) { this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); } @@ -803,6 +807,9 @@ BI.BasicButton = BI.inherit(BI.Single, { _trigger: function () { var o = this.options; + if(!this.isEnabled()){ + return; + } if (!this.isDisableSelected()) { this.isForceSelected() ? this.setSelected(true) : (this.isForceNotSelected() ? this.setSelected(false) : @@ -1516,7 +1523,6 @@ BI.TreeView = BI.inherit(BI.Pane, { _init: function () { BI.TreeView.superclass._init.apply(this, arguments); this._stop = false; - this.container = BI.createWidget(); this._createTree(); this.tip = BI.createWidget({ @@ -1529,7 +1535,7 @@ BI.TreeView = BI.inherit(BI.Pane, { scrollable: true, scrolly: false, element: this, - items: [this.container, this.tip] + items: [this.tip] }); }, @@ -1548,7 +1554,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }); BI.createWidget({ type: "bi.default", - element: this.container, + element: this.element, items: [this.tree] }); }, @@ -1943,6 +1949,7 @@ BI.TreeView = BI.inherit(BI.Pane, { setNode(child.children); }); } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); @@ -16341,9 +16348,9 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { BI.Button.superclass._init.apply(this, arguments); var o = this.options, self = this; if (BI.isNumber(o.height) && !o.clear && !o.block) { - this.element.css({height: o.height - 2, lineHeight: (o.height - 2) + 'px'}); + this.element.css({height: o.height + "px", lineHeight: o.height + "px"}); } else { - this.element.css({lineHeight: o.height + 'px'}); + this.element.css({lineHeight: o.height + "px"}); } if (BI.isKey(o.iconClass)) { this.icon = BI.createWidget({ @@ -16396,8 +16403,8 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) { if (o.clear === true) { this.element.addClass("clear"); } - if (o.minWidth > 2) { - this.element.css({"min-width": o.minWidth - 2 + "px"}); + if (o.minWidth > 0) { + this.element.css({"min-width": o.minWidth + "px"}); } }, diff --git a/docs/bundle.css b/docs/bundle.css new file mode 100644 index 000000000..888c2675f --- /dev/null +++ b/docs/bundle.css @@ -0,0 +1,6087 @@ +/*! normalize.css v1.0.0 | MIT License | git.io/normalize */ +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +nav, +section, +summary { + display: block; +} +audio, +canvas, +video { + display: inline-block; + *display: inline; + *zoom: 1; +} +audio:not([controls]) { + display: none; + height: 0; +} +[hidden] { + display: none; +} +html { + font-size: 100%; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; +} +html, +button, +input, +select, +textarea { + font-family: sans-serif; +} +body { + margin: 0; +} +a:focus { + outline: thin dotted; +} +a:active, +a:hover { + outline: 0; +} +h1 { + font-size: 2em; + margin: 0.67em 0; +} +h2 { + font-size: 1.5em; + margin: 0.83em 0; +} +h3 { + font-size: 1.17em; + margin: 1em 0; +} +h4 { + font-size: 1em; + margin: 1.33em 0; +} +h5 { + font-size: .83em; + margin: 1.67em 0; +} +h6 { + font-size: .75em; + margin: 2.33em 0; +} +abbr[title] { + border-bottom: 1px dotted; +} +b, +strong { + font-weight: bold; +} +blockquote { + margin: 1em 40px; +} +dfn { + font-style: italic; +} +mark { + background: #ff0; + color: #000000; +} +p, +pre { + margin: 1em 0; +} +code, +kbd, +pre, +samp { + font-family: monospace, serif; + _font-family: 'courier new', monospace; + font-size: 1em; +} +pre { + white-space: pre; + white-space: pre-wrap; + word-wrap: break-word; +} +q { + quotes: none; +} +q:before, +q:after { + content: ''; + content: none; +} +small { + font-size: 75%; +} +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} +sup { + top: -0.5em; +} +sub { + bottom: -0.25em; +} +dl, +menu, +ol, +ul { + margin: 1em 0; +} +dd { + margin: 0 0 0 40px; +} +menu, +ol, +ul { + padding: 0 0 0 40px; +} +nav ul, +nav ol { + list-style: none; + list-style-image: none; +} +img { + border: 0; + -ms-interpolation-mode: bicubic; +} +svg:not(:root) { + overflow: hidden; +} +figure { + margin: 0; +} +form { + margin: 0; +} +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} +legend { + border: 0; + padding: 0; + white-space: normal; + *margin-left: -7px; +} +button, +input, +select, +textarea { + font-size: 100%; + margin: 0; + vertical-align: baseline; + *vertical-align: middle; +} +button, +input { + line-height: normal; +} +button, +html input[type="button"], +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; + cursor: pointer; + *overflow: visible; +} +button[disabled], +input[disabled] { + cursor: default; +} +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; + padding: 0; + *height: 13px; + *width: 13px; +} +input[type="search"] { + -webkit-appearance: textfield; + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; + box-sizing: content-box; +} +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} +textarea { + overflow: auto; + vertical-align: top; +} +table { + border-collapse: collapse; + border-spacing: 0; +} +html, +body, +div, +ul, +ol, +li, +img, +a, +span, +p, +* { + margin: 0; + padding: 0; +} +a { + outline: none; + text-decoration: none; +} +a:focus { + outline: 0; +} +input, +textarea { + margin: 0; + padding: 0; + outline: none; + border: 1px solid #d4dadd; +} +.bi-theme-dark input, +.bi-theme-dark textarea { + border: 1px solid #525466; +} +ul { + list-style: disc; +} +li { + list-style-type: none; +} +i { + font-style: normal; + -webkit-font-smoothing: antialiased; + -webkit-text-stroke-width: 0.2px; + -moz-osx-font-smoothing: grayscale; +} +@charset "UTF-8"; +/*! + * animate.css -http://daneden.me/animate + * Version - 3.5.1 + * Licensed under the MIT license - http://opensource.org/licenses/MIT + * + * Copyright (c) 2016 Daniel Eden + */ +@-webkit-keyframes bounce { + from, + 20%, + 53%, + 80%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + 40%, + 43% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + -webkit-transform: translate3d(0, -30px, 0); + transform: translate3d(0, -30px, 0); + } + 70% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + -webkit-transform: translate3d(0, -15px, 0); + transform: translate3d(0, -15px, 0); + } + 90% { + -webkit-transform: translate3d(0, -4px, 0); + transform: translate3d(0, -4px, 0); + } +} +@keyframes bounce { + from, + 20%, + 53%, + 80%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + 40%, + 43% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + -webkit-transform: translate3d(0, -30px, 0); + transform: translate3d(0, -30px, 0); + } + 70% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + -webkit-transform: translate3d(0, -15px, 0); + transform: translate3d(0, -15px, 0); + } + 90% { + -webkit-transform: translate3d(0, -4px, 0); + transform: translate3d(0, -4px, 0); + } +} +@-webkit-keyframes flash { + from, + 50%, + to { + opacity: 1; + } + 25%, + 75% { + opacity: 0; + } +} +@keyframes flash { + from, + 50%, + to { + opacity: 1; + } + 25%, + 75% { + opacity: 0; + } +} +/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */ +@-webkit-keyframes pulse { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + 50% { + -webkit-transform: scale3d(1.05, 1.05, 1.05); + transform: scale3d(1.05, 1.05, 1.05); + } + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} +@keyframes pulse { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + 50% { + -webkit-transform: scale3d(1.05, 1.05, 1.05); + transform: scale3d(1.05, 1.05, 1.05); + } + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} +@-webkit-keyframes rubberBand { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + 30% { + -webkit-transform: scale3d(1.25, 0.75, 1); + transform: scale3d(1.25, 0.75, 1); + } + 40% { + -webkit-transform: scale3d(0.75, 1.25, 1); + transform: scale3d(0.75, 1.25, 1); + } + 50% { + -webkit-transform: scale3d(1.15, 0.85, 1); + transform: scale3d(1.15, 0.85, 1); + } + 65% { + -webkit-transform: scale3d(0.95, 1.05, 1); + transform: scale3d(0.95, 1.05, 1); + } + 75% { + -webkit-transform: scale3d(1.05, 0.95, 1); + transform: scale3d(1.05, 0.95, 1); + } + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} +@keyframes rubberBand { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + 30% { + -webkit-transform: scale3d(1.25, 0.75, 1); + transform: scale3d(1.25, 0.75, 1); + } + 40% { + -webkit-transform: scale3d(0.75, 1.25, 1); + transform: scale3d(0.75, 1.25, 1); + } + 50% { + -webkit-transform: scale3d(1.15, 0.85, 1); + transform: scale3d(1.15, 0.85, 1); + } + 65% { + -webkit-transform: scale3d(0.95, 1.05, 1); + transform: scale3d(0.95, 1.05, 1); + } + 75% { + -webkit-transform: scale3d(1.05, 0.95, 1); + transform: scale3d(1.05, 0.95, 1); + } + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} +@-webkit-keyframes shake { + from, + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + 10%, + 30%, + 50%, + 70%, + 90% { + -webkit-transform: translate3d(-10px, 0, 0); + transform: translate3d(-10px, 0, 0); + } + 20%, + 40%, + 60%, + 80% { + -webkit-transform: translate3d(10px, 0, 0); + transform: translate3d(10px, 0, 0); + } +} +@keyframes shake { + from, + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + 10%, + 30%, + 50%, + 70%, + 90% { + -webkit-transform: translate3d(-10px, 0, 0); + transform: translate3d(-10px, 0, 0); + } + 20%, + 40%, + 60%, + 80% { + -webkit-transform: translate3d(10px, 0, 0); + transform: translate3d(10px, 0, 0); + } +} +@-webkit-keyframes headShake { + 0% { + -webkit-transform: translateX(0); + transform: translateX(0); + } + 6.5% { + -webkit-transform: translateX(-6px) rotateY(-9deg); + transform: translateX(-6px) rotateY(-9deg); + } + 18.5% { + -webkit-transform: translateX(5px) rotateY(7deg); + transform: translateX(5px) rotateY(7deg); + } + 31.5% { + -webkit-transform: translateX(-3px) rotateY(-5deg); + transform: translateX(-3px) rotateY(-5deg); + } + 43.5% { + -webkit-transform: translateX(2px) rotateY(3deg); + transform: translateX(2px) rotateY(3deg); + } + 50% { + -webkit-transform: translateX(0); + transform: translateX(0); + } +} +@keyframes headShake { + 0% { + -webkit-transform: translateX(0); + transform: translateX(0); + } + 6.5% { + -webkit-transform: translateX(-6px) rotateY(-9deg); + transform: translateX(-6px) rotateY(-9deg); + } + 18.5% { + -webkit-transform: translateX(5px) rotateY(7deg); + transform: translateX(5px) rotateY(7deg); + } + 31.5% { + -webkit-transform: translateX(-3px) rotateY(-5deg); + transform: translateX(-3px) rotateY(-5deg); + } + 43.5% { + -webkit-transform: translateX(2px) rotateY(3deg); + transform: translateX(2px) rotateY(3deg); + } + 50% { + -webkit-transform: translateX(0); + transform: translateX(0); + } +} +@-webkit-keyframes swing { + 20% { + -webkit-transform: rotate3d(0, 0, 1, 15deg); + transform: rotate3d(0, 0, 1, 15deg); + } + 40% { + -webkit-transform: rotate3d(0, 0, 1, -10deg); + transform: rotate3d(0, 0, 1, -10deg); + } + 60% { + -webkit-transform: rotate3d(0, 0, 1, 5deg); + transform: rotate3d(0, 0, 1, 5deg); + } + 80% { + -webkit-transform: rotate3d(0, 0, 1, -5deg); + transform: rotate3d(0, 0, 1, -5deg); + } + to { + -webkit-transform: rotate3d(0, 0, 1, 0deg); + transform: rotate3d(0, 0, 1, 0deg); + } +} +@keyframes swing { + 20% { + -webkit-transform: rotate3d(0, 0, 1, 15deg); + transform: rotate3d(0, 0, 1, 15deg); + } + 40% { + -webkit-transform: rotate3d(0, 0, 1, -10deg); + transform: rotate3d(0, 0, 1, -10deg); + } + 60% { + -webkit-transform: rotate3d(0, 0, 1, 5deg); + transform: rotate3d(0, 0, 1, 5deg); + } + 80% { + -webkit-transform: rotate3d(0, 0, 1, -5deg); + transform: rotate3d(0, 0, 1, -5deg); + } + to { + -webkit-transform: rotate3d(0, 0, 1, 0deg); + transform: rotate3d(0, 0, 1, 0deg); + } +} +@-webkit-keyframes tada { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + 10%, + 20% { + -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); + transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); + } + 30%, + 50%, + 70%, + 90% { + -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); + transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); + } + 40%, + 60%, + 80% { + -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); + transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); + } + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} +@keyframes tada { + from { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } + 10%, + 20% { + -webkit-transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); + transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); + } + 30%, + 50%, + 70%, + 90% { + -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); + transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); + } + 40%, + 60%, + 80% { + -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); + transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); + } + to { + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} +/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */ +@-webkit-keyframes wobble { + from { + -webkit-transform: none; + transform: none; + } + 15% { + -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); + transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); + } + 30% { + -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); + transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); + } + 45% { + -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); + transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); + } + 60% { + -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); + transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); + } + 75% { + -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); + transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); + } + to { + -webkit-transform: none; + transform: none; + } +} +@keyframes wobble { + from { + -webkit-transform: none; + transform: none; + } + 15% { + -webkit-transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); + transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); + } + 30% { + -webkit-transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); + transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); + } + 45% { + -webkit-transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); + transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); + } + 60% { + -webkit-transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); + transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); + } + 75% { + -webkit-transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); + transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); + } + to { + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes jello { + from, + 11.1%, + to { + -webkit-transform: none; + transform: none; + } + 22.2% { + -webkit-transform: skewX(-12.5deg) skewY(-12.5deg); + transform: skewX(-12.5deg) skewY(-12.5deg); + } + 33.3% { + -webkit-transform: skewX(6.25deg) skewY(6.25deg); + transform: skewX(6.25deg) skewY(6.25deg); + } + 44.4% { + -webkit-transform: skewX(-3.125deg) skewY(-3.125deg); + transform: skewX(-3.125deg) skewY(-3.125deg); + } + 55.5% { + -webkit-transform: skewX(1.5625deg) skewY(1.5625deg); + transform: skewX(1.5625deg) skewY(1.5625deg); + } + 66.6% { + -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg); + transform: skewX(-0.78125deg) skewY(-0.78125deg); + } + 77.7% { + -webkit-transform: skewX(0.390625deg) skewY(0.390625deg); + transform: skewX(0.390625deg) skewY(0.390625deg); + } + 88.8% { + -webkit-transform: skewX(-0.1953125deg) skewY(-0.1953125deg); + transform: skewX(-0.1953125deg) skewY(-0.1953125deg); + } +} +@keyframes jello { + from, + 11.1%, + to { + -webkit-transform: none; + transform: none; + } + 22.2% { + -webkit-transform: skewX(-12.5deg) skewY(-12.5deg); + transform: skewX(-12.5deg) skewY(-12.5deg); + } + 33.3% { + -webkit-transform: skewX(6.25deg) skewY(6.25deg); + transform: skewX(6.25deg) skewY(6.25deg); + } + 44.4% { + -webkit-transform: skewX(-3.125deg) skewY(-3.125deg); + transform: skewX(-3.125deg) skewY(-3.125deg); + } + 55.5% { + -webkit-transform: skewX(1.5625deg) skewY(1.5625deg); + transform: skewX(1.5625deg) skewY(1.5625deg); + } + 66.6% { + -webkit-transform: skewX(-0.78125deg) skewY(-0.78125deg); + transform: skewX(-0.78125deg) skewY(-0.78125deg); + } + 77.7% { + -webkit-transform: skewX(0.390625deg) skewY(0.390625deg); + transform: skewX(0.390625deg) skewY(0.390625deg); + } + 88.8% { + -webkit-transform: skewX(-0.1953125deg) skewY(-0.1953125deg); + transform: skewX(-0.1953125deg) skewY(-0.1953125deg); + } +} +@-webkit-keyframes bounceIn { + from, + 20%, + 40%, + 60%, + 80%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + 0% { + opacity: 0; + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + } + 20% { + -webkit-transform: scale3d(1.1, 1.1, 1.1); + transform: scale3d(1.1, 1.1, 1.1); + } + 40% { + -webkit-transform: scale3d(0.9, 0.9, 0.9); + transform: scale3d(0.9, 0.9, 0.9); + } + 60% { + opacity: 1; + -webkit-transform: scale3d(1.03, 1.03, 1.03); + transform: scale3d(1.03, 1.03, 1.03); + } + 80% { + -webkit-transform: scale3d(0.97, 0.97, 0.97); + transform: scale3d(0.97, 0.97, 0.97); + } + to { + opacity: 1; + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} +@keyframes bounceIn { + from, + 20%, + 40%, + 60%, + 80%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + 0% { + opacity: 0; + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + } + 20% { + -webkit-transform: scale3d(1.1, 1.1, 1.1); + transform: scale3d(1.1, 1.1, 1.1); + } + 40% { + -webkit-transform: scale3d(0.9, 0.9, 0.9); + transform: scale3d(0.9, 0.9, 0.9); + } + 60% { + opacity: 1; + -webkit-transform: scale3d(1.03, 1.03, 1.03); + transform: scale3d(1.03, 1.03, 1.03); + } + 80% { + -webkit-transform: scale3d(0.97, 0.97, 0.97); + transform: scale3d(0.97, 0.97, 0.97); + } + to { + opacity: 1; + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} +@-webkit-keyframes bounceInDown { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + 0% { + opacity: 0; + -webkit-transform: translate3d(0, -3000px, 0); + transform: translate3d(0, -3000px, 0); + } + 60% { + opacity: 1; + -webkit-transform: translate3d(0, 25px, 0); + transform: translate3d(0, 25px, 0); + } + 75% { + -webkit-transform: translate3d(0, -10px, 0); + transform: translate3d(0, -10px, 0); + } + 90% { + -webkit-transform: translate3d(0, 5px, 0); + transform: translate3d(0, 5px, 0); + } + to { + -webkit-transform: none; + transform: none; + } +} +@keyframes bounceInDown { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + 0% { + opacity: 0; + -webkit-transform: translate3d(0, -3000px, 0); + transform: translate3d(0, -3000px, 0); + } + 60% { + opacity: 1; + -webkit-transform: translate3d(0, 25px, 0); + transform: translate3d(0, 25px, 0); + } + 75% { + -webkit-transform: translate3d(0, -10px, 0); + transform: translate3d(0, -10px, 0); + } + 90% { + -webkit-transform: translate3d(0, 5px, 0); + transform: translate3d(0, 5px, 0); + } + to { + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes bounceInLeft { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + 0% { + opacity: 0; + -webkit-transform: translate3d(-3000px, 0, 0); + transform: translate3d(-3000px, 0, 0); + } + 60% { + opacity: 1; + -webkit-transform: translate3d(25px, 0, 0); + transform: translate3d(25px, 0, 0); + } + 75% { + -webkit-transform: translate3d(-10px, 0, 0); + transform: translate3d(-10px, 0, 0); + } + 90% { + -webkit-transform: translate3d(5px, 0, 0); + transform: translate3d(5px, 0, 0); + } + to { + -webkit-transform: none; + transform: none; + } +} +@keyframes bounceInLeft { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + 0% { + opacity: 0; + -webkit-transform: translate3d(-3000px, 0, 0); + transform: translate3d(-3000px, 0, 0); + } + 60% { + opacity: 1; + -webkit-transform: translate3d(25px, 0, 0); + transform: translate3d(25px, 0, 0); + } + 75% { + -webkit-transform: translate3d(-10px, 0, 0); + transform: translate3d(-10px, 0, 0); + } + 90% { + -webkit-transform: translate3d(5px, 0, 0); + transform: translate3d(5px, 0, 0); + } + to { + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes bounceInRight { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + from { + opacity: 0; + -webkit-transform: translate3d(3000px, 0, 0); + transform: translate3d(3000px, 0, 0); + } + 60% { + opacity: 1; + -webkit-transform: translate3d(-25px, 0, 0); + transform: translate3d(-25px, 0, 0); + } + 75% { + -webkit-transform: translate3d(10px, 0, 0); + transform: translate3d(10px, 0, 0); + } + 90% { + -webkit-transform: translate3d(-5px, 0, 0); + transform: translate3d(-5px, 0, 0); + } + to { + -webkit-transform: none; + transform: none; + } +} +@keyframes bounceInRight { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + from { + opacity: 0; + -webkit-transform: translate3d(3000px, 0, 0); + transform: translate3d(3000px, 0, 0); + } + 60% { + opacity: 1; + -webkit-transform: translate3d(-25px, 0, 0); + transform: translate3d(-25px, 0, 0); + } + 75% { + -webkit-transform: translate3d(10px, 0, 0); + transform: translate3d(10px, 0, 0); + } + 90% { + -webkit-transform: translate3d(-5px, 0, 0); + transform: translate3d(-5px, 0, 0); + } + to { + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes bounceInUp { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + from { + opacity: 0; + -webkit-transform: translate3d(0, 3000px, 0); + transform: translate3d(0, 3000px, 0); + } + 60% { + opacity: 1; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + 75% { + -webkit-transform: translate3d(0, 10px, 0); + transform: translate3d(0, 10px, 0); + } + 90% { + -webkit-transform: translate3d(0, -5px, 0); + transform: translate3d(0, -5px, 0); + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@keyframes bounceInUp { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + from { + opacity: 0; + -webkit-transform: translate3d(0, 3000px, 0); + transform: translate3d(0, 3000px, 0); + } + 60% { + opacity: 1; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + 75% { + -webkit-transform: translate3d(0, 10px, 0); + transform: translate3d(0, 10px, 0); + } + 90% { + -webkit-transform: translate3d(0, -5px, 0); + transform: translate3d(0, -5px, 0); + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@-webkit-keyframes bounceOut { + 20% { + -webkit-transform: scale3d(0.9, 0.9, 0.9); + transform: scale3d(0.9, 0.9, 0.9); + } + 50%, + 55% { + opacity: 1; + -webkit-transform: scale3d(1.1, 1.1, 1.1); + transform: scale3d(1.1, 1.1, 1.1); + } + to { + opacity: 0; + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + } +} +@keyframes bounceOut { + 20% { + -webkit-transform: scale3d(0.9, 0.9, 0.9); + transform: scale3d(0.9, 0.9, 0.9); + } + 50%, + 55% { + opacity: 1; + -webkit-transform: scale3d(1.1, 1.1, 1.1); + transform: scale3d(1.1, 1.1, 1.1); + } + to { + opacity: 0; + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + } +} +@-webkit-keyframes bounceOutDown { + 20% { + -webkit-transform: translate3d(0, 10px, 0); + transform: translate3d(0, 10px, 0); + } + 40%, + 45% { + opacity: 1; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } +} +@keyframes bounceOutDown { + 20% { + -webkit-transform: translate3d(0, 10px, 0); + transform: translate3d(0, 10px, 0); + } + 40%, + 45% { + opacity: 1; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + to { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } +} +@-webkit-keyframes bounceOutLeft { + 20% { + opacity: 1; + -webkit-transform: translate3d(20px, 0, 0); + transform: translate3d(20px, 0, 0); + } + to { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } +} +@keyframes bounceOutLeft { + 20% { + opacity: 1; + -webkit-transform: translate3d(20px, 0, 0); + transform: translate3d(20px, 0, 0); + } + to { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } +} +@-webkit-keyframes bounceOutRight { + 20% { + opacity: 1; + -webkit-transform: translate3d(-20px, 0, 0); + transform: translate3d(-20px, 0, 0); + } + to { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } +} +@keyframes bounceOutRight { + 20% { + opacity: 1; + -webkit-transform: translate3d(-20px, 0, 0); + transform: translate3d(-20px, 0, 0); + } + to { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } +} +@-webkit-keyframes bounceOutUp { + 20% { + -webkit-transform: translate3d(0, -10px, 0); + transform: translate3d(0, -10px, 0); + } + 40%, + 45% { + opacity: 1; + -webkit-transform: translate3d(0, 20px, 0); + transform: translate3d(0, 20px, 0); + } + to { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } +} +@keyframes bounceOutUp { + 20% { + -webkit-transform: translate3d(0, -10px, 0); + transform: translate3d(0, -10px, 0); + } + 40%, + 45% { + opacity: 1; + -webkit-transform: translate3d(0, 20px, 0); + transform: translate3d(0, 20px, 0); + } + to { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } +} +@-webkit-keyframes fadeIn { + from { + opacity: 0; + } + to { + opacity: 1; + } +} +@keyframes fadeIn { + from { + opacity: 0; + } + to { + opacity: 1; + } +} +@-webkit-keyframes fadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@keyframes fadeInDown { + from { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes fadeInDownBig { + from { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@keyframes fadeInDownBig { + from { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes fadeInLeft { + from { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@keyframes fadeInLeft { + from { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes fadeInLeftBig { + from { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@keyframes fadeInLeftBig { + from { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes fadeInRight { + from { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@keyframes fadeInRight { + from { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes fadeInRightBig { + from { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@keyframes fadeInRightBig { + from { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes fadeInUp { + from { + opacity: 0; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@keyframes fadeInUp { + from { + opacity: 0; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes fadeInUpBig { + from { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@keyframes fadeInUpBig { + from { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@-webkit-keyframes fadeOut { + from { + opacity: 1; + } + to { + opacity: 0; + } +} +@keyframes fadeOut { + from { + opacity: 1; + } + to { + opacity: 0; + } +} +@-webkit-keyframes fadeOutDown { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } +} +@keyframes fadeOutDown { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } +} +@-webkit-keyframes fadeOutDownBig { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } +} +@keyframes fadeOutDownBig { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(0, 2000px, 0); + transform: translate3d(0, 2000px, 0); + } +} +@-webkit-keyframes fadeOutLeft { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } +} +@keyframes fadeOutLeft { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } +} +@-webkit-keyframes fadeOutLeftBig { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } +} +@keyframes fadeOutLeftBig { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(-2000px, 0, 0); + transform: translate3d(-2000px, 0, 0); + } +} +@-webkit-keyframes fadeOutRight { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } +} +@keyframes fadeOutRight { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } +} +@-webkit-keyframes fadeOutRightBig { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } +} +@keyframes fadeOutRightBig { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(2000px, 0, 0); + transform: translate3d(2000px, 0, 0); + } +} +@-webkit-keyframes fadeOutUp { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } +} +@keyframes fadeOutUp { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } +} +@-webkit-keyframes fadeOutUpBig { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } +} +@keyframes fadeOutUpBig { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(0, -2000px, 0); + transform: translate3d(0, -2000px, 0); + } +} +@-webkit-keyframes flip { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg); + transform: perspective(400px) rotate3d(0, 1, 0, -360deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 40% { + -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg); + transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 50% { + -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg); + transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 80% { + -webkit-transform: perspective(400px) scale3d(0.95, 0.95, 0.95); + transform: perspective(400px) scale3d(0.95, 0.95, 0.95); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@keyframes flip { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg); + transform: perspective(400px) rotate3d(0, 1, 0, -360deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 40% { + -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg); + transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg); + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; + } + 50% { + -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg); + transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 80% { + -webkit-transform: perspective(400px) scale3d(0.95, 0.95, 0.95); + transform: perspective(400px) scale3d(0.95, 0.95, 0.95); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } +} +@-webkit-keyframes flipInX { + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + opacity: 0; + } + 40% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 60% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + opacity: 1; + } + 80% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + } + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} +@keyframes flipInX { + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + opacity: 0; + } + 40% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 60% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + opacity: 1; + } + 80% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + } + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} +@-webkit-keyframes flipInY { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + opacity: 0; + } + 40% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 60% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + opacity: 1; + } + 80% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + } + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} +@keyframes flipInY { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + opacity: 0; + } + 40% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; + } + 60% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + opacity: 1; + } + 80% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + } + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} +@-webkit-keyframes flipOutX { + from { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } + 30% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + opacity: 1; + } + to { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + opacity: 0; + } +} +@keyframes flipOutX { + from { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } + 30% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + opacity: 1; + } + to { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + opacity: 0; + } +} +@-webkit-keyframes flipOutY { + from { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } + 30% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg); + transform: perspective(400px) rotate3d(0, 1, 0, -15deg); + opacity: 1; + } + to { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + opacity: 0; + } +} +@keyframes flipOutY { + from { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } + 30% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -15deg); + transform: perspective(400px) rotate3d(0, 1, 0, -15deg); + opacity: 1; + } + to { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + opacity: 0; + } +} +@-webkit-keyframes lightSpeedIn { + from { + -webkit-transform: translate3d(100%, 0, 0) skewX(-30deg); + transform: translate3d(100%, 0, 0) skewX(-30deg); + opacity: 0; + } + 60% { + -webkit-transform: skewX(20deg); + transform: skewX(20deg); + opacity: 1; + } + 80% { + -webkit-transform: skewX(-5deg); + transform: skewX(-5deg); + opacity: 1; + } + to { + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@keyframes lightSpeedIn { + from { + -webkit-transform: translate3d(100%, 0, 0) skewX(-30deg); + transform: translate3d(100%, 0, 0) skewX(-30deg); + opacity: 0; + } + 60% { + -webkit-transform: skewX(20deg); + transform: skewX(20deg); + opacity: 1; + } + 80% { + -webkit-transform: skewX(-5deg); + transform: skewX(-5deg); + opacity: 1; + } + to { + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@-webkit-keyframes lightSpeedOut { + from { + opacity: 1; + } + to { + -webkit-transform: translate3d(100%, 0, 0) skewX(30deg); + transform: translate3d(100%, 0, 0) skewX(30deg); + opacity: 0; + } +} +@keyframes lightSpeedOut { + from { + opacity: 1; + } + to { + -webkit-transform: translate3d(100%, 0, 0) skewX(30deg); + transform: translate3d(100%, 0, 0) skewX(30deg); + opacity: 0; + } +} +@-webkit-keyframes rotateIn { + from { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: rotate3d(0, 0, 1, -200deg); + transform: rotate3d(0, 0, 1, -200deg); + opacity: 0; + } + to { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@keyframes rotateIn { + from { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: rotate3d(0, 0, 1, -200deg); + transform: rotate3d(0, 0, 1, -200deg); + opacity: 0; + } + to { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@-webkit-keyframes rotateInDownLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@keyframes rotateInDownLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@-webkit-keyframes rotateInDownRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@keyframes rotateInDownRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@-webkit-keyframes rotateInUpLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@keyframes rotateInUpLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@-webkit-keyframes rotateInUpRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, -90deg); + transform: rotate3d(0, 0, 1, -90deg); + opacity: 0; + } + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@keyframes rotateInUpRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, -90deg); + transform: rotate3d(0, 0, 1, -90deg); + opacity: 0; + } + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: none; + transform: none; + opacity: 1; + } +} +@-webkit-keyframes rotateOut { + from { + -webkit-transform-origin: center; + transform-origin: center; + opacity: 1; + } + to { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: rotate3d(0, 0, 1, 200deg); + transform: rotate3d(0, 0, 1, 200deg); + opacity: 0; + } +} +@keyframes rotateOut { + from { + -webkit-transform-origin: center; + transform-origin: center; + opacity: 1; + } + to { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: rotate3d(0, 0, 1, 200deg); + transform: rotate3d(0, 0, 1, 200deg); + opacity: 0; + } +} +@-webkit-keyframes rotateOutDownLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + opacity: 1; + } + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } +} +@keyframes rotateOutDownLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + opacity: 1; + } + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } +} +@-webkit-keyframes rotateOutDownRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + opacity: 1; + } + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } +} +@keyframes rotateOutDownRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + opacity: 1; + } + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } +} +@-webkit-keyframes rotateOutUpLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + opacity: 1; + } + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } +} +@keyframes rotateOutUpLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + opacity: 1; + } + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } +} +@-webkit-keyframes rotateOutUpRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + opacity: 1; + } + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, 90deg); + transform: rotate3d(0, 0, 1, 90deg); + opacity: 0; + } +} +@keyframes rotateOutUpRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + opacity: 1; + } + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, 90deg); + transform: rotate3d(0, 0, 1, 90deg); + opacity: 0; + } +} +@-webkit-keyframes hinge { + 0% { + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + } + 20%, + 60% { + -webkit-transform: rotate3d(0, 0, 1, 80deg); + transform: rotate3d(0, 0, 1, 80deg); + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + } + 40%, + 80% { + -webkit-transform: rotate3d(0, 0, 1, 60deg); + transform: rotate3d(0, 0, 1, 60deg); + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + opacity: 1; + } + to { + -webkit-transform: translate3d(0, 700px, 0); + transform: translate3d(0, 700px, 0); + opacity: 0; + } +} +@keyframes hinge { + 0% { + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + } + 20%, + 60% { + -webkit-transform: rotate3d(0, 0, 1, 80deg); + transform: rotate3d(0, 0, 1, 80deg); + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + } + 40%, + 80% { + -webkit-transform: rotate3d(0, 0, 1, 60deg); + transform: rotate3d(0, 0, 1, 60deg); + -webkit-transform-origin: top left; + transform-origin: top left; + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + opacity: 1; + } + to { + -webkit-transform: translate3d(0, 700px, 0); + transform: translate3d(0, 700px, 0); + opacity: 0; + } +} +/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */ +@-webkit-keyframes rollIn { + from { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); + transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +@keyframes rollIn { + from { + opacity: 0; + -webkit-transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); + transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); + } + to { + opacity: 1; + -webkit-transform: none; + transform: none; + } +} +/* originally authored by Nick Pettit - https://github.com/nickpettit/glide */ +@-webkit-keyframes rollOut { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); + transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); + } +} +@keyframes rollOut { + from { + opacity: 1; + } + to { + opacity: 0; + -webkit-transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); + transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); + } +} +@-webkit-keyframes zoomIn { + from { + opacity: 0; + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + } + 50% { + opacity: 1; + } +} +@keyframes zoomIn { + from { + opacity: 0; + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + } + 50% { + opacity: 1; + } +} +@-webkit-keyframes zoomInDown { + from { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + 60% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@keyframes zoomInDown { + from { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + 60% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@-webkit-keyframes zoomInLeft { + from { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + 60% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@keyframes zoomInLeft { + from { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + 60% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@-webkit-keyframes zoomInRight { + from { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + 60% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@keyframes zoomInRight { + from { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + 60% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@-webkit-keyframes zoomInUp { + from { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + 60% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@keyframes zoomInUp { + from { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + 60% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@-webkit-keyframes zoomOut { + from { + opacity: 1; + } + 50% { + opacity: 0; + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + } + to { + opacity: 0; + } +} +@keyframes zoomOut { + from { + opacity: 1; + } + 50% { + opacity: 0; + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + } + to { + opacity: 0; + } +} +@-webkit-keyframes zoomOutDown { + 40% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + to { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0); + -webkit-transform-origin: center bottom; + transform-origin: center bottom; + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@keyframes zoomOutDown { + 40% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + to { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0); + -webkit-transform-origin: center bottom; + transform-origin: center bottom; + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@-webkit-keyframes zoomOutLeft { + 40% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); + } + to { + opacity: 0; + -webkit-transform: scale(0.1) translate3d(-2000px, 0, 0); + transform: scale(0.1) translate3d(-2000px, 0, 0); + -webkit-transform-origin: left center; + transform-origin: left center; + } +} +@keyframes zoomOutLeft { + 40% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); + } + to { + opacity: 0; + -webkit-transform: scale(0.1) translate3d(-2000px, 0, 0); + transform: scale(0.1) translate3d(-2000px, 0, 0); + -webkit-transform-origin: left center; + transform-origin: left center; + } +} +@-webkit-keyframes zoomOutRight { + 40% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); + } + to { + opacity: 0; + -webkit-transform: scale(0.1) translate3d(2000px, 0, 0); + transform: scale(0.1) translate3d(2000px, 0, 0); + -webkit-transform-origin: right center; + transform-origin: right center; + } +} +@keyframes zoomOutRight { + 40% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); + } + to { + opacity: 0; + -webkit-transform: scale(0.1) translate3d(2000px, 0, 0); + transform: scale(0.1) translate3d(2000px, 0, 0); + -webkit-transform-origin: right center; + transform-origin: right center; + } +} +@-webkit-keyframes zoomOutUp { + 40% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + to { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); + -webkit-transform-origin: center bottom; + transform-origin: center bottom; + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@keyframes zoomOutUp { + 40% { + opacity: 1; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + } + to { + opacity: 0; + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); + -webkit-transform-origin: center bottom; + transform-origin: center bottom; + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} +@-webkit-keyframes slideInDown { + from { + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + visibility: visible; + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@keyframes slideInDown { + from { + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + visibility: visible; + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@-webkit-keyframes slideInLeft { + from { + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + visibility: visible; + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@keyframes slideInLeft { + from { + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + visibility: visible; + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@-webkit-keyframes slideInRight { + from { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + visibility: visible; + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@keyframes slideInRight { + from { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + visibility: visible; + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@-webkit-keyframes slideInUp { + from { + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + visibility: visible; + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@keyframes slideInUp { + from { + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + visibility: visible; + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} +@-webkit-keyframes slideOutDown { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + to { + visibility: hidden; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } +} +@keyframes slideOutDown { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + to { + visibility: hidden; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } +} +@-webkit-keyframes slideOutLeft { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + to { + visibility: hidden; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } +} +@keyframes slideOutLeft { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + to { + visibility: hidden; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } +} +@-webkit-keyframes slideOutRight { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + to { + visibility: hidden; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } +} +@keyframes slideOutRight { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + to { + visibility: hidden; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } +} +@-webkit-keyframes slideOutUp { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + to { + visibility: hidden; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } +} +@keyframes slideOutUp { + from { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + to { + visibility: hidden; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } +} +.animated { + -webkit-animation-duration: 1s; + animation-duration: 1s; + -webkit-animation-fill-mode: both; + animation-fill-mode: both; +} +.animated.infinite { + -webkit-animation-iteration-count: infinite; + animation-iteration-count: infinite; +} +.bounce { + -webkit-animation-name: bounce; + animation-name: bounce; + -webkit-transform-origin: center bottom; + transform-origin: center bottom; +} +.flash { + -webkit-animation-name: flash; + animation-name: flash; +} +.pulse { + -webkit-animation-name: pulse; + animation-name: pulse; +} +.rubberBand { + -webkit-animation-name: rubberBand; + animation-name: rubberBand; +} +.shake { + -webkit-animation-name: shake; + animation-name: shake; +} +.headShake { + -webkit-animation-timing-function: ease-in-out; + animation-timing-function: ease-in-out; + -webkit-animation-name: headShake; + animation-name: headShake; +} +.swing { + -webkit-transform-origin: top center; + transform-origin: top center; + -webkit-animation-name: swing; + animation-name: swing; +} +.tada { + -webkit-animation-name: tada; + animation-name: tada; +} +.jello { + -webkit-animation-name: jello; + animation-name: jello; + -webkit-transform-origin: center; + transform-origin: center; +} +.bounceIn { + -webkit-animation-duration: .75s; + animation-duration: .75s; + -webkit-animation-name: bounceIn; + animation-name: bounceIn; +} +.bounceInDown { + -webkit-animation-name: bounceInDown; + animation-name: bounceInDown; +} +.bounceInLeft { + -webkit-animation-name: bounceInLeft; + animation-name: bounceInLeft; +} +.bounceInRight { + -webkit-animation-name: bounceInRight; + animation-name: bounceInRight; +} +.bounceInUp { + -webkit-animation-name: bounceInUp; + animation-name: bounceInUp; +} +.bounceOut { + -webkit-animation-duration: .75s; + animation-duration: .75s; + -webkit-animation-name: bounceOut; + animation-name: bounceOut; +} +.bounceOutDown { + -webkit-animation-name: bounceOutDown; + animation-name: bounceOutDown; +} +.bounceOutLeft { + -webkit-animation-name: bounceOutLeft; + animation-name: bounceOutLeft; +} +.bounceOutRight { + -webkit-animation-name: bounceOutRight; + animation-name: bounceOutRight; +} +.bounceOutUp { + -webkit-animation-name: bounceOutUp; + animation-name: bounceOutUp; +} +.fadeIn { + -webkit-animation-name: fadeIn; + animation-name: fadeIn; +} +.fadeInDown { + -webkit-animation-name: fadeInDown; + animation-name: fadeInDown; +} +.fadeInDownBig { + -webkit-animation-name: fadeInDownBig; + animation-name: fadeInDownBig; +} +.fadeInLeft { + -webkit-animation-name: fadeInLeft; + animation-name: fadeInLeft; +} +.fadeInLeftBig { + -webkit-animation-name: fadeInLeftBig; + animation-name: fadeInLeftBig; +} +.fadeInRight { + -webkit-animation-name: fadeInRight; + animation-name: fadeInRight; +} +.fadeInRightBig { + -webkit-animation-name: fadeInRightBig; + animation-name: fadeInRightBig; +} +.fadeInUp { + -webkit-animation-name: fadeInUp; + animation-name: fadeInUp; +} +.fadeInUpBig { + -webkit-animation-name: fadeInUpBig; + animation-name: fadeInUpBig; +} +.fadeOut { + -webkit-animation-name: fadeOut; + animation-name: fadeOut; +} +.fadeOutDown { + -webkit-animation-name: fadeOutDown; + animation-name: fadeOutDown; +} +.fadeOutDownBig { + -webkit-animation-name: fadeOutDownBig; + animation-name: fadeOutDownBig; +} +.fadeOutLeft { + -webkit-animation-name: fadeOutLeft; + animation-name: fadeOutLeft; +} +.fadeOutLeftBig { + -webkit-animation-name: fadeOutLeftBig; + animation-name: fadeOutLeftBig; +} +.fadeOutRight { + -webkit-animation-name: fadeOutRight; + animation-name: fadeOutRight; +} +.fadeOutRightBig { + -webkit-animation-name: fadeOutRightBig; + animation-name: fadeOutRightBig; +} +.fadeOutUp { + -webkit-animation-name: fadeOutUp; + animation-name: fadeOutUp; +} +.fadeOutUpBig { + -webkit-animation-name: fadeOutUpBig; + animation-name: fadeOutUpBig; +} +.flip { + -webkit-backface-visibility: visible; + backface-visibility: visible; + -webkit-animation-name: flip; + animation-name: flip; +} +.flipInX { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipInX; + animation-name: flipInX; +} +.flipInY { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipInY; + animation-name: flipInY; +} +.flipOutX { + -webkit-animation-duration: .75s; + animation-duration: .75s; + -webkit-animation-name: flipOutX; + animation-name: flipOutX; + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; +} +.flipOutY { + -webkit-animation-duration: .75s; + animation-duration: .75s; + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipOutY; + animation-name: flipOutY; +} +.lightSpeedIn { + -webkit-animation-name: lightSpeedIn; + animation-name: lightSpeedIn; + -webkit-animation-timing-function: ease-out; + animation-timing-function: ease-out; +} +.lightSpeedOut { + -webkit-animation-name: lightSpeedOut; + animation-name: lightSpeedOut; + -webkit-animation-timing-function: ease-in; + animation-timing-function: ease-in; +} +.rotateIn { + -webkit-animation-name: rotateIn; + animation-name: rotateIn; +} +.rotateInDownLeft { + -webkit-animation-name: rotateInDownLeft; + animation-name: rotateInDownLeft; +} +.rotateInDownRight { + -webkit-animation-name: rotateInDownRight; + animation-name: rotateInDownRight; +} +.rotateInUpLeft { + -webkit-animation-name: rotateInUpLeft; + animation-name: rotateInUpLeft; +} +.rotateInUpRight { + -webkit-animation-name: rotateInUpRight; + animation-name: rotateInUpRight; +} +.rotateOut { + -webkit-animation-name: rotateOut; + animation-name: rotateOut; +} +.rotateOutDownLeft { + -webkit-animation-name: rotateOutDownLeft; + animation-name: rotateOutDownLeft; +} +.rotateOutDownRight { + -webkit-animation-name: rotateOutDownRight; + animation-name: rotateOutDownRight; +} +.rotateOutUpLeft { + -webkit-animation-name: rotateOutUpLeft; + animation-name: rotateOutUpLeft; +} +.hinge { + -webkit-animation-duration: 2s; + animation-duration: 2s; + -webkit-animation-name: hinge; + animation-name: hinge; +} +.rollIn { + -webkit-animation-name: rollIn; + animation-name: rollIn; +} +.rollOut { + -webkit-animation-name: rollOut; + animation-name: rollOut; +} +.zoomIn { + -webkit-animation-name: zoomIn; + animation-name: zoomIn; +} +.zoomInDown { + -webkit-animation-name: zoomInDown; + animation-name: zoomInDown; +} +.zoomInLeft { + -webkit-animation-name: zoomInLeft; + animation-name: zoomInLeft; +} +.zoomInRight { + -webkit-animation-name: zoomInRight; + animation-name: zoomInRight; +} +.zoomInUp { + -webkit-animation-name: zoomInUp; + animation-name: zoomInUp; +} +.zoomOut { + -webkit-animation-name: zoomOut; + animation-name: zoomOut; +} +.zoomOutDown { + -webkit-animation-name: zoomOutDown; + animation-name: zoomOutDown; +} +.zoomOutLeft { + -webkit-animation-name: zoomOutLeft; + animation-name: zoomOutLeft; +} +.zoomOutRight { + -webkit-animation-name: zoomOutRight; + animation-name: zoomOutRight; +} +.zoomOutUp { + -webkit-animation-name: zoomOutUp; + animation-name: zoomOutUp; +} +.slideInDown { + -webkit-animation-name: slideInDown; + animation-name: slideInDown; +} +.slideInLeft { + -webkit-animation-name: slideInLeft; + animation-name: slideInLeft; +} +.slideInRight { + -webkit-animation-name: slideInRight; + animation-name: slideInRight; +} +.slideInUp { + -webkit-animation-name: slideInUp; + animation-name: slideInUp; +} +.slideOutDown { + -webkit-animation-name: slideOutDown; + animation-name: slideOutDown; +} +.slideOutLeft { + -webkit-animation-name: slideOutLeft; + animation-name: slideOutLeft; +} +.slideOutRight { + -webkit-animation-name: slideOutRight; + animation-name: slideOutRight; +} +.slideOutUp { + -webkit-animation-name: slideOutUp; + animation-name: slideOutUp; +} +.base-disabled { + cursor: default !important; + color: #cccccc !important; +} +.base-disabled .bi-input { + color: #cccccc !important; +} +.base-disabled .bi-textarea { + color: #cccccc !important; +} +.base-disabled .b-font:before { + color: #cccccc !important; +} +.bi-theme-dark .base-disabled { + color: #666666 !important; +} +.bi-theme-dark .base-disabled .bi-input { + color: #666666 !important; +} +.bi-theme-dark .base-disabled .bi-textarea { + color: #666666 !important; +} +.bi-theme-dark .base-disabled .b-font:before { + color: #666666 !important; +} +.base-invalid { + cursor: default !important; +} +.clearfix { + *zoom: 1; +} +.clearfix:before, +.clearfix:after { + content: " "; + display: table; + line-height: 0; +} +.clearfix:after { + clear: both; +} +.bi-background { + background-color: #eff1f4; + color: #666666; +} +.bi-background .bi-input { + color: #666666; +} +.bi-background .bi-textarea { + color: #666666; +} +.bi-theme-dark .bi-background { + background-color: #191b2b; + color: #cccccc; +} +.bi-theme-dark .bi-background .bi-input { + color: #cccccc; +} +.bi-theme-dark .bi-background .bi-textarea { + color: #cccccc; +} +.bi-card { + background-color: #ffffff; + color: #666666; +} +.bi-card .bi-input { + color: #666666; +} +.bi-card .bi-textarea { + color: #666666; +} +.bi-theme-dark .bi-card { + background-color: #242640; + color: #cccccc; +} +.bi-theme-dark .bi-card .bi-input { + color: #cccccc; +} +.bi-theme-dark .bi-card .bi-textarea { + color: #cccccc; +} +.bi-disabled { + color: #cccccc; +} +.bi-disabled .bi-input { + color: #cccccc; +} +.bi-disabled .bi-textarea { + color: #cccccc; +} +.bi-theme-dark .bi-disabled { + color: #666666; +} +.bi-theme-dark .bi-disabled .bi-input { + color: #666666; +} +.bi-theme-dark .bi-disabled .bi-textarea { + color: #666666; +} +.bi-tips { + color: #999999; +} +.bi-tips .bi-input { + color: #999999; +} +.bi-tips .bi-textarea { + color: #999999; +} +.bi-border { + border: 1px solid #d4dadd; +} +.bi-theme-dark .bi-border { + border: 1px solid #525466; +} +.bi-border-left { + border-left: 1px solid #d4dadd; +} +.bi-theme-dark .bi-border-left { + border-left: 1px solid #525466; +} +.bi-border-right { + border-right: 1px solid #d4dadd; +} +.bi-theme-dark .bi-border-right { + border-right: 1px solid #525466; +} +.bi-border-top { + border-top: 1px solid #d4dadd; +} +.bi-theme-dark .bi-border-top { + border-top: 1px solid #525466; +} +.bi-border-bottom { + border-bottom: 1px solid #d4dadd; +} +.bi-theme-dark .bi-border-bottom { + border-bottom: 1px solid #525466; +} +.bi-keyword-red-mark { + color: #f07d0a; +} +.bi-keyword-red-mark .bi-input { + color: #f07d0a; +} +.bi-keyword-red-mark .bi-textarea { + color: #f07d0a; +} +.bi-high-light { + color: #3f8ce8; +} +.bi-high-light .bi-input { + color: #3f8ce8; +} +.bi-high-light .bi-textarea { + color: #3f8ce8; +} +.bi-high-light-background { + background-color: #3f8ce8; + color: #ffffff; +} +.bi-high-light-background .bi-input { + color: #ffffff; +} +.bi-high-light-background .bi-textarea { + color: #ffffff; +} +.bi-high-light-border { + border-color: #178cdf; +} +.bi-water-mark { + color: #cccccc; + cursor: text; +} +.bi-water-mark .bi-input { + color: #cccccc; +} +.bi-water-mark .bi-textarea { + color: #cccccc; +} +.bi-theme-dark .bi-water-mark { + color: #666666; +} +.bi-theme-dark .bi-water-mark .bi-input { + color: #666666; +} +.bi-theme-dark .bi-water-mark .bi-textarea { + color: #666666; +} +.bi-resizer { + background: #1a1a1a; + opacity: 0.2; + filter: alpha(opacity=20); + z-index: 1000000000 !important; +} +.bi-theme-dark .bi-resizer { + background: #ffffff; +} +.bi-mask { + color: #ffffff; + background-color: rgba(26, 26, 26, 0.2); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#331a1a1a,endColorstr=#331a1a1a); +} +.bi-mask .bi-input { + color: #ffffff; +} +.bi-mask .bi-textarea { + color: #ffffff; +} +.bi-theme-dark .bi-mask { + color: #242640; + background-color: rgba(255, 255, 255, 0.2); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#33ffffff,endColorstr=#33ffffff); +} +.bi-theme-dark .bi-mask .bi-input { + color: #242640; +} +.bi-theme-dark .bi-mask .bi-textarea { + color: #242640; +} +.bi-z-index-mask { + color: #ffffff; + background-color: rgba(26, 26, 26, 0.5); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#801a1a1a,endColorstr=#801a1a1a); +} +.bi-z-index-mask .bi-input { + color: #ffffff; +} +.bi-z-index-mask .bi-textarea { + color: #ffffff; +} +.bi-list-item:hover, +.bi-list-item.hover { + color: #1a1a1a; + background-color: rgba(26, 26, 26, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d1a1a1a,endColorstr=#0d1a1a1a); +} +.bi-list-item:hover .bi-input, +.bi-list-item.hover .bi-input { + color: #1a1a1a; +} +.bi-list-item:hover .bi-textarea, +.bi-list-item.hover .bi-textarea { + color: #1a1a1a; +} +.bi-list-item.disabled, +.bi-list-item.disabled:hover, +.bi-list-item.disabled:active { + background-color: transparent !important; + color: #cccccc !important; +} +.bi-list-item.disabled .bi-input, +.bi-list-item.disabled:hover .bi-input, +.bi-list-item.disabled:active .bi-input { + color: #cccccc !important; +} +.bi-list-item.disabled .bi-textarea, +.bi-list-item.disabled:hover .bi-textarea, +.bi-list-item.disabled:active .bi-textarea { + color: #cccccc !important; +} +.bi-list-item.disabled .bi-high-light, +.bi-list-item.disabled:hover .bi-high-light, +.bi-list-item.disabled:active .bi-high-light { + color: #cccccc !important; +} +.bi-theme-dark .bi-list-item:hover, +.bi-theme-dark .bi-list-item.hover { + color: #ffffff; + background-color: rgba(255, 255, 255, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff,endColorstr=#0dffffff); +} +.bi-theme-dark .bi-list-item:hover .bi-input, +.bi-theme-dark .bi-list-item.hover .bi-input { + color: #ffffff; +} +.bi-theme-dark .bi-list-item:hover .bi-textarea, +.bi-theme-dark .bi-list-item.hover .bi-textarea { + color: #ffffff; +} +.bi-theme-dark .bi-list-item.disabled, +.bi-theme-dark .bi-list-item.disabled:hover, +.bi-theme-dark .bi-list-item.disabled:active { + background-color: transparent !important; + color: #666666 !important; +} +.bi-theme-dark .bi-list-item.disabled .bi-input, +.bi-theme-dark .bi-list-item.disabled:hover .bi-input, +.bi-theme-dark .bi-list-item.disabled:active .bi-input { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item.disabled .bi-textarea, +.bi-theme-dark .bi-list-item.disabled:hover .bi-textarea, +.bi-theme-dark .bi-list-item.disabled:active .bi-textarea { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item.disabled .bi-high-light, +.bi-theme-dark .bi-list-item.disabled:hover .bi-high-light, +.bi-theme-dark .bi-list-item.disabled:active .bi-high-light { + color: #666666 !important; +} +.bi-list-item-border:active, +.bi-list-item-border.active { + border: 1px solid #178cdf; +} +.bi-list-item-simple { + color: #999999; +} +.bi-list-item-simple .bi-input { + color: #999999; +} +.bi-list-item-simple .bi-textarea { + color: #999999; +} +.bi-list-item-simple:hover, +.bi-list-item-simple.hover { + color: #3f8ce8; +} +.bi-list-item-simple:hover .bi-input, +.bi-list-item-simple.hover .bi-input { + color: #3f8ce8; +} +.bi-list-item-simple:hover .bi-textarea, +.bi-list-item-simple.hover .bi-textarea { + color: #3f8ce8; +} +.bi-list-item-simple.disabled, +.bi-list-item-simple.disabled:hover, +.bi-list-item-simple.disabled:active { + color: #cccccc !important; +} +.bi-list-item-simple.disabled .bi-input, +.bi-list-item-simple.disabled:hover .bi-input, +.bi-list-item-simple.disabled:active .bi-input { + color: #cccccc !important; +} +.bi-list-item-simple.disabled .bi-textarea, +.bi-list-item-simple.disabled:hover .bi-textarea, +.bi-list-item-simple.disabled:active .bi-textarea { + color: #cccccc !important; +} +.bi-list-item-simple.disabled .bi-high-light, +.bi-list-item-simple.disabled:hover .bi-high-light, +.bi-list-item-simple.disabled:active .bi-high-light { + color: #cccccc !important; +} +.bi-list-item-effect:hover { + color: #1a1a1a; +} +.bi-list-item-effect:hover .bi-input { + color: #1a1a1a; +} +.bi-list-item-effect:hover .bi-textarea { + color: #1a1a1a; +} +.bi-list-item-effect.active, +.bi-list-item-effect:active { + color: #3f8ce8; +} +.bi-list-item-effect.active .bi-input, +.bi-list-item-effect:active .bi-input { + color: #3f8ce8; +} +.bi-list-item-effect.active .bi-textarea, +.bi-list-item-effect:active .bi-textarea { + color: #3f8ce8; +} +.bi-list-item-effect.disabled, +.bi-list-item-effect.disabled:hover, +.bi-list-item-effect.disabled:active { + color: #cccccc !important; +} +.bi-list-item-effect.disabled .bi-input, +.bi-list-item-effect.disabled:hover .bi-input, +.bi-list-item-effect.disabled:active .bi-input { + color: #cccccc !important; +} +.bi-list-item-effect.disabled .bi-textarea, +.bi-list-item-effect.disabled:hover .bi-textarea, +.bi-list-item-effect.disabled:active .bi-textarea { + color: #cccccc !important; +} +.bi-list-item-effect.disabled .bi-high-light, +.bi-list-item-effect.disabled:hover .bi-high-light, +.bi-list-item-effect.disabled:active .bi-high-light { + color: #cccccc !important; +} +.bi-theme-dark .bi-list-item-effect:hover { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-effect:hover .bi-input { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-effect:hover .bi-textarea { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-effect.active, +.bi-theme-dark .bi-list-item-effect:active { + color: #3f8ce8; +} +.bi-theme-dark .bi-list-item-effect.active .bi-input, +.bi-theme-dark .bi-list-item-effect:active .bi-input { + color: #3f8ce8; +} +.bi-theme-dark .bi-list-item-effect.active .bi-textarea, +.bi-theme-dark .bi-list-item-effect:active .bi-textarea { + color: #3f8ce8; +} +.bi-theme-dark .bi-list-item-effect.disabled, +.bi-theme-dark .bi-list-item-effect.disabled:hover, +.bi-theme-dark .bi-list-item-effect.disabled:active { + background-color: transparent !important; + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-effect.disabled .bi-input, +.bi-theme-dark .bi-list-item-effect.disabled:hover .bi-input, +.bi-theme-dark .bi-list-item-effect.disabled:active .bi-input { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-effect.disabled .bi-textarea, +.bi-theme-dark .bi-list-item-effect.disabled:hover .bi-textarea, +.bi-theme-dark .bi-list-item-effect.disabled:active .bi-textarea { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-effect.disabled .bi-high-light, +.bi-theme-dark .bi-list-item-effect.disabled:hover .bi-high-light, +.bi-theme-dark .bi-list-item-effect.disabled:active .bi-high-light { + color: #666666 !important; +} +.bi-list-item-active:hover, +.bi-list-item-active.hover { + color: #1a1a1a; + background-color: rgba(26, 26, 26, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d1a1a1a,endColorstr=#0d1a1a1a); +} +.bi-list-item-active:hover .bi-input, +.bi-list-item-active.hover .bi-input { + color: #1a1a1a; +} +.bi-list-item-active:hover .bi-textarea, +.bi-list-item-active.hover .bi-textarea { + color: #1a1a1a; +} +.bi-list-item-active.active, +.bi-list-item-active:active { + color: #3f8ce8; + background-color: rgba(26, 26, 26, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d1a1a1a,endColorstr=#0d1a1a1a); +} +.bi-list-item-active.active .bi-input, +.bi-list-item-active:active .bi-input { + color: #3f8ce8; +} +.bi-list-item-active.active .bi-textarea, +.bi-list-item-active:active .bi-textarea { + color: #3f8ce8; +} +.bi-list-item-active.disabled, +.bi-list-item-active.disabled:hover, +.bi-list-item-active.disabled:active { + background-color: transparent !important; + color: #cccccc !important; +} +.bi-list-item-active.disabled .bi-input, +.bi-list-item-active.disabled:hover .bi-input, +.bi-list-item-active.disabled:active .bi-input { + color: #cccccc !important; +} +.bi-list-item-active.disabled .bi-textarea, +.bi-list-item-active.disabled:hover .bi-textarea, +.bi-list-item-active.disabled:active .bi-textarea { + color: #cccccc !important; +} +.bi-list-item-active.disabled .bi-high-light, +.bi-list-item-active.disabled:hover .bi-high-light, +.bi-list-item-active.disabled:active .bi-high-light { + color: #cccccc !important; +} +.bi-theme-dark .bi-list-item-active:hover, +.bi-theme-dark .bi-list-item-active.hover { + color: #ffffff; + background-color: rgba(255, 255, 255, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff,endColorstr=#0dffffff); +} +.bi-theme-dark .bi-list-item-active:hover .bi-input, +.bi-theme-dark .bi-list-item-active.hover .bi-input { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-active:hover .bi-textarea, +.bi-theme-dark .bi-list-item-active.hover .bi-textarea { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-active.active, +.bi-theme-dark .bi-list-item-active:active { + color: #3f8ce8; + background-color: rgba(255, 255, 255, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff,endColorstr=#0dffffff); +} +.bi-theme-dark .bi-list-item-active.active .bi-input, +.bi-theme-dark .bi-list-item-active:active .bi-input { + color: #3f8ce8; +} +.bi-theme-dark .bi-list-item-active.active .bi-textarea, +.bi-theme-dark .bi-list-item-active:active .bi-textarea { + color: #3f8ce8; +} +.bi-theme-dark .bi-list-item-active.disabled, +.bi-theme-dark .bi-list-item-active.disabled:hover, +.bi-theme-dark .bi-list-item-active.disabled:active { + background-color: transparent !important; + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-active.disabled .bi-input, +.bi-theme-dark .bi-list-item-active.disabled:hover .bi-input, +.bi-theme-dark .bi-list-item-active.disabled:active .bi-input { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-active.disabled .bi-textarea, +.bi-theme-dark .bi-list-item-active.disabled:hover .bi-textarea, +.bi-theme-dark .bi-list-item-active.disabled:active .bi-textarea { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-active.disabled .bi-high-light, +.bi-theme-dark .bi-list-item-active.disabled:hover .bi-high-light, +.bi-theme-dark .bi-list-item-active.disabled:active .bi-high-light { + color: #666666 !important; +} +.bi-list-item-active2:hover, +.bi-list-item-active2.hover { + color: #1a1a1a; + background-color: #ffffff; +} +.bi-list-item-active2:hover .bi-input, +.bi-list-item-active2.hover .bi-input { + color: #1a1a1a; +} +.bi-list-item-active2:hover .bi-textarea, +.bi-list-item-active2.hover .bi-textarea { + color: #1a1a1a; +} +.bi-list-item-active2.active, +.bi-list-item-active2:active { + color: #3f8ce8; + background-color: #ffffff; +} +.bi-list-item-active2.active .bi-input, +.bi-list-item-active2:active .bi-input { + color: #3f8ce8; +} +.bi-list-item-active2.active .bi-textarea, +.bi-list-item-active2:active .bi-textarea { + color: #3f8ce8; +} +.bi-list-item-active2.disabled, +.bi-list-item-active2.disabled:hover, +.bi-list-item-active2.disabled:active { + background-color: transparent !important; + color: #cccccc !important; +} +.bi-list-item-active2.disabled .bi-input, +.bi-list-item-active2.disabled:hover .bi-input, +.bi-list-item-active2.disabled:active .bi-input { + color: #cccccc !important; +} +.bi-list-item-active2.disabled .bi-textarea, +.bi-list-item-active2.disabled:hover .bi-textarea, +.bi-list-item-active2.disabled:active .bi-textarea { + color: #cccccc !important; +} +.bi-list-item-active2.disabled .bi-high-light, +.bi-list-item-active2.disabled:hover .bi-high-light, +.bi-list-item-active2.disabled:active .bi-high-light { + color: #cccccc !important; +} +.bi-theme-dark .bi-list-item-active2:hover, +.bi-theme-dark .bi-list-item-active2.hover { + color: #ffffff; + background-color: #242640; +} +.bi-theme-dark .bi-list-item-active2:hover .bi-input, +.bi-theme-dark .bi-list-item-active2.hover .bi-input { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-active2:hover .bi-textarea, +.bi-theme-dark .bi-list-item-active2.hover .bi-textarea { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-active2.active, +.bi-theme-dark .bi-list-item-active2:active { + color: #3f8ce8; + background-color: #242640; +} +.bi-theme-dark .bi-list-item-active2.active .bi-input, +.bi-theme-dark .bi-list-item-active2:active .bi-input { + color: #3f8ce8; +} +.bi-theme-dark .bi-list-item-active2.active .bi-textarea, +.bi-theme-dark .bi-list-item-active2:active .bi-textarea { + color: #3f8ce8; +} +.bi-theme-dark .bi-list-item-active2.disabled, +.bi-theme-dark .bi-list-item-active2.disabled:hover, +.bi-theme-dark .bi-list-item-active2.disabled:active { + background-color: transparent !important; + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-active2.disabled .bi-input, +.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-input, +.bi-theme-dark .bi-list-item-active2.disabled:active .bi-input { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-active2.disabled .bi-textarea, +.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-textarea, +.bi-theme-dark .bi-list-item-active2.disabled:active .bi-textarea { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-active2.disabled .bi-high-light, +.bi-theme-dark .bi-list-item-active2.disabled:hover .bi-high-light, +.bi-theme-dark .bi-list-item-active2.disabled:active .bi-high-light { + color: #666666 !important; +} +.bi-list-item-select:hover, +.bi-list-item-select.hover { + color: #1a1a1a; + background-color: rgba(26, 26, 26, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d1a1a1a,endColorstr=#0d1a1a1a); +} +.bi-list-item-select:hover .bi-input, +.bi-list-item-select.hover .bi-input { + color: #1a1a1a; +} +.bi-list-item-select:hover .bi-textarea, +.bi-list-item-select.hover .bi-textarea { + color: #1a1a1a; +} +.bi-list-item-select:active, +.bi-list-item-select.active { + color: #ffffff; + background-color: #3f8ce8; +} +.bi-list-item-select:active .bi-input, +.bi-list-item-select.active .bi-input { + color: #ffffff; +} +.bi-list-item-select:active .bi-textarea, +.bi-list-item-select.active .bi-textarea { + color: #ffffff; +} +.bi-list-item-select:active .bi-high-light, +.bi-list-item-select.active .bi-high-light { + color: #ffffff; +} +.bi-list-item-select.disabled, +.bi-list-item-select.disabled:hover, +.bi-list-item-select.disabled:active { + color: #cccccc !important; + background-color: transparent !important; +} +.bi-list-item-select.disabled .bi-input, +.bi-list-item-select.disabled:hover .bi-input, +.bi-list-item-select.disabled:active .bi-input { + color: #cccccc !important; +} +.bi-list-item-select.disabled .bi-textarea, +.bi-list-item-select.disabled:hover .bi-textarea, +.bi-list-item-select.disabled:active .bi-textarea { + color: #cccccc !important; +} +.bi-list-item-select.disabled .bi-high-light, +.bi-list-item-select.disabled:hover .bi-high-light, +.bi-list-item-select.disabled:active .bi-high-light { + color: #cccccc !important; +} +.bi-theme-dark .bi-list-item-select:hover, +.bi-theme-dark .bi-list-item-select.hover { + color: #ffffff; + background-color: rgba(255, 255, 255, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dffffff,endColorstr=#0dffffff); +} +.bi-theme-dark .bi-list-item-select:hover .bi-input, +.bi-theme-dark .bi-list-item-select.hover .bi-input { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-select:hover .bi-textarea, +.bi-theme-dark .bi-list-item-select.hover .bi-textarea { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-select:active, +.bi-theme-dark .bi-list-item-select.active { + color: #ffffff; + background-color: #3f8ce8; +} +.bi-theme-dark .bi-list-item-select:active .bi-input, +.bi-theme-dark .bi-list-item-select.active .bi-input { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-select:active .bi-textarea, +.bi-theme-dark .bi-list-item-select.active .bi-textarea { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-select:active .bi-high-light, +.bi-theme-dark .bi-list-item-select.active .bi-high-light { + color: #ffffff; +} +.bi-theme-dark .bi-list-item-select.disabled, +.bi-theme-dark .bi-list-item-select.disabled:hover, +.bi-theme-dark .bi-list-item-select.disabled:active { + background-color: transparent !important; + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-select.disabled .bi-input, +.bi-theme-dark .bi-list-item-select.disabled:hover .bi-input, +.bi-theme-dark .bi-list-item-select.disabled:active .bi-input { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-select.disabled .bi-textarea, +.bi-theme-dark .bi-list-item-select.disabled:hover .bi-textarea, +.bi-theme-dark .bi-list-item-select.disabled:active .bi-textarea { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-select.disabled .bi-high-light, +.bi-theme-dark .bi-list-item-select.disabled:hover .bi-high-light, +.bi-theme-dark .bi-list-item-select.disabled:active .bi-high-light { + color: #666666 !important; +} +.bi-list-item-none:hover, +.bi-list-item-none.hover { + color: inherit; + background-color: transparent; +} +.bi-list-item-none:hover .bi-input, +.bi-list-item-none.hover .bi-input { + color: inherit; +} +.bi-list-item-none:hover .bi-textarea, +.bi-list-item-none.hover .bi-textarea { + color: inherit; +} +.bi-list-item-none:active, +.bi-list-item-none.active { + color: inherit; + background-color: transparent; +} +.bi-list-item-none:active .bi-input, +.bi-list-item-none.active .bi-input { + color: inherit; +} +.bi-list-item-none:active .bi-textarea, +.bi-list-item-none.active .bi-textarea { + color: inherit; +} +.bi-list-item-none:active .bi-high-light, +.bi-list-item-none.active .bi-high-light { + color: inherit; +} +.bi-list-item-none.disabled, +.bi-list-item-none.disabled:hover, +.bi-list-item-none.disabled:active { + color: #cccccc !important; + background-color: transparent !important; +} +.bi-list-item-none.disabled .bi-input, +.bi-list-item-none.disabled:hover .bi-input, +.bi-list-item-none.disabled:active .bi-input { + color: #cccccc !important; +} +.bi-list-item-none.disabled .bi-textarea, +.bi-list-item-none.disabled:hover .bi-textarea, +.bi-list-item-none.disabled:active .bi-textarea { + color: #cccccc !important; +} +.bi-list-item-none.disabled .bi-high-light, +.bi-list-item-none.disabled:hover .bi-high-light, +.bi-list-item-none.disabled:active .bi-high-light { + color: #cccccc !important; +} +.bi-theme-dark .bi-list-item-none:hover, +.bi-theme-dark .bi-list-item-none.hover { + color: inherit; + background-color: transparent; +} +.bi-theme-dark .bi-list-item-none:hover .bi-input, +.bi-theme-dark .bi-list-item-none.hover .bi-input { + color: inherit; +} +.bi-theme-dark .bi-list-item-none:hover .bi-textarea, +.bi-theme-dark .bi-list-item-none.hover .bi-textarea { + color: inherit; +} +.bi-theme-dark .bi-list-item-none:active, +.bi-theme-dark .bi-list-item-none.active { + color: inherit; + background-color: transparent; +} +.bi-theme-dark .bi-list-item-none:active .bi-input, +.bi-theme-dark .bi-list-item-none.active .bi-input { + color: inherit; +} +.bi-theme-dark .bi-list-item-none:active .bi-textarea, +.bi-theme-dark .bi-list-item-none.active .bi-textarea { + color: inherit; +} +.bi-theme-dark .bi-list-item-none:active .bi-high-light, +.bi-theme-dark .bi-list-item-none.active .bi-high-light { + color: inherit; +} +.bi-theme-dark .bi-list-item-none.disabled, +.bi-theme-dark .bi-list-item-none.disabled:hover, +.bi-theme-dark .bi-list-item-none.disabled:active { + background-color: transparent !important; + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-none.disabled .bi-input, +.bi-theme-dark .bi-list-item-none.disabled:hover .bi-input, +.bi-theme-dark .bi-list-item-none.disabled:active .bi-input { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-none.disabled .bi-textarea, +.bi-theme-dark .bi-list-item-none.disabled:hover .bi-textarea, +.bi-theme-dark .bi-list-item-none.disabled:active .bi-textarea { + color: #666666 !important; +} +.bi-theme-dark .bi-list-item-none.disabled .bi-high-light, +.bi-theme-dark .bi-list-item-none.disabled:hover .bi-high-light, +.bi-theme-dark .bi-list-item-none.disabled:active .bi-high-light { + color: #666666 !important; +} +/*****************cursor*****************/ +.cursor-pointer { + cursor: pointer; +} +.cursor-default { + cursor: default; +} +.cursor-move { + cursor: move; +} +/*****************cursor*****************/ +.y-overflow-auto { + overflow-y: auto; + overflow-x: hidden; +} +.x-overflow-auto { + overflow-y: hidden; + overflow-x: auto; +} +.y-overflow-scroll { + overflow-y: scroll; + overflow-x: hidden; +} +.x-overflow-scroll { + overflow-y: hidden; + overflow-x: scroll; +} +.overflow-auto { + overflow-x: auto; + overflow-y: auto; +} +.overflow-scroll { + overflow-x: scroll; + overflow-y: scroll; +} +.overflow-hidden { + overflow-x: hidden; + overflow-y: hidden; +} +.td-overflow { + white-space: normal; + word-break: break-all; +} +.overflow-dot { + text-overflow: ellipsis; + overflow-x: hidden; + overflow-y: hidden; + white-space: nowrap; +} +.display-block { + display: block; +} +.display-inline { + display: inline-block; + *display: inline; + *zoom: 1; +} +/**常用于span元素在与combo并列时**/ +.vertical-super { + vertical-align: super; +} +.vertical-top { + vertical-align: top; +} +.horizon-center { + text-align: center; +} +.horizon-left { + text-align: left; +} +/*类似ie6的盒子模型 可以在有百分比的时候加border 支持到ie8*/ +.border-sizing { + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ +} +.content-sizing { + -webkit-box-sizing: content-box; + /*Safari3.2+*/ + -moz-box-sizing: content-box; + /*Firefox3.5+*/ + -ms-box-sizing: content-box; + /*IE8*/ + box-sizing: content-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ +} +.bi-flex-center-layout { + display: box; + /* OLD - Android 4.4- */ + display: -webkit-box; + /* OLD - iOS 6-, Safari 3.1-6 */ + display: -moz-box; + /* OLD - Firefox 19- (buggy but mostly works) */ + display: -ms-flexbox; + /* TWEENER - IE 10 */ + display: -webkit-flex; + /* NEW - Chrome */ + display: flex; + /* NEW, Spec - Opera 12.1, Firefox 20+ */ + /* 09版 */ + -webkit-box-orient: horizontal; + /* 12版 */ + -webkit-flex-direction: row; + -moz-flex-direction: row; + -ms-flex-direction: row; + -o-flex-direction: row; + flex-direction: row; + /* 09版 */ + -webkit-box-pack: center; + /* 12版 */ + -webkit-justify-content: center; + -moz-justify-content: center; + -ms-justify-content: center; + -o-justify-content: center; + justify-content: center; + /* 09版 */ + -webkit-box-align: center; + /* 12版 */ + -webkit-align-items: center; + -moz-align-items: center; + -ms-align-items: center; + -o-align-items: center; + align-items: center; +} +.bi-flex-horizontal-layout { + display: box; + /* OLD - Android 4.4- */ + display: -webkit-box; + /* OLD - iOS 6-, Safari 3.1-6 */ + display: -moz-box; + /* OLD - Firefox 19- (buggy but mostly works) */ + display: -ms-flexbox; + /* TWEENER - IE 10 */ + display: -webkit-flex; + /* NEW - Chrome */ + display: flex; + /* NEW, Spec - Opera 12.1, Firefox 20+ */ + /* 09版 */ + -webkit-box-orient: horizontal; + /* 12版 */ + -webkit-flex-direction: row; + -moz-flex-direction: row; + -ms-flex-direction: row; + -o-flex-direction: row; + flex-direction: row; + /* 09版 */ + -webkit-box-pack: flex-start; + /* 12版 */ + -webkit-justify-content: flex-start; + -moz-justify-content: flex-start; + -ms-justify-content: flex-start; + -o-justify-content: flex-start; + justify-content: flex-start; + /* 09版 */ + -webkit-box-align: flex-start; + /* 12版 */ + -webkit-align-items: flex-start; + -moz-align-items: flex-start; + -ms-align-items: flex-start; + -o-align-items: flex-start; + align-items: flex-start; + /* 09版 */ + /*-webkit-box-lines: multiple;*/ + /* 12版 */ + -webkit-flex-wrap: nowrap; + -moz-flex-wrap: nowrap; + -ms-flex-wrap: nowrap; + -o-flex-wrap: nowrap; + flex-wrap: nowrap; +} +.bi-flex-horizontal-layout.middle { + /* 09版 */ + -webkit-box-align: center; + /* 12版 */ + -webkit-align-items: center; + -moz-align-items: center; + -ms-align-items: center; + -o-align-items: center; + align-items: center; +} +.bi-flex-horizontal-layout.bottom { + /* 09版 */ + -webkit-box-align: flex-end; + /* 12版 */ + -webkit-align-items: flex-end; + -moz-align-items: flex-end; + -ms-align-items: flex-end; + -o-align-items: flex-end; + align-items: flex-end; +} +.bi-flex-vertical-center { + display: box; + /* OLD - Android 4.4- */ + display: -webkit-box; + /* OLD - iOS 6-, Safari 3.1-6 */ + display: -moz-box; + /* OLD - Firefox 19- (buggy but mostly works) */ + display: -ms-flexbox; + /* TWEENER - IE 10 */ + display: -webkit-flex; + /* NEW - Chrome */ + display: flex; + /* NEW, Spec - Opera 12.1, Firefox 20+ */ + /* 09版 */ + -webkit-box-orient: horizontal; + /* 12版 */ + -webkit-flex-direction: row; + -moz-flex-direction: row; + -ms-flex-direction: row; + -o-flex-direction: row; + flex-direction: row; + /* 09版 */ + -webkit-box-pack: flex-start; + /* 12版 */ + -webkit-justify-content: flex-start; + -moz-justify-content: flex-start; + -ms-justify-content: flex-start; + -o-justify-content: flex-start; + justify-content: flex-start; + /* 09版 */ + -webkit-box-align: center; + /* 12版 */ + -webkit-align-items: center; + -moz-align-items: center; + -ms-align-items: center; + -o-align-items: center; + align-items: center; + /* 09版 */ + /*-webkit-box-lines: multiple;*/ + /* 12版 */ + -webkit-flex-wrap: nowrap; + -moz-flex-wrap: nowrap; + -ms-flex-wrap: nowrap; + -o-flex-wrap: nowrap; + flex-wrap: nowrap; +} +.bi-flex-wrapper-center-layout .flex-wrapper-center-layout-wrapper { + display: box; + /* OLD - Android 4.4- */ + display: -webkit-box; + /* OLD - iOS 6-, Safari 3.1-6 */ + display: -moz-box; + /* OLD - Firefox 19- (buggy but mostly works) */ + display: -ms-flexbox; + /* TWEENER - IE 10 */ + display: -webkit-flex; + /* NEW - Chrome */ + display: flex; + /* NEW, Spec - Opera 12.1, Firefox 20+ */ + /* 09版 */ + -webkit-box-orient: horizontal; + /* 12版 */ + -webkit-flex-direction: row; + -moz-flex-direction: row; + -ms-flex-direction: row; + -o-flex-direction: row; + flex-direction: row; + /* 09版 */ + -webkit-box-pack: center; + /* 12版 */ + -webkit-justify-content: center; + -moz-justify-content: center; + -ms-justify-content: center; + -o-justify-content: center; + justify-content: center; + /* 09版 */ + -webkit-box-align: center; + /* 12版 */ + -webkit-align-items: center; + -moz-align-items: center; + -ms-align-items: center; + -o-align-items: center; + align-items: center; + min-width: 100%; + min-height: 100%; + float: left; +} +.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper { + display: box; + /* OLD - Android 4.4- */ + display: -webkit-box; + /* OLD - iOS 6-, Safari 3.1-6 */ + display: -moz-box; + /* OLD - Firefox 19- (buggy but mostly works) */ + display: -ms-flexbox; + /* TWEENER - IE 10 */ + display: -webkit-flex; + /* NEW - Chrome */ + display: flex; + /* NEW, Spec - Opera 12.1, Firefox 20+ */ + /* 09版 */ + -webkit-box-orient: horizontal; + /* 12版 */ + -webkit-flex-direction: row; + -moz-flex-direction: row; + -ms-flex-direction: row; + -o-flex-direction: row; + flex-direction: row; + /* 09版 */ + -webkit-box-pack: flex-start; + /* 12版 */ + -webkit-justify-content: flex-start; + -moz-justify-content: flex-start; + -ms-justify-content: flex-start; + -o-justify-content: flex-start; + justify-content: flex-start; + /* 09版 */ + -webkit-box-align: flex-start; + /* 12版 */ + -webkit-align-items: flex-start; + -moz-align-items: flex-start; + -ms-align-items: flex-start; + -o-align-items: flex-start; + align-items: flex-start; + /* 09版 */ + /*-webkit-box-lines: multiple;*/ + /* 12版 */ + -webkit-flex-wrap: nowrap; + -moz-flex-wrap: nowrap; + -ms-flex-wrap: nowrap; + -o-flex-wrap: nowrap; + flex-wrap: nowrap; + min-height: 100%; +} +.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper.middle { + /* 09版 */ + -webkit-box-align: center; + /* 12版 */ + -webkit-align-items: center; + -moz-align-items: center; + -ms-align-items: center; + -o-align-items: center; + align-items: center; +} +.bi-flex-wrapper-horizontal-layout .flex-wrapper-horizontal-layout-wrapper.bottom { + /* 09版 */ + -webkit-box-align: flex-end; + /* 12版 */ + -webkit-align-items: flex-end; + -moz-align-items: flex-end; + -ms-align-items: flex-end; + -o-align-items: flex-end; + align-items: flex-end; +} +.bi-flex-wrapper-vertical-center .flex-wrapper-vertical-center-wrapper { + display: box; + /* OLD - Android 4.4- */ + display: -webkit-box; + /* OLD - iOS 6-, Safari 3.1-6 */ + display: -moz-box; + /* OLD - Firefox 19- (buggy but mostly works) */ + display: -ms-flexbox; + /* TWEENER - IE 10 */ + display: -webkit-flex; + /* NEW - Chrome */ + display: flex; + /* NEW, Spec - Opera 12.1, Firefox 20+ */ + /* 09版 */ + -webkit-box-orient: horizontal; + /* 12版 */ + -webkit-flex-direction: row; + -moz-flex-direction: row; + -ms-flex-direction: row; + -o-flex-direction: row; + flex-direction: row; + /* 09版 */ + -webkit-box-pack: flex-start; + /* 12版 */ + -webkit-justify-content: flex-start; + -moz-justify-content: flex-start; + -ms-justify-content: flex-start; + -o-justify-content: flex-start; + justify-content: flex-start; + /* 09版 */ + -webkit-box-align: center; + /* 12版 */ + -webkit-align-items: center; + -moz-align-items: center; + -ms-align-items: center; + -o-align-items: center; + align-items: center; + /* 09版 */ + /*-webkit-box-lines: multiple;*/ + /* 12版 */ + -webkit-flex-wrap: nowrap; + -moz-flex-wrap: nowrap; + -ms-flex-wrap: nowrap; + -o-flex-wrap: nowrap; + flex-wrap: nowrap; + min-height: 100%; + float: left; +} +.bi-inline-center-adapt-layout:after { + display: inline-block; + width: 0; + min-height: 100%; + vertical-align: middle; + content: ' '; +} +.bi-inline-vertical-adapt-layout:after { + display: inline-block; + width: 0; + min-height: 100%; + vertical-align: middle; + content: ' '; +} +.bi-theme-dark { + background-color: #191b2b; + color: #cccccc; +} +.bi-theme-dark .bi-input { + color: #ffffff; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-color-chooser-trigger { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + box-shadow: 0px 0px 2px 1px #d4dadd inset; + -webkit-box-shadow: 0px 0px 2px 1px #d4dadd inset; + -moz-box-shadow: 0px 0px 2px 1px #d4dadd inset; +} +.bi-color-picker-button .color-picker-button-mask { + border: 1px solid #1a1a1a; +} +.bi-theme-dark .bi-color-picker-button .color-picker-button-mask { + border: 1px solid #ffffff; +} +.bi-color-picker-editor .color-picker-editor-display { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + box-shadow: 0px 0px 2px 1px #d4dadd inset; + -webkit-box-shadow: 0px 0px 2px 1px #d4dadd inset; + -moz-box-shadow: 0px 0px 2px 1px #d4dadd inset; +} +.bi-bubble-combo .button-combo-triangle-wrapper { + position: fixed !important; +} +.bi-bubble-combo .bubble-combo-triangle-left { + z-index: 1; + width: 0; + height: 0; + border-top: 6px solid transparent; + border-left: 6px solid #3f8ce8; + border-bottom: 6px solid transparent; +} +.bi-bubble-combo .bubble-combo-triangle-right { + z-index: 1; + width: 0; + height: 0; + border-top: 6px solid transparent; + border-right: 6px solid #3f8ce8; + border-bottom: 6px solid transparent; +} +.bi-bubble-combo .bubble-combo-triangle-top { + z-index: 1; + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-top: 6px solid #3f8ce8; +} +.bi-bubble-combo .bubble-combo-triangle-bottom { + z-index: 1; + width: 0; + height: 0; + border-left: 6px solid transparent; + border-right: 6px solid transparent; + border-bottom: 6px solid #3f8ce8; +} +.bi-bubble-popup-view { + -webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-adapt-editor .adapt-editor-text { + font-size: 14px; +} +/*************BI.SearchEditor******************/ +.bi-search-editor .close-font { + font-size: 20px; +} +.bi-search-editor .search-font { + font-size: 20px; +} +/*************BI.SearchEditor******************/ +.bi-small-search-editor .bi-editor { + font-size: 12px; +} +.bi-small-search-editor .bi-editor .bi-input { + font-size: 12px; +} +.bi-small-search-editor .bi-editor .bi-label { + font-size: 12px; +} +.bi-small-search-editor .close-font { + font-size: 18px; +} +.bi-small-search-editor .search-font { + font-size: 18px; +} +.bi-sign-initial-editor .sign-initial-editor-text { + font-size: 14px; +} +/* BASICS */ +.CodeMirror { + /* Set height, width, borders, and global font properties here */ + font-family: monospace; + cursor: text; + width: 100%; + height: 100%; +} +/* PADDING */ +.CodeMirror-lines { + padding: 4px 0; + /* Vertical padding around content */ +} +.CodeMirror pre { + padding: 0 4px; + /* Horizontal padding of content */ +} +.CodeMirror-scrollbar-filler, +.CodeMirror-gutter-filler { + background-color: white; + /* The little square between H and V scrollbars */ +} +/* GUTTER */ +.CodeMirror-gutters { + border-right: 1px solid #ddd; + background-color: #f7f7f7; + white-space: nowrap; +} +.CodeMirror-linenumber { + padding: 0 3px 0 5px; + min-width: 20px; + text-align: right; + color: #999; + white-space: nowrap; +} +.CodeMirror-guttermarker { + color: black; +} +.CodeMirror-guttermarker-subtle { + color: #999; +} +/* CURSOR */ +.CodeMirror div.CodeMirror-cursor { + border-left: 1px solid #1a1a1a; +} +.bi-theme-dark .CodeMirror div.CodeMirror-cursor { + border-left: 1px solid #ffffff; +} +/* Shown when moving in bi-directional text */ +.CodeMirror div.CodeMirror-secondarycursor { + border-left: 1px solid silver; +} +.CodeMirror.cm-fat-cursor div.CodeMirror-cursor { + width: auto; + border: 0; + background: #7e7; +} +.CodeMirror.cm-fat-cursor div.CodeMirror-cursors { + z-index: 1; +} +.cm-animate-fat-cursor { + width: auto; + border: 0; + -webkit-animation: blink 1.06s steps(1) infinite; + -moz-animation: blink 1.06s steps(1) infinite; + animation: blink 1.06s steps(1) infinite; +} +@-moz-keyframes blink { + 0% { + background: #7e7; + } + 50% { + background: none; + } + 100% { + background: #7e7; + } +} +@-webkit-keyframes blink { + 0% { + background: #7e7; + } + 50% { + background: none; + } + 100% { + background: #7e7; + } +} +@keyframes blink { + 0% { + background: #7e7; + } + 50% { + background: none; + } + 100% { + background: #7e7; + } +} +/* Can style cursor different in overwrite (non-insert) mode */ +.cm-tab { + display: inline-block; + text-decoration: inherit; +} +.CodeMirror-ruler { + border-left: 1px solid #ccc; + position: absolute; +} +/* DEFAULT THEME */ +.cm-s-default .cm-header { + color: blue; +} +.cm-s-default .cm-quote { + color: #090; +} +.cm-negative { + color: #d44; +} +.cm-positive { + color: #292; +} +.cm-header, +.cm-strong { + font-weight: bold; +} +.cm-em { + font-style: italic; +} +.cm-link { + text-decoration: underline; +} +.cm-strikethrough { + text-decoration: line-through; +} +.cm-s-default .cm-atom { + color: #219; +} +.cm-s-default .cm-number { + color: #164; +} +.cm-s-default .cm-def { + color: #00f; +} +.cm-s-default .cm-variable-2 { + color: #05a; +} +.cm-s-default .cm-variable-3 { + color: #085; +} +.cm-s-default .cm-comment { + color: #a50; +} +.cm-s-default .cm-string { + color: #a11; +} +.cm-s-default .cm-string-2 { + color: #f50; +} +.cm-s-default .cm-meta { + color: #555; +} +.cm-s-default .cm-qualifier { + color: #555; +} +.cm-s-default .cm-builtin { + color: #30a; +} +.cm-s-default .cm-bracket { + color: #997; +} +.cm-s-default .cm-tag { + color: #170; +} +.cm-s-default .cm-attribute { + color: #00c; +} +.cm-s-default .cm-hr { + color: #999; +} +.cm-s-default .cm-link { + color: #00c; +} +.cm-s-default span[class*="fieldName"] { + color: white; + padding: 1px; + margin: 1px 0px; + background: #3f8ce8; +} +.cm-s-default span[class*="start"] { + -webkit-border-radius: 3px 0px 0px 3px; + -moz-border-radius: 3px 0px 0px 3px; + border-radius: 3px 0px 0px 3px; + margin-left: 3px; +} +.cm-s-default span[class*="end"] { + -webkit-border-radius: 0px 3px 3px 0px; + -moz-border-radius: 0px 3px 3px 0px; + border-radius: 0px 3px 3px 0px; + margin-right: 3px; +} +.cm-s-default span[class*="start end"] { + -webkit-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; +} +.cm-s-default span[class*="#"] { + color: #3f8ce8; +} +.cm-s-default .cm-error { + color: #f00; +} +.cm-invalidchar { + color: #f00; +} +.CodeMirror-composing { + border-bottom: 2px solid; +} +/* Default styles for common addons */ +div.CodeMirror span.CodeMirror-matchingbracket { + color: #0f0; +} +div.CodeMirror span.CodeMirror-nonmatchingbracket { + color: #f22; +} +.CodeMirror-matchingtag { + background: rgba(255, 150, 0, 0.3); +} +.CodeMirror-activeline-background { + background: #e8f2ff; +} +/* STOP */ +/* The rest of this file contains styles related to the mechanics of + the editor. You probably shouldn't touch them. */ +.CodeMirror { + position: relative; + overflow: hidden; +} +.CodeMirror-scroll { + overflow: scroll !important; + /* Things will break if this is overridden */ + /* 30px is the magic margin used to hide the element's real scrollbars */ + /* See overflow: hidden in .CodeMirror */ + margin-bottom: -30px; + margin-right: -30px; + padding-bottom: 30px; + height: 100%; + outline: none; + /* Prevent dragging from highlighting the element */ + position: relative; +} +.CodeMirror-sizer { + position: relative; + border-right: 30px solid transparent; +} +/* The fake, visible scrollbars. Used to force redraw during scrolling + before actuall scrolling happens, thus preventing shaking and + flickering artifacts. */ +.CodeMirror-vscrollbar, +.CodeMirror-hscrollbar, +.CodeMirror-scrollbar-filler, +.CodeMirror-gutter-filler { + position: absolute; + z-index: 6; + display: none; +} +.CodeMirror-vscrollbar { + right: 0; + top: 0; + overflow-x: hidden; + overflow-y: scroll; +} +.CodeMirror-hscrollbar { + bottom: 0; + left: 0; + overflow-y: hidden; + overflow-x: scroll; +} +.CodeMirror-scrollbar-filler { + right: 0; + bottom: 0; +} +.CodeMirror-gutter-filler { + left: 0; + bottom: 0; +} +.CodeMirror-gutters { + position: absolute; + left: 0; + top: 0; + z-index: 3; +} +.CodeMirror-gutter { + white-space: normal; + height: 100%; + display: inline-block; + margin-bottom: -30px; + /* Hack to make IE7 behave */ + *zoom: 1; + *display: inline; +} +.CodeMirror-gutter-wrapper { + position: absolute; + z-index: 4; + height: 100%; +} +.CodeMirror-gutter-elt { + position: absolute; + cursor: default; + z-index: 4; +} +.CodeMirror-gutter-wrapper { + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; +} +.CodeMirror-lines { + cursor: text; + min-height: 1px; + /* prevents collapsing before first draw */ +} +.CodeMirror pre { + /* Reset some styles that the rest of the page might have set */ + -moz-border-radius: 0; + -webkit-border-radius: 0; + border-radius: 0; + border-width: 0; + background: transparent; + font-family: inherit; + font-size: inherit; + margin: 0; + white-space: pre; + word-wrap: normal; + color: inherit; + z-index: 2; + position: relative; + overflow: visible; + -webkit-tap-highlight-color: transparent; +} +.codemirror-high-line-height { + line-height: 2; +} +.codemirror-low-line-height { + line-height: 1.4; +} +.CodeMirror-wrap pre { + word-wrap: break-word; + white-space: pre-wrap; + word-break: normal; +} +.CodeMirror-linebackground { + position: absolute; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 0; +} +.CodeMirror-linewidget { + position: relative; + z-index: 2; + overflow: auto; +} +.CodeMirror-code { + outline: none; +} +/* Force content-box sizing for the elements where we expect it */ +.CodeMirror-scroll, +.CodeMirror-sizer, +.CodeMirror-gutter, +.CodeMirror-gutters, +.CodeMirror-linenumber { + -moz-box-sizing: content-box; + box-sizing: content-box; +} +.CodeMirror-measure { + position: absolute; + width: 100%; + height: 0; + overflow: hidden; + visibility: hidden; +} +.CodeMirror-measure pre { + position: static; +} +.CodeMirror div.CodeMirror-cursor { + position: absolute; + border-right: none; + width: 0; +} +div.CodeMirror-cursors { + visibility: hidden; + position: relative; + z-index: 3; +} +.CodeMirror-focused div.CodeMirror-cursors { + visibility: visible; +} +.CodeMirror-selected { + background: #d9d9d9; +} +.CodeMirror-focused .CodeMirror-selected { + background: #d7d4f0; +} +.CodeMirror-crosshair { + cursor: crosshair; +} +.CodeMirror-line::selection, +.CodeMirror-line > span::selection, +.CodeMirror-line > span > span::selection { + background: #d7d4f0; +} +.CodeMirror-line::-moz-selection, +.CodeMirror-line > span::-moz-selection, +.CodeMirror-line > span > span::-moz-selection { + background: #d7d4f0; +} +.cm-searching { + background: #ffa; + background: rgba(255, 255, 0, 0.4); +} +/* IE7 hack to prevent it from returning funny offsetTops on the spans */ +.CodeMirror span { + *vertical-align: text-bottom; +} +/* Used to force a border model for a node */ +.cm-force-border { + padding-right: .1px; +} +@media print { + /* Hide the cursor when printing */ + .CodeMirror div.CodeMirror-cursors { + visibility: hidden; + } +} +/* See issue #2901 */ +.cm-tab-wrap-hack:after { + content: ''; +} +/* Help users use markselection to safely style text background */ +span.CodeMirror-selectedtext { + background: none; +} +/*addon: show-hint*/ +.CodeMirror-hints { + position: absolute; + z-index: 10000; + overflow: hidden; + list-style: none; + margin: 0; + padding: 2px; + -webkit-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2); + box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.2); + border-radius: 3px; + border: 1px solid silver; + background: white; + font-size: 90%; + font-family: monospace; + max-height: 20em; + overflow-y: auto; +} +.CodeMirror-hint { + margin: 0; + padding: 0 4px; + border-radius: 2px; + max-width: 19em; + overflow: hidden; + white-space: pre; + color: black; + cursor: pointer; +} +li.CodeMirror-hint-active { + background: #08f; + color: white; +} +.bi-message-title { + font-size: 16px; + cursor: pointer; +} +.bi-message-text { + font-size: 16px; + -webkit-user-select: text; + -khtml-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + -o-user-select: text; + user-select: text; +} +.bi-message-content { + font-size: 16px; +} +.bi-message-close { + font-size: 25px; +} +.bi-multi-list-view .bi-button-mask { + opacity: 0.1; + filter: alpha(opacity=10); +} +.bi-panel { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +.bi-panel .panel-title .panel-title-text { + cursor: text; + font-size: 14px; +} +.bi-all-count-pager .all-pager-prev { + font-size: 16px; +} +.bi-all-count-pager .all-pager-next { + font-size: 16px; +} +.bi-pager .page-item { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +.bi-direction-pager .direction-pager-prev { + font-size: 16px; +} +.bi-direction-pager .direction-pager-next { + font-size: 16px; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-segment > .center-element { + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + background: #ffffff; + border-right: 1px solid #d4dadd; + border-top: 1px solid #d4dadd; + border-bottom: 1px solid #d4dadd; +} +.bi-segment > .first-element { + border-left: 1px solid #d4dadd; + -webkit-border-radius: 6px 0px 0px 6px; + -moz-border-radius: 6px 0px 0px 6px; + border-radius: 6px 0px 0px 6px; +} +.bi-segment > .last-element { + -webkit-border-radius: 0px 6px 6px 0px; + -moz-border-radius: 0px 6px 6px 0px; + border-radius: 0px 6px 6px 0px; +} +.bi-theme-dark .bi-segment > .center-element { + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + background: #242640; + border-right: 1px solid #525466; + border-top: 1px solid #525466; + border-bottom: 1px solid #525466; +} +.bi-theme-dark .bi-segment > .first-element { + border-left: 1px solid #242640; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-button { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + border: 1px solid #178cdf; + background-color: #3f8ce8; + text-align: center; + vertical-align: middle; + cursor: pointer; + font-size: 14px; +} +.bi-button.block { + font-size: inherit; + border-width: 0; + -webkit-border-radius: 0px; + -moz-border-radius: 0px; + border-radius: 0px; +} +.bi-button.clear { + font-size: inherit; + border-width: 0; + background-color: transparent; +} +.bi-button.clear:hover, +.bi-button.clear:active { + opacity: 0.75; + filter: alpha(opacity=75); +} +.bi-button.button-common, +.bi-button.button-common .b-font:before { + color: #ffffff; +} +.bi-button.button-common.clear, +.bi-button.button-common.clear .b-font:before { + color: #3f8ce8; +} +.bi-button.button-ignore { + background-color: #ffffff; + border-color: #d4dadd; +} +.bi-button.button-ignore, +.bi-button.button-ignore .b-font:before { + color: #1a1a1a; +} +.bi-button.button-ignore.clear { + background-color: transparent; + border-width: 0; +} +.bi-button.button-success { + background-color: #58cc7d; + border-color: #58cc7d; +} +.bi-button.button-success, +.bi-button.button-success .b-font:before { + color: #ffffff; +} +.bi-button.button-success.clear { + background-color: transparent; + border-width: 0; +} +.bi-button.button-success.clear, +.bi-button.button-success.clear .b-font:before { + color: #0c6d23; +} +.bi-button.button-warning { + background-color: #e85050; + border-color: #e85050; +} +.bi-button.button-warning, +.bi-button.button-warning .b-font:before { + color: #ffffff; +} +.bi-button.button-warning.clear { + background-color: transparent; + border-width: 0; +} +.bi-button.button-warning.clear, +.bi-button.button-warning.clear .b-font:before { + color: #e85050; +} +.bi-button.button-common.disabled, +.bi-button.button-success.disabled, +.bi-button.button-warning.disabled, +.bi-button.button-common.disabled.base-disabled, +.bi-button.button-success.disabled.base-disabled, +.bi-button.button-warning.disabled.base-disabled { + background: #cccccc !important; + border-color: #cccccc !important; +} +.bi-button.button-common.disabled, +.bi-button.button-success.disabled, +.bi-button.button-warning.disabled, +.bi-button.button-common.disabled.base-disabled, +.bi-button.button-success.disabled.base-disabled, +.bi-button.button-warning.disabled.base-disabled, +.bi-button.button-common.disabled .b-font:before, +.bi-button.button-success.disabled .b-font:before, +.bi-button.button-warning.disabled .b-font:before, +.bi-button.button-common.disabled.base-disabled .b-font:before, +.bi-button.button-success.disabled.base-disabled .b-font:before, +.bi-button.button-warning.disabled.base-disabled .b-font:before { + color: #ffffff !important; +} +.bi-button.button-ignore.disabled { + background: #ffffff !important; + border-color: #d4dadd !important; +} +.bi-button.button-ignore.disabled, +.bi-button.button-ignore.disabled .b-font:before { + color: #cccccc !important; +} +.bi-button.button-common.disabled.clear, +.bi-button.button-success.disabled.clear, +.bi-button.button-warning.disabled.clear, +.bi-button.button-ignore.disabled.clear { + background: transparent !important; + border-width: 0 !important; +} +.bi-button.button-common.disabled.clear, +.bi-button.button-success.disabled.clear, +.bi-button.button-warning.disabled.clear, +.bi-button.button-ignore.disabled.clear, +.bi-button.button-common.disabled.clear .b-font:before, +.bi-button.button-success.disabled.clear .b-font:before, +.bi-button.button-warning.disabled.clear .b-font:before, +.bi-button.button-ignore.disabled.clear .b-font:before { + color: #cccccc !important; +} +.bi-button.button-common.disabled.clear:hover, +.bi-button.button-success.disabled.clear:hover, +.bi-button.button-warning.disabled.clear:hover, +.bi-button.button-ignore.disabled.clear:hover, +.bi-button.button-common.disabled.clear:active, +.bi-button.button-success.disabled.clear:active, +.bi-button.button-warning.disabled.clear:active, +.bi-button.button-ignore.disabled.clear:active { + opacity: 1; + filter: alpha(opacity=100); +} +.bi-basic-button.button-common .bi-button-mask, +.bi-basic-button.button-success .bi-button-mask, +.bi-basic-button.button-warning .bi-button-mask { + opacity: 0.2; + filter: alpha(opacity=20); + background-color: #ffffff; +} +.bi-basic-button .bi-button-mask { + opacity: 0.2; + filter: alpha(opacity=20); + background-color: #1a1a1a; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-single-select-icon-text-item:active .b-font:before, +.bi-single-select-icon-text-item.active .b-font:before { + color: #3f8ce8; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-editor { + font-size: 12px; +} +.bi-multifile-editor .multifile-editor { + text-align: right; + cursor: pointer; + font-size: 100px; + z-index: 2; +} +.bi-shelter-editor .shelter-editor-text { + font-size: 12px; +} +.bi-sign-editor .sign-editor-text { + font-size: 12px; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-textarea-editor { + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; +} +.bi-textarea-editor .textarea-editor-content { + font-size: 12px; +} +.bi-textarea-editor .textarea-editor-content { + border: none; +} +.bi-file { + opacity: 0; + filter: alpha(opacity=0); + z-index: 2; +} +.bi-input { + border: none; + outline: none; + background-color: transparent; + padding: 0; + margin: 0; + width: 100%; + height: 100%; +} +.bi-input.bi-input-focus { + border: none; +} +.bi-input.bi-input-error { + border: none; + color: #e85050 !important; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-text { + text-overflow: ellipsis; + overflow-x: hidden; + overflow-y: hidden; + white-space: nowrap; + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ + word-break: break-word; +} +.bi-bubble { + font-size: 14px; +} +.bi-bubble .bubble-text { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + background: #fddddd; + color: #e85050; +} +.bi-tip { + position: fixed !important; +} +.bi-toast { + font-size: 14px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +.bi-toast.toast-success { + background: #e1f4e7; + color: #0c6d23; +} +.bi-toast.toast-warning { + background: #fddddd; + color: #e85050; +} +.bi-tooltip { + max-width: 250px; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; + font-size: 12px; +} +.bi-tooltip.tooltip-success { + background: #fff5c1; + border: 1px solid #fff5c1; + color: #1a1a1a; +} +.bi-tooltip.tooltip-warning { + background: #fddddd; + color: #e85050; + border: 1px solid #f4cbcb; +} +.bi-collection-table-cell { + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ +} +.bi-collection-table-cell.first-row { + border-top: 1px solid #d4dadd; +} +.bi-collection-table-cell.first-col { + border-left: 1px solid #d4dadd; +} +.bi-theme-dark .bi-collection-table-cell.first-row { + border-top: 1px solid #525466; +} +.bi-theme-dark .bi-collection-table-cell.first-col { + border-left: 1px solid #525466; +} +.bi-quick-collection-table > div > .bi-collection { + overflow: hidden !important; + overflow-x: hidden !important; + overflow-y: hidden !important; +} +.bi-table > .first-col { + border-left: none; +} +.bi-table > .first-row { + border-top: none; +} +.bi-table > div > div > table { + border-bottom: 1px solid #d4dadd; + border-right: 1px solid #d4dadd; +} +.bi-table > div.top-left > div > div > table { + border-bottom: 1px solid #d4dadd; + border-right: 1px solid #d4dadd; +} +.bi-table > div.top-right > div > div > table { + border-bottom: 1px solid #d4dadd; + border-right: 1px solid #d4dadd; +} +.bi-table > div.bottom-left > div > div > table { + border-bottom: 1px solid #d4dadd; + border-right: 1px solid #d4dadd; +} +.bi-table > div.bottom-right > div > div > table { + border-right: 1px solid #d4dadd; + border-bottom: 1px solid #d4dadd; +} +.bi-table > div > div > table, +.bi-table > div > div > div > table { + min-width: 100%; + clear: both; + vertical-align: middle; + border-spacing: 0; + border-collapse: separate; +} +.bi-table > div > div > table, +.bi-table > div > div > div > table, +.bi-table > div > div > table > * > * > th, +.bi-table > div > div > div > table > * > * > th, +.bi-table > div > div > table > * > * > td, +.bi-table > div > div > div > table > * > * > td { + vertical-align: middle; + margin: 0; + padding: 0; +} +.bi-table > div > div > table > tbody > tr > td, +.bi-table > div > div > div > table > tbody > tr > td, +.bi-table > div > div > table > thead > tr > td, +.bi-table > div > div > div > table > thead > tr > td { + border-top: 1px solid #d4dadd; + border-left: 1px solid #d4dadd; +} +.bi-theme-dark .bi-table > div > div > table { + border-bottom: 1px solid #525466; + border-right: 1px solid #525466; +} +.bi-theme-dark .bi-table > div.top-left > div > div > table { + border-bottom: 1px solid #525466; + border-right: 1px solid #525466; +} +.bi-theme-dark .bi-table > div.top-right > div > div > table { + border-bottom: 1px solid #525466; + border-right: 1px solid #525466; +} +.bi-theme-dark .bi-table > div.bottom-left > div > div > table { + border-bottom: 1px solid #525466; + border-right: 1px solid #525466; +} +.bi-theme-dark .bi-table > div.bottom-right > div > div > table { + border-right: 1px solid #525466; + border-bottom: 1px solid #525466; +} +.bi-theme-dark .bi-table > div > div > table > tbody > tr > td, +.bi-theme-dark .bi-table > div > div > div > table > tbody > tr > td, +.bi-theme-dark .bi-table > div > div > table > thead > tr > td, +.bi-theme-dark .bi-table > div > div > div > table > thead > tr > td { + border-top: 1px solid #525466; + border-left: 1px solid #525466; +} +.bi-grid-table-cell { + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ +} +.bi-grid-table-cell.first-row { + border-top: 1px solid #d4dadd; +} +.bi-grid-table-cell.first-col { + border-left: 1px solid #d4dadd; +} +.bi-theme-dark .bi-grid-table-cell.first-row { + border-top: 1px solid #525466; +} +.bi-theme-dark .bi-grid-table-cell.first-col { + border-left: 1px solid #525466; +} +.scrollbar-layout-main { + box-sizing: border-box; + outline: none; + overflow: hidden; + position: absolute; + transition-duration: 250ms; + transition-timing-function: ease; + user-select: none; + background-color: rgba(102, 102, 102, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d666666,endColorstr=#0d666666); + border-radius: 5px; +} +.bi-theme-dark .scrollbar-layout-main { + background-color: rgba(204, 204, 204, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dcccccc,endColorstr=#0dcccccc); +} +.scrollbar-layout-main-vertical { + bottom: 0; + right: 0; + top: 0; + transition-property: background-color; + width: 10px; +} +.scrollbar-layout-main-vertical.public-scrollbar-main-active, +.scrollbar-layout-main-vertical:hover { + width: 10px; +} +.scrollbar-layout-main-horizontal { + bottom: 0; + height: 10px; + left: 0; + transition-property: background-color; + background-color: rgba(102, 102, 102, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d666666,endColorstr=#0d666666); +} +.bi-theme-dark .scrollbar-layout-main-horizontal { + background-color: rgba(204, 204, 204, 0.05); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dcccccc,endColorstr=#0dcccccc); +} +/* Touching the scroll-track directly makes the scroll-track bolder */ +.scrollbar-layout-main-horizontal.public-scrollbar-main-active, +.scrollbar-layout-main-horizontal:hover { + height: 10px; +} +.scrollbar-layout-face { + left: 0; + overflow: hidden; + position: absolute; + z-index: 1; +} +/** + * This selector renders the "nub" of the scrollface. The nub must + * be rendered as pseudo-element so that it won't receive any UI events then + * we can get the correct `event.offsetX` and `event.offsetY` from the + * scrollface element while dragging it. + */ +.scrollbar-layout-face:after { + border-radius: 6px; + content: ''; + display: block; + position: absolute; + transition: background-color 250ms ease; +} +.scrollbar-layout-face-horizontal { + bottom: 0; + left: 0; + top: 0; +} +.scrollbar-layout-face-horizontal:after { + bottom: 2px; + left: 0; + top: 2px; + width: 100%; +} +.scrollbar-layout-face-vertical { + left: 0; + right: 0; + top: 0; +} +.scrollbar-layout-face-vertical:after { + height: 100%; + left: 2px; + right: 2px; + top: 0; +} +/** + * scrollbars. + */ +/* Touching the scroll-track directly makes the scroll-track bolder */ +.public-scrollbar-face:after { + background-color: rgba(102, 102, 102, 0.3); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d666666,endColorstr=#4d666666); +} +.bi-theme-dark .public-scrollbar-face:after { + background-color: rgba(204, 204, 204, 0.3); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dcccccc,endColorstr=#4dcccccc); +} +.public-scrollbar-main:hover .public-scrollbar-face:after, +.public-scrollbar-main-active .public-scrollbar-face:after, +.public-scrollbar-face-active:after { + background-color: rgba(102, 102, 102, 0.7); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3666666,endColorstr=#b3666666); +} +.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after, +.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after, +.bi-theme-dark .public-scrollbar-face-active:after { + background-color: rgba(204, 204, 204, 0.7); + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3cccccc,endColorstr=#b3cccccc); +} +.horizontal-scrollbar { + bottom: 0; + position: absolute; +} +.bi-resizable-table-cell .resizable-table-cell-resizer-container { + cursor: ew-resize; + z-index: 1; +} +.bi-resizable-table-cell .resizable-table-cell-resizer-container:hover .resizable-table-cell-resizer-knob, +.bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob { + background-color: #3f8ce8; +} +.bi-resizable-table-cell .resizable-table-cell-resizer-container.suitable .resizable-table-cell-resizer-knob { + background-color: #58cc7d; +} +.bi-resizable-table .resizable-table-resizer { + cursor: ew-resize; + z-index: 1; + background-color: #3f8ce8; +} +.bi-resizable-table .resizable-table-resizer.suitable { + background-color: #58cc7d; +} +.bi-resizable-table .resizable-table-region-resizer { + cursor: ew-resize; + z-index: 1; +} +.bi-resizable-table .resizable-table-region-resizer:hover .resizable-table-region-resizer-knob, +.bi-resizable-table .resizable-table-region-resizer.dragging .resizable-table-region-resizer-knob { + background-color: #3f8ce8; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-branch-tree .bi-branch-tree-view { + min-width: 300px; +} +.bi-trigger .bi-trigger-icon-button { + font-size: 16px; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-select-text-trigger { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +.bi-small-select-text-trigger { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/**********BI.BIListView*************/ +.bi-popup-view { + position: fixed !important; + overflow-y: visible !important; + overflow-x: visible !important; + overflow: visible !important; + cursor: default; +} +.bi-popup-view .list-view-outer { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +.bi-popup-view .list-view-toolbar { + line-height: 30px; +} +.bi-popup-view .list-view-toolbar > .center-element { + border-left: 1px solid #d4dadd; +} +.bi-popup-view .list-view-toolbar > .first-element { + border-left: none; +} +.bi-theme-dark .bi-popup-view .list-view-toolbar > .center-element { + border-left: 1px solid #525466; +} +.bi-theme-dark .bi-popup-view .list-view-toolbar > .first-element { + border-left: none; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-arrangement .arrangement-helper { + background: #3f8ce8; + z-index: 1000000000; +} +.bi-arrangement .arrangement-block { + z-index: 1000000000; +} +.bi-arrangement .arrangement-drop-container { + z-index: 1000000000; +} +.bi-arrangement .arrangement-drop-container .arrangement-drop-region { + overflow: hidden; +} +.bi-arrangement .arrangement-drop-container .drop-devider { + z-index: 1000000001; + background: #3f8ce8; +} +.bi-arrangement .arrangement-drop-container .top-left, +.bi-arrangement .arrangement-drop-container .top-right, +.bi-arrangement .arrangement-drop-container .bottom-left, +.bi-arrangement .arrangement-drop-container .bottom-right, +.bi-arrangement .arrangement-drop-container .top-left-second, +.bi-arrangement .arrangement-drop-container .top-right-second, +.bi-arrangement .arrangement-drop-container .bottom-left-second, +.bi-arrangement .arrangement-drop-container .bottom-right-second, +.bi-arrangement .arrangement-drop-container .top-center, +.bi-arrangement .arrangement-drop-container .bottom-center, +.bi-arrangement .arrangement-drop-container .left-center, +.bi-arrangement .arrangement-drop-container .right-center, +.bi-arrangement .arrangement-drop-container .top-center-second, +.bi-arrangement .arrangement-drop-container .bottom-center-second, +.bi-arrangement .arrangement-drop-container .left-center-second, +.bi-arrangement .arrangement-drop-container .right-center-second { + z-index: 1000000001; + background: #3f8ce8; +} +.bi-arrangement-droppable { + z-index: 100000; +} +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-adapt-editor .adapt-editor-text { + font-size: 14px; +} +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/*************BI.SearchEditor******************/ +.bi-search-editor { + border: 1px solid #d4dadd; +} +.bi-search-editor .close-font { + font-size: 20px; +} +.bi-search-editor .search-font { + font-size: 20px; +} +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/*************BI.SearchEditor******************/ +.bi-small-search-editor .bi-editor { + font-size: 12px; +} +.bi-small-search-editor .bi-editor .bi-input { + font-size: 12px; +} +.bi-small-search-editor .bi-editor .bi-label { + font-size: 12px; +} +.bi-small-search-editor .close-font { + font-size: 18px; +} +.bi-small-search-editor .search-font { + font-size: 18px; +} +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-sign-initial-editor .sign-initial-editor-text { + font-size: 14px; +} +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-sign-style-editor .sign-style-editor-text { + max-width: 100%; + font-size: 12px; +} +.bi-sign-style-editor .sign-style-editor-tip { + max-width: 100%; + font-size: 12px; + color: #808080; +} +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-text-editor { + border: 1px solid #d4dadd; +} +/****添加计算宽度的--运算符直接需要space****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/*************BI.SearchEditor******************/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-date-trigger { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-down-list-popup .bi-down-list-item .list-item-text { + max-width: 203px; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-excel-table > div.bottom-right > div > div > table { + border-right: 1px solid #d4dadd; +} +.bi-theme-dark .bi-excel-table > div.bottom-right > div > div > table { + border-right: 1px solid #525466; +} +.bi-excel-table-header-cell { + font-weight: bold; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-file-manager-nav-button .file-manager-nav-button-text { + max-width: 200px; +} +.bi-file-manager-nav-button .file-manager-nav-button-text.active { + background-color: #eff1f4; + color: #999999; +} +.bi-file-manager-nav-button .file-manager-nav-button-triangle { + z-index: 1; +} +.bi-theme-dark .bi-file-manager-nav-button .file-manager-nav-button-text.active { + background-color: #191b2b; + color: #999999; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-fine-tuning-number-editor { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +.bi-interactive-arrangement .interactive-arrangement-dragtag-line { + z-index: 1000000000; + background-color: #f07d0a; +} +.bi-interactive-arrangement .interactive-arrangement-dragtag-icon { + z-index: 1000000000; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-month-trigger { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +.bi-multi-select-check-pane .multi-select-check-selected { + text-decoration: underline; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-multi-select-combo .multi-select-trigger-icon-button { + font-size: 16px; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-multi-select-trigger { + -webkit-border-radius: 2px 2px 2px 2px; + -moz-border-radius: 2px 2px 2px 2px; + border-radius: 2px 2px 2px 2px; +} +.bi-multi-select-search-pane .multi-select-toolbar { + color: #e85050; +} +.bi-multi-select-check-selected-button { + z-index: 1; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-multi-tree-check-pane .multi-tree-check-selected { + color: #3f8ce8; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-multi-tree-combo .multi-select-trigger-icon-button { + font-size: 16px; +} +.bi-multi-tree-popup .popup-view-tree { + min-height: 170px; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-multi-tree-check-selected-button .trigger-check-selected { + color: #3f8ce8; + z-index: 1; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-numerical-interval .numerical-interval-small-editor { + -moz-border-radius-topleft: 2px; + -webkit-border-top-left-radius: 2px; + -moz-border-radius-bottomleft: 2px; + -webkit-border-bottom-left-radius: 2px; + border-top-left-radius: 2px; + border-bottom-left-radius: 2px; +} +.bi-numerical-interval .numerical-interval-big-editor { + -moz-border-radius-topright: 2px; + -webkit-border-top-right-radius: 2px; + -moz-border-radius-bottomright: 2px; + -webkit-border-bottom-right-radius: 2px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; +} +.bi-numerical-interval .numerical-interval-big-combo { + -moz-border-radius-topleft: 2px; + -webkit-border-top-left-radius: 2px; + -moz-border-radius-bottomleft: 2px; + -webkit-border-bottom-left-radius: 2px; + border-top-left-radius: 2px; + border-bottom-left-radius: 2px; +} +.bi-numerical-interval .numerical-interval-big-combo .bi-icon-combo-trigger .icon-combo-trigger-icon { + font-size: 14px; +} +.bi-numerical-interval .numerical-interval-small-combo { + -moz-border-radius-topright: 2px; + -webkit-border-top-right-radius: 2px; + -moz-border-radius-bottomright: 2px; + -webkit-border-bottom-right-radius: 2px; + border-top-right-radius: 2px; + border-bottom-right-radius: 2px; +} +.bi-numerical-interval .numerical-interval-small-combo .bi-icon-combo-trigger .icon-combo-trigger-icon { + font-size: 14px; +} +.bi-numerical-interval.number-error .bi-input { + color: #e85050; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-page-table-cell { + -webkit-user-select: initial; + -khtml-user-select: initial; + -moz-user-select: initial; + -ms-user-select: initial; + -o-user-select: initial; + user-select: initial; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-path-chooser .path-chooser-radio { + z-index: 1; +} +.bi-path-region .path-region-label { + z-index: 1; +} +.bi-preview-table-cell { + min-height: 25px; + min-width: 80px; + max-width: 220px; +} +.bi-preview-table { + -webkit-user-select: initial; + -khtml-user-select: initial; + -moz-user-select: initial; + -ms-user-select: initial; + -o-user-select: initial; + user-select: initial; +} +.bi-preview-table > div > table > thead > tr.odd, +.bi-preview-table > div > div > div > table > thead > tr.odd { + background-color: #eff1f4; +} +.bi-theme-dark .bi-preview-table > div > table > thead > tr.odd, +.bi-theme-dark .bi-preview-table > div > div > div > table > thead > tr.odd { + background-color: #191b2b; +} +.bi-preview-table-header-cell { + font-weight: bold; + min-height: 25px; + min-width: 80px; + max-width: 220px; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-quarter-trigger { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-relation-view-region .relation-view-region-container { + z-index: 1; + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} +.bi-relation-view-region .relation-view-region-container.other-package { + border-style: dashed; +} +.bi-sequence-table-dynamic-number .sequence-table-title-cell { + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ +} +.bi-sequence-table-dynamic-number .sequence-table-number-cell { + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ +} +.bi-sequence-table-list-number .sequence-table-title-cell { + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ +} +.bi-sequence-table-list-number .sequence-table-number-cell { + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-sequence-table-tree-number .sequence-table-title-cell { + overflow: hidden; + overflow-x: hidden; + overflow-y: hidden; + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ +} +.bi-sequence-table-tree-number .sequence-table-number-cell { + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ +} +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +/****** common color(常用颜色,可用于普遍场景) *****/ +/**** custom color(自定义颜色,用于特定场景) ****/ +.bi-year-popup .year-popup-navigation { + line-height: 30px; +} +.bi-year-popup .year-popup-navigation > .center-element { + border-left: 1px solid #d4dadd; +} +.bi-year-popup .year-popup-navigation > .first-element { + border-left: none; +} +.bi-theme-dark .bi-year-popup .year-popup-navigation > .center-element { + border-left: 1px solid #525466; +} +.bi-theme-dark .bi-year-popup .year-popup-navigation > .first-element { + border-left: none; +} +.bi-year-trigger { + -webkit-border-radius: 2px; + -moz-border-radius: 2px; + border-radius: 2px; +} diff --git a/docs/bundle.js b/docs/bundle.js new file mode 100644 index 000000000..bf8299aa7 --- /dev/null +++ b/docs/bundle.js @@ -0,0 +1,93663 @@ +/*! + * jQuery JavaScript Library v1.9.1 + * http://jquery.com/ + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * + * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors + * Released under the MIT license + * http://jquery.org/license + * + * Date: 2013-2-4 + */ +(function( window, undefined ) { + +// Can't do this because several apps including ASP.NET trace +// the stack via arguments.caller.callee and Firefox dies if +// you try to trace through "use strict" call chains. (#13335) +// Support: Firefox 18+ +//"use strict"; +var + // The deferred used on DOM ready + readyList, + + // A central reference to the root jQuery(document) + rootjQuery, + + // Support: IE<9 + // For `typeof node.method` instead of `node.method !== undefined` + core_strundefined = typeof undefined, + + // Use the correct document accordingly with window argument (sandbox) + document = window.document, + location = window.location, + + // Map over jQuery in case of overwrite + _jQuery = window.jQuery, + + // Map over the $ in case of overwrite + _$ = window.$, + + // [[Class]] -> type pairs + class2type = {}, + + // List of deleted data cache ids, so we can reuse them + core_deletedIds = [], + + core_version = "1.9.1", + + // Save a reference to some core methods + core_concat = core_deletedIds.concat, + core_push = core_deletedIds.push, + core_slice = core_deletedIds.slice, + core_indexOf = core_deletedIds.indexOf, + core_toString = class2type.toString, + core_hasOwn = class2type.hasOwnProperty, + core_trim = core_version.trim, + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.fn.init( selector, context, rootjQuery ); + }, + + // Used for matching numbers + core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, + + // Used for splitting on whitespace + core_rnotwhite = /\S+/g, + + // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) + rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, + + // Match a standalone tag + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, + + // JSON RegExp + rvalidchars = /^[\],:{}\s]*$/, + rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, + rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, + rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, + + // Matches dashed string for camelizing + rmsPrefix = /^-ms-/, + rdashAlpha = /-([\da-z])/gi, + + // Used by jQuery.camelCase as callback to replace() + fcamelCase = function( all, letter ) { + return letter.toUpperCase(); + }, + + // The ready event handler + completed = function( event ) { + + // readyState === "complete" is good enough for us to call the dom ready in oldIE + if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { + detach(); + jQuery.ready(); + } + }, + // Clean-up method for dom ready events + detach = function() { + if ( document.addEventListener ) { + document.removeEventListener( "DOMContentLoaded", completed, false ); + window.removeEventListener( "load", completed, false ); + + } else { + document.detachEvent( "onreadystatechange", completed ); + window.detachEvent( "onload", completed ); + } + }; + +jQuery.fn = jQuery.prototype = { + // The current version of jQuery being used + jquery: core_version, + + constructor: jQuery, + init: function( selector, context, rootjQuery ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) { + context = context instanceof jQuery ? context[0] : context; + + // scripts is true for back-compat + jQuery.merge( this, jQuery.parseHTML( + match[1], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + // Properties of context are called as methods if possible + if ( jQuery.isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[2] ); + + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id !== match[2] ) { + return rootjQuery.find( selector ); + } + + // Otherwise, we inject the element directly into the jQuery object + this.length = 1; + this[0] = elem; + } + + this.context = document; + this.selector = selector; + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || rootjQuery ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this.context = this[0] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) { + return rootjQuery.ready( selector ); + } + + if ( selector.selector !== undefined ) { + this.selector = selector.selector; + this.context = selector.context; + } + + return jQuery.makeArray( selector, this ); + }, + + // Start with an empty selector + selector: "", + + // The default length of a jQuery object is 0 + length: 0, + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + toArray: function() { + return core_slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + return num == null ? + + // Return a 'clean' array + this.toArray() : + + // Return just the object + ( num < 0 ? this[ this.length + num ] : this[ num ] ); + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + ret.context = this.context; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + // (You can seed the arguments with an array of args, but this is + // only used internally.) + each: function( callback, args ) { + return jQuery.each( this, callback, args ); + }, + + ready: function( fn ) { + // Add the callback + jQuery.ready.promise().done( fn ); + + return this; + }, + + slice: function() { + return this.pushStack( core_slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function( elem, i ) { + return callback.call( elem, i, elem ); + })); + }, + + end: function() { + return this.prevObject || this.constructor(null); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: core_push, + sort: [].sort, + splice: [].splice +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.fn.init.prototype = jQuery.fn; + +jQuery.extend = jQuery.fn.extend = function() { + var src, copyIsArray, copy, name, options, clone, + target = arguments[0] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !jQuery.isFunction(target) ) { + target = {}; + } + + // extend jQuery itself if only one argument is passed + if ( length === i ) { + target = this; + --i; + } + + for ( ; i < length; i++ ) { + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) { + // Extend the base object + for ( name in options ) { + src = target[ name ]; + copy = options[ name ]; + + // Prevent never-ending loop + if ( target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { + if ( copyIsArray ) { + copyIsArray = false; + clone = src && jQuery.isArray(src) ? src : []; + + } else { + clone = src && jQuery.isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend({ + noConflict: function( deep ) { + if ( window.$ === jQuery ) { + window.$ = _$; + } + + if ( deep && window.jQuery === jQuery ) { + window.jQuery = _jQuery; + } + + return jQuery; + }, + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Hold (or release) the ready event + holdReady: function( hold ) { + if ( hold ) { + jQuery.readyWait++; + } else { + jQuery.ready( true ); + } + }, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). + if ( !document.body ) { + return setTimeout( jQuery.ready ); + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + + // Trigger any bound ready events + if ( jQuery.fn.trigger ) { + jQuery( document ).trigger("ready").off("ready"); + } + }, + + // See test/unit/core.js for details concerning isFunction. + // Since version 1.3, DOM methods and functions like alert + // aren't supported. They return false on IE (#2968). + isFunction: function( obj ) { + return jQuery.type(obj) === "function"; + }, + + isArray: Array.isArray || function( obj ) { + return jQuery.type(obj) === "array"; + }, + + isWindow: function( obj ) { + return obj != null && obj == obj.window; + }, + + isNumeric: function( obj ) { + return !isNaN( parseFloat(obj) ) && isFinite( obj ); + }, + + type: function( obj ) { + if ( obj == null ) { + return String( obj ); + } + return typeof obj === "object" || typeof obj === "function" ? + class2type[ core_toString.call(obj) ] || "object" : + typeof obj; + }, + + isPlainObject: function( obj ) { + // Must be an Object. + // Because of IE, we also have to check the presence of the constructor property. + // Make sure that DOM nodes and window objects don't pass through, as well + if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { + return false; + } + + try { + // Not own constructor property must be Object + if ( obj.constructor && + !core_hasOwn.call(obj, "constructor") && + !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { + return false; + } + } catch ( e ) { + // IE8,9 Will throw exceptions on certain host objects #9897 + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + + var key; + for ( key in obj ) {} + + return key === undefined || core_hasOwn.call( obj, key ); + }, + + isEmptyObject: function( obj ) { + var name; + for ( name in obj ) { + return false; + } + return true; + }, + + error: function( msg ) { + throw new Error( msg ); + }, + + // data: string of html + // context (optional): If specified, the fragment will be created in this context, defaults to document + // keepScripts (optional): If true, will include scripts passed in the html string + parseHTML: function( data, context, keepScripts ) { + if ( !data || typeof data !== "string" ) { + return null; + } + if ( typeof context === "boolean" ) { + keepScripts = context; + context = false; + } + context = context || document; + + var parsed = rsingleTag.exec( data ), + scripts = !keepScripts && []; + + // Single tag + if ( parsed ) { + return [ context.createElement( parsed[1] ) ]; + } + + parsed = jQuery.buildFragment( [ data ], context, scripts ); + if ( scripts ) { + jQuery( scripts ).remove(); + } + return jQuery.merge( [], parsed.childNodes ); + }, + + parseJSON: function( data ) { + // Attempt to parse using the native JSON parser first + if ( window.JSON && window.JSON.parse ) { + return window.JSON.parse( data ); + } + + if ( data === null ) { + return data; + } + + if ( typeof data === "string" ) { + + // Make sure leading/trailing whitespace is removed (IE can't handle it) + data = jQuery.trim( data ); + + if ( data ) { + // Make sure the incoming data is actual JSON + // Logic borrowed from http://json.org/json2.js + if ( rvalidchars.test( data.replace( rvalidescape, "@" ) + .replace( rvalidtokens, "]" ) + .replace( rvalidbraces, "")) ) { + + return ( new Function( "return " + data ) )(); + } + } + } + + jQuery.error( "Invalid JSON: " + data ); + }, + + // Cross-browser xml parsing + parseXML: function( data ) { + var xml, tmp; + if ( !data || typeof data !== "string" ) { + return null; + } + try { + if ( window.DOMParser ) { // Standard + tmp = new DOMParser(); + xml = tmp.parseFromString( data , "text/xml" ); + } else { // IE + xml = new ActiveXObject( "Microsoft.XMLDOM" ); + xml.async = "false"; + xml.loadXML( data ); + } + } catch( e ) { + xml = undefined; + } + if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { + jQuery.error( "Invalid XML: " + data ); + } + return xml; + }, + + noop: function() {}, + + // Evaluates a script in a global context + // Workarounds based on findings by Jim Driscoll + // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context + globalEval: function( data ) { + if ( data && jQuery.trim( data ) ) { + // We use execScript on Internet Explorer + // We use an anonymous function so that context is window + // rather than jQuery in Firefox + ( window.execScript || function( data ) { + window[ "eval" ].call( window, data ); + } )( data ); + } + }, + + // Convert dashed to camelCase; used by the css and data modules + // Microsoft forgot to hump their vendor prefix (#9572) + camelCase: function( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + }, + + // args is for internal usage only + each: function( obj, callback, args ) { + var value, + i = 0, + length = obj.length, + isArray = isArraylike( obj ); + + if ( args ) { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.apply( obj[ i ], args ); + + if ( value === false ) { + break; + } + } + } + + // A special, fast, case for the most common use of each + } else { + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } else { + for ( i in obj ) { + value = callback.call( obj[ i ], i, obj[ i ] ); + + if ( value === false ) { + break; + } + } + } + } + + return obj; + }, + + // Use native String.trim function wherever possible + trim: core_trim && !core_trim.call("\uFEFF\xA0") ? + function( text ) { + return text == null ? + "" : + core_trim.call( text ); + } : + + // Otherwise use our own trimming functionality + function( text ) { + return text == null ? + "" : + ( text + "" ).replace( rtrim, "" ); + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArraylike( Object(arr) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + core_push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + var len; + + if ( arr ) { + if ( core_indexOf ) { + return core_indexOf.call( arr, elem, i ); + } + + len = arr.length; + i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; + + for ( ; i < len; i++ ) { + // Skip accessing in sparse arrays + if ( i in arr && arr[ i ] === elem ) { + return i; + } + } + } + + return -1; + }, + + merge: function( first, second ) { + var l = second.length, + i = first.length, + j = 0; + + if ( typeof l === "number" ) { + for ( ; j < l; j++ ) { + first[ i++ ] = second[ j ]; + } + } else { + while ( second[j] !== undefined ) { + first[ i++ ] = second[ j++ ]; + } + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, inv ) { + var retVal, + ret = [], + i = 0, + length = elems.length; + inv = !!inv; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + retVal = !!callback( elems[ i ], i ); + if ( inv !== retVal ) { + ret.push( elems[ i ] ); + } + } + + return ret; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var value, + i = 0, + length = elems.length, + isArray = isArraylike( elems ), + ret = []; + + // Go through the array, translating each of the items to their + if ( isArray ) { + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret[ ret.length ] = value; + } + } + } + + // Flatten any nested arrays + return core_concat.apply( [], ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // Bind a function to a context, optionally partially applying any + // arguments. + proxy: function( fn, context ) { + var args, proxy, tmp; + + if ( typeof context === "string" ) { + tmp = fn[ context ]; + context = fn; + fn = tmp; + } + + // Quick check to determine if target is callable, in the spec + // this throws a TypeError, but we will just return undefined. + if ( !jQuery.isFunction( fn ) ) { + return undefined; + } + + // Simulated bind + args = core_slice.call( arguments, 2 ); + proxy = function() { + return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); + }; + + // Set the guid of unique handler to the same of original handler, so it can be removed + proxy.guid = fn.guid = fn.guid || jQuery.guid++; + + return proxy; + }, + + // Multifunctional method to get and set values of a collection + // The value/s can optionally be executed if it's a function + access: function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + length = elems.length, + bulk = key == null; + + // Sets many values + if ( jQuery.type( key ) === "object" ) { + chainable = true; + for ( i in key ) { + jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !jQuery.isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < length; i++ ) { + fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); + } + } + } + + return chainable ? + elems : + + // Gets + bulk ? + fn.call( elems ) : + length ? fn( elems[0], key ) : emptyGet; + }, + + now: function() { + return ( new Date() ).getTime(); + } +}); + +jQuery.ready.promise = function( obj ) { + if ( !readyList ) { + + readyList = jQuery.Deferred(); + + // Catch cases where $(document).ready() is called after the browser event has already occurred. + // we once tried to use readyState "interactive" here, but it caused issues like the one + // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 + if ( document.readyState === "complete" ) { + // Handle it asynchronously to allow scripts the opportunity to delay ready + setTimeout( jQuery.ready ); + + // Standards-based browsers support DOMContentLoaded + } else if ( document.addEventListener ) { + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed, false ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed, false ); + + // If IE event model is used + } else { + // Ensure firing before onload, maybe late but safe also for iframes + document.attachEvent( "onreadystatechange", completed ); + + // A fallback to window.onload, that will always work + window.attachEvent( "onload", completed ); + + // If IE and not a frame + // continually check to see if the document is ready + var top = false; + + try { + top = window.frameElement == null && document.documentElement; + } catch(e) {} + + if ( top && top.doScroll ) { + (function doScrollCheck() { + if ( !jQuery.isReady ) { + + try { + // Use the trick by Diego Perini + // http://javascript.nwbox.com/IEContentLoaded/ + top.doScroll("left"); + } catch(e) { + return setTimeout( doScrollCheck, 50 ); + } + + // detach all dom ready events + detach(); + + // and execute any waiting functions + jQuery.ready(); + } + })(); + } + } + } + return readyList.promise( obj ); +}; + +// Populate the class2type map +jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); +}); + +function isArraylike( obj ) { + var length = obj.length, + type = jQuery.type( obj ); + + if ( jQuery.isWindow( obj ) ) { + return false; + } + + if ( obj.nodeType === 1 && length ) { + return true; + } + + return type === "array" || type !== "function" && + ( length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj ); +} + +// All jQuery objects should point back to these +rootjQuery = jQuery(document); +// String to Object options format cache +var optionsCache = {}; + +// Convert String-formatted options into Object-formatted ones and store in cache +function createOptions( options ) { + var object = optionsCache[ options ] = {}; + jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { + object[ flag ] = true; + }); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + ( optionsCache[ options ] || createOptions( options ) ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + // Last fire value (for non-forgettable lists) + memory, + // Flag to know if list was already fired + fired, + // End of the loop when firing + firingLength, + // Index of currently firing callback (modified by remove if needed) + firingIndex, + // First callback to fire (used internally by add and fireWith) + firingStart, + // Actual callback list + list = [], + // Stack of fire calls for repeatable lists + stack = !options.once && [], + // Fire callbacks + fire = function( data ) { + memory = options.memory && data; + fired = true; + firingIndex = firingStart || 0; + firingStart = 0; + firingLength = list.length; + firing = true; + for ( ; list && firingIndex < firingLength; firingIndex++ ) { + if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { + memory = false; // To prevent further calls using add + break; + } + } + firing = false; + if ( list ) { + if ( stack ) { + if ( stack.length ) { + fire( stack.shift() ); + } + } else if ( memory ) { + list = []; + } else { + self.disable(); + } + } + }, + // Actual Callbacks object + self = { + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + // First, we save the current length + var start = list.length; + (function add( args ) { + jQuery.each( args, function( _, arg ) { + var type = jQuery.type( arg ); + if ( type === "function" ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && type !== "string" ) { + // Inspect recursively + add( arg ); + } + }); + })( arguments ); + // Do we need to add the callbacks to the + // current firing batch? + if ( firing ) { + firingLength = list.length; + // With memory, if we're not firing then + // we should call right away + } else if ( memory ) { + firingStart = start; + fire( memory ); + } + } + return this; + }, + // Remove a callback from the list + remove: function() { + if ( list ) { + jQuery.each( arguments, function( _, arg ) { + var index; + while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + // Handle firing indexes + if ( firing ) { + if ( index <= firingLength ) { + firingLength--; + } + if ( index <= firingIndex ) { + firingIndex--; + } + } + } + }); + } + return this; + }, + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); + }, + // Remove all callbacks from the list + empty: function() { + list = []; + return this; + }, + // Have the list do nothing anymore + disable: function() { + list = stack = memory = undefined; + return this; + }, + // Is it disabled? + disabled: function() { + return !list; + }, + // Lock the list in its current state + lock: function() { + stack = undefined; + if ( !memory ) { + self.disable(); + } + return this; + }, + // Is it locked? + locked: function() { + return !stack; + }, + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + if ( list && ( !fired || stack ) ) { + if ( firing ) { + stack.push( args ); + } else { + fire( args ); + } + } + return this; + }, + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; +jQuery.extend({ + + Deferred: function( func ) { + var tuples = [ + // action, add listener, listener list, final state + [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], + [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], + [ "notify", "progress", jQuery.Callbacks("memory") ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + then: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + return jQuery.Deferred(function( newDefer ) { + jQuery.each( tuples, function( i, tuple ) { + var action = tuple[ 0 ], + fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; + // deferred[ done | fail | progress ] for forwarding actions to newDefer + deferred[ tuple[1] ](function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && jQuery.isFunction( returned.promise ) ) { + returned.promise() + .done( newDefer.resolve ) + .fail( newDefer.reject ) + .progress( newDefer.notify ); + } else { + newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); + } + }); + }); + fns = null; + }).promise(); + }, + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Keep pipe for back-compat + promise.pipe = promise.then; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 3 ]; + + // promise[ done | fail | progress ] = list.add + promise[ tuple[1] ] = list.add; + + // Handle state + if ( stateString ) { + list.add(function() { + // state = [ resolved | rejected ] + state = stateString; + + // [ reject_list | resolve_list ].disable; progress_list.lock + }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); + } + + // deferred[ resolve | reject | notify ] + deferred[ tuple[0] ] = function() { + deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); + return this; + }; + deferred[ tuple[0] + "With" ] = list.fireWith; + }); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( subordinate /* , ..., subordinateN */ ) { + var i = 0, + resolveValues = core_slice.call( arguments ), + length = resolveValues.length, + + // the count of uncompleted subordinates + remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, + + // the master Deferred. If resolveValues consist of only a single Deferred, just use that. + deferred = remaining === 1 ? subordinate : jQuery.Deferred(), + + // Update function for both resolve and progress values + updateFunc = function( i, contexts, values ) { + return function( value ) { + contexts[ i ] = this; + values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; + if( values === progressValues ) { + deferred.notifyWith( contexts, values ); + } else if ( !( --remaining ) ) { + deferred.resolveWith( contexts, values ); + } + }; + }, + + progressValues, progressContexts, resolveContexts; + + // add listeners to Deferred subordinates; treat others as resolved + if ( length > 1 ) { + progressValues = new Array( length ); + progressContexts = new Array( length ); + resolveContexts = new Array( length ); + for ( ; i < length; i++ ) { + if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { + resolveValues[ i ].promise() + .done( updateFunc( i, resolveContexts, resolveValues ) ) + .fail( deferred.reject ) + .progress( updateFunc( i, progressContexts, progressValues ) ); + } else { + --remaining; + } + } + } + + // if we're not waiting on anything, resolve the master + if ( !remaining ) { + deferred.resolveWith( resolveContexts, resolveValues ); + } + + return deferred.promise(); + } +}); +jQuery.support = (function() { + + var support, all, a, + input, select, fragment, + opt, eventName, isSupported, i, + div = document.createElement("div"); + + // Setup + div.setAttribute( "className", "t" ); + div.innerHTML = "
a"; + + // Support tests won't run in some limited or non-browser environments + all = div.getElementsByTagName("*"); + a = div.getElementsByTagName("a")[ 0 ]; + if ( !all || !a || !all.length ) { + return {}; + } + + // First batch of tests + select = document.createElement("select"); + opt = select.appendChild( document.createElement("option") ); + input = div.getElementsByTagName("input")[ 0 ]; + + a.style.cssText = "top:1px;float:left;opacity:.5"; + support = { + // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) + getSetAttribute: div.className !== "t", + + // IE strips leading whitespace when .innerHTML is used + leadingWhitespace: div.firstChild.nodeType === 3, + + // Make sure that tbody elements aren't automatically inserted + // IE will insert them into empty tables + tbody: !div.getElementsByTagName("tbody").length, + + // Make sure that link elements get serialized correctly by innerHTML + // This requires a wrapper element in IE + htmlSerialize: !!div.getElementsByTagName("link").length, + + // Get the style information from getAttribute + // (IE uses .cssText instead) + style: /top/.test( a.getAttribute("style") ), + + // Make sure that URLs aren't manipulated + // (IE normalizes it by default) + hrefNormalized: a.getAttribute("href") === "/a", + + // Make sure that element opacity exists + // (IE uses filter instead) + // Use a regex to work around a WebKit issue. See #5145 + opacity: /^0.5/.test( a.style.opacity ), + + // Verify style float existence + // (IE uses styleFloat instead of cssFloat) + cssFloat: !!a.style.cssFloat, + + // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) + checkOn: !!input.value, + + // Make sure that a selected-by-default option has a working selected property. + // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) + optSelected: opt.selected, + + // Tests for enctype support on a form (#6743) + enctype: !!document.createElement("form").enctype, + + // Makes sure cloning an html5 element does not cause problems + // Where outerHTML is undefined, this still works + html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", + + // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode + boxModel: document.compatMode === "CSS1Compat", + + // Will be defined later + deleteExpando: true, + noCloneEvent: true, + inlineBlockNeedsLayout: false, + shrinkWrapBlocks: false, + reliableMarginRight: true, + boxSizingReliable: true, + pixelPosition: false + }; + + // Make sure checked status is properly cloned + input.checked = true; + support.noCloneChecked = input.cloneNode( true ).checked; + + // Make sure that the options inside disabled selects aren't marked as disabled + // (WebKit marks them as disabled) + select.disabled = true; + support.optDisabled = !opt.disabled; + + // Support: IE<9 + try { + delete div.test; + } catch( e ) { + support.deleteExpando = false; + } + + // Check if we can trust getAttribute("value") + input = document.createElement("input"); + input.setAttribute( "value", "" ); + support.input = input.getAttribute( "value" ) === ""; + + // Check if an input maintains its value after becoming a radio + input.value = "t"; + input.setAttribute( "type", "radio" ); + support.radioValue = input.value === "t"; + + // #11217 - WebKit loses check when the name is after the checked attribute + input.setAttribute( "checked", "t" ); + input.setAttribute( "name", "t" ); + + fragment = document.createDocumentFragment(); + fragment.appendChild( input ); + + // Check if a disconnected checkbox will retain its checked + // value of true after appended to the DOM (IE6/7) + support.appendChecked = input.checked; + + // WebKit doesn't clone checked state correctly in fragments + support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE<9 + // Opera does not clone events (and typeof div.attachEvent === undefined). + // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() + if ( div.attachEvent ) { + div.attachEvent( "onclick", function() { + support.noCloneEvent = false; + }); + + div.cloneNode( true ).click(); + } + + // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) + // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php + for ( i in { submit: true, change: true, focusin: true }) { + div.setAttribute( eventName = "on" + i, "t" ); + + support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; + } + + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + // Run tests that need a body at doc ready + jQuery(function() { + var container, marginDiv, tds, + divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", + body = document.getElementsByTagName("body")[0]; + + if ( !body ) { + // Return for frameset docs that don't have a body + return; + } + + container = document.createElement("div"); + container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; + + body.appendChild( container ).appendChild( div ); + + // Support: IE8 + // Check if table cells still have offsetWidth/Height when they are set + // to display:none and there are still other visible table cells in a + // table row; if so, offsetWidth/Height are not reliable for use when + // determining if an element has been hidden directly using + // display:none (it is still safe to use offsets if a parent element is + // hidden; don safety goggles and see bug #4512 for more information). + div.innerHTML = "
t
"; + tds = div.getElementsByTagName("td"); + tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; + isSupported = ( tds[ 0 ].offsetHeight === 0 ); + + tds[ 0 ].style.display = ""; + tds[ 1 ].style.display = "none"; + + // Support: IE8 + // Check if empty table cells still have offsetWidth/Height + support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); + + // Check box-sizing and margin behavior + div.innerHTML = ""; + div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; + support.boxSizing = ( div.offsetWidth === 4 ); + support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); + + // Use window.getComputedStyle because jsdom on node.js will break without it. + if ( window.getComputedStyle ) { + support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; + support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; + + // Check if div with explicit width and no margin-right incorrectly + // gets computed margin-right based on width of container. (#3333) + // Fails in WebKit before Feb 2011 nightlies + // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right + marginDiv = div.appendChild( document.createElement("div") ); + marginDiv.style.cssText = div.style.cssText = divReset; + marginDiv.style.marginRight = marginDiv.style.width = "0"; + div.style.width = "1px"; + + support.reliableMarginRight = + !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); + } + + if ( typeof div.style.zoom !== core_strundefined ) { + // Support: IE<8 + // Check if natively block-level elements act like inline-block + // elements when setting their display to 'inline' and giving + // them layout + div.innerHTML = ""; + div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; + support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); + + // Support: IE6 + // Check if elements with layout shrink-wrap their children + div.style.display = "block"; + div.innerHTML = "
"; + div.firstChild.style.width = "5px"; + support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); + + if ( support.inlineBlockNeedsLayout ) { + // Prevent IE 6 from affecting layout for positioned elements #11048 + // Prevent IE from shrinking the body in IE 7 mode #12869 + // Support: IE<8 + body.style.zoom = 1; + } + } + + body.removeChild( container ); + + // Null elements to avoid leaks in IE + container = div = tds = marginDiv = null; + }); + + // Null elements to avoid leaks in IE + all = select = fragment = opt = a = input = null; + + return support; +})(); + +var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, + rmultiDash = /([A-Z])/g; + +function internalData( elem, name, data, pvt /* Internal Use Only */ ){ + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var thisCache, ret, + internalKey = jQuery.expando, + getByName = typeof name === "string", + + // We have to handle DOM nodes and JS objects differently because IE6-7 + // can't GC object references properly across the DOM-JS boundary + isNode = elem.nodeType, + + // Only DOM nodes need the global jQuery cache; JS object data is + // attached directly to the object so GC can occur automatically + cache = isNode ? jQuery.cache : elem, + + // Only defining an ID for JS objects if its cache already exists allows + // the code to shortcut on the same path as a DOM node with no cache + id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; + + // Avoid doing any more work than we need to when trying to get data on an + // object that has no data at all + if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { + return; + } + + if ( !id ) { + // Only DOM nodes need a new unique ID for each element since their data + // ends up in the global cache + if ( isNode ) { + elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; + } else { + id = internalKey; + } + } + + if ( !cache[ id ] ) { + cache[ id ] = {}; + + // Avoids exposing jQuery metadata on plain JS objects when the object + // is serialized using JSON.stringify + if ( !isNode ) { + cache[ id ].toJSON = jQuery.noop; + } + } + + // An object can be passed to jQuery.data instead of a key/value pair; this gets + // shallow copied over onto the existing cache + if ( typeof name === "object" || typeof name === "function" ) { + if ( pvt ) { + cache[ id ] = jQuery.extend( cache[ id ], name ); + } else { + cache[ id ].data = jQuery.extend( cache[ id ].data, name ); + } + } + + thisCache = cache[ id ]; + + // jQuery data() is stored in a separate object inside the object's internal data + // cache in order to avoid key collisions between internal data and user-defined + // data. + if ( !pvt ) { + if ( !thisCache.data ) { + thisCache.data = {}; + } + + thisCache = thisCache.data; + } + + if ( data !== undefined ) { + thisCache[ jQuery.camelCase( name ) ] = data; + } + + // Check for both converted-to-camel and non-converted data property names + // If a data property was specified + if ( getByName ) { + + // First Try to find as-is property data + ret = thisCache[ name ]; + + // Test for null|undefined property data + if ( ret == null ) { + + // Try to find the camelCased property + ret = thisCache[ jQuery.camelCase( name ) ]; + } + } else { + ret = thisCache; + } + + return ret; +} + +function internalRemoveData( elem, name, pvt ) { + if ( !jQuery.acceptData( elem ) ) { + return; + } + + var i, l, thisCache, + isNode = elem.nodeType, + + // See jQuery.data for more information + cache = isNode ? jQuery.cache : elem, + id = isNode ? elem[ jQuery.expando ] : jQuery.expando; + + // If there is already no cache entry for this object, there is no + // purpose in continuing + if ( !cache[ id ] ) { + return; + } + + if ( name ) { + + thisCache = pvt ? cache[ id ] : cache[ id ].data; + + if ( thisCache ) { + + // Support array or space separated string names for data keys + if ( !jQuery.isArray( name ) ) { + + // try the string as a key before any manipulation + if ( name in thisCache ) { + name = [ name ]; + } else { + + // split the camel cased version by spaces unless a key with the spaces exists + name = jQuery.camelCase( name ); + if ( name in thisCache ) { + name = [ name ]; + } else { + name = name.split(" "); + } + } + } else { + // If "name" is an array of keys... + // When data is initially created, via ("key", "val") signature, + // keys will be converted to camelCase. + // Since there is no way to tell _how_ a key was added, remove + // both plain key and camelCase key. #12786 + // This will only penalize the array argument path. + name = name.concat( jQuery.map( name, jQuery.camelCase ) ); + } + + for ( i = 0, l = name.length; i < l; i++ ) { + delete thisCache[ name[i] ]; + } + + // If there is no data left in the cache, we want to continue + // and let the cache object itself get destroyed + if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { + return; + } + } + } + + // See jQuery.data for more information + if ( !pvt ) { + delete cache[ id ].data; + + // Don't destroy the parent cache unless the internal data object + // had been the only thing left in it + if ( !isEmptyDataObject( cache[ id ] ) ) { + return; + } + } + + // Destroy the cache + if ( isNode ) { + jQuery.cleanData( [ elem ], true ); + + // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) + } else if ( jQuery.support.deleteExpando || cache != cache.window ) { + delete cache[ id ]; + + // When all else fails, null + } else { + cache[ id ] = null; + } +} + +jQuery.extend({ + cache: {}, + + // Unique for each copy of jQuery on the page + // Non-digits removed to match rinlinejQuery + expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), + + // The following elements throw uncatchable exceptions if you + // attempt to add expando properties to them. + noData: { + "embed": true, + // Ban all objects except for Flash (which handle expandos) + "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", + "applet": true + }, + + hasData: function( elem ) { + elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; + return !!elem && !isEmptyDataObject( elem ); + }, + + data: function( elem, name, data ) { + return internalData( elem, name, data ); + }, + + removeData: function( elem, name ) { + return internalRemoveData( elem, name ); + }, + + // For internal use only. + _data: function( elem, name, data ) { + return internalData( elem, name, data, true ); + }, + + _removeData: function( elem, name ) { + return internalRemoveData( elem, name, true ); + }, + + // A method for determining if a DOM node can handle the data expando + acceptData: function( elem ) { + // Do not set data on non-element because it will not be cleared (#8335). + if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { + return false; + } + + var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; + + // nodes accept data unless otherwise specified; rejection can be conditional + return !noData || noData !== true && elem.getAttribute("classid") === noData; + } +}); + +jQuery.fn.extend({ + data: function( key, value ) { + var attrs, name, + elem = this[0], + i = 0, + data = null; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = jQuery.data( elem ); + + if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { + attrs = elem.attributes; + for ( ; i < attrs.length; i++ ) { + name = attrs[i].name; + + if ( !name.indexOf( "data-" ) ) { + name = jQuery.camelCase( name.slice(5) ); + + dataAttr( elem, name, data[ name ] ); + } + } + jQuery._data( elem, "parsedAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each(function() { + jQuery.data( this, key ); + }); + } + + return jQuery.access( this, function( value ) { + + if ( value === undefined ) { + // Try to fetch any internally stored data first + return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; + } + + this.each(function() { + jQuery.data( this, key, value ); + }); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each(function() { + jQuery.removeData( this, key ); + }); + } +}); + +function dataAttr( elem, key, data ) { + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + + var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); + + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = data === "true" ? true : + data === "false" ? false : + data === "null" ? null : + // Only convert to a number if it doesn't change the string + +data + "" === data ? +data : + rbrace.test( data ) ? jQuery.parseJSON( data ) : + data; + } catch( e ) {} + + // Make sure we set the data so it isn't changed later + jQuery.data( elem, key, data ); + + } else { + data = undefined; + } + } + + return data; +} + +// checks a cache object for emptiness +function isEmptyDataObject( obj ) { + var name; + for ( name in obj ) { + + // if the public data object is empty, the private is still empty + if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { + continue; + } + if ( name !== "toJSON" ) { + return false; + } + } + + return true; +} +jQuery.extend({ + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = jQuery._data( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || jQuery.isArray(data) ) { + queue = jQuery._data( elem, type, jQuery.makeArray(data) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + hooks.cur = fn; + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // not intended for public consumption - generates a queueHooks object, or returns the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return jQuery._data( elem, key ) || jQuery._data( elem, key, { + empty: jQuery.Callbacks("once memory").add(function() { + jQuery._removeData( elem, type + "queue" ); + jQuery._removeData( elem, key ); + }) + }); + } +}); + +jQuery.fn.extend({ + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[0], type ); + } + + return data === undefined ? + this : + this.each(function() { + var queue = jQuery.queue( this, type, data ); + + // ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[0] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + }); + }, + dequeue: function( type ) { + return this.each(function() { + jQuery.dequeue( this, type ); + }); + }, + // Based off of the plugin by Clint Helfers, with permission. + // http://blindsignals.com/index.php/2009/07/jquery-delay/ + delay: function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = setTimeout( next, time ); + hooks.stop = function() { + clearTimeout( timeout ); + }; + }); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while( i-- ) { + tmp = jQuery._data( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +}); +var nodeHook, boolHook, + rclass = /[\t\r\n]/g, + rreturn = /\r/g, + rfocusable = /^(?:input|select|textarea|button|object)$/i, + rclickable = /^(?:a|area)$/i, + rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, + ruseDefault = /^(?:checked|selected)$/i, + getSetAttribute = jQuery.support.getSetAttribute, + getSetInput = jQuery.support.input; + +jQuery.fn.extend({ + attr: function( name, value ) { + return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each(function() { + jQuery.removeAttr( this, name ); + }); + }, + + prop: function( name, value ) { + return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + name = jQuery.propFix[ name ] || name; + return this.each(function() { + // try/catch handles cases where IE balks (such as removing a property on window) + try { + this[ name ] = undefined; + delete this[ name ]; + } catch( e ) {} + }); + }, + + addClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).addClass( value.call( this, j, this.className ) ); + }); + } + + if ( proceed ) { + // The disjunction here is for better compressibility (see removeClass) + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + " " + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + elem.className = jQuery.trim( cur ); + + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, clazz, j, + i = 0, + len = this.length, + proceed = arguments.length === 0 || typeof value === "string" && value; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( j ) { + jQuery( this ).removeClass( value.call( this, j, this.className ) ); + }); + } + if ( proceed ) { + classes = ( value || "" ).match( core_rnotwhite ) || []; + + for ( ; i < len; i++ ) { + elem = this[ i ]; + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( elem.className ? + ( " " + elem.className + " " ).replace( rclass, " " ) : + "" + ); + + if ( cur ) { + j = 0; + while ( (clazz = classes[j++]) ) { + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + elem.className = value ? jQuery.trim( cur ) : ""; + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isBool = typeof stateVal === "boolean"; + + if ( jQuery.isFunction( value ) ) { + return this.each(function( i ) { + jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); + }); + } + + return this.each(function() { + if ( type === "string" ) { + // toggle individual class names + var className, + i = 0, + self = jQuery( this ), + state = stateVal, + classNames = value.match( core_rnotwhite ) || []; + + while ( (className = classNames[ i++ ]) ) { + // check each className given, space separated list + state = isBool ? state : !self.hasClass( className ); + self[ state ? "addClass" : "removeClass" ]( className ); + } + + // Toggle whole class name + } else if ( type === core_strundefined || type === "boolean" ) { + if ( this.className ) { + // store className if set + jQuery._data( this, "__className__", this.className ); + } + + // If the element has a class name or if we're passed "false", + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; + } + }); + }, + + hasClass: function( selector ) { + var className = " " + selector + " ", + i = 0, + l = this.length; + for ( ; i < l; i++ ) { + if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { + return true; + } + } + + return false; + }, + + val: function( value ) { + var ret, hooks, isFunction, + elem = this[0]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { + return ret; + } + + ret = elem.value; + + return typeof ret === "string" ? + // handle most common string cases + ret.replace(rreturn, "") : + // handle cases where value is null/undef or number + ret == null ? "" : ret; + } + + return; + } + + isFunction = jQuery.isFunction( value ); + + return this.each(function( i ) { + var val, + self = jQuery(this); + + if ( this.nodeType !== 1 ) { + return; + } + + if ( isFunction ) { + val = value.call( this, i, self.val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + } else if ( typeof val === "number" ) { + val += ""; + } else if ( jQuery.isArray( val ) ) { + val = jQuery.map(val, function ( value ) { + return value == null ? "" : value + ""; + }); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + }); + } +}); + +jQuery.extend({ + valHooks: { + option: { + get: function( elem ) { + // attributes.value is undefined in Blackberry 4.7 but + // uses .value. See #6932 + var val = elem.attributes.value; + return !val || val.specified ? elem.value : elem.text; + } + }, + select: { + get: function( elem ) { + var value, option, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one" || index < 0, + values = one ? null : [], + max = one ? index + 1 : options.length, + i = index < 0 ? + max : + one ? index : 0; + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // oldIE doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + // Don't return options that are disabled or in a disabled optgroup + ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var values = jQuery.makeArray( value ); + + jQuery(elem).find("option").each(function() { + this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; + }); + + if ( !values.length ) { + elem.selectedIndex = -1; + } + return values; + } + } + }, + + attr: function( elem, name, value ) { + var hooks, notxml, ret, + nType = elem.nodeType; + + // don't get/set attributes on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === core_strundefined ) { + return jQuery.prop( elem, name, value ); + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + // All attributes are lowercase + // Grab necessary hook if one is defined + if ( notxml ) { + name = name.toLowerCase(); + hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); + } + + if ( value !== undefined ) { + + if ( value === null ) { + jQuery.removeAttr( elem, name ); + + } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + elem.setAttribute( name, value + "" ); + return value; + } + + } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + + // In IE9+, Flash objects don't have .getAttribute (#12945) + // Support: IE9+ + if ( typeof elem.getAttribute !== core_strundefined ) { + ret = elem.getAttribute( name ); + } + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? + undefined : + ret; + } + }, + + removeAttr: function( elem, value ) { + var name, propName, + i = 0, + attrNames = value && value.match( core_rnotwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( (name = attrNames[i++]) ) { + propName = jQuery.propFix[ name ] || name; + + // Boolean attributes get special treatment (#10870) + if ( rboolean.test( name ) ) { + // Set corresponding property to false for boolean attributes + // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 + if ( !getSetAttribute && ruseDefault.test( name ) ) { + elem[ jQuery.camelCase( "default-" + name ) ] = + elem[ propName ] = false; + } else { + elem[ propName ] = false; + } + + // See #9699 for explanation of this approach (setting first, then removal) + } else { + jQuery.attr( elem, name, "" ); + } + + elem.removeAttribute( getSetAttribute ? name : propName ); + } + } + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { + // Setting the type on a radio button after the value resets the value in IE6-9 + // Reset value to default in case type is set after value during creation + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + propFix: { + tabindex: "tabIndex", + readonly: "readOnly", + "for": "htmlFor", + "class": "className", + maxlength: "maxLength", + cellspacing: "cellSpacing", + cellpadding: "cellPadding", + rowspan: "rowSpan", + colspan: "colSpan", + usemap: "useMap", + frameborder: "frameBorder", + contenteditable: "contentEditable" + }, + + prop: function( elem, name, value ) { + var ret, hooks, notxml, + nType = elem.nodeType; + + // don't get/set properties on text, comment and attribute nodes + if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); + + if ( notxml ) { + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { + return ret; + + } else { + return ( elem[ name ] = value ); + } + + } else { + if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { + return ret; + + } else { + return elem[ name ]; + } + } + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set + // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + var attributeNode = elem.getAttributeNode("tabindex"); + + return attributeNode && attributeNode.specified ? + parseInt( attributeNode.value, 10 ) : + rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? + 0 : + undefined; + } + } + } +}); + +// Hook for boolean attributes +boolHook = { + get: function( elem, name ) { + var + // Use .prop to determine if this attribute is understood as boolean + prop = jQuery.prop( elem, name ), + + // Fetch it accordingly + attr = typeof prop === "boolean" && elem.getAttribute( name ), + detail = typeof prop === "boolean" ? + + getSetInput && getSetAttribute ? + attr != null : + // oldIE fabricates an empty string for missing boolean attributes + // and conflates checked/selected into attroperties + ruseDefault.test( name ) ? + elem[ jQuery.camelCase( "default-" + name ) ] : + !!attr : + + // fetch an attribute node for properties not recognized as boolean + elem.getAttributeNode( name ); + + return detail && detail.value !== false ? + name.toLowerCase() : + undefined; + }, + set: function( elem, value, name ) { + if ( value === false ) { + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { + // IE<8 needs the *property* name + elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); + + // Use defaultChecked and defaultSelected for oldIE + } else { + elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; + } + + return name; + } +}; + +// fix oldIE value attroperty +if ( !getSetInput || !getSetAttribute ) { + jQuery.attrHooks.value = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return jQuery.nodeName( elem, "input" ) ? + + // Ignore the value *property* by using defaultValue + elem.defaultValue : + + ret && ret.specified ? ret.value : undefined; + }, + set: function( elem, value, name ) { + if ( jQuery.nodeName( elem, "input" ) ) { + // Does not return so that setAttribute is also used + elem.defaultValue = value; + } else { + // Use nodeHook if defined (#1954); otherwise setAttribute is fine + return nodeHook && nodeHook.set( elem, value, name ); + } + } + }; +} + +// IE6/7 do not support getting/setting some attributes with get/setAttribute +if ( !getSetAttribute ) { + + // Use this for any attribute in IE6/7 + // This fixes almost every IE6/7 issue + nodeHook = jQuery.valHooks.button = { + get: function( elem, name ) { + var ret = elem.getAttributeNode( name ); + return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? + ret.value : + undefined; + }, + set: function( elem, value, name ) { + // Set the existing or create a new attribute node + var ret = elem.getAttributeNode( name ); + if ( !ret ) { + elem.setAttributeNode( + (ret = elem.ownerDocument.createAttribute( name )) + ); + } + + ret.value = value += ""; + + // Break association with cloned elements by also using setAttribute (#9646) + return name === "value" || value === elem.getAttribute( name ) ? + value : + undefined; + } + }; + + // Set contenteditable to false on removals(#10429) + // Setting to empty string throws an error as an invalid value + jQuery.attrHooks.contenteditable = { + get: nodeHook.get, + set: function( elem, value, name ) { + nodeHook.set( elem, value === "" ? false : value, name ); + } + }; + + // Set width and height to auto instead of 0 on empty string( Bug #8150 ) + // This is for removals + jQuery.each([ "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + set: function( elem, value ) { + if ( value === "" ) { + elem.setAttribute( name, "auto" ); + return value; + } + } + }); + }); +} + + +// Some attributes require a special call on IE +// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !jQuery.support.hrefNormalized ) { + jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { + jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { + get: function( elem ) { + var ret = elem.getAttribute( name, 2 ); + return ret == null ? undefined : ret; + } + }); + }); + + // href/src property should get the full normalized URL (#10299/#12915) + jQuery.each([ "href", "src" ], function( i, name ) { + jQuery.propHooks[ name ] = { + get: function( elem ) { + return elem.getAttribute( name, 4 ); + } + }; + }); +} + +if ( !jQuery.support.style ) { + jQuery.attrHooks.style = { + get: function( elem ) { + // Return undefined in the case of empty string + // Note: IE uppercases css property names, but if we were to .toLowerCase() + // .cssText, that would destroy case senstitivity in URL's, like in "background" + return elem.style.cssText || undefined; + }, + set: function( elem, value ) { + return ( elem.style.cssText = value + "" ); + } + }; +} + +// Safari mis-reports the default selected property of an option +// Accessing the parent's selectedIndex property fixes it +if ( !jQuery.support.optSelected ) { + jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { + get: function( elem ) { + var parent = elem.parentNode; + + if ( parent ) { + parent.selectedIndex; + + // Make sure that it also works with optgroups, see #5701 + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + return null; + } + }); +} + +// IE6/7 call enctype encoding +if ( !jQuery.support.enctype ) { + jQuery.propFix.enctype = "encoding"; +} + +// Radios and checkboxes getter/setter +if ( !jQuery.support.checkOn ) { + jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + get: function( elem ) { + // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified + return elem.getAttribute("value") === null ? "on" : elem.value; + } + }; + }); +} +jQuery.each([ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { + set: function( elem, value ) { + if ( jQuery.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); + } + } + }); +}); +var rformElems = /^(?:input|select|textarea)$/i, + rkeyEvent = /^key/, + rmouseEvent = /^(?:mouse|contextmenu)|click/, + rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + var tmp, events, t, handleObjIn, + special, eventHandle, handleObj, + handlers, type, namespaces, origType, + elemData = jQuery._data( elem ); + + // Don't attach events to noData or text/comment nodes (but allow plain objects) + if ( !elemData ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !(events = elemData.events) ) { + events = elemData.events = {}; + } + if ( !(eventHandle = elemData.handle) ) { + eventHandle = elemData.handle = function( e ) { + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? + jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : + undefined; + }; + // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events + eventHandle.elem = elem; + } + + // Handle multiple events separated by a space + // jQuery(...).bind("mouseover mouseout", fn); + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend({ + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join(".") + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !(handlers = events[ type ]) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener/attachEvent if the special events handler returns false + if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + // Bind the global event handler to the element + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle, false ); + + } else if ( elem.attachEvent ) { + elem.attachEvent( "on" + type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + // Nullify elem to prevent memory leaks in IE + elem = null; + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + var j, handleObj, tmp, + origCount, t, events, + special, handlers, type, + namespaces, origType, + elemData = jQuery.hasData( elem ) && jQuery._data( elem ); + + if ( !elemData || !(events = elemData.events) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( core_rnotwhite ) || [""]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[t] ) || []; + type = origType = tmp[1]; + namespaces = ( tmp[2] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + delete elemData.handle; + + // removeData also checks for emptiness and clears the expando if empty + // so use it instead of delete + jQuery._removeData( elem, "events" ); + } + }, + + trigger: function( event, data, elem, onlyHandlers ) { + var handle, ontype, cur, + bubbleType, special, tmp, i, + eventPath = [ elem || document ], + type = core_hasOwn.call( event, "type" ) ? event.type : event, + namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; + + cur = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf(".") >= 0 ) { + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split("."); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf(":") < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + event.isTrigger = true; + event.namespace = namespaces.join("."); + event.namespace_re = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === (elem.ownerDocument || document) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { + + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { + event.preventDefault(); + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && + !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name name as the event. + // Can't use an .isFunction() check here because IE6/7 fails that test. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + try { + elem[ type ](); + } catch ( e ) { + // IE<9 dies on focus/blur to hidden element (#1486,#12518) + // only reproducible on winXP IE8 native, not IE9 in IE8 mode + } + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + dispatch: function( event ) { + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( event ); + + var i, ret, handleObj, matched, j, + handlerQueue = [], + args = core_slice.call( arguments ), + handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[0] = event; + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { + + // Triggered event must either 1) have no namespace, or + // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). + if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + var obj = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ); + if(obj.apply){ + ret = obj.apply( matched.elem, args ); + } + + if ( ret !== undefined ) { + if ( (event.result = ret) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var sel, handleObj, matches, i, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + // Black-hole SVG instance trees (#13180) + // Avoid non-left-click bubbling in Firefox (#3861) + if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { + + for ( ; cur != this; cur = cur.parentNode || this ) { + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { + matches = []; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matches[ sel ] === undefined ) { + matches[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) >= 0 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matches[ sel ] ) { + matches.push( handleObj ); + } + } + if ( matches.length ) { + handlerQueue.push({ elem: cur, handlers: matches }); + } + } + } + } + + // Add the remaining (directly-bound) handlers + if ( delegateCount < handlers.length ) { + handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); + } + + return handlerQueue; + }, + + fix: function( event ) { + if ( event[ jQuery.expando ] ) { + return event; + } + + // Create a writable copy of the event object and normalize some properties + var i, prop, copy, + type = event.type, + originalEvent = event, + fixHook = this.fixHooks[ type ]; + + if ( !fixHook ) { + this.fixHooks[ type ] = fixHook = + rmouseEvent.test( type ) ? this.mouseHooks : + rkeyEvent.test( type ) ? this.keyHooks : + {}; + } + copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; + + event = new jQuery.Event( originalEvent ); + + i = copy.length; + while ( i-- ) { + prop = copy[ i ]; + event[ prop ] = originalEvent[ prop ]; + } + + // Support: IE<9 + // Fix target property (#1925) + if ( !event.target ) { + event.target = originalEvent.srcElement || document; + } + + // Support: Chrome 23+, Safari? + // Target should not be a text node (#504, #13143) + if ( event.target.nodeType === 3 ) { + event.target = event.target.parentNode; + } + + // Support: IE<9 + // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) + event.metaKey = !!event.metaKey; + + return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; + }, + + // Includes some event props shared by KeyEvent and MouseEvent + props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), + + fixHooks: {}, + + keyHooks: { + props: "char charCode key keyCode".split(" "), + filter: function( event, original ) { + + // Add which for key events + if ( event.which == null ) { + event.which = original.charCode != null ? original.charCode : original.keyCode; + } + + return event; + } + }, + + mouseHooks: { + props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), + filter: function( event, original ) { + var body, eventDoc, doc, + button = original.button, + fromElement = original.fromElement; + + // Calculate pageX/Y if missing and clientX/Y available + if ( event.pageX == null && original.clientX != null ) { + eventDoc = event.target.ownerDocument || document; + doc = eventDoc.documentElement; + body = eventDoc.body; + + event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); + event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); + } + + // Add relatedTarget, if necessary + if ( !event.relatedTarget && fromElement ) { + event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; + } + + // Add which for click: 1 === left; 2 === middle; 3 === right + // Note: button is not normalized, so don't use it + if ( !event.which && button !== undefined ) { + event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); + } + + return event; + } + }, + + special: { + load: { + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + click: { + // For checkbox, fire native event so checked state will be right + trigger: function() { + if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { + this.click(); + return false; + } + } + }, + focus: { + // Fire native event if possible so blur/focus sequence is correct + trigger: function() { + if ( this !== document.activeElement && this.focus ) { + try { + this.focus(); + return false; + } catch ( e ) { + // Support: IE<9 + // If we error on focus to hidden element (#1486, #12518), + // let .trigger() run the handlers + } + } + }, + delegateType: "focusin" + }, + blur: { + trigger: function() { + if ( this === document.activeElement && this.blur ) { + this.blur(); + return false; + } + }, + delegateType: "focusout" + }, + + beforeunload: { + postDispatch: function( event ) { + + // Even when returnValue equals to undefined Firefox will still show alert + if ( event.result !== undefined ) { + event.originalEvent.returnValue = event.result; + } + } + } + }, + + simulate: function( type, elem, event, bubble ) { + // Piggyback on a donor event to simulate a different one. + // Fake originalEvent to avoid donor's stopPropagation, but if the + // simulated event prevents default then we do the same on the donor. + var e = jQuery.extend( + new jQuery.Event(), + event, + { type: type, + isSimulated: true, + originalEvent: {} + } + ); + if ( bubble ) { + jQuery.event.trigger( e, null, elem ); + } else { + jQuery.event.dispatch.call( elem, e ); + } + if ( e.isDefaultPrevented() ) { + event.preventDefault(); + } + } +}; + +jQuery.removeEvent = document.removeEventListener ? + function( elem, type, handle ) { + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle, false ); + } + } : + function( elem, type, handle ) { + var name = "on" + type; + + if ( elem.detachEvent ) { + + // #8545, #7054, preventing memory leaks for custom events in IE6-8 + // detachEvent needed property on element, by name of that event, to properly expose it to GC + if ( typeof elem[ name ] === core_strundefined ) { + elem[ name ] = null; + } + + elem.detachEvent( name, handle ); + } + }; + +jQuery.Event = function( src, props ) { + // Allow instantiation without the 'new' keyword + if ( !(this instanceof jQuery.Event) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || + src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || jQuery.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + if ( !e ) { + return; + } + + // If preventDefault exists, run it on the original event + if ( e.preventDefault ) { + e.preventDefault(); + + // Support: IE + // Otherwise set the returnValue property of the original event to false + } else { + e.returnValue = false; + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + if ( !e ) { + return; + } + // If stopPropagation exists, run it on the original event + if ( e.stopPropagation ) { + e.stopPropagation(); + } + + // Support: IE + // Set the cancelBubble property of the original event to true + e.cancelBubble = true; + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = returnTrue; + this.stopPropagation(); + } +}; + +// Create mouseenter/leave events using mouseover/out and event-time checks +jQuery.each({ + mouseenter: "mouseover", + mouseleave: "mouseout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mousenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || (related !== target && !jQuery.contains( target, related )) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +}); + +// IE submit delegation +if ( !jQuery.support.submitBubbles ) { + + jQuery.event.special.submit = { + setup: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Lazy-add a submit handler when a descendant form may potentially be submitted + jQuery.event.add( this, "click._submit keypress._submit", function( e ) { + // Node name check avoids a VML-related crash in IE (#9807) + var elem = e.target, + form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; + if ( form && !jQuery._data( form, "submitBubbles" ) ) { + jQuery.event.add( form, "submit._submit", function( event ) { + event._submit_bubble = true; + }); + jQuery._data( form, "submitBubbles", true ); + } + }); + // return undefined since we don't need an event listener + }, + + postDispatch: function( event ) { + // If form was submitted by the user, bubble the event up the tree + if ( event._submit_bubble ) { + delete event._submit_bubble; + if ( this.parentNode && !event.isTrigger ) { + jQuery.event.simulate( "submit", this.parentNode, event, true ); + } + } + }, + + teardown: function() { + // Only need this for delegated form submit events + if ( jQuery.nodeName( this, "form" ) ) { + return false; + } + + // Remove delegated handlers; cleanData eventually reaps submit handlers attached above + jQuery.event.remove( this, "._submit" ); + } + }; +} + +// IE change delegation and checkbox/radio fix +if ( !jQuery.support.changeBubbles ) { + + jQuery.event.special.change = { + + setup: function() { + + if ( rformElems.test( this.nodeName ) ) { + // IE doesn't fire change on a check/radio until blur; trigger it on click + // after a propertychange. Eat the blur-change in special.change.handle. + // This still fires onchange a second time for check/radio after blur. + if ( this.type === "checkbox" || this.type === "radio" ) { + jQuery.event.add( this, "propertychange._change", function( event ) { + if ( event.originalEvent.propertyName === "checked" ) { + this._just_changed = true; + } + }); + jQuery.event.add( this, "click._change", function( event ) { + if ( this._just_changed && !event.isTrigger ) { + this._just_changed = false; + } + // Allow triggered, simulated change events (#11500) + jQuery.event.simulate( "change", this, event, true ); + }); + } + return false; + } + // Delegated event; lazy-add a change handler on descendant inputs + jQuery.event.add( this, "beforeactivate._change", function( e ) { + var elem = e.target; + + if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { + jQuery.event.add( elem, "change._change", function( event ) { + if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { + jQuery.event.simulate( "change", this.parentNode, event, true ); + } + }); + jQuery._data( elem, "changeBubbles", true ); + } + }); + }, + + handle: function( event ) { + var elem = event.target; + + // Swallow native change events from checkbox/radio, we already triggered them above + if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { + return event.handleObj.handler.apply( this, arguments ); + } + }, + + teardown: function() { + jQuery.event.remove( this, "._change" ); + + return !rformElems.test( this.nodeName ); + } + }; +} + +// Create "bubbling" focus and blur events +if ( !jQuery.support.focusinBubbles ) { + jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler while someone wants focusin/focusout + var attaches = 0, + handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + if ( attaches++ === 0 ) { + document.addEventListener( orig, handler, true ); + } + }, + teardown: function() { + if ( --attaches === 0 ) { + document.removeEventListener( orig, handler, true ); + } + } + }; + }); +} + +jQuery.fn.extend({ + + on: function( types, selector, data, fn, /*INTERNAL*/ one ) { + var type, origFn; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + this.on( type, selector, data, types[ type ], one ); + } + return this; + } + + if ( data == null && fn == null ) { + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return this; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return this.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + }); + }, + one: function( types, selector, data, fn ) { + return this.on( types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each(function() { + jQuery.event.remove( this, types, fn, selector ); + }); + }, + + bind: function( types, data, fn ) { + return this.on( types, null, data, fn ); + }, + unbind: function( types, fn ) { + return this.off( types, null, fn ); + }, + + delegate: function( selector, types, data, fn ) { + return this.on( types, selector, data, fn ); + }, + undelegate: function( selector, types, fn ) { + // ( namespace ) or ( selector, types [, fn] ) + return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); + }, + + trigger: function( type, data ) { + return this.each(function() { + jQuery.event.trigger( type, data, this ); + }); + }, + triggerHandler: function( type, data ) { + var elem = this[0]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +}); +/*! + * Sizzle CSS Selector Engine + * Copyright 2012 jQuery Foundation and other contributors + * Released under the MIT license + * http://sizzlejs.com/ + */ +(function( window, undefined ) { + +var i, + cachedruns, + Expr, + getText, + isXML, + compile, + hasDuplicate, + outermostContext, + + // Local document vars + setDocument, + document, + docElem, + documentIsXML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + sortOrder, + + // Instance-specific data + expando = "sizzle" + -(new Date()), + preferredDoc = window.document, + support = {}, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + + // General-purpose constants + strundefined = typeof undefined, + MAX_NEGATIVE = 1 << 31, + + // Array methods + arr = [], + pop = arr.pop, + push = arr.push, + slice = arr.slice, + // Use a stripped-down indexOf if we can't use a native one + indexOf = arr.indexOf || function( elem ) { + var i = 0, + len = this.length; + for ( ; i < len; i++ ) { + if ( this[i] === elem ) { + return i; + } + } + return -1; + }, + + + // Regular expressions + + // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + // http://www.w3.org/TR/css3-syntax/#characters + characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", + + // Loosely modeled on CSS identifier characters + // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors + // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier + identifier = characterEncoding.replace( "w", "w#" ), + + // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors + operators = "([*^$|!~]?=)", + attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + + "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", + + // Prefer arguments quoted, + // then not containing pseudos/brackets, + // then attribute selectors/non-parenthetical expressions, + // then anything else + // These preferences are here to reduce the number of selectors + // needing tokenize in the PSEUDO preFilter + pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + characterEncoding + ")" ), + "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), + "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), + "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rsibling = /[\x20\t\r\n\f]*[+~]/, + + rnative = /^[^{]+\{\s*\[native code/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rescape = /'|\\/g, + rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, + + // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, + funescape = function( _, escaped ) { + var high = "0x" + escaped - 0x10000; + // NaN means non-codepoint + return high !== high ? + escaped : + // BMP codepoint + high < 0 ? + String.fromCharCode( high + 0x10000 ) : + // Supplemental Plane codepoint (surrogate pair) + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }; + +// Use a stripped-down slice if we can't use a native one +try { + slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType; +} catch ( e ) { + slice = function( i ) { + var elem, + results = []; + while ( (elem = this[i++]) ) { + results.push( elem ); + } + return results; + }; +} + +/** + * For feature detection + * @param {Function} fn The function to test for native support + */ +function isNative( fn ) { + return rnative.test( fn + "" ); +} + +/** + * Create key-value caches of limited size + * @returns {Function(string, Object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var cache, + keys = []; + + return (cache = function( key, value ) { + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key += " " ) > Expr.cacheLength ) { + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return (cache[ key ] = value); + }); +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created div and expects a boolean result + */ +function assert( fn ) { + var div = document.createElement("div"); + + try { + return fn( div ); + } catch (e) { + return false; + } finally { + // release memory in IE + div = null; + } +} + +function Sizzle( selector, context, results, seed ) { + var match, elem, m, nodeType, + // QSA vars + i, groups, old, nid, newContext, newSelector; + + if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { + setDocument( context ); + } + + context = context || document; + results = results || []; + + if ( !selector || typeof selector !== "string" ) { + return results; + } + + if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { + return []; + } + + if ( !documentIsXML && !seed ) { + + // Shortcuts + if ( (match = rquickExpr.exec( selector )) ) { + // Speed-up: Sizzle("#ID") + if ( (m = match[1]) ) { + if ( nodeType === 9 ) { + elem = context.getElementById( m ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + if ( elem && elem.parentNode ) { + // Handle the case where IE, Opera, and Webkit return items + // by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + } else { + // Context is not a document + if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && + contains( context, elem ) && elem.id === m ) { + results.push( elem ); + return results; + } + } + + // Speed-up: Sizzle("TAG") + } else if ( match[2] ) { + push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); + return results; + + // Speed-up: Sizzle(".CLASS") + } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { + push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); + return results; + } + } + + // QSA path + if ( support.qsa && !rbuggyQSA.test(selector) ) { + old = true; + nid = expando; + newContext = context; + newSelector = nodeType === 9 && selector; + + // qSA works strangely on Element-rooted queries + // We can work around this by specifying an extra ID on the root + // and working up from there (Thanks to Andrew Dupont for the technique) + // IE 8 doesn't work on object elements + if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { + groups = tokenize( selector ); + + if ( (old = context.getAttribute("id")) ) { + nid = old.replace( rescape, "\\$&" ); + } else { + context.setAttribute( "id", nid ); + } + nid = "[id='" + nid + "'] "; + + i = groups.length; + while ( i-- ) { + groups[i] = nid + toSelector( groups[i] ); + } + newContext = rsibling.test( selector ) && context.parentNode || context; + newSelector = groups.join(","); + } + + if ( newSelector ) { + try { + push.apply( results, slice.call( newContext.querySelectorAll( + newSelector + ), 0 ) ); + return results; + } catch(qsaError) { + } finally { + if ( !old ) { + context.removeAttribute("id"); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Detect xml + * @param {Element|Object} elem An element or a document + */ +isXML = Sizzle.isXML = function( elem ) { + // documentElement is verified for cases where it doesn't yet exist + // (such as loading iframes in IE - #4833) + var documentElement = elem && (elem.ownerDocument || elem).documentElement; + return documentElement ? documentElement.nodeName !== "HTML" : false; +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var doc = node ? node.ownerDocument || node : preferredDoc; + + // If no document and documentElement is available, return + if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Set our document + document = doc; + docElem = doc.documentElement; + + // Support tests + documentIsXML = isXML( doc ); + + // Check if getElementsByTagName("*") returns only elements + support.tagNameNoComments = assert(function( div ) { + div.appendChild( doc.createComment("") ); + return !div.getElementsByTagName("*").length; + }); + + // Check if attributes should be retrieved by attribute nodes + support.attributes = assert(function( div ) { + div.innerHTML = ""; + var type = typeof div.lastChild.getAttribute("multiple"); + // IE8 returns a string for some attributes even when not present + return type !== "boolean" && type !== "string"; + }); + + // Check if getElementsByClassName can be trusted + support.getByClassName = assert(function( div ) { + // Opera can't find a second classname (in 9.6) + div.innerHTML = ""; + if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { + return false; + } + + // Safari 3.2 caches class attributes and doesn't catch changes + div.lastChild.className = "e"; + return div.getElementsByClassName("e").length === 2; + }); + + // Check if getElementById returns elements by name + // Check if getElementsByName privileges form controls or returns elements by ID + support.getByName = assert(function( div ) { + // Inject content + div.id = expando + 0; + div.innerHTML = "
"; + docElem.insertBefore( div, docElem.firstChild ); + + // Test + var pass = doc.getElementsByName && + // buggy browsers will return fewer than the correct 2 + doc.getElementsByName( expando ).length === 2 + + // buggy browsers will return more than the correct 0 + doc.getElementsByName( expando + 0 ).length; + support.getIdNotName = !doc.getElementById( expando ); + + // Cleanup + docElem.removeChild( div ); + + return pass; + }); + + // IE6/7 return modified attributes + Expr.attrHandle = assert(function( div ) { + div.innerHTML = ""; + return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && + div.firstChild.getAttribute("href") === "#"; + }) ? + {} : + { + "href": function( elem ) { + return elem.getAttribute( "href", 2 ); + }, + "type": function( elem ) { + return elem.getAttribute("type"); + } + }; + + // ID find and filter + if ( support.getIdNotName ) { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && !documentIsXML ) { + var m = context.getElementById( id ); + // Check parentNode to catch when Blackberry 4.6 returns + // nodes that are no longer in the document #6963 + return m && m.parentNode ? [m] : []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute("id") === attrId; + }; + }; + } else { + Expr.find["ID"] = function( id, context ) { + if ( typeof context.getElementById !== strundefined && !documentIsXML ) { + var m = context.getElementById( id ); + + return m ? + m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? + [m] : + undefined : + []; + } + }; + Expr.filter["ID"] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); + return node && node.value === attrId; + }; + }; + } + + // Tag + Expr.find["TAG"] = support.tagNameNoComments ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== strundefined ) { + return context.getElementsByTagName( tag ); + } + } : + function( tag, context ) { + var elem, + tmp = [], + i = 0, + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( (elem = results[i++]) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Name + Expr.find["NAME"] = support.getByName && function( tag, context ) { + if ( typeof context.getElementsByName !== strundefined ) { + return context.getElementsByName( name ); + } + }; + + // Class + Expr.find["CLASS"] = support.getByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { + return context.getElementsByClassName( className ); + } + }; + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21), + // no need to also add to buggyMatches since matches checks buggyQSA + // A support test would require too much code (would include document ready) + rbuggyQSA = [ ":focus" ]; + + if ( (support.qsa = isNative(doc.querySelectorAll)) ) { + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert(function( div ) { + // Select is set to empty string on purpose + // This is to test IE's treatment of not explictly + // setting a boolean content attribute, + // since its presence should be enough + // http://bugs.jquery.com/ticket/12359 + div.innerHTML = ""; + + // IE8 - Some boolean attributes are not treated correctly + if ( !div.querySelectorAll("[selected]").length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":checked").length ) { + rbuggyQSA.push(":checked"); + } + }); + + assert(function( div ) { + + // Opera 10-12/IE8 - ^= $= *= and empty values + // Should not select anything + div.innerHTML = ""; + if ( div.querySelectorAll("[i^='']").length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( !div.querySelectorAll(":enabled").length ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Opera 10-11 does not throw on post-comma invalid pseudos + div.querySelectorAll("*,:x"); + rbuggyQSA.push(",.*:"); + }); + } + + if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || + docElem.mozMatchesSelector || + docElem.webkitMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector) )) ) { + + assert(function( div ) { + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( div, "div" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( div, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + }); + } + + rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); + rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); + + // Element contains another + // Purposefully does not implement inclusive descendent + // As in, an element does not contain itself + contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + )); + } : + function( a, b ) { + if ( b ) { + while ( (b = b.parentNode) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + // Document order sorting + sortOrder = docElem.compareDocumentPosition ? + function( a, b ) { + var compare; + + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { + if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { + if ( a === doc || contains( preferredDoc, a ) ) { + return -1; + } + if ( b === doc || contains( preferredDoc, b ) ) { + return 1; + } + return 0; + } + return compare & 4 ? -1 : 1; + } + + return a.compareDocumentPosition ? -1 : 1; + } : + function( a, b ) { + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + + // Parentless nodes are either documents or disconnected + } else if ( !aup || !bup ) { + return a === doc ? -1 : + b === doc ? 1 : + aup ? -1 : + bup ? 1 : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( (cur = cur.parentNode) ) { + ap.unshift( cur ); + } + cur = b; + while ( (cur = cur.parentNode) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[i] === bp[i] ) { + i++; + } + + return i ? + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[i], bp[i] ) : + + // Otherwise nodes in our document sort first + ap[i] === preferredDoc ? -1 : + bp[i] === preferredDoc ? 1 : + 0; + }; + + // Always assume the presence of duplicates if sort doesn't + // pass them to our comparison function (as in Google Chrome). + hasDuplicate = false; + [0, 0].sort( sortOrder ); + support.detectDuplicates = hasDuplicate; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + // Make sure that attribute selectors are quoted + expr = expr.replace( rattributeQuotes, "='$1']" ); + + // rbuggyQSA always contains :focus, so no need for an existence check + if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch(e) {} + } + + return Sizzle( expr, document, null, [elem] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + // Set document vars if needed + if ( ( context.ownerDocument || context ) !== document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + var val; + + // Set document vars if needed + if ( ( elem.ownerDocument || elem ) !== document ) { + setDocument( elem ); + } + + if ( !documentIsXML ) { + name = name.toLowerCase(); + } + if ( (val = Expr.attrHandle[ name ]) ) { + return val( elem ); + } + if ( documentIsXML || support.attributes ) { + return elem.getAttribute( name ); + } + return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? + name : + val && val.specified ? val.value : null; +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +// Document sorting and removing duplicates +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + i = 1, + j = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + results.sort( sortOrder ); + + if ( hasDuplicate ) { + for ( ; (elem = results[i]); i++ ) { + if ( elem === results[ i - 1 ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + return results; +}; + +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( (cur = cur.nextSibling) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +// Returns a function to use in pseudos for input types +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +// Returns a function to use in pseudos for buttons +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return (name === "input" || name === "button") && elem.type === type; + }; +} + +// Returns a function to use in pseudos for positionals +function createPositionalPseudo( fn ) { + return markFunction(function( argument ) { + argument = +argument; + return markFunction(function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ (j = matchIndexes[i]) ] ) { + seed[j] = !(matches[j] = seed[j]); + } + } + }); + }); +} + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + // If no nodeType, this is expected to be an array + for ( ; (node = elem[i]); i++ ) { + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + // Use textContent for elements + // innerText usage removed for consistency of new lines (see #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[1] = match[1].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); + + if ( match[2] === "~=" ) { + match[3] = " " + match[3] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[1] = match[1].toLowerCase(); + + if ( match[1].slice( 0, 3 ) === "nth" ) { + // nth-* requires argument + if ( !match[3] ) { + Sizzle.error( match[0] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); + match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); + + // other types prohibit arguments + } else if ( match[3] ) { + Sizzle.error( match[0] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[5] && match[2]; + + if ( matchExpr["CHILD"].test( match[0] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[4] ) { + match[2] = match[4]; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + // Get excess from tokenize (recursively) + (excess = tokenize( unquoted, true )) && + // advance to the next closing parenthesis + (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { + + // excess is a negative index + match[0] = match[0].slice( 0, excess ); + match[2] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeName ) { + if ( nodeName === "*" ) { + return function() { return true; }; + } + + nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && + classCache( className, function( elem ) { + return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); + }); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + }; + }, + + "CHILD": function( type, what, argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, context, xml ) { + var cache, outerCache, node, diff, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( (node = node[ dir ]) ) { + if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { + return false; + } + } + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + // Seek `elem` from a previously-cached index + outerCache = parent[ expando ] || (parent[ expando ] = {}); + cache = outerCache[ type ] || []; + nodeIndex = cache[0] === dirruns && cache[1]; + diff = cache[0] === dirruns && cache[2]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( (node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + (diff = nodeIndex = 0) || start.pop()) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + outerCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + // Use previously-cached element index if available + } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { + diff = cache[1]; + + // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) + } else { + // Use the same loop as above to seek `elem` from the start + while ( (node = ++nodeIndex && node && node[ dir ] || + (diff = nodeIndex = 0) || start.pop()) ) { + + if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { + // Cache the index of each encountered element + if ( useCache ) { + (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction(function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf.call( seed, matched[i] ); + seed[ idx ] = !( matches[ idx ] = matched[i] ); + } + }) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + // Potentially complex pseudos + "not": markFunction(function( selector ) { + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction(function( seed, matches, context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( (elem = unmatched[i]) ) { + seed[i] = !(matches[i] = elem); + } + } + }) : + function( elem, context, xml ) { + input[0] = elem; + matcher( input, null, xml, results ); + return !results.pop(); + }; + }), + + "has": markFunction(function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + }), + + "contains": markFunction(function( text ) { + return function( elem ) { + return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; + }; + }), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + // lang value must be a valid identifider + if ( !ridentifier.test(lang || "") ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( (elemLang = documentIsXML ? + elem.getAttribute("xml:lang") || elem.getAttribute("lang") : + elem.lang) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); + return false; + }; + }), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); + }, + + // Boolean properties + "enabled": function( elem ) { + return elem.disabled === false; + }, + + "disabled": function( elem ) { + return elem.disabled === true; + }, + + "checked": function( elem ) { + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); + }, + + "selected": function( elem ) { + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), + // not comment, processing instructions, or others + // Thanks to Diego Perini for the nodeName shortcut + // Greater than "@" means alpha characters (specifically not starting with "#" or "?") + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos["empty"]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) + // use getAttribute instead to test this case + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); + }, + + // Position-in-collection + "first": createPositionalPseudo(function() { + return [ 0 ]; + }), + + "last": createPositionalPseudo(function( matchIndexes, length ) { + return [ length - 1 ]; + }), + + "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + }), + + "even": createPositionalPseudo(function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "odd": createPositionalPseudo(function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }), + + "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + }) + } +}; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +function tokenize( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || (match = rcomma.exec( soFar )) ) { + if ( match ) { + // Don't consume trailing commas as valid + soFar = soFar.slice( match[0].length ) || soFar; + } + groups.push( tokens = [] ); + } + + matched = false; + + // Combinators + if ( (match = rcombinators.exec( soFar )) ) { + matched = match.shift(); + tokens.push( { + value: matched, + // Cast descendant combinators to space + type: match[0].replace( rtrim, " " ) + } ); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || + (match = preFilters[ type ]( match ))) ) { + matched = match.shift(); + tokens.push( { + value: matched, + type: type, + matches: match + } ); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +} + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[i].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + checkNonElements = base && dir === "parentNode", + doneName = done++; + + return combinator.first ? + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var data, cache, outerCache, + dirkey = dirruns + " " + doneName; + + // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching + if ( xml ) { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( (elem = elem[ dir ]) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || (elem[ expando ] = {}); + if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { + if ( (data = cache[1]) === true || data === cachedruns ) { + return data === true; + } + } else { + cache = outerCache[ dir ] = [ dirkey ]; + cache[1] = matcher( elem, context, xml ) || cachedruns; + if ( cache[1] === true ) { + return true; + } + } + } + } + } + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[i]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[0]; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( (elem = unmatched[i]) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction(function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( (elem = temp[i]) ) { + matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) ) { + // Restore matcherIn since elem is not yet a final match + temp.push( (matcherIn[i] = elem) ); + } + } + postFinder( null, (matcherOut = []), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( (elem = matcherOut[i]) && + (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { + + seed[temp] = !(results[temp] = elem); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + }); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[0].type ], + implicitRelative = leadingRelative || Expr.relative[" "], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf.call( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + (checkContext = context).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + } ]; + + for ( ; i < len; i++ ) { + if ( (matcher = Expr.relative[ tokens[i].type ]) ) { + matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; + } else { + matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[j].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + // A counter to specify which element is currently being matched + var matcherCachedRuns = 0, + bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, expandContext ) { + var elem, j, matcher, + setMatched = [], + matchedCount = 0, + i = "0", + unmatched = seed && [], + outermost = expandContext != null, + contextBackup = outermostContext, + // We must always have either seed elements or context + elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); + + if ( outermost ) { + outermostContext = context !== document && context; + cachedruns = matcherCachedRuns; + } + + // Add elements passing elementMatchers directly to results + // Keep `i` a string if there are no elements so `matchedCount` will be "00" below + for ( ; (elem = elems[i]) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + while ( (matcher = elementMatchers[j++]) ) { + if ( matcher( elem, context, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + cachedruns = ++matcherCachedRuns; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + // They will have gone through all possible matchers + if ( (elem = !matcher && elem) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // Apply set filters to unmatched elements + matchedCount += i; + if ( bySet && i !== matchedCount ) { + j = 0; + while ( (matcher = setMatchers[j++]) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !(unmatched[i] || setMatched[i]) ) { + setMatched[i] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + // Generate a function of recursive functions that can be used to check each element + if ( !group ) { + group = tokenize( selector ); + } + i = group.length; + while ( i-- ) { + cached = matcherFromTokens( group[i] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); + } + return cached; +}; + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[i], results ); + } + return results; +} + +function select( selector, context, results, seed ) { + var i, tokens, token, type, find, + match = tokenize( selector ); + + if ( !seed ) { + // Try to minimize operations if there is only one group + if ( match.length === 1 ) { + + // Take a shortcut and set the context if the root selector is an ID + tokens = match[0] = match[0].slice( 0 ); + if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && + context.nodeType === 9 && !documentIsXML && + Expr.relative[ tokens[1].type ] ) { + + context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; + if ( !context ) { + return results; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[i]; + + // Abort if we hit a combinator + if ( Expr.relative[ (type = token.type) ] ) { + break; + } + if ( (find = Expr.find[ type ]) ) { + // Search, expanding context for leading sibling combinators + if ( (seed = find( + token.matches[0].replace( runescape, funescape ), + rsibling.test( tokens[0].type ) && context.parentNode || context + )) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, slice.call( seed, 0 ) ); + return results; + } + + break; + } + } + } + } + } + + // Compile and execute a filtering function + // Provide `match` to avoid retokenization if we modified the selector above + compile( selector, match )( + seed, + context, + documentIsXML, + results, + rsibling.test( selector ) + ); + return results; +} + +// Deprecated +Expr.pseudos["nth"] = Expr.pseudos["eq"]; + +// Easy API for creating new setFilters +function setFilters() {} +Expr.filters = setFilters.prototype = Expr.pseudos; +Expr.setFilters = new setFilters(); + +// Initialize with the default document +setDocument(); + +// Override sizzle attribute retrieval +Sizzle.attr = jQuery.attr; +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; +jQuery.expr[":"] = jQuery.expr.pseudos; +jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; + + +})( window ); +var runtil = /Until$/, + rparentsprev = /^(?:parents|prev(?:Until|All))/, + isSimple = /^.[^:#\[\.,]*$/, + rneedsContext = jQuery.expr.match.needsContext, + // methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend({ + find: function( selector ) { + var i, ret, self, + len = this.length; + + if ( typeof selector !== "string" ) { + self = this; + return this.pushStack( jQuery( selector ).filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + }) ); + } + + ret = []; + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, this[ i ], ret ); + } + + // Needed because $( selector, context ) becomes $( context ).find( selector ) + ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); + ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; + return ret; + }, + + has: function( target ) { + var i, + targets = jQuery( target, this ), + len = targets.length; + + return this.filter(function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( this, targets[i] ) ) { + return true; + } + } + }); + }, + + not: function( selector ) { + return this.pushStack( winnow(this, selector, false) ); + }, + + filter: function( selector ) { + return this.pushStack( winnow(this, selector, true) ); + }, + + is: function( selector ) { + return !!selector && ( + typeof selector === "string" ? + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + rneedsContext.test( selector ) ? + jQuery( selector, this.context ).index( this[0] ) >= 0 : + jQuery.filter( selector, this ).length > 0 : + this.filter( selector ).length > 0 ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + ret = [], + pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? + jQuery( selectors, context || this.context ) : + 0; + + for ( ; i < l; i++ ) { + cur = this[i]; + + while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { + if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { + ret.push( cur ); + break; + } + cur = cur.parentNode; + } + } + + return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; + } + + // index in selector + if ( typeof elem === "string" ) { + return jQuery.inArray( this[0], jQuery( elem ) ); + } + + // Locate the position of the desired element + return jQuery.inArray( + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[0] : elem, this ); + }, + + add: function( selector, context ) { + var set = typeof selector === "string" ? + jQuery( selector, context ) : + jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), + all = jQuery.merge( this.get(), set ); + + return this.pushStack( jQuery.unique(all) ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter(selector) + ); + } +}); + +jQuery.fn.andSelf = jQuery.fn.addBack; + +function sibling( cur, dir ) { + do { + cur = cur[ dir ]; + } while ( cur && cur.nodeType !== 1 ); + + return cur; +} + +jQuery.each({ + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return jQuery.dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, i, until ) { + return jQuery.dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return jQuery.dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return jQuery.dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, i, until ) { + return jQuery.dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, i, until ) { + return jQuery.dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return jQuery.sibling( elem.firstChild ); + }, + contents: function( elem ) { + return jQuery.nodeName( elem, "iframe" ) ? + elem.contentDocument || elem.contentWindow.document : + jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var ret = jQuery.map( this, fn, until ); + + if ( !runtil.test( name ) ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + ret = jQuery.filter( selector, ret ); + } + + ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; + + if ( this.length > 1 && rparentsprev.test( name ) ) { + ret = ret.reverse(); + } + + return this.pushStack( ret ); + }; +}); + +jQuery.extend({ + filter: function( expr, elems, not ) { + if ( not ) { + expr = ":not(" + expr + ")"; + } + + return elems.length === 1 ? + jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : + jQuery.find.matches(expr, elems); + }, + + dir: function( elem, dir, until ) { + var matched = [], + cur = elem[ dir ]; + + while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { + if ( cur.nodeType === 1 ) { + matched.push( cur ); + } + cur = cur[dir]; + } + return matched; + }, + + sibling: function( n, elem ) { + var r = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + r.push( n ); + } + } + + return r; + } +}); + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, keep ) { + + // Can't pass null or undefined to indexOf in Firefox 4 + // Set to 0 to skip string check + qualifier = qualifier || 0; + + if ( jQuery.isFunction( qualifier ) ) { + return jQuery.grep(elements, function( elem, i ) { + var retVal = !!qualifier.call( elem, i, elem ); + return retVal === keep; + }); + + } else if ( qualifier.nodeType ) { + return jQuery.grep(elements, function( elem ) { + return ( elem === qualifier ) === keep; + }); + + } else if ( typeof qualifier === "string" ) { + var filtered = jQuery.grep(elements, function( elem ) { + return elem.nodeType === 1; + }); + + if ( isSimple.test( qualifier ) ) { + return jQuery.filter(qualifier, filtered, !keep); + } else { + qualifier = jQuery.filter( qualifier, filtered ); + } + } + + return jQuery.grep(elements, function( elem ) { + return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; + }); +} +function createSafeFragment( document ) { + var list = nodeNames.split( "|" ), + safeFrag = document.createDocumentFragment(); + + if ( safeFrag.createElement ) { + while ( list.length ) { + safeFrag.createElement( + list.pop() + ); + } + } + return safeFrag; +} + +var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + + "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", + rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, + rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), + rleadingWhitespace = /^\s+/, + rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, + rtagName = /<([\w:]+)/, + rtbody = /\s*$/g, + + // We have to close these tags to support XHTML (#13200) + wrapMap = { + option: [ 1, "" ], + legend: [ 1, "
", "
" ], + area: [ 1, "", "" ], + param: [ 1, "", "" ], + thead: [ 1, "", "
" ], + tr: [ 2, "", "
" ], + col: [ 2, "", "
" ], + td: [ 3, "", "
" ], + + // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, + // unless wrapped in a div with non-breaking characters in front of it. + _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X
", "
" ] + }, + safeFragment = createSafeFragment( document ), + fragmentDiv = safeFragment.appendChild( document.createElement("div") ); + +wrapMap.optgroup = wrapMap.option; +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +jQuery.fn.extend({ + text: function( value ) { + return jQuery.access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); + }, null, value, arguments.length ); + }, + + wrapAll: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapAll( html.call(this, i) ); + }); + } + + if ( this[0] ) { + // The elements to wrap the target around + var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); + + if ( this[0].parentNode ) { + wrap.insertBefore( this[0] ); + } + + wrap.map(function() { + var elem = this; + + while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { + elem = elem.firstChild; + } + + return elem; + }).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( jQuery.isFunction( html ) ) { + return this.each(function(i) { + jQuery(this).wrapInner( html.call(this, i) ); + }); + } + + return this.each(function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + }); + }, + + wrap: function( html ) { + var isFunction = jQuery.isFunction( html ); + + return this.each(function(i) { + jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); + }); + }, + + unwrap: function() { + return this.parent().each(function() { + if ( !jQuery.nodeName( this, "body" ) ) { + jQuery( this ).replaceWith( this.childNodes ); + } + }).end(); + }, + + append: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.appendChild( elem ); + } + }); + }, + + prepend: function() { + return this.domManip(arguments, true, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.insertBefore( elem, this.firstChild ); + } + }); + }, + + before: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + }); + }, + + after: function() { + return this.domManip( arguments, false, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + }); + }, + + // keepData is for internal use only--do not document + remove: function( selector, keepData ) { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { + if ( !keepData && elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem ) ); + } + + if ( elem.parentNode ) { + if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { + setGlobalEval( getAll( elem, "script" ) ); + } + elem.parentNode.removeChild( elem ); + } + } + } + + return this; + }, + + empty: function() { + var elem, + i = 0; + + for ( ; (elem = this[i]) != null; i++ ) { + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + } + + // Remove any remaining nodes + while ( elem.firstChild ) { + elem.removeChild( elem.firstChild ); + } + + // If this is a select, ensure that it displays empty (#12336) + // Support: IE<9 + if ( elem.options && jQuery.nodeName( elem, "select" ) ) { + elem.options.length = 0; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function () { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + }); + }, + + html: function( value ) { + return jQuery.access( this, function( value ) { + var elem = this[0] || {}, + i = 0, + l = this.length; + + if ( value === undefined ) { + return elem.nodeType === 1 ? + elem.innerHTML.replace( rinlinejQuery, "" ) : + undefined; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && + ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && + !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { + + value = value.replace( rxhtmlTag, "<$1>" ); + + try { + for (; i < l; i++ ) { + // Remove element nodes and prevent memory leaks + elem = this[i] || {}; + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch(e) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function( value ) { + var isFunc = jQuery.isFunction( value ); + + // Make sure that the elements are removed from the DOM before they are inserted + // this can help fix replacing a parent with child elements + if ( !isFunc && typeof value !== "string" ) { + value = jQuery( value ).not( this ).detach(); + } + + return this.domManip( [ value ], true, function( elem ) { + var next = this.nextSibling, + parent = this.parentNode; + + if ( parent ) { + jQuery( this ).remove(); + parent.insertBefore( elem, next ); + } + }); + }, + + detach: function( selector ) { + return this.remove( selector, true ); + }, + + domManip: function( args, table, callback ) { + + // Flatten any nested arrays + args = core_concat.apply( [], args ); + + var first, node, hasScripts, + scripts, doc, fragment, + i = 0, + l = this.length, + set = this, + iNoClone = l - 1, + value = args[0], + isFunction = jQuery.isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { + return this.each(function( index ) { + var self = set.eq( index ); + if ( isFunction ) { + args[0] = value.call( this, index, table ? self.html() : undefined ); + } + self.domManip( args, table, callback ); + }); + } + + if ( l ) { + fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + if ( first ) { + table = table && jQuery.nodeName( first, "tr" ); + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( + table && jQuery.nodeName( this[i], "table" ) ? + findOrAppend( this[i], "tbody" ) : + this[i], + node, + i + ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { + + if ( node.src ) { + // Hope ajax is available... + jQuery.ajax({ + url: node.src, + type: "GET", + dataType: "script", + async: false, + global: false, + "throws": true + }); + } else { + jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); + } + } + } + } + + // Fix #11809: Avoid leaking memory + fragment = first = null; + } + } + + return this; + } +}); + +function findOrAppend( elem, tag ) { + return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + var attr = elem.getAttributeNode("type"); + elem.type = ( attr && attr.specified ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + var match = rscriptTypeMasked.exec( elem.type ); + if ( match ) { + elem.type = match[1]; + } else { + elem.removeAttribute("type"); + } + return elem; +} + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var elem, + i = 0; + for ( ; (elem = elems[i]) != null; i++ ) { + jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); + } +} + +function cloneCopyEvent( src, dest ) { + + if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { + return; + } + + var type, i, l, + oldData = jQuery._data( src ), + curData = jQuery._data( dest, oldData ), + events = oldData.events; + + if ( events ) { + delete curData.handle; + curData.events = {}; + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + + // make the cloned public data object a copy from the original + if ( curData.data ) { + curData.data = jQuery.extend( {}, curData.data ); + } +} + +function fixCloneNodeIssues( src, dest ) { + var nodeName, e, data; + + // We do not need to do anything for non-Elements + if ( dest.nodeType !== 1 ) { + return; + } + + nodeName = dest.nodeName.toLowerCase(); + + // IE6-8 copies events bound via attachEvent when using cloneNode. + if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { + data = jQuery._data( dest ); + + for ( e in data.events ) { + jQuery.removeEvent( dest, e, data.handle ); + } + + // Event data gets referenced instead of copied if the expando gets copied too + dest.removeAttribute( jQuery.expando ); + } + + // IE blanks contents when cloning scripts, and tries to evaluate newly-set text + if ( nodeName === "script" && dest.text !== src.text ) { + disableScript( dest ).text = src.text; + restoreScript( dest ); + + // IE6-10 improperly clones children of object elements using classid. + // IE10 throws NoModificationAllowedError if parent is null, #12132. + } else if ( nodeName === "object" ) { + if ( dest.parentNode ) { + dest.outerHTML = src.outerHTML; + } + + // This path appears unavoidable for IE9. When cloning an object + // element in IE9, the outerHTML strategy above is not sufficient. + // If the src has innerHTML and the destination does not, + // copy the src.innerHTML into the dest.innerHTML. #10324 + if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { + dest.innerHTML = src.innerHTML; + } + + } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { + // IE6-8 fails to persist the checked state of a cloned checkbox + // or radio button. Worse, IE6-7 fail to give the cloned element + // a checked appearance if the defaultChecked value isn't also set + + dest.defaultChecked = dest.checked = src.checked; + + // IE6-7 get confused and end up setting the value of a cloned + // checkbox/radio button to an empty string instead of "on" + if ( dest.value !== src.value ) { + dest.value = src.value; + } + + // IE6-8 fails to return the selected option to the default selected + // state when cloning options + } else if ( nodeName === "option" ) { + dest.defaultSelected = dest.selected = src.defaultSelected; + + // IE6-8 fails to set the defaultValue to the correct value when + // cloning other types of input fields + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +jQuery.each({ + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + i = 0, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone(true); + jQuery( insert[i] )[ original ]( elems ); + + // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() + core_push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +}); + +function getAll( context, tag ) { + var elems, elem, + i = 0, + found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : + typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : + undefined; + + if ( !found ) { + for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { + if ( !tag || jQuery.nodeName( elem, tag ) ) { + found.push( elem ); + } else { + jQuery.merge( found, getAll( elem, tag ) ); + } + } + } + + return tag === undefined || tag && jQuery.nodeName( context, tag ) ? + jQuery.merge( [ context ], found ) : + found; +} + +// Used in buildFragment, fixes the defaultChecked property +function fixDefaultChecked( elem ) { + if ( manipulation_rcheckableType.test( elem.type ) ) { + elem.defaultChecked = elem.checked; + } +} + +jQuery.extend({ + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var destElements, node, clone, i, srcElements, + inPage = jQuery.contains( elem.ownerDocument, elem ); + + if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { + clone = elem.cloneNode( true ); + + // IE<=8 does not properly clone detached, unknown element nodes + } else { + fragmentDiv.innerHTML = elem.outerHTML; + fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); + } + + if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && + (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { + + // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + // Fix all IE cloning issues + for ( i = 0; (node = srcElements[i]) != null; ++i ) { + // Ensure that the destination node is not null; Fixes #9587 + if ( destElements[i] ) { + fixCloneNodeIssues( node, destElements[i] ); + } + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0; (node = srcElements[i]) != null; i++ ) { + cloneCopyEvent( node, destElements[i] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + destElements = srcElements = node = null; + + // Return the cloned set + return clone; + }, + + buildFragment: function( elems, context, scripts, selection ) { + var j, elem, contains, + tmp, tag, tbody, wrap, + l = elems.length, + + // Ensure a safe fragment + safe = createSafeFragment( context ), + + nodes = [], + i = 0; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( jQuery.type( elem ) === "object" ) { + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || safe.appendChild( context.createElement("div") ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + + tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1>" ) + wrap[2]; + + // Descend through wrappers to the right content + j = wrap[0]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Manually add leading whitespace removed by IE + if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { + nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); + } + + // Remove IE's autoinserted from table fragments + if ( !jQuery.support.tbody ) { + + // String was a , *may* have spurious + elem = tag === "table" && !rtbody.test( elem ) ? + tmp.firstChild : + + // String was a bare or + wrap[1] === "
" && !rtbody.test( elem ) ? + tmp : + 0; + + j = elem && elem.childNodes.length; + while ( j-- ) { + if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { + elem.removeChild( tbody ); + } + } + } + + jQuery.merge( nodes, tmp.childNodes ); + + // Fix #12392 for WebKit and IE > 9 + tmp.textContent = ""; + + // Fix #12392 for oldIE + while ( tmp.firstChild ) { + tmp.removeChild( tmp.firstChild ); + } + + // Remember the top-level container for proper cleanup + tmp = safe.lastChild; + } + } + } + + // Fix #11356: Clear elements from fragment + if ( tmp ) { + safe.removeChild( tmp ); + } + + // Reset defaultChecked for any radios and checkboxes + // about to be appended to the DOM in IE 6/7 (#8060) + if ( !jQuery.support.appendChecked ) { + jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); + } + + i = 0; + while ( (elem = nodes[ i++ ]) ) { + + // #4087 - If origin and destination elements are the same, and this is + // that element, do not do anything + if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { + continue; + } + + contains = jQuery.contains( elem.ownerDocument, elem ); + + // Append to fragment + tmp = getAll( safe.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( contains ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( (elem = tmp[ j++ ]) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + tmp = null; + + return safe; + }, + + cleanData: function( elems, /* internal */ acceptData ) { + var elem, type, id, data, + i = 0, + internalKey = jQuery.expando, + cache = jQuery.cache, + deleteExpando = jQuery.support.deleteExpando, + special = jQuery.event.special; + + for ( ; (elem = elems[i]) != null; i++ ) { + + if ( acceptData || jQuery.acceptData( elem ) ) { + + id = elem[ internalKey ]; + data = id && cache[ id ]; + + if ( data ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Remove cache only if it was not already removed by jQuery.event.remove + if ( cache[ id ] ) { + + delete cache[ id ]; + + // IE does not allow us to delete expando properties from nodes, + // nor does it have a removeAttribute function on Document nodes; + // we must handle all of these cases + if ( deleteExpando ) { + delete elem[ internalKey ]; + + } else if ( typeof elem.removeAttribute !== core_strundefined ) { + elem.removeAttribute( internalKey ); + + } else { + elem[ internalKey ] = null; + } + + core_deletedIds.push( id ); + } + } + } + } + } +}); +var iframe, getStyles, curCSS, + ralpha = /alpha\([^)]*\)/i, + ropacity = /opacity\s*=\s*([^)]*)/, + rposition = /^(top|right|bottom|left)$/, + // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" + // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rmargin = /^margin/, + rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), + rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), + rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), + elemdisplay = { BODY: "block" }, + + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: 0, + fontWeight: 400 + }, + + cssExpand = [ "Top", "Right", "Bottom", "Left" ], + cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; + +// return a css property mapped to a potentially vendor prefixed property +function vendorPropName( style, name ) { + + // shortcut for names that are not vendor prefixed + if ( name in style ) { + return name; + } + + // check for vendor prefixed names + var capName = name.charAt(0).toUpperCase() + name.slice(1), + origName = name, + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in style ) { + return name; + } + } + + return origName; +} + +function isHidden( elem, el ) { + // isHidden might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); +} + +function showHide( elements, show ) { + var display, elem, hidden, + values = [], + index = 0, + length = elements.length; + + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + values[ index ] = jQuery._data( elem, "olddisplay" ); + display = elem.style.display; + if ( show ) { + // Reset the inline display of this element to learn if it is + // being hidden by cascaded rules or not + if ( !values[ index ] && display === "none" ) { + elem.style.display = ""; + } + + // Set elements which have been overridden with display: none + // in a stylesheet to whatever the default browser style is + // for such an element + if ( elem.style.display === "" && isHidden( elem ) ) { + values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); + } + } else { + + if ( !values[ index ] ) { + hidden = isHidden( elem ); + + if ( display && display !== "none" || !hidden ) { + jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); + } + } + } + } + + // Set the display of most of the elements in a second loop + // to avoid the constant reflow + for ( index = 0; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + if ( !show || elem.style.display === "none" || elem.style.display === "" ) { + elem.style.display = show ? values[ index ] || "" : "none"; + } + } + + return elements; +} + +jQuery.fn.extend({ + css: function( name, value ) { + return jQuery.access( this, function( elem, name, value ) { + var len, styles, + map = {}, + i = 0; + + if ( jQuery.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + }, + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + var bool = typeof state === "boolean"; + + return this.each(function() { + if ( bool ? state : isHidden( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + }); + } +}); + +jQuery.extend({ + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Exclude the following css properties to add px + cssNumber: { + "columnCount": true, + "fillOpacity": true, + "fontWeight": true, + "lineHeight": true, + "opacity": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: { + // normalize float css property + "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" + }, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = jQuery.camelCase( name ), + style = elem.style; + + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // convert relative number strings (+= or -=) to relative numbers. #7345 + if ( type === "string" && (ret = rrelNum.exec( value )) ) { + value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); + // Fixes bug #9237 + type = "number"; + } + + // Make sure that NaN and null values aren't set. See: #7116 + if ( value == null || type === "number" && isNaN( value ) ) { + return; + } + + // If a number was passed in, add 'px' to the (except for certain CSS properties) + if ( type === "number" && !jQuery.cssNumber[ origName ] ) { + value += "px"; + } + + // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, + // but it would mean to define eight (for every problematic property) identical functions + if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { + + // Wrapped to prevent IE from throwing errors when 'invalid' values are provided + // Fixes bug #5509 + try { + style[ name ] = value; + } catch(e) {} + } + + } else { + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var num, val, hooks, + origName = jQuery.camelCase( name ); + + // Make sure that we're working with the right name + name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); + + // gets hook for the prefixed version + // followed by the unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + //convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Return, converting to number if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; + } + return val; + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback, args ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.apply( elem, args || [] ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; + } +}); + +// NOTE: we've included the "window" in window.getComputedStyle +// because jsdom on node.js will break without it. +if ( window.getComputedStyle ) { + getStyles = function( elem ) { + return window.getComputedStyle( elem, null ); + }; + + curCSS = function( elem, name, _computed ) { + var width, minWidth, maxWidth, + computed = _computed || getStyles( elem ), + + // getPropertyValue is only needed for .css('filter') in IE9, see #12537 + ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, + style = elem.style; + + if ( computed ) { + + if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right + // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels + // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values + if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret; + }; +} else if ( document.documentElement.currentStyle ) { + getStyles = function( elem ) { + return elem.currentStyle; + }; + + curCSS = function( elem, name, _computed ) { + var left, rs, rsLeft, + computed = _computed || getStyles( elem ), + ret = computed ? computed[ name ] : undefined, + style = elem.style; + + // Avoid setting ret to empty string here + // so we don't default to auto + if ( ret == null && style && style[ name ] ) { + ret = style[ name ]; + } + + // From the awesome hack by Dean Edwards + // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 + + // If we're not dealing with a regular pixel number + // but a number that has a weird ending, we need to convert it to pixels + // but not position css attributes, as those are proportional to the parent element instead + // and we can't measure the parent instead because it might trigger a "stacking dolls" problem + if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { + + // Remember the original values + left = style.left; + rs = elem.runtimeStyle; + rsLeft = rs && rs.left; + + // Put in the new values to get a computed value out + if ( rsLeft ) { + rs.left = elem.currentStyle.left; + } + style.left = name === "fontSize" ? "1em" : ret; + ret = style.pixelLeft + "px"; + + // Revert the changed values + style.left = left; + if ( rsLeft ) { + rs.left = rsLeft; + } + } + + return ret === "" ? "auto" : ret; + }; +} + +function setPositiveNumber( elem, value, subtract ) { + var matches = rnumsplit.exec( value ); + return matches ? + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : + value; +} + +function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { + var i = extra === ( isBorderBox ? "border" : "content" ) ? + // If we already have the right measurement, avoid augmentation + 4 : + // Otherwise initialize for horizontal or vertical properties + name === "width" ? 1 : 0, + + val = 0; + + for ( ; i < 4; i += 2 ) { + // both box models exclude margin, so add it if we want it + if ( extra === "margin" ) { + val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); + } + + if ( isBorderBox ) { + // border-box includes padding, so remove it if we want content + if ( extra === "content" ) { + val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // at this point, extra isn't border nor margin, so remove border + if ( extra !== "margin" ) { + val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } else { + // at this point, extra isn't content, so add padding + val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // at this point, extra isn't content nor padding, so add border + if ( extra !== "padding" ) { + val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + return val; +} + +function getWidthOrHeight( elem, name, extra ) { + + // Start with offset property, which is equivalent to the border-box value + var valueIsBorderBox = true, + val = name === "width" ? elem.offsetWidth : elem.offsetHeight, + styles = getStyles( elem ), + isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // some non-html elements return undefined for offsetWidth, so check for null/undefined + // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 + // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 + if ( val <= 0 || val == null ) { + // Fall back to computed then uncomputed css if necessary + val = curCSS( elem, name, styles ); + if ( val < 0 || val == null ) { + val = elem.style[ name ]; + } + + // Computed unit is not pixels. Stop here and return. + if ( rnumnonpx.test(val) ) { + return val; + } + + // we need the check for style in case a browser which returns unreliable values + // for getComputedStyle silently falls back to the reliable elem.style + valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); + + // Normalize "", auto, and prepare for extra + val = parseFloat( val ) || 0; + } + + // use the active box-sizing model to add/subtract irrelevant styles + return ( val + + augmentWidthOrHeight( + elem, + name, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles + ) + ) + "px"; +} + +// Try to determine the default display value of an element +function css_defaultDisplay( nodeName ) { + var doc = document, + display = elemdisplay[ nodeName ]; + + if ( !display ) { + display = actualDisplay( nodeName, doc ); + + // If the simple way fails, read from inside an iframe + if ( display === "none" || !display ) { + // Use the already-created iframe if possible + iframe = ( iframe || + jQuery("')); + } catch (e) { + var form = document.createElement('form'), + iframe = handler.iframe || (handler.iframe = document.createElement("iframe")); + form.setAttribute("enctype", "multipart/form-data"); + iframe.setAttribute("name", iframe.id = target); + iframe.setAttribute("src", url); + } + iframe.style.position = "absolute"; + iframe.style.left = iframe.style.top = "-10000px"; + iframe.onload = onload; + iframe.onerror = function (event) { + if (isFunction(handler.onerror)) { + handler.onerror(rpe, event || window.event); + } + }; + iframe.onreadystatechange = function () { + if (/loaded|complete/i.test(iframe.readyState)) { + onload(); + + //wei : todo,将附件信息放到handler.attach + } + else if (isFunction(handler.onloadprogress)) { + if (rpe.loaded < rpe.total) { + ++rpe.loaded; + } + handler.onloadprogress(rpe, { + readyState: { + loading: 2, + interactive: 3, + loaded: 4, + complete: 4 + }[iframe.readyState] || 1 + }); + } + }; + form.setAttribute("action", handler.url); + form.setAttribute("target", iframe.id); + form.setAttribute("method", "post"); + form.appendChild(handler.file); + form.style.display = "none"; + if (isFunction(handler.onloadstart)) { + handler.onloadstart(rpe, {}); + } + with (document.body || document.documentElement) { + appendChild(iframe); + appendChild(form); + form.submit(); + } + ; + return handler; + }; + } + xhr = null; + return sendFile; + })(Object.prototype.toString); + + var sendFiles = function (handler, maxSize, width, height) { + + var length = handler.files.length, + i = 0, + onload = handler.onload, + onloadstart = handler.onloadstart; + handler.current = 0; + handler.total = 0; + handler.sent = 0; + while (handler.current < length) { + handler.total += (handler.files[handler.current].fileSize || handler.files[handler.current].size); + handler.current++; + } + handler.current = 0; + if (length && handler.files[0].fileSize !== -1) { + handler.file = handler.files[handler.current]; + + sendFile(handler, maxSize, width, height).onload = function (rpe, xhr) { + handler.onloadstart = null; + handler.sent += (handler.files[handler.current].fileSize || handler.files[handler.current].size); + if (++handler.current < length) { + handler.file = handler.files[handler.current]; + sendFile(handler, maxSize, width, height).onload = arguments.callee; + } else if (onload) { + handler.onloadstart = onloadstart; + handler.onload = onload; + handler.onload(rpe, xhr); + } + }; + } else if (length) { + handler.total = length * 100; + handler.file = handler.files[handler.current]; + sendFile(handler, maxSize, width, height).onload = function (rpe, xhr) { + var callee = arguments.callee; + handler.onloadstart = null; + handler.sent += 100; + if (++handler.current < length) { + if (/\b(chrome|safari)\b/i.test(navigator.userAgent)) { + handler.iframe.parentNode.removeChild(handler.iframe); + handler.iframe = null; + } + setTimeout(function () { + handler.file = handler.files[handler.current]; + sendFile(handler, maxSize, width, height).onload = callee; + }, 15); + } else if (onload) { + setTimeout(function () { + handler.iframe.parentNode.removeChild(handler.iframe); + handler.iframe = null; + handler.onloadstart = onloadstart; + handler.onload = onload; + handler.onload(rpe, xhr); + }, 15); + } + }; + } + return handler; + }; + + BI.File = BI.inherit(BI.Single, { + _defaultConfig: function () { + var conf = BI.File.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-file display-block", + element: "", + name: "", + url: "", + multiple: true, + accept: "", /**'*.jpg; *.zip'**/ + maxSize: -1 //1024 * 1024 + }) + }, + + _init: function () { + var self = this, o = this.options; + BI.File.superclass._init.apply(this, arguments); + if (o.multiple === true) { + this.element.attr("multiple", "multiple"); + } + this.element.attr("name", o.name || this.getName()); + + BI.nextTick(function () { + // create the noswfupload.wrap Object + // wrap.maxSize 文件大小限制 + // wrap.maxlength 文件个数限制 + var _wrap = self.wrap = self._wrap(self.element[0], o.maxSize); + // fileType could contain whatever text but filter checks *.{extension} + // if present + + // handlers + + _wrap.onloadstart = function (rpe, xhr) { + //BI.Msg.toast("loadstart"); + self.fireEvent(BI.File.EVENT_UPLOADSTART); + }; + + _wrap.onprogress = function (rpe, xhr) { + //BI.Msg.toast("onprogress"); + // percent for each bar + + // fileSize is -1 only if browser does not support file info access + // this if splits recent browsers from others + if (this.file.fileSize !== -1) { + // simulation property indicates when the progress event is fake + if (rpe.simulation) { + + } else { + + } + } else { + // if fileSIze is -1 browser is using an iframe because it does + // not support + // files sent via Ajax (XMLHttpRequest) + // We can still show some information + } + self.fireEvent(BI.File.EVENT_PROGRESS, { + file: this.file, + total: rpe.total, + loaded: rpe.loaded, + simulation: rpe.simulation + }); + }; + + // generated if there is something wrong during upload + _wrap.onerror = function () { + // just inform the user something was wrong + self.fireEvent(BI.File.EVENT_ERROR); + }; + + // generated when every file has been sent (one or more, it does not + // matter) + _wrap.onload = function (rpe, xhr) { + var self_ = this; + // just show everything is fine ... + // ... and after a second reset the component + setTimeout(function () { + self_.clean(); // remove files from list + self_.hide(); // hide progress bars and enable input file + + //BI.Msg.toast("onload"); + self.fireEvent(BI.File.EVENT_UPLOADED); + // enable again the submit button/element + }, 1000); + }; + _wrap.url = o.url ? o.url : BI.servletURL + + '?op=fr_attach&cmd=ah_upload'; + _wrap.fileType = o.accept; //文件类型限制 + _wrap.attach_array = []; + _wrap.attach_names = []; + _wrap.attachNum = 0; + }); + }, + + _events: function (wrap) { + var self = this; + event.add(wrap.dom.input, "change", function () { + event.del(wrap.dom.input, "change", arguments.callee); + for (var input = wrap.dom.input.cloneNode(true), i = 0, files = F(wrap.dom.input); i < files.length; i++) { + var item = files.item(i); + var tempFile = item.value || item.name; + var value = item.fileName || (item.fileName = tempFile.split("\\").pop()), + ext = -1 !== value.indexOf(".") ? value.split(".").pop().toLowerCase() : "unknown", + size = item.fileSize || item.size; + if (wrap.fileType && -1 === wrap.fileType.indexOf("*." + ext)) { + //文件类型不支持 + BI.Msg.toast(BI.i18nText("BI-Upload_File_Type_Error")); + self.fireEvent(BI.File.EVENT_ERROR, { + errorType: 0, + file: item + }); + } else if (wrap.maxSize !== -1 && size && wrap.maxSize < size) { + //文件大小不支持 + BI.Msg.toast(BI.i18nText("BI-Upload_File_Size_Error")); + self.fireEvent(BI.File.EVENT_ERROR, { + errorType: 1, + file: item + }); + } else { + wrap.files.unshift(item); + //BI.Msg.toast(value); + self.fireEvent(BI.File.EVENT_CHANGE, { + file: item + }); + } + } + input.value = ""; + wrap.dom.input.parentNode.replaceChild(input, wrap.dom.input); + wrap.dom.input = input; + event.add(wrap.dom.input, "change", arguments.callee); + }); + return wrap; + }, + + _wrap: function () { + var self = this, o = this.options; + // be sure input accept multiple files + var input = this.element[0]; + if (o.multiple === true) { + this.element.attr("multiple", "multiple"); + } + input.value = ""; + + // wrap Object + return this._events({ + + // DOM namespace + dom: { + input: input, // input file + disabled: false // internal use, checks input file state + }, + name: input.name, // name to send for each file ($_FILES[{name}] in the server) + // maxSize is the maximum amount of bytes for each file + maxSize: o.maxSize ? o.maxSize >> 0 : -1, + files: [], // file list + + // remove every file from the noswfupload component + clean: function () { + this.files = []; + }, + + // upload one file a time (which make progress possible rather than all files in one shot) + // the handler is an object injected into the wrap one, could be the wrap itself or + // something like {onload:function(){alert("OK")},onerror:function(){alert("Error")}, etc ...} + upload: function (handler) { + if (handler) { + for (var key in handler) { + this[key] = handler[key]; + } + } + sendFiles(this, this.maxSize); + return this; + }, + + // hide progress bar (total + current) and enable files selection + hide: function () { + if (this.dom.disabled) { + this.dom.disabled = false; + this.dom.input.removeAttribute("disabled"); + } + }, + + // show progress bar and disable file selection (used during upload) + // total and current are pixels used to style bars + // totalProp and currentProp are properties to change, "height" by default + show: function (total, current, totalProp, currentProp) { + if (!this.dom.disabled) { + this.dom.disabled = true; + this.dom.input.setAttribute("disabled", "disabled"); + } + } + }); + }, + + select: function () { + $(this.wrap.dom.input).click(); + }, + + upload: function (handler) { + this.wrap.upload(handler); + }, + + getValue: function () { + return this.wrap.attach_array; + }, + + reset: function () { + this.wrap.attach_array = []; + this.wrap.attach_names = []; + this.wrap.attachNum = 0; + }, + + _setEnable: function (enable) { + BI.File.superclass._setEnable.apply(this, arguments); + if (enable === true) { + this.element.attr("disabled", "disabled"); + } else { + this.element.removeAttr("disabled"); + } + } + }); + BI.File.EVENT_CHANGE = "BI.File.EVENT_CHANGE"; + BI.File.EVENT_UPLOADSTART = "EVENT_UPLOADSTART"; + BI.File.EVENT_ERROR = "EVENT_ERROR"; + BI.File.EVENT_PROGRESS = "EVENT_PROGRESS"; + BI.File.EVENT_UPLOADED = "EVENT_UPLOADED"; + BI.shortcut("bi.file", BI.File); +})();/** + * guy + * @class BI.Input 一个button和一行数 组成的一行listitem + * @extends BI.Single + * @type {*|void|Object} + */ +BI.Input = BI.inherit(BI.Single, { + _defaultConfig: function () { + var conf = BI.Input.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-input display-block", + element: "", + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn,//按确定键能否退出编辑 + mouseOut: false, + allowBlank: false + }) + }, + + _init: function () { + BI.Input.superclass._init.apply(this, arguments); + var self = this; + var ctrlKey = false; + var inputEventValid = false; + var _keydown = BI.debounce(function (keyCode) { + self.onKeyDown(keyCode, ctrlKey); + self._keydown_ = false; + }, 300); + var _clk = BI.debounce(BI.bind(this._click, this), BI.EVENT_RESPONSE_TIME, true); + this._blurDebounce = BI.debounce(BI.bind(this._blur, this), BI.EVENT_RESPONSE_TIME, true); + this.element + .keydown(function (e) { + inputEventValid = false; + ctrlKey = e.ctrlKey; + self.fireEvent(BI.Input.EVENT_QUICK_DOWN); + }) + .keyup(function (e) { + if (!(inputEventValid && e.keyCode === BI.KeyCode.ENTER)) { + self._keydown_ = true; + _keydown(e.keyCode); + } + }) + .on("input propertychange", function (e) { + inputEventValid = true; + self._keydown_ = true; + _keydown(e.keyCode); + }) + .click(function (e) { + e.stopPropagation(); + _clk(); + }) + .mousedown(function (e) { + self.element.val(self.element.val()); + }) + .focusout(function (e) { + self._blurDebounce(); + }); + }, + + _focus: function () { + this.element.addClass("bi-input-focus"); + this._checkValidationOnValueChange(); + this._isEditing = true; + if (this.getValue() == "") { + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this); + this.fireEvent(BI.Input.EVENT_EMPTY); + } + this.fireEvent(BI.Input.EVENT_FOCUS); + }, + + _blur: function () { + var self = this; + if (self._keydown_ === true) { + BI.delay(blur, 300); + } else { + blur(); + } + function blur() { + if (!self.isValid() && self.options.quitChecker.apply(self, [BI.trim(self.getValue())]) !== false) { + self.element.val(self._lastValidValue ? self._lastValidValue : ""); + self._checkValidationOnValueChange(); + self._defaultState(); + } + self.element.removeClass("bi-input-focus"); + self._isEditing = false; + self._start = false; + if (self.isValid()) { + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CONFIRM, self.getValue(), self); + self.fireEvent(BI.Input.EVENT_CONFIRM); + } + self.fireEvent(BI.Input.EVENT_BLUR); + } + }, + + _click: function () { + if (this._isEditing !== true) { + this._focus(); + this.selectAll(); + this.fireEvent(BI.Input.EVENT_CLICK); + } + }, + + onClick: function () { + this._click(); + }, + + onKeyDown: function (keyCode, ctrlKey) { + if (!this.isValid() || BI.trim(this._lastValidValue) !== BI.trim(this.getValue())) { + this._checkValidationOnValueChange(); + } + if (this.isValid() && BI.trim(this.getValue()) !== "") { + if (BI.trim(this.getValue()) !== this._lastValue && (!this._start || this._lastValue == null || this._lastValue === "") + || (this._pause === true && !/(\s|\u00A0)$/.test(this.getValue()))) { + this._start = true; + this._pause = false; + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STARTEDIT, this.getValue(), this); + this.fireEvent(BI.Input.EVENT_START); + } + } + if (ctrlKey === true && keyCode === 86) {//ctrlKey+V + this._valueChange(); + } else { + if (keyCode == BI.KeyCode.ENTER) { + if (this.isValid() || this.options.quitChecker.apply(this, [BI.trim(this.getValue())]) !== false) { + this.blur(); + this.fireEvent(BI.Input.EVENT_ENTER); + } else { + this.fireEvent(BI.Input.EVENT_RESTRICT); + } + } + if (keyCode == BI.KeyCode.SPACE) { + this.fireEvent(BI.Input.EVENT_SPACE); + } + if (keyCode == BI.KeyCode.BACKSPACE && this._lastValue == "") { + this.fireEvent(BI.Input.EVENT_REMOVE); + } + if (keyCode == BI.KeyCode.BACKSPACE || keyCode == BI.KeyCode.DELETE) { + this.fireEvent(BI.Input.EVENT_BACKSPACE); + } + } + this.fireEvent(BI.Input.EVENT_KEY_DOWN); + + if (BI.isEndWithBlank(this.getValue())) { + this._pause = true; + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.PAUSE, "", this); + this.fireEvent(BI.Input.EVENT_PAUSE); + this._defaultState(); + } else if ((keyCode === BI.KeyCode.BACKSPACE || keyCode === BI.KeyCode.DELETE) && + BI.trim(this.getValue()) === "" && (this._lastValue !== null && BI.trim(this._lastValue) !== "")) { + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT, this.getValue(), this); + this.fireEvent(BI.Input.EVENT_STOP); + this._valueChange(); + } else { + this._valueChange(); + } + }, + + //初始状态 + _defaultState: function () { + if (this.getValue() == "") { + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this); + this.fireEvent(BI.Input.EVENT_EMPTY); + } + this._lastValue = this.getValue(); + this._lastSubmitValue = null; + }, + + _valueChange: function () { + if (this.isValid() && BI.trim(this.getValue()) !== this._lastSubmitValue) { + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, this.getValue(), this); + this.fireEvent(BI.Input.EVENT_CHANGE); + this._lastSubmitValue = BI.trim(this.getValue()); + } + if (this.getValue() == "") { + this.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.EMPTY, this.getValue(), this); + this.fireEvent(BI.Input.EVENT_EMPTY); + } + this._lastValue = this.getValue(); + }, + + _checkValidationOnValueChange: function () { + var o = this.options; + var v = this.getValue(); + this.setValid( + (o.allowBlank === true && BI.trim(v) == "") || + (BI.isNotEmptyString(BI.trim(v)) + && (v === this._lastValidValue || + o.validationChecker.apply(this, [BI.trim(v)]) !== false)) + ); + }, + + focus: function () { + if (!this.element.is(":visible")) { + throw new Error("input输入框在不可见下不能focus"); + } + if (!this._isEditing === true) { + this.element.focus(); + this._focus(); + this.selectAll(); + } + }, + + blur: function () { + if (!this.element.is(":visible")) { + throw new Error("input输入框在不可见下不能blur"); + } + if (this._isEditing === true) { + this.element.blur(); + this._blurDebounce(); + } + }, + + selectAll: function () { + if (!this.element.is(":visible")) { + throw new Error("input输入框在不可见下不能select"); + } + this.element.select(); + this._isEditing = true; + }, + + setValue: function (textValue) { + this.element.val(textValue); + BI.nextTick(BI.bind(function () { + this._checkValidationOnValueChange(); + this._defaultState(); + if (this.isValid()) { + this._lastSubmitValue = this.getValue(); + } + }, this)); + }, + + getValue: function () { + return this.element.val() || ""; + }, + + isEditing: function () { + return this._isEditing; + }, + + getLastValidValue: function () { + return this._lastValidValue; + }, + + _setValid: function () { + BI.Input.superclass._setValid.apply(this, arguments); + if (this.isValid()) { + this._lastValidValue = this.getValue(); + this.element.removeClass("bi-input-error"); + this.fireEvent(BI.Input.EVENT_VALID, BI.trim(this.getValue()), this); + } else { + if (this._lastValidValue === this.getValue()) { + this._lastValidValue = null; + } + this.element.addClass("bi-input-error"); + this.fireEvent(BI.Input.EVENT_ERROR, BI.trim(this.getValue()), this); + } + }, + + _setEnable: function (b) { + BI.Input.superclass._setEnable.apply(this, [b]); + this.element[0].disabled = !b; + } +}); +BI.Input.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.Input.EVENT_FOCUS = "EVENT_FOCUS"; +BI.Input.EVENT_CLICK = "EVENT_CLICK"; +BI.Input.EVENT_BLUR = "EVENT_BLUR"; +BI.Input.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; +BI.Input.EVENT_QUICK_DOWN = "EVENT_QUICK_DOWN"; +BI.Input.EVENT_SPACE = "EVENT_SPACE"; +BI.Input.EVENT_BACKSPACE = "EVENT_BACKSPACE"; + +BI.Input.EVENT_START = "EVENT_START"; +BI.Input.EVENT_PAUSE = "EVENT_PAUSE"; +BI.Input.EVENT_STOP = "EVENT_STOP"; +BI.Input.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.Input.EVENT_REMOVE = "EVENT_REMOVE"; +BI.Input.EVENT_EMPTY = "EVENT_EMPTY"; +BI.Input.EVENT_VALID = "EVENT_VALID"; +BI.Input.EVENT_ERROR = "EVENT_ERROR"; +BI.Input.EVENT_ENTER = "EVENT_ENTER"; +BI.Input.EVENT_RESTRICT = "EVENT_RESTRICT"; +BI.shortcut("bi.input", BI.Input);/** + * guy + * @extends BI.Single + * @type {*|void|Object} + */ +BI.Radio = BI.inherit(BI.IconButton, { + _defaultConfig: function() { + var conf = BI.Radio.superclass._defaultConfig.apply(this,arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-radio radio-icon", + selected: false, + handler: BI.emptyFn, + width: 16, + height: 16, + iconWidth: 16, + iconHeight: 16 + }) + }, + + _init : function() { + BI.Radio.superclass._init.apply(this, arguments); + }, + + doClick: function(){ + BI.Radio.superclass.doClick.apply(this, arguments); + if(this.isValid()){ + this.fireEvent(BI.Radio.EVENT_CHANGE); + } + } +}); +BI.Radio.EVENT_CHANGE = "Radio.EVENT_CHANGE"; + +BI.shortcut("bi.radio", BI.Radio);/** + * Created by GUY on 2015/6/26. + */ + +BI.Label = BI.inherit(BI.Single, { + _defaultConfig: function () { + var conf = BI.Label.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-label", + textAlign: "center", + whiteSpace: "nowrap", //normal or nowrap + forceCenter: false, //是否无论如何都要居中, 不考虑超出边界的情况, 在未知宽度和高度时有效 + textWidth: null, + textHeight: null, + hgap: 0, + vgap: 0, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + text: "", + py: "", + keyword: "" + }) + }, + + _createJson: function () { + var o = this.options; + return { + type: "bi.text", + textAlign: o.textAlign, + whiteSpace: o.whiteSpace, + lineHeight: o.textHeight, + text: o.text, + value: o.value, + py: o.py, + keyword: o.keyword + }; + }, + + _init: function () { + BI.Label.superclass._init.apply(this, arguments); + + if (this.options.textAlign === "center") { + this._createCenterEl(); + } else { + this._createNotCenterEl(); + } + }, + + _createCenterEl: function () { + var o = this.options; + var json = this._createJson(); + if (BI.isNumber(o.width) && o.width > 0) { + if (BI.isNumber(o.textWidth) && o.textWidth > 0) { + if (BI.isNumber(o.height) && o.height > 0) { + var gap = (o.width - o.textWidth) / 2; + BI.createWidget({ + type: "bi.adaptive", + height: o.height, + scrollable: o.whiteSpace === "normal", + element: this, + items: [ + { + el: (this.text = BI.createWidget(json)), + left: gap + o.hgap + o.lgap, + right: gap + o.hgap + o.rgap, + top: o.vgap + o.tgap, + bottom: o.vgap + o.bgap + } + ] + }); + this.element.css({"line-height": o.height + "px"}); + return; + } + json.width = o.textWidth; + BI.createWidget({ + type: "bi.center_adapt", + scrollable: o.whiteSpace === "normal", + element: this, + items: [ + { + el: (this.text = BI.createWidget(json)) + } + ] + }); + return; + } + if (o.whiteSpace == "normal") { + this.text = BI.createWidget(json); + BI.createWidget({ + type: "bi.center_adapt", + scrollable: o.whiteSpace === "normal", + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + element: this, + items: [this.text] + }); + return; + } + if (BI.isNumber(o.height) && o.height > 0) { + this.element.css({ + "line-height": o.height + "px" + }); + BI.createWidget({ + type: "bi.absolute", + scrollable: o.whiteSpace === "normal", + element: this, + items: [{ + el: (this.text = BI.createWidget(json)), + left: o.hgap + o.lgap, + right: o.hgap + o.rgap, + top: o.vgap + o.tgap, + bottom: o.vgap + o.bgap + }] + }); + return; + } + json.width = o.width - 2 * o.hgap; + BI.createWidget({ + type: "bi.center_adapt", + scrollable: o.whiteSpace === "normal", + element: this, + items: [{ + el: (this.text = BI.createWidget(json)) + }] + }); + return; + } + if (BI.isNumber(o.textWidth) && o.textWidth > 0) { + json.width = o.textWidth; + BI.createWidget({ + type: "bi.center_adapt", + scrollable: o.whiteSpace === "normal", + element: this, + items: [ + { + el: (this.text = BI.createWidget(json)) + } + ] + }); + return; + } + if (o.whiteSpace == "normal") { + this.text = BI.createWidget(json); + BI.createWidget({ + type: "bi.center_adapt", + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + scrollable: o.whiteSpace === "normal", + element: this, + items: [this.text] + }); + return; + } + if (BI.isNumber(o.height) && o.height > 0) { + if (BI.isNumber(o.textHeight) && o.textHeight > 0) { + this.element.css({ + "line-height": o.height + "px" + }); + BI.createWidget({ + type: "bi.adaptive", + height: o.height, + scrollable: o.whiteSpace === "normal", + element: this, + items: [{ + el: (this.text = BI.createWidget(json)), + left: o.hgap + o.lgap, + right: o.hgap + o.rgap, + top: o.vgap + o.tgap, + bottom: o.vgap + o.bgap + }] + }); + return; + } + BI.extend(json, { + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap + }); + this.element.css({ + "line-height": o.height + "px" + }); + this.text = BI.createWidget(BI.extend(json, { + element: this + })); + BI.createWidget({ + type: "bi.layout", + element: this.text, + scrollable: o.whiteSpace === "normal" + }); + return; + } + BI.extend(json, { + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap + }); + if (o.forceCenter) { + this.text = BI.createWidget(json); + BI.createWidget({ + type: "bi.center_adapt", + element: this, + items: [this.text] + }); + return; + } + this.text = BI.createWidget(BI.extend(json, { + element: this + })); + BI.createWidget({ + type: "bi.layout", + element: this.text, + scrollable: o.whiteSpace === "normal" + }) + }, + + _createNotCenterEl: function () { + var o = this.options; + var json = this._createJson(); + if (BI.isNumber(o.width) && o.width > 0) { + if (BI.isNumber(o.textWidth) && o.textWidth > 0) { + if (BI.isNumber(o.height) && o.height > 0) { + BI.createWidget({ + type: "bi.adaptive", + height: o.height, + scrollable: o.whiteSpace === "normal", + element: this, + items: [ + { + el: (this.text = BI.createWidget(json)), + left: o.hgap + o.lgap, + right: o.hgap + o.rgap, + top: o.vgap + o.tgap, + bottom: o.vgap + o.bgap + } + ] + }); + this.element.css({"line-height": o.height + "px"}); + return; + } + json.width = o.textWidth; + BI.createWidget({ + type: "bi.vertical_adapt", + scrollable: o.whiteSpace === "normal", + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + element: this, + items: [ + { + el: (this.text = BI.createWidget(json)) + } + ] + }); + return; + } + if (o.whiteSpace == "normal") { + this.text = BI.createWidget(json); + BI.createWidget({ + type: "bi.vertical_adapt", + scrollable: o.whiteSpace === "normal", + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + element: this, + items: [this.text] + }); + return; + } + if (BI.isNumber(o.height) && o.height > 0) { + this.element.css({ + "line-height": o.height + "px" + }); + BI.createWidget({ + type: "bi.absolute", + scrollable: o.whiteSpace === "normal", + element: this, + items: [{ + el: (this.text = BI.createWidget(json)), + left: o.hgap + o.lgap, + right: o.hgap + o.rgap, + top: o.vgap + o.tgap, + bottom: o.vgap + o.bgap + }] + }); + return; + } + json.width = o.width - 2 * o.hgap - o.lgap - o.rgap; + BI.createWidget({ + type: "bi.vertical_adapt", + scrollable: o.whiteSpace === "normal", + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + element: this, + items: [{ + el: (this.text = BI.createWidget(json)) + }] + }); + return; + } + if (BI.isNumber(o.textWidth) && o.textWidth > 0) { + json.width = o.textWidth; + BI.createWidget({ + type: "bi.vertical_adapt", + scrollable: o.whiteSpace === "normal", + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + element: this, + items: [ + { + el: (this.text = BI.createWidget(json)) + } + ] + }); + return; + } + if (o.whiteSpace == "normal") { + this.text = BI.createWidget(json) + BI.createWidget({ + type: "bi.vertical_adapt", + scrollable: o.whiteSpace === "normal", + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + element: this, + items: [this.text] + }); + return; + } + if (BI.isNumber(o.height) && o.height > 0) { + if (BI.isNumber(o.textHeight) && o.textHeight > 0) { + this.element.css({ + "line-height": o.height + "px" + }); + BI.createWidget({ + type: "bi.adaptive", + height: o.height, + scrollable: o.whiteSpace === "normal", + element: this, + items: [{ + el: (this.text = BI.createWidget(json)), + left: o.hgap + o.lgap, + right: o.hgap + o.rgap, + top: o.vgap + o.tgap, + bottom: o.vgap + o.bgap + }] + }); + return; + } + BI.extend(json, { + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap + }); + this.element.css({ + "line-height": o.height + "px" + }); + this.text = BI.createWidget(BI.extend(json, { + element: this + })); + BI.createWidget({ + type: "bi.layout", + element: this.text, + scrollable: o.whiteSpace === "normal" + }); + return; + } + BI.extend(json, { + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap + }); + if (o.forceCenter) { + this.text = BI.createWidget(json); + BI.createWidget({ + type: "bi.vertical_adapt", + element: this, + items: [this.text] + }); + return; + } + this.text = BI.createWidget(BI.extend(json, { + element: this + })); + BI.createWidget({ + type: "bi.layout", + element: this.text, + scrollable: o.whiteSpace === "normal" + }) + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + setText: function (v) { + this.options.text = v; + this.text.setText(v); + }, + + getText: function () { + return this.options.text; + }, + + setStyle: function (css) { + this.text.setStyle(css) + }, + + setValue: function (v) { + BI.Label.superclass.setValue.apply(this, arguments); + if (!this.isReadOnly()) { + this.text.setValue(v); + } + }, + + populate: function () { + BI.Label.superclass.populate.apply(this, arguments); + } +}); + +BI.shortcut("bi.label", BI.Label);/** + * guy a元素 + * @class BI.Link + * @extends BI.Text + */ +BI.Link = BI.inherit(BI.Label, { + _defaultConfig: function() { + var conf = BI.Link.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-link", + href: "", + target: "_blank" + }) + }, + + _createJson: function(){ + var o = this.options; + return { + type:"bi.a", + textAlign: o.textAlign, + whiteSpace: o.whiteSpace, + lineHeight: o.textHeight, + text: o.text, + keyword: o.keyword, + value: o.value, + py: o.py, + href: o.href, + target: o.target + }; + }, + + _init : function() { + BI.Link.superclass._init.apply(this, arguments); + } +}); + +BI.shortcut("bi.link", BI.Link);/** + * guy + * 气泡提示 + * @class BI.Bubble + * @extends BI.Tip + * @type {*|void|Object} + */ +BI.Bubble = BI.inherit(BI.Tip, { + _defaultConfig: function() { + return BI.extend(BI.Bubble.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-bubble", + direction: "top", + text: "", + height: 35 + }) + }, + _init : function() { + BI.Bubble.superclass._init.apply(this, arguments); + var fn = function (e) { + e.stopPropagation(); + e.stopEvent(); + return false; + }; + this.element.bind({"click": fn, "mousedown": fn, "mouseup": fn, "mouseover": fn, "mouseenter": fn, "mouseleave": fn, "mousemove": fn}); + BI.createWidget({ + type: "bi.left", + element: this, + items: [this["_" + this.options.direction]()] + }) + }, + + _createBubbleText: function(){ + return (this.text = BI.createWidget({ + type: "bi.label", + cls: "bubble-text", + text: this.options.text, + hgap: 10, + height: 30 + })); + }, + + _top: function(){ + return BI.createWidget({ + type: "bi.vertical", + items: [{ + el: this._createBubbleText(), + height: 30 + }, { + el: { + type: "bi.layout" + }, + height: 3 + }] + }) + }, + + _bottom: function(){ + return BI.createWidget({ + type: "bi.vertical", + items: [{ + el: { + type: "bi.layout" + }, + height: 3 + }, { + el: this._createBubbleText(), + height: 30 + }] + }) + }, + + _left: function(){ + return BI.createWidget({ + type: "bi.right", + items: [{ + el: { + type: "bi.layout", + width: 3, + height: 30 + } + }, { + el: this._createBubbleText() + }] + }) + }, + + _right: function(){ + return BI.createWidget({ + type: "bi.left", + items: [{ + el: { + type: "bi.layout", + width: 3, + height: 30 + } + }, { + el: this._createBubbleText() + }] + }) + }, + + setText: function(text){ + this.text.setText(text); + } +}); + +BI.shortcut("bi.bubble", BI.Bubble);/** + * toast提示 + * + * Created by GUY on 2015/9/7. + * @class BI.Toast + * @extends BI.Tip + */ +BI.Toast = BI.inherit(BI.Tip, { + _const: { + minWidth: 200, + hgap: 20 + }, + + _defaultConfig: function () { + return BI.extend(BI.Toast.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-toast", + text: "", + level: "success",//success或warning + height: 30 + }) + }, + _init: function () { + BI.Toast.superclass._init.apply(this, arguments); + var o = this.options; + this.element.css({ + minWidth: this._const.minWidth + "px" + }) + this.element.addClass("toast-" + o.level); + var fn = function (e) { + e.stopPropagation(); + e.stopEvent(); + return false; + }; + this.element.bind({"click": fn, "mousedown": fn, "mouseup": fn, "mouseover": fn, "mouseenter": fn, "mouseleave": fn, "mousemove": fn}); + + this.text = BI.createWidget({ + type: "bi.label", + element: this, + text: o.text, + height: 30, + hgap: this._const.hgap + }) + }, + + setWidth: function(width){ + this.element.width(width); + }, + + setText: function (text) { + this.text.setText(text); + } +}); + +BI.shortcut("bi.toast", BI.Toast);/** + * toast提示 + * + * Created by GUY on 2015/9/7. + * @class BI.Tooltip + * @extends BI.Tip + */ +BI.Tooltip = BI.inherit(BI.Tip, { + _const: { + hgap: 10 + }, + + _defaultConfig: function () { + return BI.extend(BI.Tooltip.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-tooltip", + text: "", + level: "success",//success或warning + stopEvent: false, + stopPropagation: false, + height: 20 + }) + }, + _init: function () { + BI.Tooltip.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.element.addClass("tooltip-" + o.level); + var fn = function (e) { + o.stopPropagation && e.stopPropagation(); + o.stopEvent && e.stopEvent(); + }; + this.element.bind({ + "click": fn, + "mousedown": fn, + "mouseup": fn, + "mouseover": fn, + "mouseenter": fn, + "mouseleave": fn, + "mousemove": fn + }); + + var texts = (o.text + "").split("\n"); + if (texts.length > 1) { + BI.createWidget({ + type: "bi.vertical", + element: this, + hgap: this._const.hgap, + items: BI.map(texts, function (i, text) { + return { + type: "bi.label", + textAlign: "left", + whiteSpace: "normal", + text: text, + textHeight: 16 + } + }) + }) + } else { + this.text = BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "left", + whiteSpace: "normal", + text: o.text, + textHeight: 20, + hgap: this._const.hgap + }); + } + }, + + setWidth: function (width) { + this.element.width(width - 2 * this._const.hgap); + }, + + setText: function (text) { + this.text && this.text.setText(text); + }, + + setLevel: function (level) { + this.element.removeClass("tooltip-success").removeClass("tooltip-warning"); + this.element.addClass("tooltip-" + level); + } +}); + +BI.shortcut("bi.tooltip", BI.Tooltip);/** + * 下拉 + * @class BI.Trigger + * @extends BI.Single + * @abstract + */ +BI.Trigger = BI.inherit(BI.Single, { + _defaultConfig: function() { + var conf = BI.Trigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-trigger cursor-pointer", + height: 30 + }) + }, + + _init : function() { + BI.Trigger.superclass._init.apply(this, arguments); + }, + + setKey: function(){ + + }, + + getKey: function(){ + + } +});// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ┌────────────────────────────────────────────────────────────┐ \\ +// │ Eve 0.4.2 - JavaScript Events Library │ \\ +// ├────────────────────────────────────────────────────────────┤ \\ +// │ Author Dmitry Baranovskiy (http://dmitry.baranovskiy.com/) │ \\ +// └────────────────────────────────────────────────────────────┘ \\ +(function (glob, factory) { + if (typeof define === "function" && define.amd) { + define("eve", function() { + return factory(); + }); + } else if (typeof exports === "object") { + module.exports = factory(); + } else { + glob.eve = factory(); + } +}(this, function(){ + var version = "0.4.2", + has = "hasOwnProperty", + separator = /[\.\/]/, + wildcard = "*", + fun = function () {}, + numsort = function (a, b) { + return a - b; + }, + current_event, + stop, + events = {n: {}}, + /*\ + * eve + [ method ] + + * Fires event with given `name`, given scope and other parameters. + + > Arguments + + - name (string) name of the *event*, dot (`.`) or slash (`/`) separated + - scope (object) context for the event handlers + - varargs (...) the rest of arguments will be sent to event handlers + + = (object) array of returned values from the listeners + \*/ + eve = function (name, scope) { + name = String(name); + var e = events, + oldstop = stop, + args = Array.prototype.slice.call(arguments, 2), + listeners = eve.listeners(name), + z = 0, + f = false, + l, + indexed = [], + queue = {}, + out = [], + ce = current_event, + errors = []; + current_event = name; + stop = 0; + for (var i = 0, ii = listeners.length; i < ii; i++) if ("zIndex" in listeners[i]) { + indexed.push(listeners[i].zIndex); + if (listeners[i].zIndex < 0) { + queue[listeners[i].zIndex] = listeners[i]; + } + } + indexed.sort(numsort); + while (indexed[z] < 0) { + l = queue[indexed[z++]]; + out.push(l.apply(scope, args)); + if (stop) { + stop = oldstop; + return out; + } + } + for (i = 0; i < ii; i++) { + l = listeners[i]; + if ("zIndex" in l) { + if (l.zIndex == indexed[z]) { + out.push(l.apply(scope, args)); + if (stop) { + break; + } + do { + z++; + l = queue[indexed[z]]; + l && out.push(l.apply(scope, args)); + if (stop) { + break; + } + } while (l) + } else { + queue[l.zIndex] = l; + } + } else { + out.push(l.apply(scope, args)); + if (stop) { + break; + } + } + } + stop = oldstop; + current_event = ce; + return out.length ? out : null; + }; + // Undocumented. Debug only. + eve._events = events; + /*\ + * eve.listeners + [ method ] + + * Internal method which gives you array of all event handlers that will be triggered by the given `name`. + + > Arguments + + - name (string) name of the event, dot (`.`) or slash (`/`) separated + + = (array) array of event handlers + \*/ + eve.listeners = function (name) { + var names = name.split(separator), + e = events, + item, + items, + k, + i, + ii, + j, + jj, + nes, + es = [e], + out = []; + for (i = 0, ii = names.length; i < ii; i++) { + nes = []; + for (j = 0, jj = es.length; j < jj; j++) { + e = es[j].n; + items = [e[names[i]], e[wildcard]]; + k = 2; + while (k--) { + item = items[k]; + if (item) { + nes.push(item); + out = out.concat(item.f || []); + } + } + } + es = nes; + } + return out; + }; + + /*\ + * eve.on + [ method ] + ** + * Binds given event handler with a given name. You can use wildcards “`*`” for the names: + | eve.on("*.under.*", f); + | eve("mouse.under.floor"); // triggers f + * Use @eve to trigger the listener. + ** + > Arguments + ** + - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards + - f (function) event handler function + ** + = (function) returned function accepts a single numeric parameter that represents z-index of the handler. It is an optional feature and only used when you need to ensure that some subset of handlers will be invoked in a given order, despite of the order of assignment. + > Example: + | eve.on("mouse", eatIt)(2); + | eve.on("mouse", scream); + | eve.on("mouse", catchIt)(1); + * This will ensure that `catchIt()` function will be called before `eatIt()`. + * + * If you want to put your handler before non-indexed handlers, specify a negative value. + * Note: I assume most of the time you don’t need to worry about z-index, but it’s nice to have this feature “just in case”. + \*/ + eve.on = function (name, f) { + name = String(name); + if (typeof f != "function") { + return function () {}; + } + var names = name.split(separator), + e = events; + for (var i = 0, ii = names.length; i < ii; i++) { + e = e.n; + e = e.hasOwnProperty(names[i]) && e[names[i]] || (e[names[i]] = {n: {}}); + } + e.f = e.f || []; + for (i = 0, ii = e.f.length; i < ii; i++) if (e.f[i] == f) { + return fun; + } + e.f.push(f); + return function (zIndex) { + if (+zIndex == +zIndex) { + f.zIndex = +zIndex; + } + }; + }; + /*\ + * eve.f + [ method ] + ** + * Returns function that will fire given event with optional arguments. + * Arguments that will be passed to the result function will be also + * concated to the list of final arguments. + | el.onclick = eve.f("click", 1, 2); + | eve.on("click", function (a, b, c) { + | console.log(a, b, c); // 1, 2, [event object] + | }); + > Arguments + - event (string) event name + - varargs (…) and any other arguments + = (function) possible event handler function + \*/ + eve.f = function (event) { + var attrs = [].slice.call(arguments, 1); + return function () { + eve.apply(null, [event, null].concat(attrs).concat([].slice.call(arguments, 0))); + }; + }; + /*\ + * eve.stop + [ method ] + ** + * Is used inside an event handler to stop the event, preventing any subsequent listeners from firing. + \*/ + eve.stop = function () { + stop = 1; + }; + /*\ + * eve.nt + [ method ] + ** + * Could be used inside event handler to figure out actual name of the event. + ** + > Arguments + ** + - subname (string) #optional subname of the event + ** + = (string) name of the event, if `subname` is not specified + * or + = (boolean) `true`, if current event’s name contains `subname` + \*/ + eve.nt = function (subname) { + if (subname) { + return new RegExp("(?:\\.|\\/|^)" + subname + "(?:\\.|\\/|$)").test(current_event); + } + return current_event; + }; + /*\ + * eve.nts + [ method ] + ** + * Could be used inside event handler to figure out actual name of the event. + ** + ** + = (array) names of the event + \*/ + eve.nts = function () { + return current_event.split(separator); + }; + /*\ + * eve.off + [ method ] + ** + * Removes given function from the list of event listeners assigned to given name. + * If no arguments specified all the events will be cleared. + ** + > Arguments + ** + - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards + - f (function) event handler function + \*/ + /*\ + * eve.unbind + [ method ] + ** + * See @eve.off + \*/ + eve.off = eve.unbind = function (name, f) { + if (!name) { + eve._events = events = {n: {}}; + return; + } + var names = name.split(separator), + e, + key, + splice, + i, ii, j, jj, + cur = [events]; + for (i = 0, ii = names.length; i < ii; i++) { + for (j = 0; j < cur.length; j += splice.length - 2) { + splice = [j, 1]; + e = cur[j].n; + if (names[i] != wildcard) { + if (e[names[i]]) { + splice.push(e[names[i]]); + } + } else { + for (key in e) if (e[has](key)) { + splice.push(e[key]); + } + } + cur.splice.apply(cur, splice); + } + } + for (i = 0, ii = cur.length; i < ii; i++) { + e = cur[i]; + while (e.n) { + if (f) { + if (e.f) { + for (j = 0, jj = e.f.length; j < jj; j++) if (e.f[j] == f) { + e.f.splice(j, 1); + break; + } + !e.f.length && delete e.f; + } + for (key in e.n) if (e.n[has](key) && e.n[key].f) { + var funcs = e.n[key].f; + for (j = 0, jj = funcs.length; j < jj; j++) if (funcs[j] == f) { + funcs.splice(j, 1); + break; + } + !funcs.length && delete e.n[key].f; + } + } else { + delete e.f; + for (key in e.n) if (e.n[has](key) && e.n[key].f) { + delete e.n[key].f; + } + } + e = e.n; + } + } + }; + /*\ + * eve.once + [ method ] + ** + * Binds given event handler with a given name to only run once then unbind itself. + | eve.once("login", f); + | eve("login"); // triggers f + | eve("login"); // no listeners + * Use @eve to trigger the listener. + ** + > Arguments + ** + - name (string) name of the event, dot (`.`) or slash (`/`) separated, with optional wildcards + - f (function) event handler function + ** + = (function) same return function as @eve.on + \*/ + eve.once = function (name, f) { + var f2 = function () { + eve.unbind(name, f2); + return f.apply(this, arguments); + }; + return eve.on(name, f2); + }; + /*\ + * eve.version + [ property (string) ] + ** + * Current version of the library. + \*/ + eve.version = version; + eve.toString = function () { + return "You are running Eve " + version; + }; + + return eve; +})); + +// ┌────────────────────────────────────────────────────────────────────┐ \\ +// │ Raphaël 2.1.4 - JavaScript Vector Library │ \\ +// ├────────────────────────────────────────────────────────────────────┤ \\ +// │ Core Module │ \\ +// ├────────────────────────────────────────────────────────────────────┤ \\ +// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\ +// └────────────────────────────────────────────────────────────────────┘ \\ + +(function (glob, factory) { + if (typeof define === "function" && define.amd) { + define("raphael.core", ["eve"], function(eve) { + return factory(eve); + }); + } else if (typeof exports === "object") { + module.exports = factory(require("eve")); + } else { + glob.Raphael = factory(glob.eve); + } +}(this, function (eve) { + /*\ + * Raphael + [ method ] + ** + * Creates a canvas object on which to draw. + * You must do this first, as all future calls to drawing methods + * from this instance will be bound to this canvas. + > Parameters + ** + - container (HTMLElement|string) DOM element or its ID which is going to be a parent for drawing surface + - width (number) + - height (number) + - callback (function) #optional callback function which is going to be executed in the context of newly created paper + * or + - x (number) + - y (number) + - width (number) + - height (number) + - callback (function) #optional callback function which is going to be executed in the context of newly created paper + * or + - all (array) (first 3 or 4 elements in the array are equal to [containerID, width, height] or [x, y, width, height]. The rest are element descriptions in format {type: type, }). See @Paper.add. + - callback (function) #optional callback function which is going to be executed in the context of newly created paper + * or + - onReadyCallback (function) function that is going to be called on DOM ready event. You can also subscribe to this event via Eve’s “DOMLoad” event. In this case method returns `undefined`. + = (object) @Paper + > Usage + | // Each of the following examples create a canvas + | // that is 320px wide by 200px high. + | // Canvas is created at the viewport’s 10,50 coordinate. + | var paper = Raphael(10, 50, 320, 200); + | // Canvas is created at the top left corner of the #notepad element + | // (or its top right corner in dir="rtl" elements) + | var paper = Raphael(document.getElementById("notepad"), 320, 200); + | // Same as above + | var paper = Raphael("notepad", 320, 200); + | // Image dump + | var set = Raphael(["notepad", 320, 200, { + | type: "rect", + | x: 10, + | y: 10, + | width: 25, + | height: 25, + | stroke: "#f00" + | }, { + | type: "text", + | x: 30, + | y: 40, + | text: "Dump" + | }]); + \*/ + function R(first) { + if (R.is(first, "function")) { + return loaded ? first() : eve.on("raphael.DOMload", first); + } else if (R.is(first, array)) { + return R._engine.create[apply](R, first.splice(0, 3 + R.is(first[0], nu))).add(first); + } else { + var args = Array.prototype.slice.call(arguments, 0); + if (R.is(args[args.length - 1], "function")) { + var f = args.pop(); + return loaded ? f.call(R._engine.create[apply](R, args)) : eve.on("raphael.DOMload", function () { + f.call(R._engine.create[apply](R, args)); + }); + } else { + return R._engine.create[apply](R, arguments); + } + } + } + R.version = "2.1.4"; + R.eve = eve; + var loaded, + separator = /[, ]+/, + elements = {circle: 1, rect: 1, path: 1, ellipse: 1, text: 1, image: 1}, + formatrg = /\{(\d+)\}/g, + proto = "prototype", + has = "hasOwnProperty", + g = { + doc: document, + win: window + }, + oldRaphael = { + was: Object.prototype[has].call(g.win, "Raphael"), + is: g.win.Raphael + }, + Paper = function () { + /*\ + * Paper.ca + [ property (object) ] + ** + * Shortcut for @Paper.customAttributes + \*/ + /*\ + * Paper.customAttributes + [ property (object) ] + ** + * If you have a set of attributes that you would like to represent + * as a function of some number you can do it easily with custom attributes: + > Usage + | paper.customAttributes.hue = function (num) { + | num = num % 1; + | return {fill: "hsb(" + num + ", 0.75, 1)"}; + | }; + | // Custom attribute “hue” will change fill + | // to be given hue with fixed saturation and brightness. + | // Now you can use it like this: + | var c = paper.circle(10, 10, 10).attr({hue: .45}); + | // or even like this: + | c.animate({hue: 1}, 1e3); + | + | // You could also create custom attribute + | // with multiple parameters: + | paper.customAttributes.hsb = function (h, s, b) { + | return {fill: "hsb(" + [h, s, b].join(",") + ")"}; + | }; + | c.attr({hsb: "0.5 .8 1"}); + | c.animate({hsb: [1, 0, 0.5]}, 1e3); + \*/ + this.ca = this.customAttributes = {}; + }, + paperproto, + appendChild = "appendChild", + apply = "apply", + concat = "concat", + supportsTouch = ('ontouchstart' in g.win) || g.win.DocumentTouch && g.doc instanceof DocumentTouch, //taken from Modernizr touch test + E = "", + S = " ", + Str = String, + split = "split", + events = "click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[split](S), + touchMap = { + mousedown: "touchstart", + mousemove: "touchmove", + mouseup: "touchend" + }, + lowerCase = Str.prototype.toLowerCase, + math = Math, + mmax = math.max, + mmin = math.min, + abs = math.abs, + pow = math.pow, + PI = math.PI, + nu = "number", + string = "string", + array = "array", + toString = "toString", + fillString = "fill", + objectToString = Object.prototype.toString, + paper = {}, + push = "push", + ISURL = R._ISURL = /^url\(['"]?(.+?)['"]?\)$/i, + colourRegExp = /^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i, + isnan = {"NaN": 1, "Infinity": 1, "-Infinity": 1}, + bezierrg = /^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/, + round = math.round, + setAttribute = "setAttribute", + toFloat = parseFloat, + toInt = parseInt, + upperCase = Str.prototype.toUpperCase, + availableAttrs = R._availableAttrs = { + "arrow-end": "none", + "arrow-start": "none", + blur: 0, + "clip-rect": "0 0 1e9 1e9", + cursor: "default", + cx: 0, + cy: 0, + fill: "#fff", + "fill-opacity": 1, + font: '10px "Arial"', + "font-family": '"Arial"', + "font-size": "10", + "font-style": "normal", + "font-weight": 400, + gradient: 0, + height: 0, + href: "http://raphaeljs.com/", + "letter-spacing": 0, + opacity: 1, + path: "M0,0", + r: 0, + rx: 0, + ry: 0, + src: "", + stroke: "#000", + "stroke-dasharray": "", + "stroke-linecap": "butt", + "stroke-linejoin": "butt", + "stroke-miterlimit": 0, + "stroke-opacity": 1, + "stroke-width": 1, + target: "_blank", + "text-anchor": "middle", + title: "Raphael", + transform: "", + width: 0, + x: 0, + y: 0 + }, + availableAnimAttrs = R._availableAnimAttrs = { + blur: nu, + "clip-rect": "csv", + cx: nu, + cy: nu, + fill: "colour", + "fill-opacity": nu, + "font-size": nu, + height: nu, + opacity: nu, + path: "path", + r: nu, + rx: nu, + ry: nu, + stroke: "colour", + "stroke-opacity": nu, + "stroke-width": nu, + transform: "transform", + width: nu, + x: nu, + y: nu + }, + whitespace = /[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]/g, + commaSpaces = /[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/, + hsrg = {hs: 1, rg: 1}, + p2s = /,?([achlmqrstvxz]),?/gi, + pathCommand = /([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig, + tCommand = /([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig, + pathValues = /(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/ig, + radial_gradient = R._radial_gradient = /^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/, + eldata = {}, + sortByKey = function (a, b) { + return a.key - b.key; + }, + sortByNumber = function (a, b) { + return toFloat(a) - toFloat(b); + }, + fun = function () {}, + pipe = function (x) { + return x; + }, + rectPath = R._rectPath = function (x, y, w, h, r) { + if (r) { + return [["M", x + r, y], ["l", w - r * 2, 0], ["a", r, r, 0, 0, 1, r, r], ["l", 0, h - r * 2], ["a", r, r, 0, 0, 1, -r, r], ["l", r * 2 - w, 0], ["a", r, r, 0, 0, 1, -r, -r], ["l", 0, r * 2 - h], ["a", r, r, 0, 0, 1, r, -r], ["z"]]; + } + return [["M", x, y], ["l", w, 0], ["l", 0, h], ["l", -w, 0], ["z"]]; + }, + ellipsePath = function (x, y, rx, ry) { + if (ry == null) { + ry = rx; + } + return [["M", x, y], ["m", 0, -ry], ["a", rx, ry, 0, 1, 1, 0, 2 * ry], ["a", rx, ry, 0, 1, 1, 0, -2 * ry], ["z"]]; + }, + getPath = R._getPath = { + path: function (el) { + return el.attr("path"); + }, + circle: function (el) { + var a = el.attrs; + return ellipsePath(a.cx, a.cy, a.r); + }, + ellipse: function (el) { + var a = el.attrs; + return ellipsePath(a.cx, a.cy, a.rx, a.ry); + }, + rect: function (el) { + var a = el.attrs; + return rectPath(a.x, a.y, a.width, a.height, a.r); + }, + image: function (el) { + var a = el.attrs; + return rectPath(a.x, a.y, a.width, a.height); + }, + text: function (el) { + var bbox = el._getBBox(); + return rectPath(bbox.x, bbox.y, bbox.width, bbox.height); + }, + set : function(el) { + var bbox = el._getBBox(); + return rectPath(bbox.x, bbox.y, bbox.width, bbox.height); + } + }, + /*\ + * Raphael.mapPath + [ method ] + ** + * Transform the path string with given matrix. + > Parameters + - path (string) path string + - matrix (object) see @Matrix + = (string) transformed path string + \*/ + mapPath = R.mapPath = function (path, matrix) { + if (!matrix) { + return path; + } + var x, y, i, j, ii, jj, pathi; + path = path2curve(path); + for (i = 0, ii = path.length; i < ii; i++) { + pathi = path[i]; + for (j = 1, jj = pathi.length; j < jj; j += 2) { + x = matrix.x(pathi[j], pathi[j + 1]); + y = matrix.y(pathi[j], pathi[j + 1]); + pathi[j] = x; + pathi[j + 1] = y; + } + } + return path; + }; + + R._g = g; + /*\ + * Raphael.type + [ property (string) ] + ** + * Can be “SVG”, “VML” or empty, depending on browser support. + \*/ + R.type = (g.win.SVGAngle || g.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") ? "SVG" : "VML"); + if (R.type == "VML") { + var d = g.doc.createElement("div"), + b; + d.innerHTML = ''; + b = d.firstChild; + b.style.behavior = "url(#default#VML)"; + if (!(b && typeof b.adj == "object")) { + return (R.type = E); + } + d = null; + } + /*\ + * Raphael.svg + [ property (boolean) ] + ** + * `true` if browser supports SVG. + \*/ + /*\ + * Raphael.vml + [ property (boolean) ] + ** + * `true` if browser supports VML. + \*/ + R.svg = !(R.vml = R.type == "VML"); + R._Paper = Paper; + /*\ + * Raphael.fn + [ property (object) ] + ** + * You can add your own method to the canvas. For example if you want to draw a pie chart, + * you can create your own pie chart function and ship it as a Raphaël plugin. To do this + * you need to extend the `Raphael.fn` object. You should modify the `fn` object before a + * Raphaël instance is created, otherwise it will take no effect. Please note that the + * ability for namespaced plugins was removed in Raphael 2.0. It is up to the plugin to + * ensure any namespacing ensures proper context. + > Usage + | Raphael.fn.arrow = function (x1, y1, x2, y2, size) { + | return this.path( ... ); + | }; + | // or create namespace + | Raphael.fn.mystuff = { + | arrow: function () {…}, + | star: function () {…}, + | // etc… + | }; + | var paper = Raphael(10, 10, 630, 480); + | // then use it + | paper.arrow(10, 10, 30, 30, 5).attr({fill: "#f00"}); + | paper.mystuff.arrow(); + | paper.mystuff.star(); + \*/ + R.fn = paperproto = Paper.prototype = R.prototype; + R._id = 0; + R._oid = 0; + /*\ + * Raphael.is + [ method ] + ** + * Handful of replacements for `typeof` operator. + > Parameters + - o (…) any object or primitive + - type (string) name of the type, i.e. “string”, “function”, “number”, etc. + = (boolean) is given value is of given type + \*/ + R.is = function (o, type) { + type = lowerCase.call(type); + if (type == "finite") { + return !isnan[has](+o); + } + if (type == "array") { + return o instanceof Array; + } + return (type == "null" && o === null) || + (type == typeof o && o !== null) || + (type == "object" && o === Object(o)) || + (type == "array" && Array.isArray && Array.isArray(o)) || + objectToString.call(o).slice(8, -1).toLowerCase() == type; + }; + + function clone(obj) { + if (typeof obj == "function" || Object(obj) !== obj) { + return obj; + } + var res = new obj.constructor; + for (var key in obj) if (obj[has](key)) { + res[key] = clone(obj[key]); + } + return res; + } + + /*\ + * Raphael.angle + [ method ] + ** + * Returns angle between two or three points + > Parameters + - x1 (number) x coord of first point + - y1 (number) y coord of first point + - x2 (number) x coord of second point + - y2 (number) y coord of second point + - x3 (number) #optional x coord of third point + - y3 (number) #optional y coord of third point + = (number) angle in degrees. + \*/ + R.angle = function (x1, y1, x2, y2, x3, y3) { + if (x3 == null) { + var x = x1 - x2, + y = y1 - y2; + if (!x && !y) { + return 0; + } + return (180 + math.atan2(-y, -x) * 180 / PI + 360) % 360; + } else { + return R.angle(x1, y1, x3, y3) - R.angle(x2, y2, x3, y3); + } + }; + /*\ + * Raphael.rad + [ method ] + ** + * Transform angle to radians + > Parameters + - deg (number) angle in degrees + = (number) angle in radians. + \*/ + R.rad = function (deg) { + return deg % 360 * PI / 180; + }; + /*\ + * Raphael.deg + [ method ] + ** + * Transform angle to degrees + > Parameters + - rad (number) angle in radians + = (number) angle in degrees. + \*/ + R.deg = function (rad) { + return Math.round ((rad * 180 / PI% 360)* 1000) / 1000; + }; + /*\ + * Raphael.snapTo + [ method ] + ** + * Snaps given value to given grid. + > Parameters + - values (array|number) given array of values or step of the grid + - value (number) value to adjust + - tolerance (number) #optional tolerance for snapping. Default is `10`. + = (number) adjusted value. + \*/ + R.snapTo = function (values, value, tolerance) { + tolerance = R.is(tolerance, "finite") ? tolerance : 10; + if (R.is(values, array)) { + var i = values.length; + while (i--) if (abs(values[i] - value) <= tolerance) { + return values[i]; + } + } else { + values = +values; + var rem = value % values; + if (rem < tolerance) { + return value - rem; + } + if (rem > values - tolerance) { + return value - rem + values; + } + } + return value; + }; + + /*\ + * Raphael.createUUID + [ method ] + ** + * Returns RFC4122, version 4 ID + \*/ + var createUUID = R.createUUID = (function (uuidRegEx, uuidReplacer) { + return function () { + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(uuidRegEx, uuidReplacer).toUpperCase(); + }; + })(/[xy]/g, function (c) { + var r = math.random() * 16 | 0, + v = c == "x" ? r : (r & 3 | 8); + return v.toString(16); + }); + + /*\ + * Raphael.setWindow + [ method ] + ** + * Used when you need to draw in `<iframe>`. Switched window to the iframe one. + > Parameters + - newwin (window) new window object + \*/ + R.setWindow = function (newwin) { + eve("raphael.setWindow", R, g.win, newwin); + g.win = newwin; + g.doc = g.win.document; + if (R._engine.initWin) { + R._engine.initWin(g.win); + } + }; + var toHex = function (color) { + if (R.vml) { + // http://dean.edwards.name/weblog/2009/10/convert-any-colour-value-to-hex-in-msie/ + var trim = /^\s+|\s+$/g; + var bod; + try { + var docum = new ActiveXObject("htmlfile"); + docum.write(""); + docum.close(); + bod = docum.body; + } catch(e) { + bod = createPopup().document.body; + } + var range = bod.createTextRange(); + toHex = cacher(function (color) { + try { + bod.style.color = Str(color).replace(trim, E); + var value = range.queryCommandValue("ForeColor"); + value = ((value & 255) << 16) | (value & 65280) | ((value & 16711680) >>> 16); + return "#" + ("000000" + value.toString(16)).slice(-6); + } catch(e) { + return "none"; + } + }); + } else { + var i = g.doc.createElement("i"); + i.title = "Rapha\xebl Colour Picker"; + i.style.display = "none"; + g.doc.body.appendChild(i); + toHex = cacher(function (color) { + i.style.color = color; + return g.doc.defaultView.getComputedStyle(i, E).getPropertyValue("color"); + }); + } + return toHex(color); + }, + hsbtoString = function () { + return "hsb(" + [this.h, this.s, this.b] + ")"; + }, + hsltoString = function () { + return "hsl(" + [this.h, this.s, this.l] + ")"; + }, + rgbtoString = function () { + return this.hex; + }, + prepareRGB = function (r, g, b) { + if (g == null && R.is(r, "object") && "r" in r && "g" in r && "b" in r) { + b = r.b; + g = r.g; + r = r.r; + } + if (g == null && R.is(r, string)) { + var clr = R.getRGB(r); + r = clr.r; + g = clr.g; + b = clr.b; + } + if (r > 1 || g > 1 || b > 1) { + r /= 255; + g /= 255; + b /= 255; + } + + return [r, g, b]; + }, + packageRGB = function (r, g, b, o) { + r *= 255; + g *= 255; + b *= 255; + var rgb = { + r: r, + g: g, + b: b, + hex: R.rgb(r, g, b), + toString: rgbtoString + }; + R.is(o, "finite") && (rgb.opacity = o); + return rgb; + }; + + /*\ + * Raphael.color + [ method ] + ** + * Parses the color string and returns object with all values for the given color. + > Parameters + - clr (string) color string in one of the supported formats (see @Raphael.getRGB) + = (object) Combined RGB & HSB object in format: + o { + o r (number) red, + o g (number) green, + o b (number) blue, + o hex (string) color in HTML/CSS format: #••••••, + o error (boolean) `true` if string can’t be parsed, + o h (number) hue, + o s (number) saturation, + o v (number) value (brightness), + o l (number) lightness + o } + \*/ + R.color = function (clr) { + var rgb; + if (R.is(clr, "object") && "h" in clr && "s" in clr && "b" in clr) { + rgb = R.hsb2rgb(clr); + clr.r = rgb.r; + clr.g = rgb.g; + clr.b = rgb.b; + clr.hex = rgb.hex; + } else if (R.is(clr, "object") && "h" in clr && "s" in clr && "l" in clr) { + rgb = R.hsl2rgb(clr); + clr.r = rgb.r; + clr.g = rgb.g; + clr.b = rgb.b; + clr.hex = rgb.hex; + } else { + if (R.is(clr, "string")) { + clr = R.getRGB(clr); + } + if (R.is(clr, "object") && "r" in clr && "g" in clr && "b" in clr) { + rgb = R.rgb2hsl(clr); + clr.h = rgb.h; + clr.s = rgb.s; + clr.l = rgb.l; + rgb = R.rgb2hsb(clr); + clr.v = rgb.b; + } else { + clr = {hex: "none"}; + clr.r = clr.g = clr.b = clr.h = clr.s = clr.v = clr.l = -1; + } + } + clr.toString = rgbtoString; + return clr; + }; + /*\ + * Raphael.hsb2rgb + [ method ] + ** + * Converts HSB values to RGB object. + > Parameters + - h (number) hue + - s (number) saturation + - v (number) value or brightness + = (object) RGB object in format: + o { + o r (number) red, + o g (number) green, + o b (number) blue, + o hex (string) color in HTML/CSS format: #•••••• + o } + \*/ + R.hsb2rgb = function (h, s, v, o) { + if (this.is(h, "object") && "h" in h && "s" in h && "b" in h) { + v = h.b; + s = h.s; + o = h.o; + h = h.h; + } + h *= 360; + var R, G, B, X, C; + h = (h % 360) / 60; + C = v * s; + X = C * (1 - abs(h % 2 - 1)); + R = G = B = v - C; + + h = ~~h; + R += [C, X, 0, 0, X, C][h]; + G += [X, C, C, X, 0, 0][h]; + B += [0, 0, X, C, C, X][h]; + return packageRGB(R, G, B, o); + }; + /*\ + * Raphael.hsl2rgb + [ method ] + ** + * Converts HSL values to RGB object. + > Parameters + - h (number) hue + - s (number) saturation + - l (number) luminosity + = (object) RGB object in format: + o { + o r (number) red, + o g (number) green, + o b (number) blue, + o hex (string) color in HTML/CSS format: #•••••• + o } + \*/ + R.hsl2rgb = function (h, s, l, o) { + if (this.is(h, "object") && "h" in h && "s" in h && "l" in h) { + l = h.l; + s = h.s; + h = h.h; + } + if (h > 1 || s > 1 || l > 1) { + h /= 360; + s /= 100; + l /= 100; + } + h *= 360; + var R, G, B, X, C; + h = (h % 360) / 60; + C = 2 * s * (l < .5 ? l : 1 - l); + X = C * (1 - abs(h % 2 - 1)); + R = G = B = l - C / 2; + + h = ~~h; + R += [C, X, 0, 0, X, C][h]; + G += [X, C, C, X, 0, 0][h]; + B += [0, 0, X, C, C, X][h]; + return packageRGB(R, G, B, o); + }; + /*\ + * Raphael.rgb2hsb + [ method ] + ** + * Converts RGB values to HSB object. + > Parameters + - r (number) red + - g (number) green + - b (number) blue + = (object) HSB object in format: + o { + o h (number) hue + o s (number) saturation + o b (number) brightness + o } + \*/ + R.rgb2hsb = function (r, g, b) { + b = prepareRGB(r, g, b); + r = b[0]; + g = b[1]; + b = b[2]; + + var H, S, V, C; + V = mmax(r, g, b); + C = V - mmin(r, g, b); + H = (C == 0 ? null : + V == r ? (g - b) / C : + V == g ? (b - r) / C + 2 : + (r - g) / C + 4 + ); + H = ((H + 360) % 6) * 60 / 360; + S = C == 0 ? 0 : C / V; + return {h: H, s: S, b: V, toString: hsbtoString}; + }; + /*\ + * Raphael.rgb2hsl + [ method ] + ** + * Converts RGB values to HSL object. + > Parameters + - r (number) red + - g (number) green + - b (number) blue + = (object) HSL object in format: + o { + o h (number) hue + o s (number) saturation + o l (number) luminosity + o } + \*/ + R.rgb2hsl = function (r, g, b) { + b = prepareRGB(r, g, b); + r = b[0]; + g = b[1]; + b = b[2]; + + var H, S, L, M, m, C; + M = mmax(r, g, b); + m = mmin(r, g, b); + C = M - m; + H = (C == 0 ? null : + M == r ? (g - b) / C : + M == g ? (b - r) / C + 2 : + (r - g) / C + 4); + H = ((H + 360) % 6) * 60 / 360; + L = (M + m) / 2; + S = (C == 0 ? 0 : + L < .5 ? C / (2 * L) : + C / (2 - 2 * L)); + return {h: H, s: S, l: L, toString: hsltoString}; + }; + R._path2string = function () { + return this.join(",").replace(p2s, "$1"); + }; + function repush(array, item) { + for (var i = 0, ii = array.length; i < ii; i++) if (array[i] === item) { + return array.push(array.splice(i, 1)[0]); + } + } + function cacher(f, scope, postprocessor) { + function newf() { + var arg = Array.prototype.slice.call(arguments, 0), + args = arg.join("\u2400"), + cache = newf.cache = newf.cache || {}, + count = newf.count = newf.count || []; + if (cache[has](args)) { + repush(count, args); + return postprocessor ? postprocessor(cache[args]) : cache[args]; + } + count.length >= 1e3 && delete cache[count.shift()]; + count.push(args); + cache[args] = f[apply](scope, arg); + return postprocessor ? postprocessor(cache[args]) : cache[args]; + } + return newf; + } + + var preload = R._preload = function (src, f) { + var img = g.doc.createElement("img"); + img.style.cssText = "position:absolute;left:-9999em;top:-9999em"; + img.onload = function () { + f.call(this); + this.onload = null; + g.doc.body.removeChild(this); + }; + img.onerror = function () { + g.doc.body.removeChild(this); + }; + g.doc.body.appendChild(img); + img.src = src; + }; + + function clrToString() { + return this.hex; + } + + /*\ + * Raphael.getRGB + [ method ] + ** + * Parses colour string as RGB object + > Parameters + - colour (string) colour string in one of formats: + #
    + #
  • Colour name (“red”, “green”, “cornflowerblue”, etc)
  • + #
  • #••• — shortened HTML colour: (“#000”, “#fc0”, etc)
  • + #
  • #•••••• — full length HTML colour: (“#000000”, “#bd2300”)
  • + #
  • rgb(•••, •••, •••) — red, green and blue channels’ values: (“rgb(200, 100, 0)”)
  • + #
  • rgb(•••%, •••%, •••%) — same as above, but in %: (“rgb(100%, 175%, 0%)”)
  • + #
  • hsb(•••, •••, •••) — hue, saturation and brightness values: (“hsb(0.5, 0.25, 1)”)
  • + #
  • hsb(•••%, •••%, •••%) — same as above, but in %
  • + #
  • hsl(•••, •••, •••) — same as hsb
  • + #
  • hsl(•••%, •••%, •••%) — same as hsb
  • + #
+ = (object) RGB object in format: + o { + o r (number) red, + o g (number) green, + o b (number) blue + o hex (string) color in HTML/CSS format: #••••••, + o error (boolean) true if string can’t be parsed + o } + \*/ + R.getRGB = cacher(function (colour) { + if (!colour || !!((colour = Str(colour)).indexOf("-") + 1)) { + return {r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString}; + } + if (colour == "none") { + return {r: -1, g: -1, b: -1, hex: "none", toString: clrToString}; + } + !(hsrg[has](colour.toLowerCase().substring(0, 2)) || colour.charAt() == "#") && (colour = toHex(colour)); + var res, + red, + green, + blue, + opacity, + t, + values, + rgb = colour.match(colourRegExp); + if (rgb) { + if (rgb[2]) { + blue = toInt(rgb[2].substring(5), 16); + green = toInt(rgb[2].substring(3, 5), 16); + red = toInt(rgb[2].substring(1, 3), 16); + } + if (rgb[3]) { + blue = toInt((t = rgb[3].charAt(3)) + t, 16); + green = toInt((t = rgb[3].charAt(2)) + t, 16); + red = toInt((t = rgb[3].charAt(1)) + t, 16); + } + if (rgb[4]) { + values = rgb[4][split](commaSpaces); + red = toFloat(values[0]); + values[0].slice(-1) == "%" && (red *= 2.55); + green = toFloat(values[1]); + values[1].slice(-1) == "%" && (green *= 2.55); + blue = toFloat(values[2]); + values[2].slice(-1) == "%" && (blue *= 2.55); + rgb[1].toLowerCase().slice(0, 4) == "rgba" && (opacity = toFloat(values[3])); + values[3] && values[3].slice(-1) == "%" && (opacity /= 100); + } + if (rgb[5]) { + values = rgb[5][split](commaSpaces); + red = toFloat(values[0]); + values[0].slice(-1) == "%" && (red *= 2.55); + green = toFloat(values[1]); + values[1].slice(-1) == "%" && (green *= 2.55); + blue = toFloat(values[2]); + values[2].slice(-1) == "%" && (blue *= 2.55); + (values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360); + rgb[1].toLowerCase().slice(0, 4) == "hsba" && (opacity = toFloat(values[3])); + values[3] && values[3].slice(-1) == "%" && (opacity /= 100); + return R.hsb2rgb(red, green, blue, opacity); + } + if (rgb[6]) { + values = rgb[6][split](commaSpaces); + red = toFloat(values[0]); + values[0].slice(-1) == "%" && (red *= 2.55); + green = toFloat(values[1]); + values[1].slice(-1) == "%" && (green *= 2.55); + blue = toFloat(values[2]); + values[2].slice(-1) == "%" && (blue *= 2.55); + (values[0].slice(-3) == "deg" || values[0].slice(-1) == "\xb0") && (red /= 360); + rgb[1].toLowerCase().slice(0, 4) == "hsla" && (opacity = toFloat(values[3])); + values[3] && values[3].slice(-1) == "%" && (opacity /= 100); + return R.hsl2rgb(red, green, blue, opacity); + } + rgb = {r: red, g: green, b: blue, toString: clrToString}; + rgb.hex = "#" + (16777216 | blue | (green << 8) | (red << 16)).toString(16).slice(1); + R.is(opacity, "finite") && (rgb.opacity = opacity); + return rgb; + } + return {r: -1, g: -1, b: -1, hex: "none", error: 1, toString: clrToString}; + }, R); + /*\ + * Raphael.hsb + [ method ] + ** + * Converts HSB values to hex representation of the colour. + > Parameters + - h (number) hue + - s (number) saturation + - b (number) value or brightness + = (string) hex representation of the colour. + \*/ + R.hsb = cacher(function (h, s, b) { + return R.hsb2rgb(h, s, b).hex; + }); + /*\ + * Raphael.hsl + [ method ] + ** + * Converts HSL values to hex representation of the colour. + > Parameters + - h (number) hue + - s (number) saturation + - l (number) luminosity + = (string) hex representation of the colour. + \*/ + R.hsl = cacher(function (h, s, l) { + return R.hsl2rgb(h, s, l).hex; + }); + /*\ + * Raphael.rgb + [ method ] + ** + * Converts RGB values to hex representation of the colour. + > Parameters + - r (number) red + - g (number) green + - b (number) blue + = (string) hex representation of the colour. + \*/ + R.rgb = cacher(function (r, g, b) { + function round(x) { return (x + 0.5) | 0; } + return "#" + (16777216 | round(b) | (round(g) << 8) | (round(r) << 16)).toString(16).slice(1); + }); + /*\ + * Raphael.getColor + [ method ] + ** + * On each call returns next colour in the spectrum. To reset it back to red call @Raphael.getColor.reset + > Parameters + - value (number) #optional brightness, default is `0.75` + = (string) hex representation of the colour. + \*/ + R.getColor = function (value) { + var start = this.getColor.start = this.getColor.start || {h: 0, s: 1, b: value || .75}, + rgb = this.hsb2rgb(start.h, start.s, start.b); + start.h += .075; + if (start.h > 1) { + start.h = 0; + start.s -= .2; + start.s <= 0 && (this.getColor.start = {h: 0, s: 1, b: start.b}); + } + return rgb.hex; + }; + /*\ + * Raphael.getColor.reset + [ method ] + ** + * Resets spectrum position for @Raphael.getColor back to red. + \*/ + R.getColor.reset = function () { + delete this.start; + }; + + // http://schepers.cc/getting-to-the-point + function catmullRom2bezier(crp, z) { + var d = []; + for (var i = 0, iLen = crp.length; iLen - 2 * !z > i; i += 2) { + var p = [ + {x: +crp[i - 2], y: +crp[i - 1]}, + {x: +crp[i], y: +crp[i + 1]}, + {x: +crp[i + 2], y: +crp[i + 3]}, + {x: +crp[i + 4], y: +crp[i + 5]} + ]; + if (z) { + if (!i) { + p[0] = {x: +crp[iLen - 2], y: +crp[iLen - 1]}; + } else if (iLen - 4 == i) { + p[3] = {x: +crp[0], y: +crp[1]}; + } else if (iLen - 2 == i) { + p[2] = {x: +crp[0], y: +crp[1]}; + p[3] = {x: +crp[2], y: +crp[3]}; + } + } else { + if (iLen - 4 == i) { + p[3] = p[2]; + } else if (!i) { + p[0] = {x: +crp[i], y: +crp[i + 1]}; + } + } + d.push(["C", + (-p[0].x + 6 * p[1].x + p[2].x) / 6, + (-p[0].y + 6 * p[1].y + p[2].y) / 6, + (p[1].x + 6 * p[2].x - p[3].x) / 6, + (p[1].y + 6*p[2].y - p[3].y) / 6, + p[2].x, + p[2].y + ]); + } + + return d; + } + /*\ + * Raphael.parsePathString + [ method ] + ** + * Utility method + ** + * Parses given path string into an array of arrays of path segments. + > Parameters + - pathString (string|array) path string or array of segments (in the last case it will be returned straight away) + = (array) array of segments. + \*/ + R.parsePathString = function (pathString) { + if (!pathString) { + return null; + } + var pth = paths(pathString); + if (pth.arr) { + return pathClone(pth.arr); + } + + var paramCounts = {a: 7, c: 6, h: 1, l: 2, m: 2, r: 4, q: 4, s: 4, t: 2, v: 1, z: 0}, + data = []; + if (R.is(pathString, array) && R.is(pathString[0], array)) { // rough assumption + data = pathClone(pathString); + } + if (!data.length) { + Str(pathString).replace(pathCommand, function (a, b, c) { + var params = [], + name = b.toLowerCase(); + c.replace(pathValues, function (a, b) { + b && params.push(+b); + }); + if (name == "m" && params.length > 2) { + data.push([b][concat](params.splice(0, 2))); + name = "l"; + b = b == "m" ? "l" : "L"; + } + if (name == "r") { + data.push([b][concat](params)); + } else while (params.length >= paramCounts[name]) { + data.push([b][concat](params.splice(0, paramCounts[name]))); + if (!paramCounts[name]) { + break; + } + } + }); + } + data.toString = R._path2string; + pth.arr = pathClone(data); + return data; + }; + /*\ + * Raphael.parseTransformString + [ method ] + ** + * Utility method + ** + * Parses given path string into an array of transformations. + > Parameters + - TString (string|array) transform string or array of transformations (in the last case it will be returned straight away) + = (array) array of transformations. + \*/ + R.parseTransformString = cacher(function (TString) { + if (!TString) { + return null; + } + var paramCounts = {r: 3, s: 4, t: 2, m: 6}, + data = []; + if (R.is(TString, array) && R.is(TString[0], array)) { // rough assumption + data = pathClone(TString); + } + if (!data.length) { + Str(TString).replace(tCommand, function (a, b, c) { + var params = [], + name = lowerCase.call(b); + c.replace(pathValues, function (a, b) { + b && params.push(+b); + }); + data.push([b][concat](params)); + }); + } + data.toString = R._path2string; + return data; + }); + // PATHS + var paths = function (ps) { + var p = paths.ps = paths.ps || {}; + if (p[ps]) { + p[ps].sleep = 100; + } else { + p[ps] = { + sleep: 100 + }; + } + setTimeout(function () { + for (var key in p) if (p[has](key) && key != ps) { + p[key].sleep--; + !p[key].sleep && delete p[key]; + } + }); + return p[ps]; + }; + /*\ + * Raphael.findDotsAtSegment + [ method ] + ** + * Utility method + ** + * Find dot coordinates on the given cubic bezier curve at the given t. + > Parameters + - p1x (number) x of the first point of the curve + - p1y (number) y of the first point of the curve + - c1x (number) x of the first anchor of the curve + - c1y (number) y of the first anchor of the curve + - c2x (number) x of the second anchor of the curve + - c2y (number) y of the second anchor of the curve + - p2x (number) x of the second point of the curve + - p2y (number) y of the second point of the curve + - t (number) position on the curve (0..1) + = (object) point information in format: + o { + o x: (number) x coordinate of the point + o y: (number) y coordinate of the point + o m: { + o x: (number) x coordinate of the left anchor + o y: (number) y coordinate of the left anchor + o } + o n: { + o x: (number) x coordinate of the right anchor + o y: (number) y coordinate of the right anchor + o } + o start: { + o x: (number) x coordinate of the start of the curve + o y: (number) y coordinate of the start of the curve + o } + o end: { + o x: (number) x coordinate of the end of the curve + o y: (number) y coordinate of the end of the curve + o } + o alpha: (number) angle of the curve derivative at the point + o } + \*/ + R.findDotsAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) { + var t1 = 1 - t, + t13 = pow(t1, 3), + t12 = pow(t1, 2), + t2 = t * t, + t3 = t2 * t, + x = t13 * p1x + t12 * 3 * t * c1x + t1 * 3 * t * t * c2x + t3 * p2x, + y = t13 * p1y + t12 * 3 * t * c1y + t1 * 3 * t * t * c2y + t3 * p2y, + mx = p1x + 2 * t * (c1x - p1x) + t2 * (c2x - 2 * c1x + p1x), + my = p1y + 2 * t * (c1y - p1y) + t2 * (c2y - 2 * c1y + p1y), + nx = c1x + 2 * t * (c2x - c1x) + t2 * (p2x - 2 * c2x + c1x), + ny = c1y + 2 * t * (c2y - c1y) + t2 * (p2y - 2 * c2y + c1y), + ax = t1 * p1x + t * c1x, + ay = t1 * p1y + t * c1y, + cx = t1 * c2x + t * p2x, + cy = t1 * c2y + t * p2y, + alpha = (90 - math.atan2(mx - nx, my - ny) * 180 / PI); + (mx > nx || my < ny) && (alpha += 180); + return { + x: x, + y: y, + m: {x: mx, y: my}, + n: {x: nx, y: ny}, + start: {x: ax, y: ay}, + end: {x: cx, y: cy}, + alpha: alpha + }; + }; + /*\ + * Raphael.bezierBBox + [ method ] + ** + * Utility method + ** + * Return bounding box of a given cubic bezier curve + > Parameters + - p1x (number) x of the first point of the curve + - p1y (number) y of the first point of the curve + - c1x (number) x of the first anchor of the curve + - c1y (number) y of the first anchor of the curve + - c2x (number) x of the second anchor of the curve + - c2y (number) y of the second anchor of the curve + - p2x (number) x of the second point of the curve + - p2y (number) y of the second point of the curve + * or + - bez (array) array of six points for bezier curve + = (object) point information in format: + o { + o min: { + o x: (number) x coordinate of the left point + o y: (number) y coordinate of the top point + o } + o max: { + o x: (number) x coordinate of the right point + o y: (number) y coordinate of the bottom point + o } + o } + \*/ + R.bezierBBox = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) { + if (!R.is(p1x, "array")) { + p1x = [p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y]; + } + var bbox = curveDim.apply(null, p1x); + return { + x: bbox.min.x, + y: bbox.min.y, + x2: bbox.max.x, + y2: bbox.max.y, + width: bbox.max.x - bbox.min.x, + height: bbox.max.y - bbox.min.y + }; + }; + /*\ + * Raphael.isPointInsideBBox + [ method ] + ** + * Utility method + ** + * Returns `true` if given point is inside bounding boxes. + > Parameters + - bbox (string) bounding box + - x (string) x coordinate of the point + - y (string) y coordinate of the point + = (boolean) `true` if point inside + \*/ + R.isPointInsideBBox = function (bbox, x, y) { + return x >= bbox.x && x <= bbox.x2 && y >= bbox.y && y <= bbox.y2; + }; + /*\ + * Raphael.isBBoxIntersect + [ method ] + ** + * Utility method + ** + * Returns `true` if two bounding boxes intersect + > Parameters + - bbox1 (string) first bounding box + - bbox2 (string) second bounding box + = (boolean) `true` if they intersect + \*/ + R.isBBoxIntersect = function (bbox1, bbox2) { + var i = R.isPointInsideBBox; + return i(bbox2, bbox1.x, bbox1.y) + || i(bbox2, bbox1.x2, bbox1.y) + || i(bbox2, bbox1.x, bbox1.y2) + || i(bbox2, bbox1.x2, bbox1.y2) + || i(bbox1, bbox2.x, bbox2.y) + || i(bbox1, bbox2.x2, bbox2.y) + || i(bbox1, bbox2.x, bbox2.y2) + || i(bbox1, bbox2.x2, bbox2.y2) + || (bbox1.x < bbox2.x2 && bbox1.x > bbox2.x || bbox2.x < bbox1.x2 && bbox2.x > bbox1.x) + && (bbox1.y < bbox2.y2 && bbox1.y > bbox2.y || bbox2.y < bbox1.y2 && bbox2.y > bbox1.y); + }; + function base3(t, p1, p2, p3, p4) { + var t1 = -3 * p1 + 9 * p2 - 9 * p3 + 3 * p4, + t2 = t * t1 + 6 * p1 - 12 * p2 + 6 * p3; + return t * t2 - 3 * p1 + 3 * p2; + } + function bezlen(x1, y1, x2, y2, x3, y3, x4, y4, z) { + if (z == null) { + z = 1; + } + z = z > 1 ? 1 : z < 0 ? 0 : z; + var z2 = z / 2, + n = 12, + Tvalues = [-0.1252,0.1252,-0.3678,0.3678,-0.5873,0.5873,-0.7699,0.7699,-0.9041,0.9041,-0.9816,0.9816], + Cvalues = [0.2491,0.2491,0.2335,0.2335,0.2032,0.2032,0.1601,0.1601,0.1069,0.1069,0.0472,0.0472], + sum = 0; + for (var i = 0; i < n; i++) { + var ct = z2 * Tvalues[i] + z2, + xbase = base3(ct, x1, x2, x3, x4), + ybase = base3(ct, y1, y2, y3, y4), + comb = xbase * xbase + ybase * ybase; + sum += Cvalues[i] * math.sqrt(comb); + } + return z2 * sum; + } + function getTatLen(x1, y1, x2, y2, x3, y3, x4, y4, ll) { + if (ll < 0 || bezlen(x1, y1, x2, y2, x3, y3, x4, y4) < ll) { + return; + } + var t = 1, + step = t / 2, + t2 = t - step, + l, + e = .01; + l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2); + while (abs(l - ll) > e) { + step /= 2; + t2 += (l < ll ? 1 : -1) * step; + l = bezlen(x1, y1, x2, y2, x3, y3, x4, y4, t2); + } + return t2; + } + function intersect(x1, y1, x2, y2, x3, y3, x4, y4) { + if ( + mmax(x1, x2) < mmin(x3, x4) || + mmin(x1, x2) > mmax(x3, x4) || + mmax(y1, y2) < mmin(y3, y4) || + mmin(y1, y2) > mmax(y3, y4) + ) { + return; + } + var nx = (x1 * y2 - y1 * x2) * (x3 - x4) - (x1 - x2) * (x3 * y4 - y3 * x4), + ny = (x1 * y2 - y1 * x2) * (y3 - y4) - (y1 - y2) * (x3 * y4 - y3 * x4), + denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4); + + if (!denominator) { + return; + } + var px = nx / denominator, + py = ny / denominator, + px2 = +px.toFixed(2), + py2 = +py.toFixed(2); + if ( + px2 < +mmin(x1, x2).toFixed(2) || + px2 > +mmax(x1, x2).toFixed(2) || + px2 < +mmin(x3, x4).toFixed(2) || + px2 > +mmax(x3, x4).toFixed(2) || + py2 < +mmin(y1, y2).toFixed(2) || + py2 > +mmax(y1, y2).toFixed(2) || + py2 < +mmin(y3, y4).toFixed(2) || + py2 > +mmax(y3, y4).toFixed(2) + ) { + return; + } + return {x: px, y: py}; + } + function inter(bez1, bez2) { + return interHelper(bez1, bez2); + } + function interCount(bez1, bez2) { + return interHelper(bez1, bez2, 1); + } + function interHelper(bez1, bez2, justCount) { + var bbox1 = R.bezierBBox(bez1), + bbox2 = R.bezierBBox(bez2); + if (!R.isBBoxIntersect(bbox1, bbox2)) { + return justCount ? 0 : []; + } + var l1 = bezlen.apply(0, bez1), + l2 = bezlen.apply(0, bez2), + n1 = mmax(~~(l1 / 5), 1), + n2 = mmax(~~(l2 / 5), 1), + dots1 = [], + dots2 = [], + xy = {}, + res = justCount ? 0 : []; + for (var i = 0; i < n1 + 1; i++) { + var p = R.findDotsAtSegment.apply(R, bez1.concat(i / n1)); + dots1.push({x: p.x, y: p.y, t: i / n1}); + } + for (i = 0; i < n2 + 1; i++) { + p = R.findDotsAtSegment.apply(R, bez2.concat(i / n2)); + dots2.push({x: p.x, y: p.y, t: i / n2}); + } + for (i = 0; i < n1; i++) { + for (var j = 0; j < n2; j++) { + var di = dots1[i], + di1 = dots1[i + 1], + dj = dots2[j], + dj1 = dots2[j + 1], + ci = abs(di1.x - di.x) < .001 ? "y" : "x", + cj = abs(dj1.x - dj.x) < .001 ? "y" : "x", + is = intersect(di.x, di.y, di1.x, di1.y, dj.x, dj.y, dj1.x, dj1.y); + if (is) { + if (xy[is.x.toFixed(4)] == is.y.toFixed(4)) { + continue; + } + xy[is.x.toFixed(4)] = is.y.toFixed(4); + var t1 = di.t + abs((is[ci] - di[ci]) / (di1[ci] - di[ci])) * (di1.t - di.t), + t2 = dj.t + abs((is[cj] - dj[cj]) / (dj1[cj] - dj[cj])) * (dj1.t - dj.t); + if (t1 >= 0 && t1 <= 1.001 && t2 >= 0 && t2 <= 1.001) { + if (justCount) { + res++; + } else { + res.push({ + x: is.x, + y: is.y, + t1: mmin(t1, 1), + t2: mmin(t2, 1) + }); + } + } + } + } + } + return res; + } + /*\ + * Raphael.pathIntersection + [ method ] + ** + * Utility method + ** + * Finds intersections of two paths + > Parameters + - path1 (string) path string + - path2 (string) path string + = (array) dots of intersection + o [ + o { + o x: (number) x coordinate of the point + o y: (number) y coordinate of the point + o t1: (number) t value for segment of path1 + o t2: (number) t value for segment of path2 + o segment1: (number) order number for segment of path1 + o segment2: (number) order number for segment of path2 + o bez1: (array) eight coordinates representing beziér curve for the segment of path1 + o bez2: (array) eight coordinates representing beziér curve for the segment of path2 + o } + o ] + \*/ + R.pathIntersection = function (path1, path2) { + return interPathHelper(path1, path2); + }; + R.pathIntersectionNumber = function (path1, path2) { + return interPathHelper(path1, path2, 1); + }; + function interPathHelper(path1, path2, justCount) { + path1 = R._path2curve(path1); + path2 = R._path2curve(path2); + var x1, y1, x2, y2, x1m, y1m, x2m, y2m, bez1, bez2, + res = justCount ? 0 : []; + for (var i = 0, ii = path1.length; i < ii; i++) { + var pi = path1[i]; + if (pi[0] == "M") { + x1 = x1m = pi[1]; + y1 = y1m = pi[2]; + } else { + if (pi[0] == "C") { + bez1 = [x1, y1].concat(pi.slice(1)); + x1 = bez1[6]; + y1 = bez1[7]; + } else { + bez1 = [x1, y1, x1, y1, x1m, y1m, x1m, y1m]; + x1 = x1m; + y1 = y1m; + } + for (var j = 0, jj = path2.length; j < jj; j++) { + var pj = path2[j]; + if (pj[0] == "M") { + x2 = x2m = pj[1]; + y2 = y2m = pj[2]; + } else { + if (pj[0] == "C") { + bez2 = [x2, y2].concat(pj.slice(1)); + x2 = bez2[6]; + y2 = bez2[7]; + } else { + bez2 = [x2, y2, x2, y2, x2m, y2m, x2m, y2m]; + x2 = x2m; + y2 = y2m; + } + var intr = interHelper(bez1, bez2, justCount); + if (justCount) { + res += intr; + } else { + for (var k = 0, kk = intr.length; k < kk; k++) { + intr[k].segment1 = i; + intr[k].segment2 = j; + intr[k].bez1 = bez1; + intr[k].bez2 = bez2; + } + res = res.concat(intr); + } + } + } + } + } + return res; + } + /*\ + * Raphael.isPointInsidePath + [ method ] + ** + * Utility method + ** + * Returns `true` if given point is inside a given closed path. + > Parameters + - path (string) path string + - x (number) x of the point + - y (number) y of the point + = (boolean) true, if point is inside the path + \*/ + R.isPointInsidePath = function (path, x, y) { + var bbox = R.pathBBox(path); + return R.isPointInsideBBox(bbox, x, y) && + interPathHelper(path, [["M", x, y], ["H", bbox.x2 + 10]], 1) % 2 == 1; + }; + R._removedFactory = function (methodname) { + return function () { + eve("raphael.log", null, "Rapha\xebl: you are calling to method \u201c" + methodname + "\u201d of removed object", methodname); + }; + }; + /*\ + * Raphael.pathBBox + [ method ] + ** + * Utility method + ** + * Return bounding box of a given path + > Parameters + - path (string) path string + = (object) bounding box + o { + o x: (number) x coordinate of the left top point of the box + o y: (number) y coordinate of the left top point of the box + o x2: (number) x coordinate of the right bottom point of the box + o y2: (number) y coordinate of the right bottom point of the box + o width: (number) width of the box + o height: (number) height of the box + o cx: (number) x coordinate of the center of the box + o cy: (number) y coordinate of the center of the box + o } + \*/ + var pathDimensions = R.pathBBox = function (path) { + var pth = paths(path); + if (pth.bbox) { + return clone(pth.bbox); + } + if (!path) { + return {x: 0, y: 0, width: 0, height: 0, x2: 0, y2: 0}; + } + path = path2curve(path); + var x = 0, + y = 0, + X = [], + Y = [], + p; + for (var i = 0, ii = path.length; i < ii; i++) { + p = path[i]; + if (p[0] == "M") { + x = p[1]; + y = p[2]; + X.push(x); + Y.push(y); + } else { + var dim = curveDim(x, y, p[1], p[2], p[3], p[4], p[5], p[6]); + X = X[concat](dim.min.x, dim.max.x); + Y = Y[concat](dim.min.y, dim.max.y); + x = p[5]; + y = p[6]; + } + } + var xmin = mmin[apply](0, X), + ymin = mmin[apply](0, Y), + xmax = mmax[apply](0, X), + ymax = mmax[apply](0, Y), + width = xmax - xmin, + height = ymax - ymin, + bb = { + x: xmin, + y: ymin, + x2: xmax, + y2: ymax, + width: width, + height: height, + cx: xmin + width / 2, + cy: ymin + height / 2 + }; + pth.bbox = clone(bb); + return bb; + }, + pathClone = function (pathArray) { + var res = clone(pathArray); + res.toString = R._path2string; + return res; + }, + pathToRelative = R._pathToRelative = function (pathArray) { + var pth = paths(pathArray); + if (pth.rel) { + return pathClone(pth.rel); + } + if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption + pathArray = R.parsePathString(pathArray); + } + var res = [], + x = 0, + y = 0, + mx = 0, + my = 0, + start = 0; + if (pathArray[0][0] == "M") { + x = pathArray[0][1]; + y = pathArray[0][2]; + mx = x; + my = y; + start++; + res.push(["M", x, y]); + } + for (var i = start, ii = pathArray.length; i < ii; i++) { + var r = res[i] = [], + pa = pathArray[i]; + if (pa[0] != lowerCase.call(pa[0])) { + r[0] = lowerCase.call(pa[0]); + switch (r[0]) { + case "a": + r[1] = pa[1]; + r[2] = pa[2]; + r[3] = pa[3]; + r[4] = pa[4]; + r[5] = pa[5]; + r[6] = +(pa[6] - x).toFixed(3); + r[7] = +(pa[7] - y).toFixed(3); + break; + case "v": + r[1] = +(pa[1] - y).toFixed(3); + break; + case "m": + mx = pa[1]; + my = pa[2]; + default: + for (var j = 1, jj = pa.length; j < jj; j++) { + r[j] = +(pa[j] - ((j % 2) ? x : y)).toFixed(3); + } + } + } else { + r = res[i] = []; + if (pa[0] == "m") { + mx = pa[1] + x; + my = pa[2] + y; + } + for (var k = 0, kk = pa.length; k < kk; k++) { + res[i][k] = pa[k]; + } + } + var len = res[i].length; + switch (res[i][0]) { + case "z": + x = mx; + y = my; + break; + case "h": + x += +res[i][len - 1]; + break; + case "v": + y += +res[i][len - 1]; + break; + default: + x += +res[i][len - 2]; + y += +res[i][len - 1]; + } + } + res.toString = R._path2string; + pth.rel = pathClone(res); + return res; + }, + pathToAbsolute = R._pathToAbsolute = function (pathArray) { + var pth = paths(pathArray); + if (pth.abs) { + return pathClone(pth.abs); + } + if (!R.is(pathArray, array) || !R.is(pathArray && pathArray[0], array)) { // rough assumption + pathArray = R.parsePathString(pathArray); + } + if (!pathArray || !pathArray.length) { + return [["M", 0, 0]]; + } + var res = [], + x = 0, + y = 0, + mx = 0, + my = 0, + start = 0; + if (pathArray[0][0] == "M") { + x = +pathArray[0][1]; + y = +pathArray[0][2]; + mx = x; + my = y; + start++; + res[0] = ["M", x, y]; + } + var crz = pathArray.length == 3 && pathArray[0][0] == "M" && pathArray[1][0].toUpperCase() == "R" && pathArray[2][0].toUpperCase() == "Z"; + for (var r, pa, i = start, ii = pathArray.length; i < ii; i++) { + res.push(r = []); + pa = pathArray[i]; + if (pa[0] != upperCase.call(pa[0])) { + r[0] = upperCase.call(pa[0]); + switch (r[0]) { + case "A": + r[1] = pa[1]; + r[2] = pa[2]; + r[3] = pa[3]; + r[4] = pa[4]; + r[5] = pa[5]; + r[6] = +(pa[6] + x); + r[7] = +(pa[7] + y); + break; + case "V": + r[1] = +pa[1] + y; + break; + case "H": + r[1] = +pa[1] + x; + break; + case "R": + var dots = [x, y][concat](pa.slice(1)); + for (var j = 2, jj = dots.length; j < jj; j++) { + dots[j] = +dots[j] + x; + dots[++j] = +dots[j] + y; + } + res.pop(); + res = res[concat](catmullRom2bezier(dots, crz)); + break; + case "M": + mx = +pa[1] + x; + my = +pa[2] + y; + default: + for (j = 1, jj = pa.length; j < jj; j++) { + r[j] = +pa[j] + ((j % 2) ? x : y); + } + } + } else if (pa[0] == "R") { + dots = [x, y][concat](pa.slice(1)); + res.pop(); + res = res[concat](catmullRom2bezier(dots, crz)); + r = ["R"][concat](pa.slice(-2)); + } else { + for (var k = 0, kk = pa.length; k < kk; k++) { + r[k] = pa[k]; + } + } + switch (r[0]) { + case "Z": + x = mx; + y = my; + break; + case "H": + x = r[1]; + break; + case "V": + y = r[1]; + break; + case "M": + mx = r[r.length - 2]; + my = r[r.length - 1]; + default: + x = r[r.length - 2]; + y = r[r.length - 1]; + } + } + res.toString = R._path2string; + pth.abs = pathClone(res); + return res; + }, + l2c = function (x1, y1, x2, y2) { + return [x1, y1, x2, y2, x2, y2]; + }, + q2c = function (x1, y1, ax, ay, x2, y2) { + var _13 = 1 / 3, + _23 = 2 / 3; + return [ + _13 * x1 + _23 * ax, + _13 * y1 + _23 * ay, + _13 * x2 + _23 * ax, + _13 * y2 + _23 * ay, + x2, + y2 + ]; + }, + a2c = function (x1, y1, rx, ry, angle, large_arc_flag, sweep_flag, x2, y2, recursive) { + // for more information of where this math came from visit: + // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes + var _120 = PI * 120 / 180, + rad = PI / 180 * (+angle || 0), + res = [], + xy, + rotate = cacher(function (x, y, rad) { + var X = x * math.cos(rad) - y * math.sin(rad), + Y = x * math.sin(rad) + y * math.cos(rad); + return {x: X, y: Y}; + }); + if (!recursive) { + xy = rotate(x1, y1, -rad); + x1 = xy.x; + y1 = xy.y; + xy = rotate(x2, y2, -rad); + x2 = xy.x; + y2 = xy.y; + var cos = math.cos(PI / 180 * angle), + sin = math.sin(PI / 180 * angle), + x = (x1 - x2) / 2, + y = (y1 - y2) / 2; + var h = (x * x) / (rx * rx) + (y * y) / (ry * ry); + if (h > 1) { + h = math.sqrt(h); + rx = h * rx; + ry = h * ry; + } + var rx2 = rx * rx, + ry2 = ry * ry, + k = (large_arc_flag == sweep_flag ? -1 : 1) * + math.sqrt(abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x))), + cx = k * rx * y / ry + (x1 + x2) / 2, + cy = k * -ry * x / rx + (y1 + y2) / 2, + f1 = math.asin(((y1 - cy) / ry).toFixed(9)), + f2 = math.asin(((y2 - cy) / ry).toFixed(9)); + + f1 = x1 < cx ? PI - f1 : f1; + f2 = x2 < cx ? PI - f2 : f2; + f1 < 0 && (f1 = PI * 2 + f1); + f2 < 0 && (f2 = PI * 2 + f2); + if (sweep_flag && f1 > f2) { + f1 = f1 - PI * 2; + } + if (!sweep_flag && f2 > f1) { + f2 = f2 - PI * 2; + } + } else { + f1 = recursive[0]; + f2 = recursive[1]; + cx = recursive[2]; + cy = recursive[3]; + } + var df = f2 - f1; + if (abs(df) > _120) { + var f2old = f2, + x2old = x2, + y2old = y2; + f2 = f1 + _120 * (sweep_flag && f2 > f1 ? 1 : -1); + x2 = cx + rx * math.cos(f2); + y2 = cy + ry * math.sin(f2); + res = a2c(x2, y2, rx, ry, angle, 0, sweep_flag, x2old, y2old, [f2, f2old, cx, cy]); + } + df = f2 - f1; + var c1 = math.cos(f1), + s1 = math.sin(f1), + c2 = math.cos(f2), + s2 = math.sin(f2), + t = math.tan(df / 4), + hx = 4 / 3 * rx * t, + hy = 4 / 3 * ry * t, + m1 = [x1, y1], + m2 = [x1 + hx * s1, y1 - hy * c1], + m3 = [x2 + hx * s2, y2 - hy * c2], + m4 = [x2, y2]; + m2[0] = 2 * m1[0] - m2[0]; + m2[1] = 2 * m1[1] - m2[1]; + if (recursive) { + return [m2, m3, m4][concat](res); + } else { + res = [m2, m3, m4][concat](res).join()[split](","); + var newres = []; + for (var i = 0, ii = res.length; i < ii; i++) { + newres[i] = i % 2 ? rotate(res[i - 1], res[i], rad).y : rotate(res[i], res[i + 1], rad).x; + } + return newres; + } + }, + findDotAtSegment = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t) { + var t1 = 1 - t; + return { + x: pow(t1, 3) * p1x + pow(t1, 2) * 3 * t * c1x + t1 * 3 * t * t * c2x + pow(t, 3) * p2x, + y: pow(t1, 3) * p1y + pow(t1, 2) * 3 * t * c1y + t1 * 3 * t * t * c2y + pow(t, 3) * p2y + }; + }, + curveDim = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) { + var a = (c2x - 2 * c1x + p1x) - (p2x - 2 * c2x + c1x), + b = 2 * (c1x - p1x) - 2 * (c2x - c1x), + c = p1x - c1x, + t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a, + t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a, + y = [p1y, p2y], + x = [p1x, p2x], + dot; + abs(t1) > "1e12" && (t1 = .5); + abs(t2) > "1e12" && (t2 = .5); + if (t1 > 0 && t1 < 1) { + dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1); + x.push(dot.x); + y.push(dot.y); + } + if (t2 > 0 && t2 < 1) { + dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2); + x.push(dot.x); + y.push(dot.y); + } + a = (c2y - 2 * c1y + p1y) - (p2y - 2 * c2y + c1y); + b = 2 * (c1y - p1y) - 2 * (c2y - c1y); + c = p1y - c1y; + t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a; + t2 = (-b - math.sqrt(b * b - 4 * a * c)) / 2 / a; + abs(t1) > "1e12" && (t1 = .5); + abs(t2) > "1e12" && (t2 = .5); + if (t1 > 0 && t1 < 1) { + dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t1); + x.push(dot.x); + y.push(dot.y); + } + if (t2 > 0 && t2 < 1) { + dot = findDotAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, t2); + x.push(dot.x); + y.push(dot.y); + } + return { + min: {x: mmin[apply](0, x), y: mmin[apply](0, y)}, + max: {x: mmax[apply](0, x), y: mmax[apply](0, y)} + }; + }), + path2curve = R._path2curve = cacher(function (path, path2) { + var pth = !path2 && paths(path); + if (!path2 && pth.curve) { + return pathClone(pth.curve); + } + var p = pathToAbsolute(path), + p2 = path2 && pathToAbsolute(path2), + attrs = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null}, + attrs2 = {x: 0, y: 0, bx: 0, by: 0, X: 0, Y: 0, qx: null, qy: null}, + processPath = function (path, d, pcom) { + var nx, ny, tq = {T:1, Q:1}; + if (!path) { + return ["C", d.x, d.y, d.x, d.y, d.x, d.y]; + } + !(path[0] in tq) && (d.qx = d.qy = null); + switch (path[0]) { + case "M": + d.X = path[1]; + d.Y = path[2]; + break; + case "A": + path = ["C"][concat](a2c[apply](0, [d.x, d.y][concat](path.slice(1)))); + break; + case "S": + if (pcom == "C" || pcom == "S") { // In "S" case we have to take into account, if the previous command is C/S. + nx = d.x * 2 - d.bx; // And reflect the previous + ny = d.y * 2 - d.by; // command's control point relative to the current point. + } + else { // or some else or nothing + nx = d.x; + ny = d.y; + } + path = ["C", nx, ny][concat](path.slice(1)); + break; + case "T": + if (pcom == "Q" || pcom == "T") { // In "T" case we have to take into account, if the previous command is Q/T. + d.qx = d.x * 2 - d.qx; // And make a reflection similar + d.qy = d.y * 2 - d.qy; // to case "S". + } + else { // or something else or nothing + d.qx = d.x; + d.qy = d.y; + } + path = ["C"][concat](q2c(d.x, d.y, d.qx, d.qy, path[1], path[2])); + break; + case "Q": + d.qx = path[1]; + d.qy = path[2]; + path = ["C"][concat](q2c(d.x, d.y, path[1], path[2], path[3], path[4])); + break; + case "L": + path = ["C"][concat](l2c(d.x, d.y, path[1], path[2])); + break; + case "H": + path = ["C"][concat](l2c(d.x, d.y, path[1], d.y)); + break; + case "V": + path = ["C"][concat](l2c(d.x, d.y, d.x, path[1])); + break; + case "Z": + path = ["C"][concat](l2c(d.x, d.y, d.X, d.Y)); + break; + } + return path; + }, + fixArc = function (pp, i) { + if (pp[i].length > 7) { + pp[i].shift(); + var pi = pp[i]; + while (pi.length) { + pcoms1[i]="A"; // if created multiple C:s, their original seg is saved + p2 && (pcoms2[i]="A"); // the same as above + pp.splice(i++, 0, ["C"][concat](pi.splice(0, 6))); + } + pp.splice(i, 1); + ii = mmax(p.length, p2 && p2.length || 0); + } + }, + fixM = function (path1, path2, a1, a2, i) { + if (path1 && path2 && path1[i][0] == "M" && path2[i][0] != "M") { + path2.splice(i, 0, ["M", a2.x, a2.y]); + a1.bx = 0; + a1.by = 0; + a1.x = path1[i][1]; + a1.y = path1[i][2]; + ii = mmax(p.length, p2 && p2.length || 0); + } + }, + pcoms1 = [], // path commands of original path p + pcoms2 = [], // path commands of original path p2 + pfirst = "", // temporary holder for original path command + pcom = ""; // holder for previous path command of original path + for (var i = 0, ii = mmax(p.length, p2 && p2.length || 0); i < ii; i++) { + p[i] && (pfirst = p[i][0]); // save current path command + + if (pfirst != "C") // C is not saved yet, because it may be result of conversion + { + pcoms1[i] = pfirst; // Save current path command + i && ( pcom = pcoms1[i-1]); // Get previous path command pcom + } + p[i] = processPath(p[i], attrs, pcom); // Previous path command is inputted to processPath + + if (pcoms1[i] != "A" && pfirst == "C") pcoms1[i] = "C"; // A is the only command + // which may produce multiple C:s + // so we have to make sure that C is also C in original path + + fixArc(p, i); // fixArc adds also the right amount of A:s to pcoms1 + + if (p2) { // the same procedures is done to p2 + p2[i] && (pfirst = p2[i][0]); + if (pfirst != "C") + { + pcoms2[i] = pfirst; + i && (pcom = pcoms2[i-1]); + } + p2[i] = processPath(p2[i], attrs2, pcom); + + if (pcoms2[i]!="A" && pfirst=="C") pcoms2[i]="C"; + + fixArc(p2, i); + } + fixM(p, p2, attrs, attrs2, i); + fixM(p2, p, attrs2, attrs, i); + var seg = p[i], + seg2 = p2 && p2[i], + seglen = seg.length, + seg2len = p2 && seg2.length; + attrs.x = seg[seglen - 2]; + attrs.y = seg[seglen - 1]; + attrs.bx = toFloat(seg[seglen - 4]) || attrs.x; + attrs.by = toFloat(seg[seglen - 3]) || attrs.y; + attrs2.bx = p2 && (toFloat(seg2[seg2len - 4]) || attrs2.x); + attrs2.by = p2 && (toFloat(seg2[seg2len - 3]) || attrs2.y); + attrs2.x = p2 && seg2[seg2len - 2]; + attrs2.y = p2 && seg2[seg2len - 1]; + } + if (!p2) { + pth.curve = pathClone(p); + } + return p2 ? [p, p2] : p; + }, null, pathClone), + parseDots = R._parseDots = cacher(function (gradient) { + var dots = []; + for (var i = 0, ii = gradient.length; i < ii; i++) { + var dot = {}, + par = gradient[i].match(/^([^:]*):?([\d\.]*)/); + dot.color = R.getRGB(par[1]); + if (dot.color.error) { + return null; + } + dot.opacity = dot.color.opacity; + dot.color = dot.color.hex; + par[2] && (dot.offset = par[2] + "%"); + dots.push(dot); + } + for (i = 1, ii = dots.length - 1; i < ii; i++) { + if (!dots[i].offset) { + var start = toFloat(dots[i - 1].offset || 0), + end = 0; + for (var j = i + 1; j < ii; j++) { + if (dots[j].offset) { + end = dots[j].offset; + break; + } + } + if (!end) { + end = 100; + j = ii; + } + end = toFloat(end); + var d = (end - start) / (j - i + 1); + for (; i < j; i++) { + start += d; + dots[i].offset = start + "%"; + } + } + } + return dots; + }), + tear = R._tear = function (el, paper) { + el == paper.top && (paper.top = el.prev); + el == paper.bottom && (paper.bottom = el.next); + el.next && (el.next.prev = el.prev); + el.prev && (el.prev.next = el.next); + }, + tofront = R._tofront = function (el, paper) { + if (paper.top === el) { + return; + } + tear(el, paper); + el.next = null; + el.prev = paper.top; + paper.top.next = el; + paper.top = el; + }, + toback = R._toback = function (el, paper) { + if (paper.bottom === el) { + return; + } + tear(el, paper); + el.next = paper.bottom; + el.prev = null; + paper.bottom.prev = el; + paper.bottom = el; + }, + insertafter = R._insertafter = function (el, el2, paper) { + tear(el, paper); + el2 == paper.top && (paper.top = el); + el2.next && (el2.next.prev = el); + el.next = el2.next; + el.prev = el2; + el2.next = el; + }, + insertbefore = R._insertbefore = function (el, el2, paper) { + tear(el, paper); + el2 == paper.bottom && (paper.bottom = el); + el2.prev && (el2.prev.next = el); + el.prev = el2.prev; + el2.prev = el; + el.next = el2; + }, + /*\ + * Raphael.toMatrix + [ method ] + ** + * Utility method + ** + * Returns matrix of transformations applied to a given path + > Parameters + - path (string) path string + - transform (string|array) transformation string + = (object) @Matrix + \*/ + toMatrix = R.toMatrix = function (path, transform) { + var bb = pathDimensions(path), + el = { + _: { + transform: E + }, + getBBox: function () { + return bb; + } + }; + extractTransform(el, transform); + return el.matrix; + }, + /*\ + * Raphael.transformPath + [ method ] + ** + * Utility method + ** + * Returns path transformed by a given transformation + > Parameters + - path (string) path string + - transform (string|array) transformation string + = (string) path + \*/ + transformPath = R.transformPath = function (path, transform) { + return mapPath(path, toMatrix(path, transform)); + }, + extractTransform = R._extractTransform = function (el, tstr) { + if (tstr == null) { + return el._.transform; + } + tstr = Str(tstr).replace(/\.{3}|\u2026/g, el._.transform || E); + var tdata = R.parseTransformString(tstr), + deg = 0, + dx = 0, + dy = 0, + sx = 1, + sy = 1, + _ = el._, + m = new Matrix; + _.transform = tdata || []; + if (tdata) { + for (var i = 0, ii = tdata.length; i < ii; i++) { + var t = tdata[i], + tlen = t.length, + command = Str(t[0]).toLowerCase(), + absolute = t[0] != command, + inver = absolute ? m.invert() : 0, + x1, + y1, + x2, + y2, + bb; + if (command == "t" && tlen == 3) { + if (absolute) { + x1 = inver.x(0, 0); + y1 = inver.y(0, 0); + x2 = inver.x(t[1], t[2]); + y2 = inver.y(t[1], t[2]); + m.translate(x2 - x1, y2 - y1); + } else { + m.translate(t[1], t[2]); + } + } else if (command == "r") { + if (tlen == 2) { + bb = bb || el.getBBox(1); + m.rotate(t[1], bb.x + bb.width / 2, bb.y + bb.height / 2); + deg += t[1]; + } else if (tlen == 4) { + if (absolute) { + x2 = inver.x(t[2], t[3]); + y2 = inver.y(t[2], t[3]); + m.rotate(t[1], x2, y2); + } else { + m.rotate(t[1], t[2], t[3]); + } + deg += t[1]; + } + } else if (command == "s") { + if (tlen == 2 || tlen == 3) { + bb = bb || el.getBBox(1); + m.scale(t[1], t[tlen - 1], bb.x + bb.width / 2, bb.y + bb.height / 2); + sx *= t[1]; + sy *= t[tlen - 1]; + } else if (tlen == 5) { + if (absolute) { + x2 = inver.x(t[3], t[4]); + y2 = inver.y(t[3], t[4]); + m.scale(t[1], t[2], x2, y2); + } else { + m.scale(t[1], t[2], t[3], t[4]); + } + sx *= t[1]; + sy *= t[2]; + } + } else if (command == "m" && tlen == 7) { + m.add(t[1], t[2], t[3], t[4], t[5], t[6]); + } + _.dirtyT = 1; + el.matrix = m; + } + } + + /*\ + * Element.matrix + [ property (object) ] + ** + * Keeps @Matrix object, which represents element transformation + \*/ + el.matrix = m; + + _.sx = sx; + _.sy = sy; + _.deg = deg; + _.dx = dx = m.e; + _.dy = dy = m.f; + + if (sx == 1 && sy == 1 && !deg && _.bbox) { + _.bbox.x += +dx; + _.bbox.y += +dy; + } else { + _.dirtyT = 1; + } + }, + getEmpty = function (item) { + var l = item[0]; + switch (l.toLowerCase()) { + case "t": return [l, 0, 0]; + case "m": return [l, 1, 0, 0, 1, 0, 0]; + case "r": if (item.length == 4) { + return [l, 0, item[2], item[3]]; + } else { + return [l, 0]; + } + case "s": if (item.length == 5) { + return [l, 1, 1, item[3], item[4]]; + } else if (item.length == 3) { + return [l, 1, 1]; + } else { + return [l, 1]; + } + } + }, + equaliseTransform = R._equaliseTransform = function (t1, t2) { + t2 = Str(t2).replace(/\.{3}|\u2026/g, t1); + t1 = R.parseTransformString(t1) || []; + t2 = R.parseTransformString(t2) || []; + var maxlength = mmax(t1.length, t2.length), + from = [], + to = [], + i = 0, j, jj, + tt1, tt2; + for (; i < maxlength; i++) { + tt1 = t1[i] || getEmpty(t2[i]); + tt2 = t2[i] || getEmpty(tt1); + if ((tt1[0] != tt2[0]) || + (tt1[0].toLowerCase() == "r" && (tt1[2] != tt2[2] || tt1[3] != tt2[3])) || + (tt1[0].toLowerCase() == "s" && (tt1[3] != tt2[3] || tt1[4] != tt2[4])) + ) { + return; + } + from[i] = []; + to[i] = []; + for (j = 0, jj = mmax(tt1.length, tt2.length); j < jj; j++) { + j in tt1 && (from[i][j] = tt1[j]); + j in tt2 && (to[i][j] = tt2[j]); + } + } + return { + from: from, + to: to + }; + }; + R._getContainer = function (x, y, w, h) { + var container; + container = h == null && !R.is(x, "object") ? g.doc.getElementById(x) : x; + if (container == null) { + return; + } + if (container.tagName) { + if (y == null) { + return { + container: container, + width: container.style.pixelWidth || container.offsetWidth, + height: container.style.pixelHeight || container.offsetHeight + }; + } else { + return { + container: container, + width: y, + height: w + }; + } + } + return { + container: 1, + x: x, + y: y, + width: w, + height: h + }; + }; + /*\ + * Raphael.pathToRelative + [ method ] + ** + * Utility method + ** + * Converts path to relative form + > Parameters + - pathString (string|array) path string or array of segments + = (array) array of segments. + \*/ + R.pathToRelative = pathToRelative; + R._engine = {}; + /*\ + * Raphael.path2curve + [ method ] + ** + * Utility method + ** + * Converts path to a new path where all segments are cubic bezier curves. + > Parameters + - pathString (string|array) path string or array of segments + = (array) array of segments. + \*/ + R.path2curve = path2curve; + /*\ + * Raphael.matrix + [ method ] + ** + * Utility method + ** + * Returns matrix based on given parameters. + > Parameters + - a (number) + - b (number) + - c (number) + - d (number) + - e (number) + - f (number) + = (object) @Matrix + \*/ + R.matrix = function (a, b, c, d, e, f) { + return new Matrix(a, b, c, d, e, f); + }; + function Matrix(a, b, c, d, e, f) { + if (a != null) { + this.a = +a; + this.b = +b; + this.c = +c; + this.d = +d; + this.e = +e; + this.f = +f; + } else { + this.a = 1; + this.b = 0; + this.c = 0; + this.d = 1; + this.e = 0; + this.f = 0; + } + } + (function (matrixproto) { + /*\ + * Matrix.add + [ method ] + ** + * Adds given matrix to existing one. + > Parameters + - a (number) + - b (number) + - c (number) + - d (number) + - e (number) + - f (number) + or + - matrix (object) @Matrix + \*/ + matrixproto.add = function (a, b, c, d, e, f) { + var out = [[], [], []], + m = [[this.a, this.c, this.e], [this.b, this.d, this.f], [0, 0, 1]], + matrix = [[a, c, e], [b, d, f], [0, 0, 1]], + x, y, z, res; + + if (a && a instanceof Matrix) { + matrix = [[a.a, a.c, a.e], [a.b, a.d, a.f], [0, 0, 1]]; + } + + for (x = 0; x < 3; x++) { + for (y = 0; y < 3; y++) { + res = 0; + for (z = 0; z < 3; z++) { + res += m[x][z] * matrix[z][y]; + } + out[x][y] = res; + } + } + this.a = out[0][0]; + this.b = out[1][0]; + this.c = out[0][1]; + this.d = out[1][1]; + this.e = out[0][2]; + this.f = out[1][2]; + }; + /*\ + * Matrix.invert + [ method ] + ** + * Returns inverted version of the matrix + = (object) @Matrix + \*/ + matrixproto.invert = function () { + var me = this, + x = me.a * me.d - me.b * me.c; + return new Matrix(me.d / x, -me.b / x, -me.c / x, me.a / x, (me.c * me.f - me.d * me.e) / x, (me.b * me.e - me.a * me.f) / x); + }; + /*\ + * Matrix.clone + [ method ] + ** + * Returns copy of the matrix + = (object) @Matrix + \*/ + matrixproto.clone = function () { + return new Matrix(this.a, this.b, this.c, this.d, this.e, this.f); + }; + /*\ + * Matrix.translate + [ method ] + ** + * Translate the matrix + > Parameters + - x (number) + - y (number) + \*/ + matrixproto.translate = function (x, y) { + this.add(1, 0, 0, 1, x, y); + }; + /*\ + * Matrix.scale + [ method ] + ** + * Scales the matrix + > Parameters + - x (number) + - y (number) #optional + - cx (number) #optional + - cy (number) #optional + \*/ + matrixproto.scale = function (x, y, cx, cy) { + y == null && (y = x); + (cx || cy) && this.add(1, 0, 0, 1, cx, cy); + this.add(x, 0, 0, y, 0, 0); + (cx || cy) && this.add(1, 0, 0, 1, -cx, -cy); + }; + /*\ + * Matrix.rotate + [ method ] + ** + * Rotates the matrix + > Parameters + - a (number) + - x (number) + - y (number) + \*/ + matrixproto.rotate = function (a, x, y) { + a = R.rad(a); + x = x || 0; + y = y || 0; + var cos = +math.cos(a).toFixed(9), + sin = +math.sin(a).toFixed(9); + this.add(cos, sin, -sin, cos, x, y); + this.add(1, 0, 0, 1, -x, -y); + }; + /*\ + * Matrix.x + [ method ] + ** + * Return x coordinate for given point after transformation described by the matrix. See also @Matrix.y + > Parameters + - x (number) + - y (number) + = (number) x + \*/ + matrixproto.x = function (x, y) { + return x * this.a + y * this.c + this.e; + }; + /*\ + * Matrix.y + [ method ] + ** + * Return y coordinate for given point after transformation described by the matrix. See also @Matrix.x + > Parameters + - x (number) + - y (number) + = (number) y + \*/ + matrixproto.y = function (x, y) { + return x * this.b + y * this.d + this.f; + }; + matrixproto.get = function (i) { + return +this[Str.fromCharCode(97 + i)].toFixed(4); + }; + matrixproto.toString = function () { + return R.svg ? + "matrix(" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)].join() + ")" : + [this.get(0), this.get(2), this.get(1), this.get(3), 0, 0].join(); + }; + matrixproto.toFilter = function () { + return "progid:DXImageTransform.Microsoft.Matrix(M11=" + this.get(0) + + ", M12=" + this.get(2) + ", M21=" + this.get(1) + ", M22=" + this.get(3) + + ", Dx=" + this.get(4) + ", Dy=" + this.get(5) + ", sizingmethod='auto expand')"; + }; + matrixproto.offset = function () { + return [this.e.toFixed(4), this.f.toFixed(4)]; + }; + function norm(a) { + return a[0] * a[0] + a[1] * a[1]; + } + function normalize(a) { + var mag = math.sqrt(norm(a)); + a[0] && (a[0] /= mag); + a[1] && (a[1] /= mag); + } + /*\ + * Matrix.split + [ method ] + ** + * Splits matrix into primitive transformations + = (object) in format: + o dx (number) translation by x + o dy (number) translation by y + o scalex (number) scale by x + o scaley (number) scale by y + o shear (number) shear + o rotate (number) rotation in deg + o isSimple (boolean) could it be represented via simple transformations + \*/ + matrixproto.split = function () { + var out = {}; + // translation + out.dx = this.e; + out.dy = this.f; + + // scale and shear + var row = [[this.a, this.c], [this.b, this.d]]; + out.scalex = math.sqrt(norm(row[0])); + normalize(row[0]); + + out.shear = row[0][0] * row[1][0] + row[0][1] * row[1][1]; + row[1] = [row[1][0] - row[0][0] * out.shear, row[1][1] - row[0][1] * out.shear]; + + out.scaley = math.sqrt(norm(row[1])); + normalize(row[1]); + out.shear /= out.scaley; + + // rotation + var sin = -row[0][1], + cos = row[1][1]; + if (cos < 0) { + out.rotate = R.deg(math.acos(cos)); + if (sin < 0) { + out.rotate = 360 - out.rotate; + } + } else { + out.rotate = R.deg(math.asin(sin)); + } + + out.isSimple = !+out.shear.toFixed(9) && (out.scalex.toFixed(9) == out.scaley.toFixed(9) || !out.rotate); + out.isSuperSimple = !+out.shear.toFixed(9) && out.scalex.toFixed(9) == out.scaley.toFixed(9) && !out.rotate; + out.noRotation = !+out.shear.toFixed(9) && !out.rotate; + return out; + }; + /*\ + * Matrix.toTransformString + [ method ] + ** + * Return transform string that represents given matrix + = (string) transform string + \*/ + matrixproto.toTransformString = function (shorter) { + var s = shorter || this[split](); + if (s.isSimple) { + s.scalex = +s.scalex.toFixed(4); + s.scaley = +s.scaley.toFixed(4); + s.rotate = +s.rotate.toFixed(4); + return (s.dx || s.dy ? "t" + [s.dx, s.dy] : E) + + (s.scalex != 1 || s.scaley != 1 ? "s" + [s.scalex, s.scaley, 0, 0] : E) + + (s.rotate ? "r" + [s.rotate, 0, 0] : E); + } else { + return "m" + [this.get(0), this.get(1), this.get(2), this.get(3), this.get(4), this.get(5)]; + } + }; + })(Matrix.prototype); + + var preventDefault = function () { + this.returnValue = false; + }, + preventTouch = function () { + return this.originalEvent.preventDefault(); + }, + stopPropagation = function () { + this.cancelBubble = true; + }, + stopTouch = function () { + return this.originalEvent.stopPropagation(); + }, + getEventPosition = function (e) { + var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop, + scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft; + + return { + x: e.clientX + scrollX, + y: e.clientY + scrollY + }; + }, + addEvent = (function () { + if (g.doc.addEventListener) { + return function (obj, type, fn, element) { + var f = function (e) { + var pos = getEventPosition(e); + return fn.call(element, e, pos.x, pos.y); + }; + obj.addEventListener(type, f, false); + + if (supportsTouch && touchMap[type]) { + var _f = function (e) { + var pos = getEventPosition(e), + olde = e; + + for (var i = 0, ii = e.targetTouches && e.targetTouches.length; i < ii; i++) { + if (e.targetTouches[i].target == obj) { + e = e.targetTouches[i]; + e.originalEvent = olde; + e.preventDefault = preventTouch; + e.stopPropagation = stopTouch; + break; + } + } + + return fn.call(element, e, pos.x, pos.y); + }; + obj.addEventListener(touchMap[type], _f, false); + } + + return function () { + obj.removeEventListener(type, f, false); + + if (supportsTouch && touchMap[type]) + obj.removeEventListener(touchMap[type], _f, false); + + return true; + }; + }; + } else if (g.doc.attachEvent) { + return function (obj, type, fn, element) { + var f = function (e) { + e = e || g.win.event; + var scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop, + scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft, + x = e.clientX + scrollX, + y = e.clientY + scrollY; + e.preventDefault = e.preventDefault || preventDefault; + e.stopPropagation = e.stopPropagation || stopPropagation; + return fn.call(element, e, x, y); + }; + obj.attachEvent("on" + type, f); + var detacher = function () { + obj.detachEvent("on" + type, f); + return true; + }; + return detacher; + }; + } + })(), + drag = [], + dragMove = function (e) { + var x = e.clientX, + y = e.clientY, + scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop, + scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft, + dragi, + j = drag.length; + while (j--) { + dragi = drag[j]; + if (supportsTouch && e.touches) { + var i = e.touches.length, + touch; + while (i--) { + touch = e.touches[i]; + if (touch.identifier == dragi.el._drag.id) { + x = touch.clientX; + y = touch.clientY; + (e.originalEvent ? e.originalEvent : e).preventDefault(); + break; + } + } + } else { + e.preventDefault(); + } + var node = dragi.el.node, + o, + next = node.nextSibling, + parent = node.parentNode, + display = node.style.display; + g.win.opera && parent.removeChild(node); + node.style.display = "none"; + o = dragi.el.paper.getElementByPoint(x, y); + node.style.display = display; + g.win.opera && (next ? parent.insertBefore(node, next) : parent.appendChild(node)); + o && eve("raphael.drag.over." + dragi.el.id, dragi.el, o); + x += scrollX; + y += scrollY; + eve("raphael.drag.move." + dragi.el.id, dragi.move_scope || dragi.el, x - dragi.el._drag.x, y - dragi.el._drag.y, x, y, e); + } + }, + dragUp = function (e) { + R.unmousemove(dragMove).unmouseup(dragUp); + var i = drag.length, + dragi; + while (i--) { + dragi = drag[i]; + dragi.el._drag = {}; + eve("raphael.drag.end." + dragi.el.id, dragi.end_scope || dragi.start_scope || dragi.move_scope || dragi.el, e); + } + drag = []; + }, + /*\ + * Raphael.el + [ property (object) ] + ** + * You can add your own method to elements. This is usefull when you want to hack default functionality or + * want to wrap some common transformation or attributes in one method. In difference to canvas methods, + * you can redefine element method at any time. Expending element methods wouldn’t affect set. + > Usage + | Raphael.el.red = function () { + | this.attr({fill: "#f00"}); + | }; + | // then use it + | paper.circle(100, 100, 20).red(); + \*/ + elproto = R.el = {}; + /*\ + * Element.click + [ method ] + ** + * Adds event handler for click for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.unclick + [ method ] + ** + * Removes event handler for click for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + + /*\ + * Element.dblclick + [ method ] + ** + * Adds event handler for double click for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.undblclick + [ method ] + ** + * Removes event handler for double click for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + + /*\ + * Element.mousedown + [ method ] + ** + * Adds event handler for mousedown for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.unmousedown + [ method ] + ** + * Removes event handler for mousedown for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + + /*\ + * Element.mousemove + [ method ] + ** + * Adds event handler for mousemove for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.unmousemove + [ method ] + ** + * Removes event handler for mousemove for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + + /*\ + * Element.mouseout + [ method ] + ** + * Adds event handler for mouseout for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.unmouseout + [ method ] + ** + * Removes event handler for mouseout for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + + /*\ + * Element.mouseover + [ method ] + ** + * Adds event handler for mouseover for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.unmouseover + [ method ] + ** + * Removes event handler for mouseover for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + + /*\ + * Element.mouseup + [ method ] + ** + * Adds event handler for mouseup for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.unmouseup + [ method ] + ** + * Removes event handler for mouseup for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + + /*\ + * Element.touchstart + [ method ] + ** + * Adds event handler for touchstart for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.untouchstart + [ method ] + ** + * Removes event handler for touchstart for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + + /*\ + * Element.touchmove + [ method ] + ** + * Adds event handler for touchmove for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.untouchmove + [ method ] + ** + * Removes event handler for touchmove for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + + /*\ + * Element.touchend + [ method ] + ** + * Adds event handler for touchend for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.untouchend + [ method ] + ** + * Removes event handler for touchend for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + + /*\ + * Element.touchcancel + [ method ] + ** + * Adds event handler for touchcancel for the element. + > Parameters + - handler (function) handler for the event + = (object) @Element + \*/ + /*\ + * Element.untouchcancel + [ method ] + ** + * Removes event handler for touchcancel for the element. + > Parameters + - handler (function) #optional handler for the event + = (object) @Element + \*/ + for (var i = events.length; i--;) { + (function (eventName) { + R[eventName] = elproto[eventName] = function (fn, scope) { + if (R.is(fn, "function")) { + this.events = this.events || []; + this.events.push({name: eventName, f: fn, unbind: addEvent(this.shape || this.node || g.doc, eventName, fn, scope || this)}); + } + return this; + }; + R["un" + eventName] = elproto["un" + eventName] = function (fn) { + var events = this.events || [], + l = events.length; + while (l--){ + if (events[l].name == eventName && (R.is(fn, "undefined") || events[l].f == fn)) { + events[l].unbind(); + events.splice(l, 1); + !events.length && delete this.events; + } + } + return this; + }; + })(events[i]); + } + + /*\ + * Element.data + [ method ] + ** + * Adds or retrieves given value asociated with given key. + ** + * See also @Element.removeData + > Parameters + - key (string) key to store data + - value (any) #optional value to store + = (object) @Element + * or, if value is not specified: + = (any) value + * or, if key and value are not specified: + = (object) Key/value pairs for all the data associated with the element. + > Usage + | for (var i = 0, i < 5, i++) { + | paper.circle(10 + 15 * i, 10, 10) + | .attr({fill: "#000"}) + | .data("i", i) + | .click(function () { + | alert(this.data("i")); + | }); + | } + \*/ + elproto.data = function (key, value) { + var data = eldata[this.id] = eldata[this.id] || {}; + if (arguments.length == 0) { + return data; + } + if (arguments.length == 1) { + if (R.is(key, "object")) { + for (var i in key) if (key[has](i)) { + this.data(i, key[i]); + } + return this; + } + eve("raphael.data.get." + this.id, this, data[key], key); + return data[key]; + } + data[key] = value; + eve("raphael.data.set." + this.id, this, value, key); + return this; + }; + + elproto.datum = function(){ + return arguments.length == 0 ? this._bindData : ((this._bindData = arguments[0]), this); + }; + + /*\ + * Element.removeData + [ method ] + ** + * Removes value associated with an element by given key. + * If key is not provided, removes all the data of the element. + > Parameters + - key (string) #optional key + = (object) @Element + \*/ + elproto.removeData = function (key) { + if (key == null) { + eldata[this.id] = {}; + } else { + eldata[this.id] && delete eldata[this.id][key]; + } + return this; + }; + /*\ + * Element.getData + [ method ] + ** + * Retrieves the element data + = (object) data + \*/ + elproto.getData = function () { + return clone(eldata[this.id] || {}); + }; + /*\ + * Element.hover + [ method ] + ** + * Adds event handlers for hover for the element. + > Parameters + - f_in (function) handler for hover in + - f_out (function) handler for hover out + - icontext (object) #optional context for hover in handler + - ocontext (object) #optional context for hover out handler + = (object) @Element + \*/ + elproto.hover = function (f_in, f_out, scope_in, scope_out) { + return this.mouseover(f_in, scope_in).mouseout(f_out, scope_out || scope_in); + }; + /*\ + * Element.unhover + [ method ] + ** + * Removes event handlers for hover for the element. + > Parameters + - f_in (function) handler for hover in + - f_out (function) handler for hover out + = (object) @Element + \*/ + elproto.unhover = function (f_in, f_out) { + return this.unmouseover(f_in).unmouseout(f_out); + }; + var draggable = []; + /*\ + * Element.drag + [ method ] + ** + * Adds event handlers for drag of the element. + > Parameters + - onmove (function) handler for moving + - onstart (function) handler for drag start + - onend (function) handler for drag end + - mcontext (object) #optional context for moving handler + - scontext (object) #optional context for drag start handler + - econtext (object) #optional context for drag end handler + * Additionaly following `drag` events will be triggered: `drag.start.` on start, + * `drag.end.` on end and `drag.move.` on every move. When element will be dragged over another element + * `drag.over.` will be fired as well. + * + * Start event and start handler will be called in specified context or in context of the element with following parameters: + o x (number) x position of the mouse + o y (number) y position of the mouse + o event (object) DOM event object + * Move event and move handler will be called in specified context or in context of the element with following parameters: + o dx (number) shift by x from the start point + o dy (number) shift by y from the start point + o x (number) x position of the mouse + o y (number) y position of the mouse + o event (object) DOM event object + * End event and end handler will be called in specified context or in context of the element with following parameters: + o event (object) DOM event object + = (object) @Element + \*/ + elproto.drag = function (onmove, onstart, onend, move_scope, start_scope, end_scope) { + function start(e) { + (e.originalEvent || e).preventDefault(); + var x = e.clientX, + y = e.clientY, + scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop, + scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft; + this._drag.id = e.identifier; + if (supportsTouch && e.touches) { + var i = e.touches.length, touch; + while (i--) { + touch = e.touches[i]; + this._drag.id = touch.identifier; + if (touch.identifier == this._drag.id) { + x = touch.clientX; + y = touch.clientY; + break; + } + } + } + this._drag.x = x + scrollX; + this._drag.y = y + scrollY; + !drag.length && R.mousemove(dragMove).mouseup(dragUp); + drag.push({el: this, move_scope: move_scope, start_scope: start_scope, end_scope: end_scope}); + onstart && eve.on("raphael.drag.start." + this.id, onstart); + onmove && eve.on("raphael.drag.move." + this.id, onmove); + onend && eve.on("raphael.drag.end." + this.id, onend); + eve("raphael.drag.start." + this.id, start_scope || move_scope || this, e.clientX + scrollX, e.clientY + scrollY, e); + } + this._drag = {}; + draggable.push({el: this, start: start}); + this.mousedown(start); + return this; + }; + /*\ + * Element.onDragOver + [ method ] + ** + * Shortcut for assigning event handler for `drag.over.` event, where id is id of the element (see @Element.id). + > Parameters + - f (function) handler for event, first argument would be the element you are dragging over + \*/ + elproto.onDragOver = function (f) { + f ? eve.on("raphael.drag.over." + this.id, f) : eve.unbind("raphael.drag.over." + this.id); + }; + /*\ + * Element.undrag + [ method ] + ** + * Removes all drag event handlers from given element. + \*/ + elproto.undrag = function () { + var i = draggable.length; + while (i--) if (draggable[i].el == this) { + this.unmousedown(draggable[i].start); + draggable.splice(i, 1); + eve.unbind("raphael.drag.*." + this.id); + } + !draggable.length && R.unmousemove(dragMove).unmouseup(dragUp); + drag = []; + }; + /*\ + * Paper.circle + [ method ] + ** + * Draws a circle. + ** + > Parameters + ** + - x (number) x coordinate of the centre + - y (number) y coordinate of the centre + - r (number) radius + = (object) Raphaël element object with type “circle” + ** + > Usage + | var c = paper.circle(50, 50, 40); + \*/ + paperproto.circle = function (x, y, r) { + var out = R._engine.circle(this, x || 0, y || 0, r || 0); + this.__set__ && this.__set__.push(out); + return out; + }; + /*\ + * Paper.rect + [ method ] + * + * Draws a rectangle. + ** + > Parameters + ** + - x (number) x coordinate of the top left corner + - y (number) y coordinate of the top left corner + - width (number) width + - height (number) height + - r (number) #optional radius for rounded corners, default is 0 + = (object) Raphaël element object with type “rect” + ** + > Usage + | // regular rectangle + | var c = paper.rect(10, 10, 50, 50); + | // rectangle with rounded corners + | var c = paper.rect(40, 40, 50, 50, 10); + \*/ + paperproto.rect = function (x, y, w, h, r) { + var out = R._engine.rect(this, x || 0, y || 0, w || 0, h || 0, r || 0); + this.__set__ && this.__set__.push(out); + return out; + }; + /*\ + * Paper.ellipse + [ method ] + ** + * Draws an ellipse. + ** + > Parameters + ** + - x (number) x coordinate of the centre + - y (number) y coordinate of the centre + - rx (number) horizontal radius + - ry (number) vertical radius + = (object) Raphaël element object with type “ellipse” + ** + > Usage + | var c = paper.ellipse(50, 50, 40, 20); + \*/ + paperproto.ellipse = function (x, y, rx, ry) { + var out = R._engine.ellipse(this, x || 0, y || 0, rx || 0, ry || 0); + this.__set__ && this.__set__.push(out); + return out; + }; + /*\ + * Paper.path + [ method ] + ** + * Creates a path element by given path data string. + > Parameters + - pathString (string) #optional path string in SVG format. + * Path string consists of one-letter commands, followed by comma seprarated arguments in numercal form. Example: + | "M10,20L30,40" + * Here we can see two commands: “M”, with arguments `(10, 20)` and “L” with arguments `(30, 40)`. Upper case letter mean command is absolute, lower case—relative. + * + #

Here is short list of commands available, for more details see SVG path string format.

+ #
+ # + # + # + # + # + # + # + # + # + # + #
CommandNameParameters
Mmoveto(x y)+
Zclosepath(none)
Llineto(x y)+
Hhorizontal linetox+
Vvertical linetoy+
Ccurveto(x1 y1 x2 y2 x y)+
Ssmooth curveto(x2 y2 x y)+
Qquadratic Bézier curveto(x1 y1 x y)+
Tsmooth quadratic Bézier curveto(x y)+
Aelliptical arc(rx ry x-axis-rotation large-arc-flag sweep-flag x y)+
RCatmull-Rom curveto*x1 y1 (x y)+
+ * * “Catmull-Rom curveto” is a not standard SVG command and added in 2.0 to make life easier. + * Note: there is a special case when path consist of just three commands: “M10,10R…z”. In this case path will smoothly connects to its beginning. + > Usage + | var c = paper.path("M10 10L90 90"); + | // draw a diagonal line: + | // move to 10,10, line to 90,90 + * For example of path strings, check out these icons: http://raphaeljs.com/icons/ + \*/ + paperproto.path = function (pathString) { + pathString && !R.is(pathString, string) && !R.is(pathString[0], array) && (pathString += E); + var out = R._engine.path(R.format[apply](R, arguments), this); + this.__set__ && this.__set__.push(out); + return out; + }; + /*\ + * Paper.image + [ method ] + ** + * Embeds an image into the surface. + ** + > Parameters + ** + - src (string) URI of the source image + - x (number) x coordinate position + - y (number) y coordinate position + - width (number) width of the image + - height (number) height of the image + = (object) Raphaël element object with type “image” + ** + > Usage + | var c = paper.image("apple.png", 10, 10, 80, 80); + \*/ + paperproto.image = function (src, x, y, w, h) { + var out = R._engine.image(this, src || "about:blank", x || 0, y || 0, w || 0, h || 0); + this.__set__ && this.__set__.push(out); + return out; + }; + /*\ + * Paper.text + [ method ] + ** + * Draws a text string. If you need line breaks, put “\n” in the string. + ** + > Parameters + ** + - x (number) x coordinate position + - y (number) y coordinate position + - text (string) The text string to draw + = (object) Raphaël element object with type “text” + ** + > Usage + | var t = paper.text(50, 50, "Raphaël\nkicks\nbutt!"); + \*/ + paperproto.text = function (x, y, text) { + var out = R._engine.text(this, x || 0, y || 0, Str(text)); + this.__set__ && this.__set__.push(out); + return out; + }; + /*\ + * Paper.set + [ method ] + ** + * Creates array-like object to keep and operate several elements at once. + * Warning: it doesn’t create any elements for itself in the page, it just groups existing elements. + * Sets act as pseudo elements — all methods available to an element can be used on a set. + = (object) array-like object that represents set of elements + ** + > Usage + | var st = paper.set(); + | st.push( + | paper.circle(10, 10, 5), + | paper.circle(30, 10, 5) + | ); + | st.attr({fill: "red"}); // changes the fill of both circles + \*/ + paperproto.set = function (itemsArray) { + !R.is(itemsArray, "array") && (itemsArray = Array.prototype.splice.call(arguments, 0, arguments.length)); + var out = new Set(itemsArray); + this.__set__ && this.__set__.push(out); + out["paper"] = this; + out["type"] = "set"; + return out; + }; + /*\ + * Paper.setStart + [ method ] + ** + * Creates @Paper.set. All elements that will be created after calling this method and before calling + * @Paper.setFinish will be added to the set. + ** + > Usage + | paper.setStart(); + | paper.circle(10, 10, 5), + | paper.circle(30, 10, 5) + | var st = paper.setFinish(); + | st.attr({fill: "red"}); // changes the fill of both circles + \*/ + paperproto.setStart = function (set) { + this.__set__ = set || this.set(); + }; + /*\ + * Paper.setFinish + [ method ] + ** + * See @Paper.setStart. This method finishes catching and returns resulting set. + ** + = (object) set + \*/ + paperproto.setFinish = function (set) { + var out = this.__set__; + delete this.__set__; + return out; + }; + /*\ + * Paper.getSize + [ method ] + ** + * Obtains current paper actual size. + ** + = (object) + \*/ + paperproto.getSize = function () { + var container = this.canvas.parentNode; + return { + width: container.offsetWidth, + height: container.offsetHeight + }; + }; + /*\ + * Paper.setSize + [ method ] + ** + * If you need to change dimensions of the canvas call this method + ** + > Parameters + ** + - width (number) new width of the canvas + - height (number) new height of the canvas + \*/ + paperproto.setSize = function (width, height) { + return R._engine.setSize.call(this, width, height); + }; + /*\ + * Paper.setViewBox + [ method ] + ** + * Sets the view box of the paper. Practically it gives you ability to zoom and pan whole paper surface by + * specifying new boundaries. + ** + > Parameters + ** + - x (number) new x position, default is `0` + - y (number) new y position, default is `0` + - w (number) new width of the canvas + - h (number) new height of the canvas + - fit (boolean) `true` if you want graphics to fit into new boundary box + \*/ + paperproto.setViewBox = function (x, y, w, h, fit) { + return R._engine.setViewBox.call(this, x, y, w, h, fit); + }; + /*\ + * Paper.top + [ property ] + ** + * Points to the topmost element on the paper + \*/ + /*\ + * Paper.bottom + [ property ] + ** + * Points to the bottom element on the paper + \*/ + paperproto.top = paperproto.bottom = null; + /*\ + * Paper.raphael + [ property ] + ** + * Points to the @Raphael object/function + \*/ + paperproto.raphael = R; + var getOffset = function (elem) { + var box = elem.getBoundingClientRect(), + doc = elem.ownerDocument, + body = doc.body, + docElem = doc.documentElement, + clientTop = docElem.clientTop || body.clientTop || 0, clientLeft = docElem.clientLeft || body.clientLeft || 0, + top = box.top + (g.win.pageYOffset || docElem.scrollTop || body.scrollTop ) - clientTop, + left = box.left + (g.win.pageXOffset || docElem.scrollLeft || body.scrollLeft) - clientLeft; + return { + y: top, + x: left + }; + }; + /*\ + * Paper.getElementByPoint + [ method ] + ** + * Returns you topmost element under given point. + ** + = (object) Raphaël element object + > Parameters + ** + - x (number) x coordinate from the top left corner of the window + - y (number) y coordinate from the top left corner of the window + > Usage + | paper.getElementByPoint(mouseX, mouseY).attr({stroke: "#f00"}); + \*/ + paperproto.getElementByPoint = function (x, y) { + var paper = this, + svg = paper.canvas, + target = g.doc.elementFromPoint(x, y); + if (g.win.opera && target.tagName == "svg") { + var so = getOffset(svg), + sr = svg.createSVGRect(); + sr.x = x - so.x; + sr.y = y - so.y; + sr.width = sr.height = 1; + var hits = svg.getIntersectionList(sr, null); + if (hits.length) { + target = hits[hits.length - 1]; + } + } + if (!target) { + return null; + } + while (target.parentNode && target != svg.parentNode && !target.raphael) { + target = target.parentNode; + } + target == paper.canvas.parentNode && (target = svg); + target = target && target.raphael ? paper.getById(target.raphaelid) : null; + return target; + }; + + /*\ + * Paper.getElementsByBBox + [ method ] + ** + * Returns set of elements that have an intersecting bounding box + ** + > Parameters + ** + - bbox (object) bbox to check with + = (object) @Set + \*/ + paperproto.getElementsByBBox = function (bbox) { + var set = this.set(); + this.forEach(function (el) { + if (R.isBBoxIntersect(el.getBBox(), bbox)) { + set.push(el); + } + }); + return set; + }; + + /*\ + * Paper.getById + [ method ] + ** + * Returns you element by its internal ID. + ** + > Parameters + ** + - id (number) id + = (object) Raphaël element object + \*/ + paperproto.getById = function (id) { + var bot = this.bottom; + while (bot) { + if (bot.id == id) { + return bot; + } + bot = bot.next; + } + return null; + }; + /*\ + * Paper.forEach + [ method ] + ** + * Executes given function for each element on the paper + * + * If callback function returns `false` it will stop loop running. + ** + > Parameters + ** + - callback (function) function to run + - thisArg (object) context object for the callback + = (object) Paper object + > Usage + | paper.forEach(function (el) { + | el.attr({ stroke: "blue" }); + | }); + \*/ + paperproto.forEach = function (callback, thisArg) { + var bot = this.bottom; + while (bot) { + if (callback.call(thisArg, bot) === false) { + return this; + } + bot = bot.next; + } + return this; + }; + /*\ + * Paper.getElementsByPoint + [ method ] + ** + * Returns set of elements that have common point inside + ** + > Parameters + ** + - x (number) x coordinate of the point + - y (number) y coordinate of the point + = (object) @Set + \*/ + paperproto.getElementsByPoint = function (x, y) { + var set = this.set(); + this.forEach(function (el) { + if (el.isPointInside(x, y)) { + set.push(el); + } + }); + return set; + }; + function x_y() { + return this.x + S + this.y; + } + function x_y_w_h() { + return this.x + S + this.y + S + this.width + " \xd7 " + this.height; + } + /*\ + * Element.isPointInside + [ method ] + ** + * Determine if given point is inside this element’s shape + ** + > Parameters + ** + - x (number) x coordinate of the point + - y (number) y coordinate of the point + = (boolean) `true` if point inside the shape + \*/ + elproto.isPointInside = function (x, y) { + var rp = this.realPath = getPath[this.type](this); + if (this.attr('transform') && this.attr('transform').length) { + rp = R.transformPath(rp, this.attr('transform')); + } + return R.isPointInsidePath(rp, x, y); + }; + /*\ + * Element.getBBox + [ method ] + ** + * Return bounding box for a given element + ** + > Parameters + ** + - isWithoutTransform (boolean) flag, `true` if you want to have bounding box before transformations. Default is `false`. + = (object) Bounding box object: + o { + o x: (number) top left corner x + o y: (number) top left corner y + o x2: (number) bottom right corner x + o y2: (number) bottom right corner y + o width: (number) width + o height: (number) height + o } + \*/ + elproto.getBBox = function (isWithoutTransform) { + if (this.removed) { + return {}; + } + var _ = this._; + if (isWithoutTransform) { + if (_.dirty || !_.bboxwt) { + this.realPath = getPath[this.type](this); + _.bboxwt = pathDimensions(this.realPath); + _.bboxwt.toString = x_y_w_h; + _.dirty = 0; + } + return _.bboxwt; + } + if (_.dirty || _.dirtyT || !_.bbox) { + if (_.dirty || !this.realPath) { + _.bboxwt = 0; + this.realPath = getPath[this.type](this); + } + _.bbox = pathDimensions(mapPath(this.realPath, this.matrix)); + _.bbox.toString = x_y_w_h; + _.dirty = _.dirtyT = 0; + } + return _.bbox; + }; + /*\ + * Element.clone + [ method ] + ** + = (object) clone of a given element + ** + \*/ + elproto.clone = function () { + if (this.removed) { + return null; + } + var out = this.paper[this.type]().attr(this.attr()); + this.__set__ && this.__set__.push(out); + return out; + }; + /*\ + * Element.glow + [ method ] + ** + * Return set of elements that create glow-like effect around given element. See @Paper.set. + * + * Note: Glow is not connected to the element. If you change element attributes it won’t adjust itself. + ** + > Parameters + ** + - glow (object) #optional parameters object with all properties optional: + o { + o width (number) size of the glow, default is `10` + o fill (boolean) will it be filled, default is `false` + o opacity (number) opacity, default is `0.5` + o offsetx (number) horizontal offset, default is `0` + o offsety (number) vertical offset, default is `0` + o color (string) glow colour, default is `black` + o } + = (object) @Paper.set of elements that represents glow + \*/ + elproto.glow = function (glow) { + if (this.type == "text") { + return null; + } + glow = glow || {}; + var s = { + width: (glow.width || 10) + (+this.attr("stroke-width") || 1), + fill: glow.fill || false, + opacity: glow.opacity == null ? .5 : glow.opacity, + offsetx: glow.offsetx || 0, + offsety: glow.offsety || 0, + color: glow.color || "#000" + }, + c = s.width / 2, + r = this.paper, + out = r.set(), + path = this.realPath || getPath[this.type](this); + path = this.matrix ? mapPath(path, this.matrix) : path; + for (var i = 1; i < c + 1; i++) { + out.push(r.path(path).attr({ + stroke: s.color, + fill: s.fill ? s.color : "none", + "stroke-linejoin": "round", + "stroke-linecap": "round", + "stroke-width": +(s.width / c * i).toFixed(3), + opacity: +(s.opacity / c).toFixed(3) + })); + } + return out.insertBefore(this).translate(s.offsetx, s.offsety); + }; + var curveslengths = {}, + getPointAtSegmentLength = function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length) { + if (length == null) { + return bezlen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y); + } else { + return R.findDotsAtSegment(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, getTatLen(p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y, length)); + } + }, + getLengthFactory = function (istotal, subpath) { + return function (path, length, onlystart) { + path = path2curve(path); + var x, y, p, l, sp = "", subpaths = {}, point, + len = 0; + for (var i = 0, ii = path.length; i < ii; i++) { + p = path[i]; + if (p[0] == "M") { + x = +p[1]; + y = +p[2]; + } else { + l = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6]); + if (len + l > length) { + if (subpath && !subpaths.start) { + point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len); + sp += ["C" + point.start.x, point.start.y, point.m.x, point.m.y, point.x, point.y]; + if (onlystart) {return sp;} + subpaths.start = sp; + sp = ["M" + point.x, point.y + "C" + point.n.x, point.n.y, point.end.x, point.end.y, p[5], p[6]].join(); + len += l; + x = +p[5]; + y = +p[6]; + continue; + } + if (!istotal && !subpath) { + point = getPointAtSegmentLength(x, y, p[1], p[2], p[3], p[4], p[5], p[6], length - len); + return {x: point.x, y: point.y, alpha: point.alpha}; + } + } + len += l; + x = +p[5]; + y = +p[6]; + } + sp += p.shift() + p; + } + subpaths.end = sp; + point = istotal ? len : subpath ? subpaths : R.findDotsAtSegment(x, y, p[0], p[1], p[2], p[3], p[4], p[5], 1); + point.alpha && (point = {x: point.x, y: point.y, alpha: point.alpha}); + return point; + }; + }; + var getTotalLength = getLengthFactory(1), + getPointAtLength = getLengthFactory(), + getSubpathsAtLength = getLengthFactory(0, 1); + /*\ + * Raphael.getTotalLength + [ method ] + ** + * Returns length of the given path in pixels. + ** + > Parameters + ** + - path (string) SVG path string. + ** + = (number) length. + \*/ + R.getTotalLength = getTotalLength; + /*\ + * Raphael.getPointAtLength + [ method ] + ** + * Return coordinates of the point located at the given length on the given path. + ** + > Parameters + ** + - path (string) SVG path string + - length (number) + ** + = (object) representation of the point: + o { + o x: (number) x coordinate + o y: (number) y coordinate + o alpha: (number) angle of derivative + o } + \*/ + R.getPointAtLength = getPointAtLength; + /*\ + * Raphael.getSubpath + [ method ] + ** + * Return subpath of a given path from given length to given length. + ** + > Parameters + ** + - path (string) SVG path string + - from (number) position of the start of the segment + - to (number) position of the end of the segment + ** + = (string) pathstring for the segment + \*/ + R.getSubpath = function (path, from, to) { + if (this.getTotalLength(path) - to < 1e-6) { + return getSubpathsAtLength(path, from).end; + } + var a = getSubpathsAtLength(path, to, 1); + return from ? getSubpathsAtLength(a, from).end : a; + }; + /*\ + * Element.getTotalLength + [ method ] + ** + * Returns length of the path in pixels. Only works for element of “path” type. + = (number) length. + \*/ + elproto.getTotalLength = function () { + var path = this.getPath(); + if (!path) { + return; + } + + if (this.node.getTotalLength) { + return this.node.getTotalLength(); + } + + return getTotalLength(path); + }; + /*\ + * Element.getPointAtLength + [ method ] + ** + * Return coordinates of the point located at the given length on the given path. Only works for element of “path” type. + ** + > Parameters + ** + - length (number) + ** + = (object) representation of the point: + o { + o x: (number) x coordinate + o y: (number) y coordinate + o alpha: (number) angle of derivative + o } + \*/ + elproto.getPointAtLength = function (length) { + var path = this.getPath(); + if (!path) { + return; + } + + return getPointAtLength(path, length); + }; + /*\ + * Element.getPath + [ method ] + ** + * Returns path of the element. Only works for elements of “path” type and simple elements like circle. + = (object) path + ** + \*/ + elproto.getPath = function () { + var path, + getPath = R._getPath[this.type]; + + if (this.type == "text" || this.type == "set") { + return; + } + + if (getPath) { + path = getPath(this); + } + + return path; + }; + /*\ + * Element.getSubpath + [ method ] + ** + * Return subpath of a given element from given length to given length. Only works for element of “path” type. + ** + > Parameters + ** + - from (number) position of the start of the segment + - to (number) position of the end of the segment + ** + = (string) pathstring for the segment + \*/ + elproto.getSubpath = function (from, to) { + var path = this.getPath(); + if (!path) { + return; + } + + return R.getSubpath(path, from, to); + }; + /*\ + * Raphael.easing_formulas + [ property ] + ** + * Object that contains easing formulas for animation. You could extend it with your own. By default it has following list of easing: + # + #

See also Easing demo.

+ \*/ + var ef = R.easing_formulas = { + linear: function (n) { + return n; + }, + "<": function (n) { + return pow(n, 1.7); + }, + ">": function (n) { + return pow(n, .48); + }, + "<>": function (n) { + var q = .48 - n / 1.04, + Q = math.sqrt(.1734 + q * q), + x = Q - q, + X = pow(abs(x), 1 / 3) * (x < 0 ? -1 : 1), + y = -Q - q, + Y = pow(abs(y), 1 / 3) * (y < 0 ? -1 : 1), + t = X + Y + .5; + return (1 - t) * 3 * t * t + t * t * t; + }, + backIn: function (n) { + var s = 1.70158; + return n * n * ((s + 1) * n - s); + }, + backOut: function (n) { + n = n - 1; + var s = 1.70158; + return n * n * ((s + 1) * n + s) + 1; + }, + elastic: function (n) { + if (n == !!n) { + return n; + } + return pow(2, -10 * n) * math.sin((n - .075) * (2 * PI) / .3) + 1; + }, + bounce: function (n) { + var s = 7.5625, + p = 2.75, + l; + if (n < (1 / p)) { + l = s * n * n; + } else { + if (n < (2 / p)) { + n -= (1.5 / p); + l = s * n * n + .75; + } else { + if (n < (2.5 / p)) { + n -= (2.25 / p); + l = s * n * n + .9375; + } else { + n -= (2.625 / p); + l = s * n * n + .984375; + } + } + } + return l; + } + }; + ef.easeIn = ef["ease-in"] = ef["<"]; + ef.easeOut = ef["ease-out"] = ef[">"]; + ef.easeInOut = ef["ease-in-out"] = ef["<>"]; + ef["back-in"] = ef.backIn; + ef["back-out"] = ef.backOut; + + var animationElements = [], + requestAnimFrame = window.requestAnimationFrame || + window.webkitRequestAnimationFrame || + window.mozRequestAnimationFrame || + window.oRequestAnimationFrame || + window.msRequestAnimationFrame || + function (callback) { + setTimeout(callback, 16); + }, + animation = function () { + var Now = +new Date, + l = 0; + for (; l < animationElements.length; l++) { + var e = animationElements[l]; + if (e.el.removed || e.paused) { + continue; + } + var time = Now - e.start, + ms = e.ms, + easing = e.easing, + from = e.from, + diff = e.diff, + to = e.to, + t = e.t, + that = e.el, + set = {}, + now, + init = {}, + key; + if (e.initstatus) { + time = (e.initstatus * e.anim.top - e.prev) / (e.percent - e.prev) * ms; + e.status = e.initstatus; + delete e.initstatus; + e.stop && animationElements.splice(l--, 1); + } else { + e.status = (e.prev + (e.percent - e.prev) * (time / ms)) / e.anim.top; + } + if (time < 0) { + continue; + } + if (time < ms) { + var pos = easing(time / ms); + for (var attr in from) if (from[has](attr)) { + switch (availableAnimAttrs[attr]) { + case nu: + now = +from[attr] + pos * ms * diff[attr]; + break; + case "colour": + now = "rgb(" + [ + upto255(round(from[attr].r + pos * ms * diff[attr].r)), + upto255(round(from[attr].g + pos * ms * diff[attr].g)), + upto255(round(from[attr].b + pos * ms * diff[attr].b)) + ].join(",") + ")"; + break; + case "path": + now = []; + for (var i = 0, ii = from[attr].length; i < ii; i++) { + now[i] = [from[attr][i][0]]; + for (var j = 1, jj = from[attr][i].length; j < jj; j++) { + now[i][j] = +from[attr][i][j] + pos * ms * diff[attr][i][j]; + } + now[i] = now[i].join(S); + } + now = now.join(S); + break; + case "transform": + if (diff[attr].real) { + now = []; + for (i = 0, ii = from[attr].length; i < ii; i++) { + now[i] = [from[attr][i][0]]; + for (j = 1, jj = from[attr][i].length; j < jj; j++) { + now[i][j] = from[attr][i][j] + pos * ms * diff[attr][i][j]; + } + } + } else { + var get = function (i) { + return +from[attr][i] + pos * ms * diff[attr][i]; + }; + // now = [["r", get(2), 0, 0], ["t", get(3), get(4)], ["s", get(0), get(1), 0, 0]]; + now = [["m", get(0), get(1), get(2), get(3), get(4), get(5)]]; + } + break; + case "csv": + if (attr == "clip-rect") { + now = []; + i = 4; + while (i--) { + now[i] = +from[attr][i] + pos * ms * diff[attr][i]; + } + } + break; + default: + var from2 = [][concat](from[attr]); + now = []; + i = that.paper.customAttributes[attr].length; + while (i--) { + now[i] = +from2[i] + pos * ms * diff[attr][i]; + } + break; + } + set[attr] = now; + } + that.attr(set); + (function (id, that, anim) { + setTimeout(function () { + eve("raphael.anim.frame." + id, that, anim); + }); + })(that.id, that, e.anim); + } else { + (function(f, el, a) { + setTimeout(function() { + eve("raphael.anim.frame." + el.id, el, a); + eve("raphael.anim.finish." + el.id, el, a); + R.is(f, "function") && f.call(el); + }); + })(e.callback, that, e.anim); + that.attr(to); + animationElements.splice(l--, 1); + if (e.repeat > 1 && !e.next) { + for (key in to) if (to[has](key)) { + init[key] = e.totalOrigin[key]; + } + e.el.attr(init); + runAnimation(e.anim, e.el, e.anim.percents[0], null, e.totalOrigin, e.repeat - 1); + } + if (e.next && !e.stop) { + runAnimation(e.anim, e.el, e.next, null, e.totalOrigin, e.repeat); + } + } + } + animationElements.length && requestAnimFrame(animation); + }, + upto255 = function (color) { + return color > 255 ? 255 : color < 0 ? 0 : color; + }; + /*\ + * Element.animateWith + [ method ] + ** + * Acts similar to @Element.animate, but ensure that given animation runs in sync with another given element. + ** + > Parameters + ** + - el (object) element to sync with + - anim (object) animation to sync with + - params (object) #optional final attributes for the element, see also @Element.attr + - ms (number) #optional number of milliseconds for animation to run + - easing (string) #optional easing type. Accept on of @Raphael.easing_formulas or CSS format: `cubic‐bezier(XX, XX, XX, XX)` + - callback (function) #optional callback function. Will be called at the end of animation. + * or + - element (object) element to sync with + - anim (object) animation to sync with + - animation (object) #optional animation object, see @Raphael.animation + ** + = (object) original element + \*/ + elproto.animateWith = function (el, anim, params, ms, easing, callback) { + var element = this; + if (element.removed) { + callback && callback.call(element); + return element; + } + var a = params instanceof Animation ? params : R.animation(params, ms, easing, callback), + x, y; + runAnimation(a, element, a.percents[0], null, element.attr()); + for (var i = 0, ii = animationElements.length; i < ii; i++) { + if (animationElements[i].anim == anim && animationElements[i].el == el) { + animationElements[ii - 1].start = animationElements[i].start; + break; + } + } + return element; + // + // + // var a = params ? R.animation(params, ms, easing, callback) : anim, + // status = element.status(anim); + // return this.animate(a).status(a, status * anim.ms / a.ms); + }; + function CubicBezierAtTime(t, p1x, p1y, p2x, p2y, duration) { + var cx = 3 * p1x, + bx = 3 * (p2x - p1x) - cx, + ax = 1 - cx - bx, + cy = 3 * p1y, + by = 3 * (p2y - p1y) - cy, + ay = 1 - cy - by; + function sampleCurveX(t) { + return ((ax * t + bx) * t + cx) * t; + } + function solve(x, epsilon) { + var t = solveCurveX(x, epsilon); + return ((ay * t + by) * t + cy) * t; + } + function solveCurveX(x, epsilon) { + var t0, t1, t2, x2, d2, i; + for(t2 = x, i = 0; i < 8; i++) { + x2 = sampleCurveX(t2) - x; + if (abs(x2) < epsilon) { + return t2; + } + d2 = (3 * ax * t2 + 2 * bx) * t2 + cx; + if (abs(d2) < 1e-6) { + break; + } + t2 = t2 - x2 / d2; + } + t0 = 0; + t1 = 1; + t2 = x; + if (t2 < t0) { + return t0; + } + if (t2 > t1) { + return t1; + } + while (t0 < t1) { + x2 = sampleCurveX(t2); + if (abs(x2 - x) < epsilon) { + return t2; + } + if (x > x2) { + t0 = t2; + } else { + t1 = t2; + } + t2 = (t1 - t0) / 2 + t0; + } + return t2; + } + return solve(t, 1 / (200 * duration)); + } + elproto.onAnimation = function (f) { + f ? eve.on("raphael.anim.frame." + this.id, f) : eve.unbind("raphael.anim.frame." + this.id); + return this; + }; + function Animation(anim, ms) { + var percents = [], + newAnim = {}; + this.ms = ms; + this.times = 1; + if (anim) { + for (var attr in anim) if (anim[has](attr)) { + newAnim[toFloat(attr)] = anim[attr]; + percents.push(toFloat(attr)); + } + percents.sort(sortByNumber); + } + this.anim = newAnim; + this.top = percents[percents.length - 1]; + this.percents = percents; + } + /*\ + * Animation.delay + [ method ] + ** + * Creates a copy of existing animation object with given delay. + ** + > Parameters + ** + - delay (number) number of ms to pass between animation start and actual animation + ** + = (object) new altered Animation object + | var anim = Raphael.animation({cx: 10, cy: 20}, 2e3); + | circle1.animate(anim); // run the given animation immediately + | circle2.animate(anim.delay(500)); // run the given animation after 500 ms + \*/ + Animation.prototype.delay = function (delay) { + var a = new Animation(this.anim, this.ms); + a.times = this.times; + a.del = +delay || 0; + return a; + }; + /*\ + * Animation.repeat + [ method ] + ** + * Creates a copy of existing animation object with given repetition. + ** + > Parameters + ** + - repeat (number) number iterations of animation. For infinite animation pass `Infinity` + ** + = (object) new altered Animation object + \*/ + Animation.prototype.repeat = function (times) { + var a = new Animation(this.anim, this.ms); + a.del = this.del; + a.times = math.floor(mmax(times, 0)) || 1; + return a; + }; + function runAnimation(anim, element, percent, status, totalOrigin, times) { + percent = toFloat(percent); + var params, + isInAnim, + isInAnimSet, + percents = [], + next, + prev, + timestamp, + ms = anim.ms, + from = {}, + to = {}, + diff = {}; + if (status) { + for (i = 0, ii = animationElements.length; i < ii; i++) { + var e = animationElements[i]; + if (e.el.id == element.id && e.anim == anim) { + if (e.percent != percent) { + animationElements.splice(i, 1); + isInAnimSet = 1; + } else { + isInAnim = e; + } + element.attr(e.totalOrigin); + break; + } + } + } else { + status = +to; // NaN + } + for (var i = 0, ii = anim.percents.length; i < ii; i++) { + if (anim.percents[i] == percent || anim.percents[i] > status * anim.top) { + percent = anim.percents[i]; + prev = anim.percents[i - 1] || 0; + ms = ms / anim.top * (percent - prev); + next = anim.percents[i + 1]; + params = anim.anim[percent]; + break; + } else if (status) { + element.attr(anim.anim[anim.percents[i]]); + } + } + if (!params) { + return; + } + if (!isInAnim) { + for (var attr in params) if (params[has](attr)) { + if (availableAnimAttrs[has](attr) || element.paper.customAttributes[has](attr)) { + from[attr] = element.attr(attr); + (from[attr] == null) && (from[attr] = availableAttrs[attr]); + to[attr] = params[attr]; + switch (availableAnimAttrs[attr]) { + case nu: + diff[attr] = (to[attr] - from[attr]) / ms; + break; + case "colour": + from[attr] = R.getRGB(from[attr]); + var toColour = R.getRGB(to[attr]); + diff[attr] = { + r: (toColour.r - from[attr].r) / ms, + g: (toColour.g - from[attr].g) / ms, + b: (toColour.b - from[attr].b) / ms + }; + break; + case "path": + var pathes = path2curve(from[attr], to[attr]), + toPath = pathes[1]; + from[attr] = pathes[0]; + diff[attr] = []; + for (i = 0, ii = from[attr].length; i < ii; i++) { + diff[attr][i] = [0]; + for (var j = 1, jj = from[attr][i].length; j < jj; j++) { + diff[attr][i][j] = (toPath[i][j] - from[attr][i][j]) / ms; + } + } + break; + case "transform": + var _ = element._, + eq = equaliseTransform(_[attr], to[attr]); + if (eq) { + from[attr] = eq.from; + to[attr] = eq.to; + diff[attr] = []; + diff[attr].real = true; + for (i = 0, ii = from[attr].length; i < ii; i++) { + diff[attr][i] = [from[attr][i][0]]; + for (j = 1, jj = from[attr][i].length; j < jj; j++) { + diff[attr][i][j] = (to[attr][i][j] - from[attr][i][j]) / ms; + } + } + } else { + var m = (element.matrix || new Matrix), + to2 = { + _: {transform: _.transform}, + getBBox: function () { + return element.getBBox(1); + } + }; + from[attr] = [ + m.a, + m.b, + m.c, + m.d, + m.e, + m.f + ]; + extractTransform(to2, to[attr]); + to[attr] = to2._.transform; + diff[attr] = [ + (to2.matrix.a - m.a) / ms, + (to2.matrix.b - m.b) / ms, + (to2.matrix.c - m.c) / ms, + (to2.matrix.d - m.d) / ms, + (to2.matrix.e - m.e) / ms, + (to2.matrix.f - m.f) / ms + ]; + // from[attr] = [_.sx, _.sy, _.deg, _.dx, _.dy]; + // var to2 = {_:{}, getBBox: function () { return element.getBBox(); }}; + // extractTransform(to2, to[attr]); + // diff[attr] = [ + // (to2._.sx - _.sx) / ms, + // (to2._.sy - _.sy) / ms, + // (to2._.deg - _.deg) / ms, + // (to2._.dx - _.dx) / ms, + // (to2._.dy - _.dy) / ms + // ]; + } + break; + case "csv": + var values = Str(params[attr])[split](separator), + from2 = Str(from[attr])[split](separator); + if (attr == "clip-rect") { + from[attr] = from2; + diff[attr] = []; + i = from2.length; + while (i--) { + diff[attr][i] = (values[i] - from[attr][i]) / ms; + } + } + to[attr] = values; + break; + default: + values = [][concat](params[attr]); + from2 = [][concat](from[attr]); + diff[attr] = []; + i = element.paper.customAttributes[attr].length; + while (i--) { + diff[attr][i] = ((values[i] || 0) - (from2[i] || 0)) / ms; + } + break; + } + } + } + var easing = params.easing, + easyeasy = R.easing_formulas[easing]; + if (!easyeasy) { + easyeasy = Str(easing).match(bezierrg); + if (easyeasy && easyeasy.length == 5) { + var curve = easyeasy; + easyeasy = function (t) { + return CubicBezierAtTime(t, +curve[1], +curve[2], +curve[3], +curve[4], ms); + }; + } else { + easyeasy = pipe; + } + } + timestamp = params.start || anim.start || +new Date; + e = { + anim: anim, + percent: percent, + timestamp: timestamp, + start: timestamp + (anim.del || 0), + status: 0, + initstatus: status || 0, + stop: false, + ms: ms, + easing: easyeasy, + from: from, + diff: diff, + to: to, + el: element, + callback: params.callback, + prev: prev, + next: next, + repeat: times || anim.times, + origin: element.attr(), + totalOrigin: totalOrigin + }; + animationElements.push(e); + if (status && !isInAnim && !isInAnimSet) { + e.stop = true; + e.start = new Date - ms * status; + if (animationElements.length == 1) { + return animation(); + } + } + if (isInAnimSet) { + e.start = new Date - e.ms * status; + } + animationElements.length == 1 && requestAnimFrame(animation); + } else { + isInAnim.initstatus = status; + isInAnim.start = new Date - isInAnim.ms * status; + } + eve("raphael.anim.start." + element.id, element, anim); + } + /*\ + * Raphael.animation + [ method ] + ** + * Creates an animation object that can be passed to the @Element.animate or @Element.animateWith methods. + * See also @Animation.delay and @Animation.repeat methods. + ** + > Parameters + ** + - params (object) final attributes for the element, see also @Element.attr + - ms (number) number of milliseconds for animation to run + - easing (string) #optional easing type. Accept one of @Raphael.easing_formulas or CSS format: `cubic‐bezier(XX, XX, XX, XX)` + - callback (function) #optional callback function. Will be called at the end of animation. + ** + = (object) @Animation + \*/ + R.animation = function (params, ms, easing, callback) { + if (params instanceof Animation) { + return params; + } + if (R.is(easing, "function") || !easing) { + callback = callback || easing || null; + easing = null; + } + params = Object(params); + ms = +ms || 0; + var p = {}, + json, + attr; + for (attr in params) if (params[has](attr) && toFloat(attr) != attr && toFloat(attr) + "%" != attr) { + json = true; + p[attr] = params[attr]; + } + if (!json) { + // if percent-like syntax is used and end-of-all animation callback used + if(callback){ + // find the last one + var lastKey = 0; + for(var i in params){ + var percent = toInt(i); + if(params[has](i) && percent > lastKey){ + lastKey = percent; + } + } + lastKey += '%'; + // if already defined callback in the last keyframe, skip + !params[lastKey].callback && (params[lastKey].callback = callback); + } + return new Animation(params, ms); + } else { + easing && (p.easing = easing); + callback && (p.callback = callback); + return new Animation({100: p}, ms); + } + }; + /*\ + * Element.animate + [ method ] + ** + * Creates and starts animation for given element. + ** + > Parameters + ** + - params (object) final attributes for the element, see also @Element.attr + - ms (number) number of milliseconds for animation to run + - easing (string) #optional easing type. Accept one of @Raphael.easing_formulas or CSS format: `cubic‐bezier(XX, XX, XX, XX)` + - callback (function) #optional callback function. Will be called at the end of animation. + * or + - animation (object) animation object, see @Raphael.animation + ** + = (object) original element + \*/ + elproto.animate = function (params, ms, easing, callback) { + var element = this; + if (element.removed) { + callback && callback.call(element); + return element; + } + var anim = params instanceof Animation ? params : R.animation(params, ms, easing, callback); + runAnimation(anim, element, anim.percents[0], null, element.attr()); + return element; + }; + /*\ + * Element.setTime + [ method ] + ** + * Sets the status of animation of the element in milliseconds. Similar to @Element.status method. + ** + > Parameters + ** + - anim (object) animation object + - value (number) number of milliseconds from the beginning of the animation + ** + = (object) original element if `value` is specified + * Note, that during animation following events are triggered: + * + * On each animation frame event `anim.frame.`, on start `anim.start.` and on end `anim.finish.`. + \*/ + elproto.setTime = function (anim, value) { + if (anim && value != null) { + this.status(anim, mmin(value, anim.ms) / anim.ms); + } + return this; + }; + /*\ + * Element.status + [ method ] + ** + * Gets or sets the status of animation of the element. + ** + > Parameters + ** + - anim (object) #optional animation object + - value (number) #optional 0 – 1. If specified, method works like a setter and sets the status of a given animation to the value. This will cause animation to jump to the given position. + ** + = (number) status + * or + = (array) status if `anim` is not specified. Array of objects in format: + o { + o anim: (object) animation object + o status: (number) status + o } + * or + = (object) original element if `value` is specified + \*/ + elproto.status = function (anim, value) { + var out = [], + i = 0, + len, + e; + if (value != null) { + runAnimation(anim, this, -1, mmin(value, 1)); + return this; + } else { + len = animationElements.length; + for (; i < len; i++) { + e = animationElements[i]; + if (e.el.id == this.id && (!anim || e.anim == anim)) { + if (anim) { + return e.status; + } + out.push({ + anim: e.anim, + status: e.status + }); + } + } + if (anim) { + return 0; + } + return out; + } + }; + /*\ + * Element.pause + [ method ] + ** + * Stops animation of the element with ability to resume it later on. + ** + > Parameters + ** + - anim (object) #optional animation object + ** + = (object) original element + \*/ + elproto.pause = function (anim) { + for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) { + if (eve("raphael.anim.pause." + this.id, this, animationElements[i].anim) !== false) { + animationElements[i].paused = true; + } + } + return this; + }; + /*\ + * Element.resume + [ method ] + ** + * Resumes animation if it was paused with @Element.pause method. + ** + > Parameters + ** + - anim (object) #optional animation object + ** + = (object) original element + \*/ + elproto.resume = function (anim) { + for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) { + var e = animationElements[i]; + if (eve("raphael.anim.resume." + this.id, this, e.anim) !== false) { + delete e.paused; + this.status(e.anim, e.status); + } + } + return this; + }; + /*\ + * Element.stop + [ method ] + ** + * Stops animation of the element. + ** + > Parameters + ** + - anim (object) #optional animation object + ** + = (object) original element + \*/ + elproto.stop = function (anim) { + for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.id == this.id && (!anim || animationElements[i].anim == anim)) { + if (eve("raphael.anim.stop." + this.id, this, animationElements[i].anim) !== false) { + animationElements.splice(i--, 1); + } + } + return this; + }; + function stopAnimation(paper) { + for (var i = 0; i < animationElements.length; i++) if (animationElements[i].el.paper == paper) { + animationElements.splice(i--, 1); + } + } + eve.on("raphael.remove", stopAnimation); + eve.on("raphael.clear", stopAnimation); + elproto.toString = function () { + return "Rapha\xebl\u2019s object"; + }; + + // Set + var Set = function (items) { + this.items = []; + this.length = 0; + this.type = "set"; + if (items) { + for (var i = 0, ii = items.length; i < ii; i++) { + if (items[i] && (items[i].constructor == elproto.constructor || items[i].constructor == Set)) { + this[this.items.length] = this.items[this.items.length] = items[i]; + this.length++; + } + } + } + }, + setproto = Set.prototype; + /*\ + * Set.push + [ method ] + ** + * Adds each argument to the current set. + = (object) original element + \*/ + setproto.push = function () { + var item, + len; + for (var i = 0, ii = arguments.length; i < ii; i++) { + item = arguments[i]; + if (item && (item.constructor == elproto.constructor || item.constructor == Set)) { + len = this.items.length; + this[len] = this.items[len] = item; + this.length++; + } + } + return this; + }; + /*\ + * Set.pop + [ method ] + ** + * Removes last element and returns it. + = (object) element + \*/ + setproto.pop = function () { + this.length && delete this[this.length--]; + return this.items.pop(); + }; + /*\ + * Set.forEach + [ method ] + ** + * Executes given function for each element in the set. + * + * If function returns `false` it will stop loop running. + ** + > Parameters + ** + - callback (function) function to run + - thisArg (object) context object for the callback + = (object) Set object + \*/ + setproto.forEach = function (callback, thisArg) { + for (var i = 0, ii = this.items.length; i < ii; i++) { + if (callback.call(thisArg, this.items[i], i) === false) { + return this; + } + } + return this; + }; + for (var method in elproto) if (elproto[has](method)) { + setproto[method] = (function (methodname) { + return function () { + var arg = arguments; + return this.forEach(function (el) { + el[methodname][apply](el, arg); + }); + }; + })(method); + } + setproto.attr = function (name, value) { + if (name && R.is(name, array) && R.is(name[0], "object")) { + for (var j = 0, jj = name.length; j < jj; j++) { + this.items[j].attr(name[j]); + } + } else { + for (var i = 0, ii = this.items.length; i < ii; i++) { + this.items[i].attr(name, value); + } + } + return this; + }; + /*\ + * Set.clear + [ method ] + ** + * Removes all elements from the set + \*/ + setproto.clear = function () { + while (this.length) { + this.pop(); + } + }; + /*\ + * Set.splice + [ method ] + ** + * Removes given element from the set + ** + > Parameters + ** + - index (number) position of the deletion + - count (number) number of element to remove + - insertion… (object) #optional elements to insert + = (object) set elements that were deleted + \*/ + setproto.splice = function (index, count, insertion) { + index = index < 0 ? mmax(this.length + index, 0) : index; + count = mmax(0, mmin(this.length - index, count)); + var tail = [], + todel = [], + args = [], + i; + for (i = 2; i < arguments.length; i++) { + args.push(arguments[i]); + } + for (i = 0; i < count; i++) { + todel.push(this[index + i]); + } + for (; i < this.length - index; i++) { + tail.push(this[index + i]); + } + var arglen = args.length; + for (i = 0; i < arglen + tail.length; i++) { + this.items[index + i] = this[index + i] = i < arglen ? args[i] : tail[i - arglen]; + } + i = this.items.length = this.length -= count - arglen; + while (this[i]) { + delete this[i++]; + } + return new Set(todel); + }; + /*\ + * Set.exclude + [ method ] + ** + * Removes given element from the set + ** + > Parameters + ** + - element (object) element to remove + = (boolean) `true` if object was found & removed from the set + \*/ + setproto.exclude = function (el) { + for (var i = 0, ii = this.length; i < ii; i++) if (this[i] == el) { + this.splice(i, 1); + return true; + } + }; + setproto.animate = function (params, ms, easing, callback) { + (R.is(easing, "function") || !easing) && (callback = easing || null); + var len = this.items.length, + i = len, + item, + set = this, + collector; + if (!len) { + return this; + } + callback && (collector = function () { + !--len && callback.call(set); + }); + easing = R.is(easing, string) ? easing : collector; + var anim = R.animation(params, ms, easing, collector); + item = this.items[--i].animate(anim); + while (i--) { + this.items[i] && !this.items[i].removed && this.items[i].animateWith(item, anim, anim); + (this.items[i] && !this.items[i].removed) || len--; + } + return this; + }; + setproto.insertAfter = function (el) { + var i = this.items.length; + while (i--) { + this.items[i].insertAfter(el); + } + return this; + }; + setproto.getBBox = function () { + var x = [], + y = [], + x2 = [], + y2 = []; + for (var i = this.items.length; i--;) if (!this.items[i].removed) { + var box = this.items[i].getBBox(); + x.push(box.x); + y.push(box.y); + x2.push(box.x + box.width); + y2.push(box.y + box.height); + } + x = mmin[apply](0, x); + y = mmin[apply](0, y); + x2 = mmax[apply](0, x2); + y2 = mmax[apply](0, y2); + return { + x: x, + y: y, + x2: x2, + y2: y2, + width: x2 - x, + height: y2 - y + }; + }; + setproto.clone = function (s) { + s = this.paper.set(); + for (var i = 0, ii = this.items.length; i < ii; i++) { + s.push(this.items[i].clone()); + } + return s; + }; + setproto.toString = function () { + return "Rapha\xebl\u2018s set"; + }; + + setproto.glow = function(glowConfig) { + var ret = this.paper.set(); + this.forEach(function(shape, index){ + var g = shape.glow(glowConfig); + if(g != null){ + g.forEach(function(shape2, index2){ + ret.push(shape2); + }); + } + }); + return ret; + }; + + + /*\ + * Set.isPointInside + [ method ] + ** + * Determine if given point is inside this set’s elements + ** + > Parameters + ** + - x (number) x coordinate of the point + - y (number) y coordinate of the point + = (boolean) `true` if point is inside any of the set's elements + \*/ + setproto.isPointInside = function (x, y) { + var isPointInside = false; + this.forEach(function (el) { + if (el.isPointInside(x, y)) { + isPointInside = true; + return false; // stop loop + } + }); + return isPointInside; + }; + + /*\ + * Raphael.registerFont + [ method ] + ** + * Adds given font to the registered set of font for Raphaël. Should be used as an internal call from within Cufón’s font file. + * Returns original parameter, so it could be used with chaining. + # More about Cufón and how to convert your font form TTF, OTF, etc to JavaScript file. + ** + > Parameters + ** + - font (object) the font to register + = (object) the font you passed in + > Usage + | Cufon.registerFont(Raphael.registerFont({…})); + \*/ + R.registerFont = function (font) { + if (!font.face) { + return font; + } + this.fonts = this.fonts || {}; + var fontcopy = { + w: font.w, + face: {}, + glyphs: {} + }, + family = font.face["font-family"]; + for (var prop in font.face) if (font.face[has](prop)) { + fontcopy.face[prop] = font.face[prop]; + } + if (this.fonts[family]) { + this.fonts[family].push(fontcopy); + } else { + this.fonts[family] = [fontcopy]; + } + if (!font.svg) { + fontcopy.face["units-per-em"] = toInt(font.face["units-per-em"], 10); + for (var glyph in font.glyphs) if (font.glyphs[has](glyph)) { + var path = font.glyphs[glyph]; + fontcopy.glyphs[glyph] = { + w: path.w, + k: {}, + d: path.d && "M" + path.d.replace(/[mlcxtrv]/g, function (command) { + return {l: "L", c: "C", x: "z", t: "m", r: "l", v: "c"}[command] || "M"; + }) + "z" + }; + if (path.k) { + for (var k in path.k) if (path[has](k)) { + fontcopy.glyphs[glyph].k[k] = path.k[k]; + } + } + } + } + return font; + }; + /*\ + * Paper.getFont + [ method ] + ** + * Finds font object in the registered font by given parameters. You could specify only one word from the font name, like “Myriad” for “Myriad Pro”. + ** + > Parameters + ** + - family (string) font family name or any word from it + - weight (string) #optional font weight + - style (string) #optional font style + - stretch (string) #optional font stretch + = (object) the font object + > Usage + | paper.print(100, 100, "Test string", paper.getFont("Times", 800), 30); + \*/ + paperproto.getFont = function (family, weight, style, stretch) { + stretch = stretch || "normal"; + style = style || "normal"; + weight = +weight || {normal: 400, bold: 700, lighter: 300, bolder: 800}[weight] || 400; + if (!R.fonts) { + return; + } + var font = R.fonts[family]; + if (!font) { + var name = new RegExp("(^|\\s)" + family.replace(/[^\w\d\s+!~.:_-]/g, E) + "(\\s|$)", "i"); + for (var fontName in R.fonts) if (R.fonts[has](fontName)) { + if (name.test(fontName)) { + font = R.fonts[fontName]; + break; + } + } + } + var thefont; + if (font) { + for (var i = 0, ii = font.length; i < ii; i++) { + thefont = font[i]; + if (thefont.face["font-weight"] == weight && (thefont.face["font-style"] == style || !thefont.face["font-style"]) && thefont.face["font-stretch"] == stretch) { + break; + } + } + } + return thefont; + }; + /*\ + * Paper.print + [ method ] + ** + * Creates path that represent given text written using given font at given position with given size. + * Result of the method is path element that contains whole text as a separate path. + ** + > Parameters + ** + - x (number) x position of the text + - y (number) y position of the text + - string (string) text to print + - font (object) font object, see @Paper.getFont + - size (number) #optional size of the font, default is `16` + - origin (string) #optional could be `"baseline"` or `"middle"`, default is `"middle"` + - letter_spacing (number) #optional number in range `-1..1`, default is `0` + - line_spacing (number) #optional number in range `1..3`, default is `1` + = (object) resulting path element, which consist of all letters + > Usage + | var txt = r.print(10, 50, "print", r.getFont("Museo"), 30).attr({fill: "#fff"}); + \*/ + paperproto.print = function (x, y, string, font, size, origin, letter_spacing, line_spacing) { + origin = origin || "middle"; // baseline|middle + letter_spacing = mmax(mmin(letter_spacing || 0, 1), -1); + line_spacing = mmax(mmin(line_spacing || 1, 3), 1); + var letters = Str(string)[split](E), + shift = 0, + notfirst = 0, + path = E, + scale; + R.is(font, "string") && (font = this.getFont(font)); + if (font) { + scale = (size || 16) / font.face["units-per-em"]; + var bb = font.face.bbox[split](separator), + top = +bb[0], + lineHeight = bb[3] - bb[1], + shifty = 0, + height = +bb[1] + (origin == "baseline" ? lineHeight + (+font.face.descent) : lineHeight / 2); + for (var i = 0, ii = letters.length; i < ii; i++) { + if (letters[i] == "\n") { + shift = 0; + curr = 0; + notfirst = 0; + shifty += lineHeight * line_spacing; + } else { + var prev = notfirst && font.glyphs[letters[i - 1]] || {}, + curr = font.glyphs[letters[i]]; + shift += notfirst ? (prev.w || font.w) + (prev.k && prev.k[letters[i]] || 0) + (font.w * letter_spacing) : 0; + notfirst = 1; + } + if (curr && curr.d) { + path += R.transformPath(curr.d, ["t", shift * scale, shifty * scale, "s", scale, scale, top, height, "t", (x - top) / scale, (y - height) / scale]); + } + } + } + return this.path(path).attr({ + fill: "#000", + stroke: "none" + }); + }; + + /*\ + * Paper.add + [ method ] + ** + * Imports elements in JSON array in format `{type: type, }` + ** + > Parameters + ** + - json (array) + = (object) resulting set of imported elements + > Usage + | paper.add([ + | { + | type: "circle", + | cx: 10, + | cy: 10, + | r: 5 + | }, + | { + | type: "rect", + | x: 10, + | y: 10, + | width: 10, + | height: 10, + | fill: "#fc0" + | } + | ]); + \*/ + paperproto.add = function (json) { + if (R.is(json, "array")) { + var res = this.set(), + i = 0, + ii = json.length, + j; + for (; i < ii; i++) { + j = json[i] || {}; + elements[has](j.type) && res.push(this[j.type]().attr(j)); + } + } + return res; + }; + + /*\ + * Raphael.format + [ method ] + ** + * Simple format function. Replaces construction of type “`{}`” to the corresponding argument. + ** + > Parameters + ** + - token (string) string to format + - … (string) rest of arguments will be treated as parameters for replacement + = (string) formated string + > Usage + | var x = 10, + | y = 20, + | width = 40, + | height = 50; + | // this will draw a rectangular shape equivalent to "M10,20h40v50h-40z" + | paper.path(Raphael.format("M{0},{1}h{2}v{3}h{4}z", x, y, width, height, -width)); + \*/ + R.format = function (token, params) { + var args = R.is(params, array) ? [0][concat](params) : arguments; + token && R.is(token, string) && args.length - 1 && (token = token.replace(formatrg, function (str, i) { + return args[++i] == null ? E : args[i]; + })); + return token || E; + }; + /*\ + * Raphael.fullfill + [ method ] + ** + * A little bit more advanced format function than @Raphael.format. Replaces construction of type “`{}`” to the corresponding argument. + ** + > Parameters + ** + - token (string) string to format + - json (object) object which properties will be used as a replacement + = (string) formated string + > Usage + | // this will draw a rectangular shape equivalent to "M10,20h40v50h-40z" + | paper.path(Raphael.fullfill("M{x},{y}h{dim.width}v{dim.height}h{dim['negative width']}z", { + | x: 10, + | y: 20, + | dim: { + | width: 40, + | height: 50, + | "negative width": -40 + | } + | })); + \*/ + R.fullfill = (function () { + var tokenRegex = /\{([^\}]+)\}/g, + objNotationRegex = /(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g, // matches .xxxxx or ["xxxxx"] to run over object properties + replacer = function (all, key, obj) { + var res = obj; + key.replace(objNotationRegex, function (all, name, quote, quotedName, isFunc) { + name = name || quotedName; + if (res) { + if (name in res) { + res = res[name]; + } + typeof res == "function" && isFunc && (res = res()); + } + }); + res = (res == null || res == obj ? all : res) + ""; + return res; + }; + return function (str, obj) { + return String(str).replace(tokenRegex, function (all, key) { + return replacer(all, key, obj); + }); + }; + })(); + /*\ + * Raphael.ninja + [ method ] + ** + * If you want to leave no trace of Raphaël (Well, Raphaël creates only one global variable `Raphael`, but anyway.) You can use `ninja` method. + * Beware, that in this case plugins could stop working, because they are depending on global variable existence. + ** + = (object) Raphael object + > Usage + | (function (local_raphael) { + | var paper = local_raphael(10, 10, 320, 200); + | … + | })(Raphael.ninja()); + \*/ + R.ninja = function () { + oldRaphael.was ? (g.win.Raphael = oldRaphael.is) : delete Raphael; + return R; + }; + /*\ + * Raphael.st + [ property (object) ] + ** + * You can add your own method to elements and sets. It is wise to add a set method for each element method + * you added, so you will be able to call the same method on sets too. + ** + * See also @Raphael.el. + > Usage + | Raphael.el.red = function () { + | this.attr({fill: "#f00"}); + | }; + | Raphael.st.red = function () { + | this.forEach(function (el) { + | el.red(); + | }); + | }; + | // then use it + | paper.set(paper.circle(100, 100, 20), paper.circle(110, 100, 20)).red(); + \*/ + R.st = setproto; + + eve.on("raphael.DOMload", function () { + loaded = true; + }); + + // Firefox <3.6 fix: http://webreflection.blogspot.com/2009/11/195-chars-to-help-lazy-loading.html + (function (doc, loaded, f) { + if (doc.readyState == null && doc.addEventListener){ + doc.addEventListener(loaded, f = function () { + doc.removeEventListener(loaded, f, false); + doc.readyState = "complete"; + }, false); + doc.readyState = "loading"; + } + function isLoaded() { + (/in/).test(doc.readyState) ? setTimeout(isLoaded, 9) : R.eve("raphael.DOMload"); + } + isLoaded(); + })(document, "DOMContentLoaded"); + + return R; +})); + +// ┌─────────────────────────────────────────────────────────────────────┐ \\ +// │ Raphaël 2.1.4 - JavaScript Vector Library │ \\ +// ├─────────────────────────────────────────────────────────────────────┤ \\ +// │ SVG Module │ \\ +// ├─────────────────────────────────────────────────────────────────────┤ \\ +// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\ +// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\ +// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\ +// └─────────────────────────────────────────────────────────────────────┘ \\ + +(function (glob, factory) { + if (typeof define === "function" && define.amd) { + define("raphael.svg", ["raphael.core"], function(raphael) { + return factory(raphael); + }); + } else if (typeof exports === "object") { + factory(require("raphael.core")); + } else { + factory(glob.Raphael); + } +}(this, function(R) { + if (R && !R.svg) { + return; + } + + var has = "hasOwnProperty", + Str = String, + toFloat = parseFloat, + toInt = parseInt, + math = Math, + mmax = math.max, + abs = math.abs, + pow = math.pow, + separator = /[, ]+/, + eve = R.eve, + E = "", + S = " "; + var xlink = "http://www.w3.org/1999/xlink", + markers = { + block: "M5,0 0,2.5 5,5z", + classic: "M5,0 0,2.5 5,5 3.5,3 3.5,2z", + diamond: "M2.5,0 5,2.5 2.5,5 0,2.5z", + open: "M6,1 1,3.5 6,6", + oval: "M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z" + }, + markerCounter = {}; + R.toString = function () { + return "Your browser supports SVG.\nYou are running Rapha\xebl " + this.version; + }; + var $ = function (el, attr) { + if (attr) { + if (typeof el == "string") { + el = $(el); + } + for (var key in attr) if (attr[has](key)) { + if (key.substring(0, 6) == "xlink:") { + el.setAttributeNS(xlink, key.substring(6), Str(attr[key])); + } else { + el.setAttribute(key, Str(attr[key])); + } + } + } else { + el = R._g.doc.createElementNS("http://www.w3.org/2000/svg", el); + el.style && (el.style.webkitTapHighlightColor = "rgba(0,0,0,0)"); + } + return el; + }, + addGradientFill = function (element, gradient) { + var type = "linear", + id = element.id + gradient, + fx = .5, fy = .5, + o = element.node, + SVG = element.paper, + s = o.style, + el = R._g.doc.getElementById(id); + if (!el) { + gradient = Str(gradient).replace(R._radial_gradient, function (all, _fx, _fy) { + type = "radial"; + if (_fx && _fy) { + fx = toFloat(_fx); + fy = toFloat(_fy); + var dir = ((fy > .5) * 2 - 1); + pow(fx - .5, 2) + pow(fy - .5, 2) > .25 && + (fy = math.sqrt(.25 - pow(fx - .5, 2)) * dir + .5) && + fy != .5 && + (fy = fy.toFixed(5) - 1e-5 * dir); + } + return E; + }); + gradient = gradient.split(/\s*\-\s*/); + if (type == "linear") { + var angle = gradient.shift(); + angle = -toFloat(angle); + if (isNaN(angle)) { + return null; + } + var vector = [0, 0, math.cos(R.rad(angle)), math.sin(R.rad(angle))], + max = 1 / (mmax(abs(vector[2]), abs(vector[3])) || 1); + vector[2] *= max; + vector[3] *= max; + if (vector[2] < 0) { + vector[0] = -vector[2]; + vector[2] = 0; + } + if (vector[3] < 0) { + vector[1] = -vector[3]; + vector[3] = 0; + } + } + var dots = R._parseDots(gradient); + if (!dots) { + return null; + } + id = id.replace(/[\(\)\s,\xb0#]/g, "_"); + + if (element.gradient && id != element.gradient.id) { + SVG.defs.removeChild(element.gradient); + delete element.gradient; + } + + if (!element.gradient) { + el = $(type + "Gradient", {id: id}); + element.gradient = el; + $(el, type == "radial" ? { + fx: fx, + fy: fy + } : { + x1: vector[0], + y1: vector[1], + x2: vector[2], + y2: vector[3], + gradientTransform: element.matrix.invert() + }); + SVG.defs.appendChild(el); + for (var i = 0, ii = dots.length; i < ii; i++) { + el.appendChild($("stop", { + offset: dots[i].offset ? dots[i].offset : i ? "100%" : "0%", + "stop-color": dots[i].color || "#fff", + "stop-opacity": isFinite(dots[i].opacity) ? dots[i].opacity : 1 + })); + } + } + } + $(o, { + fill: "url('" + document.location.origin + document.location.pathname + "#" + id + "')", + opacity: 1, + "fill-opacity": 1 + }); + s.fill = E; + s.opacity = 1; + s.fillOpacity = 1; + return 1; + }, + updatePosition = function (o) { + var bbox = o.getBBox(1); + $(o.pattern, {patternTransform: o.matrix.invert() + " translate(" + bbox.x + "," + bbox.y + ")"}); + }, + addArrow = function (o, value, isEnd) { + if (o.type == "path") { + var values = Str(value).toLowerCase().split("-"), + p = o.paper, + se = isEnd ? "end" : "start", + node = o.node, + attrs = o.attrs, + stroke = attrs["stroke-width"], + i = values.length, + type = "classic", + from, + to, + dx, + refX, + attr, + w = 3, + h = 3, + t = 5; + while (i--) { + switch (values[i]) { + case "block": + case "classic": + case "oval": + case "diamond": + case "open": + case "none": + type = values[i]; + break; + case "wide": h = 5; break; + case "narrow": h = 2; break; + case "long": w = 5; break; + case "short": w = 2; break; + } + } + if (type == "open") { + w += 2; + h += 2; + t += 2; + dx = 1; + refX = isEnd ? 4 : 1; + attr = { + fill: "none", + stroke: attrs.stroke + }; + } else { + refX = dx = w / 2; + attr = { + fill: attrs.stroke, + stroke: "none" + }; + } + if (o._.arrows) { + if (isEnd) { + o._.arrows.endPath && markerCounter[o._.arrows.endPath]--; + o._.arrows.endMarker && markerCounter[o._.arrows.endMarker]--; + } else { + o._.arrows.startPath && markerCounter[o._.arrows.startPath]--; + o._.arrows.startMarker && markerCounter[o._.arrows.startMarker]--; + } + } else { + o._.arrows = {}; + } + if (type != "none") { + var pathId = "raphael-marker-" + type, + markerId = "raphael-marker-" + se + type + w + h + "-obj" + o.id; + if (!R._g.doc.getElementById(pathId)) { + p.defs.appendChild($($("path"), { + "stroke-linecap": "round", + d: markers[type], + id: pathId + })); + markerCounter[pathId] = 1; + } else { + markerCounter[pathId]++; + } + var marker = R._g.doc.getElementById(markerId), + use; + if (!marker) { + marker = $($("marker"), { + id: markerId, + markerHeight: h, + markerWidth: w, + orient: "auto", + refX: refX, + refY: h / 2 + }); + use = $($("use"), { + "xlink:href": "#" + pathId, + transform: (isEnd ? "rotate(180 " + w / 2 + " " + h / 2 + ") " : E) + "scale(" + w / t + "," + h / t + ")", + "stroke-width": (1 / ((w / t + h / t) / 2)).toFixed(4) + }); + marker.appendChild(use); + p.defs.appendChild(marker); + markerCounter[markerId] = 1; + } else { + markerCounter[markerId]++; + use = marker.getElementsByTagName("use")[0]; + } + $(use, attr); + var delta = dx * (type != "diamond" && type != "oval"); + if (isEnd) { + from = o._.arrows.startdx * stroke || 0; + to = R.getTotalLength(attrs.path) - delta * stroke; + } else { + from = delta * stroke; + to = R.getTotalLength(attrs.path) - (o._.arrows.enddx * stroke || 0); + } + attr = {}; + attr["marker-" + se] = "url(#" + markerId + ")"; + if (to || from) { + attr.d = R.getSubpath(attrs.path, from, to); + } + $(node, attr); + o._.arrows[se + "Path"] = pathId; + o._.arrows[se + "Marker"] = markerId; + o._.arrows[se + "dx"] = delta; + o._.arrows[se + "Type"] = type; + o._.arrows[se + "String"] = value; + } else { + if (isEnd) { + from = o._.arrows.startdx * stroke || 0; + to = R.getTotalLength(attrs.path) - from; + } else { + from = 0; + to = R.getTotalLength(attrs.path) - (o._.arrows.enddx * stroke || 0); + } + o._.arrows[se + "Path"] && $(node, {d: R.getSubpath(attrs.path, from, to)}); + delete o._.arrows[se + "Path"]; + delete o._.arrows[se + "Marker"]; + delete o._.arrows[se + "dx"]; + delete o._.arrows[se + "Type"]; + delete o._.arrows[se + "String"]; + } + for (attr in markerCounter) if (markerCounter[has](attr) && !markerCounter[attr]) { + var item = R._g.doc.getElementById(attr); + item && item.parentNode.removeChild(item); + } + } + }, + dasharray = { + "-": [3, 1], + ".": [1, 1], + "-.": [3, 1, 1, 1], + "-..": [3, 1, 1, 1, 1, 1], + ". ": [1, 3], + "- ": [4, 3], + "--": [8, 3], + "- .": [4, 3, 1, 3], + "--.": [8, 3, 1, 3], + "--..": [8, 3, 1, 3, 1, 3] + }, + addDashes = function (o, value, params) { + value = dasharray[Str(value).toLowerCase()]; + if (value) { + var width = o.attrs["stroke-width"] || "1", + butt = {round: width, square: width, butt: 0}[o.attrs["stroke-linecap"] || params["stroke-linecap"]] || 0, + dashes = [], + i = value.length; + while (i--) { + dashes[i] = value[i] * width + ((i % 2) ? 1 : -1) * butt; + } + $(o.node, {"stroke-dasharray": dashes.join(",")}); + } + else { + $(o.node, {"stroke-dasharray": "none"}); + } + }, + setFillAndStroke = function (o, params) { + var node = o.node, + attrs = o.attrs, + vis = node.style.visibility; + node.style.visibility = "hidden"; + for (var att in params) { + if (params[has](att)) { + if (!R._availableAttrs[has](att)) { + continue; + } + var value = params[att]; + attrs[att] = value; + switch (att) { + case "blur": + o.blur(value); + break; + case "title": + var title = node.getElementsByTagName("title"); + + // Use the existing . + if (title.length && (title = title[0])) { + title.firstChild.nodeValue = value; + } else { + title = $("title"); + var val = R._g.doc.createTextNode(value); + title.appendChild(val); + node.appendChild(title); + } + break; + case "href": + case "target": + var pn = node.parentNode; + if (pn.tagName.toLowerCase() != "a") { + var hl = $("a"); + pn.insertBefore(hl, node); + hl.appendChild(node); + pn = hl; + } + if (att == "target") { + pn.setAttributeNS(xlink, "show", value == "blank" ? "new" : value); + } else { + pn.setAttributeNS(xlink, att, value); + } + break; + case "cursor": + node.style.cursor = value; + break; + case "transform": + o.transform(value); + break; + case "arrow-start": + addArrow(o, value); + break; + case "arrow-end": + addArrow(o, value, 1); + break; + case "clip-rect": + var rect = Str(value).split(separator); + if (rect.length == 4) { + o.clip && o.clip.parentNode.parentNode.removeChild(o.clip.parentNode); + var el = $("clipPath"), + rc = $("rect"); + el.id = R.createUUID(); + $(rc, { + x: rect[0], + y: rect[1], + width: rect[2], + height: rect[3] + }); + el.appendChild(rc); + o.paper.defs.appendChild(el); + $(node, {"clip-path": "url(#" + el.id + ")"}); + o.clip = rc; + } + if (!value) { + var path = node.getAttribute("clip-path"); + if (path) { + var clip = R._g.doc.getElementById(path.replace(/(^url\(#|\)$)/g, E)); + clip && clip.parentNode.removeChild(clip); + $(node, {"clip-path": E}); + delete o.clip; + } + } + break; + case "path": + if (o.type == "path") { + $(node, {d: value ? attrs.path = R._pathToAbsolute(value) : "M0,0"}); + o._.dirty = 1; + if (o._.arrows) { + "startString" in o._.arrows && addArrow(o, o._.arrows.startString); + "endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1); + } + } + break; + case "width": + node.setAttribute(att, value); + o._.dirty = 1; + if (attrs.fx) { + att = "x"; + value = attrs.x; + } else { + break; + } + case "x": + if (attrs.fx) { + value = -attrs.x - (attrs.width || 0); + } + case "rx": + if (att == "rx" && o.type == "rect") { + break; + } + case "cx": + node.setAttribute(att, value); + o.pattern && updatePosition(o); + o._.dirty = 1; + break; + case "height": + node.setAttribute(att, value); + o._.dirty = 1; + if (attrs.fy) { + att = "y"; + value = attrs.y; + } else { + break; + } + case "y": + if (attrs.fy) { + value = -attrs.y - (attrs.height || 0); + } + case "ry": + if (att == "ry" && o.type == "rect") { + break; + } + case "cy": + node.setAttribute(att, value); + o.pattern && updatePosition(o); + o._.dirty = 1; + break; + case "r": + if (o.type == "rect") { + $(node, {rx: value, ry: value}); + } else { + node.setAttribute(att, value); + } + o._.dirty = 1; + break; + case "src": + if (o.type == "image") { + node.setAttributeNS(xlink, "href", value); + } + break; + case "stroke-width": + if (o._.sx != 1 || o._.sy != 1) { + value /= mmax(abs(o._.sx), abs(o._.sy)) || 1; + } + node.setAttribute(att, value); + if (attrs["stroke-dasharray"]) { + addDashes(o, attrs["stroke-dasharray"], params); + } + if (o._.arrows) { + "startString" in o._.arrows && addArrow(o, o._.arrows.startString); + "endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1); + } + break; + case "stroke-dasharray": + addDashes(o, value, params); + break; + case "fill": + var isURL = Str(value).match(R._ISURL); + if (isURL) { + el = $("pattern"); + var ig = $("image"); + el.id = R.createUUID(); + $(el, {x: 0, y: 0, patternUnits: "userSpaceOnUse", height: 1, width: 1}); + $(ig, {x: 0, y: 0, "xlink:href": isURL[1]}); + el.appendChild(ig); + + (function (el) { + R._preload(isURL[1], function () { + var w = this.offsetWidth, + h = this.offsetHeight; + $(el, {width: w, height: h}); + $(ig, {width: w, height: h}); + }); + })(el); + o.paper.defs.appendChild(el); + $(node, {fill: "url(#" + el.id + ")"}); + o.pattern = el; + o.pattern && updatePosition(o); + break; + } + var clr = R.getRGB(value); + if (!clr.error) { + delete params.gradient; + delete attrs.gradient; + !R.is(attrs.opacity, "undefined") && + R.is(params.opacity, "undefined") && + $(node, {opacity: attrs.opacity}); + !R.is(attrs["fill-opacity"], "undefined") && + R.is(params["fill-opacity"], "undefined") && + $(node, {"fill-opacity": attrs["fill-opacity"]}); + } else if ((o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value)) { + if ("opacity" in attrs || "fill-opacity" in attrs) { + var gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E)); + if (gradient) { + var stops = gradient.getElementsByTagName("stop"); + $(stops[stops.length - 1], {"stop-opacity": ("opacity" in attrs ? attrs.opacity : 1) * ("fill-opacity" in attrs ? attrs["fill-opacity"] : 1)}); + } + } + attrs.gradient = value; + attrs.fill = "none"; + break; + } + clr[has]("opacity") && $(node, {"fill-opacity": clr.opacity > 1 ? clr.opacity / 100 : clr.opacity}); + case "stroke": + clr = R.getRGB(value); + node.setAttribute(att, clr.hex); + att == "stroke" && clr[has]("opacity") && $(node, {"stroke-opacity": clr.opacity > 1 ? clr.opacity / 100 : clr.opacity}); + if (att == "stroke" && o._.arrows) { + "startString" in o._.arrows && addArrow(o, o._.arrows.startString); + "endString" in o._.arrows && addArrow(o, o._.arrows.endString, 1); + } + break; + case "gradient": + (o.type == "circle" || o.type == "ellipse" || Str(value).charAt() != "r") && addGradientFill(o, value); + break; + case "opacity": + if (attrs.gradient && !attrs[has]("stroke-opacity")) { + $(node, {"stroke-opacity": value > 1 ? value / 100 : value}); + } + // fall + case "fill-opacity": + if (attrs.gradient) { + gradient = R._g.doc.getElementById(node.getAttribute("fill").replace(/^url\(#|\)$/g, E)); + if (gradient) { + stops = gradient.getElementsByTagName("stop"); + $(stops[stops.length - 1], {"stop-opacity": value}); + } + break; + } + default: + att == "font-size" && (value = toInt(value, 10) + "px"); + var cssrule = att.replace(/(\-.)/g, function (w) { + return w.substring(1).toUpperCase(); + }); + node.style[cssrule] = value; + o._.dirty = 1; + node.setAttribute(att, value); + break; + } + } + } + + tuneText(o, params); + node.style.visibility = vis; + }, + leading = 1.2, + tuneText = function (el, params) { + if (el.type != "text" || !(params[has]("text") || params[has]("font") || params[has]("font-size") || params[has]("x") || params[has]("y"))) { + return; + } + var a = el.attrs, + node = el.node, + fontSize = node.firstChild ? toInt(R._g.doc.defaultView.getComputedStyle(node.firstChild, E).getPropertyValue("font-size"), 10) : 10; + + if (params[has]("text")) { + a.text = params.text; + while (node.firstChild) { + node.removeChild(node.firstChild); + } + var texts = Str(params.text).split("\n"), + tspans = [], + tspan; + for (var i = 0, ii = texts.length; i < ii; i++) { + tspan = $("tspan"); + i && $(tspan, {dy: fontSize * leading, x: a.x}); + tspan.appendChild(R._g.doc.createTextNode(texts[i])); + node.appendChild(tspan); + tspans[i] = tspan; + } + } else { + tspans = node.getElementsByTagName("tspan"); + for (i = 0, ii = tspans.length; i < ii; i++) if (i) { + $(tspans[i], {dy: fontSize * leading, x: a.x}); + } else { + $(tspans[0], {dy: 0}); + } + } + $(node, {x: a.x, y: a.y}); + el._.dirty = 1; + var bb = el._getBBox(), + dif = a.y - (bb.y + bb.height / 2); + dif && R.is(dif, "finite") && $(tspans[0], {dy: dif}); + }, + getRealNode = function (node) { + if (node.parentNode && node.parentNode.tagName.toLowerCase() === "a") { + return node.parentNode; + } else { + return node; + } + }, + Element = function (node, svg) { + var X = 0, + Y = 0; + /*\ + * Element.node + [ property (object) ] + ** + * Gives you a reference to the DOM object, so you can assign event handlers or just mess around. + ** + * Note: Don’t mess with it. + > Usage + | // draw a circle at coordinate 10,10 with radius of 10 + | var c = paper.circle(10, 10, 10); + | c.node.onclick = function () { + | c.attr("fill", "red"); + | }; + \*/ + this[0] = this.node = node; + /*\ + * Element.raphael + [ property (object) ] + ** + * Internal reference to @Raphael object. In case it is not available. + > Usage + | Raphael.el.red = function () { + | var hsb = this.paper.raphael.rgb2hsb(this.attr("fill")); + | hsb.h = 1; + | this.attr({fill: this.paper.raphael.hsb2rgb(hsb).hex}); + | } + \*/ + node.raphael = true; + /*\ + * Element.id + [ property (number) ] + ** + * Unique id of the element. Especially useful when you want to listen to events of the element, + * because all events are fired in format `<module>.<action>.<id>`. Also useful for @Paper.getById method. + \*/ + this.id = R._oid++; + node.raphaelid = this.id; + this.matrix = R.matrix(); + this.realPath = null; + /*\ + * Element.paper + [ property (object) ] + ** + * Internal reference to “paper” where object drawn. Mainly for use in plugins and element extensions. + > Usage + | Raphael.el.cross = function () { + | this.attr({fill: "red"}); + | this.paper.path("M10,10L50,50M50,10L10,50") + | .attr({stroke: "red"}); + | } + \*/ + this.paper = svg; + this.attrs = this.attrs || {}; + this._ = { + transform: [], + sx: 1, + sy: 1, + deg: 0, + dx: 0, + dy: 0, + dirty: 1 + }; + !svg.bottom && (svg.bottom = this); + /*\ + * Element.prev + [ property (object) ] + ** + * Reference to the previous element in the hierarchy. + \*/ + this.prev = svg.top; + svg.top && (svg.top.next = this); + svg.top = this; + /*\ + * Element.next + [ property (object) ] + ** + * Reference to the next element in the hierarchy. + \*/ + this.next = null; + }, + elproto = R.el; + + Element.prototype = elproto; + elproto.constructor = Element; + + R._engine.path = function (pathString, SVG) { + var el = $("path"); + SVG.canvas && SVG.canvas.appendChild(el); + var p = new Element(el, SVG); + p.type = "path"; + setFillAndStroke(p, { + fill: "none", + stroke: "#000", + path: pathString + }); + return p; + }; + /*\ + * Element.rotate + [ method ] + ** + * Deprecated! Use @Element.transform instead. + * Adds rotation by given angle around given point to the list of + * transformations of the element. + > Parameters + - deg (number) angle in degrees + - cx (number) #optional x coordinate of the centre of rotation + - cy (number) #optional y coordinate of the centre of rotation + * If cx & cy aren’t specified centre of the shape is used as a point of rotation. + = (object) @Element + \*/ + elproto.rotate = function (deg, cx, cy) { + if (this.removed) { + return this; + } + deg = Str(deg).split(separator); + if (deg.length - 1) { + cx = toFloat(deg[1]); + cy = toFloat(deg[2]); + } + deg = toFloat(deg[0]); + (cy == null) && (cx = cy); + if (cx == null || cy == null) { + var bbox = this.getBBox(1); + cx = bbox.x + bbox.width / 2; + cy = bbox.y + bbox.height / 2; + } + this.transform(this._.transform.concat([["r", deg, cx, cy]])); + return this; + }; + /*\ + * Element.scale + [ method ] + ** + * Deprecated! Use @Element.transform instead. + * Adds scale by given amount relative to given point to the list of + * transformations of the element. + > Parameters + - sx (number) horisontal scale amount + - sy (number) vertical scale amount + - cx (number) #optional x coordinate of the centre of scale + - cy (number) #optional y coordinate of the centre of scale + * If cx & cy aren’t specified centre of the shape is used instead. + = (object) @Element + \*/ + elproto.scale = function (sx, sy, cx, cy) { + if (this.removed) { + return this; + } + sx = Str(sx).split(separator); + if (sx.length - 1) { + sy = toFloat(sx[1]); + cx = toFloat(sx[2]); + cy = toFloat(sx[3]); + } + sx = toFloat(sx[0]); + (sy == null) && (sy = sx); + (cy == null) && (cx = cy); + if (cx == null || cy == null) { + var bbox = this.getBBox(1); + } + cx = cx == null ? bbox.x + bbox.width / 2 : cx; + cy = cy == null ? bbox.y + bbox.height / 2 : cy; + this.transform(this._.transform.concat([["s", sx, sy, cx, cy]])); + return this; + }; + /*\ + * Element.translate + [ method ] + ** + * Deprecated! Use @Element.transform instead. + * Adds translation by given amount to the list of transformations of the element. + > Parameters + - dx (number) horisontal shift + - dy (number) vertical shift + = (object) @Element + \*/ + elproto.translate = function (dx, dy) { + if (this.removed) { + return this; + } + dx = Str(dx).split(separator); + if (dx.length - 1) { + dy = toFloat(dx[1]); + } + dx = toFloat(dx[0]) || 0; + dy = +dy || 0; + this.transform(this._.transform.concat([["t", dx, dy]])); + return this; + }; + /*\ + * Element.transform + [ method ] + ** + * Adds transformation to the element which is separate to other attributes, + * i.e. translation doesn’t change `x` or `y` of the rectange. The format + * of transformation string is similar to the path string syntax: + | "t100,100r30,100,100s2,2,100,100r45s1.5" + * Each letter is a command. There are four commands: `t` is for translate, `r` is for rotate, `s` is for + * scale and `m` is for matrix. + * + * There are also alternative “absolute” translation, rotation and scale: `T`, `R` and `S`. They will not take previous transformation into account. For example, `...T100,0` will always move element 100 px horisontally, while `...t100,0` could move it vertically if there is `r90` before. Just compare results of `r90t100,0` and `r90T100,0`. + * + * So, the example line above could be read like “translate by 100, 100; rotate 30° around 100, 100; scale twice around 100, 100; + * rotate 45° around centre; scale 1.5 times relative to centre”. As you can see rotate and scale commands have origin + * coordinates as optional parameters, the default is the centre point of the element. + * Matrix accepts six parameters. + > Usage + | var el = paper.rect(10, 20, 300, 200); + | // translate 100, 100, rotate 45°, translate -100, 0 + | el.transform("t100,100r45t-100,0"); + | // if you want you can append or prepend transformations + | el.transform("...t50,50"); + | el.transform("s2..."); + | // or even wrap + | el.transform("t50,50...t-50-50"); + | // to reset transformation call method with empty string + | el.transform(""); + | // to get current value call it without parameters + | console.log(el.transform()); + > Parameters + - tstr (string) #optional transformation string + * If tstr isn’t specified + = (string) current transformation string + * else + = (object) @Element + \*/ + elproto.transform = function (tstr) { + var _ = this._; + if (tstr == null) { + return _.transform; + } + R._extractTransform(this, tstr); + + this.clip && $(this.clip, {transform: this.matrix.invert()}); + this.pattern && updatePosition(this); + this.node && $(this.node, {transform: this.matrix}); + + if (_.sx != 1 || _.sy != 1) { + var sw = this.attrs[has]("stroke-width") ? this.attrs["stroke-width"] : 1; + this.attr({"stroke-width": sw}); + } + + return this; + }; + /*\ + * Element.hide + [ method ] + ** + * Makes element invisible. See @Element.show. + = (object) @Element + \*/ + elproto.hide = function () { + if(!this.removed) this.node.style.display = "none"; + return this; + }; + /*\ + * Element.show + [ method ] + ** + * Makes element visible. See @Element.hide. + = (object) @Element + \*/ + elproto.show = function () { + if(!this.removed) this.node.style.display = ""; + return this; + }; + /*\ + * Element.remove + [ method ] + ** + * Removes element from the paper. + \*/ + elproto.remove = function () { + var node = getRealNode(this.node); + if (this.removed || !node.parentNode) { + return; + } + var paper = this.paper; + paper.__set__ && paper.__set__.exclude(this); + eve.unbind("raphael.*.*." + this.id); + if (this.gradient) { + paper.defs.removeChild(this.gradient); + } + R._tear(this, paper); + + node.parentNode.removeChild(node); + + // Remove custom data for element + this.removeData(); + + for (var i in this) { + this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null; + } + this.removed = true; + }; + elproto._getBBox = function () { + if (this.node.style.display == "none") { + this.show(); + var hide = true; + } + var canvasHidden = false, + containerStyle; + if (this.paper.canvas.parentElement) { + containerStyle = this.paper.canvas.parentElement.style; + } //IE10+ can't find parentElement + else if (this.paper.canvas.parentNode) { + containerStyle = this.paper.canvas.parentNode.style; + } + + if(containerStyle && containerStyle.display == "none") { + canvasHidden = true; + containerStyle.display = ""; + } + var bbox = {}; + try { + bbox = this.node.getBBox(); + } catch(e) { + // Firefox 3.0.x, 25.0.1 (probably more versions affected) play badly here - possible fix + bbox = { + x: this.node.clientLeft, + y: this.node.clientTop, + width: this.node.clientWidth, + height: this.node.clientHeight + } + } finally { + bbox = bbox || {}; + if(canvasHidden){ + containerStyle.display = "none"; + } + } + hide && this.hide(); + return bbox; + }; + /*\ + * Element.attr + [ method ] + ** + * Sets the attributes of the element. + > Parameters + - attrName (string) attribute’s name + - value (string) value + * or + - params (object) object of name/value pairs + * or + - attrName (string) attribute’s name + * or + - attrNames (array) in this case method returns array of current values for given attribute names + = (object) @Element if attrsName & value or params are passed in. + = (...) value of the attribute if only attrsName is passed in. + = (array) array of values of the attribute if attrsNames is passed in. + = (object) object of attributes if nothing is passed in. + > Possible parameters + # <p>Please refer to the <a href="http://www.w3.org/TR/SVG/" title="The W3C Recommendation for the SVG language describes these properties in detail.">SVG specification</a> for an explanation of these parameters.</p> + o arrow-end (string) arrowhead on the end of the path. The format for string is `<type>[-<width>[-<length>]]`. Possible types: `classic`, `block`, `open`, `oval`, `diamond`, `none`, width: `wide`, `narrow`, `medium`, length: `long`, `short`, `midium`. + o clip-rect (string) comma or space separated values: x, y, width and height + o cursor (string) CSS type of the cursor + o cx (number) the x-axis coordinate of the center of the circle, or ellipse + o cy (number) the y-axis coordinate of the center of the circle, or ellipse + o fill (string) colour, gradient or image + o fill-opacity (number) + o font (string) + o font-family (string) + o font-size (number) font size in pixels + o font-weight (string) + o height (number) + o href (string) URL, if specified element behaves as hyperlink + o opacity (number) + o path (string) SVG path string format + o r (number) radius of the circle, ellipse or rounded corner on the rect + o rx (number) horisontal radius of the ellipse + o ry (number) vertical radius of the ellipse + o src (string) image URL, only works for @Element.image element + o stroke (string) stroke colour + o stroke-dasharray (string) [“”, “none”, “`-`”, “`.`”, “`-.`”, “`-..`”, “`. `”, “`- `”, “`--`”, “`- .`”, “`--.`”, “`--..`”] + o stroke-linecap (string) [“`butt`”, “`square`”, “`round`”] + o stroke-linejoin (string) [“`bevel`”, “`round`”, “`miter`”] + o stroke-miterlimit (number) + o stroke-opacity (number) + o stroke-width (number) stroke width in pixels, default is '1' + o target (string) used with href + o text (string) contents of the text element. Use `\n` for multiline text + o text-anchor (string) [“`start`”, “`middle`”, “`end`”], default is “`middle`” + o title (string) will create tooltip with a given text + o transform (string) see @Element.transform + o width (number) + o x (number) + o y (number) + > Gradients + * Linear gradient format: “`‹angle›-‹colour›[-‹colour›[:‹offset›]]*-‹colour›`”, example: “`90-#fff-#000`” – 90° + * gradient from white to black or “`0-#fff-#f00:20-#000`” – 0° gradient from white via red (at 20%) to black. + * + * radial gradient: “`r[(‹fx›, ‹fy›)]‹colour›[-‹colour›[:‹offset›]]*-‹colour›`”, example: “`r#fff-#000`” – + * gradient from white to black or “`r(0.25, 0.75)#fff-#000`” – gradient from white to black with focus point + * at 0.25, 0.75. Focus point coordinates are in 0..1 range. Radial gradients can only be applied to circles and ellipses. + > Path String + # <p>Please refer to <a href="http://www.w3.org/TR/SVG/paths.html#PathData" title="Details of a path’s data attribute’s format are described in the SVG specification.">SVG documentation regarding path string</a>. Raphaël fully supports it.</p> + > Colour Parsing + # <ul> + # <li>Colour name (“<code>red</code>”, “<code>green</code>”, “<code>cornflowerblue</code>”, etc)</li> + # <li>#••• — shortened HTML colour: (“<code>#000</code>”, “<code>#fc0</code>”, etc)</li> + # <li>#•••••• — full length HTML colour: (“<code>#000000</code>”, “<code>#bd2300</code>”)</li> + # <li>rgb(•••, •••, •••) — red, green and blue channels’ values: (“<code>rgb(200, 100, 0)</code>”)</li> + # <li>rgb(•••%, •••%, •••%) — same as above, but in %: (“<code>rgb(100%, 175%, 0%)</code>”)</li> + # <li>rgba(•••, •••, •••, •••) — red, green and blue channels’ values: (“<code>rgba(200, 100, 0, .5)</code>”)</li> + # <li>rgba(•••%, •••%, •••%, •••%) — same as above, but in %: (“<code>rgba(100%, 175%, 0%, 50%)</code>”)</li> + # <li>hsb(•••, •••, •••) — hue, saturation and brightness values: (“<code>hsb(0.5, 0.25, 1)</code>”)</li> + # <li>hsb(•••%, •••%, •••%) — same as above, but in %</li> + # <li>hsba(•••, •••, •••, •••) — same as above, but with opacity</li> + # <li>hsl(•••, •••, •••) — almost the same as hsb, see <a href="http://en.wikipedia.org/wiki/HSL_and_HSV" title="HSL and HSV - Wikipedia, the free encyclopedia">Wikipedia page</a></li> + # <li>hsl(•••%, •••%, •••%) — same as above, but in %</li> + # <li>hsla(•••, •••, •••, •••) — same as above, but with opacity</li> + # <li>Optionally for hsb and hsl you could specify hue as a degree: “<code>hsl(240deg, 1, .5)</code>” or, if you want to go fancy, “<code>hsl(240°, 1, .5)</code>”</li> + # </ul> + \*/ + elproto.attr = function (name, value) { + if (this.removed) { + return this; + } + if (name == null) { + var res = {}; + for (var a in this.attrs) if (this.attrs[has](a)) { + res[a] = this.attrs[a]; + } + res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient; + res.transform = this._.transform; + return res; + } + if (value == null && R.is(name, "string")) { + if (name == "fill" && this.attrs.fill == "none" && this.attrs.gradient) { + return this.attrs.gradient; + } + if (name == "transform") { + return this._.transform; + } + var names = name.split(separator), + out = {}; + for (var i = 0, ii = names.length; i < ii; i++) { + name = names[i]; + if (name in this.attrs) { + out[name] = this.attrs[name]; + } else if (R.is(this.paper.customAttributes[name], "function")) { + out[name] = this.paper.customAttributes[name].def; + } else { + out[name] = R._availableAttrs[name]; + } + } + return ii - 1 ? out : out[names[0]]; + } + if (value == null && R.is(name, "array")) { + out = {}; + for (i = 0, ii = name.length; i < ii; i++) { + out[name[i]] = this.attr(name[i]); + } + return out; + } + if (value != null) { + var params = {}; + params[name] = value; + } else if (name != null && R.is(name, "object")) { + params = name; + } + for (var key in params) { + eve("raphael.attr." + key + "." + this.id, this, params[key]); + } + for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) { + var par = this.paper.customAttributes[key].apply(this, [].concat(params[key])); + this.attrs[key] = params[key]; + for (var subkey in par) if (par[has](subkey)) { + params[subkey] = par[subkey]; + } + } + setFillAndStroke(this, params); + return this; + }; + /*\ + * Element.toFront + [ method ] + ** + * Moves the element so it is the closest to the viewer’s eyes, on top of other elements. + = (object) @Element + \*/ + elproto.toFront = function () { + if (this.removed) { + return this; + } + var node = getRealNode(this.node); + node.parentNode.appendChild(node); + var svg = this.paper; + svg.top != this && R._tofront(this, svg); + return this; + }; + /*\ + * Element.toBack + [ method ] + ** + * Moves the element so it is the furthest from the viewer’s eyes, behind other elements. + = (object) @Element + \*/ + elproto.toBack = function () { + if (this.removed) { + return this; + } + var node = getRealNode(this.node); + var parentNode = node.parentNode; + parentNode.insertBefore(node, parentNode.firstChild); + R._toback(this, this.paper); + var svg = this.paper; + return this; + }; + /*\ + * Element.insertAfter + [ method ] + ** + * Inserts current object after the given one. + = (object) @Element + \*/ + elproto.insertAfter = function (element) { + if (this.removed || !element) { + return this; + } + + var node = getRealNode(this.node); + var afterNode = getRealNode(element.node || element[element.length - 1].node); + if (afterNode.nextSibling) { + afterNode.parentNode.insertBefore(node, afterNode.nextSibling); + } else { + afterNode.parentNode.appendChild(node); + } + R._insertafter(this, element, this.paper); + return this; + }; + /*\ + * Element.insertBefore + [ method ] + ** + * Inserts current object before the given one. + = (object) @Element + \*/ + elproto.insertBefore = function (element) { + if (this.removed || !element) { + return this; + } + + var node = getRealNode(this.node); + var beforeNode = getRealNode(element.node || element[0].node); + beforeNode.parentNode.insertBefore(node, beforeNode); + R._insertbefore(this, element, this.paper); + return this; + }; + elproto.blur = function (size) { + // Experimental. No Safari support. Use it on your own risk. + var t = this; + if (+size !== 0) { + var fltr = $("filter"), + blur = $("feGaussianBlur"); + t.attrs.blur = size; + fltr.id = R.createUUID(); + $(blur, {stdDeviation: +size || 1.5}); + fltr.appendChild(blur); + t.paper.defs.appendChild(fltr); + t._blur = fltr; + $(t.node, {filter: "url(#" + fltr.id + ")"}); + } else { + if (t._blur) { + t._blur.parentNode.removeChild(t._blur); + delete t._blur; + delete t.attrs.blur; + } + t.node.removeAttribute("filter"); + } + return t; + }; + R._engine.circle = function (svg, x, y, r) { + var el = $("circle"); + svg.canvas && svg.canvas.appendChild(el); + var res = new Element(el, svg); + res.attrs = {cx: x, cy: y, r: r, fill: "none", stroke: "#000"}; + res.type = "circle"; + $(el, res.attrs); + return res; + }; + R._engine.rect = function (svg, x, y, w, h, r) { + var el = $("rect"); + svg.canvas && svg.canvas.appendChild(el); + var res = new Element(el, svg); + res.attrs = {x: x, y: y, width: w, height: h, rx: r || 0, ry: r || 0, fill: "none", stroke: "#000"}; + res.type = "rect"; + $(el, res.attrs); + return res; + }; + R._engine.ellipse = function (svg, x, y, rx, ry) { + var el = $("ellipse"); + svg.canvas && svg.canvas.appendChild(el); + var res = new Element(el, svg); + res.attrs = {cx: x, cy: y, rx: rx, ry: ry, fill: "none", stroke: "#000"}; + res.type = "ellipse"; + $(el, res.attrs); + return res; + }; + R._engine.image = function (svg, src, x, y, w, h) { + var el = $("image"); + $(el, {x: x, y: y, width: w, height: h, preserveAspectRatio: "none"}); + el.setAttributeNS(xlink, "href", src); + svg.canvas && svg.canvas.appendChild(el); + var res = new Element(el, svg); + res.attrs = {x: x, y: y, width: w, height: h, src: src}; + res.type = "image"; + return res; + }; + R._engine.text = function (svg, x, y, text) { + var el = $("text"); + svg.canvas && svg.canvas.appendChild(el); + var res = new Element(el, svg); + res.attrs = { + x: x, + y: y, + "text-anchor": "middle", + text: text, + "font-family": R._availableAttrs["font-family"], + "font-size": R._availableAttrs["font-size"], + stroke: "none", + fill: "#000" + }; + res.type = "text"; + setFillAndStroke(res, res.attrs); + return res; + }; + R._engine.setSize = function (width, height) { + this.width = width || this.width; + this.height = height || this.height; + this.canvas.setAttribute("width", this.width); + this.canvas.setAttribute("height", this.height); + if (this._viewBox) { + this.setViewBox.apply(this, this._viewBox); + } + return this; + }; + R._engine.create = function () { + var con = R._getContainer.apply(0, arguments), + container = con && con.container, + x = con.x, + y = con.y, + width = con.width, + height = con.height; + if (!container) { + throw new Error("SVG container not found."); + } + var cnvs = $("svg"), + css = "overflow:hidden;", + isFloating; + x = x || 0; + y = y || 0; + width = width || 512; + height = height || 342; + $(cnvs, { + height: height, + version: 1.1, + width: width, + xmlns: "http://www.w3.org/2000/svg", + "xmlns:xlink": "http://www.w3.org/1999/xlink" + }); + if (container == 1) { + cnvs.style.cssText = css + "position:absolute;left:" + x + "px;top:" + y + "px"; + R._g.doc.body.appendChild(cnvs); + isFloating = 1; + } else { + cnvs.style.cssText = css + "position:relative"; + if (container.firstChild) { + container.insertBefore(cnvs, container.firstChild); + } else { + container.appendChild(cnvs); + } + } + container = new R._Paper; + container.width = width; + container.height = height; + container.canvas = cnvs; + container.clear(); + container._left = container._top = 0; + isFloating && (container.renderfix = function () {}); + container.renderfix(); + return container; + }; + R._engine.setViewBox = function (x, y, w, h, fit) { + eve("raphael.setViewBox", this, this._viewBox, [x, y, w, h, fit]); + var paperSize = this.getSize(), + size = mmax(w / paperSize.width, h / paperSize.height), + top = this.top, + aspectRatio = fit ? "xMidYMid meet" : "xMinYMin", + vb, + sw; + if (x == null) { + if (this._vbSize) { + size = 1; + } + delete this._vbSize; + vb = "0 0 " + this.width + S + this.height; + } else { + this._vbSize = size; + vb = x + S + y + S + w + S + h; + } + $(this.canvas, { + viewBox: vb, + preserveAspectRatio: aspectRatio + }); + while (size && top) { + sw = "stroke-width" in top.attrs ? top.attrs["stroke-width"] : 1; + top.attr({"stroke-width": sw}); + top._.dirty = 1; + top._.dirtyT = 1; + top = top.prev; + } + this._viewBox = [x, y, w, h, !!fit]; + return this; + }; + /*\ + * Paper.renderfix + [ method ] + ** + * Fixes the issue of Firefox and IE9 regarding subpixel rendering. If paper is dependant + * on other elements after reflow it could shift half pixel which cause for lines to lost their crispness. + * This method fixes the issue. + ** + Special thanks to Mariusz Nowak (http://www.medikoo.com/) for this method. + \*/ + R.prototype.renderfix = function () { + var cnvs = this.canvas, + s = cnvs.style, + pos; + try { + pos = cnvs.getScreenCTM() || cnvs.createSVGMatrix(); + } catch (e) { + pos = cnvs.createSVGMatrix(); + } + var left = -pos.e % 1, + top = -pos.f % 1; + if (left || top) { + if (left) { + this._left = (this._left + left) % 1; + s.left = this._left + "px"; + } + if (top) { + this._top = (this._top + top) % 1; + s.top = this._top + "px"; + } + } + }; + /*\ + * Paper.clear + [ method ] + ** + * Clears the paper, i.e. removes all the elements. + \*/ + R.prototype.clear = function () { + R.eve("raphael.clear", this); + var c = this.canvas; + while (c.firstChild) { + c.removeChild(c.firstChild); + } + this.bottom = this.top = null; + (this.desc = $("desc")).appendChild(R._g.doc.createTextNode("Created with Rapha\xebl " + R.version)); + c.appendChild(this.desc); + c.appendChild(this.defs = $("defs")); + }; + /*\ + * Paper.remove + [ method ] + ** + * Removes the paper from the DOM. + \*/ + R.prototype.remove = function () { + eve("raphael.remove", this); + this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas); + for (var i in this) { + this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null; + } + }; + var setproto = R.st; + for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) { + setproto[method] = (function (methodname) { + return function () { + var arg = arguments; + return this.forEach(function (el) { + el[methodname].apply(el, arg); + }); + }; + })(method); + } +})); + +// ┌─────────────────────────────────────────────────────────────────────┐ \\ +// │ Raphaël 2.1.4 - JavaScript Vector Library │ \\ +// ├─────────────────────────────────────────────────────────────────────┤ \\ +// │ VML Module │ \\ +// ├─────────────────────────────────────────────────────────────────────┤ \\ +// │ Copyright (c) 2008-2011 Dmitry Baranovskiy (http://raphaeljs.com) │ \\ +// │ Copyright (c) 2008-2011 Sencha Labs (http://sencha.com) │ \\ +// │ Licensed under the MIT (http://raphaeljs.com/license.html) license. │ \\ +// └─────────────────────────────────────────────────────────────────────┘ \\ + +(function (glob, factory) { + if (typeof define === "function" && define.amd) { + define("raphael.vml", ["raphael.core"], function(raphael) { + return factory(raphael); + }); + } else if (typeof exports === "object") { + factory(require("raphael")); + } else { + factory(glob.Raphael); + } +}(this, function(R) { + if (R && !R.vml) { + return; + } + + var has = "hasOwnProperty", + Str = String, + toFloat = parseFloat, + math = Math, + round = math.round, + mmax = math.max, + mmin = math.min, + abs = math.abs, + fillString = "fill", + separator = /[, ]+/, + eve = R.eve, + ms = " progid:DXImageTransform.Microsoft", + S = " ", + E = "", + map = {M: "m", L: "l", C: "c", Z: "x", m: "t", l: "r", c: "v", z: "x"}, + bites = /([clmz]),?([^clmz]*)/gi, + blurregexp = / progid:\S+Blur\([^\)]+\)/g, + val = /-?[^,\s-]+/g, + cssDot = "position:absolute;left:0;top:0;width:1px;height:1px;behavior:url(#default#VML)", + zoom = 21600, + pathTypes = {path: 1, rect: 1, image: 1}, + ovalTypes = {circle: 1, ellipse: 1}, + path2vml = function (path) { + var total = /[ahqstv]/ig, + command = R._pathToAbsolute; + Str(path).match(total) && (command = R._path2curve); + total = /[clmz]/g; + if (command == R._pathToAbsolute && !Str(path).match(total)) { + var res = Str(path).replace(bites, function (all, command, args) { + var vals = [], + isMove = command.toLowerCase() == "m", + res = map[command]; + args.replace(val, function (value) { + if (isMove && vals.length == 2) { + res += vals + map[command == "m" ? "l" : "L"]; + vals = []; + } + vals.push(round(value * zoom)); + }); + return res + vals; + }); + return res; + } + var pa = command(path), p, r; + res = []; + for (var i = 0, ii = pa.length; i < ii; i++) { + p = pa[i]; + r = pa[i][0].toLowerCase(); + r == "z" && (r = "x"); + for (var j = 1, jj = p.length; j < jj; j++) { + r += round(p[j] * zoom) + (j != jj - 1 ? "," : E); + } + res.push(r); + } + return res.join(S); + }, + compensation = function (deg, dx, dy) { + var m = R.matrix(); + m.rotate(-deg, .5, .5); + return { + dx: m.x(dx, dy), + dy: m.y(dx, dy) + }; + }, + setCoords = function (p, sx, sy, dx, dy, deg) { + var _ = p._, + m = p.matrix, + fillpos = _.fillpos, + o = p.node, + s = o.style, + y = 1, + flip = "", + dxdy, + kx = zoom / sx, + ky = zoom / sy; + s.visibility = "hidden"; + if (!sx || !sy) { + return; + } + o.coordsize = abs(kx) + S + abs(ky); + s.rotation = deg * (sx * sy < 0 ? -1 : 1); + if (deg) { + var c = compensation(deg, dx, dy); + dx = c.dx; + dy = c.dy; + } + sx < 0 && (flip += "x"); + sy < 0 && (flip += " y") && (y = -1); + s.flip = flip; + o.coordorigin = (dx * -kx) + S + (dy * -ky); + if (fillpos || _.fillsize) { + var fill = o.getElementsByTagName(fillString); + fill = fill && fill[0]; + o.removeChild(fill); + if (fillpos) { + c = compensation(deg, m.x(fillpos[0], fillpos[1]), m.y(fillpos[0], fillpos[1])); + fill.position = c.dx * y + S + c.dy * y; + } + if (_.fillsize) { + fill.size = _.fillsize[0] * abs(sx) + S + _.fillsize[1] * abs(sy); + } + o.appendChild(fill); + } + s.visibility = "visible"; + }; + R.toString = function () { + return "Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\xebl " + this.version; + }; + var addArrow = function (o, value, isEnd) { + var values = Str(value).toLowerCase().split("-"), + se = isEnd ? "end" : "start", + i = values.length, + type = "classic", + w = "medium", + h = "medium"; + while (i--) { + switch (values[i]) { + case "block": + case "classic": + case "oval": + case "diamond": + case "open": + case "none": + type = values[i]; + break; + case "wide": + case "narrow": h = values[i]; break; + case "long": + case "short": w = values[i]; break; + } + } + var stroke = o.node.getElementsByTagName("stroke")[0]; + stroke[se + "arrow"] = type; + stroke[se + "arrowlength"] = w; + stroke[se + "arrowwidth"] = h; + }, + setFillAndStroke = function (o, params) { + // o.paper.canvas.style.display = "none"; + o.attrs = o.attrs || {}; + var node = o.node, + a = o.attrs, + s = node.style, + xy, + newpath = pathTypes[o.type] && (params.x != a.x || params.y != a.y || params.width != a.width || params.height != a.height || params.cx != a.cx || params.cy != a.cy || params.rx != a.rx || params.ry != a.ry || params.r != a.r), + isOval = ovalTypes[o.type] && (a.cx != params.cx || a.cy != params.cy || a.r != params.r || a.rx != params.rx || a.ry != params.ry), + res = o; + + + for (var par in params) if (params[has](par)) { + a[par] = params[par]; + } + if (newpath) { + a.path = R._getPath[o.type](o); + o._.dirty = 1; + } + params.href && (node.href = params.href); + params.title && (node.title = params.title); + params.target && (node.target = params.target); + params.cursor && (s.cursor = params.cursor); + "blur" in params && o.blur(params.blur); + if (params.path && o.type == "path" || newpath) { + node.path = path2vml(~Str(a.path).toLowerCase().indexOf("r") ? R._pathToAbsolute(a.path) : a.path); + o._.dirty = 1; + if (o.type == "image") { + o._.fillpos = [a.x, a.y]; + o._.fillsize = [a.width, a.height]; + setCoords(o, 1, 1, 0, 0, 0); + } + } + "transform" in params && o.transform(params.transform); + if (isOval) { + var cx = +a.cx, + cy = +a.cy, + rx = +a.rx || +a.r || 0, + ry = +a.ry || +a.r || 0; + node.path = R.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x", round((cx - rx) * zoom), round((cy - ry) * zoom), round((cx + rx) * zoom), round((cy + ry) * zoom), round(cx * zoom)); + o._.dirty = 1; + } + if ("clip-rect" in params) { + var rect = Str(params["clip-rect"]).split(separator); + if (rect.length == 4) { + rect[2] = +rect[2] + (+rect[0]); + rect[3] = +rect[3] + (+rect[1]); + var div = node.clipRect || R._g.doc.createElement("div"), + dstyle = div.style; + dstyle.clip = R.format("rect({1}px {2}px {3}px {0}px)", rect); + if (!node.clipRect) { + dstyle.position = "absolute"; + dstyle.top = 0; + dstyle.left = 0; + dstyle.width = o.paper.width + "px"; + dstyle.height = o.paper.height + "px"; + node.parentNode.insertBefore(div, node); + div.appendChild(node); + node.clipRect = div; + } + } + if (!params["clip-rect"]) { + node.clipRect && (node.clipRect.style.clip = "auto"); + } + } + if (o.textpath) { + var textpathStyle = o.textpath.style; + params.font && (textpathStyle.font = params.font); + params["font-family"] && (textpathStyle.fontFamily = '"' + params["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g, E) + '"'); + params["font-size"] && (textpathStyle.fontSize = params["font-size"]); + params["font-weight"] && (textpathStyle.fontWeight = params["font-weight"]); + params["font-style"] && (textpathStyle.fontStyle = params["font-style"]); + } + if ("arrow-start" in params) { + addArrow(res, params["arrow-start"]); + } + if ("arrow-end" in params) { + addArrow(res, params["arrow-end"], 1); + } + if (params.opacity != null || + params["stroke-width"] != null || + params.fill != null || + params.src != null || + params.stroke != null || + params["stroke-width"] != null || + params["stroke-opacity"] != null || + params["fill-opacity"] != null || + params["stroke-dasharray"] != null || + params["stroke-miterlimit"] != null || + params["stroke-linejoin"] != null || + params["stroke-linecap"] != null) { + var fill = node.getElementsByTagName(fillString), + newfill = false; + fill = fill && fill[0]; + !fill && (newfill = fill = createNode(fillString)); + if (o.type == "image" && params.src) { + fill.src = params.src; + } + params.fill && (fill.on = true); + if (fill.on == null || params.fill == "none" || params.fill === null) { + fill.on = false; + } + if (fill.on && params.fill) { + var isURL = Str(params.fill).match(R._ISURL); + if (isURL) { + fill.parentNode == node && node.removeChild(fill); + fill.rotate = true; + fill.src = isURL[1]; + fill.type = "tile"; + var bbox = o.getBBox(1); + fill.position = bbox.x + S + bbox.y; + o._.fillpos = [bbox.x, bbox.y]; + + R._preload(isURL[1], function () { + o._.fillsize = [this.offsetWidth, this.offsetHeight]; + }); + } else { + fill.color = R.getRGB(params.fill).hex; + fill.src = E; + fill.type = "solid"; + if (R.getRGB(params.fill).error && (res.type in {circle: 1, ellipse: 1} || Str(params.fill).charAt() != "r") && addGradientFill(res, params.fill, fill)) { + a.fill = "none"; + a.gradient = params.fill; + fill.rotate = false; + } + } + } + if ("fill-opacity" in params || "opacity" in params) { + var opacity = ((+a["fill-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+R.getRGB(params.fill).o + 1 || 2) - 1); + opacity = mmin(mmax(opacity, 0), 1); + fill.opacity = opacity; + if (fill.src) { + fill.color = "none"; + } + } + node.appendChild(fill); + var stroke = (node.getElementsByTagName("stroke") && node.getElementsByTagName("stroke")[0]), + newstroke = false; + !stroke && (newstroke = stroke = createNode("stroke")); + if ((params.stroke && params.stroke != "none") || + params["stroke-width"] || + params["stroke-opacity"] != null || + params["stroke-dasharray"] || + params["stroke-miterlimit"] || + params["stroke-linejoin"] || + params["stroke-linecap"]) { + stroke.on = true; + } + (params.stroke == "none" || params.stroke === null || stroke.on == null || params.stroke == 0 || params["stroke-width"] == 0) && (stroke.on = false); + var strokeColor = R.getRGB(params.stroke); + stroke.on && params.stroke && (stroke.color = strokeColor.hex); + opacity = ((+a["stroke-opacity"] + 1 || 2) - 1) * ((+a.opacity + 1 || 2) - 1) * ((+strokeColor.o + 1 || 2) - 1); + var width = (toFloat(params["stroke-width"]) || 1) * .75; + opacity = mmin(mmax(opacity, 0), 1); + params["stroke-width"] == null && (width = a["stroke-width"]); + params["stroke-width"] && (stroke.weight = width); + width && width < 1 && (opacity *= width) && (stroke.weight = 1); + stroke.opacity = opacity; + + params["stroke-linejoin"] && (stroke.joinstyle = params["stroke-linejoin"] || "miter"); + stroke.miterlimit = params["stroke-miterlimit"] || 8; + params["stroke-linecap"] && (stroke.endcap = params["stroke-linecap"] == "butt" ? "flat" : params["stroke-linecap"] == "square" ? "square" : "round"); + if ("stroke-dasharray" in params) { + var dasharray = { + "-": "shortdash", + ".": "shortdot", + "-.": "shortdashdot", + "-..": "shortdashdotdot", + ". ": "dot", + "- ": "dash", + "--": "longdash", + "- .": "dashdot", + "--.": "longdashdot", + "--..": "longdashdotdot" + }; + stroke.dashstyle = dasharray[has](params["stroke-dasharray"]) ? dasharray[params["stroke-dasharray"]] : E; + } + newstroke && node.appendChild(stroke); + } + if (res.type == "text") { + res.paper.canvas.style.display = E; + var span = res.paper.span, + m = 100, + fontSize = a.font && a.font.match(/\d+(?:\.\d*)?(?=px)/); + s = span.style; + a.font && (s.font = a.font); + a["font-family"] && (s.fontFamily = a["font-family"]); + a["font-weight"] && (s.fontWeight = a["font-weight"]); + a["font-style"] && (s.fontStyle = a["font-style"]); + fontSize = toFloat(a["font-size"] || fontSize && fontSize[0]) || 10; + s.fontSize = fontSize * m + "px"; + res.textpath.string && (span.innerHTML = Str(res.textpath.string).replace(/</g, "<").replace(/&/g, "&").replace(/\n/g, "<br>")); + var brect = span.getBoundingClientRect(); + res.W = a.w = (brect.right - brect.left) / m; + res.H = a.h = (brect.bottom - brect.top) / m; + // res.paper.canvas.style.display = "none"; + res.X = a.x; + res.Y = a.y + res.H / 2; + + ("x" in params || "y" in params) && (res.path.v = R.format("m{0},{1}l{2},{1}", round(a.x * zoom), round(a.y * zoom), round(a.x * zoom) + 1)); + var dirtyattrs = ["x", "y", "text", "font", "font-family", "font-weight", "font-style", "font-size"]; + for (var d = 0, dd = dirtyattrs.length; d < dd; d++) if (dirtyattrs[d] in params) { + res._.dirty = 1; + break; + } + + // text-anchor emulation + switch (a["text-anchor"]) { + case "start": + res.textpath.style["v-text-align"] = "left"; + res.bbx = res.W / 2; + break; + case "end": + res.textpath.style["v-text-align"] = "right"; + res.bbx = -res.W / 2; + break; + default: + res.textpath.style["v-text-align"] = "center"; + res.bbx = 0; + break; + } + res.textpath.style["v-text-kern"] = true; + } + // res.paper.canvas.style.display = E; + }, + addGradientFill = function (o, gradient, fill) { + o.attrs = o.attrs || {}; + var attrs = o.attrs, + pow = Math.pow, + opacity, + oindex, + type = "linear", + fxfy = ".5 .5"; + o.attrs.gradient = gradient; + gradient = Str(gradient).replace(R._radial_gradient, function (all, fx, fy) { + type = "radial"; + if (fx && fy) { + fx = toFloat(fx); + fy = toFloat(fy); + pow(fx - .5, 2) + pow(fy - .5, 2) > .25 && (fy = math.sqrt(.25 - pow(fx - .5, 2)) * ((fy > .5) * 2 - 1) + .5); + fxfy = fx + S + fy; + } + return E; + }); + gradient = gradient.split(/\s*\-\s*/); + if (type == "linear") { + var angle = gradient.shift(); + angle = -toFloat(angle); + if (isNaN(angle)) { + return null; + } + } + var dots = R._parseDots(gradient); + if (!dots) { + return null; + } + o = o.shape || o.node; + if (dots.length) { + o.removeChild(fill); + fill.on = true; + fill.method = "none"; + fill.color = dots[0].color; + fill.color2 = dots[dots.length - 1].color; + var clrs = []; + for (var i = 0, ii = dots.length; i < ii; i++) { + dots[i].offset && clrs.push(dots[i].offset + S + dots[i].color); + } + fill.colors = clrs.length ? clrs.join() : "0% " + fill.color; + if (type == "radial") { + fill.type = "gradientTitle"; + fill.focus = "100%"; + fill.focussize = "0 0"; + fill.focusposition = fxfy; + fill.angle = 0; + } else { + // fill.rotate= true; + fill.type = "gradient"; + fill.angle = (270 - angle) % 360; + } + o.appendChild(fill); + } + return 1; + }, + Element = function (node, vml) { + this[0] = this.node = node; + node.raphael = true; + this.id = R._oid++; + node.raphaelid = this.id; + this.X = 0; + this.Y = 0; + this.attrs = {}; + this.paper = vml; + this.matrix = R.matrix(); + this._ = { + transform: [], + sx: 1, + sy: 1, + dx: 0, + dy: 0, + deg: 0, + dirty: 1, + dirtyT: 1 + }; + !vml.bottom && (vml.bottom = this); + this.prev = vml.top; + vml.top && (vml.top.next = this); + vml.top = this; + this.next = null; + }; + var elproto = R.el; + + Element.prototype = elproto; + elproto.constructor = Element; + elproto.transform = function (tstr) { + if (tstr == null) { + return this._.transform; + } + var vbs = this.paper._viewBoxShift, + vbt = vbs ? "s" + [vbs.scale, vbs.scale] + "-1-1t" + [vbs.dx, vbs.dy] : E, + oldt; + if (vbs) { + oldt = tstr = Str(tstr).replace(/\.{3}|\u2026/g, this._.transform || E); + } + R._extractTransform(this, vbt + tstr); + var matrix = this.matrix.clone(), + skew = this.skew, + o = this.node, + split, + isGrad = ~Str(this.attrs.fill).indexOf("-"), + isPatt = !Str(this.attrs.fill).indexOf("url("); + matrix.translate(1, 1); + if (isPatt || isGrad || this.type == "image") { + skew.matrix = "1 0 0 1"; + skew.offset = "0 0"; + split = matrix.split(); + if ((isGrad && split.noRotation) || !split.isSimple) { + o.style.filter = matrix.toFilter(); + var bb = this.getBBox(), + bbt = this.getBBox(1), + dx = bb.x - bbt.x, + dy = bb.y - bbt.y; + o.coordorigin = (dx * -zoom) + S + (dy * -zoom); + setCoords(this, 1, 1, dx, dy, 0); + } else { + o.style.filter = E; + setCoords(this, split.scalex, split.scaley, split.dx, split.dy, split.rotate); + } + } else { + o.style.filter = E; + skew.matrix = Str(matrix); + skew.offset = matrix.offset(); + } + if (oldt !== null) { // empty string value is true as well + this._.transform = oldt; + R._extractTransform(this, oldt); + } + return this; + }; + elproto.rotate = function (deg, cx, cy) { + if (this.removed) { + return this; + } + if (deg == null) { + return; + } + deg = Str(deg).split(separator); + if (deg.length - 1) { + cx = toFloat(deg[1]); + cy = toFloat(deg[2]); + } + deg = toFloat(deg[0]); + (cy == null) && (cx = cy); + if (cx == null || cy == null) { + var bbox = this.getBBox(1); + cx = bbox.x + bbox.width / 2; + cy = bbox.y + bbox.height / 2; + } + this._.dirtyT = 1; + this.transform(this._.transform.concat([["r", deg, cx, cy]])); + return this; + }; + elproto.translate = function (dx, dy) { + if (this.removed) { + return this; + } + dx = Str(dx).split(separator); + if (dx.length - 1) { + dy = toFloat(dx[1]); + } + dx = toFloat(dx[0]) || 0; + dy = +dy || 0; + if (this._.bbox) { + this._.bbox.x += dx; + this._.bbox.y += dy; + } + this.transform(this._.transform.concat([["t", dx, dy]])); + return this; + }; + elproto.scale = function (sx, sy, cx, cy) { + if (this.removed) { + return this; + } + sx = Str(sx).split(separator); + if (sx.length - 1) { + sy = toFloat(sx[1]); + cx = toFloat(sx[2]); + cy = toFloat(sx[3]); + isNaN(cx) && (cx = null); + isNaN(cy) && (cy = null); + } + sx = toFloat(sx[0]); + (sy == null) && (sy = sx); + (cy == null) && (cx = cy); + if (cx == null || cy == null) { + var bbox = this.getBBox(1); + } + cx = cx == null ? bbox.x + bbox.width / 2 : cx; + cy = cy == null ? bbox.y + bbox.height / 2 : cy; + + this.transform(this._.transform.concat([["s", sx, sy, cx, cy]])); + this._.dirtyT = 1; + return this; + }; + elproto.hide = function () { + !this.removed && (this.node.style.display = "none"); + return this; + }; + elproto.show = function () { + !this.removed && (this.node.style.display = E); + return this; + }; + // Needed to fix the vml setViewBox issues + elproto.auxGetBBox = R.el.getBBox; + elproto.getBBox = function(){ + var b = this.auxGetBBox(); + if (this.paper && this.paper._viewBoxShift) + { + var c = {}; + var z = 1/this.paper._viewBoxShift.scale; + c.x = b.x - this.paper._viewBoxShift.dx; + c.x *= z; + c.y = b.y - this.paper._viewBoxShift.dy; + c.y *= z; + c.width = b.width * z; + c.height = b.height * z; + c.x2 = c.x + c.width; + c.y2 = c.y + c.height; + return c; + } + return b; + }; + elproto._getBBox = function () { + if (this.removed) { + return {}; + } + return { + x: this.X + (this.bbx || 0) - this.W / 2, + y: this.Y - this.H, + width: this.W, + height: this.H + }; + }; + elproto.remove = function () { + if (this.removed || !this.node.parentNode) { + return; + } + this.paper.__set__ && this.paper.__set__.exclude(this); + R.eve.unbind("raphael.*.*." + this.id); + R._tear(this, this.paper); + this.node.parentNode.removeChild(this.node); + this.shape && this.shape.parentNode.removeChild(this.shape); + for (var i in this) { + this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null; + } + this.removed = true; + }; + elproto.attr = function (name, value) { + if (this.removed) { + return this; + } + if (name == null) { + var res = {}; + for (var a in this.attrs) if (this.attrs[has](a)) { + res[a] = this.attrs[a]; + } + res.gradient && res.fill == "none" && (res.fill = res.gradient) && delete res.gradient; + res.transform = this._.transform; + return res; + } + if (value == null && R.is(name, "string")) { + if (name == fillString && this.attrs.fill == "none" && this.attrs.gradient) { + return this.attrs.gradient; + } + var names = name.split(separator), + out = {}; + for (var i = 0, ii = names.length; i < ii; i++) { + name = names[i]; + if (name in this.attrs) { + out[name] = this.attrs[name]; + } else if (R.is(this.paper.customAttributes[name], "function")) { + out[name] = this.paper.customAttributes[name].def; + } else { + out[name] = R._availableAttrs[name]; + } + } + return ii - 1 ? out : out[names[0]]; + } + if (this.attrs && value == null && R.is(name, "array")) { + out = {}; + for (i = 0, ii = name.length; i < ii; i++) { + out[name[i]] = this.attr(name[i]); + } + return out; + } + var params; + if (value != null) { + params = {}; + params[name] = value; + } + value == null && R.is(name, "object") && (params = name); + for (var key in params) { + eve("raphael.attr." + key + "." + this.id, this, params[key]); + } + if (params) { + for (key in this.paper.customAttributes) if (this.paper.customAttributes[has](key) && params[has](key) && R.is(this.paper.customAttributes[key], "function")) { + var par = this.paper.customAttributes[key].apply(this, [].concat(params[key])); + this.attrs[key] = params[key]; + for (var subkey in par) if (par[has](subkey)) { + params[subkey] = par[subkey]; + } + } + // this.paper.canvas.style.display = "none"; + if (params.text && this.type == "text") { + this.textpath.string = params.text; + } + setFillAndStroke(this, params); + // this.paper.canvas.style.display = E; + } + return this; + }; + elproto.toFront = function () { + !this.removed && this.node.parentNode.appendChild(this.node); + this.paper && this.paper.top != this && R._tofront(this, this.paper); + return this; + }; + elproto.toBack = function () { + if (this.removed) { + return this; + } + if (this.node.parentNode.firstChild != this.node) { + this.node.parentNode.insertBefore(this.node, this.node.parentNode.firstChild); + R._toback(this, this.paper); + } + return this; + }; + elproto.insertAfter = function (element) { + if (this.removed) { + return this; + } + if (element.constructor == R.st.constructor) { + element = element[element.length - 1]; + } + if (element.node.nextSibling) { + element.node.parentNode.insertBefore(this.node, element.node.nextSibling); + } else { + element.node.parentNode.appendChild(this.node); + } + R._insertafter(this, element, this.paper); + return this; + }; + elproto.insertBefore = function (element) { + if (this.removed) { + return this; + } + if (element.constructor == R.st.constructor) { + element = element[0]; + } + element.node.parentNode.insertBefore(this.node, element.node); + R._insertbefore(this, element, this.paper); + return this; + }; + elproto.blur = function (size) { + var s = this.node.runtimeStyle, + f = s.filter; + f = f.replace(blurregexp, E); + if (+size !== 0) { + this.attrs.blur = size; + s.filter = f + S + ms + ".Blur(pixelradius=" + (+size || 1.5) + ")"; + s.margin = R.format("-{0}px 0 0 -{0}px", round(+size || 1.5)); + } else { + s.filter = f; + s.margin = 0; + delete this.attrs.blur; + } + return this; + }; + + R._engine.path = function (pathString, vml) { + var el = createNode("shape"); + el.style.cssText = cssDot; + el.coordsize = zoom + S + zoom; + el.coordorigin = vml.coordorigin; + var p = new Element(el, vml), + attr = {fill: "none", stroke: "#000"}; + pathString && (attr.path = pathString); + p.type = "path"; + p.path = []; + p.Path = E; + setFillAndStroke(p, attr); + vml.canvas.appendChild(el); + var skew = createNode("skew"); + skew.on = true; + el.appendChild(skew); + p.skew = skew; + p.transform(E); + return p; + }; + R._engine.rect = function (vml, x, y, w, h, r) { + var path = R._rectPath(x, y, w, h, r), + res = vml.path(path), + a = res.attrs; + res.X = a.x = x; + res.Y = a.y = y; + res.W = a.width = w; + res.H = a.height = h; + a.r = r; + a.path = path; + res.type = "rect"; + return res; + }; + R._engine.ellipse = function (vml, x, y, rx, ry) { + var res = vml.path(), + a = res.attrs; + res.X = x - rx; + res.Y = y - ry; + res.W = rx * 2; + res.H = ry * 2; + res.type = "ellipse"; + setFillAndStroke(res, { + cx: x, + cy: y, + rx: rx, + ry: ry + }); + return res; + }; + R._engine.circle = function (vml, x, y, r) { + var res = vml.path(), + a = res.attrs; + res.X = x - r; + res.Y = y - r; + res.W = res.H = r * 2; + res.type = "circle"; + setFillAndStroke(res, { + cx: x, + cy: y, + r: r + }); + return res; + }; + R._engine.image = function (vml, src, x, y, w, h) { + var path = R._rectPath(x, y, w, h), + res = vml.path(path).attr({stroke: "none"}), + a = res.attrs, + node = res.node, + fill = node.getElementsByTagName(fillString)[0]; + a.src = src; + res.X = a.x = x; + res.Y = a.y = y; + res.W = a.width = w; + res.H = a.height = h; + a.path = path; + res.type = "image"; + fill.parentNode == node && node.removeChild(fill); + fill.rotate = true; + fill.src = src; + fill.type = "tile"; + res._.fillpos = [x, y]; + res._.fillsize = [w, h]; + node.appendChild(fill); + setCoords(res, 1, 1, 0, 0, 0); + return res; + }; + R._engine.text = function (vml, x, y, text) { + var el = createNode("shape"), + path = createNode("path"), + o = createNode("textpath"); + x = x || 0; + y = y || 0; + text = text || ""; + path.v = R.format("m{0},{1}l{2},{1}", round(x * zoom), round(y * zoom), round(x * zoom) + 1); + path.textpathok = true; + o.string = Str(text); + o.on = true; + el.style.cssText = cssDot; + el.coordsize = zoom + S + zoom; + el.coordorigin = "0 0"; + var p = new Element(el, vml), + attr = { + fill: "#000", + stroke: "none", + font: R._availableAttrs.font, + text: text + }; + p.shape = el; + p.path = path; + p.textpath = o; + p.type = "text"; + p.attrs.text = Str(text); + p.attrs.x = x; + p.attrs.y = y; + p.attrs.w = 1; + p.attrs.h = 1; + setFillAndStroke(p, attr); + el.appendChild(o); + el.appendChild(path); + vml.canvas.appendChild(el); + var skew = createNode("skew"); + skew.on = true; + el.appendChild(skew); + p.skew = skew; + p.transform(E); + return p; + }; + R._engine.setSize = function (width, height) { + var cs = this.canvas.style; + this.width = width; + this.height = height; + width == +width && (width += "px"); + height == +height && (height += "px"); + cs.width = width; + cs.height = height; + cs.clip = "rect(0 " + width + " " + height + " 0)"; + if (this._viewBox) { + R._engine.setViewBox.apply(this, this._viewBox); + } + return this; + }; + R._engine.setViewBox = function (x, y, w, h, fit) { + R.eve("raphael.setViewBox", this, this._viewBox, [x, y, w, h, fit]); + var paperSize = this.getSize(), + width = paperSize.width, + height = paperSize.height, + H, W; + if (fit) { + H = height / h; + W = width / w; + if (w * H < width) { + x -= (width - w * H) / 2 / H; + } + if (h * W < height) { + y -= (height - h * W) / 2 / W; + } + } + this._viewBox = [x, y, w, h, !!fit]; + this._viewBoxShift = { + dx: -x, + dy: -y, + scale: paperSize + }; + this.forEach(function (el) { + el.transform("..."); + }); + return this; + }; + var createNode; + R._engine.initWin = function (win) { + var doc = win.document; + if (doc.styleSheets.length < 31) { + doc.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)"); + } else { + // no more room, add to the existing one + // http://msdn.microsoft.com/en-us/library/ms531194%28VS.85%29.aspx + doc.styleSheets[0].addRule(".rvml", "behavior:url(#default#VML)"); + } + try { + !doc.namespaces.rvml && doc.namespaces.add("rvml", "urn:schemas-microsoft-com:vml"); + createNode = function (tagName) { + return doc.createElement('<rvml:' + tagName + ' class="rvml">'); + }; + } catch (e) { + createNode = function (tagName) { + return doc.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">'); + }; + } + }; + R._engine.initWin(R._g.win); + R._engine.create = function () { + var con = R._getContainer.apply(0, arguments), + container = con.container, + height = con.height, + s, + width = con.width, + x = con.x, + y = con.y; + if (!container) { + throw new Error("VML container not found."); + } + var res = new R._Paper, + c = res.canvas = R._g.doc.createElement("div"), + cs = c.style; + x = x || 0; + y = y || 0; + width = width || 512; + height = height || 342; + res.width = width; + res.height = height; + width == +width && (width += "px"); + height == +height && (height += "px"); + res.coordsize = zoom * 1e3 + S + zoom * 1e3; + res.coordorigin = "0 0"; + res.span = R._g.doc.createElement("span"); + res.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;"; + c.appendChild(res.span); + cs.cssText = R.format("top:0;left:0;display:inline-block;position:absolute;clip:rect(0 {0} {1} 0);", width, height); + if (container == 1) { + R._g.doc.body.appendChild(c); + cs.left = x + "px"; + cs.top = y + "px"; + cs.position = "absolute"; + } else { + if (container.firstChild) { + container.insertBefore(c, container.firstChild); + } else { + container.appendChild(c); + } + } + res.renderfix = function () {}; + return res; + }; + R.prototype.clear = function () { + R.eve("raphael.clear", this); + this.canvas.innerHTML = E; + this.span = R._g.doc.createElement("span"); + this.span.style.cssText = "position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;"; + this.canvas.appendChild(this.span); + this.bottom = this.top = null; + }; + R.prototype.remove = function () { + R.eve("raphael.remove", this); + this.canvas.parentNode.removeChild(this.canvas); + for (var i in this) { + this[i] = typeof this[i] == "function" ? R._removedFactory(i) : null; + } + return true; + }; + + var setproto = R.st; + for (var method in elproto) if (elproto[has](method) && !setproto[has](method)) { + setproto[method] = (function (methodname) { + return function () { + var arg = arguments; + return this.forEach(function (el) { + el[methodname].apply(el, arg); + }); + }; + })(method); + } +})); + +// ┌────────────────────────────────────────────────────────────────────┐ \\ +// │ Raphaël 2.1.4 - JavaScript Vector Library │ \\ +// ├────────────────────────────────────────────────────────────────────┤ \\ +// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\ +// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\ +// ├────────────────────────────────────────────────────────────────────┤ \\ +// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\ +// └────────────────────────────────────────────────────────────────────┘ \\ + +(function (glob, factory) { + if (typeof define === "function" && define.amd) { + define("raphael", ["raphael.core", "raphael.svg", "raphael.vml"], function(Raphael) { + return factory(Raphael); + }); + } else if (typeof exports === "object") { + var raphael = require("raphael.core"); + + require("raphael.svg"); + require("raphael.vml"); + + module.exports = factory(raphael); + } else { + //glob.Raphael = factory(glob.Raphael); + } +}(this, function (Raphael) { + return Raphael.ninja(); +}));/** + * svg绘图 + * + * Created by GUY on 2015/12/3. + * @class BI.Svg + * @extends BI.Widget + */ +BI.Svg = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.Svg.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-svg" + }) + }, + + _init: function () { + BI.Svg.superclass._init.apply(this, arguments); + this.paper = Raphael(this.element[0]); + + this.element.css("overflow", "hidden"); + $(this.paper.canvas).width("100%").height("100%").css({"left": "0", "top": "0"}).appendTo(this.element); + + this.top = this.paper.top; + this.bottom = this.paper.bottom; + this.customAttributes = this.paper.customAttributes; + this.ca = this.paper.ca; + this.raphael = this.paper.raphael; + }, + + add: function () { + return this.paper.add.apply(this.paper, arguments); + }, + + path: function () { + return this.paper.path.apply(this.paper, arguments); + }, + + image: function () { + return this.paper.image.apply(this.paper, arguments); + }, + + rect: function () { + return this.paper.rect.apply(this.paper, arguments); + }, + + circle: function () { + return this.paper.circle.apply(this.paper, arguments); + }, + + ellipse: function () { + return this.paper.ellipse.apply(this.paper, arguments); + }, + + text: function () { + return this.paper.text.apply(this.paper, arguments); + }, + + print: function () { + return this.paper.print.apply(this.paper, arguments); + }, + + + setStart: function () { + return this.paper.setStart.apply(this.paper, arguments); + }, + + setFinish: function () { + return this.paper.setFinish.apply(this.paper, arguments); + }, + + setSize: function () { + return this.paper.setSize.apply(this.paper, arguments); + }, + + setViewBox: function () { + return this.paper.setViewBox.apply(this.paper, arguments); + }, + + + getById: function () { + return this.paper.getById.apply(this.paper, arguments); + }, + + getElementByPoint: function () { + return this.paper.getElementByPoint.apply(this.paper, arguments); + }, + + getElementsByPoint: function () { + return this.paper.getElementsByPoint.apply(this.paper, arguments); + }, + + getFont: function () { + return this.paper.getFont.apply(this.paper, arguments); + }, + + + set: function () { + return this.paper.set.apply(this.paper, arguments); + }, + remove: function () { + return this.paper.remove.apply(this.paper, arguments); + }, + clear: function () { + return this.paper.clear.apply(this.paper, arguments); + } +}); +BI.shortcut("bi.svg", BI.Svg);/** + * + * 原生表格滚动条,为了IE8的兼容 + * + * Created by GUY on 2016/1/12. + * @class BI.NativeTableScrollbar + * @extends BI.Widget + */ +BI.NativeTableScrollbar = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.NativeTableScrollbar.superclass._defaultConfig.apply(this, arguments), { + attributes: { + tabIndex: 0 + }, + contentSize: 0, + defaultPosition: 0, + position: 0, + size: 0 + }) + }, + + render: function () { + var self = this, o = this.options; + //把滚动台size改掉 + this.element.width(36); + + var throttle = BI.throttle(function () { + self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollTop()); + }, 150, {leading: false}); + this.element.scroll(function () { + throttle(); + }); + return { + type: "bi.default", + scrolly: true, + items: [{ + type: "bi.layout", + width: 1, + ref: function (_ref) { + self.inner = _ref; + } + }] + } + }, + + mounted: function () { + this._populate(); + }, + + _populate: function () { + var self = this, o = this.options; + if (o.size < 1 || o.contentSize <= o.size) { + this.setVisible(false); + return; + } + this.setVisible(true); + try { + this.element.scrollTop(o.position); + } catch (e) { + + } + this.inner.element.height(o.contentSize); + }, + + setContentSize: function (contentSize) { + this.options.contentSize = contentSize; + }, + + setPosition: function (position) { + this.options.position = position; + }, + + setSize: function (size) { + this.setHeight(size); + this.options.size = size; + }, + + populate: function () { + this._populate(); + } +}); +BI.NativeTableScrollbar.EVENT_SCROLL = "EVENT_SCROLL"; +BI.shortcut("bi.native_table_scrollbar", BI.NativeTableScrollbar); + + +BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.NativeTableHorizontalScrollbar.superclass._defaultConfig.apply(this, arguments), { + attributes: { + tabIndex: 0 + }, + contentSize: 0, + position: 0, + size: 0 + }) + }, + + render: function () { + var self = this, o = this.options; + //把滚动台size改掉 + this.element.height(36); + + var throttle = BI.throttle(function () { + self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollLeft()); + }, 150, {leading: false}); + this.element.scroll(function () { + throttle(); + }); + return { + type: "bi.default", + scrollx: true, + items: [{ + type: "bi.layout", + height: 1, + ref: function (_ref) { + self.inner = _ref; + } + }] + } + }, + + setContentSize: function (contentSize) { + this.options.contentSize = contentSize; + }, + + setPosition: function (position) { + this.options.position = position; + }, + + setSize: function (size) { + this.setWidth(size); + this.options.size = size; + }, + + _populate: function () { + var self = this, o = this.options; + if (o.size < 1 || o.contentSize <= o.size) { + this.setVisible(false); + return; + } + this.setVisible(true); + try { + this.element.scrollLeft(o.position); + } catch (e) { + + } + this.inner.element.width(o.contentSize); + }, + + populate: function () { + this._populate(); + } +}); +BI.NativeTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL"; +BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);/** + * + * 表格 + * + * Created by GUY on 2015/9/22. + * @class BI.TableCell + * @extends BI.Single + */ +BI.TableCell = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-table-cell", + textAlign: "left", + text: "" + }) + }, + + _init: function () { + BI.TableCell.superclass._init.apply(this, arguments); + BI.createWidget({ + type: "bi.label", + element: this, + whiteSpace: "nowrap", + textAlign: this.options.textAlign, + height: this.options.height, + text: this.options.text, + value: this.options.value, + lgap: 5 + }) + } +}); + +BI.shortcut("bi.table_cell", BI.TableCell);/** + * + * 表格单元格 + * + * Created by GUY on 2016/1/12. + * @class BI.CollectionTableCell + * @extends BI.Widget + */ +BI.CollectionTableCell = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.CollectionTableCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-collection-table-cell bi-border-right bi-border-bottom", + width: 0, + height: 0, + _left: 0, + _top: 0, + cell: {} + }) + }, + + _init: function () { + BI.CollectionTableCell.superclass._init.apply(this, arguments); + var o = this.options; + this.cell = BI.createWidget(BI.extend({ + type: "bi.label" + }, o.cell, { + cls: (o.cell.cls || "") + " collection-table-cell-wrapper", + width: o.width - (o._left === 0 ? 1 : 0) - 1, + height: o.height - (o._top === 0 ? 1 : 0) - 1 + })); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.cell, + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + }); + }, + + setWidth: function (width) { + BI.CollectionTableCell.superclass.setWidth.apply(this, arguments); + var o = this.options; + this.cell.setWidth(o.width - (o._left === 0 ? 1 : 0) - 1); + }, + + setHeight: function (height) { + BI.CollectionTableCell.superclass.setHeight.apply(this, arguments); + var o = this.options; + this.cell.setHeight(o.height - (o._top === 0 ? 1 : 0) - 1); + } +}); + +BI.shortcut("bi.collection_table_cell", BI.CollectionTableCell);/** + * CollectionTable + * + * Created by GUY on 2016/1/12. + * @class BI.CollectionTable + * @extends BI.Widget + */ +BI.CollectionTable = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.CollectionTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-collection-table", + headerRowSize: 25, + rowSize: 25, + columnSize: [], + isNeedFreeze: false, + freezeCols: [], + isNeedMerge: false, + mergeCols: [], + mergeRule: BI.emptyFn, + header: [], + items: [], + regionColumnSize: [] + }); + }, + + render: function () { + var self = this, o = this.options; + this._width = 0; + this._height = 0; + this._scrollBarSize = BI.DOM.getScrollWidth(); + this.topLeftCollection = BI.createWidget({ + type: "bi.collection_view", + cellSizeAndPositionGetter: function (index) { + return self.topLeftItems[index]; + } + }); + this.topLeftCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { + self.bottomLeftCollection.setScrollLeft(scroll.scrollLeft); + self._populateScrollbar(); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.topRightCollection = BI.createWidget({ + type: "bi.collection_view", + cellSizeAndPositionGetter: function (index) { + return self.topRightItems[index]; + } + }); + this.topRightCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { + self.bottomRightCollection.setScrollLeft(scroll.scrollLeft); + self._populateScrollbar(); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.bottomLeftCollection = BI.createWidget({ + type: "bi.collection_view", + cellSizeAndPositionGetter: function (index) { + return self.bottomLeftItems[index]; + } + }); + this.bottomLeftCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { + self.bottomRightCollection.setScrollTop(scroll.scrollTop); + self.topLeftCollection.setScrollLeft(scroll.scrollLeft); + self._populateScrollbar(); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.bottomRightCollection = BI.createWidget({ + type: "bi.collection_view", + cellSizeAndPositionGetter: function (index) { + return self.bottomRightItems[index]; + } + }); + this.bottomRightCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) { + self.bottomLeftCollection.setScrollTop(scroll.scrollTop); + self.topRightCollection.setScrollLeft(scroll.scrollLeft); + self._populateScrollbar(); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.topLeft = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.topLeftCollection] + }); + this.topRight = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.topRightCollection] + }); + this.bottomLeft = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.bottomLeftCollection] + }); + this.bottomRight = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.bottomRightCollection] + }); + this.contextLayout = BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.topLeft, + top: 0, + left: 0 + }, { + el: this.topRight, + top: 0 + }, { + el: this.bottomLeft, + left: 0 + }, { + el: this.bottomRight + }] + }); + + this.topScrollbar = BI.createWidget({ + type: "bi.grid_table_scrollbar", + width: BI.GridTableScrollbar.SIZE + }); + this.topScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL, function (scrollTop) { + self.bottomLeftCollection.setScrollTop(scrollTop); + self.bottomRightCollection.setScrollTop(scrollTop); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.leftScrollbar = BI.createWidget({ + type: "bi.grid_table_horizontal_scrollbar", + height: BI.GridTableScrollbar.SIZE + }); + this.leftScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL, function (scrollLeft) { + self.topLeftCollection.setScrollLeft(scrollLeft); + self.bottomLeftCollection.setScrollLeft(scrollLeft); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.rightScrollbar = BI.createWidget({ + type: "bi.grid_table_horizontal_scrollbar", + height: BI.GridTableScrollbar.SIZE + }); + this.rightScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL, function (scrollLeft) { + self.topRightCollection.setScrollLeft(scrollLeft); + self.bottomRightCollection.setScrollLeft(scrollLeft); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.scrollBarLayout = BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.topScrollbar, + right: 0, + top: 0 + }, { + el: this.leftScrollbar, + left: 0 + }, { + el: this.rightScrollbar, + }] + }); + this._width = o.width - BI.GridTableScrollbar.SIZE; + this._height = o.height - BI.GridTableScrollbar.SIZE; + }, + + mounted: function () { + var o = this.options; + if (o.items.length > 0 || o.header.length > 0) { + this._digest(); + this._populate(); + } + }, + + _getFreezeColLength: function () { + return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; + }, + + _getFreezeHeaderHeight: function () { + var o = this.options; + if (o.header.length * o.headerRowSize >= this._height) { + return 0; + } + return o.header.length * o.headerRowSize; + }, + + _getActualItems: function () { + var o = this.options; + if (o.header.length * o.headerRowSize >= this._height) { + return o.header.concat(o.items); + } + return o.items; + }, + + _populateScrollbar: function () { + var o = this.options; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = []; + BI.each(o.columnSize, function (i, size) { + if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { + totalLeftColumnSize += size; + } else { + totalRightColumnSize += size; + } + totalColumnSize += size; + if (i === 0) { + summaryColumnSizeArray[i] = size; + } else { + summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; + } + }); + this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize); + this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight()); + this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop()); + this.topScrollbar.populate(); + + this.leftScrollbar.setContentSize(totalLeftColumnSize); + this.leftScrollbar.setSize(regionSize); + this.leftScrollbar.setPosition(this.bottomLeftCollection.getScrollLeft()); + this.leftScrollbar.populate(); + + this.rightScrollbar.setContentSize(totalRightColumnSize); + this.rightScrollbar.setSize(this._width - regionSize); + this.rightScrollbar.setPosition(this.bottomRightCollection.getScrollLeft()); + this.rightScrollbar.populate(); + + var items = this.scrollBarLayout.attr("items"); + items[0].top = this._getFreezeHeaderHeight(); + items[1].top = this._height; + items[2].top = this._height; + items[2].left = regionSize; + this.scrollBarLayout.attr("items", items); + this.scrollBarLayout.resize(); + }, + + _populateTable: function () { + var self = this, o = this.options; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = []; + BI.each(o.columnSize, function (i, size) { + if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { + totalLeftColumnSize += size; + } else { + totalRightColumnSize += size; + } + totalColumnSize += size; + if (i === 0) { + summaryColumnSizeArray[i] = size; + } else { + summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; + } + }); + + var otlw = regionSize; + var otlh = this._getFreezeHeaderHeight(); + var otrw = this._width - regionSize; + var otrh = this._getFreezeHeaderHeight(); + var oblw = regionSize; + var oblh = this._height - otlh; + var obrw = this._width - regionSize; + var obrh = this._height - otrh; + + var tlw = otlw + this._scrollBarSize; + var tlh = otlh + this._scrollBarSize; + var trw = otrw + this._scrollBarSize; + var trh = otrh + this._scrollBarSize; + var blw = oblw + this._scrollBarSize; + var blh = oblh + this._scrollBarSize; + var brw = obrw + this._scrollBarSize; + var brh = obrh + this._scrollBarSize; + + var digest = function (el) { + el.element.css({ + overflow: "scroll", + overflowX: "scroll", + overflowY: "scroll" + }) + }; + + this.topLeft.setWidth(otlw); + this.topLeft.setHeight(otlh); + this.topRight.setWidth(otrw); + this.topRight.setHeight(otrh); + this.bottomLeft.setWidth(oblw); + this.bottomLeft.setHeight(oblh); + this.bottomRight.setWidth(obrw); + this.bottomRight.setHeight(obrh); + + this.topLeftCollection.setWidth(tlw); + this.topLeftCollection.setHeight(tlh); + this.topRightCollection.setWidth(trw); + this.topRightCollection.setHeight(trh); + this.bottomLeftCollection.setWidth(blw); + this.bottomLeftCollection.setHeight(blh); + this.bottomRightCollection.setWidth(brw); + this.bottomRightCollection.setHeight(brh); + + digest(this.topLeftCollection); + digest(this.topRightCollection); + digest(this.bottomLeftCollection); + digest(this.bottomRightCollection); + + var items = this.contextLayout.attr("items"); + items[1].left = regionSize; + items[2].top = this._getFreezeHeaderHeight(); + items[3].left = regionSize; + items[3].top = this._getFreezeHeaderHeight(); + this.contextLayout.attr("items", items); + this.contextLayout.resize(); + + var leftHeader = [], rightHeader = [], leftItems = [], rightItems = []; + var run = function (positions, items, rendered) { + BI.each(positions, function (i, item) { + var cell = { + type: "bi.collection_table_cell", + cell: items[item.row][item.col] + }; + rendered.push(cell); + }); + }; + run(this.topLeftItems, o.header, leftHeader); + run(this.topRightItems, o.header, rightHeader); + run(this.bottomLeftItems, this._getActualItems(), leftItems); + run(this.bottomRightItems, this._getActualItems(), rightItems); + + this.topLeftCollection._populate(leftHeader); + this.topRightCollection._populate(rightHeader); + this.bottomLeftCollection._populate(leftItems); + this.bottomRightCollection._populate(rightItems); + }, + + _digest: function () { + var o = this.options; + var freezeColLength = this._getFreezeColLength(); + //如果表头位置不够,取消表头冻结 + if (this._getFreezeHeaderHeight() <= 0) { + this.topLeftItems = []; + this.topRightItems = []; + this.bottomLeftItems = this._serialize(this._getActualItems(), 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols, BI.range(o.header.length)); + this.bottomRightItems = this._serialize(this._getActualItems(), freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols, BI.range(o.header.length)); + } else { + this.topLeftItems = this._serialize(o.header, 0, freezeColLength, o.headerRowSize, o.columnSize, o.mergeCols); + this.topRightItems = this._serialize(o.header, freezeColLength, o.columnSize.length, o.headerRowSize, o.columnSize, true); + this.bottomLeftItems = this._serialize(o.items, 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols); + this.bottomRightItems = this._serialize(o.items, freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols); + } + }, + + _serialize: function (items, startCol, endCol, rowHeight, columnSize, mergeCols, mergeRows) { + mergeCols = mergeCols || []; + mergeRows = mergeRows || []; + var self = this, o = this.options; + var result = [], cache = {}, preCol = {}, preRow = {}, map = {}; + var summaryColumnSize = []; + for (var i = startCol; i < endCol; i++) { + if (i === startCol) { + summaryColumnSize[i] = columnSize[i]; + } else { + summaryColumnSize[i] = summaryColumnSize[i - 1] + columnSize[i]; + } + } + var mergeRow = function (i, j) { + preCol[j]._height += rowHeight; + preCol[j].__mergeRows.push(i); + }; + + var mergeCol = function (i, j) { + preRow[i]._width += columnSize[j]; + preRow[i].__mergeCols.push(j); + }; + + var createOneEl = function (r, c) { + var width = columnSize[c]; + var height = rowHeight; + map[r][c]._row = r; + map[r][c]._col = c; + map[r][c]._width = width; + map[r][c]._height = height; + preCol[c] = map[r][c]; + preCol[c].__mergeRows = [r]; + preRow[r] = map[r][c]; + preRow[r].__mergeCols = [c]; + + result.push({ + x: summaryColumnSize[c] - columnSize[c], + y: +r * rowHeight, + item: map[r][c] + }); + }; + + BI.each(items, function (i, cols) { + for (var j = startCol; j < endCol; j++) { + if (!cache[i]) { + cache[i] = {}; + } + if (!map[i]) { + map[i] = {}; + } + cache[i][j] = cols[j]; + map[i][j] = {}; + if (mergeCols === true || mergeCols.indexOf(j) > -1 || mergeRows === true || mergeRows.indexOf(i) > -1) { + if (i === 0 && j === startCol) { + createOneEl(0, startCol); + } else if (j === startCol && i > 0) { + var isNeedMergeRow = o.mergeRule(cache[i][j], cache[i - 1][j]); + if (isNeedMergeRow === true) { + mergeRow(i, j); + preRow[i] = preCol[j]; + } else { + createOneEl(i, j); + } + } else if (i === 0 && j > startCol) { + var isNeedMergeCol = o.mergeRule(cache[i][j], cache[i][j - 1]); + if (isNeedMergeCol === true) { + mergeCol(i, j); + preCol[j] = preRow[i]; + } else { + createOneEl(i, j); + } + } else { + var isNeedMergeRow = o.mergeRule(cache[i][j], cache[i - 1][j]); + var isNeedMergeCol = o.mergeRule(cache[i][j], cache[i][j - 1]); + if (isNeedMergeCol && isNeedMergeRow) { + continue; + //mergeRow(i, j);//优先合并列 + } + if (isNeedMergeCol) { + mergeCol(i, j); + } + if (isNeedMergeRow) { + mergeRow(i, j); + } + if (!isNeedMergeCol && !isNeedMergeRow) { + createOneEl(i, j); + } + } + } else { + createOneEl(i, j); + } + } + }); + return BI.map(result, function (i, item) { + return { + x: item.x, + y: item.y, + row: item.item._row, + col: item.item._col, + width: item.item._width, + height: item.item._height + } + }); + }, + + _populate: function () { + if (this._width <= 0 || this._height <= 0) { + return; + } + if (this._isNeedDigest === true) { + this._digest(); + } + this._isNeedDigest = false; + this._populateTable(); + this._populateScrollbar(); + }, + + getRegionSize: function () { + var o = this.options; + var regionSize = o.regionColumnSize[0] || 0; + if (o.isNeedFreeze === false || o.freezeCols.length === 0) { + return 0; + } + if (!regionSize) { + BI.each(o.freezeCols, function (i, col) { + regionSize += o.columnSize[col]; + }); + } + return regionSize; + }, + + setVerticalScroll: function (scrollTop) { + this.bottomLeftCollection.setScrollTop(scrollTop); + this.bottomRightCollection.setScrollTop(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.topLeftCollection.setScrollLeft(scrollLeft); + this.bottomLeftCollection.setScrollLeft(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.topRightCollection.setScrollLeft(scrollLeft); + this.bottomRightCollection.setScrollLeft(scrollLeft); + }, + + getVerticalScroll: function () { + return this.bottomRightCollection.getScrollTop(); + }, + + getLeftHorizontalScroll: function () { + return this.bottomLeftCollection.getScrollLeft(); + }, + + getRightHorizontalScroll: function () { + return this.bottomRightCollection.getScrollLeft(); + }, + + setWidth: function (width) { + BI.CollectionTable.superclass.setWidth.apply(this, arguments); + this._width = this.options.width - BI.GridTableScrollbar.SIZE; + }, + + setHeight: function (height) { + BI.CollectionTable.superclass.setHeight.apply(this, arguments); + this._height = this.options.height - BI.GridTableScrollbar.SIZE; + }, + + setColumnSize: function (columnSize) { + this._isNeedDigest = true; + this.options.columnSize = columnSize; + }, + + setRegionColumnSize: function (regionColumnSize) { + this._isNeedDigest = true; + this.options.regionColumnSize = regionColumnSize; + }, + + getColumnSize: function () { + return this.options.columnSize; + }, + + getRegionColumnSize: function () { + return this.options.regionColumnSize; + }, + + populate: function (items, header) { + if (items && items !== this.options.items) { + this._isNeedDigest = true; + this.options.items = items; + this._restore(); + } + if (header && header !== this.options.header) { + this._isNeedDigest = true; + this.options.header = header; + this._restore(); + } + this._populate(); + }, + + _restore: function () { + this.topLeftCollection.restore(); + this.topRightCollection.restore(); + this.bottomLeftCollection.restore(); + this.bottomRightCollection.restore(); + }, + + restore: function () { + this._restore(); + } +}); +BI.shortcut('bi.collection_table', BI.CollectionTable);/** + * QuickCollectionTable + * + * Created by GUY on 2016/1/12. + * @class BI.QuickCollectionTable + * @extends BI.CollectionTable + */ +BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, { + _defaultConfig: function () { + return BI.extend(BI.QuickCollectionTable.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-quick-collection-table" + }); + }, + + render: function () { + BI.QuickCollectionTable.superclass.render.apply(this, arguments); + var self = this, o = this.options; + this.topLeftCollection.setOverflowX(false); + this.topLeftCollection.setOverflowY(false); + this.topRightCollection.setOverflowX(false); + this.topRightCollection.setOverflowY(false); + this.bottomLeftCollection.setOverflowX(false); + this.bottomLeftCollection.setOverflowY(false); + this.bottomRightCollection.setOverflowX(false); + this.bottomRightCollection.setOverflowY(false); + }, + + mounted: function () { + BI.QuickCollectionTable.superclass.mounted.apply(this, arguments); + var self = this; + this._topLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), + BI.bind(this._shouldHandleY, this) + ); + this._topRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this._bottomLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), + BI.bind(this._shouldHandleY, this) + ); + this._bottomRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this.topLeftCollection.element.mousewheel(function (e) { + self._topLeftWheelHandler.onWheel(e.originalEvent); + }); + this.topRightCollection.element.mousewheel(function (e) { + self._topRightWheelHandler.onWheel(e.originalEvent); + }); + this.bottomLeftCollection.element.mousewheel(function (e) { + self._bottomLeftWheelHandler.onWheel(e.originalEvent); + }); + this.bottomRightCollection.element.mousewheel(function (e) { + self._bottomRightWheelHandler.onWheel(e.originalEvent); + }); + }, + + _shouldHandleLeftX: function (delta) { + if (delta > 0) { + return this.bottomLeftCollection.getScrollLeft() < this.bottomLeftCollection.getMaxScrollLeft(); + } else { + return this.bottomLeftCollection.getScrollLeft() > 0; + } + }, + + _shouldHandleRightX: function (delta) { + if (delta > 0) { + return this.bottomRightCollection.getScrollLeft() < this.bottomRightCollection.getMaxScrollLeft(); + } else { + return this.bottomRightCollection.getScrollLeft() > 0; + } + }, + + _shouldHandleY: function (delta) { + if (delta > 0) { + return this.bottomRightCollection.getScrollTop() < this.bottomRightCollection.getMaxScrollTop(); + } else { + return this.bottomRightCollection.getScrollTop() > 0; + } + }, + + _onWheelLeft: function (deltaX, deltaY) { + var self = this; + var scrollTop = this.bottomLeftCollection.getScrollTop(); + var scrollLeft = this.bottomLeftCollection.getScrollLeft(); + scrollTop += deltaY; + scrollLeft += deltaX; + this.bottomLeftCollection.setScrollTop(scrollTop); + this.bottomRightCollection.setScrollTop(scrollTop); + this.topLeftCollection.setScrollLeft(scrollLeft); + this.bottomLeftCollection.setScrollLeft(scrollLeft); + self._populateScrollbar(); + this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }, + + _onWheelRight: function (deltaX, deltaY) { + var self = this; + var scrollTop = this.bottomRightCollection.getScrollTop(); + var scrollLeft = this.bottomRightCollection.getScrollLeft(); + scrollTop += deltaY; + scrollLeft += deltaX; + this.bottomLeftCollection.setScrollTop(scrollTop); + this.bottomRightCollection.setScrollTop(scrollTop); + this.topRightCollection.setScrollLeft(scrollLeft); + this.bottomRightCollection.setScrollLeft(scrollLeft); + self._populateScrollbar(); + this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }, + + _populateTable: function () { + var self = this, o = this.options; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = [] + BI.each(o.columnSize, function (i, size) { + if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { + totalLeftColumnSize += size; + } else { + totalRightColumnSize += size; + } + totalColumnSize += size; + if (i === 0) { + summaryColumnSizeArray[i] = size; + } else { + summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; + } + }); + + var otlw = regionSize; + var otlh = this._getFreezeHeaderHeight(); + var otrw = this._width - regionSize; + var otrh = this._getFreezeHeaderHeight(); + var oblw = regionSize; + var oblh = this._height - otlh; + var obrw = this._width - regionSize; + var obrh = this._height - otrh; + + this.topLeft.setWidth(otlw); + this.topLeft.setHeight(otlh); + this.topRight.setWidth(otrw); + this.topRight.setHeight(otrh); + this.bottomLeft.setWidth(oblw); + this.bottomLeft.setHeight(oblh); + this.bottomRight.setWidth(obrw); + this.bottomRight.setHeight(obrh); + + this.topLeftCollection.setWidth(otlw); + this.topLeftCollection.setHeight(otlh); + this.topRightCollection.setWidth(otrw); + this.topRightCollection.setHeight(otrh); + this.bottomLeftCollection.setWidth(oblw); + this.bottomLeftCollection.setHeight(oblh); + this.bottomRightCollection.setWidth(obrw); + this.bottomRightCollection.setHeight(obrh); + + var items = this.contextLayout.attr("items"); + items[1].left = regionSize; + items[2].top = this._getFreezeHeaderHeight(); + items[3].left = regionSize; + items[3].top = this._getFreezeHeaderHeight(); + this.contextLayout.attr("items", items); + this.contextLayout.resize(); + + var leftHeader = [], rightHeader = [], leftItems = [], rightItems = []; + var run = function (positions, items, rendered) { + BI.each(positions, function (i, item) { + var cell = { + type: "bi.collection_table_cell", + cell: items[item.row][item.col] + }; + rendered.push(cell); + }); + }; + run(this.topLeftItems, o.header, leftHeader); + run(this.topRightItems, o.header, rightHeader); + run(this.bottomLeftItems, this._getActualItems(), leftItems); + run(this.bottomRightItems, this._getActualItems(), rightItems); + + this.topLeftCollection.populate(leftHeader); + this.topRightCollection.populate(rightHeader); + this.bottomLeftCollection.populate(leftItems); + this.bottomRightCollection.populate(rightItems); + } +}); +BI.shortcut('bi.quick_collection_table', BI.QuickCollectionTable);/** + * + * 表格单元格 + * + * Created by GUY on 2016/1/12. + * @class BI.GridTableCell + * @extends BI.Widget + */ +BI.GridTableCell = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.GridTableCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-grid-table-cell bi-border-right bi-border-bottom", + width: 0, + height: 0, + _rowIndex: 0, + _columnIndex: 0, + _left: 0, + _top: 0, + cell: {} + }) + }, + + _init: function () { + BI.GridTableCell.superclass._init.apply(this, arguments); + var o = this.options; + this.cell = BI.createWidget(BI.extend({ + type: "bi.label" + }, o.cell, { + cls: (o.cell.cls || "") + "grid-table-cell-wrapper", + width: o.width - (o._columnIndex === 0 ? 1 : 0) - 1, + height: o.height - (o._rowIndex === 0 ? 1 : 0) - 1 + })); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.cell, + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + }); + }, + + setWidth: function (width) { + BI.GridTableCell.superclass.setWidth.apply(this, arguments); + var o = this.options; + this.cell.setWidth(o.width - (o._columnIndex === 0 ? 1 : 0) - 1); + }, + + setHeight: function (height) { + BI.GridTableCell.superclass.setHeight.apply(this, arguments); + var o = this.options; + this.cell.setHeight(o.height - (o._rowIndex === 0 ? 1 : 0) - 1); + } +}); + +BI.shortcut("bi.grid_table_cell", BI.GridTableCell);/** + * GridTable + * + * Created by GUY on 2016/1/12. + * @class BI.GridTable + * @extends BI.Widget + */ +BI.GridTable = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.GridTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-grid-table", + headerRowSize: 25, + rowSize: 25, + columnSize: [], + isNeedFreeze: false, + freezeCols: [], + header: [], + items: [], + regionColumnSize: [] + }); + }, + + render: function () { + var self = this, o = this.options; + this._width = 0; + this._height = 0; + this._scrollBarSize = BI.DOM.getScrollWidth(); + var rowHeightGetter = function () { + return o.rowSize; + }; + var columnLeftWidthGetter = function (index) { + return o.columnSize[index]; + }; + var columnRightWidthGetter = function (index) { + return o.columnSize[index + self._getFreezeColLength()]; + }; + this.topLeftGrid = BI.createWidget({ + type: "bi.grid_view", + rowHeightGetter: rowHeightGetter, + columnWidthGetter: columnLeftWidthGetter + }); + this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { + self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft); + self._populateScrollbar(); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.topRightGrid = BI.createWidget({ + type: "bi.grid_view", + rowHeightGetter: rowHeightGetter, + columnWidthGetter: columnRightWidthGetter + }); + this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { + self.bottomRightGrid.setScrollLeft(scroll.scrollLeft); + self._populateScrollbar(); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.bottomLeftGrid = BI.createWidget({ + type: "bi.grid_view", + rowHeightGetter: rowHeightGetter, + columnWidthGetter: columnLeftWidthGetter + }); + this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { + self.bottomRightGrid.setScrollTop(scroll.scrollTop); + self.topLeftGrid.setScrollLeft(scroll.scrollLeft); + self._populateScrollbar(); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.bottomRightGrid = BI.createWidget({ + type: "bi.grid_view", + rowHeightGetter: rowHeightGetter, + columnWidthGetter: columnRightWidthGetter + }); + this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) { + self.bottomLeftGrid.setScrollTop(scroll.scrollTop); + self.topRightGrid.setScrollLeft(scroll.scrollLeft); + self._populateScrollbar(); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.topLeft = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.topLeftGrid] + }); + this.topRight = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.topRightGrid] + }); + this.bottomLeft = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.bottomLeftGrid] + }); + this.bottomRight = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.bottomRightGrid] + }); + this.contextLayout = BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.topLeft, + top: 0, + left: 0 + }, { + el: this.topRight, + top: 0 + }, { + el: this.bottomLeft, + left: 0 + }, { + el: this.bottomRight + }] + }); + + this.topScrollbar = BI.createWidget({ + type: "bi.grid_table_scrollbar", + width: BI.GridTableScrollbar.SIZE + }); + this.topScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL, function (scrollTop) { + self.bottomLeftGrid.setScrollTop(scrollTop); + self.bottomRightGrid.setScrollTop(scrollTop); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.leftScrollbar = BI.createWidget({ + type: "bi.grid_table_horizontal_scrollbar", + height: BI.GridTableScrollbar.SIZE + }); + this.leftScrollbar.on(BI.GridTableHorizontalScrollbar.EVENT_SCROLL, function (scrollLeft) { + self.topLeftGrid.setScrollLeft(scrollLeft); + self.bottomLeftGrid.setScrollLeft(scrollLeft); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.rightScrollbar = BI.createWidget({ + type: "bi.grid_table_horizontal_scrollbar", + height: BI.GridTableScrollbar.SIZE + }); + this.rightScrollbar.on(BI.GridTableHorizontalScrollbar.EVENT_SCROLL, function (scrollLeft) { + self.topRightGrid.setScrollLeft(scrollLeft); + self.bottomRightGrid.setScrollLeft(scrollLeft); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.scrollBarLayout = BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.topScrollbar, + right: 0, + top: 0 + }, { + el: this.leftScrollbar, + left: 0 + }, { + el: this.rightScrollbar + }] + }); + this._width = o.width - BI.GridTableScrollbar.SIZE; + this._height = o.height - BI.GridTableScrollbar.SIZE; + this.header = this._getHeader(); + this.items = this._getItems(); + }, + + mounted: function () { + var o = this.options; + if (o.items.length > 0 || o.header.length > 0) { + this._populate(); + } + }, + + _getFreezeColLength: function () { + return this.options.isNeedFreeze ? this.options.freezeCols.length : 0; + }, + + _getFreezeHeaderHeight: function () { + var o = this.options; + if (o.header.length * o.headerRowSize >= this._height) { + return 0; + } + return o.header.length * o.headerRowSize; + }, + + _getActualItems: function () { + var o = this.options; + if (o.header.length * o.headerRowSize >= this._height) { + return o.header.concat(o.items); + } + return o.items; + }, + + _populateScrollbar: function () { + var o = this.options; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = []; + BI.each(o.columnSize, function (i, size) { + if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { + totalLeftColumnSize += size; + } else { + totalRightColumnSize += size; + } + totalColumnSize += size; + if (i === 0) { + summaryColumnSizeArray[i] = size; + } else { + summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; + } + }); + this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize); + this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight()); + this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop())); + this.topScrollbar.populate(); + + this.leftScrollbar.setContentSize(totalLeftColumnSize); + this.leftScrollbar.setSize(regionSize); + this.leftScrollbar.setPosition(this.bottomLeftGrid.getScrollLeft()); + this.leftScrollbar.populate(); + + this.rightScrollbar.setContentSize(totalRightColumnSize); + this.rightScrollbar.setSize(this._width - regionSize); + this.rightScrollbar.setPosition(this.bottomRightGrid.getScrollLeft()); + this.rightScrollbar.populate(); + + var items = this.scrollBarLayout.attr("items"); + items[0].top = this._getFreezeHeaderHeight(); + items[1].top = this._height; + items[2].top = this._height; + items[2].left = regionSize; + this.scrollBarLayout.attr("items", items); + this.scrollBarLayout.resize(); + }, + + _getHeader: function () { + var o = this.options; + var freezeColLength = this._getFreezeColLength(); + var leftHeader = [], rightHeader = []; + BI.each(o.header, function (i, cols) { + leftHeader[i] = []; + rightHeader[i] = []; + BI.each(cols, function (j, col) { + var cell = { + type: "bi.grid_table_cell", + cell: col + }; + if (j < freezeColLength) { + leftHeader[i].push(cell); + } else { + rightHeader[i].push(cell); + } + }); + }); + return [leftHeader, rightHeader]; + }, + + _getItems: function () { + var o = this.options; + var freezeColLength = this._getFreezeColLength(); + var leftItems = [], rightItems = []; + BI.each(this._getActualItems(), function (i, cols) { + leftItems[i] = []; + rightItems[i] = []; + BI.each(cols, function (j, col) { + var cell = { + type: "bi.grid_table_cell", + cell: col + }; + if (j < freezeColLength) { + leftItems[i].push(cell); + } else { + rightItems[i].push(cell); + } + }); + }); + return [leftItems, rightItems]; + }, + + _populateTable: function () { + var self = this, o = this.options; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = []; + var freezeColLength = this._getFreezeColLength(); + BI.each(o.columnSize, function (i, size) { + if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { + totalLeftColumnSize += size; + } else { + totalRightColumnSize += size; + } + totalColumnSize += size; + if (i === 0) { + summaryColumnSizeArray[i] = size; + } else { + summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; + } + }); + + var otlw = regionSize; + var otlh = this._getFreezeHeaderHeight(); + var otrw = this._width - regionSize; + var otrh = this._getFreezeHeaderHeight(); + var oblw = regionSize; + var oblh = this._height - otlh; + var obrw = this._width - regionSize; + var obrh = this._height - otrh; + + var tlw = otlw + this._scrollBarSize; + var tlh = otlh + this._scrollBarSize; + var trw = otrw + this._scrollBarSize; + var trh = otrh + this._scrollBarSize; + var blw = oblw + this._scrollBarSize; + var blh = oblh + this._scrollBarSize; + var brw = obrw + this._scrollBarSize; + var brh = obrh + this._scrollBarSize; + + var digest = function (el) { + el.element.css({ + overflow: "scroll", + overflowX: "scroll", + overflowY: "scroll" + }) + }; + + this.topLeft.setWidth(otlw); + this.topLeft.setHeight(otlh); + this.topRight.setWidth(otrw); + this.topRight.setHeight(otrh); + this.bottomLeft.setWidth(oblw); + this.bottomLeft.setHeight(oblh); + this.bottomRight.setWidth(obrw); + this.bottomRight.setHeight(obrh); + + this.topLeftGrid.setWidth(tlw); + this.topLeftGrid.setHeight(tlh); + this.topRightGrid.setWidth(trw); + this.topRightGrid.setHeight(trh); + this.bottomLeftGrid.setWidth(blw); + this.bottomLeftGrid.setHeight(blh); + this.bottomRightGrid.setWidth(brw); + this.bottomRightGrid.setHeight(brh); + + digest(this.topLeftGrid); + digest(this.topRightGrid); + digest(this.bottomLeftGrid); + digest(this.bottomRightGrid); + + this.topLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0); + this.topLeftGrid.setEstimatedRowSize(o.headerRowSize); + this.topRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0); + this.topRightGrid.setEstimatedRowSize(o.headerRowSize); + this.bottomLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0); + this.bottomLeftGrid.setEstimatedRowSize(o.rowSize); + this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0); + this.bottomRightGrid.setEstimatedRowSize(o.rowSize); + + var items = this.contextLayout.attr("items"); + items[1].left = regionSize; + items[2].top = this._getFreezeHeaderHeight(); + items[3].left = regionSize; + items[3].top = this._getFreezeHeaderHeight(); + this.contextLayout.attr("items", items); + this.contextLayout.resize(); + + this.topLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.topRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + + function overscan(grid, w, h, rSize, cSize) { + var rCount = h / rSize; + var cCount = w / cSize; + if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) { + grid.attr("overscanRowCount", 100); + grid.attr("overscanColumnCount", 100); + } + } + + if (freezeColLength > 0) { + overscan(this.topLeftGrid, tlw, tlh, o.headerRowSize, totalLeftColumnSize / freezeColLength); + overscan(this.bottomLeftGrid, blw, blh, o.rowSize, totalLeftColumnSize / freezeColLength); + } + if (o.columnSize.length - freezeColLength > 0) { + overscan(this.topRight, trw, trh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + overscan(this.bottomRightGrid, brw, brh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + } + + this.topLeftGrid._populate(this.header[0]); + this.topRightGrid._populate(this.header[1]); + this.bottomLeftGrid._populate(this.items[0]); + this.bottomRightGrid._populate(this.items[1]); + }, + + _populate: function () { + if (this._width <= 0 || this._height <= 0) { + return; + } + this._populateTable(); + this._populateScrollbar(); + }, + + getRegionSize: function () { + var o = this.options; + var regionSize = o.regionColumnSize[0] || 0; + if (o.isNeedFreeze === false || o.freezeCols.length === 0) { + return 0; + } + if (!regionSize) { + BI.each(o.freezeCols, function (i, col) { + regionSize += o.columnSize[col]; + }); + } + return regionSize; + }, + + setVerticalScroll: function (scrollTop) { + this.bottomLeftGrid.setScrollTop(scrollTop); + this.bottomRightGrid.setScrollTop(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.topLeftGrid.setScrollLeft(scrollLeft); + this.bottomLeftGrid.setScrollLeft(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.topRightGrid.setScrollLeft(scrollLeft); + this.bottomRightGrid.setScrollLeft(scrollLeft); + }, + + getVerticalScroll: function () { + return this.bottomRightGrid.getScrollTop(); + }, + + getLeftHorizontalScroll: function () { + return this.bottomLeftGrid.getScrollLeft(); + }, + + getRightHorizontalScroll: function () { + return this.bottomRightGrid.getScrollLeft(); + }, + + setWidth: function (width) { + BI.GridTable.superclass.setWidth.apply(this, arguments); + this._width = this.options.width - BI.GridTableScrollbar.SIZE; + }, + + setHeight: function (height) { + BI.GridTable.superclass.setHeight.apply(this, arguments); + this._height = this.options.height - BI.GridTableScrollbar.SIZE; + }, + + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this._isNeedDigest = true; + }, + + setRegionColumnSize: function (regionColumnSize) { + this.options.regionColumnSize = regionColumnSize; + this._isNeedDigest = true; + }, + + getColumnSize: function () { + return this.options.columnSize; + }, + + getRegionColumnSize: function () { + return this.options.regionColumnSize; + }, + + populate: function (items, header) { + if (items && this.options.items !== items) { + this.options.items = items; + this.items = this._getItems(); + this._restore(); + } + if (header && this.options.header !== header) { + this.options.header = header; + this.header = this._getHeader(); + this._restore(); + } + this._populate(); + }, + + _restore: function () { + this.topLeftGrid.restore(); + this.topRightGrid.restore(); + this.bottomLeftGrid.restore(); + this.bottomRightGrid.restore(); + }, + + restore: function () { + this._restore(); + } +}); +BI.shortcut('bi.grid_table', BI.GridTable);/** + * QuickGridTable + * + * Created by GUY on 2016/1/12. + * @class BI.QuickGridTable + * @extends BI.GridTable + */ +BI.QuickGridTable = BI.inherit(BI.GridTable, { + _defaultConfig: function () { + return BI.extend(BI.QuickGridTable.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-quick-grid-table" + }); + }, + + render: function () { + BI.QuickGridTable.superclass.render.apply(this, arguments); + var self = this, o = this.options; + this.topLeftGrid.setOverflowX(false); + this.topLeftGrid.setOverflowY(false); + this.topRightGrid.setOverflowX(false); + this.topRightGrid.setOverflowY(false); + this.bottomLeftGrid.setOverflowX(false); + this.bottomLeftGrid.setOverflowY(false); + this.bottomRightGrid.setOverflowX(false); + this.bottomRightGrid.setOverflowY(false); + }, + + mounted: function () { + BI.QuickGridTable.superclass.mounted.apply(this, arguments); + var self = this; + this._topLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), + BI.bind(this._shouldHandleY, this) + ); + this._topRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this._bottomLeftWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelLeft, this), + BI.bind(this._shouldHandleLeftX, this), + BI.bind(this._shouldHandleY, this) + ); + this._bottomRightWheelHandler = new BI.WheelHandler( + BI.bind(this._onWheelRight, this), + BI.bind(this._shouldHandleRightX, this), + BI.bind(this._shouldHandleY, this) + ); + this.topLeftGrid.element.mousewheel(function (e) { + self._topLeftWheelHandler.onWheel(e.originalEvent); + }); + this.topRightGrid.element.mousewheel(function (e) { + self._topRightWheelHandler.onWheel(e.originalEvent); + }); + this.bottomLeftGrid.element.mousewheel(function (e) { + self._bottomLeftWheelHandler.onWheel(e.originalEvent); + }); + this.bottomRightGrid.element.mousewheel(function (e) { + self._bottomRightWheelHandler.onWheel(e.originalEvent); + }); + }, + + _shouldHandleLeftX: function (delta) { + if (delta > 0) { + return this.bottomLeftGrid.getScrollLeft() < this.bottomLeftGrid.getMaxScrollLeft(); + } else { + return this.bottomLeftGrid.getScrollLeft() > 0; + } + }, + + _shouldHandleRightX: function (delta) { + if (delta > 0) { + return this.bottomRightGrid.getScrollLeft() < this.bottomRightGrid.getMaxScrollLeft(); + } else { + return this.bottomRightGrid.getScrollLeft() > 0; + } + }, + + _shouldHandleY: function (delta) { + if (delta > 0) { + return this.bottomRightGrid.getScrollTop() < this.bottomRightGrid.getMaxScrollTop(); + } else { + return this.bottomRightGrid.getScrollTop() > 0; + } + }, + + _onWheelLeft: function (deltaX, deltaY) { + var self = this; + var scrollTop = this.bottomLeftGrid.getScrollTop(); + var scrollLeft = this.bottomLeftGrid.getScrollLeft(); + scrollTop += deltaY; + scrollLeft += deltaX; + this.bottomLeftGrid.setScrollTop(scrollTop); + this.bottomRightGrid.setScrollTop(scrollTop); + this.topLeftGrid.setScrollLeft(scrollLeft); + this.bottomLeftGrid.setScrollLeft(scrollLeft); + self._populateScrollbar(); + this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }, + + _onWheelRight: function (deltaX, deltaY) { + var self = this; + var scrollTop = this.bottomRightGrid.getScrollTop(); + var scrollLeft = this.bottomRightGrid.getScrollLeft(); + scrollTop += deltaY; + scrollLeft += deltaX; + this.bottomLeftGrid.setScrollTop(scrollTop); + this.bottomRightGrid.setScrollTop(scrollTop); + this.topRightGrid.setScrollLeft(scrollLeft); + this.bottomRightGrid.setScrollLeft(scrollLeft); + self._populateScrollbar(); + this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }, + + _populateTable: function () { + var self = this, o = this.options; + var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0, + summaryColumnSizeArray = []; + var freezeColLength = this._getFreezeColLength(); + BI.each(o.columnSize, function (i, size) { + if (o.isNeedFreeze === true && o.freezeCols.contains(i)) { + totalLeftColumnSize += size; + } else { + totalRightColumnSize += size; + } + totalColumnSize += size; + if (i === 0) { + summaryColumnSizeArray[i] = size; + } else { + summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size; + } + }); + + var otlw = regionSize; + var otlh = this._getFreezeHeaderHeight(); + var otrw = this._width - regionSize; + var otrh = this._getFreezeHeaderHeight(); + var oblw = regionSize; + var oblh = this._height - otlh; + var obrw = this._width - regionSize; + var obrh = this._height - otrh; + + this.topLeft.setWidth(otlw); + this.topLeft.setHeight(otlh); + this.topRight.setWidth(otrw); + this.topRight.setHeight(otrh); + this.bottomLeft.setWidth(oblw); + this.bottomLeft.setHeight(oblh); + this.bottomRight.setWidth(obrw); + this.bottomRight.setHeight(obrh); + + this.topLeftGrid.setWidth(otlw); + this.topLeftGrid.setHeight(otlh); + this.topRightGrid.setWidth(otrw); + this.topRightGrid.setHeight(otrh); + this.bottomLeftGrid.setWidth(oblw); + this.bottomLeftGrid.setHeight(oblh); + this.bottomRightGrid.setWidth(obrw); + this.bottomRightGrid.setHeight(obrh); + + this.topLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0); + this.topLeftGrid.setEstimatedRowSize(o.headerRowSize); + this.topRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0); + this.topRightGrid.setEstimatedRowSize(o.headerRowSize); + this.bottomLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0); + this.bottomLeftGrid.setEstimatedRowSize(o.rowSize); + this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0); + this.bottomRightGrid.setEstimatedRowSize(o.rowSize); + + var items = this.contextLayout.attr("items"); + items[1].left = regionSize; + items[2].top = this._getFreezeHeaderHeight(); + items[3].left = regionSize; + items[3].top = this._getFreezeHeaderHeight(); + this.contextLayout.attr("items", items); + this.contextLayout.resize(); + + var leftHeader = [], rightHeader = [], leftItems = [], rightItems = []; + BI.each(o.header, function (i, cols) { + leftHeader[i] = []; + rightHeader[i] = []; + BI.each(cols, function (j, col) { + var cell = { + type: "bi.grid_table_cell", + cell: col + }; + if (j < freezeColLength) { + leftHeader[i].push(cell); + } else { + rightHeader[i].push(cell); + } + }); + }); + BI.each(this._getActualItems(), function (i, cols) { + leftItems[i] = []; + rightItems[i] = []; + BI.each(cols, function (j, col) { + var cell = { + type: "bi.grid_table_cell", + cell: col + }; + if (j < freezeColLength) { + leftItems[i].push(cell); + } else { + rightItems[i].push(cell); + } + }); + }); + + this.topLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.topRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomLeftGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + this.bottomRightGrid.attr({ + overscanColumnCount: 0, + overscanRowCount: 0 + }); + + function overscan(grid, w, h, rSize, cSize) { + var rCount = h / rSize; + var cCount = w / cSize; + if (cCount * (120 / rSize) >= 60 || rCount * (120 / cSize) >= 60) { + grid.attr("overscanRowCount", 100); + grid.attr("overscanColumnCount", 100); + } + } + + if (freezeColLength > 0) { + overscan(this.topLeftGrid, otlw, otlh, o.headerRowSize, totalLeftColumnSize / freezeColLength); + overscan(this.bottomLeftGrid, oblw, oblh, o.rowSize, totalLeftColumnSize / freezeColLength); + } + if (o.columnSize.length - freezeColLength > 0) { + overscan(this.topRight, otrw, otrh, o.headerRowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + overscan(this.bottomRightGrid, obrw, obrh, o.rowSize, totalRightColumnSize / (o.columnSize.length - freezeColLength)); + } + + this.topLeftGrid.populate(leftHeader); + this.topRightGrid.populate(rightHeader); + this.bottomLeftGrid.populate(leftItems); + this.bottomRightGrid.populate(rightItems); + } +}); +BI.shortcut('bi.quick_grid_table', BI.QuickGridTable);/** + * + * 表格滚动条 + * + * Created by GUY on 2016/1/12. + * @class BI.GridTableScrollbar + * @extends BI.Widget + */ +BI.GridTableScrollbar = BI.inherit(BI.Widget, { + _const: { + FACE_MARGIN: 4, + FACE_MARGIN_2: 4 * 2, + FACE_SIZE_MIN: 30, + KEYBOARD_SCROLL_AMOUNT: 40 + }, + _defaultConfig: function () { + return BI.extend(BI.GridTableScrollbar.superclass._defaultConfig.apply(this, arguments), { + baseCls: "scrollbar-layout-main public-scrollbar-main", + attributes: { + tabIndex: 0 + }, + contentSize: 0, + defaultPosition: 0, + isOpaque: false, + orientation: "vertical", + position: 0, + size: 0 + }) + }, + + render: function () { + var self = this, o = this.options; + this.focused = false; + this.isDragging = false; + this.face = BI.createWidget({ + type: "bi.layout", + cls: "scrollbar-layout-face public-scrollbar-face " + + (this._isHorizontal() ? "scrollbar-layout-face-horizontal" : "scrollbar-layout-face-vertical") + }); + this.contextLayout = BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.face, + left: 0, + top: 0 + }] + }); + }, + + mounted: function () { + var self = this, o = this.options; + var onWheel = o.orientation === 'horizontal' ? this._onWheelX : this._onWheelY; + this._wheelHandler = new BI.WheelHandler( + BI.bind(onWheel, this), + BI.bind(this._shouldHandleX, this), + BI.bind(this._shouldHandleY, this) + ); + this._mouseMoveTracker = new BI.MouseMoveTracker( + BI.bind(this._onMouseMove, this), + BI.bind(this._onMouseMoveEnd, this), + document + ); + this.element.on("mousedown", BI.bind(this._onMouseDown, this)); + this.element.on("mousewheel", function (e) { + self._wheelHandler.onWheel(e.originalEvent); + }); + this.element.on("keydown", BI.bind(this._onKeyDown, this)); + this.element.on("focus", function () { + self.focused = true; + self._populate(); + }); + this.element.on("blur", function () { + self.focused = false; + self._populate(); + }); + if (this._isHorizontal()) { + this.element.addClass("scrollbar-layout-main-horizontal"); + } else { + this.element.addClass("scrollbar-layout-main-vertical"); + } + this._populate(); + }, + + _isHorizontal: function () { + return this.options.orientation === 'horizontal' + }, + + _getScale: function () { + var o = this.options; + var scale = o.size / o.contentSize; + var faceSize = o.size * scale; + + if (faceSize < this._const.FACE_SIZE_MIN) { + scale = (o.size - this._const.FACE_SIZE_MIN) / (o.contentSize - o.size); + } + return scale; + }, + + _getFaceSize: function () { + var o = this.options; + var scale = o.size / o.contentSize; + var faceSize = o.size * scale; + + if (faceSize < this._const.FACE_SIZE_MIN) { + faceSize = this._const.FACE_SIZE_MIN; + } + return faceSize; + }, + + _shouldHandleX: function (delta) { + return this.options.orientation === 'horizontal' ? + this._shouldHandleChange(delta) : + false; + }, + + _shouldHandleY: function (delta) { + return this.options.orientation !== 'horizontal' ? + this._shouldHandleChange(delta) : + false; + }, + + _shouldHandleChange: function (delta) { + return this.options.position + delta !== this.options.position; + }, + + _onWheelY: function (deltaX, deltaY) { + this._onWheel(deltaY); + }, + + _onWheelX: function (deltaX, deltaY) { + this._onWheel(deltaX); + }, + + _onWheel: function (delta) { + var maxPosition = this.options.contentSize - this.options.size; + this.options.position += delta; + if (this.options.position < 0) { + this.options.position = 0; + } else if (this.options.position > maxPosition) { + this.options.position = maxPosition; + } + this._populate(); + this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL, this.options.position); + }, + + _onMouseDown: function (e) { + if (e.target !== this.face.element[0]) { + var position = this._isHorizontal() ? e.offsetX : e.offsetY; + position /= this._getScale(); + this.options.position = BI.clamp(position - (this._getFaceSize() * 0.5 / this._getScale()), 0, this.options.contentSize - this.options.size); + this._populate(); + this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL, this.options.position); + } else { + this._mouseMoveTracker.captureMouseMoves(e); + } + try { + this.element[0].focus(); + } catch (e) { + + } + }, + + _onMouseMove: function (deltaX, deltaY) { + var delta = this._isHorizontal() ? deltaX : deltaY; + delta /= this._getScale(); + this.options.position = BI.clamp(this.options.position + delta, 0, this.options.contentSize - this.options.size); + this.isDragging = this._mouseMoveTracker.isDragging(); + this._populate(); + this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL, this.options.position); + }, + + _onMouseMoveEnd: function (event) { + this._mouseMoveTracker.releaseMouseMoves(); + if (this.isDragging === true) { + this.isDragging = false; + this._populate(); + } + }, + + _onKeyDown: function (event) { + var Keys = { + BACKSPACE: 8, + TAB: 9, + RETURN: 13, + ALT: 18, + ESC: 27, + SPACE: 32, + PAGE_UP: 33, + PAGE_DOWN: 34, + END: 35, + HOME: 36, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, + DELETE: 46, + COMMA: 188, + PERIOD: 190, + A: 65, + Z: 90, + ZERO: 48, + NUMPAD_0: 96, + NUMPAD_9: 105 + }; + var keyCode = event.keyCode; + + if (keyCode === Keys.TAB) { + return; + } + + var distance = 40; + var direction = 0; + + if (this._isHorizontal()) { + switch (keyCode) { + case Keys.HOME: + direction = -1; + distance = this.options.contentSize; + break; + + case Keys.LEFT: + direction = -1; + break; + + case Keys.RIGHT: + direction = 1; + break; + + default: + return; + } + } + + if (!this._isHorizontal()) { + switch (keyCode) { + case Keys.SPACE: + if (event.shiftKey) { + direction = -1; + } else { + direction = 1; + } + break; + + case Keys.HOME: + direction = -1; + distance = this.options.contentSize; + break; + + case Keys.UP: + direction = -1; + break; + + case Keys.DOWN: + direction = 1; + break; + + case Keys.PAGE_UP: + direction = -1; + distance = this.options.size; + break; + + case Keys.PAGE_DOWN: + direction = 1; + distance = this.options.size; + break; + + default: + return; + } + } + + this.options.position = BI.clamp(this.options.position + (distance * direction), 0, this.options.contentSize - this.options.size); + event.preventDefault(); + this._populate(); + this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL, this.options.position); + }, + + _populate: function () { + var self = this, o = this.options; + if (o.size < 1 || o.contentSize <= o.size) { + this.setVisible(false); + return; + } + this.setVisible(true); + + var size = o.size; + var isHorizontal = this._isHorizontal(); + var isActive = this.focused || this.isDragging; + + var faceSize = this._getFaceSize(); + var isOpaque = o.isOpaque; + this.element[isOpaque === true ? "addClass" : "removeClass"]("public-scrollbar-main-opaque"); + this.element[isActive === true ? "addClass" : "removeClass"]("public-scrollbar-main-active"); + + this.face.element[isActive === true ? "addClass" : "removeClass"]("public-scrollbar-face-active"); + + var position = o.position * this._getScale() + this._const.FACE_MARGIN; + + var items = this.contextLayout.attr("items"); + if (isHorizontal) { + this.setWidth(size); + this.face.setWidth(faceSize - this._const.FACE_MARGIN_2); + items[0].left = position; + items[0].top = 0; + } else { + this.setHeight(size); + this.face.setHeight(faceSize - this._const.FACE_MARGIN_2); + items[0].left = 0; + items[0].top = position; + } + this.contextLayout.attr("items", items); + this.contextLayout.resize(); + }, + + setContentSize: function (contentSize) { + this.options.contentSize = contentSize; + }, + + setPosition: function (position) { + this.options.position = position; + }, + + setSize: function (size) { + this.options.size = size; + }, + + populate: function () { + this._populate(); + } +}); +BI.GridTableScrollbar.SIZE = 10; +BI.GridTableScrollbar.EVENT_SCROLL = "EVENT_SCROLL"; +BI.shortcut("bi.grid_table_scrollbar", BI.GridTableScrollbar); + + +BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, { + _const: { + FACE_MARGIN: 4, + FACE_MARGIN_2: 4 * 2, + FACE_SIZE_MIN: 30, + KEYBOARD_SCROLL_AMOUNT: 40 + }, + _defaultConfig: function () { + return BI.extend(BI.GridTableHorizontalScrollbar.superclass._defaultConfig.apply(this, arguments), { + attributes: { + tabIndex: 0 + }, + contentSize: 0, + position: 0, + size: 0 + }) + }, + + _init: function () { + BI.GridTableHorizontalScrollbar.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.scrollbar = BI.createWidget({ + type: "bi.grid_table_scrollbar", + orientation: "horizontal", + isOpaque: true, + position: o.position, + contentSize: o.contentSize, + size: o.size + }); + this.scrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL, function () { + self.fireEvent(BI.GridTableHorizontalScrollbar.EVENT_SCROLL, arguments); + }); + BI.createWidget({ + type: "bi.absolute", + cls: "horizontal-scrollbar", + element: this, + width: o.size, + height: BI.GridTableScrollbar.SIZE, + items: [{ + el: { + type: "bi.absolute", + scrollable: false, + height: BI.GridTableScrollbar.SIZE, + items: [{ + el: this.scrollbar, + left: 0, + top: 0 + }] + }, + top: 0, + left: 0, + right: 0 + }] + }); + }, + + setContentSize: function (contentSize) { + this.options.contentSize = contentSize; + this.scrollbar.setContentSize(contentSize); + }, + + setPosition: function (position) { + this.options.position = position; + this.scrollbar.setPosition(position); + }, + + setSize: function (size) { + this.setWidth(size); + this.options.size = size; + this.scrollbar.setSize(size); + }, + + populate: function () { + this.scrollbar.populate(); + var o = this.options; + if (o.size < 1 || o.contentSize <= o.size) { + this.setVisible(false); + return; + } + this.setVisible(true); + } +}); +BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL"; +BI.shortcut("bi.grid_table_horizontal_scrollbar", BI.GridTableHorizontalScrollbar);/** + * + * 表格 + * + * Created by GUY on 2015/9/22. + * @class BI.TableHeaderCell + * @extends BI.Single + */ +BI.TableHeaderCell = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.TableHeaderCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-table-header-cell", + text: "" + }) + }, + + _init: function () { + BI.TableHeaderCell.superclass._init.apply(this, arguments); + BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "center", + height: this.options.height, + text: this.options.text, + value: this.options.value + }) + } +}); + +BI.shortcut("bi.table_header_cell", BI.TableHeaderCell);/** + * + * 表格 + * + * 能处理静态宽度以及动态宽度的表, 百分比宽度的表请使用PreviewTable + * + * Created by GUY on 2015/9/22. + * @class BI.Table + * @extends BI.Widget + */ +BI.Table = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.Table.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-table", + logic: { //冻结的页面布局逻辑 + dynamic: false + }, + + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 + + isNeedMerge: false,//是否需要合并单元格 + mergeCols: [], //合并的单元格列号 + mergeRule: function (row1, row2) { //合并规则, 默认相等时合并 + return BI.isEqual(row1, row2); + }, + + columnSize: [], + headerRowSize: 25, + footerRowSize: 25, + rowSize: 25, + + regionColumnSize: false, + + header: [], + footer: false, + items: [] //二维数组 + }) + }, + + _calculateWidth: function (width) { + if (!width || width === "0") { + return ""; + } + width = BI.parseFloat(width); + if (width < 0) { + width = 0; + } + return width > 1.01 ? width : (width * 100 + "%"); + }, + + _calculateHeight: function (height) { + return height ? height : ""; + }, + + _isRightFreeze: function () { + return BI.isNotEmptyArray(this.options.freezeCols) && BI.first(this.options.freezeCols) !== 0; + }, + + _createTopLeft: function () { + var o = this.options, isRight = this._isRightFreeze(); + this.topLeftColGroupTds = {}; + this.topLeftBodyTds = {}; + this.topLeftBodyItems = {}; + var table = this._table(); + var colgroup = this._createColGroup(this.columnLeft, this.topLeftColGroupTds); + var body = this.topLeftBody = this._body(); + body.element.append(this._createHeaderCells(this.topLeftItems, this.columnLeft, this.mergeLeft, this.topLeftBodyTds, this.topLeftBodyItems)); + BI.createWidget({ + type: "bi.adaptive", + element: table, + items: [colgroup, body] + }); + if (isRight) { + var w = 0; + BI.each(o.columnSize, function (i, col) { + if (!o.freezeCols.contains(i)) { + w += col; + } + }); + if (BI.isNumeric(w) && w > 1) { + w = BI.parseFloat(w) + o.columnSize.length - o.freezeCols.length; + } + } + return (this.topLeftContainer = BI.createWidget({ + type: "bi.adaptive", + width: this._calculateWidth(w), + items: [table] + })); + }, + + _createTopRight: function () { + var o = this.options, isRight = this._isRightFreeze(); + this.topRightColGroupTds = {}; + this.topRightBodyTds = {}; + this.topRightBodyItems = {}; + var table = this._table(); + var colgroup = this._createColGroup(this.columnRight, this.topRightColGroupTds); + var body = this.topRightBody = this._body(); + body.element.append(this._createHeaderCells(this.topRightItems, this.columnRight, this.mergeRight, this.topRightBodyTds, this.topRightBodyItems, this.columnLeft.length)); + BI.createWidget({ + type: "bi.adaptive", + element: table, + items: [colgroup, body] + }); + if (!isRight) { + var w = 0; + BI.each(o.columnSize, function (i, col) { + if (!o.freezeCols.contains(i)) { + w += col; + } + }); + if (BI.isNumeric(w)) { + w = BI.parseFloat(w) + o.columnSize.length - o.freezeCols.length; + } + } + return (this.topRightContainer = BI.createWidget({ + type: "bi.adaptive", + width: w || undefined, + items: [table] + })); + }, + + _createBottomLeft: function () { + var o = this.options, isRight = this._isRightFreeze(); + this.bottomLeftColGroupTds = {}; + this.bottomLeftBodyTds = {}; + this.bottomLeftBodyItems = {}; + var table = this._table(); + var colgroup = this._createColGroup(this.columnLeft, this.bottomLeftColGroupTds); + var body = this._createBottomLeftBody(); + BI.createWidget({ + type: "bi.adaptive", + element: table, + items: [colgroup, body] + }); + if (isRight) { + var w = 0; + BI.each(o.columnSize, function (i, col) { + if (!o.freezeCols.contains(i)) { + w += col; + } + }); + if (BI.isNumeric(w) && w > 1) { + w = BI.parseFloat(w) + o.columnSize.length - o.freezeCols.length; + } + } + return (this.bottomLeftContainer = BI.createWidget({ + type: "bi.adaptive", + width: this._calculateWidth(w), + items: [table] + })); + }, + + _createBottomLeftBody: function () { + var body = this.bottomLeftBody = this._body(); + body.element.append(this._createCells(this.bottomLeftItems, this.columnLeft, this.mergeLeft, this.bottomLeftBodyTds, this.bottomLeftBodyItems)); + return body; + }, + + _createBottomRight: function () { + var o = this.options, isRight = this._isRightFreeze(); + this.bottomRightColGroupTds = {}; + this.bottomRightBodyTds = {}; + this.bottomRightBodyItems = {}; + var table = this._table(); + var colgroup = this._createColGroup(this.columnRight, this.bottomRightColGroupTds); + var body = this._createBottomRightBody(); + BI.createWidget({ + type: "bi.adaptive", + element: table, + items: [colgroup, body] + }); + if (!isRight) { + var w = 0; + BI.each(o.columnSize, function (i, col) { + if (!o.freezeCols.contains(i)) { + w += col; + } + }); + if (BI.isNumeric(w) && w > 1) { + w = BI.parseFloat(w) + o.columnSize.length - o.freezeCols.length; + } + } + return (this.bottomRightContainer = BI.createWidget({ + type: "bi.adaptive", + width: this._calculateWidth(w), + items: [table] + })); + }, + + _createBottomRightBody: function () { + var body = this.bottomRightBody = this._body(); + body.element.append(this._createCells(this.bottomRightItems, this.columnRight, this.mergeRight, this.bottomRightBodyTds, this.bottomRightBodyItems, this.columnLeft.length)); + return body; + }, + + _createFreezeTable: function () { + var self = this, o = this.options; + var isRight = this._isRightFreeze(); + var split = this._split(o.header); + this.topLeftItems = split.left; + this.topRightItems = split.right; + split = this._split(o.items); + this.bottomLeftItems = split.left; + this.bottomRightItems = split.right; + + this.columnLeft = []; + this.columnRight = []; + BI.each(o.columnSize, function (i, size) { + if (o.freezeCols.contains(i)) { + self[isRight ? "columnRight" : "columnLeft"].push(size); + } else { + self[isRight ? "columnLeft" : "columnRight"].push(size); + } + }); + this.mergeLeft = []; + this.mergeRight = []; + BI.each(o.mergeCols, function (i, col) { + if (o.freezeCols.contains(col)) { + self[isRight ? "mergeRight" : "mergeLeft"].push(col); + } else { + self[isRight ? "mergeLeft" : "mergeRight"].push(col); + } + }); + + var topLeft = this._createTopLeft(); + var topRight = this._createTopRight(); + var bottomLeft = this._createBottomLeft(); + var bottomRight = this._createBottomRight(); + + this.scrollTopLeft = BI.createWidget({ + type: "bi.adaptive", + cls: "scroll-top-left", + width: "100%", + height: "100%", + scrollable: false, + items: [topLeft] + }); + this.scrollTopRight = BI.createWidget({ + type: "bi.adaptive", + cls: "scroll-top-right", + width: "100%", + height: "100%", + scrollable: false, + items: [topRight] + }); + this.scrollBottomLeft = BI.createWidget({ + type: "bi.adaptive", + cls: "scroll-bottom-left", + width: "100%", + height: "100%", + scrollable: isRight || null, + scrollx: !isRight, + items: [bottomLeft] + }); + this.scrollBottomRight = BI.createWidget({ + type: "bi.adaptive", + cls: "scroll-bottom-right", + width: "100%", + height: "100%", + scrollable: !isRight || null, + scrollx: isRight, + items: [bottomRight] + }); + this.topLeft = BI.createWidget({ + type: "bi.adaptive", + cls: "top-left", + scrollable: false, + items: [this.scrollTopLeft] + }); + this.topRight = BI.createWidget({ + type: "bi.adaptive", + cls: "top-right", + scrollable: false, + items: [this.scrollTopRight] + }); + this.bottomLeft = BI.createWidget({ + type: "bi.adaptive", + cls: "bottom-left", + // scrollable: false, + items: [this.scrollBottomLeft] + }); + this.bottomRight = BI.createWidget({ + type: "bi.adaptive", + cls: "bottom-right", + scrollable: false, + items: [this.scrollBottomRight] + }); + + var headerHeight = o.header.length * ((o.headerRowSize || o.rowSize) + 1) + 1; + var leftWidth = BI.sum(o.freezeCols, function (i, col) { + return o.columnSize[col] > 1 ? o.columnSize[col] + 1 : o.columnSize[col]; + }); + + this._resize = function () { + if (self.scrollBottomLeft.element.is(":visible")) { + self.scrollBottomLeft.element.css({"overflow-x": "auto"}); + self.scrollBottomRight.element.css({"overflow-x": "auto"}); + self.setColumnSize(o.columnSize); + if (isRight) { + self.scrollBottomLeft.element.css({"overflow-y": "auto"}); + } else { + self.scrollBottomRight.element.css({"overflow-y": "auto"}); + } + if (self.scrollBottomLeft.element.hasHorizonScroll() || self.scrollBottomRight.element.hasHorizonScroll()) { + self.scrollBottomLeft.element.css("overflow-x", "scroll"); + self.scrollBottomRight.element.css("overflow-x", "scroll"); + } + if (self.scrollBottomRight.element.hasVerticalScroll()) { + self.scrollTopRight.element.css("overflow-y", "scroll"); + } else { + self.scrollTopRight.element.css("overflow-y", "hidden"); + } + if (self.scrollBottomLeft.element.hasVerticalScroll()) { + self.scrollTopLeft.element.css("overflow-y", "scroll"); + } else { + self.scrollTopLeft.element.css("overflow-y", "hidden"); + } + self.scrollTopLeft.element[0].scrollLeft = self.scrollBottomLeft.element[0].scrollLeft; + self.scrollTopRight.element[0].scrollLeft = self.scrollBottomRight.element[0].scrollLeft; + self.scrollBottomLeft.element[0].scrollTop = self.scrollBottomRight.element[0].scrollTop; + } + }; + + var regionColumnSize = o.regionColumnSize; + if (o.freezeCols.length === 0) { + regionColumnSize = isRight ? ['fill', 0] : [0, 'fill']; + } else if (o.freezeCols.length >= o.columnSize.length) { + regionColumnSize = isRight ? [0, 'fill'] : ['fill', 0]; + } + this.partitions = BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic("table", BI.extend({}, o.logic, { + rows: 2, + columns: 2, + columnSize: regionColumnSize || (isRight ? ['fill', leftWidth] : [leftWidth, 'fill']), + rowSize: [headerHeight, 'fill'], + items: [[{ + el: this.topLeft + }, { + el: this.topRight + }], [{ + el: this.bottomLeft + }, { + el: this.bottomRight + }]] + })))); + + this._initFreezeScroll(); + BI.nextTick(function () { + if (self.element.is(":visible")) { + self._resize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT); + } + }); + BI.ResizeDetector.addResizeListener(this, function () { + self._resize(); + self.fireEvent(BI.Table.EVENT_TABLE_RESIZE); + }); + }, + + _initFreezeScroll: function () { + var self = this, o = this.options; + scroll(this.scrollBottomRight.element, this.scrollTopRight.element, this.scrollBottomLeft.element); + // scroll(this.scrollBottomLeft.element, this.scrollTopLeft.element, this.scrollBottomRight.element); + + function scroll(scrollElement, scrollTopElement, otherElement) { + scrollElement.scroll(function (e) { + otherElement.scrollTop(scrollElement.scrollTop()); + scrollTopElement.scrollLeft(scrollElement.scrollLeft()); + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL); + }); + } + }, + + resize: function () { + this._resize && this._resize(); + }, + + _createCells: function (items, columnSize, mergeCols, TDs, Ws, start, rowSize) { + var self = this, o = this.options, preCol = {}, preRow = {}, preRW = {}, preCW = {}, map = {}; + columnSize = columnSize || o.columnSize; + mergeCols = mergeCols || o.mergeCols; + TDs = TDs || {}; + Ws = Ws || {}; + start = start || 0; + rowSize || (rowSize = o.rowSize); + var frag = document.createDocumentFragment(); + BI.each(items, function (i, rows) { + var tr = $("<tr>").addClass((i & 1) === 0 ? "odd" : "even"); + BI.each(rows, function (j, row) { + if (!map[i]) { + map[i] = {}; + } + if (!TDs[i]) { + TDs[i] = {}; + } + if (!Ws[i]) { + Ws[i] = {}; + } + map[i][j] = row; + + if (o.isNeedMerge && mergeCols.contains(j)) { + if (i === 0 && j === 0) { + createOneEl(0, 0); + } else if (j === 0 && i > 0) { + var isNeedMergeRow = o.mergeRule(map[i][j], map[i - 1][j]); + if (isNeedMergeRow === true) { + mergeRow(i, j); + preRow[i] = preCol[j]; + preRW[i] = preCW[j]; + } else { + createOneEl(i, j); + } + } else if (i === 0 && j > 0) { + var isNeedMergeCol = o.mergeRule(map[i][j], map[i][j - 1]); + if (isNeedMergeCol === true) { + mergeCol(i, j); + preCol[j] = preRow[i]; + preCW[j] = preRW[i]; + } else { + createOneEl(i, j); + } + } else { + var isNeedMergeRow = o.mergeRule(map[i][j], map[i - 1][j]); + var isNeedMergeCol = o.mergeRule(map[i][j], map[i][j - 1]); + if (isNeedMergeCol && isNeedMergeRow) { + return; + } + if (isNeedMergeCol) { + mergeCol(i, j); + } + if (isNeedMergeRow) { + mergeRow(i, j); + } + if (!isNeedMergeCol && !isNeedMergeRow) { + createOneEl(i, j); + } + } + } else { + createOneEl(i, j); + } + }); + function mergeRow(i, j) { + var height = (preCol[j].attr("height") | 0) + rowSize + 1; + preCol[j].attr("height", height).css("height", height); + //preCW[j].element.css("height", height); + var rowspan = ((preCol[j].attr("rowspan") || 1) | 0) + 1; + preCol[j].attr("rowspan", rowspan); + preCol[j].__mergeRows.pushDistinct(i); + TDs[i][j] = preCol[j]; + Ws[i][j] = preCW[j]; + } + + function mergeCol(i, j) { + if (columnSize[j]) { + var width = preRow[i].attr("width") | 0; + if (width > 1.05 && columnSize[j]) { + width = width + columnSize[j] + 1; + if (j === columnSize.length - 1) { + width--; + } + } else { + width = width + columnSize[j] + } + width = self._calculateWidth(width); + preRow[i].attr("width", width).css("width", width); + preRW[i].element.width(width); + } + var colspan = ((preRow[i].attr("colspan") || 1) | 0) + 1; + preRow[i].attr("colspan", colspan); + preRow[i].__mergeCols.pushDistinct(j); + TDs[i][j] = preRow[i]; + Ws[i][j] = preRW[i]; + } + + function createOneEl(r, c) { + var width = self._calculateWidth(columnSize[c]); + if (width > 1.05 && c === columnSize.length - 1) { + width--; + } + var height = self._calculateHeight(rowSize); + var td = $("<td>").attr("height", height) + .attr("width", width).css({"width": width, "height": height, "position": "relative"}) + .addClass((c & 1) === 0 ? "odd-col" : "even-col") + .addClass(r === 0 ? "first-row" : "") + .addClass(c === 0 ? "first-col" : "") + .addClass(c === rows.length - 1 ? "last-col" : ""); + var w = BI.createWidget(map[r][c], { + type: "bi.table_cell", + textAlign: "left", + width: BI.isNumeric(width) ? width : "", + height: BI.isNumeric(height) ? height : "", + _row: r, + _col: c + start + }); + self.addWidget(w.getName(), w); + w._mount(); + w.element.css("position", "relative"); + td.append(w.element); + tr.append(td); + preCol[c] = td; + preCol[c].__mergeRows = [r]; + preCW[c] = w; + preRow[r] = td; + preRow[r].__mergeCols = [c]; + preRW[r] = w; + TDs[r][c] = td; + Ws[r][c] = w; + } + + frag.appendChild(tr[0]); + }); + return frag; + }, + + _createColGroupCells: function (columnSize, store) { + var self = this, o = this.options; + columnSize = columnSize || o.columnSize; + store = store || {}; + var frag = document.createDocumentFragment(); + BI.each(columnSize, function (i, size) { + var width = self._calculateWidth(size); + var col = $("<col>").attr("width", width).css("width", width); + store[i] = col; + frag.appendChild(col[0]); + }); + return frag; + }, + + _createHeaderCells: function (items, columnSize, mergeCols, TDs, Ws, start) { + var self = this, o = this.options; + start || (start = 0); + var frag = this._createCells(items, columnSize, BI.range(o.columnSize.length), TDs, Ws, start, o.headerRowSize || o.rowSize); + + return frag; + }, + + _createFooterCells: function (items, columnSize, TDs, Ws) { + var o = this.options; + var frag = this._createCells(items, columnSize, [], TDs, Ws, 0); + return frag; + }, + + _createColGroup: function (columnSize, store, widgets) { + var self = this, o = this.options; + this.colgroup = this._colgroup(); + this.colgroup.element.append(this._createColGroupCells(columnSize, store, widgets)); + return this.colgroup; + }, + + _createHeader: function () { + var self = this, o = this.options; + if (o.header === false) { + return; + } + this.header = this._header(); + this.header.element.append(this._createHeaderCells(o.header, null, null, this.headerTds, this.headerItems)); + return this.header; + }, + + _createFooter: function (columnSize, store, widgets) { + var self = this, o = this.options; + if (o.footer === false) { + return; + } + this.footer = this._footer(); + this.footer.element.append(this._createFooterCells(o.footer, null, this.footerTds, this.footerItems)); + return this.footer; + }, + + + _createBody: function () { + var self = this, o = this.options; + this.body = this._body(); + this.body.element.append(this._createCells(o.items, null, null, this.bodyTds, this.bodyItems)); + return this.body; + }, + + _createNormalTable: function () { + var self = this, o = this.options, table = this._table(); + this.colgroupTds = {}; + this.headerTds = {}; + this.footerTds = {}; + this.bodyTds = {}; + + this.headerItems = {}; + this.footerItems = {}; + this.bodyItems = {}; + var colgroup = this._createColGroup(null, this.colgroupTds); + var header = this._createHeader(); + var footer = this._createFooter(); + var body = this._createBody(); + + BI.createWidget({ + type: "bi.adaptive", + element: table, + items: [colgroup, header, footer, body] + }); + + var w = BI.sum(this.options.columnSize) || undefined; + w = this._calculateWidth(w); + if (BI.isNumeric(w) && w > 1) { + w += o.columnSize.length; + } + this.tableContainer = BI.createWidget({ + type: "bi.adaptive", + width: this._calculateWidth(w), + items: [table] + }); + + this.scrollBottomRight = BI.createWidget({ + type: "bi.adaptive", + width: "100%", + height: "100%", + cls: "scroll-bottom-right", + scrollable: true, + items: [this.tableContainer] + }); + + BI.createWidget({ + type: "bi.adaptive", + cls: "bottom-right", + element: this, + scrollable: false, + items: [this.scrollBottomRight] + }); + + this._initNormalScroll(); + BI.nextTick(function () { + if (self.element.is(":visible")) { + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT); + } + }); + }, + + _initNormalScroll: function () { + var self = this; + this.scrollBottomRight.element.scroll(function (e) { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL); + }); + }, + + _split: function (items) { + var o = this.options, left = [], right = [], isRight = this._isRightFreeze(); + BI.each(items, function (i, rows) { + left.push([]); + right.push([]); + BI.each(rows, function (j, cell) { + if (o.freezeCols.contains(j)) { + (isRight ? right : left)[i].push(cell); + } else { + (isRight ? left : right)[i].push(cell); + } + }) + }); + return { + left: left, + right: right + } + }, + + _table: function () { + return BI.createWidget({ + type: "bi.layout", + tagName: "table", + cls: "table", + attribute: {"cellspacing": 0, "cellpadding": 0} + }); + }, + + _header: function () { + return BI.createWidget({ + type: "bi.layout", + cls: "header", + tagName: "thead" + }); + }, + + _footer: function () { + return BI.createWidget({ + type: "bi.layout", + cls: "footer", + tagName: "tfoot" + }); + }, + + _body: function () { + return BI.createWidget({ + type: "bi.layout", + tagName: "tbody", + cls: "body" + }); + }, + + _colgroup: function () { + return BI.createWidget({ + type: "bi.layout", + tagName: "colgroup" + }); + }, + + _init: function () { + BI.Table.superclass._init.apply(this, arguments); + + this.populate(this.options.items); + }, + + setColumnSize: function (columnSize) { + var self = this, o = this.options; + var isRight = this._isRightFreeze(); + o.columnSize = columnSize || []; + if (o.isNeedFreeze) { + var columnLeft = []; + var columnRight = []; + BI.each(o.columnSize, function (i, size) { + if (o.freezeCols.contains(i)) { + isRight ? columnRight.push(size) : columnLeft.push(size); + } else { + isRight ? columnLeft.push(size) : columnRight.push(size); + } + }); + var topleft = 0, topright = 1, bottomleft = 2, bottomright = 3; + var run = function (direction) { + var colgroupTds, bodyTds, bodyItems, sizes; + switch (direction) { + case topleft: + colgroupTds = self.topLeftColGroupTds; + bodyTds = self.topLeftBodyTds; + bodyItems = self.topLeftBodyItems; + sizes = columnLeft; + break; + case topright: + colgroupTds = self.topRightColGroupTds; + bodyTds = self.topRightBodyTds; + bodyItems = self.topRightBodyItems; + sizes = columnRight; + break; + case bottomleft: + colgroupTds = self.bottomLeftColGroupTds; + bodyTds = self.bottomLeftBodyTds; + bodyItems = self.bottomLeftBodyItems; + sizes = columnLeft; + break; + case bottomright: + colgroupTds = self.bottomRightColGroupTds; + bodyTds = self.bottomRightBodyTds; + bodyItems = self.bottomRightBodyItems; + sizes = columnRight; + break; + } + BI.each(colgroupTds, function (i, colgroup) { + var width = colgroup.attr("width") | 0; + if (sizes[i] !== "" && width !== sizes[i]) { + var w = self._calculateWidth(sizes[i]); + colgroup.attr("width", w).css("width", w); + BI.each(bodyTds, function (j, items) { + if (items[i]) { + if (items[i].__mergeCols.length > 1) { + var wid = 0; + BI.each(sizes, function (t, s) { + if (items[i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += items[i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].attr("width", wid - 1).css("width", wid - 1); + } else { + items[i].attr("width", wid).css("width", wid); + } + } else { + items[i].attr("width", "").css("width", ""); + } + } else { + if (i == BI.size(items) - 1) { + items[i].attr("width", w - 1).css("width", w - 1); + } else { + items[i].attr("width", w).css("width", w); + } + } + } + }); + BI.each(bodyItems, function (j, items) { + if (items[i]) { + if (bodyTds[j][i].__mergeCols.length > 1) { + var wid = 0; + BI.each(sizes, function (t, s) { + if (bodyTds[j][i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += bodyTds[j][i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", wid - 1).css("width", wid - 1); + } else { + items[i].element.attr("width", wid).css("width", wid); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } else { + if (BI.isNumeric(w)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", w - 1).css("width", w - 1); + } else { + items[i].element.attr("width", w).css("width", w); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } + } + }); + } + }) + }; + run(topleft); + run(topright); + run(bottomleft); + run(bottomright); + + var lw = 0, rw = 0; + this.columnLeft = []; + this.columnRight = []; + BI.each(o.columnSize, function (i, size) { + if (o.freezeCols.contains(i)) { + lw += size; + self[isRight ? "columnRight" : "columnLeft"].push(size); + } else { + rw += size; + self[isRight ? "columnLeft" : "columnRight"].push(size); + } + }); + lw = this._calculateWidth(lw); + rw = this._calculateWidth(rw); + + if (BI.isNumeric(lw)) { + lw = BI.parseFloat(lw) + o.freezeCols.length; + } + if (BI.isNumeric(rw)) { + rw = BI.parseFloat(rw) + o.columnSize.length - o.freezeCols.length; + } + this.topLeftContainer.element.width(isRight ? rw : lw); + this.bottomLeftContainer.element.width(isRight ? rw : lw); + this.topRightContainer.element.width(isRight ? lw : rw); + this.bottomRightContainer.element.width(isRight ? lw : rw); + this.scrollTopLeft.element[0].scrollLeft = this.scrollBottomLeft.element[0].scrollLeft; + this.scrollTopRight.element[0].scrollLeft = this.scrollBottomRight.element[0].scrollLeft; + } else { + BI.each(this.colgroupTds, function (i, colgroup) { + var width = colgroup.attr("width") | 0; + if (o.columnSize[i] !== "" && width !== o.columnSize[i]) { + var w = self._calculateWidth(o.columnSize[i]); + colgroup.attr("width", w).css("width", w); + BI.each(self.bodyTds, function (j, items) { + if (items[i]) { + if (items[i].__mergeCols.length > 1) { + var wid = 0; + BI.each(o.columnSize, function (t, s) { + if (items[i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += items[i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].attr("width", w - 1).css("width", w - 1); + } else { + items[i].attr("width", w).css("width", w); + } + } else { + items[i].attr("width", "").css("width", ""); + } + } else { + if (i == BI.size(items) - 1) { + items[i].attr("width", w - 1).css("width", w - 1); + } else { + items[i].attr("width", w).css("width", w); + } + } + } + }); + BI.each(self.headerTds, function (j, items) { + if (items[i]) { + if (items[i].__mergeCols.length > 1) { + var wid = 0; + BI.each(o.columnSize, function (t, s) { + if (items[i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += items[i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].attr("width", w - 1).css("width", w - 1); + } else { + items[i].attr("width", w).css("width", w); + } + } else { + items[i].attr("width", "").css("width", ""); + } + } else { + if (i == BI.size(items) - 1) { + items[i].attr("width", w - 1).css("width", w - 1); + } else { + items[i].attr("width", w).css("width", w); + } + } + } + }); + BI.each(self.footerTds, function (j, items) { + if (items[i]) { + if (items[i].__mergeCols.length > 1) { + var wid = 0; + BI.each(o.columnSize, function (t, s) { + if (items[i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += items[i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].attr("width", w - 1).css("width", w - 1); + } else { + items[i].attr("width", w).css("width", w); + } + } else { + items[i].attr("width", "").css("width", ""); + } + } else { + if (i == BI.size(items) - 1) { + items[i].attr("width", w - 1).css("width", w - 1); + } else { + items[i].attr("width", w).css("width", w); + } + } + } + }); + BI.each(self.bodyItems, function (j, items) { + if (items[i]) { + if (self.bodyTds[j][i].__mergeCols.length > 1) { + var wid = 0; + BI.each(o.columnSize, function (t, s) { + if (self.bodyTds[j][i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += self.bodyTds[j][i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", wid - 1).css("width", wid - 1); + } else { + items[i].element.attr("width", wid).css("width", wid); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } else { + if (BI.isNumeric(w)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", w - 1).css("width", w - 1); + } else { + items[i].element.attr("width", w).css("width", w); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } + } + }); + BI.each(self.headerItems, function (j, items) { + if (items[i]) { + if (self.headerTds[j][i].__mergeCols.length > 1) { + var wid = 0; + BI.each(o.columnSize, function (t, s) { + if (self.headerTds[j][i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += self.headerTds[j][i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", wid - 1).css("width", wid - 1); + } else { + items[i].element.attr("width", wid).css("width", wid); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } else { + if (BI.isNumeric(w)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", w - 1).css("width", w - 1); + } else { + items[i].element.attr("width", w).css("width", w); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } + } + }); + BI.each(self.footerItems, function (j, items) { + if (items[i]) { + if (self.footerTds[j][i].__mergeCols.length > 1) { + var wid = 0; + BI.each(o.columnSize, function (t, s) { + if (self.footerTds[j][i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += self.footerTds[j][i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", wid - 1).css("width", wid - 1); + } else { + items[i].element.attr("width", wid).css("width", wid); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } else { + if (BI.isNumeric(w)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", w - 1).css("width", w - 1); + } else { + items[i].element.attr("width", w).css("width", w); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } + } + }); + } + }); + var w = this._calculateWidth(BI.sum(o.columnSize)); + if (w > 1.05) { + w += o.columnSize.length; + } + if (w > 1.05) { + this.tableContainer.element.width(w); + } + } + }, + + getColumnSize: function () { + return this.options.columnSize; + }, + + getCalculateColumnSize: function () { + var self = this, o = this.options; + var columnSize = []; + if (o.isNeedFreeze === true) { + if (BI.size(this.bottomLeftBodyTds) > 0 || BI.size(this.bottomRightBodyTds) > 0) { + if (!BI.any(this.bottomLeftBodyTds, function (i, tds) { + if (!BI.any(tds, function (i, item) { + if (item.__mergeCols.length > 1) { + return true; + } + })) { + BI.each(tds, function (i, item) { + var width = item.width() / item.__mergeCols.length; + if (i == BI.size(tds) - 1) { + width++; + } + columnSize.push(width); + }); + return true; + } + })) { + BI.each(this.bottomLeftBodyTds[0], function (i, item) { + var width = item.width() / item.__mergeCols.length; + if (i == BI.size(self.bottomLeftBodyTds[0]) - 1) { + width++; + } + columnSize.push(width); + }); + } + if (!BI.any(this.bottomRightBodyTds, function (i, tds) { + if (!BI.any(tds, function (i, item) { + if (item.__mergeCols.length > 1) { + return true; + } + })) { + BI.each(tds, function (i, item) { + var width = item.width() / item.__mergeCols.length; + if (i == BI.size(tds) - 1) { + width++; + } + columnSize.push(width); + }); + return true; + } + })) { + BI.each(this.bottomRightBodyTds[0], function (i, item) { + var width = item.width() / item.__mergeCols.length; + if (i == BI.size(self.bottomRightBodyTds[0]) - 1) { + width++; + } + columnSize.push(width); + }); + } + return columnSize; + } + if (!BI.any(this.topLeftBodyTds, function (i, tds) { + if (!BI.any(tds, function (i, item) { + if (item.__mergeCols.length > 1) { + return true; + } + })) { + BI.each(tds, function (i, item) { + var width = item.width() / item.__mergeCols.length; + if (i == BI.size(tds) - 1) { + width++; + } + columnSize.push(width); + }); + return true; + } + })) { + BI.each(this.topLeftBodyTds[BI.size(this.topLeftBodyTds) - 1], function (i, item) { + var width = item.width() / item.__mergeCols.length; + if (i == BI.size(self.topLeftBodyTds[BI.size(self.topLeftBodyTds) - 1]) - 1) { + width++; + } + columnSize.push(width); + }); + } + if (!BI.any(this.topRightBodyTds, function (i, tds) { + if (!BI.any(tds, function (i, item) { + if (item.__mergeCols.length > 1) { + return true; + } + })) { + BI.each(tds, function (i, item) { + var width = item.width() / item.__mergeCols.length; + if (i == BI.size(tds) - 1) { + width++; + } + columnSize.push(width); + }); + return true; + } + })) { + BI.each(this.topRightBodyTds[BI.size(this.topRightBodyTds) - 1], function (i, item) { + var width = item.width() / item.__mergeCols.length; + if (i == BI.size(self.topRightBodyTds[BI.size(self.topRightBodyTds) - 1]) - 1) { + width++; + } + columnSize.push(width); + }); + } + } else { + BI.each(this.headerTds[BI.size(this.headerTds) - 1], function (i, item) { + var width = item.width() / item.__mergeCols.length; + if (i == BI.size(self.headerTds[BI.size(self.headerTds) - 1]) - 1) { + width++; + } + columnSize.push(width); + }); + } + return columnSize; + }, + + setHeaderColumnSize: function (columnSize) { + var self = this, o = this.options; + var isRight = this._isRightFreeze(); + if (o.isNeedFreeze) { + var columnLeft = []; + var columnRight = []; + BI.each(columnSize, function (i, size) { + if (o.freezeCols.contains(i)) { + isRight ? columnRight.push(size) : columnLeft.push(size); + } else { + isRight ? columnLeft.push(size) : columnRight.push(size); + } + }); + var topleft = 0, topright = 1; + var run = function (direction) { + var colgroupTds, bodyTds, bodyItems, sizes; + switch (direction) { + case topleft: + colgroupTds = self.topLeftColGroupTds; + bodyTds = self.topLeftBodyTds; + bodyItems = self.topLeftBodyItems; + sizes = columnLeft; + break; + case topright: + colgroupTds = self.topRightColGroupTds; + bodyTds = self.topRightBodyTds; + bodyItems = self.topRightBodyItems; + sizes = columnRight; + break; + } + BI.each(colgroupTds, function (i, colgroup) { + var width = colgroup.attr("width") | 0; + if (width !== sizes[i]) { + var w = self._calculateWidth(sizes[i]); + colgroup.attr("width", w).css("width", w); + BI.each(bodyTds, function (j, items) { + if (items[i]) { + if (items[i].__mergeCols.length > 1) { + var wid = 0; + BI.each(sizes, function (t, s) { + if (items[i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += items[i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].attr("width", wid - 1).css("width", wid - 1); + } else { + items[i].attr("width", wid).css("width", wid); + } + } else { + items[i].attr("width", "").css("width", ""); + } + } else { + if (i == BI.size(items) - 1) { + items[i].attr("width", w - 1).css("width", w - 1); + } else { + items[i].attr("width", w).css("width", w); + } + } + } + }); + BI.each(bodyItems, function (j, items) { + if (items[i]) { + if (bodyTds[j][i].__mergeCols.length > 1) { + var wid = 0; + BI.each(sizes, function (t, s) { + if (bodyTds[j][i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += bodyTds[j][i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", wid - 1).css("width", wid - 1); + } else { + items[i].element.attr("width", wid).css("width", wid); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } else { + if (BI.isNumeric(w)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", w - 1).css("width", w - 1); + } else { + items[i].element.attr("width", w).css("width", w); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } + } + }); + } + }) + }; + run(topleft); + run(topright); + + var lw = 0, rw = 0; + BI.each(columnSize, function (i, size) { + if (o.freezeCols.contains(i)) { + lw += size; + } else { + rw += size; + } + }); + lw = this._calculateWidth(lw); + rw = this._calculateWidth(rw); + + if (BI.isNumeric(lw)) { + lw = BI.parseFloat(lw) + o.freezeCols.length; + } + if (BI.isNumeric(rw)) { + rw = BI.parseFloat(rw) + columnSize.length - o.freezeCols.length; + } + this.topLeftContainer.element.width(isRight ? rw : lw); + this.topRightContainer.element.width(isRight ? lw : rw); + this.scrollTopLeft.element[0].scrollLeft = this.scrollBottomLeft.element[0].scrollLeft; + this.scrollTopRight.element[0].scrollLeft = this.scrollBottomRight.element[0].scrollLeft; + } else { + BI.each(this.colgroupTds, function (i, colgroup) { + var width = colgroup.attr("width") | 0; + if (width !== columnSize[i]) { + var w = self._calculateWidth(columnSize[i]); + colgroup.attr("width", w).css("width", w); + BI.each(self.headerTds, function (j, items) { + if (items[i]) { + if (items[i].__mergeCols.length > 1) { + var wid = 0; + BI.each(columnSize, function (t, s) { + if (items[i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += items[i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", wid - 1).css("width", wid - 1); + } else { + items[i].element.attr("width", wid).css("width", wid); + } + } else { + items[i].attr("width", "").css("width", ""); + } + } else { + if (i == BI.size(items) - 1) { + items[i].attr("width", w - 1).css("width", w - 1); + } else { + items[i].attr("width", w).css("width", w); + } + } + } + }); + BI.each(self.headerItems, function (j, items) { + if (items[i]) { + if (self.headerTds[j][i].__mergeCols.length > 1) { + var wid = 0; + BI.each(columnSize, function (t, s) { + if (self.headerTds[j][i].__mergeCols.contains(t)) { + wid += s; + } + }); + wid = self._calculateWidth(wid); + if (wid > 1) { + wid += self.headerTds[j][i].__mergeCols.length - 1; + } + if (BI.isNumeric(wid)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", wid - 1).css("width", wid - 1); + } else { + items[i].element.attr("width", wid).css("width", wid); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } else { + if (BI.isNumeric(w)) { + if (i == BI.size(items) - 1) { + items[i].element.attr("width", w - 1).css("width", w - 1); + } else { + items[i].element.attr("width", w).css("width", w); + } + } else { + items[i].element.attr("width", "").css("width", ""); + } + } + } + }); + } + }); + var cW = this._calculateWidth(BI.sum(columnSize)); + if (cW > 1.05) { + cW = cW + columnSize.length; + } + this.tableContainer.element.width(cW); + } + }, + + setRegionColumnSize: function (columnSize) { + var self = this, o = this.options; + o.regionColumnSize = columnSize; + if (o.freezeCols.length === 0) { + if (o.isNeedFreeze) { + this.partitions.attr("columnSize", this._isRightFreeze() ? ['fill', 0] : [0, 'fill']); + this.partitions.resize(); + } else { + this.tableContainer.element.width(columnSize[0]); + } + } else if (o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) { + if (o.isNeedFreeze) { + this.partitions.attr("columnSize", columnSize); + this.partitions.resize(); + } else { + this.tableContainer.element.width(columnSize[0]); + } + } else { + if (o.isNeedFreeze) { + this.partitions.attr("columnSize", this._isRightFreeze() ? [0, 'fill'] : ['fill', 0]); + this.partitions.resize(); + } else { + this.tableContainer.element.width(columnSize[0]); + } + } + }, + + getRegionColumnSize: function () { + return this.options.regionColumnSize; + }, + + getCalculateRegionColumnSize: function () { + var o = this.options; + if (o.isNeedFreeze) { + return [this.scrollBottomLeft.element.width(), this.scrollBottomRight.element.width()]; + } + return [this.scrollBottomRight.element.width()]; + }, + + getCalculateRegionRowSize: function () { + var o = this.options; + if (o.isNeedFreeze) { + return [this.scrollTopRight.element.height(), this.scrollBottomRight.element.height()]; + } + return [this.scrollBottomRight.element.height()]; + }, + + getClientRegionColumnSize: function () { + var o = this.options; + if (o.isNeedFreeze) { + return [this.scrollBottomLeft.element[0].clientWidth, this.scrollBottomRight.element[0].clientWidth]; + } + return [this.scrollBottomRight.element[0].clientWidth]; + }, + + getClientRegionRowSize: function () { + var o = this.options; + if (o.isNeedFreeze) { + return [this.scrollBottomLeft.element[0].clientHeight, this.scrollBottomRight.element[0].clientHeight]; + } + return [this.scrollBottomRight.element[0].clientHeight]; + }, + + getScrollRegionColumnSize: function () { + var o = this.options; + if (o.isNeedFreeze) { + return [this.scrollBottomLeft.element[0].scrollWidth, this.scrollBottomRight.element[0].scrollWidth]; + } + return [this.scrollBottomRight.element[0].scrollWidth]; + }, + + getScrollRegionRowSize: function () { + var o = this.options; + if (o.isNeedFreeze) { + if (o.freezeCols.length < o.columnSize.length) { + return [this.scrollTopRight.element[0].scrollHeight, this.scrollBottomRight.element[0].scrollHeight]; + } else { + return [this.scrollTopLeft.element[0].scrollHeight, this.scrollBottomLeft.element[0].scrollHeight]; + } + } + return [this.scrollBottomRight.element[0].scrollHeight]; + }, + + hasVerticalScroll: function () { + var o = this.options; + if (o.isNeedFreeze) { + return this.scrollBottomRight.element.hasVerticalScroll() || this.scrollBottomLeft.element.hasVerticalScroll(); + } + return this.scrollBottomRight.element.hasVerticalScroll(); + }, + + setVerticalScroll: function (scrollTop) { + var o = this.options; + if (o.isNeedFreeze) { + if (this.scrollBottomRight.element[0].scrollTop !== scrollTop) { + this.scrollBottomRight.element[0].scrollTop = scrollTop; + } + if (this.scrollBottomLeft.element[0].scrollTop !== scrollTop) { + this.scrollBottomLeft.element[0].scrollTop = scrollTop; + } + } else { + if (this.scrollBottomRight.element[0].scrollTop !== scrollTop) { + this.scrollBottomRight.element[0].scrollTop = scrollTop; + } + } + }, + + setLeftHorizontalScroll: function (scrollLeft) { + var o = this.options; + if (o.isNeedFreeze) { + if (this.scrollBottomLeft.element[0].scrollLeft !== scrollLeft) { + this.scrollBottomLeft.element[0].scrollLeft = scrollLeft; + } + if (this.scrollTopLeft.element[0].scrollLeft !== scrollLeft) { + this.scrollTopLeft.element[0].scrollLeft = scrollLeft; + } + } else { + if (this.scrollBottomRight.element[0].scrollLeft !== scrollLeft) { + this.scrollBottomRight.element[0].scrollLeft = scrollLeft; + } + } + }, + + setRightHorizontalScroll: function (scrollLeft) { + var o = this.options; + if (o.isNeedFreeze) { + if (this.scrollBottomRight.element[0].scrollLeft !== scrollLeft) { + this.scrollBottomRight.element[0].scrollLeft = scrollLeft; + } + if (this.scrollTopRight.element[0].scrollLeft !== scrollLeft) { + this.scrollTopRight.element[0].scrollLeft = scrollLeft; + } + } else { + if (this.scrollBottomRight.element[0].scrollLeft !== scrollLeft) { + this.scrollBottomRight.element[0].scrollLeft = scrollLeft; + } + } + }, + + getVerticalScroll: function () { + var o = this.options; + if (o.isNeedFreeze) { + return this.scrollBottomRight.element[0].scrollTop || this.scrollBottomLeft.element[0].scrollTop; + } + return this.scrollBottomRight.element[0].scrollTop; + }, + + getLeftHorizontalScroll: function () { + var o = this.options; + if (o.isNeedFreeze) { + return this.scrollBottomLeft.element[0].scrollLeft; + } + return this.scrollBottomRight.element[0].scrollLeft; + }, + + getRightHorizontalScroll: function () { + var o = this.options; + if (o.isNeedFreeze) { + return this.scrollBottomRight.element[0].scrollLeft; + } + return this.scrollBottomRight.element[0].scrollLeft; + }, + + getColumns: function () { + var o = this.options; + if (o.isNeedFreeze) { + return { + topLeft: this.topLeftBodyItems, + topRight: this.topRightBodyItems, + bottomLeft: this.bottomLeftBodyItems, + bottomRight: this.bottomRightBodyItems + } + } else { + return { + header: this.headerItems, + body: this.bodyItems, + footer: this.footerItems + } + } + }, + + populate: function (items, header) { + this.options.items = items || []; + if (header) { + this.options.header = header; + } + this.empty(); + if (this.options.isNeedFreeze) { + this._createFreezeTable(); + } else { + this._createNormalTable(); + } + } +}) +; +BI.Table.EVENT_TABLE_AFTER_INIT = "EVENT_TABLE_AFTER_INIT"; +BI.Table.EVENT_TABLE_RESIZE = "EVENT_TABLE_RESIZE"; +BI.Table.EVENT_TABLE_SCROLL = "EVENT_TABLE_SCROLL"; +BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE = "EVENT_TABLE_BEFORE_COLUMN_RESIZE"; +BI.Table.EVENT_TABLE_COLUMN_RESIZE = "EVENT_TABLE_COLUMN_RESIZE"; +BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE = "EVENT_TABLE_AFTER_COLUMN_RESIZE"; + +BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE = "EVENT_TABLE_BEFORE_REGION_RESIZE"; +BI.Table.EVENT_TABLE_REGION_RESIZE = "EVENT_TABLE_REGION_RESIZE"; +BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE = "EVENT_TABLE_AFTER_REGION_RESIZE"; +BI.shortcut("bi.table_view", BI.Table); +/** + * + * 表格单元格 + * + * Created by GUY on 2016/1/12. + * @class BI.ResizableTableCell + * @extends BI.Widget + */ +BI.ResizableTableCell = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-resizable-table-cell", + cell: {}, + minSize: 15, + // suitableSize, + maxSize: Number.MAX_VALUE, + start: BI.emptyFn, + resize: BI.emptyFn, + stop: BI.emptyFn + }) + }, + + _init: function () { + BI.ResizableTableCell.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.cell = BI.createWidget(BI.extend({type: "bi.label"}, o.cell, {width: o.width, height: o.height})); + + var startDrag = false; + var size = 0, offset = 0, defaultSize = o.width; + + function optimizeSize(s) { + var optSize = BI.clamp(s, o.minSize, o.maxSize || Number.MAX_VALUE); + // if (o.suitableSize) { + // if (Math.abs(o.suitableSize - optSize) < 5) { + // optSize = o.suitableSize; + // self.handler.element.addClass("suitable"); + // } else { + // self.handler.element.removeClass("suitable"); + // } + // } + return optSize; + } + + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) { + if (mouseMoveTracker.isDragging()) { + startDrag = true; + offset += deltaX; + size = optimizeSize(defaultSize + offset); + self.handler.element.addClass("dragging"); + o.resize(size); + } + }, function () { + if (startDrag === true) { + size = optimizeSize(size); + o.stop(size); + size = 0; + offset = 0; + defaultSize = o.width; + startDrag = false; + } + self.handler.element.removeClass("dragging"); + self.handler.element.removeClass("suitable"); + mouseMoveTracker.releaseMouseMoves(); + }, document); + this.handler = BI.createWidget({ + type: "bi.absolute", + cls: "resizable-table-cell-resizer-container", + width: 6, + items: [{ + el: { + type: "bi.layout", + cls: "resizable-table-cell-resizer-knob", + width: 4 + }, + right: 0, + top: 0, + bottom: 0 + }] + }); + this.handler.element.on("mousedown", function (event) { + defaultSize = o.width; + optimizeSize(defaultSize); + mouseMoveTracker.captureMouseMoves(event); + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.cell, + left: 0, + right: 0, + top: 0, + bottom: 0 + }, { + el: this.handler, + right: 0, + top: 0, + bottom: 0 + }] + }) + }, + + setWidth: function (width) { + BI.ResizableTableCell.superclass.setWidth.apply(this, arguments); + var o = this.options; + this.cell.setWidth(o.width); + }, + + setHeight: function (height) { + BI.ResizableTableCell.superclass.setHeight.apply(this, arguments); + var o = this.options; + this.cell.setHeight(o.height); + } +}); +BI.shortcut("bi.resizable_table_cell", BI.ResizableTableCell);/** + * + * 可调整列宽的grid表格 + * + * Created by GUY on 2016/1/12. + * @class BI.ResizableTable + * @extends BI.Widget + */ +BI.ResizableTable = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.ResizableTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-resizable-table", + el: { + type: "bi.grid_table" + }, + isNeedFreeze: false, + isNeedResize: true, + isResizeAdapt: false, + headerRowSize: 25, + rowSize: 25, + isNeedMerge: true,//是否需要合并单元格 + mergeCols: [], + mergeRule: BI.emptyFn, + columnSize: [], + minColumnSize: [], + maxColumnSize: [], + freezeCols: [], + header: [], + items: [], + regionColumnSize: [] + }) + }, + + _init: function () { + BI.ResizableTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.resizer = BI.createWidget({ + type: "bi.layout", + cls: "resizable-table-resizer", + invisible: true, + width: 2 + }); + this.regionResizerHandler = this._createResizerHandler(); + this.table = BI.createWidget(o.el, { + type: "bi.grid_table", + element: this, + width: o.width, + height: o.height, + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + columnSize: o.columnSize, + + isNeedFreeze: o.isNeedFreeze, + freezeCols: o.freezeCols, + isNeedMerge: o.isNeedMerge, + mergeCols: o.mergeCols, + mergeRule: BI.bind(this._mergeRule, this), + + header: this._formatHeader(o.header), + items: o.items, + regionColumnSize: o.regionColumnSize + }); + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.regionResizerHandler, + left: 0, + top: 0, + bottom: 0 + }, { + el: this.resizer, + left: 0, + top: 0 + }] + }); + this._populate(); + }, + + _mergeRule: function (row1, row2) { + var o = this.options; + if (row1.type === "bi.resizable_table_cell") { + row1 = row1.cell; + } + if (row2.type === "bi.resizable_table_cell") { + row2 = row2.cell; + } + return o.mergeRule(row1, row2); + }, + + _createResizerHandler: function () { + var self = this, o = this.options; + var regionResizerHandler = BI.createWidget({ + type: "bi.absolute", + cls: "resizable-table-region-resizer", + invisible: true, + width: 6, + items: [{ + el: { + type: "bi.layout", + width: 2, + cls: "resizable-table-region-resizer-knob" + }, + left: 2, + top: 0, + bottom: 0 + }] + }); + var size = 0, offset = 0, defaultSize = 0, start = false; + var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) { + if (mouseMoveTracker.isDragging()) { + start = true; + offset += deltaX; + size = BI.clamp(defaultSize + offset, 15, o.width - 15); + + self.regionResizerHandler.element.addClass("dragging"); + self._setRegionResizerHandlerPosition(size - 3, 0); + } + + }, function () { + if (start === true) { + o.regionColumnSize[0] = BI.clamp(size, 15, o.width - 15); + self.table.setRegionColumnSize(o.regionColumnSize); + if (o.isResizeAdapt === true) { + var freezeColumnSize = self._getFreezeColumnSize(); + o.columnSize[self._getFreezeColLength() - 1] += o.regionColumnSize[0] - freezeColumnSize; + self.table.setColumnSize(o.columnSize); + } + self.table.populate(); + self._populate(); + self.regionResizerHandler.element.removeClass("dragging"); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE); + start = false; + } + mouseMoveTracker.releaseMouseMoves(); + }, document); + regionResizerHandler.element.on("mousedown", function (event) { + defaultSize = size = self._getRegionSize(); + offset = 0; + self._setResizerPosition(0, 0); + mouseMoveTracker.captureMouseMoves(event); + }); + return regionResizerHandler; + }, + + _setResizerPosition: function (left, top) { + this.resizer.element.css({ + left: left + "px", + top: top + "px" + }); + }, + + _setRegionResizerHandlerPosition: function (left, top) { + this.regionResizerHandler.element.css({ + left: left + "px", + top: top + "px" + }); + }, + + _getRegionSize: function () { + var o = this.options; + var regionSize = o.regionColumnSize[0] || 0; + if (o.isNeedFreeze === false || o.freezeCols.length === 0) { + return 0; + } + if (!regionSize) { + BI.each(o.freezeCols, function (i, col) { + regionSize += o.columnSize[col]; + }); + } + return regionSize; + }, + + _getRegionRowSize: function () { + var o = this.options; + return [o.header.length * o.headerRowSize, + Math.min(o.height - o.header.length * o.headerRowSize, o.items.length * o.rowSize)]; + }, + + _getFreezeColLength: function () { + return this.options.freezeCols.length; + }, + + _getFreezeColumnSize: function () { + var columnSize = this.options.columnSize; + var sum = 0; + for (var i = 0, len = this._getFreezeColLength(); i < len; i++) { + sum += columnSize[i]; + } + return sum; + }, + + _getResizerLeft: function (j) { + var left = 0; + var columnSize = this.options.columnSize; + var freezeColLength = this._getFreezeColLength(); + for (var i = (j >= freezeColLength ? freezeColLength : 0); i < j; i++) { + left += columnSize[i] || 0; + } + if (j >= freezeColLength) { + left += this.table.getRegionSize(); + left -= this.table.getRightHorizontalScroll(); + } else { + left -= this.table.getLeftHorizontalScroll(); + } + return left; + }, + + _formatHeader: function (header) { + var self = this, o = this.options; + var result = []; + var resize = function (j, size) { + self.resizer.setVisible(true); + var height = o.headerRowSize + self._getRegionRowSize()[1]; + self.resizer.setHeight(height); + //TODO 不知道为什么加入这段代码会使得列宽调整出问题 + // if (o.minColumnSize[j]) { + // if (size === o.minColumnSize[j]) { + // self.resizer.element.addClass("suitable"); + // } else { + // self.resizer.element.removeClass("suitable"); + // } + // } + self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); + }; + var stop = function (j, size) { + self.resizer.setVisible(false); + var columnSize = o.columnSize.slice(); + columnSize[j] = size; + o.columnSize = columnSize; + self.table.setColumnSize(columnSize); + self.table.populate(); + self._populate(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE); + }; + BI.each(header, function (i, cols) { + if (i === header.length - 1) { + result[i] = []; + BI.each(cols, function (j, col) { + if (j === self._getFreezeColLength() - 1 || j === cols.length - 1) { + result[i][j] = col; + } else { + result[i][j] = { + type: "bi.resizable_table_cell", + cell: col, + suitableSize: o.minColumnSize[j], + maxSize: o.maxColumnSize[j], + resize: BI.bind(resize, null, j), + stop: BI.bind(stop, null, j) + }; + if (o.isNeedMerge) { + var r = i; + while (r > 0 && self._mergeRule(result[r][j], result[r - 1][j])) { + result[r - 1][j] = { + type: "bi.resizable_table_cell", + cell: result[r - 1][j], + suitableSize: o.minColumnSize[j], + maxSize: o.maxColumnSize[j], + resize: BI.bind(resize, null, j), + stop: BI.bind(stop, null, j) + }; + r--; + } + } + } + }); + } else { + result.push(cols); + } + }); + return result; + }, + + _populate: function () { + var o = this.options; + var regionSize = this._getRegionSize(); + if (regionSize > 0) { + this.regionResizerHandler.setVisible(true); + this._setRegionResizerHandlerPosition(regionSize - 3, 0); + } else { + this.regionResizerHandler.setVisible(false); + } + }, + + setWidth: function (width) { + BI.ResizableTable.superclass.setWidth.apply(this, arguments); + this.table.setWidth(width) + }, + + setHeight: function (height) { + BI.ResizableTable.superclass.setHeight.apply(this, arguments); + this.table.setHeight(height); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this.table.setColumnSize(columnSize); + }, + + getColumnSize: function () { + return this.table.getColumnSize(); + }, + + setRegionColumnSize: function (columnSize) { + this.options.regionColumnSize = columnSize; + this.table.setRegionColumnSize(columnSize); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, + + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + attr: function () { + BI.ResizableTable.superclass.attr.apply(this, arguments); + this.table.attr.apply(this.table, arguments); + }, + + restore: function () { + this.table.restore(); + }, + + populate: function (items, header) { + if (items) { + this.options.items = items; + } + if (header) { + this.options.header = header; + if (this.options.isNeedResize) { + header = this._formatHeader(header); + } + } + this.table.populate(items, header); + this._populate(); + } +}); + +BI.shortcut("bi.resizable_table", BI.ResizableTable);/** + * + * 自定义树 + * + * Created by GUY on 2015/9/7. + * @class BI.CustomTree + * @extends BI.Single + */ +BI.CustomTree = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.CustomTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-custom-tree", + expander: { + el: {}, + popup: { + type: "bi.custom_tree" + } + }, + + items: [], + itemsCreator: BI.emptyFn, + + el: { + type: "bi.button_tree", + chooseType: 0, + layouts: [{ + type: "bi.vertical" + }] + } + }) + }, + + _init: function () { + BI.CustomTree.superclass._init.apply(this, arguments); + this.initTree(this.options.items); + }, + + _formatItems: function (nodes) { + var self = this, o = this.options; + nodes = BI.Tree.transformToTreeFormat(nodes); + + var items = []; + BI.each(nodes, function (i, node) { + if (BI.isNotEmptyArray(node.children) || node.isParent === true) { + var item = BI.extend({ + type: "bi.expander", + el: {}, + popup: {type: "bi.custom_tree"} + }, BI.deepClone(o.expander), { + id: node.id, + pId: node.pId, + value: node.value + }); + var el = BI.stripEL(node); + if (!BI.isWidget(el)) { + el = BI.clone(el); + delete el.children; + BI.extend(item.el, el); + } else { + item.el = el; + } + item.popup.expander = BI.deepClone(o.expander); + item.items = item.popup.items = node.children; + item.itemsCreator = item.popup.itemsCreator = function (op) { + if (BI.isNotNull(op.node)) {//从子节点传过来的itemsCreator直接向上传递 + return o.itemsCreator.apply(self, arguments); + } + var args = Array.prototype.slice.call(arguments, 0); + args[0].node = node; + return o.itemsCreator.apply(self, args); + }; + BI.isNull(item.popup.el) && (item.popup.el = BI.deepClone(o.el)); + items.push(item); + } else { + items.push(node); + } + }); + return items; + }, + + //构造树结构, + initTree: function (nodes) { + var self = this, o = this.options; + this.tree = BI.createWidget(o.el, { + element: this, + items: this._formatItems(nodes), + itemsCreator: function (op, callback) { + o.itemsCreator.apply(this, [op, function (items) { + var args = Array.prototype.slice.call(arguments, 0); + args[0] = self._formatItems(items); + callback.apply(null, args); + }]); + } + }); + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.CustomTree.EVENT_CHANGE, val, obj); + } + }) + }, + + //生成树方法 + stroke: function (nodes) { + this.populate.apply(this, arguments); + }, + + populate: function (nodes) { + var args = Array.prototype.slice.call(arguments, 0); + if (arguments.length > 0) { + args[0] = this._formatItems(nodes); + } + this.tree.populate.apply(this.tree, args); + }, + + setValue: function (v) { + this.tree && this.tree.setValue(v); + }, + + getValue: function () { + return this.tree ? this.tree.getValue() : []; + }, + + getAllButtons: function () { + return this.tree ? this.tree.getAllButtons() : []; + }, + + getAllLeaves: function () { + return this.tree ? this.tree.getAllLeaves() : []; + }, + + getNodeById: function (id) { + return this.tree && this.tree.getNodeById(id); + }, + + getNodeByValue: function (id) { + return this.tree && this.tree.getNodeByValue(id); + }, + + empty: function () { + this.tree.empty(); + } +}); +BI.CustomTree.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.shortcut("bi.custom_tree", BI.CustomTree);/* + * JQuery zTree core v3.5.18 + * http://zTree.me/ + * + * Copyright (c) 2010 Hunter.z + * + * Licensed same as jquery - MIT License + * http://www.opensource.org/licenses/mit-license.php + * + * email: hunter.z@263.net + * Date: 2015-06-18 + */ +(function($){ + var settings = {}, roots = {}, caches = {}, + //default consts of core + _consts = { + className: { + BUTTON: "button", + LEVEL: "level", + ICO_LOADING: "ico_loading", + SWITCH: "switch" + }, + event: { + NODECREATED: "ztree_nodeCreated", + CLICK: "ztree_click", + EXPAND: "ztree_expand", + COLLAPSE: "ztree_collapse", + ASYNC_SUCCESS: "ztree_async_success", + ASYNC_ERROR: "ztree_async_error", + REMOVE: "ztree_remove", + SELECTED: "ztree_selected", + UNSELECTED: "ztree_unselected" + }, + id: { + A: "_a", + ICON: "_ico", + SPAN: "_span", + SWITCH: "_switch", + UL: "_ul" + }, + line: { + ROOT: "root", + ROOTS: "roots", + CENTER: "center", + BOTTOM: "bottom", + NOLINE: "noline", + LINE: "line" + }, + folder: { + OPEN: "open", + CLOSE: "close", + DOCU: "docu" + }, + node: { + CURSELECTED: "curSelectedNode" + } + }, + //default setting of core + _setting = { + treeId: "", + treeObj: null, + view: { + addDiyDom: null, + autoCancelSelected: true, + dblClickExpand: true, + expandSpeed: "fast", + fontCss: {}, + nameIsHTML: false, + selectedMulti: true, + showIcon: true, + showLine: true, + showTitle: true, + txtSelectedEnable: false + }, + data: { + key: { + children: "children", + name: "name", + title: "", + url: "url" + }, + simpleData: { + enable: false, + idKey: "id", + pIdKey: "pId", + rootPId: null + }, + keep: { + parent: false, + leaf: false + } + }, + async: { + enable: false, + contentType: "application/x-www-form-urlencoded", + type: "post", + dataType: "text", + url: "", + autoParam: [], + otherParam: [], + dataFilter: null + }, + callback: { + beforeAsync:null, + beforeClick:null, + beforeDblClick:null, + beforeRightClick:null, + beforeMouseDown:null, + beforeMouseUp:null, + beforeExpand:null, + beforeCollapse:null, + beforeRemove:null, + + onAsyncError:null, + onAsyncSuccess:null, + onNodeCreated:null, + onClick:null, + onDblClick:null, + onRightClick:null, + onMouseDown:null, + onMouseUp:null, + onExpand:null, + onCollapse:null, + onRemove:null + } + }, + //default root of core + //zTree use root to save full data + _initRoot = function (setting) { + var r = data.getRoot(setting); + if (!r) { + r = {}; + data.setRoot(setting, r); + } + r[setting.data.key.children] = []; + r.expandTriggerFlag = false; + r.curSelectedList = []; + r.noSelection = true; + r.createdNodes = []; + r.zId = 0; + r._ver = (new Date()).getTime(); + }, + //default cache of core + _initCache = function(setting) { + var c = data.getCache(setting); + if (!c) { + c = {}; + data.setCache(setting, c); + } + c.nodes = []; + c.doms = []; + }, + //default bindEvent of core + _bindEvent = function(setting) { + var o = setting.treeObj, + c = consts.event; + o.bind(c.NODECREATED, function (event, treeId, node) { + tools.apply(setting.callback.onNodeCreated, [event, treeId, node]); + }); + + o.bind(c.CLICK, function (event, srcEvent, treeId, node, clickFlag) { + tools.apply(setting.callback.onClick, [srcEvent, treeId, node, clickFlag]); + }); + + o.bind(c.EXPAND, function (event, treeId, node) { + tools.apply(setting.callback.onExpand, [event, treeId, node]); + }); + + o.bind(c.COLLAPSE, function (event, treeId, node) { + tools.apply(setting.callback.onCollapse, [event, treeId, node]); + }); + + o.bind(c.ASYNC_SUCCESS, function (event, treeId, node, msg) { + tools.apply(setting.callback.onAsyncSuccess, [event, treeId, node, msg]); + }); + + o.bind(c.ASYNC_ERROR, function (event, treeId, node, XMLHttpRequest, textStatus, errorThrown) { + tools.apply(setting.callback.onAsyncError, [event, treeId, node, XMLHttpRequest, textStatus, errorThrown]); + }); + + o.bind(c.REMOVE, function (event, treeId, treeNode) { + tools.apply(setting.callback.onRemove, [event, treeId, treeNode]); + }); + + o.bind(c.SELECTED, function (event, srcEvent, treeId, node) { + tools.apply(setting.callback.onSelected, [srcEvent, treeId, node]); + }); + o.bind(c.UNSELECTED, function (event, srcEvent, treeId, node) { + tools.apply(setting.callback.onUnSelected, [srcEvent, treeId, node]); + }); + }, + _unbindEvent = function(setting) { + var o = setting.treeObj, + c = consts.event; + o.unbind(c.NODECREATED) + .unbind(c.CLICK) + .unbind(c.EXPAND) + .unbind(c.COLLAPSE) + .unbind(c.ASYNC_SUCCESS) + .unbind(c.ASYNC_ERROR) + .unbind(c.REMOVE) + .unbind(c.SELECTED) + .unbind(c.UNSELECTED); + }, + //default event proxy of core + _eventProxy = function(event) { + var target = event.target, + setting = data.getSetting(event.data.treeId), + tId = "", node = null, + nodeEventType = "", treeEventType = "", + nodeEventCallback = null, treeEventCallback = null, + tmp = null; + + if (tools.eqs(event.type, "mousedown")) { + treeEventType = "mousedown"; + } else if (tools.eqs(event.type, "mouseup")) { + treeEventType = "mouseup"; + } else if (tools.eqs(event.type, "contextmenu")) { + treeEventType = "contextmenu"; + } else if (tools.eqs(event.type, "click")) { + if (tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.SWITCH) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "switchNode"; + } else { + tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]); + if (tmp) { + tId = tools.getNodeMainDom(tmp).id; + nodeEventType = "clickNode"; + } + } + } else if (tools.eqs(event.type, "dblclick")) { + treeEventType = "dblclick"; + tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]); + if (tmp) { + tId = tools.getNodeMainDom(tmp).id; + nodeEventType = "switchNode"; + } + } + if (treeEventType.length > 0 && tId.length == 0) { + tmp = tools.getMDom(setting, target, [{tagName:"a", attrName:"treeNode"+consts.id.A}]); + if (tmp) {tId = tools.getNodeMainDom(tmp).id;} + } + // event to node + if (tId.length>0) { + node = data.getNodeCache(setting, tId); + switch (nodeEventType) { + case "switchNode" : + if (!node.isParent) { + nodeEventType = ""; + } else if (tools.eqs(event.type, "click") + || (tools.eqs(event.type, "dblclick") && tools.apply(setting.view.dblClickExpand, [setting.treeId, node], setting.view.dblClickExpand))) { + nodeEventCallback = handler.onSwitchNode; + } else { + nodeEventType = ""; + } + break; + case "clickNode" : + nodeEventCallback = handler.onClickNode; + break; + } + } + // event to zTree + switch (treeEventType) { + case "mousedown" : + treeEventCallback = handler.onZTreeMousedown; + break; + case "mouseup" : + treeEventCallback = handler.onZTreeMouseup; + break; + case "dblclick" : + treeEventCallback = handler.onZTreeDblclick; + break; + case "contextmenu" : + treeEventCallback = handler.onZTreeContextmenu; + break; + } + var proxyResult = { + stop: false, + node: node, + nodeEventType: nodeEventType, + nodeEventCallback: nodeEventCallback, + treeEventType: treeEventType, + treeEventCallback: treeEventCallback + }; + return proxyResult + }, + //default init node of core + _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) { + if (!n) return; + var r = data.getRoot(setting), + childKey = setting.data.key.children; + n.level = level; + n.tId = setting.treeId + "_" + (++r.zId); + n.parentTId = parentNode ? parentNode.tId : null; + n.open = (typeof n.open == "string") ? tools.eqs(n.open, "true") : !!n.open; + if (n[childKey] && n[childKey].length > 0) { + n.isParent = true; + n.zAsync = true; + } else { + n.isParent = (typeof n.isParent == "string") ? tools.eqs(n.isParent, "true") : !!n.isParent; + n.open = (n.isParent && !setting.async.enable) ? n.open : false; + n.zAsync = !n.isParent; + } + n.isFirstNode = isFirstNode; + n.isLastNode = isLastNode; + n.getParentNode = function() {return data.getNodeCache(setting, n.parentTId);}; + n.getPreNode = function() {return data.getPreNode(setting, n);}; + n.getNextNode = function() {return data.getNextNode(setting, n);}; + n.isAjaxing = false; + data.fixPIdKeyValue(setting, n); + }, + _init = { + bind: [_bindEvent], + unbind: [_unbindEvent], + caches: [_initCache], + nodes: [_initNode], + proxys: [_eventProxy], + roots: [_initRoot], + beforeA: [], + afterA: [], + innerBeforeA: [], + innerAfterA: [], + zTreeTools: [] + }, + //method of operate data + data = { + addNodeCache: function(setting, node) { + data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = node; + }, + getNodeCacheId: function(tId) { + return tId.substring(tId.lastIndexOf("_")+1); + }, + addAfterA: function(afterA) { + _init.afterA.push(afterA); + }, + addBeforeA: function(beforeA) { + _init.beforeA.push(beforeA); + }, + addInnerAfterA: function(innerAfterA) { + _init.innerAfterA.push(innerAfterA); + }, + addInnerBeforeA: function(innerBeforeA) { + _init.innerBeforeA.push(innerBeforeA); + }, + addInitBind: function(bindEvent) { + _init.bind.push(bindEvent); + }, + addInitUnBind: function(unbindEvent) { + _init.unbind.push(unbindEvent); + }, + addInitCache: function(initCache) { + _init.caches.push(initCache); + }, + addInitNode: function(initNode) { + _init.nodes.push(initNode); + }, + addInitProxy: function(initProxy, isFirst) { + if (!!isFirst) { + _init.proxys.splice(0,0,initProxy); + } else { + _init.proxys.push(initProxy); + } + }, + addInitRoot: function(initRoot) { + _init.roots.push(initRoot); + }, + addNodesData: function(setting, parentNode, nodes) { + var childKey = setting.data.key.children; + if (!parentNode[childKey]) parentNode[childKey] = []; + if (parentNode[childKey].length > 0) { + parentNode[childKey][parentNode[childKey].length - 1].isLastNode = false; + view.setNodeLineIcos(setting, parentNode[childKey][parentNode[childKey].length - 1]); + } + parentNode.isParent = true; + parentNode[childKey] = parentNode[childKey].concat(nodes); + }, + addSelectedNode: function(setting, node) { + var root = data.getRoot(setting); + if (!data.isSelectedNode(setting, node)) { + root.curSelectedList.push(node); + } + }, + addCreatedNode: function(setting, node) { + if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) { + var root = data.getRoot(setting); + root.createdNodes.push(node); + } + }, + addZTreeTools: function(zTreeTools) { + _init.zTreeTools.push(zTreeTools); + }, + exSetting: function(s) { + $.extend(true, _setting, s); + }, + fixPIdKeyValue: function(setting, node) { + if (setting.data.simpleData.enable) { + node[setting.data.simpleData.pIdKey] = node.parentTId ? node.getParentNode()[setting.data.simpleData.idKey] : setting.data.simpleData.rootPId; + } + }, + getAfterA: function(setting, node, array) { + for (var i=0, j=_init.afterA.length; i<j; i++) { + _init.afterA[i].apply(this, arguments); + } + }, + getBeforeA: function(setting, node, array) { + for (var i=0, j=_init.beforeA.length; i<j; i++) { + _init.beforeA[i].apply(this, arguments); + } + }, + getInnerAfterA: function(setting, node, array) { + for (var i=0, j=_init.innerAfterA.length; i<j; i++) { + _init.innerAfterA[i].apply(this, arguments); + } + }, + getInnerBeforeA: function(setting, node, array) { + for (var i=0, j=_init.innerBeforeA.length; i<j; i++) { + _init.innerBeforeA[i].apply(this, arguments); + } + }, + getCache: function(setting) { + return caches[setting.treeId]; + }, + getNextNode: function(setting, node) { + if (!node) return null; + var childKey = setting.data.key.children, + p = node.parentTId ? node.getParentNode() : data.getRoot(setting); + for (var i=0, l=p[childKey].length-1; i<=l; i++) { + if (p[childKey][i] === node) { + return (i==l ? null : p[childKey][i+1]); + } + } + return null; + }, + getNodeByParam: function(setting, nodes, key, value) { + if (!nodes || !key) return null; + var childKey = setting.data.key.children; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i][key] == value) { + return nodes[i]; + } + var tmp = data.getNodeByParam(setting, nodes[i][childKey], key, value); + if (tmp) return tmp; + } + return null; + }, + getNodeCache: function(setting, tId) { + if (!tId) return null; + var n = caches[setting.treeId].nodes[data.getNodeCacheId(tId)]; + return n ? n : null; + }, + getNodeName: function(setting, node) { + var nameKey = setting.data.key.name; + return "" + node[nameKey]; + }, + getNodeTitle: function(setting, node) { + var t = setting.data.key.title === "" ? setting.data.key.name : setting.data.key.title; + return "" + node[t]; + }, + getNodes: function(setting) { + return data.getRoot(setting)[setting.data.key.children]; + }, + getNodesByParam: function(setting, nodes, key, value) { + if (!nodes || !key) return []; + var childKey = setting.data.key.children, + result = []; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i][key] == value) { + result.push(nodes[i]); + } + result = result.concat(data.getNodesByParam(setting, nodes[i][childKey], key, value)); + } + return result; + }, + getNodesByParamFuzzy: function(setting, nodes, key, value) { + if (!nodes || !key) return []; + var childKey = setting.data.key.children, + result = []; + value = value.toLowerCase(); + for (var i = 0, l = nodes.length; i < l; i++) { + if (typeof nodes[i][key] == "string" && nodes[i][key].toLowerCase().indexOf(value)>-1) { + result.push(nodes[i]); + } + result = result.concat(data.getNodesByParamFuzzy(setting, nodes[i][childKey], key, value)); + } + return result; + }, + getNodesByFilter: function(setting, nodes, filter, isSingle, invokeParam) { + if (!nodes) return (isSingle ? null : []); + var childKey = setting.data.key.children, + result = isSingle ? null : []; + for (var i = 0, l = nodes.length; i < l; i++) { + if (tools.apply(filter, [nodes[i], invokeParam], false)) { + if (isSingle) {return nodes[i];} + result.push(nodes[i]); + } + var tmpResult = data.getNodesByFilter(setting, nodes[i][childKey], filter, isSingle, invokeParam); + if (isSingle && !!tmpResult) {return tmpResult;} + result = isSingle ? tmpResult : result.concat(tmpResult); + } + return result; + }, + getPreNode: function(setting, node) { + if (!node) return null; + var childKey = setting.data.key.children, + p = node.parentTId ? node.getParentNode() : data.getRoot(setting); + for (var i=0, l=p[childKey].length; i<l; i++) { + if (p[childKey][i] === node) { + return (i==0 ? null : p[childKey][i-1]); + } + } + return null; + }, + getRoot: function(setting) { + return setting ? roots[setting.treeId] : null; + }, + getRoots: function() { + return roots; + }, + getSetting: function(treeId) { + return settings[treeId]; + }, + getSettings: function() { + return settings; + }, + getZTreeTools: function(treeId) { + var r = this.getRoot(this.getSetting(treeId)); + return r ? r.treeTools : null; + }, + initCache: function(setting) { + for (var i=0, j=_init.caches.length; i<j; i++) { + _init.caches[i].apply(this, arguments); + } + }, + initNode: function(setting, level, node, parentNode, preNode, nextNode) { + for (var i=0, j=_init.nodes.length; i<j; i++) { + _init.nodes[i].apply(this, arguments); + } + }, + initRoot: function(setting) { + for (var i=0, j=_init.roots.length; i<j; i++) { + _init.roots[i].apply(this, arguments); + } + }, + isSelectedNode: function(setting, node) { + var root = data.getRoot(setting); + for (var i=0, j=root.curSelectedList.length; i<j; i++) { + if(node === root.curSelectedList[i]) return true; + } + return false; + }, + removeNodeCache: function(setting, node) { + var childKey = setting.data.key.children; + if (node[childKey]) { + for (var i=0, l=node[childKey].length; i<l; i++) { + arguments.callee(setting, node[childKey][i]); + } + } + data.getCache(setting).nodes[data.getNodeCacheId(node.tId)] = null; + }, + removeSelectedNode: function(setting, node) { + var root = data.getRoot(setting); + for (var i=0, j=root.curSelectedList.length; i<j; i++) { + if(node === root.curSelectedList[i] || !data.getNodeCache(setting, root.curSelectedList[i].tId)) { + root.curSelectedList.splice(i, 1); + i--;j--; + } + } + }, + setCache: function(setting, cache) { + caches[setting.treeId] = cache; + }, + setRoot: function(setting, root) { + roots[setting.treeId] = root; + }, + setZTreeTools: function(setting, zTreeTools) { + for (var i=0, j=_init.zTreeTools.length; i<j; i++) { + _init.zTreeTools[i].apply(this, arguments); + } + }, + transformToArrayFormat: function (setting, nodes) { + if (!nodes) return []; + var childKey = setting.data.key.children, + r = []; + if (tools.isArray(nodes)) { + for (var i=0, l=nodes.length; i<l; i++) { + r.push(nodes[i]); + if (nodes[i][childKey]) + r = r.concat(data.transformToArrayFormat(setting, nodes[i][childKey])); + } + } else { + r.push(nodes); + if (nodes[childKey]) + r = r.concat(data.transformToArrayFormat(setting, nodes[childKey])); + } + return r; + }, + transformTozTreeFormat: function(setting, sNodes) { + var i,l, + key = setting.data.simpleData.idKey, + parentKey = setting.data.simpleData.pIdKey, + childKey = setting.data.key.children; + if (!key || key=="" || !sNodes) return []; + + if (tools.isArray(sNodes)) { + var r = []; + var tmpMap = []; + for (i=0, l=sNodes.length; i<l; i++) { + tmpMap[sNodes[i][key]] = sNodes[i]; + } + for (i=0, l=sNodes.length; i<l; i++) { + if (tmpMap[sNodes[i][parentKey]] && sNodes[i][key] != sNodes[i][parentKey]) { + if (!tmpMap[sNodes[i][parentKey]][childKey]) + tmpMap[sNodes[i][parentKey]][childKey] = []; + tmpMap[sNodes[i][parentKey]][childKey].push(sNodes[i]); + } else { + r.push(sNodes[i]); + } + } + return r; + }else { + return [sNodes]; + } + } + }, + //method of event proxy + event = { + bindEvent: function(setting) { + for (var i=0, j=_init.bind.length; i<j; i++) { + _init.bind[i].apply(this, arguments); + } + }, + unbindEvent: function(setting) { + for (var i=0, j=_init.unbind.length; i<j; i++) { + _init.unbind[i].apply(this, arguments); + } + }, + bindTree: function(setting) { + var eventParam = { + treeId: setting.treeId + }, + o = setting.treeObj; + if (!setting.view.txtSelectedEnable) { + // for can't select text + o.bind('selectstart', function(e){ + var node + var n = e.originalEvent.srcElement.nodeName.toLowerCase(); + return (n === "input" || n === "textarea" ); + }).css({ + "-moz-user-select":"-moz-none" + }); + } + o.bind('click', eventParam, event.proxy); + o.bind('dblclick', eventParam, event.proxy); + o.bind('mouseover', eventParam, event.proxy); + o.bind('mouseout', eventParam, event.proxy); + o.bind('mousedown', eventParam, event.proxy); + o.bind('mouseup', eventParam, event.proxy); + o.bind('contextmenu', eventParam, event.proxy); + }, + unbindTree: function(setting) { + var o = setting.treeObj; + o.unbind('click', event.proxy) + .unbind('dblclick', event.proxy) + .unbind('mouseover', event.proxy) + .unbind('mouseout', event.proxy) + .unbind('mousedown', event.proxy) + .unbind('mouseup', event.proxy) + .unbind('contextmenu', event.proxy); + }, + doProxy: function(e) { + var results = []; + for (var i=0, j=_init.proxys.length; i<j; i++) { + var proxyResult = _init.proxys[i].apply(this, arguments); + results.push(proxyResult); + if (proxyResult.stop) { + break; + } + } + return results; + }, + proxy: function(e) { + var setting = data.getSetting(e.data.treeId); + if (!tools.uCanDo(setting, e)) return true; + var results = event.doProxy(e), + r = true, x = false; + for (var i=0, l=results.length; i<l; i++) { + var proxyResult = results[i]; + if (proxyResult.nodeEventCallback) { + x = true; + r = proxyResult.nodeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r; + } + if (proxyResult.treeEventCallback) { + x = true; + r = proxyResult.treeEventCallback.apply(proxyResult, [e, proxyResult.node]) && r; + } + } + return r; + } + }, + //method of event handler + handler = { + onSwitchNode: function (event, node) { + var setting = data.getSetting(event.data.treeId); + if (node.open) { + if (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false) return true; + data.getRoot(setting).expandTriggerFlag = true; + view.switchNode(setting, node); + } else { + if (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false) return true; + data.getRoot(setting).expandTriggerFlag = true; + view.switchNode(setting, node); + } + return true; + }, + onClickNode: function (event, node) { + var setting = data.getSetting(event.data.treeId), + clickFlag = ( (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey)) && data.isSelectedNode(setting, node)) ? 0 : (setting.view.autoCancelSelected && (event.ctrlKey || event.metaKey) && setting.view.selectedMulti) ? 2 : 1; + if (tools.apply(setting.callback.beforeClick, [setting.treeId, node, clickFlag], true) == false) return true; + if (clickFlag === 0) { + view.cancelPreSelectedNode(setting, node); + } else { + view.selectNode(setting, node, clickFlag === 2); + } + setting.treeObj.trigger(consts.event.CLICK, [event, setting.treeId, node, clickFlag]); + return true; + }, + onZTreeMousedown: function(event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeMouseDown, [setting.treeId, node], true)) { + tools.apply(setting.callback.onMouseDown, [event, setting.treeId, node]); + } + return true; + }, + onZTreeMouseup: function(event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeMouseUp, [setting.treeId, node], true)) { + tools.apply(setting.callback.onMouseUp, [event, setting.treeId, node]); + } + return true; + }, + onZTreeDblclick: function(event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeDblClick, [setting.treeId, node], true)) { + tools.apply(setting.callback.onDblClick, [event, setting.treeId, node]); + } + return true; + }, + onZTreeContextmenu: function(event, node) { + var setting = data.getSetting(event.data.treeId); + if (tools.apply(setting.callback.beforeRightClick, [setting.treeId, node], true)) { + tools.apply(setting.callback.onRightClick, [event, setting.treeId, node]); + } + return (typeof setting.callback.onRightClick) != "function"; + } + }, + //method of tools for zTree + tools = { + apply: function(fun, param, defaultValue) { + if ((typeof fun) == "function") { + return fun.apply(zt, param?param:[]); + } + return defaultValue; + }, + canAsync: function(setting, node) { + var childKey = setting.data.key.children; + return (setting.async.enable && node && node.isParent && !(node.zAsync || (node[childKey] && node[childKey].length > 0))); + }, + clone: function (obj){ + if (obj === null) return null; + var o = tools.isArray(obj) ? [] : {}; + for(var i in obj){ + o[i] = (obj[i] instanceof Date) ? new Date(obj[i].getTime()) : (typeof obj[i] === "object" ? arguments.callee(obj[i]) : obj[i]); + } + return o; + }, + eqs: function(str1, str2) { + return str1.toLowerCase() === str2.toLowerCase(); + }, + isArray: function(arr) { + return Object.prototype.toString.apply(arr) === "[object Array]"; + }, + $: function(node, exp, setting) { + if (!!exp && typeof exp != "string") { + setting = exp; + exp = ""; + } + if (typeof node == "string") { + return $(node, setting ? setting.treeObj.get(0).ownerDocument : null); + } else { + return $("#" + node.tId + exp, setting ? setting.treeObj : null); + } + }, + getMDom: function (setting, curDom, targetExpr) { + if (!curDom) return null; + while (curDom && curDom.id !== setting.treeId) { + for (var i=0, l=targetExpr.length; curDom.tagName && i<l; i++) { + if (tools.eqs(curDom.tagName, targetExpr[i].tagName) && curDom.getAttribute(targetExpr[i].attrName) !== null) { + return curDom; + } + } + curDom = curDom.parentNode; + } + return null; + }, + getNodeMainDom:function(target) { + return ($(target).parent("li").get(0) || $(target).parentsUntil("li").parent().get(0)); + }, + isChildOrSelf: function(dom, parentId) { + return ( $(dom).closest("#" + parentId).length> 0 ); + }, + uCanDo: function(setting, e) { + return true; + } + }, + //method of operate ztree dom + view = { + addNodes: function(setting, parentNode, newNodes, isSilent) { + if (setting.data.keep.leaf && parentNode && !parentNode.isParent) { + return; + } + if (!tools.isArray(newNodes)) { + newNodes = [newNodes]; + } + if (setting.data.simpleData.enable) { + newNodes = data.transformTozTreeFormat(setting, newNodes); + } + if (parentNode) { + var target_switchObj = $$(parentNode, consts.id.SWITCH, setting), + target_icoObj = $$(parentNode, consts.id.ICON, setting), + target_ulObj = $$(parentNode, consts.id.UL, setting); + + if (!parentNode.open) { + view.replaceSwitchClass(parentNode, target_switchObj, consts.folder.CLOSE); + view.replaceIcoClass(parentNode, target_icoObj, consts.folder.CLOSE); + parentNode.open = false; + target_ulObj.css({ + "display": "none" + }); + } + + data.addNodesData(setting, parentNode, newNodes); + view.createNodes(setting, parentNode.level + 1, newNodes, parentNode); + if (!isSilent) { + view.expandCollapseParentNode(setting, parentNode, true); + } + } else { + data.addNodesData(setting, data.getRoot(setting), newNodes); + view.createNodes(setting, 0, newNodes, null); + } + }, + appendNodes: function(setting, level, nodes, parentNode, initFlag, openFlag) { + if (!nodes) return []; + var html = [], + childKey = setting.data.key.children; + for (var i = 0, l = nodes.length; i < l; i++) { + var node = nodes[i]; + if (initFlag) { + var tmpPNode = (parentNode) ? parentNode: data.getRoot(setting), + tmpPChild = tmpPNode[childKey], + isFirstNode = ((tmpPChild.length == nodes.length) && (i == 0)), + isLastNode = (i == (nodes.length - 1)); + data.initNode(setting, level, node, parentNode, isFirstNode, isLastNode, openFlag); + data.addNodeCache(setting, node); + } + + var childHtml = []; + if (node[childKey] && node[childKey].length > 0) { + //make child html first, because checkType + childHtml = view.appendNodes(setting, level + 1, node[childKey], node, initFlag, openFlag && node.open); + } + if (openFlag) { + + view.makeDOMNodeMainBefore(html, setting, node); + view.makeDOMNodeLine(html, setting, node); + data.getBeforeA(setting, node, html); + view.makeDOMNodeNameBefore(html, setting, node); + data.getInnerBeforeA(setting, node, html); + view.makeDOMNodeIcon(html, setting, node); + data.getInnerAfterA(setting, node, html); + view.makeDOMNodeNameAfter(html, setting, node); + data.getAfterA(setting, node, html); + if (node.isParent && node.open) { + view.makeUlHtml(setting, node, html, childHtml.join('')); + } + view.makeDOMNodeMainAfter(html, setting, node); + data.addCreatedNode(setting, node); + } + } + return html; + }, + appendParentULDom: function(setting, node) { + var html = [], + nObj = $$(node, setting); + if (!nObj.get(0) && !!node.parentTId) { + view.appendParentULDom(setting, node.getParentNode()); + nObj = $$(node, setting); + } + var ulObj = $$(node, consts.id.UL, setting); + if (ulObj.get(0)) { + ulObj.remove(); + } + var childKey = setting.data.key.children, + childHtml = view.appendNodes(setting, node.level+1, node[childKey], node, false, true); + view.makeUlHtml(setting, node, html, childHtml.join('')); + nObj.append(html.join('')); + }, + asyncNode: function(setting, node, isSilent, callback) { + var i, l; + if (node && !node.isParent) { + tools.apply(callback); + return false; + } else if (node && node.isAjaxing) { + return false; + } else if (tools.apply(setting.callback.beforeAsync, [setting.treeId, node], true) == false) { + tools.apply(callback); + return false; + } + if (node) { + node.isAjaxing = true; + var icoObj = $$(node, consts.id.ICON, setting); + icoObj.attr({"style":"", "class":consts.className.BUTTON + " " + consts.className.ICO_LOADING}); + } + + var tmpParam = {}; + for (i = 0, l = setting.async.autoParam.length; node && i < l; i++) { + var pKey = setting.async.autoParam[i].split("="), spKey = pKey; + if (pKey.length>1) { + spKey = pKey[1]; + pKey = pKey[0]; + } + tmpParam[spKey] = node[pKey]; + } + if (tools.isArray(setting.async.otherParam)) { + for (i = 0, l = setting.async.otherParam.length; i < l; i += 2) { + tmpParam[setting.async.otherParam[i]] = setting.async.otherParam[i + 1]; + } + } else { + for (var p in setting.async.otherParam) { + tmpParam[p] = setting.async.otherParam[p]; + } + } + + var _tmpV = data.getRoot(setting)._ver; + $.ajax({ + contentType: setting.async.contentType, + cache: false, + type: setting.async.type, + url: tools.apply(setting.async.url, [setting.treeId, node], setting.async.url), + data: tmpParam, + dataType: setting.async.dataType, + success: function(msg) { + if (_tmpV != data.getRoot(setting)._ver) { + return; + } + var newNodes = []; + try { + if (!msg || msg.length == 0) { + newNodes = []; + } else if (typeof msg == "string") { + newNodes = eval("(" + msg + ")"); + } else { + newNodes = msg; + } + } catch(err) { + newNodes = msg; + } + + if (node) { + node.isAjaxing = null; + node.zAsync = true; + } + view.setNodeLineIcos(setting, node); + if (newNodes && newNodes !== "") { + newNodes = tools.apply(setting.async.dataFilter, [setting.treeId, node, newNodes], newNodes); + view.addNodes(setting, node, !!newNodes ? tools.clone(newNodes) : [], !!isSilent); + } else { + view.addNodes(setting, node, [], !!isSilent); + } + setting.treeObj.trigger(consts.event.ASYNC_SUCCESS, [setting.treeId, node, msg]); + tools.apply(callback); + }, + error: function(XMLHttpRequest, textStatus, errorThrown) { + if (_tmpV != data.getRoot(setting)._ver) { + return; + } + if (node) node.isAjaxing = null; + view.setNodeLineIcos(setting, node); + setting.treeObj.trigger(consts.event.ASYNC_ERROR, [setting.treeId, node, XMLHttpRequest, textStatus, errorThrown]); + } + }); + return true; + }, + cancelPreSelectedNode: function (setting, node, excludeNode) { + var list = data.getRoot(setting).curSelectedList, + i, n; + for (i=list.length-1; i>=0; i--) { + n = list[i]; + if (node === n || (!node && (!excludeNode || excludeNode !== n))) { + $$(n, consts.id.A, setting).removeClass(consts.node.CURSELECTED); + if (node) { + data.removeSelectedNode(setting, node); + setting.treeObj.trigger(consts.event.UNSELECTED, [event, setting.treeId, n]); + break; + } else { + list.splice(i, 1); + setting.treeObj.trigger(consts.event.UNSELECTED, [event, setting.treeId, n]); + } + } + } + }, + createNodeCallback: function(setting) { + if (!!setting.callback.onNodeCreated || !!setting.view.addDiyDom) { + var root = data.getRoot(setting); + while (root.createdNodes.length>0) { + var node = root.createdNodes.shift(); + tools.apply(setting.view.addDiyDom, [setting.treeId, node]); + if (!!setting.callback.onNodeCreated) { + setting.treeObj.trigger(consts.event.NODECREATED, [setting.treeId, node]); + } + } + } + }, + createNodes: function(setting, level, nodes, parentNode) { + if (!nodes || nodes.length == 0) return; + var root = data.getRoot(setting), + childKey = setting.data.key.children, + openFlag = !parentNode || parentNode.open || !!$$(parentNode[childKey][0], setting).get(0); + root.createdNodes = []; + var zTreeHtml = view.appendNodes(setting, level, nodes, parentNode, true, openFlag); + if (!parentNode) { + setting.treeObj.append(zTreeHtml.join('')); + } else { + var ulObj = $$(parentNode, consts.id.UL, setting); + if (ulObj.get(0)) { + ulObj.append(zTreeHtml.join('')); + } + } + view.createNodeCallback(setting); + }, + destroy: function(setting) { + if (!setting) return; + data.initCache(setting); + data.initRoot(setting); + event.unbindTree(setting); + event.unbindEvent(setting); + setting.treeObj.empty(); + delete settings[setting.treeId]; + }, + expandCollapseNode: function(setting, node, expandFlag, animateFlag, callback) { + var root = data.getRoot(setting), + childKey = setting.data.key.children; + if (!node) { + tools.apply(callback, []); + return; + } + if (root.expandTriggerFlag) { + var _callback = callback; + callback = function(){ + if (_callback) _callback(); + if (node.open) { + setting.treeObj.trigger(consts.event.EXPAND, [setting.treeId, node]); + } else { + setting.treeObj.trigger(consts.event.COLLAPSE, [setting.treeId, node]); + } + }; + root.expandTriggerFlag = false; + } + if (!node.open && node.isParent && ((!$$(node, consts.id.UL, setting).get(0)) || (node[childKey] && node[childKey].length>0 && !$$(node[childKey][0], setting).get(0)))) { + view.appendParentULDom(setting, node); + view.createNodeCallback(setting); + } + if (node.open == expandFlag) { + tools.apply(callback, []); + return; + } + var ulObj = $$(node, consts.id.UL, setting), + switchObj = $$(node, consts.id.SWITCH, setting), + icoObj = $$(node, consts.id.ICON, setting); + + if (node.isParent) { + node.open = !node.open; + if (node.iconOpen && node.iconClose) { + icoObj.attr("style", view.makeNodeIcoStyle(setting, node)); + } + + if (node.open) { + view.replaceSwitchClass(node, switchObj, consts.folder.OPEN); + view.replaceIcoClass(node, icoObj, consts.folder.OPEN); + if (animateFlag == false || setting.view.expandSpeed == "") { + ulObj.show(); + tools.apply(callback, []); + } else { + if (node[childKey] && node[childKey].length > 0) { + ulObj.slideDown(setting.view.expandSpeed, callback); + } else { + ulObj.show(); + tools.apply(callback, []); + } + } + } else { + view.replaceSwitchClass(node, switchObj, consts.folder.CLOSE); + view.replaceIcoClass(node, icoObj, consts.folder.CLOSE); + if (animateFlag == false || setting.view.expandSpeed == "" || !(node[childKey] && node[childKey].length > 0)) { + ulObj.hide(); + tools.apply(callback, []); + } else { + ulObj.slideUp(setting.view.expandSpeed, callback); + } + } + } else { + tools.apply(callback, []); + } + }, + expandCollapseParentNode: function(setting, node, expandFlag, animateFlag, callback) { + if (!node) return; + if (!node.parentTId) { + view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback); + return; + } else { + view.expandCollapseNode(setting, node, expandFlag, animateFlag); + } + if (node.parentTId) { + view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, animateFlag, callback); + } + }, + expandCollapseSonNode: function(setting, node, expandFlag, animateFlag, callback) { + var root = data.getRoot(setting), + childKey = setting.data.key.children, + treeNodes = (node) ? node[childKey]: root[childKey], + selfAnimateSign = (node) ? false : animateFlag, + expandTriggerFlag = data.getRoot(setting).expandTriggerFlag; + data.getRoot(setting).expandTriggerFlag = false; + if (treeNodes) { + for (var i = 0, l = treeNodes.length; i < l; i++) { + if (treeNodes[i]) view.expandCollapseSonNode(setting, treeNodes[i], expandFlag, selfAnimateSign); + } + } + data.getRoot(setting).expandTriggerFlag = expandTriggerFlag; + view.expandCollapseNode(setting, node, expandFlag, animateFlag, callback ); + }, + isSelectedNode: function (setting, node) { + if (!node) { + return false; + } + var list = data.getRoot(setting).curSelectedList, + i; + for (i=list.length-1; i>=0; i--) { + if (node === list[i]) { + return true; + } + } + return false; + }, + makeDOMNodeIcon: function(html, setting, node) { + var nameStr = data.getNodeName(setting, node), + name = setting.view.nameIsHTML ? nameStr : nameStr.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); + html.push("<span id='", node.tId, consts.id.ICON, + "' title='' treeNode", consts.id.ICON," class='", view.makeNodeIcoClass(setting, node), + "' style='", view.makeNodeIcoStyle(setting, node), "'></span><span id='", node.tId, consts.id.SPAN, + "'>",name,"</span>"); + }, + makeDOMNodeLine: function(html, setting, node) { + html.push("<span id='", node.tId, consts.id.SWITCH, "' title='' class='", view.makeNodeLineClass(setting, node), "' treeNode", consts.id.SWITCH,"></span>"); + }, + makeDOMNodeMainAfter: function(html, setting, node) { + html.push("</li>"); + }, + makeDOMNodeMainBefore: function(html, setting, node) { + html.push("<li id='", node.tId, "' class='", consts.className.LEVEL, node.level,"' tabindex='0' hidefocus='true' treenode>"); + }, + makeDOMNodeNameAfter: function(html, setting, node) { + html.push("</a>"); + }, + makeDOMNodeNameBefore: function(html, setting, node) { + var title = data.getNodeTitle(setting, node), + url = view.makeNodeUrl(setting, node), + fontcss = view.makeNodeFontCss(setting, node), + fontStyle = []; + for (var f in fontcss) { + fontStyle.push(f, ":", fontcss[f], ";"); + } + html.push("<a id='", node.tId, consts.id.A, "' class='", consts.className.LEVEL, node.level,"' treeNode", consts.id.A," onclick=\"", (node.click || ''), + "\" ", ((url != null && url.length > 0) ? "href='" + url + "'" : ""), " target='",view.makeNodeTarget(node),"' style='", fontStyle.join(''), + "'"); + if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle) && title) {html.push("title='", title.replace(/'/g,"'").replace(/</g,'<').replace(/>/g,'>'),"'");} + html.push(">"); + }, + makeNodeFontCss: function(setting, node) { + var fontCss = tools.apply(setting.view.fontCss, [setting.treeId, node], setting.view.fontCss); + return (fontCss && ((typeof fontCss) != "function")) ? fontCss : {}; + }, + makeNodeIcoClass: function(setting, node) { + var icoCss = ["ico"]; + if (!node.isAjaxing) { + icoCss[0] = (node.iconSkin ? node.iconSkin + "_" : "") + icoCss[0]; + if (node.isParent) { + icoCss.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE); + } else { + icoCss.push(consts.folder.DOCU); + } + } + return consts.className.BUTTON + " " + icoCss.join('_'); + }, + makeNodeIcoStyle: function(setting, node) { + var icoStyle = []; + if (!node.isAjaxing) { + var icon = (node.isParent && node.iconOpen && node.iconClose) ? (node.open ? node.iconOpen : node.iconClose) : node.icon; + if (icon) icoStyle.push("background:url(", icon, ") 0 0 no-repeat;"); + if (setting.view.showIcon == false || !tools.apply(setting.view.showIcon, [setting.treeId, node], true)) { + icoStyle.push("width:0px;height:0px;"); + } + } + return icoStyle.join(''); + }, + makeNodeLineClass: function(setting, node) { + var lineClass = []; + if (setting.view.showLine) { + if (node.level == 0 && node.isFirstNode && node.isLastNode) { + lineClass.push(consts.line.ROOT); + } else if (node.level == 0 && node.isFirstNode) { + lineClass.push(consts.line.ROOTS); + } else if (node.isLastNode) { + lineClass.push(consts.line.BOTTOM); + } else { + lineClass.push(consts.line.CENTER); + } + } else { + lineClass.push(consts.line.NOLINE); + } + if (node.isParent) { + lineClass.push(node.open ? consts.folder.OPEN : consts.folder.CLOSE); + } else { + lineClass.push(consts.folder.DOCU); + } + return view.makeNodeLineClassEx(node) + lineClass.join('_'); + }, + makeNodeLineClassEx: function(node) { + return consts.className.BUTTON + " " + consts.className.LEVEL + node.level + " " + consts.className.SWITCH + " "; + }, + makeNodeTarget: function(node) { + return (node.target || "_blank"); + }, + makeNodeUrl: function(setting, node) { + var urlKey = setting.data.key.url; + return node[urlKey] ? node[urlKey] : null; + }, + makeUlHtml: function(setting, node, html, content) { + html.push("<ul id='", node.tId, consts.id.UL, "' class='", consts.className.LEVEL, node.level, " ", view.makeUlLineClass(setting, node), "' style='display:", (node.open ? "block": "none"),"'>"); + html.push(content); + html.push("</ul>"); + }, + makeUlLineClass: function(setting, node) { + return ((setting.view.showLine && !node.isLastNode) ? consts.line.LINE : ""); + }, + removeChildNodes: function(setting, node) { + if (!node) return; + var childKey = setting.data.key.children, + nodes = node[childKey]; + if (!nodes) return; + + for (var i = 0, l = nodes.length; i < l; i++) { + data.removeNodeCache(setting, nodes[i]); + } + data.removeSelectedNode(setting); + delete node[childKey]; + + if (!setting.data.keep.parent) { + node.isParent = false; + node.open = false; + var tmp_switchObj = $$(node, consts.id.SWITCH, setting), + tmp_icoObj = $$(node, consts.id.ICON, setting); + view.replaceSwitchClass(node, tmp_switchObj, consts.folder.DOCU); + view.replaceIcoClass(node, tmp_icoObj, consts.folder.DOCU); + $$(node, consts.id.UL, setting).remove(); + } else { + $$(node, consts.id.UL, setting).empty(); + } + }, + setFirstNode: function(setting, parentNode) { + var childKey = setting.data.key.children, childLength = parentNode[childKey].length; + if ( childLength > 0) { + parentNode[childKey][0].isFirstNode = true; + } + }, + setLastNode: function(setting, parentNode) { + var childKey = setting.data.key.children, childLength = parentNode[childKey].length; + if ( childLength > 0) { + parentNode[childKey][childLength - 1].isLastNode = true; + } + }, + removeNode: function(setting, node) { + var root = data.getRoot(setting), + childKey = setting.data.key.children, + parentNode = (node.parentTId) ? node.getParentNode() : root; + + node.isFirstNode = false; + node.isLastNode = false; + node.getPreNode = function() {return null;}; + node.getNextNode = function() {return null;}; + + if (!data.getNodeCache(setting, node.tId)) { + return; + } + + $$(node, setting).remove(); + data.removeNodeCache(setting, node); + data.removeSelectedNode(setting, node); + + for (var i = 0, l = parentNode[childKey].length; i < l; i++) { + if (parentNode[childKey][i].tId == node.tId) { + parentNode[childKey].splice(i, 1); + break; + } + } + view.setFirstNode(setting, parentNode); + view.setLastNode(setting, parentNode); + + var tmp_ulObj,tmp_switchObj,tmp_icoObj, + childLength = parentNode[childKey].length; + + //repair nodes old parent + if (!setting.data.keep.parent && childLength == 0) { + //old parentNode has no child nodes + parentNode.isParent = false; + parentNode.open = false; + tmp_ulObj = $$(parentNode, consts.id.UL, setting); + tmp_switchObj = $$(parentNode, consts.id.SWITCH, setting); + tmp_icoObj = $$(parentNode, consts.id.ICON, setting); + view.replaceSwitchClass(parentNode, tmp_switchObj, consts.folder.DOCU); + view.replaceIcoClass(parentNode, tmp_icoObj, consts.folder.DOCU); + tmp_ulObj.css("display", "none"); + + } else if (setting.view.showLine && childLength > 0) { + //old parentNode has child nodes + var newLast = parentNode[childKey][childLength - 1]; + tmp_ulObj = $$(newLast, consts.id.UL, setting); + tmp_switchObj = $$(newLast, consts.id.SWITCH, setting); + tmp_icoObj = $$(newLast, consts.id.ICON, setting); + if (parentNode == root) { + if (parentNode[childKey].length == 1) { + //node was root, and ztree has only one root after move node + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.ROOT); + } else { + var tmp_first_switchObj = $$(parentNode[childKey][0], consts.id.SWITCH, setting); + view.replaceSwitchClass(parentNode[childKey][0], tmp_first_switchObj, consts.line.ROOTS); + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM); + } + } else { + view.replaceSwitchClass(newLast, tmp_switchObj, consts.line.BOTTOM); + } + tmp_ulObj.removeClass(consts.line.LINE); + } + }, + replaceIcoClass: function(node, obj, newName) { + if (!obj || node.isAjaxing) return; + var tmpName = obj.attr("class"); + if (tmpName == undefined) return; + var tmpList = tmpName.split("_"); + switch (newName) { + case consts.folder.OPEN: + case consts.folder.CLOSE: + case consts.folder.DOCU: + tmpList[tmpList.length-1] = newName; + break; + } + obj.attr("class", tmpList.join("_")); + }, + replaceSwitchClass: function(node, obj, newName) { + if (!obj) return; + var tmpName = obj.attr("class"); + if (tmpName == undefined) return; + var tmpList = tmpName.split("_"); + switch (newName) { + case consts.line.ROOT: + case consts.line.ROOTS: + case consts.line.CENTER: + case consts.line.BOTTOM: + case consts.line.NOLINE: + tmpList[0] = view.makeNodeLineClassEx(node) + newName; + break; + case consts.folder.OPEN: + case consts.folder.CLOSE: + case consts.folder.DOCU: + tmpList[1] = newName; + break; + } + obj.attr("class", tmpList.join("_")); + if (newName !== consts.folder.DOCU) { + obj.removeAttr("disabled"); + } else { + obj.attr("disabled", "disabled"); + } + }, + selectNode: function(setting, node, addFlag) { + if (!addFlag) { + view.cancelPreSelectedNode(setting, null, node); + } + $$(node, consts.id.A, setting).addClass(consts.node.CURSELECTED); + data.addSelectedNode(setting, node); + setting.treeObj.trigger(consts.event.SELECTED, [event, setting.treeId, node]); + }, + setNodeFontCss: function(setting, treeNode) { + var aObj = $$(treeNode, consts.id.A, setting), + fontCss = view.makeNodeFontCss(setting, treeNode); + if (fontCss) { + aObj.css(fontCss); + } + }, + setNodeLineIcos: function(setting, node) { + if (!node) return; + var switchObj = $$(node, consts.id.SWITCH, setting), + ulObj = $$(node, consts.id.UL, setting), + icoObj = $$(node, consts.id.ICON, setting), + ulLine = view.makeUlLineClass(setting, node); + if (ulLine.length==0) { + ulObj.removeClass(consts.line.LINE); + } else { + ulObj.addClass(ulLine); + } + switchObj.attr("class", view.makeNodeLineClass(setting, node)); + if (node.isParent) { + switchObj.removeAttr("disabled"); + } else { + switchObj.attr("disabled", "disabled"); + } + icoObj.removeAttr("style"); + icoObj.attr("style", view.makeNodeIcoStyle(setting, node)); + icoObj.attr("class", view.makeNodeIcoClass(setting, node)); + }, + setNodeName: function(setting, node) { + var title = data.getNodeTitle(setting, node), + nObj = $$(node, consts.id.SPAN, setting); + nObj.empty(); + if (setting.view.nameIsHTML) { + nObj.html(data.getNodeName(setting, node)); + } else { + nObj.text(data.getNodeName(setting, node)); + } + if (tools.apply(setting.view.showTitle, [setting.treeId, node], setting.view.showTitle)) { + var aObj = $$(node, consts.id.A, setting); + aObj.attr("title", !title ? "" : title); + } + }, + setNodeTarget: function(setting, node) { + var aObj = $$(node, consts.id.A, setting); + aObj.attr("target", view.makeNodeTarget(node)); + }, + setNodeUrl: function(setting, node) { + var aObj = $$(node, consts.id.A, setting), + url = view.makeNodeUrl(setting, node); + if (url == null || url.length == 0) { + aObj.removeAttr("href"); + } else { + aObj.attr("href", url); + } + }, + switchNode: function(setting, node) { + if (node.open || !tools.canAsync(setting, node)) { + view.expandCollapseNode(setting, node, !node.open); + } else if (setting.async.enable) { + if (!view.asyncNode(setting, node)) { + view.expandCollapseNode(setting, node, !node.open); + return; + } + } else if (node) { + view.expandCollapseNode(setting, node, !node.open); + } + } + }; + // zTree defind + $.fn.zTree = { + consts : _consts, + _z : { + tools: tools, + view: view, + event: event, + data: data + }, + getZTreeObj: function(treeId) { + var o = data.getZTreeTools(treeId); + return o ? o : null; + }, + destroy: function(treeId) { + if (!!treeId && treeId.length > 0) { + view.destroy(data.getSetting(treeId)); + } else { + for(var s in settings) { + view.destroy(settings[s]); + } + } + }, + init: function(obj, zSetting, zNodes) { + var setting = tools.clone(_setting); + $.extend(true, setting, zSetting); + setting.treeId = obj.attr("id"); + setting.treeObj = obj; + setting.treeObj.empty(); + settings[setting.treeId] = setting; + //For some older browser,(e.g., ie6) + if(typeof document.body.style.maxHeight === "undefined") { + setting.view.expandSpeed = ""; + } + data.initRoot(setting); + var root = data.getRoot(setting), + childKey = setting.data.key.children; + zNodes = zNodes ? tools.clone(tools.isArray(zNodes)? zNodes : [zNodes]) : []; + if (setting.data.simpleData.enable) { + root[childKey] = data.transformTozTreeFormat(setting, zNodes); + } else { + root[childKey] = zNodes; + } + + data.initCache(setting); + event.unbindTree(setting); + event.bindTree(setting); + event.unbindEvent(setting); + event.bindEvent(setting); + + var zTreeTools = { + setting : setting, + addNodes : function(parentNode, newNodes, isSilent) { + if (!newNodes) return null; + if (!parentNode) parentNode = null; + if (parentNode && !parentNode.isParent && setting.data.keep.leaf) return null; + var xNewNodes = tools.clone(tools.isArray(newNodes)? newNodes: [newNodes]); + function addCallback() { + view.addNodes(setting, parentNode, xNewNodes, (isSilent==true)); + } + + if (tools.canAsync(setting, parentNode)) { + view.asyncNode(setting, parentNode, isSilent, addCallback); + } else { + addCallback(); + } + return xNewNodes; + }, + cancelSelectedNode : function(node) { + view.cancelPreSelectedNode(setting, node); + }, + destroy : function() { + view.destroy(setting); + }, + expandAll : function(expandFlag) { + expandFlag = !!expandFlag; + view.expandCollapseSonNode(setting, null, expandFlag, true); + return expandFlag; + }, + expandNode : function(node, expandFlag, sonSign, focus, callbackFlag) { + if (!node || !node.isParent) return null; + if (expandFlag !== true && expandFlag !== false) { + expandFlag = !node.open; + } + callbackFlag = !!callbackFlag; + + if (callbackFlag && expandFlag && (tools.apply(setting.callback.beforeExpand, [setting.treeId, node], true) == false)) { + return null; + } else if (callbackFlag && !expandFlag && (tools.apply(setting.callback.beforeCollapse, [setting.treeId, node], true) == false)) { + return null; + } + if (expandFlag && node.parentTId) { + view.expandCollapseParentNode(setting, node.getParentNode(), expandFlag, false); + } + if (expandFlag === node.open && !sonSign) { + return null; + } + + data.getRoot(setting).expandTriggerFlag = callbackFlag; + if (!tools.canAsync(setting, node) && sonSign) { + view.expandCollapseSonNode(setting, node, expandFlag, true, function() { + if (focus !== false) {try{$$(node, setting).focus().blur();}catch(e){}} + }); + } else { + node.open = !expandFlag; + view.switchNode(this.setting, node); + if (focus !== false) {try{$$(node, setting).focus().blur();}catch(e){}} + } + return expandFlag; + }, + getNodes : function() { + return data.getNodes(setting); + }, + getNodeByParam : function(key, value, parentNode) { + if (!key) return null; + return data.getNodeByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value); + }, + getNodeByTId : function(tId) { + return data.getNodeCache(setting, tId); + }, + getNodesByParam : function(key, value, parentNode) { + if (!key) return null; + return data.getNodesByParam(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value); + }, + getNodesByParamFuzzy : function(key, value, parentNode) { + if (!key) return null; + return data.getNodesByParamFuzzy(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), key, value); + }, + getNodesByFilter: function(filter, isSingle, parentNode, invokeParam) { + isSingle = !!isSingle; + if (!filter || (typeof filter != "function")) return (isSingle ? null : []); + return data.getNodesByFilter(setting, parentNode?parentNode[setting.data.key.children]:data.getNodes(setting), filter, isSingle, invokeParam); + }, + getNodeIndex : function(node) { + if (!node) return null; + var childKey = setting.data.key.children, + parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting); + for (var i=0, l = parentNode[childKey].length; i < l; i++) { + if (parentNode[childKey][i] == node) return i; + } + return -1; + }, + getSelectedNodes : function() { + var r = [], list = data.getRoot(setting).curSelectedList; + for (var i=0, l=list.length; i<l; i++) { + r.push(list[i]); + } + return r; + }, + isSelectedNode : function(node) { + return data.isSelectedNode(setting, node); + }, + reAsyncChildNodes : function(parentNode, reloadType, isSilent) { + if (!this.setting.async.enable) return; + var isRoot = !parentNode; + if (isRoot) { + parentNode = data.getRoot(setting); + } + if (reloadType=="refresh") { + var childKey = this.setting.data.key.children; + for (var i = 0, l = parentNode[childKey] ? parentNode[childKey].length : 0; i < l; i++) { + data.removeNodeCache(setting, parentNode[childKey][i]); + } + data.removeSelectedNode(setting); + parentNode[childKey] = []; + if (isRoot) { + this.setting.treeObj.empty(); + } else { + var ulObj = $$(parentNode, consts.id.UL, setting); + ulObj.empty(); + } + } + view.asyncNode(this.setting, isRoot? null:parentNode, !!isSilent); + }, + refresh : function() { + this.setting.treeObj.empty(); + var root = data.getRoot(setting), + nodes = root[setting.data.key.children] + data.initRoot(setting); + root[setting.data.key.children] = nodes + data.initCache(setting); + view.createNodes(setting, 0, root[setting.data.key.children]); + }, + removeChildNodes : function(node) { + if (!node) return null; + var childKey = setting.data.key.children, + nodes = node[childKey]; + view.removeChildNodes(setting, node); + return nodes ? nodes : null; + }, + removeNode : function(node, callbackFlag) { + if (!node) return; + callbackFlag = !!callbackFlag; + if (callbackFlag && tools.apply(setting.callback.beforeRemove, [setting.treeId, node], true) == false) return; + view.removeNode(setting, node); + if (callbackFlag) { + this.setting.treeObj.trigger(consts.event.REMOVE, [setting.treeId, node]); + } + }, + selectNode : function(node, addFlag) { + if (!node) return; + if (tools.uCanDo(setting)) { + addFlag = setting.view.selectedMulti && addFlag; + if (node.parentTId) { + view.expandCollapseParentNode(setting, node.getParentNode(), true, false, function() { + try{$$(node, setting).focus().blur();}catch(e){} + }); + } else { + try{$$(node, setting).focus().blur();}catch(e){} + } + view.selectNode(setting, node, addFlag); + } + }, + transformTozTreeNodes : function(simpleNodes) { + return data.transformTozTreeFormat(setting, simpleNodes); + }, + transformToArray : function(nodes) { + return data.transformToArrayFormat(setting, nodes); + }, + updateNode : function(node, checkTypeFlag) { + if (!node) return; + var nObj = $$(node, setting); + if (nObj.get(0) && tools.uCanDo(setting)) { + view.setNodeName(setting, node); + view.setNodeTarget(setting, node); + view.setNodeUrl(setting, node); + view.setNodeLineIcos(setting, node); + view.setNodeFontCss(setting, node); + } + } + } + root.treeTools = zTreeTools; + data.setZTreeTools(setting, zTreeTools); + + if (root[childKey] && root[childKey].length > 0) { + view.createNodes(setting, 0, root[childKey]); + } else if (setting.async.enable && setting.async.url && setting.async.url !== '') { + view.asyncNode(setting); + } + return zTreeTools; + } + }; + + var zt = $.fn.zTree, + $$ = tools.$, + consts = zt.consts; +})(jQuery);/* + * JQuery zTree excheck v3.5.18 + * http://zTree.me/ + * + * Copyright (c) 2010 Hunter.z + * + * Licensed same as jquery - MIT License + * http://www.opensource.org/licenses/mit-license.php + * + * email: hunter.z@263.net + * Date: 2015-06-18 + */ +(function($){ + //default consts of excheck + var _consts = { + event: { + CHECK: "ztree_check" + }, + id: { + CHECK: "_check" + }, + checkbox: { + STYLE: "checkbox", + DEFAULT: "chk", + DISABLED: "disable", + FALSE: "false", + TRUE: "true", + FULL: "full", + PART: "part", + FOCUS: "focus" + }, + radio: { + STYLE: "radio", + TYPE_ALL: "all", + TYPE_LEVEL: "level" + } + }, + //default setting of excheck + _setting = { + check: { + enable: false, + autoCheckTrigger: false, + chkStyle: _consts.checkbox.STYLE, + nocheckInherit: false, + chkDisabledInherit: false, + radioType: _consts.radio.TYPE_LEVEL, + chkboxType: { + "Y": "ps", + "N": "ps" + } + }, + data: { + key: { + checked: "checked" + } + }, + callback: { + beforeCheck:null, + onCheck:null + } + }, + //default root of excheck + _initRoot = function (setting) { + var r = data.getRoot(setting); + r.radioCheckedList = []; + }, + //default cache of excheck + _initCache = function(treeId) {}, + //default bind event of excheck + _bindEvent = function(setting) { + var o = setting.treeObj, + c = consts.event; + o.bind(c.CHECK, function (event, srcEvent, treeId, node) { + event.srcEvent = srcEvent; + tools.apply(setting.callback.onCheck, [event, treeId, node]); + }); + }, + _unbindEvent = function(setting) { + var o = setting.treeObj, + c = consts.event; + o.unbind(c.CHECK); + }, + //default event proxy of excheck + _eventProxy = function(e) { + var target = e.target, + setting = data.getSetting(e.data.treeId), + tId = "", node = null, + nodeEventType = "", treeEventType = "", + nodeEventCallback = null, treeEventCallback = null; + + if (tools.eqs(e.type, "mouseover")) { + if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "mouseoverCheck"; + } + } else if (tools.eqs(e.type, "mouseout")) { + if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "mouseoutCheck"; + } + } else if (tools.eqs(e.type, "click")) { + if (setting.check.enable && tools.eqs(target.tagName, "span") && target.getAttribute("treeNode"+ consts.id.CHECK) !== null) { + tId = tools.getNodeMainDom(target).id; + nodeEventType = "checkNode"; + } + } + if (tId.length>0) { + node = data.getNodeCache(setting, tId); + switch (nodeEventType) { + case "checkNode" : + nodeEventCallback = _handler.onCheckNode; + break; + case "mouseoverCheck" : + nodeEventCallback = _handler.onMouseoverCheck; + break; + case "mouseoutCheck" : + nodeEventCallback = _handler.onMouseoutCheck; + break; + } + } + var proxyResult = { + stop: nodeEventType === "checkNode", + node: node, + nodeEventType: nodeEventType, + nodeEventCallback: nodeEventCallback, + treeEventType: treeEventType, + treeEventCallback: treeEventCallback + }; + return proxyResult + }, + //default init node of excheck + _initNode = function(setting, level, n, parentNode, isFirstNode, isLastNode, openFlag) { + if (!n) return; + var checkedKey = setting.data.key.checked; + if (typeof n[checkedKey] == "string") n[checkedKey] = tools.eqs(n[checkedKey], "true"); + n[checkedKey] = !!n[checkedKey]; + n.checkedOld = n[checkedKey]; + if (typeof n.nocheck == "string") n.nocheck = tools.eqs(n.nocheck, "true"); + n.nocheck = !!n.nocheck || (setting.check.nocheckInherit && parentNode && !!parentNode.nocheck); + if (typeof n.chkDisabled == "string") n.chkDisabled = tools.eqs(n.chkDisabled, "true"); + n.chkDisabled = !!n.chkDisabled || (setting.check.chkDisabledInherit && parentNode && !!parentNode.chkDisabled); + if (typeof n.halfCheck == "string") n.halfCheck = tools.eqs(n.halfCheck, "true"); + n.halfCheck = !!n.halfCheck; + n.check_Child_State = -1; + n.check_Focus = false; + n.getCheckStatus = function() {return data.getCheckStatus(setting, n);}; + + if (setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL && n[checkedKey] ) { + var r = data.getRoot(setting); + r.radioCheckedList.push(n); + } + }, + //add dom for check + _beforeA = function(setting, node, html) { + var checkedKey = setting.data.key.checked; + if (setting.check.enable) { + data.makeChkFlag(setting, node); + html.push("<span ID='", node.tId, consts.id.CHECK, "' class='", view.makeChkClass(setting, node), "' treeNode", consts.id.CHECK, (node.nocheck === true?" style='display:none;'":""),"></span>"); + } + }, + //update zTreeObj, add method of check + _zTreeTools = function(setting, zTreeTools) { + zTreeTools.checkNode = function(node, checked, checkTypeFlag, callbackFlag) { + var checkedKey = this.setting.data.key.checked; + if (node.chkDisabled === true) return; + if (checked !== true && checked !== false) { + checked = !node[checkedKey]; + } + callbackFlag = !!callbackFlag; + + if (node[checkedKey] === checked && !checkTypeFlag) { + return; + } else if (callbackFlag && tools.apply(this.setting.callback.beforeCheck, [this.setting.treeId, node], true) == false) { + return; + } + if (tools.uCanDo(this.setting) && this.setting.check.enable && node.nocheck !== true) { + node[checkedKey] = checked; + var checkObj = $$(node, consts.id.CHECK, this.setting); + if (checkTypeFlag || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node); + view.setChkClass(this.setting, checkObj, node); + view.repairParentChkClassWithSelf(this.setting, node); + if (callbackFlag) { + this.setting.treeObj.trigger(consts.event.CHECK, [null, this.setting.treeId, node]); + } + } + } + + zTreeTools.checkAllNodes = function(checked) { + view.repairAllChk(this.setting, !!checked); + } + + zTreeTools.getCheckedNodes = function(checked) { + var childKey = this.setting.data.key.children; + checked = (checked !== false); + return data.getTreeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey], checked); + } + + zTreeTools.getChangeCheckedNodes = function() { + var childKey = this.setting.data.key.children; + return data.getTreeChangeCheckedNodes(this.setting, data.getRoot(this.setting)[childKey]); + } + + zTreeTools.setChkDisabled = function(node, disabled, inheritParent, inheritChildren) { + disabled = !!disabled; + inheritParent = !!inheritParent; + inheritChildren = !!inheritChildren; + view.repairSonChkDisabled(this.setting, node, disabled, inheritChildren); + view.repairParentChkDisabled(this.setting, node.getParentNode(), disabled, inheritParent); + } + + var _updateNode = zTreeTools.updateNode; + zTreeTools.updateNode = function(node, checkTypeFlag) { + if (_updateNode) _updateNode.apply(zTreeTools, arguments); + if (!node || !this.setting.check.enable) return; + var nObj = $$(node, this.setting); + if (nObj.get(0) && tools.uCanDo(this.setting)) { + var checkObj = $$(node, consts.id.CHECK, this.setting); + if (checkTypeFlag == true || this.setting.check.chkStyle === consts.radio.STYLE) view.checkNodeRelation(this.setting, node); + view.setChkClass(this.setting, checkObj, node); + view.repairParentChkClassWithSelf(this.setting, node); + } + } + }, + //method of operate data + _data = { + getRadioCheckedList: function(setting) { + var checkedList = data.getRoot(setting).radioCheckedList; + for (var i=0, j=checkedList.length; i<j; i++) { + if(!data.getNodeCache(setting, checkedList[i].tId)) { + checkedList.splice(i, 1); + i--; j--; + } + } + return checkedList; + }, + getCheckStatus: function(setting, node) { + if (!setting.check.enable || node.nocheck || node.chkDisabled) return null; + var checkedKey = setting.data.key.checked, + r = { + checked: node[checkedKey], + half: node.halfCheck ? node.halfCheck : (setting.check.chkStyle == consts.radio.STYLE ? (node.check_Child_State === 2) : (node[checkedKey] ? (node.check_Child_State > -1 && node.check_Child_State < 2) : (node.check_Child_State > 0))) + }; + return r; + }, + getTreeCheckedNodes: function(setting, nodes, checked, results) { + if (!nodes) return []; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + onlyOne = (checked && setting.check.chkStyle == consts.radio.STYLE && setting.check.radioType == consts.radio.TYPE_ALL); + results = !results ? [] : results; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] == checked) { + results.push(nodes[i]); + if(onlyOne) { + break; + } + } + data.getTreeCheckedNodes(setting, nodes[i][childKey], checked, results); + if(onlyOne && results.length > 0) { + break; + } + } + return results; + }, + getTreeChangeCheckedNodes: function(setting, nodes, results) { + if (!nodes) return []; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked; + results = !results ? [] : results; + for (var i = 0, l = nodes.length; i < l; i++) { + if (nodes[i].nocheck !== true && nodes[i].chkDisabled !== true && nodes[i][checkedKey] != nodes[i].checkedOld) { + results.push(nodes[i]); + } + data.getTreeChangeCheckedNodes(setting, nodes[i][childKey], results); + } + return results; + }, + makeChkFlag: function(setting, node) { + if (!node) return; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + chkFlag = -1; + if (node[childKey]) { + for (var i = 0, l = node[childKey].length; i < l; i++) { + var cNode = node[childKey][i]; + var tmp = -1; + if (setting.check.chkStyle == consts.radio.STYLE) { + if (cNode.nocheck === true || cNode.chkDisabled === true) { + tmp = cNode.check_Child_State; + } else if (cNode.halfCheck === true) { + tmp = 2; + } else if (cNode[checkedKey]) { + tmp = 2; + } else { + tmp = cNode.check_Child_State > 0 ? 2:0; + } + if (tmp == 2) { + chkFlag = 2; break; + } else if (tmp == 0){ + chkFlag = 0; + } + } else if (setting.check.chkStyle == consts.checkbox.STYLE) { + if (cNode.nocheck === true || cNode.chkDisabled === true) { + tmp = cNode.check_Child_State; + } else if (cNode.halfCheck === true) { + tmp = 1; + } else if (cNode[checkedKey] ) { + tmp = (cNode.check_Child_State === -1 || cNode.check_Child_State === 2) ? 2 : 1; + } else { + tmp = (cNode.check_Child_State > 0) ? 1 : 0; + } + if (tmp === 1) { + chkFlag = 1; break; + } else if (tmp === 2 && chkFlag > -1 && i > 0 && tmp !== chkFlag) { + chkFlag = 1; break; + } else if (chkFlag === 2 && tmp > -1 && tmp < 2) { + chkFlag = 1; break; + } else if (tmp > -1) { + chkFlag = tmp; + } + } + } + } + node.check_Child_State = chkFlag; + } + }, + //method of event proxy + _event = { + + }, + //method of event handler + _handler = { + onCheckNode: function (event, node) { + if (node.chkDisabled === true) return false; + var setting = data.getSetting(event.data.treeId), + checkedKey = setting.data.key.checked; + if (tools.apply(setting.callback.beforeCheck, [setting.treeId, node], true) == false) return true; + node[checkedKey] = !node[checkedKey]; + view.checkNodeRelation(setting, node); + var checkObj = $$(node, consts.id.CHECK, setting); + view.setChkClass(setting, checkObj, node); + view.repairParentChkClassWithSelf(setting, node); + setting.treeObj.trigger(consts.event.CHECK, [event, setting.treeId, node]); + return true; + }, + onMouseoverCheck: function(event, node) { + if (node.chkDisabled === true) return false; + var setting = data.getSetting(event.data.treeId), + checkObj = $$(node, consts.id.CHECK, setting); + node.check_Focus = true; + view.setChkClass(setting, checkObj, node); + return true; + }, + onMouseoutCheck: function(event, node) { + if (node.chkDisabled === true) return false; + var setting = data.getSetting(event.data.treeId), + checkObj = $$(node, consts.id.CHECK, setting); + node.check_Focus = false; + view.setChkClass(setting, checkObj, node); + return true; + } + }, + //method of tools for zTree + _tools = { + + }, + //method of operate ztree dom + _view = { + checkNodeRelation: function(setting, node) { + var pNode, i, l, + childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + r = consts.radio; + if (setting.check.chkStyle == r.STYLE) { + var checkedList = data.getRadioCheckedList(setting); + if (node[checkedKey]) { + if (setting.check.radioType == r.TYPE_ALL) { + for (i = checkedList.length-1; i >= 0; i--) { + pNode = checkedList[i]; + if (pNode[checkedKey] && pNode != node) { + pNode[checkedKey] = false; + checkedList.splice(i, 1); + + view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode); + if (pNode.parentTId != node.parentTId) { + view.repairParentChkClassWithSelf(setting, pNode); + } + } + } + checkedList.push(node); + } else { + var parentNode = (node.parentTId) ? node.getParentNode() : data.getRoot(setting); + for (i = 0, l = parentNode[childKey].length; i < l; i++) { + pNode = parentNode[childKey][i]; + if (pNode[checkedKey] && pNode != node) { + pNode[checkedKey] = false; + view.setChkClass(setting, $$(pNode, consts.id.CHECK, setting), pNode); + } + } + } + } else if (setting.check.radioType == r.TYPE_ALL) { + for (i = 0, l = checkedList.length; i < l; i++) { + if (node == checkedList[i]) { + checkedList.splice(i, 1); + break; + } + } + } + + } else { + if (node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.Y.indexOf("s") > -1)) { + view.setSonNodeCheckBox(setting, node, true); + } + if (!node[checkedKey] && (!node[childKey] || node[childKey].length==0 || setting.check.chkboxType.N.indexOf("s") > -1)) { + view.setSonNodeCheckBox(setting, node, false); + } + if (node[checkedKey] && setting.check.chkboxType.Y.indexOf("p") > -1) { + view.setParentNodeCheckBox(setting, node, true); + } + if (!node[checkedKey] && setting.check.chkboxType.N.indexOf("p") > -1) { + view.setParentNodeCheckBox(setting, node, false); + } + } + }, + makeChkClass: function(setting, node) { + var checkedKey = setting.data.key.checked, + c = consts.checkbox, r = consts.radio, + fullStyle = ""; + if (node.chkDisabled === true) { + fullStyle = c.DISABLED; + } else if (node.halfCheck) { + fullStyle = c.PART; + } else if (setting.check.chkStyle == r.STYLE) { + fullStyle = (node.check_Child_State < 1)? c.FULL:c.PART; + } else { + fullStyle = node[checkedKey] ? ((node.check_Child_State === 2 || node.check_Child_State === -1) ? c.FULL:c.PART) : ((node.check_Child_State < 1)? c.FULL:c.PART); + } + var chkName = setting.check.chkStyle + "_" + (node[checkedKey] ? c.TRUE : c.FALSE) + "_" + fullStyle; + chkName = (node.check_Focus && node.chkDisabled !== true) ? chkName + "_" + c.FOCUS : chkName; + return consts.className.BUTTON + " " + c.DEFAULT + " " + chkName; + }, + repairAllChk: function(setting, checked) { + if (setting.check.enable && setting.check.chkStyle === consts.checkbox.STYLE) { + var checkedKey = setting.data.key.checked, + childKey = setting.data.key.children, + root = data.getRoot(setting); + for (var i = 0, l = root[childKey].length; i<l ; i++) { + var node = root[childKey][i]; + if (node.nocheck !== true && node.chkDisabled !== true) { + node[checkedKey] = checked; + } + view.setSonNodeCheckBox(setting, node, checked); + } + } + }, + repairChkClass: function(setting, node) { + if (!node) return; + data.makeChkFlag(setting, node); + if (node.nocheck !== true) { + var checkObj = $$(node, consts.id.CHECK, setting); + view.setChkClass(setting, checkObj, node); + } + }, + repairParentChkClass: function(setting, node) { + if (!node || !node.parentTId) return; + var pNode = node.getParentNode(); + view.repairChkClass(setting, pNode); + view.repairParentChkClass(setting, pNode); + }, + repairParentChkClassWithSelf: function(setting, node) { + if (!node) return; + var childKey = setting.data.key.children; + if (node[childKey] && node[childKey].length > 0) { + view.repairParentChkClass(setting, node[childKey][0]); + } else { + view.repairParentChkClass(setting, node); + } + }, + repairSonChkDisabled: function(setting, node, chkDisabled, inherit) { + if (!node) return; + var childKey = setting.data.key.children; + if (node.chkDisabled != chkDisabled) { + node.chkDisabled = chkDisabled; + } + view.repairChkClass(setting, node); + if (node[childKey] && inherit) { + for (var i = 0, l = node[childKey].length; i < l; i++) { + var sNode = node[childKey][i]; + view.repairSonChkDisabled(setting, sNode, chkDisabled, inherit); + } + } + }, + repairParentChkDisabled: function(setting, node, chkDisabled, inherit) { + if (!node) return; + if (node.chkDisabled != chkDisabled && inherit) { + node.chkDisabled = chkDisabled; + } + view.repairChkClass(setting, node); + view.repairParentChkDisabled(setting, node.getParentNode(), chkDisabled, inherit); + }, + setChkClass: function(setting, obj, node) { + if (!obj) return; + if (node.nocheck === true) { + obj.hide(); + } else { + obj.show(); + } + obj.attr('class', view.makeChkClass(setting, node)); + }, + setParentNodeCheckBox: function(setting, node, value, srcNode) { + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + checkObj = $$(node, consts.id.CHECK, setting); + if (!srcNode) srcNode = node; + data.makeChkFlag(setting, node); + if (node.nocheck !== true && node.chkDisabled !== true) { + node[checkedKey] = value; + view.setChkClass(setting, checkObj, node); + if (setting.check.autoCheckTrigger && node != srcNode) { + setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]); + } + } + if (node.parentTId) { + var pSign = true; + if (!value) { + var pNodes = node.getParentNode()[childKey]; + for (var i = 0, l = pNodes.length; i < l; i++) { + if ((pNodes[i].nocheck !== true && pNodes[i].chkDisabled !== true && pNodes[i][checkedKey]) + || ((pNodes[i].nocheck === true || pNodes[i].chkDisabled === true) && pNodes[i].check_Child_State > 0)) { + pSign = false; + break; + } + } + } + if (pSign) { + view.setParentNodeCheckBox(setting, node.getParentNode(), value, srcNode); + } + } + }, + setSonNodeCheckBox: function(setting, node, value, srcNode) { + if (!node) return; + var childKey = setting.data.key.children, + checkedKey = setting.data.key.checked, + checkObj = $$(node, consts.id.CHECK, setting); + if (!srcNode) srcNode = node; + + var hasDisable = false; + if (node[childKey]) { + for (var i = 0, l = node[childKey].length; i < l && node.chkDisabled !== true; i++) { + var sNode = node[childKey][i]; + view.setSonNodeCheckBox(setting, sNode, value, srcNode); + if (sNode.chkDisabled === true) hasDisable = true; + } + } + + if (node != data.getRoot(setting) && node.chkDisabled !== true) { + if (hasDisable && node.nocheck !== true) { + data.makeChkFlag(setting, node); + } + if (node.nocheck !== true && node.chkDisabled !== true) { + node[checkedKey] = value; + if (!hasDisable) node.check_Child_State = (node[childKey] && node[childKey].length > 0) ? (value ? 2 : 0) : -1; + } else { + node.check_Child_State = -1; + } + view.setChkClass(setting, checkObj, node); + if (setting.check.autoCheckTrigger && node != srcNode && node.nocheck !== true && node.chkDisabled !== true) { + setting.treeObj.trigger(consts.event.CHECK, [null, setting.treeId, node]); + } + } + + } + }, + + _z = { + tools: _tools, + view: _view, + event: _event, + data: _data + }; + $.extend(true, $.fn.zTree.consts, _consts); + $.extend(true, $.fn.zTree._z, _z); + + var zt = $.fn.zTree, + tools = zt._z.tools, + consts = zt.consts, + view = zt._z.view, + data = zt._z.data, + event = zt._z.event, + $$ = tools.$; + + data.exSetting(_setting); + data.addInitBind(_bindEvent); + data.addInitUnBind(_unbindEvent); + data.addInitCache(_initCache); + data.addInitNode(_initNode); + data.addInitProxy(_eventProxy, true); + data.addInitRoot(_initRoot); + data.addBeforeA(_beforeA); + data.addZTreeTools(_zTreeTools); + + var _createNodes = view.createNodes; + view.createNodes = function(setting, level, nodes, parentNode) { + if (_createNodes) _createNodes.apply(view, arguments); + if (!nodes) return; + view.repairParentChkClassWithSelf(setting, parentNode); + } + var _removeNode = view.removeNode; + view.removeNode = function(setting, node) { + var parentNode = node.getParentNode(); + if (_removeNode) _removeNode.apply(view, arguments); + if (!node || !parentNode) return; + view.repairChkClass(setting, parentNode); + view.repairParentChkClass(setting, parentNode); + } + + var _appendNodes = view.appendNodes; + view.appendNodes = function(setting, level, nodes, parentNode, initFlag, openFlag) { + var html = ""; + if (_appendNodes) { + html = _appendNodes.apply(view, arguments); + } + if (parentNode) { + data.makeChkFlag(setting, parentNode); + } + return html; + } +})(jQuery);/** + * 可以改变图标的button + * + * Created by GUY on 2016/2/2. + * + * @class BI.IconChangeButton + * @extends BI.Single + */ +BI.IconChangeButton = BI.inherit(BI.Single, { + _defaultConfig: function () { + var conf = BI.IconChangeButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: "bi-icon-change-button", + iconClass: "", + iconWidth: null, + iconHeight: null, + + stopEvent: false, + stopPropagation: false, + selected: false, + once: false, //点击一次选中有效,再点无效 + forceSelected: false, //点击即选中, 选中了就不会被取消 + forceNotSelected: false, //无论怎么点击都不会被选中 + disableSelected: false, //使能选中 + + shadow: false, + isShadowShowingOnSelected: false, //选中状态下是否显示阴影 + trigger: null, + handler: BI.emptyFn + }) + }, + + _init: function () { + BI.IconChangeButton.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.button = BI.createWidget({ + type: "bi.icon_button", + element: this, + cls: o.iconClass, + height: o.height, + iconWidth: o.iconWidth, + iconHeight: o.iconHeight, + + stopEvent: o.stopEvent, + stopPropagation: o.stopPropagation, + selected: o.selected, + once: o.once, + forceSelected: o.forceSelected, + forceNotSelected: o.forceNotSelected, + disableSelected: o.disableSelected, + + shadow: o.shadow, + isShadowShowingOnSelected: o.isShadowShowingOnSelected, + trigger: o.trigger, + handler: o.handler + }); + + this.button.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.button.on(BI.IconButton.EVENT_CHANGE, function () { + self.fireEvent(BI.IconChangeButton.EVENT_CHANGE, arguments); + }); + }, + + isSelected: function () { + return this.button.isSelected(); + }, + + setSelected: function (b) { + this.button.setSelected(b); + }, + + setIcon: function (cls) { + var o = this.options; + if (o.iconClass !== cls) { + this.element.removeClass(o.iconClass).addClass(cls); + o.iconClass = cls; + } + } +}); +BI.IconChangeButton.EVENT_CHANGE = "IconChangeButton.EVENT_CHANGE"; +BI.shortcut("bi.icon_change_button", BI.IconChangeButton);/** + * guy + * @extends BI.Single + * @type {*|void|Object} + */ +BI.HalfIconButton = BI.inherit(BI.IconButton, { + _defaultConfig: function() { + var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this,arguments); + return BI.extend(conf, { + extraCls: "bi-half-icon-button check-half-select-icon", + height: 16, + width: 16, + iconWidth: 16, + iconHeight: 16, + selected: false + }) + }, + + _init : function() { + BI.HalfIconButton.superclass._init.apply(this, arguments); + }, + + doClick: function(){ + BI.HalfIconButton.superclass.doClick.apply(this, arguments); + if(this.isValid()){ + this.fireEvent(BI.HalfIconButton.EVENT_CHANGE); + } + } +}); +BI.HalfIconButton.EVENT_CHANGE = "HalfIconButton.EVENT_CHANGE"; + +BI.shortcut("bi.half_icon_button", BI.HalfIconButton);/** + * 统一的trigger图标按钮 + * + * Created by GUY on 2015/9/16. + * @class BI.TriggerIconButton + * @extends BI.IconButton + */ +BI.TriggerIconButton = BI.inherit(BI.IconButton, { + + _defaultConfig: function () { + var conf = BI.TriggerIconButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-trigger-icon-button", + extraCls: "pull-down-font" + }); + }, + + _init: function () { + BI.TriggerIconButton.superclass._init.apply(this, arguments); + }, + + doClick: function () { + BI.TriggerIconButton.superclass.doClick.apply(this, arguments); + if (this.isValid()) { + this.fireEvent(BI.TriggerIconButton.EVENT_CHANGE, this); + } + } +}); +BI.TriggerIconButton.EVENT_CHANGE = "TriggerIconButton.EVENT_CHANGE"; +BI.shortcut("bi.trigger_icon_button", BI.TriggerIconButton);/** + * guy + * 复选框item + * @type {*|void|Object} + */ +BI.MultiSelectItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.MultiSelectItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-multi-select-item", + height: 25, + logic: { + dynamic: false + } + }) + }, + _init: function () { + BI.MultiSelectItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.checkbox" + }); + this.text = BI.createWidget({ + type: "bi.label", + cls: "list-item-text", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + rgap: o.rgap, + text: o.text, + keyword: o.keyword, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self.setSelected(self.isSelected()); + } + }); + + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, { + items: BI.LogicFactory.createLogicItemsByDirection("left", { + type: "bi.center_adapt", + items: [this.checkbox], + width: 36 + }, this.text) + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.MultiSelectItem.superclass.doClick.apply(this, arguments); + this.checkbox.setSelected(this.isSelected()); + if (this.isValid()) { + this.fireEvent(BI.MultiSelectItem.EVENT_CHANGE, this.getValue(), this); + } + }, + + setSelected: function (v) { + BI.MultiSelectItem.superclass.setSelected.apply(this, arguments); + this.checkbox.setSelected(v); + } +}); +BI.MultiSelectItem.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.multi_select_item", BI.MultiSelectItem);/** + * Created by GUY on 2016/2/2. + * + * @class BI.SingleSelectIconTextItem + * @extends BI.BasicButton + */ +BI.SingleSelectIconTextItem = BI.inherit(BI.Single, { + _defaultConfig: function () { + return BI.extend(BI.SingleSelectIconTextItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-single-select-icon-text-item bi-list-item-active", + iconClass: "", + hgap: 10, + height: 25 + }) + }, + _init: function () { + BI.SingleSelectIconTextItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.text = BI.createWidget({ + type: "bi.icon_text_item", + element: this, + cls: o.iconClass, + once: o.once, + selected: o.selected, + height: o.height, + iconHeight: o.iconHeight, + iconWidth: o.iconWidth, + text: o.text, + keyword: o.keyword, + value: o.value, + py: o.py + }); + this.text.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + }, + + isSelected: function () { + return this.text.isSelected(); + }, + + setSelected: function (b) { + this.text.setSelected(b); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.SingleSelectIconTextItem.superclass.doClick.apply(this, arguments); + } +}); + +BI.shortcut("bi.single_select_icon_text_item", BI.SingleSelectIconTextItem);/** + * guy + * 复选框item + * @type {*|void|Object} + */ +BI.SingleSelectItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.SingleSelectItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-single-select-item bi-list-item-active", + hgap: 10, + height: 25, + textAlign: "left", + }) + }, + _init: function () { + BI.SingleSelectItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.text = BI.createWidget({ + type: "bi.label", + element: this, + textAlign: o.textAlign, + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + keyword: o.keyword, + value: o.value, + py: o.py + }); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.SingleSelectItem.superclass.doClick.apply(this, arguments); + }, + + setSelected: function (v) { + BI.SingleSelectItem.superclass.setSelected.apply(this, arguments); + } +}); + +BI.shortcut("bi.single_select_item", BI.SingleSelectItem);/** + * guy + * 单选框item + * @type {*|void|Object} + */ +BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.SingleSelectRadioItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-single-select-radio-item bi-list-item-active", + logic: { + dynamic: false + }, + hgap: 10, + height: 25 + }) + }, + _init: function () { + BI.SingleSelectRadioItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.radio = BI.createWidget({ + type: "bi.radio" + }); + this.radio.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self.setSelected(!self.isSelected()); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.text = BI.createWidget({ + type: "bi.label", + cls: "list-item-text", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + keyword: o.keyword, + value: o.value, + py: o.py + }); + + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, { + items: BI.LogicFactory.createLogicItemsByDirection("left", { + type: "bi.center_adapt", + items: [this.radio], + width: 36 + }, this.text) + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.SingleSelectRadioItem.superclass.doClick.apply(this, arguments); + this.radio.setSelected(this.isSelected()); + }, + + setSelected: function (v) { + BI.SingleSelectRadioItem.superclass.setSelected.apply(this, arguments); + this.radio.setSelected(v); + + } +}); + +BI.shortcut("bi.single_select_radio_item", BI.SingleSelectRadioItem);/** + * Created by roy on 15/10/16. + */ +BI.ArrowNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.ArrowNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-arrow-group-node bi-list-item", + logic: { + dynamic: false + }, + id: "", + pId: "", + open: false, + height: 25 + }); + }, + _init: function () { + var self = this, o = this.options; + BI.ArrowNode.superclass._init.apply(this, arguments); + this.checkbox = BI.createWidget({ + type: "bi.arrow_tree_group_node_checkbox", + iconWidth: 13, + iconHeight: 13 + }); + + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self.setSelected(self.isSelected()); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.ArrowNode.superclass.doClick.apply(this, arguments); + this.checkbox.setSelected(this.isOpened()); + }, + setValue: function (v) { + this.text.setValue(v); + }, + + setOpened: function (v) { + BI.ArrowNode.superclass.setOpened.apply(this, arguments); + this.checkbox.setSelected(v); + } +}); + +BI.shortcut("bi.arrow_group_node", BI.ArrowNode);/** + * 加号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.FirstPlusGroupNode + * @extends BI.NodeButton + */ +BI.FirstPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.FirstPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-first-plus-group-node bi-list-item", + logic: { + dynamic: false + }, + id: "", + pId: "", + open: false, + height: 25 + }) + }, + _init: function () { + BI.FirstPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.first_tree_node_checkbox", + stopPropagation: true + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.triggerExpand(); + } else { + self.triggerCollapse(); + } + } + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.FirstPlusGroupNode.superclass.doClick.apply(this, arguments); + this.checkbox.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.FirstPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.checkbox)) { + this.checkbox.setSelected(v); + } + } +}); + +BI.shortcut("bi.first_plus_group_node", BI.FirstPlusGroupNode);/** + * Created by User on 2016/3/31. + */ +/** + * > + icon + 文本 + * @class BI.IconArrowNode + * @extends BI.NodeButton + */ +BI.IconArrowNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.IconArrowNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-icon-arrow-node bi-list-item", + logic: { + dynamic: false + }, + id: "", + pId: "", + open: false, + height: 25, + iconHeight: 13, + iconWidth: 13, + iconCls: "" + }) + }, + _init: function () { + BI.IconArrowNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.tree_group_node_checkbox", + width: 23, + stopPropagation: true + }); + + var icon = BI.createWidget({ + type: "bi.center_adapt", + cls: o.iconCls, + width: 23, + items: [{ + type: "bi.icon", + height: o.iconHeight, + width: o.iconWidth + }] + }); + + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.triggerExpand(); + } else { + self.triggerCollapse(); + } + } + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, { + width: 23, + el: icon + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.IconArrowNode.superclass.doClick.apply(this, arguments); + this.checkbox.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.IconArrowNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.checkbox)) { + this.checkbox.setSelected(v); + } + } +}); + +BI.shortcut("bi.icon_arrow_node", BI.IconArrowNode);/** + * 加号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.LastPlusGroupNode + * @extends BI.NodeButton + */ +BI.LastPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.LastPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-last-plus-group-node bi-list-item", + logic: { + dynamic: false + }, + id: "", + pId: "", + open: false, + height: 25 + }) + }, + _init: function () { + BI.LastPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.last_tree_node_checkbox", + stopPropagation: true + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if(type === BI.Events.CLICK) { + if (this.isSelected()) { + self.triggerExpand(); + } else { + self.triggerCollapse(); + } + } + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.LastPlusGroupNode.superclass.doClick.apply(this, arguments); + this.checkbox.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.LastPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.checkbox)) { + this.checkbox.setSelected(v); + } + } +}); + +BI.shortcut("bi.last_plus_group_node", BI.LastPlusGroupNode);/** + * 加号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.MidPlusGroupNode + * @extends BI.NodeButton + */ +BI.MidPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.MidPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-mid-plus-group-node bi-list-item", + logic: { + dynamic: false + }, + id: "", + pId: "", + open: false, + height: 25 + }) + }, + _init: function () { + BI.MidPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.mid_tree_node_checkbox", + stopPropagation: true + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.triggerExpand(); + } else { + self.triggerCollapse(); + } + } + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.MidPlusGroupNode.superclass.doClick.apply(this, arguments); + this.checkbox.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.MidPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.checkbox)) { + this.checkbox.setSelected(v); + } + } +}); + +BI.shortcut("bi.mid_plus_group_node", BI.MidPlusGroupNode);BI.MultiLayerIconArrowNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.MultiLayerIconArrowNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + extraCls: "bi-multilayer-icon-arrow-node bi-list-item", + layer: 0,//第几层级 + id: "", + pId: "", + open: false, + height: 25, + iconHeight: 13, + iconWidth: 13, + iconCls: "" + }) + }, + _init: function () { + BI.MultiLayerIconArrowNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.node = BI.createWidget({ + type: "bi.icon_arrow_node", + iconCls: o.iconCls, + //logic: { + // dynamic: true + //}, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + iconHeight: o.iconHeight, + iconWidth: o.iconWidth, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.node.on(BI.Controller.EVENT_CHANGE, function (type) { + self.setSelected(self.isSelected()); + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + width: 13, + height: o.height + }) + }); + items.push(this.node); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + isOnce: function () { + return true; + }, + + doRedMark: function () { + this.node.doRedMark.apply(this.node, arguments); + }, + + unRedMark: function () { + this.node.unRedMark.apply(this.node, arguments); + }, + + isSelected: function () { + return this.node.isSelected(); + }, + + setSelected: function (b) { + BI.MultiLayerIconArrowNode.superclass.setSelected.apply(this, arguments); + this.node.setSelected(b); + }, + + doClick: function () { + BI.NodeButton.superclass.doClick.apply(this, arguments); + this.node.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.MultiLayerIconArrowNode.superclass.setOpened.apply(this, arguments); + this.node.setOpened(v); + } +}); + +BI.shortcut("bi.multilayer_icon_arrow_node", BI.MultiLayerIconArrowNode);/** + * 加号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.PlusGroupNode + * @extends BI.NodeButton + */ +BI.PlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.PlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-plus-group-node bi-list-item", + logic: { + dynamic: false + }, + id: "", + pId: "", + open: false, + height: 25 + }) + }, + _init: function () { + BI.PlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.tree_node_checkbox" + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self.setSelected(self.isSelected()); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.PlusGroupNode.superclass.doClick.apply(this, arguments); + this.checkbox.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.PlusGroupNode.superclass.setOpened.apply(this, arguments); + if (this.checkbox) { + this.checkbox.setSelected(v); + } + } +}); + +BI.shortcut("bi.plus_group_node", BI.PlusGroupNode);/** + * 三角号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.TriangleGroupNode + * @extends BI.NodeButton + */ +BI.TriangleGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.TriangleGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-triangle-group-node bi-list-item", + logic: { + dynamic: false + }, + id: "", + pId: "", + open: false, + height: 25 + }) + }, + _init: function () { + BI.TriangleGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + iconWidth: 13, + iconHeight: 13, + type: "bi.tree_group_node_checkbox" + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py, + keyword: o.keyword + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self.setSelected(self.isSelected()); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.TriangleGroupNode.superclass.doClick.apply(this, arguments); + this.checkbox.setSelected(this.isOpened()); + }, + + setOpened: function (v) { + BI.TriangleGroupNode.superclass.setOpened.apply(this, arguments); + this.checkbox.setSelected(v); + }, + + setText: function(text){ + BI.TriangleGroupNode.superclass.setText.apply(this, arguments); + this.text.setText(text); + } +}); + +BI.shortcut("bi.triangle_group_node", BI.TriangleGroupNode);/** + * guy + * 复选框item + * @type {*|void|Object} + */ +BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.FirstTreeLeafItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-first-tree-leaf-item bi-list-item-active", + logic: { + dynamic: false + }, + id: "", + pId: "", + layer: 0, + height: 25 + }) + }, + _init: function () { + BI.FirstTreeLeafItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.checkbox" + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self.setSelected(self.isSelected()); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : { + width: 13, + el: { + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + } + }), { + width: 25, + el: { + type: "bi.layout", + cls: "mid-line-conn-background", + width: 25, + height: o.height + } + }, { + el: this.text + }); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + getId: function () { + return this.options.id; + }, + + getPId: function () { + return this.options.pId; + }, + + doClick: function () { + BI.FirstTreeLeafItem.superclass.doClick.apply(this, arguments); + this.checkbox.setSelected(this.isSelected()); + }, + + setSelected: function (v) { + BI.FirstTreeLeafItem.superclass.setSelected.apply(this, arguments); + this.checkbox.setSelected(v); + } +}); + +BI.shortcut("bi.first_tree_leaf_item", BI.FirstTreeLeafItem);BI.IconTreeLeafItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.IconTreeLeafItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-icon-tree-leaf-item bi-list-item-active", + logic: { + dynamic: false + }, + height: 25, + iconWidth: 16, + iconHeight: 16, + iconCls: "" + }) + }, + + _init: function () { + BI.IconTreeLeafItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + var icon = BI.createWidget({ + type: "bi.center_adapt", + width: 23, + cls: o.iconCls, + items: [{ + type: "bi.icon", + width: o.iconWidth, + height: o.iconHeight + }] + }); + + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 23, + el: icon + }, { + el: this.text + }); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + getId: function () { + return this.options.id; + }, + + getPId: function () { + return this.options.pId; + }, + + doClick: function () { + BI.IconTreeLeafItem.superclass.doClick.apply(this, arguments); + }, + + setSelected: function (v) { + BI.IconTreeLeafItem.superclass.setSelected.apply(this, arguments); + } +}); + +BI.shortcut("bi.icon_tree_leaf_item", BI.IconTreeLeafItem);/** + * guy + * 复选框item + * @type {*|void|Object} + */ +BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.LastTreeLeafItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-last-tree-leaf-item bi-list-item-active", + logic: { + dynamic: false + }, + id: "", + pId: "", + layer: 0, + height: 25 + }) + }, + _init: function () { + BI.LastTreeLeafItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.checkbox" + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self.setSelected(self.isSelected()); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : { + width: 13, + el: { + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + } + }), { + width: 25, + el: { + type: "bi.layout", + cls: "mid-line-conn-background", + width: 25, + height: o.height + } + }, { + el: this.text + }); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + getId: function () { + return this.options.id; + }, + + getPId: function () { + return this.options.pId; + }, + + doClick: function () { + BI.LastTreeLeafItem.superclass.doClick.apply(this, arguments); + // this.checkbox.setSelected(this.isSelected()); + }, + + setSelected: function (v) { + BI.LastTreeLeafItem.superclass.setSelected.apply(this, arguments); + // this.checkbox.setSelected(v); + } +}); + +BI.shortcut("bi.last_tree_leaf_item", BI.LastTreeLeafItem);/** + * guy + * 复选框item + * @type {*|void|Object} + */ +BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.MidTreeLeafItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-mid-tree-leaf-item bi-list-item-active", + logic: { + dynamic: false + }, + id: "", + pId: "", + layer: 0, + height: 25 + }) + }, + _init: function () { + BI.MidTreeLeafItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.checkbox" + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self.setSelected(self.isSelected()); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : { + width: 13, + el: { + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + } + }), { + width: 25, + el: { + type: "bi.layout", + cls: "mid-line-conn-background", + width: 25, + height: o.height + } + }, { + el: this.text + }); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + getId: function () { + return this.options.id; + }, + + getPId: function () { + return this.options.pId; + }, + + doClick: function () { + BI.MidTreeLeafItem.superclass.doClick.apply(this, arguments); + this.checkbox.setSelected(this.isSelected()); + }, + + setSelected: function (v) { + BI.MidTreeLeafItem.superclass.setSelected.apply(this, arguments); + this.checkbox.setSelected(v); + } +}); + +BI.shortcut("bi.mid_tree_leaf_item", BI.MidTreeLeafItem);/** + * @class BI.MultiLayerIconTreeLeafItem + * @extends BI.BasicButton + */ +BI.MultiLayerIconTreeLeafItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.MultiLayerIconTreeLeafItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-multilayer-icon-tree-leaf-item bi-list-item-active", + layer: 0, + height: 25, + iconCls: "", + iconHeight: 14, + iconWidth: 12 + }) + }, + _init: function () { + BI.MultiLayerIconTreeLeafItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.item = BI.createWidget({ + type: "bi.icon_tree_leaf_item", + cls: "bi-list-item-none", + iconCls: o.iconCls, + id: o.id, + pId: o.pId, + isFront: true, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py, + iconWidth: o.iconWidth, + iconHeight: o.iconHeight + }); + this.item.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) {//本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + width: 13, + height: o.height + }) + }); + items.push(this.item); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }); + }, + + doRedMark: function () { + this.item.doRedMark.apply(this.item, arguments); + }, + + unRedMark: function () { + this.item.unRedMark.apply(this.item, arguments); + }, + + doHighLight: function () { + this.item.doHighLight.apply(this.item, arguments); + }, + + unHighLight: function () { + this.item.unHighLight.apply(this.item, arguments); + }, + + getId: function () { + return this.options.id; + }, + + getPId: function () { + return this.options.pId; + }, + + doClick: function () { + BI.MultiLayerIconTreeLeafItem.superclass.doClick.apply(this, arguments); + this.item.setSelected(this.isSelected()); + }, + + setSelected: function (v) { + BI.MultiLayerIconTreeLeafItem.superclass.setSelected.apply(this, arguments); + this.item.setSelected(v); + }, + + getValue: function(){ + return this.options.value; + } +}); + +BI.shortcut("bi.multilayer_icon_tree_leaf_item", BI.MultiLayerIconTreeLeafItem);/** + * 树叶子节点 + * Created by GUY on 2015/9/6. + * @class BI.TreeTextLeafItem + * @extends BI.BasicButton + */ +BI.TreeTextLeafItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function() { + return BI.extend(BI.TreeTextLeafItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-tree-text-leaf-item bi-list-item-active", + id: "", + pId: "", + height: 25, + hgap: 0, + lgap: 0, + rgap: 0 + }) + }, + _init : function() { + BI.TreeTextLeafItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + lgap: o.lgap, + rgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + BI.createWidget({ + type: "bi.htape", + element: this, + items: [{ + el: this.text + }] + }) + }, + + doRedMark: function(){ + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function(){ + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function(){ + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function(){ + this.text.unHighLight.apply(this.text, arguments); + }, + + getId: function(){ + return this.options.id; + }, + + getPId: function(){ + return this.options.pId; + } +}); + +BI.shortcut("bi.tree_text_leaf_item", BI.TreeTextLeafItem);/** + * Created by GUY on 2015/8/28. + * @class BI.Calendar + * @extends BI.Widget + */ +BI.Calendar = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.Calendar.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: "bi-calendar", + logic: { + dynamic: false + }, + min: '1900-01-01', //最小日期 + max: '2099-12-31', //最大日期 + year: 2015, + month: 7, //7表示八月 + day: 25 + }) + }, + + _dateCreator: function (Y, M, D) { + var self = this, o = this.options, log = {}, De = new Date(); + var mins = o.min.match(/\d+/g); + var maxs = o.max.match(/\d+/g); + Y < (mins[0] | 0) && (Y = (mins[0] | 0)); + Y > (maxs[0] | 0) && (Y = (maxs[0] | 0)); + + De.setFullYear(Y, M, D); + log.ymd = [De.getFullYear(), De.getMonth(), De.getDate()]; + + var MD = Date._MD.slice(0); + MD[1] = Date.isLeap(log.ymd[0]) ? 29 : 28; + + De.setFullYear(log.ymd[0], log.ymd[1], 1); + log.FDay = De.getDay(); + + log.PDay = MD[M === 0 ? 11 : M - 1] - log.FDay + 1; + log.NDay = 1; + + var items = []; + BI.each(BI.range(42), function (i) { + var td = {}, YY = log.ymd[0], MM = log.ymd[1] + 1, DD; + if (i < log.FDay) { + td.lastMonth = true; + DD = i + log.PDay; + MM === 1 && (YY -= 1); + MM = MM === 1 ? 12 : MM - 1; + } else if (i >= log.FDay && i < log.FDay + MD[log.ymd[1]]) { + DD = i - log.FDay + 1; + if (i - log.FDay + 1 === log.ymd[2]) { + td.currentDay = true; + } + } else { + td.nextMonth = true; + DD = log.NDay++; + MM === 12 && (YY += 1); + MM = MM === 12 ? 1 : MM + 1; + } + if (Date.checkVoid(YY, MM, DD, mins, maxs)[0]) { + td.disabled = true; + } + td.text = DD; + items.push(td); + }) + return items; + }, + + _init: function () { + BI.Calendar.superclass._init.apply(this, arguments); + var self = this, o = this.options; + var items = BI.map(Date._SDN.slice(0, 7), function (i, value) { + return { + type: "bi.label", + height: 25, + text: value + } + }) + var title = BI.createWidget({ + type: "bi.button_group", + height: 25, + items: items + }) + var days = this._dateCreator(o.year, o.month, o.day); + items = []; + items.push(days.slice(0, 7)); + items.push(days.slice(7, 14)); + items.push(days.slice(14, 21)); + items.push(days.slice(21, 28)); + items.push(days.slice(28, 35)); + items.push(days.slice(35, 42)); + + items = BI.map(items, function (i, item) { + return BI.map(item, function (j, td) { + return BI.extend(td, { + type: "bi.text_item", + cls: "bi-list-item-active", + textAlign: "center", + whiteSpace: "normal", + once: false, + forceSelected: true, + height: 25, + value: o.year + "-" + o.month + "-" + td.text, + disabled: td.lastMonth || td.nextMonth || td.disabled + //selected: td.currentDay + }); + }); + }); + + this.days = BI.createWidget({ + type: "bi.button_group", + items: BI.createItems(items, {}), + layouts: [BI.LogicFactory.createLogic("table", BI.extend({}, o.logic, { + columns: 7, + rows: 6, + columnSize: [1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7, 1 / 7], + rowSize: 25 + }))] + }); + this.days.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }) + BI.createWidget(BI.extend({ + element: this + + }, BI.LogicFactory.createLogic("vertical", BI.extend({}, o.logic, { + items: BI.LogicFactory.createLogicItemsByDirection("top", title, this.days) + })))); + }, + + isFrontDate: function () { + var o = this.options, c = this._const; + var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); + Y = Y | 0; + De.setFullYear(Y, M, 1); + var newDate = De.getOffsetDate(-1 * (day + 1)); + return !!Date.checkVoid(newDate.getFullYear(), newDate.getMonth(), newDate.getDate(), o.min, o.max)[0]; + }, + + isFinalDate: function () { + var o = this.options, c = this._const; + var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); + Y = Y | 0; + De.setFullYear(Y, M, 1); + var newDate = De.getOffsetDate(42 - day); + return !!Date.checkVoid(newDate.getFullYear(), newDate.getMonth(), newDate.getDate(), o.min, o.max)[0]; + }, + + setValue: function (ob) { + this.days.setValue([ob.year + "-" + ob.month + "-" + ob.day]); + }, + + getValue: function () { + var date = this.days.getValue()[0].match(/\d+/g); + return { + year: date[0] | 0, + month: date[1] | 0, + day: date[2] | 0 + } + } +}); + +BI.extend(BI.Calendar, { + getPageByDateJSON: function (json) { + var year = new Date().getFullYear(); + var month = new Date().getMonth(); + var page = (json.year - year) * 12; + page += json.month - month; + return page; + }, + getDateJSONByPage: function(v){ + var months = new Date().getMonth(); + var page = v; + + //对当前page做偏移,使到当前年初 + page = page + months; + + var year = BI.parseInt(page / 12); + if(page < 0 && page % 12 !== 0){ + year--; + } + var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12); + return { + year: new Date().getFullYear() + year, + month: month + } + } +}); + +BI.shortcut("bi.calendar", BI.Calendar);/** + * Created by GUY on 2015/8/28. + * @class BI.YearCalendar + * @extends BI.Widget + */ +BI.YearCalendar = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + var conf = BI.YearCalendar.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: "bi-year-calendar", + behaviors: {}, + logic: { + dynamic: false + }, + min: '1900-01-01', //最小日期 + max: '2099-12-31', //最大日期 + year: null + }) + }, + + _yearCreator: function (Y) { + var o = this.options; + Y = Y | 0; + var start = BI.YearCalendar.getStartYear(Y); + var items = []; + BI.each(BI.range(BI.YearCalendar.INTERVAL), function (i) { + var td = {}; + if (Date.checkVoid(start + i, 1, 1, o.min, o.max)[0]) { + td.disabled = true; + } + td.text = start + i; + items.push(td); + }); + return items; + }, + + _init: function () { + BI.YearCalendar.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.currentYear = new Date().getFullYear(); + var years = this._yearCreator(o.year || this.currentYear); + + //纵向排列年 + var len = years.length, tyears = BI.makeArray(len, ""); + var map = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]; + BI.each(years, function (i, y) { + tyears[i] = years[map[i]]; + }); + var items = []; + items.push(tyears.slice(0, 2)); + items.push(tyears.slice(2, 4)); + items.push(tyears.slice(4, 6)); + items.push(tyears.slice(6, 8)); + items.push(tyears.slice(8, 10)); + items.push(tyears.slice(10, 12)); + + items = BI.map(items, function (i, item) { + return BI.map(item, function (j, td) { + return BI.extend(td, { + type: "bi.text_item", + cls: "bi-list-item-active", + textAlign: "center", + whiteSpace: "normal", + once: false, + forceSelected: true, + height: 23, + width: 38, + value: td.text, + disabled: td.disabled + }); + }); + }); + + this.years = BI.createWidget({ + type: "bi.button_group", + behaviors: o.behaviors, + items: BI.createItems(items, {}), + layouts: [BI.LogicFactory.createLogic("table", BI.extend({}, o.logic, { + columns: 2, + rows: 6, + columnSize: [1 / 2, 1 / 2], + rowSize: 25 + })), { + type: "bi.center_adapt", + vgap: 1 + }] + }); + this.years.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + BI.createWidget(BI.extend({ + element: this + + }, BI.LogicFactory.createLogic("vertical", BI.extend({}, o.logic, { + items: BI.LogicFactory.createLogicItemsByDirection("top", this.years) + })))); + }, + + isFrontYear: function () { + var o = this.options; + var Y = o.year; + Y = Y | 0; + return !!Date.checkVoid(BI.YearCalendar.getStartYear(Y) - 1, 1, 1, o.min, o.max)[0]; + }, + + isFinalYear: function () { + var o = this.options, c = this._const; + var Y = o.year; + Y = Y | 0; + return !!Date.checkVoid(BI.YearCalendar.getEndYear(Y) + 1, 1, 1, o.min, o.max)[0]; + }, + + setValue: function (val) { + this.years.setValue([val]); + }, + + getValue: function () { + return this.years.getValue()[0]; + } +}); +//类方法 +BI.extend(BI.YearCalendar, { + INTERVAL: 12, + + //获取显示的第一年 + getStartYear: function (year) { + var cur = new Date().getFullYear(); + return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL; + }, + + getEndYear: function (year) { + return BI.YearCalendar.getStartYear(year) + BI.YearCalendar.INTERVAL; + }, + + getPageByYear: function (year) { + var cur = new Date().getFullYear(); + year = BI.YearCalendar.getStartYear(year); + return (year - cur + 3) / BI.YearCalendar.INTERVAL; + } +}); + +BI.shortcut("bi.year_calendar", BI.YearCalendar);/** + * 绘制一些较复杂的canvas + * + * Created by GUY on 2015/11/24. + * @class BI.ComplexCanvas + * @extends BI.Widget + */ +BI.ComplexCanvas = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.ComplexCanvas.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-complex-canvas" + }) + }, + + + _init: function () { + BI.ComplexCanvas.superclass._init.apply(this, arguments); + var o = this.options; + this.canvas = BI.createWidget({ + type: "bi.canvas", + element: this, + width: o.width, + height: o.height + }); + }, + + //绘制树枝节点 + branch: function (x0, y0, x1, y1, x2, y2) { + var self = this, args = [].slice.call(arguments); + if (args.length <= 5) { + return this.canvas.line.apply(this.canvas, arguments); + } + var options; + if (BI.isOdd(args.length)) { + options = BI.last(args); + args = BI.initial(args); + } + args = [].slice.call(args, 2); + var odd = BI.filter(args, function (i) { + return i % 2 === 0; + }); + var even = BI.filter(args, function (i) { + return i % 2 !== 0; + }); + options || (options = {}); + var offset = options.offset || 20; + if ((y0 > y1 && y0 > y2) || (y0 < y1 && y0 < y2)) { + if (y0 > y1 && y0 > y2) { + var y = Math.max.apply(this, even) + offset; + } else { + var y = Math.min.apply(this, even) - offset; + } + var minx = Math.min.apply(this, odd); + var minix = BI.indexOf(odd, minx); + var maxx = Math.max.apply(this, odd); + var maxix = BI.indexOf(odd, maxx); + this.canvas.line(minx, even[minix], minx, y, maxx, y, maxx, even[maxix], options); + BI.each(odd, function (i, dot) { + if (i !== maxix && i !== minix) { + self.canvas.line(dot, even[i], dot, y, options); + } + }); + this.canvas.line(x0, y, x0, y0, options); + return; + } + if ((x0 > x1 && x0 > x2) || (x0 < x1 && x0 < x2)) { + if (x0 > x1 && x0 > x2) { + var x = Math.max.apply(this, odd) + offset; + } else { + var x = Math.min.apply(this, odd) - offset; + } + var miny = Math.min.apply(this, even); + var miniy = BI.indexOf(even, miny); + var maxy = Math.max.apply(this, even); + var maxiy = BI.indexOf(even, maxy); + this.canvas.line(odd[miniy], miny, x, miny, x, maxy, odd[maxiy], maxy, options); + BI.each(even, function (i, dot) { + if (i !== miniy && i !== maxiy) { + self.canvas.line(odd[i], dot, x, dot, options); + } + }); + this.canvas.line(x, y0, x0, y0, options); + return; + } + }, + + stroke: function (callback) { + this.canvas.stroke(callback); + } +}); + +BI.shortcut("bi.complex_canvas", BI.ComplexCanvas);/** + * Created by roy on 15/10/16. + * 上箭头与下箭头切换的树节点 + */ +BI.ArrowTreeGroupNodeCheckbox=BI.inherit(BI.IconButton,{ + _defaultConfig:function(){ + return BI.extend(BI.ArrowTreeGroupNodeCheckbox.superclass._defaultConfig.apply(this,arguments),{ + extraCls:"bi-arrow-tree-group-node", + iconWidth: 13, + iconHeight: 13 + }); + }, + _init:function(){ + BI.ArrowTreeGroupNodeCheckbox.superclass._init.apply(this,arguments); + }, + setSelected: function(v){ + BI.ArrowTreeGroupNodeCheckbox.superclass.setSelected.apply(this, arguments); + if(v) { + this.element.removeClass("column-next-page-h-font").addClass("column-pre-page-h-font"); + } else { + this.element.removeClass("column-pre-page-h-font").addClass("column-next-page-h-font"); + } + } +}); +BI.shortcut("bi.arrow_tree_group_node_checkbox",BI.ArrowTreeGroupNodeCheckbox);/** + * 十字型的树节点 + * @class BI.CheckingMarkNode + * @extends BI.IconButton + */ +BI.CheckingMarkNode = BI.inherit(BI.IconButton, { + _defaultConfig: function() { + return BI.extend( BI.CheckingMarkNode.superclass._defaultConfig.apply(this, arguments), { + extraCls: "check-mark-font", + iconWidth: 13, + iconHeight: 13 + }); + }, + _init:function() { + BI.CheckingMarkNode.superclass._init.apply(this, arguments); + this.setSelected(this.options.selected); + + }, + setSelected: function(v){ + BI.CheckingMarkNode.superclass.setSelected.apply(this, arguments); + if(v===true) { + this.element.addClass("check-mark-font"); + } else { + this.element.removeClass("check-mark-font"); + } + } +}); +BI.shortcut("bi.checking_mark_node", BI.CheckingMarkNode);/** + * 十字型的树节点 + * @class BI.FirstTreeNodeCheckbox + * @extends BI.IconButton + */ +BI.FirstTreeNodeCheckbox = BI.inherit(BI.IconButton, { + _defaultConfig: function() { + return BI.extend( BI.FirstTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), { + extraCls: "tree-collapse-icon-type2", + iconWidth: 25, + iconHeight: 25 + }); + }, + _init:function() { + BI.FirstTreeNodeCheckbox.superclass._init.apply(this, arguments); + + }, + setSelected: function(v){ + BI.FirstTreeNodeCheckbox.superclass.setSelected.apply(this, arguments); + if(v===true) { + this.element.addClass("tree-expand-icon-type2"); + } else { + this.element.removeClass("tree-expand-icon-type2"); + } + } +}); +BI.shortcut("bi.first_tree_node_checkbox", BI.FirstTreeNodeCheckbox);/** + * 十字型的树节点 + * @class BI.LastTreeNodeCheckbox + * @extends BI.IconButton + */ +BI.LastTreeNodeCheckbox = BI.inherit(BI.IconButton, { + _defaultConfig: function() { + return BI.extend( BI.LastTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), { + extraCls: "tree-collapse-icon-type4", + iconWidth: 25, + iconHeight: 25 + }); + }, + _init:function() { + BI.LastTreeNodeCheckbox.superclass._init.apply(this, arguments); + + }, + setSelected: function(v){ + BI.LastTreeNodeCheckbox.superclass.setSelected.apply(this, arguments); + if(v===true) { + this.element.addClass("tree-expand-icon-type3"); + } else { + this.element.removeClass("tree-expand-icon-type3"); + } + } +}); +BI.shortcut("bi.last_tree_node_checkbox", BI.LastTreeNodeCheckbox);/** + * 十字型的树节点 + * @class BI.MidTreeNodeCheckbox + * @extends BI.IconButton + */ +BI.MidTreeNodeCheckbox = BI.inherit(BI.IconButton, { + _defaultConfig: function() { + return BI.extend( BI.MidTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), { + extraCls: "tree-collapse-icon-type3", + iconWidth: 25, + iconHeight: 25 + }); + }, + _init:function() { + BI.MidTreeNodeCheckbox.superclass._init.apply(this, arguments); + + }, + setSelected: function(v){ + BI.MidTreeNodeCheckbox.superclass.setSelected.apply(this, arguments); + if(v===true) { + this.element.addClass("tree-expand-icon-type3"); + } else { + this.element.removeClass("tree-expand-icon-type3"); + } + } +}); +BI.shortcut("bi.mid_tree_node_checkbox", BI.MidTreeNodeCheckbox);/** + * 三角形的树节点 + * Created by GUY on 2015/9/6. + * @class BI.TreeGroupNodeCheckbox + * @extends BI.IconButton + */ +BI.TreeGroupNodeCheckbox = BI.inherit(BI.IconButton, { + _defaultConfig: function() { + return BI.extend( BI.TreeGroupNodeCheckbox.superclass._defaultConfig.apply(this, arguments), { + extraCls: "tree-node-triangle-collapse-font", + iconWidth: 13, + iconHeight: 13 + }); + }, + _init:function() { + BI.TreeGroupNodeCheckbox.superclass._init.apply(this, arguments); + + }, + setSelected: function(v){ + BI.TreeGroupNodeCheckbox.superclass.setSelected.apply(this, arguments); + if(v) { + this.element.removeClass("tree-node-triangle-collapse-font").addClass("tree-node-triangle-expand-font"); + } else { + this.element.removeClass("tree-node-triangle-expand-font").addClass("tree-node-triangle-collapse-font"); + } + } +}); +BI.shortcut("bi.tree_group_node_checkbox", BI.TreeGroupNodeCheckbox);/** + * 十字型的树节点 + * @class BI.TreeNodeCheckbox + * @extends BI.IconButton + */ +BI.TreeNodeCheckbox = BI.inherit(BI.IconButton, { + _defaultConfig: function() { + return BI.extend( BI.TreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), { + extraCls: "tree-collapse-icon-type1", + iconWidth: 25, + iconHeight: 25 + }); + }, + _init:function() { + BI.TreeNodeCheckbox.superclass._init.apply(this, arguments); + + }, + setSelected: function(v){ + BI.TreeNodeCheckbox.superclass.setSelected.apply(this, arguments); + if(v) { + this.element.addClass("tree-expand-icon-type1"); + } else { + this.element.removeClass("tree-expand-icon-type1"); + } + } +}); +BI.shortcut("bi.tree_node_checkbox", BI.TreeNodeCheckbox);/*! + * clipboard.js v1.6.1 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +try {//IE8下会抛错 + (function (f) { + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = f() + } else if (typeof define === "function" && define.amd) { + define([], f) + } else { + var g; + if (typeof window !== "undefined") { + g = window + } else if (typeof global !== "undefined") { + g = global + } else if (typeof self !== "undefined") { + g = self + } else { + g = this + } + g.Clipboard = f() + } + })(function () { + var define, module, exports; + return (function e(t, n, r) { + function s(o, u) { + if (!n[o]) { + if (!t[o]) { + var a = typeof require == "function" && require; + if (!u && a)return a(o, !0); + if (i)return i(o, !0); + var f = new Error("Cannot find module '" + o + "'"); + throw f.code = "MODULE_NOT_FOUND", f + } + var l = n[o] = {exports: {}}; + t[o][0].call(l.exports, function (e) { + var n = t[o][1][e]; + return s(n ? n : e) + }, l, l.exports, e, t, n, r) + } + return n[o].exports + } + + var i = typeof require == "function" && require; + for (var o = 0; o < r.length; o++)s(r[o]); + return s + })({ + 1: [function (require, module, exports) { + var DOCUMENT_NODE_TYPE = 9; + + /** + * A polyfill for Element.matches() + */ + if (typeof Element !== 'undefined' && !Element.prototype.matches) { + var proto = Element.prototype; + + proto.matches = proto.matchesSelector || + proto.mozMatchesSelector || + proto.msMatchesSelector || + proto.oMatchesSelector || + proto.webkitMatchesSelector; + } + + /** + * Finds the closest parent that matches a selector. + * + * @param {Element} element + * @param {String} selector + * @return {Function} + */ + function closest(element, selector) { + while (element && element.nodeType !== DOCUMENT_NODE_TYPE) { + if (element.matches(selector)) return element; + element = element.parentNode; + } + } + + module.exports = closest; + + }, {}], 2: [function (require, module, exports) { + var closest = require('./closest'); + + /** + * Delegates event to a selector. + * + * @param {Element} element + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @param {Boolean} useCapture + * @return {Object} + */ + function delegate(element, selector, type, callback, useCapture) { + var listenerFn = listener.apply(this, arguments); + + element.addEventListener(type, listenerFn, useCapture); + + return { + destroy: function () { + element.removeEventListener(type, listenerFn, useCapture); + } + } + } + + /** + * Finds closest match and invokes callback. + * + * @param {Element} element + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @return {Function} + */ + function listener(element, selector, type, callback) { + return function (e) { + e.delegateTarget = closest(e.target, selector); + + if (e.delegateTarget) { + callback.call(element, e); + } + } + } + + module.exports = delegate; + + }, {"./closest": 1}], 3: [function (require, module, exports) { + /** + * Check if argument is a HTML element. + * + * @param {Object} value + * @return {Boolean} + */ + exports.node = function (value) { + return value !== undefined + && value instanceof HTMLElement + && value.nodeType === 1; + }; + + /** + * Check if argument is a list of HTML elements. + * + * @param {Object} value + * @return {Boolean} + */ + exports.nodeList = function (value) { + var type = Object.prototype.toString.call(value); + + return value !== undefined + && (type === '[object NodeList]' || type === '[object HTMLCollection]') + && ('length' in value) + && (value.length === 0 || exports.node(value[0])); + }; + + /** + * Check if argument is a string. + * + * @param {Object} value + * @return {Boolean} + */ + exports.string = function (value) { + return typeof value === 'string' + || value instanceof String; + }; + + /** + * Check if argument is a function. + * + * @param {Object} value + * @return {Boolean} + */ + exports.fn = function (value) { + var type = Object.prototype.toString.call(value); + + return type === '[object Function]'; + }; + + }, {}], 4: [function (require, module, exports) { + var is = require('./is'); + var delegate = require('delegate'); + + /** + * Validates all params and calls the right + * listener function based on its target type. + * + * @param {String|HTMLElement|HTMLCollection|NodeList} target + * @param {String} type + * @param {Function} callback + * @return {Object} + */ + function listen(target, type, callback) { + if (!target && !type && !callback) { + throw new Error('Missing required arguments'); + } + + if (!is.string(type)) { + throw new TypeError('Second argument must be a String'); + } + + if (!is.fn(callback)) { + throw new TypeError('Third argument must be a Function'); + } + + if (is.node(target)) { + return listenNode(target, type, callback); + } + else if (is.nodeList(target)) { + return listenNodeList(target, type, callback); + } + else if (is.string(target)) { + return listenSelector(target, type, callback); + } + else { + throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList'); + } + } + + /** + * Adds an event listener to a HTML element + * and returns a remove listener function. + * + * @param {HTMLElement} node + * @param {String} type + * @param {Function} callback + * @return {Object} + */ + function listenNode(node, type, callback) { + node.addEventListener(type, callback); + + return { + destroy: function () { + node.removeEventListener(type, callback); + } + } + } + + /** + * Add an event listener to a list of HTML elements + * and returns a remove listener function. + * + * @param {NodeList|HTMLCollection} nodeList + * @param {String} type + * @param {Function} callback + * @return {Object} + */ + function listenNodeList(nodeList, type, callback) { + Array.prototype.forEach.call(nodeList, function (node) { + node.addEventListener(type, callback); + }); + + return { + destroy: function () { + Array.prototype.forEach.call(nodeList, function (node) { + node.removeEventListener(type, callback); + }); + } + } + } + + /** + * Add an event listener to a selector + * and returns a remove listener function. + * + * @param {String} selector + * @param {String} type + * @param {Function} callback + * @return {Object} + */ + function listenSelector(selector, type, callback) { + return delegate(document.body, selector, type, callback); + } + + module.exports = listen; + + }, {"./is": 3, "delegate": 2}], 5: [function (require, module, exports) { + function select(element) { + var selectedText; + + if (element.nodeName === 'SELECT') { + element.focus(); + + selectedText = element.value; + } + else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') { + var isReadOnly = element.hasAttribute('readonly'); + + if (!isReadOnly) { + element.setAttribute('readonly', ''); + } + + element.select(); + element.setSelectionRange(0, element.value.length); + + if (!isReadOnly) { + element.removeAttribute('readonly'); + } + + selectedText = element.value; + } + else { + if (element.hasAttribute('contenteditable')) { + element.focus(); + } + + var selection = window.getSelection(); + var range = document.createRange(); + + range.selectNodeContents(element); + selection.removeAllRanges(); + selection.addRange(range); + + selectedText = selection.toString(); + } + + return selectedText; + } + + module.exports = select; + + }, {}], 6: [function (require, module, exports) { + function E() { + // Keep this empty so it's easier to inherit from + // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3) + } + + E.prototype = { + on: function (name, callback, ctx) { + var e = this.e || (this.e = {}); + + (e[name] || (e[name] = [])).push({ + fn: callback, + ctx: ctx + }); + + return this; + }, + + once: function (name, callback, ctx) { + var self = this; + + function listener() { + self.off(name, listener); + callback.apply(ctx, arguments); + }; + + listener._ = callback + return this.on(name, listener, ctx); + }, + + emit: function (name) { + var data = [].slice.call(arguments, 1); + var evtArr = ((this.e || (this.e = {}))[name] || []).slice(); + var i = 0; + var len = evtArr.length; + + for (i; i < len; i++) { + evtArr[i].fn.apply(evtArr[i].ctx, data); + } + + return this; + }, + + off: function (name, callback) { + var e = this.e || (this.e = {}); + var evts = e[name]; + var liveEvents = []; + + if (evts && callback) { + for (var i = 0, len = evts.length; i < len; i++) { + if (evts[i].fn !== callback && evts[i].fn._ !== callback) + liveEvents.push(evts[i]); + } + } + + // Remove event from queue to prevent memory leak + // Suggested by https://github.com/lazd + // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910 + + (liveEvents.length) + ? e[name] = liveEvents + : delete e[name]; + + return this; + } + }; + + module.exports = E; + + }, {}], 7: [function (require, module, exports) { + (function (global, factory) { + if (typeof define === "function" && define.amd) { + define(['module', 'select'], factory); + } else if (typeof exports !== "undefined") { + factory(module, require('select')); + } else { + var mod = { + exports: {} + }; + factory(mod, global.select); + global.clipboardAction = mod.exports; + } + })(this, function (module, _select) { + 'use strict'; + + var _select2 = _interopRequireDefault(_select); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; + } + + var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { + return typeof obj; + } : function (obj) { + return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; + }; + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + var _createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + }(); + + var ClipboardAction = function () { + /** + * @param {Object} options + */ + function ClipboardAction(options) { + _classCallCheck(this, ClipboardAction); + + this.resolveOptions(options); + this.initSelection(); + } + + /** + * Defines base properties passed from constructor. + * @param {Object} options + */ + + + _createClass(ClipboardAction, [{ + key: 'resolveOptions', + value: function resolveOptions() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + this.action = options.action; + this.emitter = options.emitter; + this.target = options.target; + this.text = options.text; + this.trigger = options.trigger; + + this.selectedText = ''; + } + }, { + key: 'initSelection', + value: function initSelection() { + if (this.text) { + this.selectFake(); + } else if (this.target) { + this.selectTarget(); + } + } + }, { + key: 'selectFake', + value: function selectFake() { + var _this = this; + + var isRTL = document.documentElement.getAttribute('dir') == 'rtl'; + + this.removeFake(); + + this.fakeHandlerCallback = function () { + return _this.removeFake(); + }; + this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true; + + this.fakeElem = document.createElement('textarea'); + // Prevent zooming on iOS + this.fakeElem.style.fontSize = '12pt'; + // Reset box model + this.fakeElem.style.border = '0'; + this.fakeElem.style.padding = '0'; + this.fakeElem.style.margin = '0'; + // Move element out of screen horizontally + this.fakeElem.style.position = 'absolute'; + this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px'; + // Move element to the same position vertically + var yPosition = window.pageYOffset || document.documentElement.scrollTop; + this.fakeElem.style.top = yPosition + 'px'; + + this.fakeElem.setAttribute('readonly', ''); + this.fakeElem.value = this.text; + + document.body.appendChild(this.fakeElem); + + this.selectedText = (0, _select2["default"])(this.fakeElem); + this.copyText(); + } + }, { + key: 'removeFake', + value: function removeFake() { + if (this.fakeHandler) { + document.body.removeEventListener('click', this.fakeHandlerCallback); + this.fakeHandler = null; + this.fakeHandlerCallback = null; + } + + if (this.fakeElem) { + document.body.removeChild(this.fakeElem); + this.fakeElem = null; + } + } + }, { + key: 'selectTarget', + value: function selectTarget() { + this.selectedText = (0, _select2["default"])(this.target); + this.copyText(); + } + }, { + key: 'copyText', + value: function copyText() { + var succeeded = void 0; + + try { + succeeded = document.execCommand(this.action); + } catch (err) { + succeeded = false; + } + + this.handleResult(succeeded); + } + }, { + key: 'handleResult', + value: function handleResult(succeeded) { + this.emitter.emit(succeeded ? 'success' : 'error', { + action: this.action, + text: this.selectedText, + trigger: this.trigger, + clearSelection: this.clearSelection.bind(this) + }); + } + }, { + key: 'clearSelection', + value: function clearSelection() { + if (this.target) { + this.target.blur(); + } + + window.getSelection().removeAllRanges(); + } + }, { + key: 'destroy', + value: function destroy() { + this.removeFake(); + } + }, { + key: 'action', + set: function set() { + var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy'; + + this._action = action; + + if (this._action !== 'copy' && this._action !== 'cut') { + throw new Error('Invalid "action" value, use either "copy" or "cut"'); + } + }, + get: function get() { + return this._action; + } + }, { + key: 'target', + set: function set(target) { + if (target !== undefined) { + if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) { + if (this.action === 'copy' && target.hasAttribute('disabled')) { + throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute'); + } + + if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) { + throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes'); + } + + this._target = target; + } else { + throw new Error('Invalid "target" value, use a valid Element'); + } + } + }, + get: function get() { + return this._target; + } + }]); + + return ClipboardAction; + }(); + + module.exports = ClipboardAction; + }); + + }, {"select": 5}], 8: [function (require, module, exports) { + (function (global, factory) { + if (typeof define === "function" && define.amd) { + define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory); + } else if (typeof exports !== "undefined") { + factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener')); + } else { + var mod = { + exports: {} + }; + factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener); + global.clipboard = mod.exports; + } + })(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) { + 'use strict'; + + var _clipboardAction2 = _interopRequireDefault(_clipboardAction); + + var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter); + + var _goodListener2 = _interopRequireDefault(_goodListener); + + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { + "default": obj + }; + } + + function _classCallCheck(instance, Constructor) { + if (!(instance instanceof Constructor)) { + throw new TypeError("Cannot call a class as a function"); + } + } + + var _createClass = function () { + function defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + return function (Constructor, protoProps, staticProps) { + if (protoProps) defineProperties(Constructor.prototype, protoProps); + if (staticProps) defineProperties(Constructor, staticProps); + return Constructor; + }; + }(); + + function _possibleConstructorReturn(self, call) { + if (!self) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return call && (typeof call === "object" || typeof call === "function") ? call : self; + } + + function _inherits(subClass, superClass) { + if (typeof superClass !== "function" && superClass !== null) { + throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); + } + + subClass.prototype = Object.create(superClass && superClass.prototype, { + constructor: { + value: subClass, + enumerable: false, + writable: true, + configurable: true + } + }); + if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; + } + + var Clipboard = function (_Emitter) { + _inherits(Clipboard, _Emitter); + + /** + * @param {String|HTMLElement|HTMLCollection|NodeList} trigger + * @param {Object} options + */ + function Clipboard(trigger, options) { + _classCallCheck(this, Clipboard); + + var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this)); + + _this.resolveOptions(options); + _this.listenClick(trigger); + return _this; + } + + /** + * Defines if attributes would be resolved using internal setter functions + * or custom functions that were passed in the constructor. + * @param {Object} options + */ + + + _createClass(Clipboard, [{ + key: 'resolveOptions', + value: function resolveOptions() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + + this.action = typeof options.action === 'function' ? options.action : this.defaultAction; + this.target = typeof options.target === 'function' ? options.target : this.defaultTarget; + this.text = typeof options.text === 'function' ? options.text : this.defaultText; + } + }, { + key: 'listenClick', + value: function listenClick(trigger) { + var _this2 = this; + + this.listener = (0, _goodListener2["default"])(trigger, 'click', function (e) { + return _this2.onClick(e); + }); + } + }, { + key: 'onClick', + value: function onClick(e) { + var trigger = e.delegateTarget || e.currentTarget; + + if (this.clipboardAction) { + this.clipboardAction = null; + } + + this.clipboardAction = new _clipboardAction2["default"]({ + action: this.action(trigger), + target: this.target(trigger), + text: this.text(trigger), + trigger: trigger, + emitter: this + }); + } + }, { + key: 'defaultAction', + value: function defaultAction(trigger) { + return getAttributeValue('action', trigger); + } + }, { + key: 'defaultTarget', + value: function defaultTarget(trigger) { + var selector = getAttributeValue('target', trigger); + + if (selector) { + return document.querySelector(selector); + } + } + }, { + key: 'defaultText', + value: function defaultText(trigger) { + return getAttributeValue('text', trigger); + } + }, { + key: 'destroy', + value: function destroy() { + this.listener.destroy(); + + if (this.clipboardAction) { + this.clipboardAction.destroy(); + this.clipboardAction = null; + } + } + }], [{ + key: 'isSupported', + value: function isSupported() { + var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut']; + + var actions = typeof action === 'string' ? [action] : action; + var support = !!document.queryCommandSupported; + + actions.forEach(function (action) { + support = support && !!document.queryCommandSupported(action); + }); + + return support; + } + }]); + + return Clipboard; + }(_tinyEmitter2["default"]); + + /** + * Helper function to retrieve attribute value. + * @param {String} suffix + * @param {Element} element + */ + function getAttributeValue(suffix, element) { + var attribute = 'data-clipboard-' + suffix; + + if (!element.hasAttribute(attribute)) { + return; + } + + return element.getAttribute(attribute); + } + + module.exports = Clipboard; + }); + + }, {"./clipboard-action": 7, "good-listener": 4, "tiny-emitter": 6}] + }, {}, [8])(8) + }); +} catch (e) { + /* + * zClip :: jQuery ZeroClipboard v1.1.1 + * http://steamdev.com/zclip + * + * Copyright 2011, SteamDev + * Released under the MIT license. + * http://www.opensource.org/licenses/mit-license.php + * + * Date: Wed Jun 01, 2011 + */ + + + (function ($) { + + $.fn.zclip = function (params) { + + if (typeof params == "object" && !params.length) { + + var settings = $.extend({ + + path: 'ZeroClipboard.swf', + copy: null, + beforeCopy: null, + afterCopy: null, + clickAfter: true, + setHandCursor: true, + setCSSEffects: true + + }, params); + + + return this.each(function () { + + var o = $(this); + + if (o.is(':visible') && (typeof settings.copy == 'string' || $.isFunction(settings.copy))) { + + ZeroClipboard.setMoviePath(settings.path); + var clip = new ZeroClipboard.Client(); + + if ($.isFunction(settings.copy)) { + o.bind('zClip_copy', settings.copy); + } + if ($.isFunction(settings.beforeCopy)) { + o.bind('zClip_beforeCopy', settings.beforeCopy); + } + if ($.isFunction(settings.afterCopy)) { + o.bind('zClip_afterCopy', settings.afterCopy); + } + + clip.setHandCursor(settings.setHandCursor); + clip.setCSSEffects(settings.setCSSEffects); + clip.addEventListener('mouseOver', function (client) { + o.trigger('mouseenter'); + }); + clip.addEventListener('mouseOut', function (client) { + o.trigger('mouseleave'); + }); + clip.addEventListener('mouseDown', function (client) { + + o.trigger('mousedown'); + + if (!$.isFunction(settings.copy)) { + clip.setText(settings.copy); + } else { + clip.setText(o.triggerHandler('zClip_copy')); + } + + if ($.isFunction(settings.beforeCopy)) { + o.trigger('zClip_beforeCopy'); + } + + }); + + clip.addEventListener('complete', function (client, text) { + + if ($.isFunction(settings.afterCopy)) { + + o.trigger('zClip_afterCopy'); + + } else { + if (text.length > 500) { + text = text.substr(0, 500) + "...\n\n(" + (text.length - 500) + " characters not shown)"; + } + + o.removeClass('hover'); + alert("Copied text to clipboard:\n\n " + text); + } + + if (settings.clickAfter) { + o.trigger('click'); + } + + }); + + + clip.glue(o[0], o.parent()[0]); + + $(window).bind('load resize', function () { + clip.reposition(); + }); + + + } + + }); + + } else if (typeof params == "string") { + + return this.each(function () { + + var o = $(this); + + params = params.toLowerCase(); + var zclipId = o.data('zclipId'); + var clipElm = $('#' + zclipId + '.zclip'); + + if (params == "remove") { + + clipElm.remove(); + o.removeClass('active hover'); + + } else if (params == "hide") { + + clipElm.hide(); + o.removeClass('active hover'); + + } else if (params == "show") { + + clipElm.show(); + + } + + }); + + } + + } + + + })(jQuery); + + +// ZeroClipboard +// Simple Set Clipboard System +// Author: Joseph Huckaby + var ZeroClipboard = { + + version: "1.0.7", + clients: {}, + // registered upload clients on page, indexed by id + moviePath: 'ZeroClipboard.swf', + // URL to movie + nextId: 1, + // ID of next movie + $: function (thingy) { + // simple DOM lookup utility function + if (typeof(thingy) == 'string') thingy = document.getElementById(thingy); + if (!thingy.addClass) { + // extend element with a few useful methods + thingy.hide = function () { + this.style.display = 'none'; + }; + thingy.show = function () { + this.style.display = ''; + }; + thingy.addClass = function (name) { + this.removeClass(name); + this.className += ' ' + name; + }; + thingy.removeClass = function (name) { + var classes = this.className.split(/\s+/); + var idx = -1; + for (var k = 0; k < classes.length; k++) { + if (classes[k] == name) { + idx = k; + k = classes.length; + } + } + if (idx > -1) { + classes.splice(idx, 1); + this.className = classes.join(' '); + } + return this; + }; + thingy.hasClass = function (name) { + return !!this.className.match(new RegExp("\\s*" + name + "\\s*")); + }; + } + return thingy; + }, + + setMoviePath: function (path) { + // set path to ZeroClipboard.swf + this.moviePath = path; + }, + + dispatch: function (id, eventName, args) { + // receive event from flash movie, send to client + var client = this.clients[id]; + if (client) { + client.receiveEvent(eventName, args); + } + }, + + register: function (id, client) { + // register new client to receive events + this.clients[id] = client; + }, + + getDOMObjectPosition: function (obj, stopObj) { + // get absolute coordinates for dom element + var info = { + left: 0, + top: 0, + width: obj.width ? obj.width : obj.offsetWidth, + height: obj.height ? obj.height : obj.offsetHeight + }; + + if (obj && (obj != stopObj)) { + info.left += obj.offsetLeft; + info.top += obj.offsetTop; + } + + return info; + }, + + Client: function (elem) { + // constructor for new simple upload client + this.handlers = {}; + + // unique ID + this.id = ZeroClipboard.nextId++; + this.movieId = 'ZeroClipboardMovie_' + this.id; + + // register client with singleton to receive flash events + ZeroClipboard.register(this.id, this); + + // create movie + if (elem) this.glue(elem); + } + }; + + ZeroClipboard.Client.prototype = { + + id: 0, + // unique ID for us + ready: false, + // whether movie is ready to receive events or not + movie: null, + // reference to movie object + clipText: '', + // text to copy to clipboard + handCursorEnabled: true, + // whether to show hand cursor, or default pointer cursor + cssEffects: true, + // enable CSS mouse effects on dom container + handlers: null, + // user event handlers + glue: function (elem, appendElem, stylesToAdd) { + // glue to DOM element + // elem can be ID or actual DOM element object + this.domElement = ZeroClipboard.$(elem); + + // float just above object, or zIndex 99 if dom element isn't set + var zIndex = 99; + if (this.domElement.style.zIndex) { + zIndex = parseInt(this.domElement.style.zIndex, 10) + 1; + } + + if (typeof(appendElem) == 'string') { + appendElem = ZeroClipboard.$(appendElem); + } else if (typeof(appendElem) == 'undefined') { + appendElem = document.getElementsByTagName('body')[0]; + } + + // find X/Y position of domElement + var box = ZeroClipboard.getDOMObjectPosition(this.domElement, appendElem); + + // create floating DIV above element + this.div = document.createElement('div'); + this.div.className = "zclip"; + this.div.id = "zclip-" + this.movieId; + $(this.domElement).data('zclipId', 'zclip-' + this.movieId); + var style = this.div.style; + style.position = 'absolute'; + style.left = '' + box.left + 'px'; + style.top = '' + box.top + 'px'; + style.width = '' + box.width + 'px'; + style.height = '' + box.height + 'px'; + style.zIndex = zIndex; + + if (typeof(stylesToAdd) == 'object') { + for (addedStyle in stylesToAdd) { + style[addedStyle] = stylesToAdd[addedStyle]; + } + } + + // style.backgroundColor = '#f00'; // debug + appendElem.appendChild(this.div); + + this.div.innerHTML = this.getHTML(box.width, box.height); + }, + + getHTML: function (width, height) { + // return HTML for movie + var html = ''; + var flashvars = 'id=' + this.id + '&width=' + width + '&height=' + height; + + if (navigator.userAgent.match(/MSIE/)) { + // IE gets an OBJECT tag + var protocol = location.href.match(/^https/i) ? 'https://' : 'http://'; + html += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="' + protocol + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + width + '" height="' + height + '" id="' + this.movieId + '" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="' + ZeroClipboard.moviePath + '" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="' + flashvars + '"/><param name="wmode" value="transparent"/></object>'; + } else { + // all other browsers get an EMBED tag + html += '<embed id="' + this.movieId + '" src="' + ZeroClipboard.moviePath + '" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="' + width + '" height="' + height + '" name="' + this.movieId + '" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="' + flashvars + '" wmode="transparent" />'; + } + return html; + }, + + hide: function () { + // temporarily hide floater offscreen + if (this.div) { + this.div.style.left = '-2000px'; + } + }, + + show: function () { + // show ourselves after a call to hide() + this.reposition(); + }, + + destroy: function () { + // destroy control and floater + if (this.domElement && this.div) { + this.hide(); + this.div.innerHTML = ''; + + var body = document.getElementsByTagName('body')[0]; + try { + body.removeChild(this.div); + } catch (e) { + ; + } + + this.domElement = null; + this.div = null; + } + }, + + reposition: function (elem) { + // reposition our floating div, optionally to new container + // warning: container CANNOT change size, only position + if (elem) { + this.domElement = ZeroClipboard.$(elem); + if (!this.domElement) this.hide(); + } + + if (this.domElement && this.div) { + var box = ZeroClipboard.getDOMObjectPosition(this.domElement); + var style = this.div.style; + style.left = '' + box.left + 'px'; + style.top = '' + box.top + 'px'; + } + }, + + setText: function (newText) { + // set text to be copied to clipboard + this.clipText = newText; + if (this.ready) { + this.movie.setText(newText); + } + }, + + addEventListener: function (eventName, func) { + // add user event listener for event + // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel + eventName = eventName.toString().toLowerCase().replace(/^on/, ''); + if (!this.handlers[eventName]) { + this.handlers[eventName] = []; + } + this.handlers[eventName].push(func); + }, + + setHandCursor: function (enabled) { + // enable hand cursor (true), or default arrow cursor (false) + this.handCursorEnabled = enabled; + if (this.ready) { + this.movie.setHandCursor(enabled); + } + }, + + setCSSEffects: function (enabled) { + // enable or disable CSS effects on DOM container + this.cssEffects = !!enabled; + }, + + receiveEvent: function (eventName, args) { + // receive event from flash + eventName = eventName.toString().toLowerCase().replace(/^on/, ''); + + // special behavior for certain events + switch (eventName) { + case 'load': + // movie claims it is ready, but in IE this isn't always the case... + // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function + this.movie = document.getElementById(this.movieId); + if (!this.movie) { + var self = this; + setTimeout(function () { + self.receiveEvent('load', null); + }, 1); + return; + } + + // firefox on pc needs a "kick" in order to set these in certain cases + if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) { + var self = this; + setTimeout(function () { + self.receiveEvent('load', null); + }, 100); + this.ready = true; + return; + } + + this.ready = true; + try { + this.movie.setText(this.clipText); + } catch (e) { + } + try { + this.movie.setHandCursor(this.handCursorEnabled); + } catch (e) { + } + break; + + case 'mouseover': + if (this.domElement && this.cssEffects) { + this.domElement.addClass('hover'); + if (this.recoverActive) { + this.domElement.addClass('active'); + } + + + } + + + break; + + case 'mouseout': + if (this.domElement && this.cssEffects) { + this.recoverActive = false; + if (this.domElement.hasClass('active')) { + this.domElement.removeClass('active'); + this.recoverActive = true; + } + this.domElement.removeClass('hover'); + + } + break; + + case 'mousedown': + if (this.domElement && this.cssEffects) { + this.domElement.addClass('active'); + } + break; + + case 'mouseup': + if (this.domElement && this.cssEffects) { + this.domElement.removeClass('active'); + this.recoverActive = false; + } + break; + } // switch eventName + if (this.handlers[eventName]) { + for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) { + var func = this.handlers[eventName][idx]; + + if (typeof(func) == 'function') { + // actual function reference + func(this, args); + } else if ((typeof(func) == 'object') && (func.length == 2)) { + // PHP style object + method, i.e. [myObject, 'myMethod'] + func[0][func[1]](this, args); + } else if (typeof(func) == 'string') { + // name of function + window[func](this, args); + } + } // foreach event handler defined + } // user defined handler for event + } + + }; +}/** + * 复制 + * Created by GUY on 2016/2/16. + * @class BI.ClipBoard + * @extends BI.BasicButton + */ +BI.ClipBoard = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.ClipBoard.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-clipboard", + copy: BI.emptyFn, + afterCopy: BI.emptyFn + }) + }, + + _init: function () { + BI.ClipBoard.superclass._init.apply(this, arguments); + }, + + mounted: function () { + var self = this, o = this.options; + if (window.Clipboard) { + this.clipboard = new Clipboard(this.element[0], { + text: function () { + return BI.isFunction(o.copy) ? o.copy() : o.copy; + } + }); + this.clipboard.on("success", o.afterCopy) + } else { + this.element.zclip({ + path: BI.resourceURL + "/ZeroClipboard.swf", + copy: o.copy, + beforeCopy: o.beforeCopy, + afterCopy: o.afterCopy + }); + } + }, + + destroyed: function () { + this.clipboard && this.clipboard.destroy(); + } +}); + +BI.shortcut("bi.clipboard", BI.ClipBoard);/** + * 自定义选色 + * + * Created by GUY on 2015/11/17. + * @class BI.CustomColorChooser + * @extends BI.Widget + */ +BI.CustomColorChooser = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.CustomColorChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-custom-color-chooser", + width: 227, + height: 245 + }) + }, + + _init: function () { + BI.CustomColorChooser.superclass._init.apply(this, arguments); + var self = this; + this.editor = BI.createWidget({ + type: "bi.color_picker_editor", + width: 195 + }); + this.editor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () { + self.setValue(this.getValue()); + }); + this.farbtastic = BI.createWidget({ + type: "bi.farbtastic" + }); + this.farbtastic.on(BI.Farbtastic.EVENT_CHANGE, function () { + self.setValue(this.getValue()); + }); + + BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + type: "bi.absolute", + items: [{ + el: this.editor, + left: 15, + top: 10, + right: 15 + }], + height: 30 + }, { + type: "bi.absolute", + items: [{ + el: this.farbtastic, + left: 15, + right: 15, + top: 10 + }], + height: 215 + }] + }) + }, + + setValue: function (color) { + this.editor.setValue(color); + this.farbtastic.setValue(color); + }, + + getValue: function () { + return this.editor.getValue(); + } +}); +BI.CustomColorChooser.EVENT_CHANGE = "CustomColorChooser.EVENT_CHANGE"; +BI.shortcut("bi.custom_color_chooser", BI.CustomColorChooser);/** + * 选色控件 + * + * Created by GUY on 2015/11/17. + * @class BI.ColorChooser + * @extends BI.Widget + */ +BI.ColorChooser = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.ColorChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-color-chooser", + el: {} + }) + }, + + _init: function () { + BI.ColorChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget(BI.extend({ + type: "bi.color_chooser_trigger", + width: o.width, + height: o.height + }, o.el)); + this.colorPicker = BI.createWidget({ + type: "bi.color_chooser_popup" + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 1, + el: this.trigger, + popup: { + el: this.colorPicker, + stopPropagation: false, + minWidth: 202 + } + }); + + var fn = function () { + var color = self.colorPicker.getValue(); + self.trigger.setValue(color); + var colors = BI.string2Array(BI.Cache.getItem("colors") || ""); + var que = new BI.Queue(8); + que.fromArray(colors); + que.remove(color); + que.unshift(color); + BI.Cache.setItem("colors", BI.array2String(que.toArray())); + }; + + this.colorPicker.on(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, function () { + fn(); + }); + + this.colorPicker.on(BI.ColorChooserPopup.EVENT_CHANGE, function () { + fn(); + self.combo.hideView(); + }); + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self.colorPicker.setStoreColors(BI.string2Array(BI.Cache.getItem("colors") || "")); + }); + + this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () { + self.fireEvent(BI.ColorChooser.EVENT_CHANGE, arguments); + }) + }, + + isViewVisible: function () { + return this.combo.isViewVisible(); + }, + + setValue: function (color) { + this.combo.setValue(color); + }, + + getValue: function () { + return this.colorPicker.getValue(); + } +}); +BI.ColorChooser.EVENT_CHANGE = "ColorChooser.EVENT_CHANGE"; +BI.shortcut("bi.color_chooser", BI.ColorChooser);/** + * 选色控件 + * + * Created by GUY on 2015/11/17. + * @class BI.ColorChooserPopup + * @extends BI.Widget + */ +BI.ColorChooserPopup = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.ColorChooserPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-color-chooser-popup", + height: 145 + }) + }, + + _init: function () { + BI.ColorChooserPopup.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.colorEditor = BI.createWidget({ + type: "bi.color_picker_editor" + }); + + this.colorEditor.on(BI.ColorPickerEditor.EVENT_CHANGE, function () { + self.setValue(this.getValue()); + self.fireEvent(BI.ColorChooserPopup.EVENT_VALUE_CHANGE, arguments); + }); + + this.storeColors = BI.createWidget({ + type: "bi.color_picker", + items: [[{ + value: "", + disabled: true + }, { + value: "", + disabled: true + }, { + value: "", + disabled: true + }, { + value: "", + disabled: true + }, { + value: "", + disabled: true + }, { + value: "", + disabled: true + }, { + value: "", + disabled: true + }, { + value: "", + disabled: true + }]], + width: 190, + height: 25 + }); + this.storeColors.on(BI.ColorPicker.EVENT_CHANGE, function () { + self.setValue(this.getValue()[0]); + self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments); + }); + + this.colorPicker = BI.createWidget({ + type: "bi.color_picker", + width: 190, + height: 50 + }); + + this.colorPicker.on(BI.ColorPicker.EVENT_CHANGE, function () { + self.setValue(this.getValue()[0]); + self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments); + }); + + this.customColorChooser = BI.createWidget({ + type: "bi.custom_color_chooser" + }); + + var panel = BI.createWidget({ + type: "bi.popup_panel", + buttons: [BI.i18nText("BI-Basic_Cancel"), BI.i18nText("BI-Basic_Save")], + title: BI.i18nText("BI-Custom_Color"), + el: this.customColorChooser, + stopPropagation: false, + bgap: -1, + rgap: 1, + lgap: 1, + minWidth: 227 + }); + + this.more = BI.createWidget({ + type: "bi.combo", + direction: "right,top", + isNeedAdjustHeight: false, + el: { + type: "bi.text_item", + cls: "color-chooser-popup-more bi-list-item", + textAlign: "center", + height: 20, + text: BI.i18nText("BI-Basic_More") + "..." + }, + popup: panel + }); + + this.more.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () { + self.customColorChooser.setValue(self.getValue()); + }); + panel.on(BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON, function (index) { + switch (index) { + case 0: + self.more.hideView(); + break; + case 1: + self.setValue(self.customColorChooser.getValue()); + self.more.hideView(); + self.fireEvent(BI.ColorChooserPopup.EVENT_CHANGE, arguments); + break; + } + }); + + BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: { + type: "bi.absolute", + cls: "bi-background bi-border-bottom", + items: [{ + el: this.colorEditor, + left: 0, + right: 0, + top: 5 + }] + }, + height: 30 + }, { + el: { + type: "bi.absolute", + items: [{ + el: this.storeColors, + left: 5, + right: 5, + top: 5 + }] + }, + height: 30 + }, { + el: { + type: "bi.absolute", + items: [{ + el: this.colorPicker, + left: 5, + right: 5, + top: 5 + }] + }, + height: 65 + }, { + el: this.more, + height: 20 + }] + }) + }, + + setStoreColors: function (colors) { + if (BI.isArray(colors)) { + var items = BI.map(colors, function (i, color) { + return { + value: color + } + }); + BI.count(colors.length, 8, function (i) { + items.push({ + value: "", + disabled: true + }) + }); + this.storeColors.populate([items]); + } + }, + + setValue: function (color) { + this.colorEditor.setValue(color); + this.colorPicker.setValue(color); + this.storeColors.setValue(color); + }, + + getValue: function () { + return this.colorEditor.getValue(); + } +}); +BI.ColorChooserPopup.EVENT_VALUE_CHANGE = "ColorChooserPopup.EVENT_VALUE_CHANGE"; +BI.ColorChooserPopup.EVENT_CHANGE = "ColorChooserPopup.EVENT_CHANGE"; +BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup);/** + * 选色控件 + * + * Created by GUY on 2015/11/17. + * @class BI.ColorChooserTrigger + * @extends BI.Trigger + */ +BI.ColorChooserTrigger = BI.inherit(BI.Trigger, { + + _defaultConfig: function () { + var conf = BI.ColorChooserTrigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-color-chooser-trigger", + height: 30 + }) + }, + + _init: function () { + BI.ColorChooserTrigger.superclass._init.apply(this, arguments); + this.colorContainer = BI.createWidget({ + type: "bi.layout", + cls: "bi-card color-chooser-trigger-content" + }); + + var down = BI.createWidget({ + type: "bi.icon_button", + disableSelected: true, + cls: "icon-combo-down-icon trigger-triangle-font", + width: 12, + height: 8 + }); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.colorContainer, + left: 3, + right: 3, + top: 3, + bottom: 3 + }, { + el: down, + right: 3, + bottom: 3 + }] + }); + if (this.options.value) { + this.setValue(this.options.value); + } + }, + + setValue: function (color) { + BI.ColorChooserTrigger.superclass.setValue.apply(this, arguments); + if (color === "") { + this.colorContainer.element.css("background-color", "").removeClass("trans-color-background").addClass("auto-color-background"); + } else if (color === "transparent") { + this.colorContainer.element.css("background-color", "").removeClass("auto-color-background").addClass("trans-color-background") + } else { + this.colorContainer.element.css({"background-color": color}).removeClass("auto-color-background").removeClass("trans-color-background"); + } + } +}); +BI.ColorChooserTrigger.EVENT_CHANGE = "ColorChooserTrigger.EVENT_CHANGE"; +BI.shortcut("bi.color_chooser_trigger", BI.ColorChooserTrigger);/** + * 简单选色控件按钮 + * + * Created by GUY on 2015/11/16. + * @class BI.ColorPickerButton + * @extends BI.BasicButton + */ +BI.ColorPickerButton = BI.inherit(BI.BasicButton, { + + _defaultConfig: function () { + var conf = BI.ColorPickerButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-color-picker-button bi-background bi-border-top bi-border-left" + }) + }, + + _init: function () { + BI.ColorPickerButton.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (o.value) { + this.element.css("background-color", o.value); + var name = this.getName(); + this.element.hover(function () { + self._createMask(); + if (self.isEnabled()) { + BI.Maskers.show(name); + } + }, function () { + if (!self.isSelected()) { + BI.Maskers.hide(name); + } + }); + } + }, + + _createMask: function () { + var o = this.options, name = this.getName(); + if (this.isEnabled() && !BI.Maskers.has(name)) { + var w = BI.Maskers.make(name, this, { + offset: { + left: -1, + top: -1, + right: -1, + bottom: -1 + } + }); + w.element.addClass("color-picker-button-mask").css("background-color", o.value); + } + }, + + setSelected: function (b) { + BI.ColorPickerButton.superclass.setSelected.apply(this, arguments); + if (!!b) { + this._createMask(); + } + BI.Maskers[!!b ? "show" : "hide"](this.getName()); + } +}); +BI.ColorPickerButton.EVENT_CHANGE = "ColorPickerButton.EVENT_CHANGE"; +BI.shortcut("bi.color_picker_button", BI.ColorPickerButton);/** + * 简单选色控件 + * + * Created by GUY on 2015/11/16. + * @class BI.ColorPicker + * @extends BI.Widget + */ +BI.ColorPicker = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.ColorPicker.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-color-picker", + items: null + }) + }, + + _items: [ + [{ + value: "#ffffff" + }, { + value: "#f2f2f2" + }, { + value: "#e5e5e5" + }, { + value: "#d9d9d9" + }, { + value: "#cccccc" + }, { + value: "#bfbfbf" + }, { + value: "#b2b2b2" + }, { + value: "#a6a6a6" + }, { + value: "#999999" + }, { + value: "#8c8c8c" + }, { + value: "#808080" + }, { + value: "#737373" + }, { + value: "#666666" + }, { + value: "#4d4d4d" + }, { + value: "#333333" + }, { + value: "#000000" + }], + [{ + value: "#d8b5a6" + }, { + value: "#ff9e9a" + }, { + value: "#ffc17d" + }, { + value: "#f5e56b" + }, { + value: "#d8e698" + }, { + value: "#e0ebaf" + }, { + value: "#c3d825" + }, { + value: "#bce2e8" + }, { + value: "#85d3cd" + }, { + value: "#bce2e8" + }, { + value: "#a0d8ef" + }, { + value: "#89c3eb" + }, { + value: "#bbc8e6" + }, { + value: "#bbbcde" + }, { + value: "#d6b4cc" + }, { + value: "#fbc0d3" + }], + [{ + value: "#bb9581" + }, { + value: "#f37d79" + }, { + value: "#fba74f" + }, { + value: "#ffdb4f" + }, { + value: "#c7dc68" + }, { + value: "#b0ca71" + }, { + value: "#99ab4e" + }, { + value: "#84b9cb" + }, { + value: "#00a3af" + }, { + value: "#2ca9e1" + }, { + value: "#0095d9" + }, { + value: "#4c6cb3" + }, { + value: "#8491c3" + }, { + value: "#a59aca" + }, { + value: "#cc7eb1" + }, { + value: "#e89bb4" + }], + [{ + value: "#9d775f" + }, { + value: "#dd4b4b" + }, { + value: "#ef8b07" + }, { + value: "#fcc800" + }, { + value: "#aacf53" + }, { + value: "#82ae46" + }, { + value: "#69821b" + }, { + value: "#59b9c6" + }, { + value: "#2a83a2" + }, { + value: "#007bbb" + }, { + value: "#19448e" + }, { + value: "#274a78" + }, { + value: "#4a488e" + }, { + value: "#7058a3" + }, { + value: "#884898" + }, { + value: "#d47596" + }] + ], + + _init: function () { + BI.ColorPicker.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.colors = BI.createWidget({ + type: "bi.button_group", + element: this, + items: BI.createItems(o.items || this._items, { + type: "bi.color_picker_button", + once: false + }), + layouts: [{ + type: "bi.grid" + }] + }); + this.colors.on(BI.ButtonGroup.EVENT_CHANGE, function () { + self.fireEvent(BI.ColorPicker.EVENT_CHANGE, arguments); + }) + }, + + populate: function(items){ + var args =[].slice.call(arguments); + args[0] = BI.createItems(items, { + type: "bi.color_picker_button", + once: false + }); + this.colors.populate.apply(this.colors, args); + }, + + setValue: function (color) { + this.colors.setValue(color); + }, + + getValue: function () { + return this.colors.getValue(); + } +}); +BI.ColorPicker.EVENT_CHANGE = "ColorPicker.EVENT_CHANGE"; +BI.shortcut("bi.color_picker", BI.ColorPicker);/** + * 简单选色控件 + * + * Created by GUY on 2015/11/16. + * @class BI.ColorPickerEditor + * @extends BI.Widget + */ +BI.ColorPickerEditor = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.ColorPickerEditor.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-color-picker-editor", + width: 200, + height: 20 + }) + }, + + _init: function () { + BI.ColorPickerEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.colorShow = BI.createWidget({ + type: "bi.layout", + cls: "color-picker-editor-display bi-card", + height: 20 + }); + var RGB = BI.createWidgets(BI.createItems([{text: "R"}, {text: "G"}, {text: "B"}], { + type: "bi.label", + cls: "color-picker-editor-label", + width: 10, + height: 20 + })); + + var checker = function (v) { + return BI.isNumeric(v) && (v | 0) >= 0 && (v | 0) <= 255; + }; + var Ws = BI.createWidgets([{}, {}, {}], { + type: "bi.small_text_editor", + cls: "color-picker-editor-input", + validationChecker: checker, + errorText: BI.i18nText("BI-Color_Picker_Error_Text"), + allowBlank: true, + value: 255, + width: 32, + height: 20 + }); + BI.each(Ws, function (i, w) { + w.on(BI.TextEditor.EVENT_CHANGE, function () { + if (self.R.isValid() && self.G.isValid() && self.B.isValid()) { + self.colorShow.element.css("background-color", self.getValue()); + self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); + } + }); + }); + this.R = Ws[0]; + this.G = Ws[1]; + this.B = Ws[2]; + + this.none = BI.createWidget({ + type: "bi.checkbox", + title: BI.i18nText("BI-Basic_Auto") + }); + this.none.on(BI.Checkbox.EVENT_CHANGE, function () { + if (this.isSelected()) { + self.lastColor = self.getValue(); + self.setValue(""); + } else { + self.setValue(self.lastColor || "#000000"); + } + if (self.R.isValid() && self.G.isValid() && self.B.isValid()) { + self.colorShow.element.css("background-color", self.getValue()); + self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); + } + }); + + this.transparent = BI.createWidget({ + type: "bi.checkbox", + title: BI.i18nText("BI-Transparent_Color") + }); + this.transparent.on(BI.Checkbox.EVENT_CHANGE, function () { + if (this.isSelected()) { + self.lastColor = self.getValue(); + self.setValue("transparent"); + } else { + self.setValue(self.lastColor || "#000000"); + } + if (self.R.isValid() && self.G.isValid() && self.B.isValid()) { + self.colorShow.element.css("background-color", self.getValue()); + self.fireEvent(BI.ColorPickerEditor.EVENT_CHANGE); + } + }); + + BI.createWidget({ + type: "bi.htape", + element: this, + items: [{ + el: this.colorShow, + width: 'fill' + }, { + el: RGB[0], + lgap: 10, + width: 16 + }, { + el: this.R, + width: 32 + }, { + el: RGB[1], + lgap: 10, + width: 16 + }, { + el: this.G, + width: 32 + }, { + el: RGB[2], + lgap: 10, + width: 16 + }, { + el: this.B, + width: 32 + }, { + el: { + type: "bi.center_adapt", + items: [this.none] + }, + width: 18 + }, { + el: { + type: "bi.center_adapt", + items: [this.transparent] + }, + width: 18 + }] + }) + }, + + setValue: function (color) { + if (color === "transparent") { + this.transparent.setSelected(true); + this.none.setSelected(false); + this.R.setValue(""); + this.G.setValue(""); + this.B.setValue(""); + return; + } + if (!color) { + color = ""; + this.none.setSelected(true); + } else { + this.none.setSelected(false); + } + this.transparent.setSelected(false); + this.colorShow.element.css("background-color", color); + var json = BI.DOM.rgb2json(BI.DOM.hex2rgb(color)); + this.R.setValue(BI.isNull(json.r) ? "" : json.r); + this.G.setValue(BI.isNull(json.g) ? "" : json.g); + this.B.setValue(BI.isNull(json.b) ? "" : json.b); + }, + + getValue: function () { + if (this.transparent.isSelected()) { + return "transparent"; + } + return BI.DOM.rgb2hex(BI.DOM.json2rgb({ + r: this.R.getValue(), + g: this.G.getValue(), + b: this.B.getValue() + })) + } +}); +BI.ColorPickerEditor.EVENT_CHANGE = "ColorPickerEditor.EVENT_CHANGE"; +BI.shortcut("bi.color_picker_editor", BI.ColorPickerEditor);/** + * 选色控件 + * + * Created by GUY on 2015/11/16. + * @class BI.Farbtastic + * @extends BI.Widget + */ +BI.Farbtastic = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.Farbtastic.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-farbtastic", + width: 195, + height: 195 + }) + }, + + _init: function () { + BI.Farbtastic.superclass._init.apply(this, arguments); + }, + + mounted: function () { + var self = this; + this.farbtastic = $.farbtastic(this.element, function (v) { + self.fireEvent(BI.Farbtastic.EVENT_CHANGE, self.getValue(), self); + }); + }, + + setValue: function (color) { + this.farbtastic.setColor(color); + }, + + getValue: function () { + return this.farbtastic.color; + } +}); +BI.Farbtastic.EVENT_CHANGE = "Farbtastic.EVENT_CHANGE"; +BI.shortcut("bi.farbtastic", BI.Farbtastic);/** + * Farbtastic Color Picker 1.2 + * © 2008 Steven Wittens + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +jQuery.fn.farbtastic = function (callback) { + $.farbtastic(this, callback); + return this; +}; + +jQuery.farbtastic = function (container, callback) { + var container = $(container).get(0); + return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback)); +} + +jQuery._farbtastic = function (container, callback) { + // Store farbtastic object + var fb = this; + + // Insert markup + $(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>'); + var e = $('.farbtastic', container); + fb.wheel = $('.wheel', container).get(0); + // Dimensions + fb.radius = 84; + fb.square = 100; + fb.width = 194; + + // Fix background PNGs in IE6 + if (navigator.appVersion.match(/MSIE [0-6]\./)) { + $('*', e).each(function () { + if (this.currentStyle.backgroundImage != 'none') { + var image = this.currentStyle.backgroundImage; + image = this.currentStyle.backgroundImage.substring(5, image.length - 2); + $(this).css({ + 'backgroundImage': 'none', + 'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')" + }); + } + }); + } + + /** + * Link to the given element(s) or callback. + */ + fb.linkTo = function (callback) { + // Unbind previous nodes + if (typeof fb.callback == 'object') { + $(fb.callback).unbind('keyup', fb.updateValue); + } + + // Reset color + fb.color = null; + + // Bind callback or elements + if (typeof callback == 'function') { + fb.callback = callback; + } + else if (typeof callback == 'object' || typeof callback == 'string') { + fb.callback = $(callback); + fb.callback.bind('keyup', fb.updateValue); + if (fb.callback.get(0).value) { + fb.setColor(fb.callback.get(0).value); + } + } + return this; + } + fb.updateValue = function (event) { + if (this.value && this.value != fb.color) { + fb.setColor(this.value); + } + } + + /** + * Change color with HTML syntax #123456 + */ + fb.setColor = function (color) { + var unpack = fb.unpack(color); + if (fb.color != color && unpack) { + fb.color = color; + fb.rgb = unpack; + fb.hsl = fb.RGBToHSL(fb.rgb); + fb.updateDisplay(); + } + return this; + } + + /** + * Change color with HSL triplet [0..1, 0..1, 0..1] + */ + fb.setHSL = function (hsl) { + fb.hsl = hsl; + fb.rgb = fb.HSLToRGB(hsl); + fb.color = fb.pack(fb.rgb); + fb.updateDisplay(); + return this; + } + + ///////////////////////////////////////////////////// + + /** + * Retrieve the coordinates of the given event relative to the center + * of the widget. + */ + fb.widgetCoords = function (event) { + var x, y; + var el = event.target || event.srcElement; + var reference = fb.wheel; + + if (typeof event.offsetX != 'undefined') { + // Use offset coordinates and find common offsetParent + var pos = { x: event.offsetX, y: event.offsetY }; + + // Send the coordinates upwards through the offsetParent chain. + var e = el; + while (e) { + e.mouseX = pos.x; + e.mouseY = pos.y; + pos.x += e.offsetLeft; + pos.y += e.offsetTop; + e = e.offsetParent; + } + + // Look for the coordinates starting from the wheel widget. + var e = reference; + var offset = { x: 0, y: 0 } + while (e) { + if (typeof e.mouseX != 'undefined') { + x = e.mouseX - offset.x; + y = e.mouseY - offset.y; + break; + } + offset.x += e.offsetLeft; + offset.y += e.offsetTop; + e = e.offsetParent; + } + + // Reset stored coordinates + e = el; + while (e) { + e.mouseX = undefined; + e.mouseY = undefined; + e = e.offsetParent; + } + } + else { + // Use absolute coordinates + var pos = fb.absolutePosition(reference); + x = (event.pageX || 0*(event.clientX + $('html').get(0).scrollLeft)) - pos.x; + y = (event.pageY || 0*(event.clientY + $('html').get(0).scrollTop)) - pos.y; + } + // Subtract distance to middle + return { x: x - fb.width / 2, y: y - fb.width / 2 }; + } + + /** + * Mousedown handler + */ + fb.mousedown = function (event) { + // Capture mouse + if (!document.dragging) { + $(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup); + document.dragging = true; + } + + // Check which area is being dragged + var pos = fb.widgetCoords(event); + fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square; + + // Process + fb.mousemove(event); + return false; + } + + /** + * Mousemove handler + */ + fb.mousemove = function (event) { + // Get coordinates relative to color picker center + var pos = fb.widgetCoords(event); + + // Set new HSL parameters + if (fb.circleDrag) { + var hue = Math.atan2(pos.x, -pos.y) / 6.28; + if (hue < 0) hue += 1; + fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]); + } + else { + var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5)); + var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5)); + fb.setHSL([fb.hsl[0], sat, lum]); + } + return false; + } + + /** + * Mouseup handler + */ + fb.mouseup = function () { + // Uncapture mouse + $(document).unbind('mousemove', fb.mousemove); + $(document).unbind('mouseup', fb.mouseup); + document.dragging = false; + } + + /** + * Update the markers and styles + */ + fb.updateDisplay = function () { + // Markers + var angle = fb.hsl[0] * 6.28; + $('.h-marker', e).css({ + left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px', + top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px' + }); + + $('.sl-marker', e).css({ + left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px', + top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px' + }); + + // Saturation/Luminance gradient + $('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5]))); + + // Linked elements or callback + if (typeof fb.callback == 'object') { + // Set background/foreground color + $(fb.callback).css({ + backgroundColor: fb.color, + color: fb.hsl[2] > 0.5 ? '#000' : '#fff' + }); + + // Change linked value + $(fb.callback).each(function() { + if (this.value && this.value != fb.color) { + this.value = fb.color; + } + }); + } + else if (typeof fb.callback == 'function') { + fb.callback.call(fb, fb.color); + } + } + + /** + * Get absolute position of element + */ + fb.absolutePosition = function (el) { + var r = { x: el.offsetLeft, y: el.offsetTop }; + // Resolve relative to offsetParent + if (el.offsetParent) { + var tmp = fb.absolutePosition(el.offsetParent); + r.x += tmp.x; + r.y += tmp.y; + } + return r; + }; + + /* Various color utility functions */ + fb.pack = function (rgb) { + var r = Math.round(rgb[0] * 255); + var g = Math.round(rgb[1] * 255); + var b = Math.round(rgb[2] * 255); + return '#' + (r < 16 ? '0' : '') + r.toString(16) + + (g < 16 ? '0' : '') + g.toString(16) + + (b < 16 ? '0' : '') + b.toString(16); + } + + fb.unpack = function (color) { + if (color.length == 7) { + return [parseInt('0x' + color.substring(1, 3)) / 255, + parseInt('0x' + color.substring(3, 5)) / 255, + parseInt('0x' + color.substring(5, 7)) / 255]; + } + else if (color.length == 4) { + return [parseInt('0x' + color.substring(1, 2)) / 15, + parseInt('0x' + color.substring(2, 3)) / 15, + parseInt('0x' + color.substring(3, 4)) / 15]; + } + } + + fb.HSLToRGB = function (hsl) { + var m1, m2, r, g, b; + var h = hsl[0], s = hsl[1], l = hsl[2]; + m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s; + m1 = l * 2 - m2; + return [this.hueToRGB(m1, m2, h+0.33333), + this.hueToRGB(m1, m2, h), + this.hueToRGB(m1, m2, h-0.33333)]; + } + + fb.hueToRGB = function (m1, m2, h) { + h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h); + if (h * 6 < 1) return m1 + (m2 - m1) * h * 6; + if (h * 2 < 1) return m2; + if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6; + return m1; + } + + fb.RGBToHSL = function (rgb) { + var min, max, delta, h, s, l; + var r = rgb[0], g = rgb[1], b = rgb[2]; + min = Math.min(r, Math.min(g, b)); + max = Math.max(r, Math.max(g, b)); + delta = max - min; + l = (min + max) / 2; + s = 0; + if (l > 0 && l < 1) { + s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l)); + } + h = 0; + if (delta > 0) { + if (max == r && max != g) h += (g - b) / delta; + if (max == g && max != b) h += (2 + (b - r) / delta); + if (max == b && max != r) h += (4 + (r - g) / delta); + h /= 6; + } + return [h, s, l]; + } + + // Install mousedown handler (the others are set on the document on-demand) + $('*', e).mousedown(fb.mousedown); + + // Init color + fb.setColor('#000000'); + + // Set linked elements/callback + if (callback) { + fb.linkTo(callback); + } +}/** + * Created by GUY on 2017/2/8. + * + * @class BI.BubbleCombo + * @extends BI.Widget + */ +BI.BubbleCombo = BI.inherit(BI.Widget, { + _const: { + TRIANGLE_LENGTH: 6 + }, + _defaultConfig: function () { + return BI.extend(BI.BubbleCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-bubble-combo", + trigger: "click", + toggle: true, + direction: "bottom", //top||bottom||left||right||top,left||top,right||bottom,left||bottom,right + isDefaultInit: false, + destroyWhenHide: false, + isNeedAdjustHeight: true,//是否需要高度调整 + isNeedAdjustWidth: true, + stopPropagation: false, + adjustLength: 0,//调整的距离 + // adjustXOffset: 0, + // adjustYOffset: 10, + hideChecker: BI.emptyFn, + offsetStyle: "left", //left,right,center + el: {}, + popup: {}, + }) + }, + _init: function () { + BI.BubbleCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + trigger: o.trigger, + toggle: o.toggle, + direction: o.direction, + isDefaultInit: o.isDefaultInit, + destroyWhenHide: o.destroyWhenHide, + isNeedAdjustHeight: o.isNeedAdjustHeight, + isNeedAdjustWidth: o.isNeedAdjustWidth, + adjustLength: this._getAdjustLength(), + stopPropagation: o.stopPropagation, + adjustXOffset: 0, + adjustYOffset: 0, + hideChecker: o.hideChecker, + offsetStyle: o.offsetStyle, + el: o.el, + popup: BI.extend({ + type: "bi.bubble_popup_view" + }, o.popup), + }); + this.combo.on(BI.Combo.EVENT_TRIGGER_CHANGE, function () { + self.fireEvent(BI.BubbleCombo.EVENT_TRIGGER_CHANGE, arguments); + }); + this.combo.on(BI.Combo.EVENT_CHANGE, function () { + self.fireEvent(BI.BubbleCombo.EVENT_CHANGE, arguments); + }); + this.combo.on(BI.Combo.EVENT_EXPAND, function () { + self.fireEvent(BI.BubbleCombo.EVENT_EXPAND, arguments); + }); + this.combo.on(BI.Combo.EVENT_COLLAPSE, function () { + self.fireEvent(BI.BubbleCombo.EVENT_COLLAPSE, arguments); + }); + this.combo.on(BI.Combo.EVENT_AFTER_INIT, function () { + self.fireEvent(BI.BubbleCombo.EVENT_AFTER_INIT, arguments); + }); + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW, arguments); + }); + this.combo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () { + self._showTriangle(); + self.fireEvent(BI.BubbleCombo.EVENT_AFTER_POPUPVIEW, arguments); + }); + this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { + self._hideTriangle(); + self.fireEvent(BI.BubbleCombo.EVENT_BEFORE_HIDEVIEW, arguments); + }); + this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () { + self.fireEvent(BI.BubbleCombo.EVENT_AFTER_HIDEVIEW, arguments); + }); + }, + + _getAdjustLength: function () { + return this._const.TRIANGLE_LENGTH + this.options.adjustLength; + }, + + _createTriangle: function (direction) { + var pos = {}, op = {}; + var adjustLength = this.options.adjustLength; + var offset = this.element.offset(); + var left = offset.left, right = offset.left + this.element.outerWidth(); + var top = offset.top, bottom = offset.top + this.element.outerHeight(); + switch (direction) { + case "left": + pos = { + top: top, + height: this.element.outerHeight(), + left: left - adjustLength - this._const.TRIANGLE_LENGTH + }; + op = {width: this._const.TRIANGLE_LENGTH}; + break; + case "right": + pos = { + top: top, + height: this.element.outerHeight(), + left: right + adjustLength + }; + op = {width: this._const.TRIANGLE_LENGTH}; + break; + case "top": + pos = { + left: left, + width: this.element.outerWidth(), + top: top - adjustLength - this._const.TRIANGLE_LENGTH + }; + op = {height: this._const.TRIANGLE_LENGTH}; + break; + case "bottom": + pos = { + left: left, + width: this.element.outerWidth(), + top: bottom + adjustLength + }; + op = {height: this._const.TRIANGLE_LENGTH}; + break; + default: + break; + } + this.triangle && this.triangle.destroy(); + this.triangle = BI.createWidget(op, { + type: "bi.center_adapt", + cls: "button-combo-triangle-wrapper", + items: [{ + type: "bi.layout", + cls: "bubble-combo-triangle-" + direction + " bi-high-light-border" + }] + }); + pos.el = this.triangle; + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [pos] + }) + }, + + _createLeftTriangle: function () { + this._createTriangle("left"); + }, + + _createRightTriangle: function () { + this._createTriangle("right"); + }, + + _createTopTriangle: function () { + this._createTriangle("top"); + }, + + _createBottomTriangle: function () { + this._createTriangle("bottom"); + }, + + _showTriangle: function () { + var pos = this.combo.getPopupPosition(); + switch (pos.dir) { + case "left,top": + case "left,bottom": + this._createLeftTriangle(); + this.combo.getView().showLine("right"); + break; + case "right,top": + case "right,bottom": + this._createRightTriangle(); + this.combo.getView().showLine("left"); + break; + case "top,left": + case "top,right": + this._createTopTriangle(); + this.combo.getView().showLine("bottom"); + break; + case "bottom,left": + case "bottom,right": + this._createBottomTriangle(); + this.combo.getView().showLine("top"); + break; + } + }, + + _hideTriangle: function () { + this.triangle && this.triangle.destroy(); + this.triangle = null; + this.combo.getView() && this.combo.getView().hideLine(); + }, + + hideView: function () { + this._hideTriangle(); + this.combo && this.combo.hideView(); + }, + + showView: function () { + this.combo && this.combo.showView(); + }, + + isViewVisible: function () { + return this.combo.isViewVisible(); + } +}); + +BI.BubbleCombo.EVENT_TRIGGER_CHANGE = "EVENT_TRIGGER_CHANGE"; +BI.BubbleCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.BubbleCombo.EVENT_EXPAND = "EVENT_EXPAND"; +BI.BubbleCombo.EVENT_COLLAPSE = "EVENT_COLLAPSE"; +BI.BubbleCombo.EVENT_AFTER_INIT = "EVENT_AFTER_INIT"; + + +BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.BubbleCombo.EVENT_AFTER_POPUPVIEW = "EVENT_AFTER_POPUPVIEW"; +BI.BubbleCombo.EVENT_BEFORE_HIDEVIEW = "EVENT_BEFORE_HIDEVIEW"; +BI.BubbleCombo.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; +BI.shortcut("bi.bubble_combo", BI.BubbleCombo);/** + * Created by GUY on 2017/2/8. + * + * @class BI.BubblePopupView + * @extends BI.PopupView + */ +BI.BubblePopupView = BI.inherit(BI.PopupView, { + _defaultConfig: function () { + var config = BI.BubblePopupView.superclass._defaultConfig.apply(this, arguments); + return BI.extend(config, { + baseCls: config.baseCls + " bi-bubble-popup-view" + }) + }, + _init: function () { + BI.BubblePopupView.superclass._init.apply(this, arguments); + }, + + showLine: function (direction) { + var pos = {}, op = {}; + switch (direction) { + case "left": + pos = { + top: 0, + bottom: 0, + left: -1 + }; + op = {width: 3}; + break; + case "right": + pos = { + top: 0, + bottom: 0, + right: -1 + }; + op = {width: 3}; + break; + case "top": + pos = { + left: 0, + right: 0, + top: -1 + }; + op = {height: 3}; + break; + case "bottom": + pos = { + left: 0, + right: 0, + bottom: -1 + }; + op = {height: 3}; + break; + default: + break; + } + this.line = BI.createWidget(op, { + type: "bi.layout", + cls: "bubble-popup-line bi-high-light-background" + }); + pos.el = this.line; + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [pos] + }) + }, + + hideLine: function () { + this.line && this.line.destroy(); + } +}); + +BI.shortcut("bi.bubble_popup_view", BI.BubblePopupView); + +/** + * Created by GUY on 2017/2/8. + * + * @class BI.BubblePopupBarView + * @extends BI.BubblePopupView + */ +BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, { + _defaultConfig: function () { + return BI.extend(BI.BubblePopupBarView.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-bubble-bar-popup-view", + buttons: [{value: BI.i18nText(BI.i18nText("BI-Basic_Sure"))}, {value: BI.i18nText("BI-Basic_Cancel"), level: "ignore"}] + }) + }, + _init: function () { + BI.BubblePopupBarView.superclass._init.apply(this, arguments); + }, + _createToolBar: function () { + var o = this.options, self = this; + + var items = []; + BI.each(o.buttons.reverse(), function (i, buttonOpt) { + if(BI.isWidget(buttonOpt)){ + items.push(buttonOpt); + }else{ + items.push(BI.extend({ + type: 'bi.button', + height: 30, + handler: function (v) { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, v); + } + }, buttonOpt)) + } + }); + return BI.createWidget({ + type: 'bi.right_vertical_adapt', + height: 40, + hgap: 10, + bgap: 10, + items: items + }); + } +}); +BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; +BI.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView);/** + * Created by Young's on 2016/4/28. + */ +BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.EditorIconCheckCombo.superclass._defaultConfig.apply(this, arguments), { + baseClass: "bi-check-editor-combo", + width: 100, + height: 30, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + allowBlank: true, + watermark: "", + errorText: "" + }) + }, + + _init: function () { + BI.EditorIconCheckCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.editor_trigger", + items: o.items, + height: o.height, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker, + allowBlank: o.allowBlank, + watermark: o.watermark, + errorText: o.errorText + }); + this.trigger.on(BI.EditorTrigger.EVENT_CHANGE, function () { + self.popup.setValue(this.getValue()); + self.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE); + }); + this.popup = BI.createWidget({ + type: "bi.text_value_check_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.editorIconCheckCombo.hideView(); + self.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.editorIconCheckCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup, + maxHeight: 300 + } + }); + }, + + setValue: function (v) { + this.editorIconCheckCombo.setValue(v); + }, + + getValue: function () { + return this.trigger.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.editorIconCheckCombo.populate(items); + } +}); +BI.EditorIconCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.editor_icon_check_combo", BI.EditorIconCheckCombo);/** + * Created by GUY on 2016/4/25. + * + * @class BI.FormulaCombo + * @extend BI.Widget + */ +BI.FormulaCombo = BI.inherit(BI.Widget, { + + _constant: { + POPUP_HEIGHT: 450, + POPUP_WIDTH: 600, + POPUP_V_GAP: 10, + POPUP_H_GAP: 10, + ADJUST_LENGTH: 2, + HEIGHT_MAX: 10000, + MAX_HEIGHT: 500, + MAX_WIDTH: 600, + COMBO_TRIGGER_WIDTH: 300 + }, + + _defaultConfig: function () { + return BI.extend(BI.FormulaCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-formula-combo", + height: 30, + items: [] + }) + }, + + _init: function () { + BI.FormulaCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.formula_ids = []; + this.input = BI.createWidget({ + type: "bi.formula_combo_trigger", + height: o.height, + items: o.items + }); + this.formulaPopup = BI.createWidget({ + type: "bi.formula_combo_popup", + fieldItems: o.items + }); + + this.formulaInputCombo = BI.createWidget({ + type: "bi.combo", + element: this, + isNeedAdjustHeight: true, + isNeedAdjustWidth: false, + adjustLength: this._constant.ADJUST_LENGTH, + el: this.input, + popup: { + el: { + type: "bi.absolute", + height: this._constant.HEIGHT_MAX, + width: this._constant.POPUP_WIDTH, + items: [{ + el: this.formulaPopup, + top: this._constant.POPUP_V_GAP, + left: this._constant.POPUP_H_GAP, + right: this._constant.POPUP_V_GAP, + bottom: 0 + }] + }, + stopPropagation: false, + maxHeight: this._constant.MAX_HEIGHT, + width: this._constant.MAX_WIDTH + } + }); + this.formulaInputCombo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () { + self.formulaPopup.setValue(self.input.getValue()); + }); + this.formulaPopup.on(BI.FormulaComboPopup.EVENT_CHANGE, function () { + self.setValue(self.formulaPopup.getValue()); + self.formulaInputCombo.hideView(); + self.fireEvent(BI.FormulaCombo.EVENT_CHANGE); + }); + this.formulaPopup.on(BI.FormulaComboPopup.EVENT_VALUE_CANCEL, function () { + self.formulaInputCombo.hideView(); + }); + }, + + setValue: function (v) { + if (this.formulaInputCombo.isViewVisible()) { + this.formulaInputCombo.hideView(); + } + this.input.setValue(v); + this.input.setText(BI.Func.getFormulaStringFromFormulaValue(v)); + this.formulaPopup.setValue(this.input.getValue()); + }, + + getFormulaTargetIds: function() { + return this.formulaPopup.getFormulaTargetIds(); + }, + + getValue: function () { + return this.input.getValue(); + } +}); +BI.FormulaCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.formula_combo", BI.FormulaCombo);/** + * Created by GUY on 2016/4/25. + * + * @class BI.FormulaComboPopup + * @extend BI.Widget + */ +BI.FormulaComboPopup = BI.inherit(BI.Widget, { + + _constant: { + BUTTON_HEIGHT: 30, + SOUTH_HEIGHT: 60, + SOUTH_H_GAP: 10 + }, + + _defaultConfig: function () { + return BI.extend(BI.FormulaComboPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-formula-pane-popup" + }) + }, + + _init: function () { + BI.FormulaComboPopup.superclass._init.apply(this, arguments); + this.populate(); + }, + + populate: function () { + var self = this, fieldItems = this.options.fieldItems; + this.formula = BI.createWidget({ + type: "bi.formula_insert" + }); + this.formula.populate(fieldItems); + var confirmButton = BI.createWidget({ + type: "bi.button", + level: "common", + height: this._constant.BUTTON_HEIGHT, + text: BI.i18nText("BI-Basic_OK") + }); + var cancelButton = BI.createWidget({ + type: "bi.button", + level: "ignore", + height: this._constant.BUTTON_HEIGHT, + text: BI.i18nText("BI-Basic_Cancel") + }); + + this.formula.on(BI.FormulaInsert.EVENT_CHANGE, function () { + confirmButton.setEnable(self.formula.checkValidation()); + }); + confirmButton.on(BI.Button.EVENT_CHANGE, function () { + self.fireEvent(BI.FormulaComboPopup.EVENT_CHANGE); + }); + cancelButton.on(BI.Button.EVENT_CHANGE, function () { + self.setValue(self.oldValue); + self.fireEvent(BI.FormulaComboPopup.EVENT_VALUE_CANCEL); + }); + + BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: this.formula, + height: "fill" + }, { + el: { + type: "bi.right_vertical_adapt", + height: this._constant.SOUTH_HEIGHT, + items: [cancelButton, confirmButton], + hgap: this._constant.SOUTH_H_GAP + }, + height: this._constant.SOUTH_HEIGHT + }] + }) + }, + + getFormulaTargetIds: function(){ + return this.formula.getUsedFields(); + }, + + getValue: function () { + return this.formula.getValue(); + }, + + setValue: function (v) { + this.oldValue = v; + this.formula.setValue(v); + } +}); +BI.FormulaComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.FormulaComboPopup.EVENT_VALUE_CANCEL = "EVENT_VALUE_CANCEL"; +BI.shortcut("bi.formula_combo_popup", BI.FormulaComboPopup);/** + * Created by GUY on 2016/4/25. + * + * @class BI.FormulaComboTrigger + * @extend BI.Widget + */ +BI.FormulaComboTrigger = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.FormulaComboTrigger.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-formula-combo-trigger", + height: 30, + items: [] + }) + }, + + _init: function () { + BI.FormulaComboTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.label = BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "left", + textHeight: this.options.height, + lgap: 10 + }); + }, + + _getTextFromFormulaValue: function (formulaValue) { + var self = this; + var formulaString = ""; + var regx = /\$[\{][^\}]*[\}]|\w*\w|\$\{[^\$\(\)\+\-\*\/)\$,]*\w\}|\$\{[^\$\(\)\+\-\*\/]*\w\}|\$\{[^\$\(\)\+\-\*\/]*[\u4e00-\u9fa5]\}|\w|(.)/g; + var result = formulaValue.match(regx); + BI.each(result, function (i, item) { + var fieldRegx = /\$[\{][^\}]*[\}]/; + var str = item.match(fieldRegx); + if (BI.isNotEmptyArray(str)) { + var id = str[0].substring(2, item.length - 1); + var item = BI.find(BI.flatten(self.options.items), function (i, item) { + return id === item.value; + }); + formulaString = formulaString + item.text; + } else { + formulaString = formulaString + item; + } + }); + return formulaString; + }, + + getValue: function () { + return this.options.value; + }, + + setValue: function (v) { + this.options.value = v; + this.label.setText(this._getTextFromFormulaValue(v)); + } +}); +BI.shortcut("bi.formula_combo_trigger", BI.FormulaComboTrigger);/** + * Created by GUY on 2016/2/2. + * + * @class BI.IconCombo + * @extend BI.Widget + */ +BI.IconCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.IconCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-icon-combo", + width: 24, + height: 24, + iconClass: "", + el: {}, + popup: {}, + minWidth: 100, + maxWidth: 'auto', + maxHeight: 300, + direction: "bottom", + adjustLength: 3,//调整的距离 + adjustXOffset: 0, + adjustYOffset: 0, + offsetStyle: "left", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }) + }, + + _init: function () { + BI.IconCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget(o.el, { + type: "bi.icon_combo_trigger", + iconClass: o.iconClass, + title: o.title, + items: o.items, + width: o.width, + height: o.height, + iconWidth: o.iconWidth, + iconHeight: o.iconHeight + }); + this.popup = BI.createWidget(o.popup, { + type: "bi.icon_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.iconCombo.hideView(); + self.fireEvent(BI.IconCombo.EVENT_CHANGE); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.iconCombo = BI.createWidget({ + type: "bi.combo", + element: this, + direction: o.direction, + adjustLength: o.adjustLength, + adjustXOffset: o.adjustXOffset, + adjustYOffset: o.adjustYOffset, + offsetStyle: o.offsetStyle, + el: this.trigger, + popup: { + el: this.popup, + maxWidth: o.maxWidth, + maxHeight: o.maxHeight, + minWidth: o.minWidth + } + }); + }, + + showView: function () { + this.iconCombo.showView(); + }, + + hideView: function () { + this.iconCombo.hideView(); + }, + + setValue: function (v) { + this.iconCombo.setValue(v); + }, + + getValue: function () { + return this.iconCombo.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.iconCombo.populate(items); + } +}); +BI.IconCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.icon_combo", BI.IconCombo);/** + * Created by GUY on 2016/2/2. + * + * @class BI.IconComboPopup + * @extend BI.Pane + */ +BI.IconComboPopup = BI.inherit(BI.Pane, { + _defaultConfig: function () { + return BI.extend(BI.IconComboPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi.icon-combo-popup", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }); + }, + + _init: function () { + BI.IconComboPopup.superclass._init.apply(this, arguments); + var o = this.options, self = this; + this.popup = BI.createWidget({ + type: "bi.button_group", + items: BI.createItems(o.items, { + type: "bi.single_select_icon_text_item", + height: 30 + }), + chooseType: o.chooseType, + layouts: [{ + type: "bi.vertical" + }] + }); + + this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.IconComboPopup.EVENT_CHANGE, val, obj); + } + }); + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.popup] + }); + }, + + populate: function (items) { + BI.IconComboPopup.superclass.populate.apply(this, arguments); + items = BI.createItems(items, { + type: "bi.single_select_icon_text_item", + height: 30 + }); + this.popup.populate(items); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + setValue: function (v) { + this.popup.setValue(v); + } + +}); +BI.IconComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.icon_combo_popup", BI.IconComboPopup);/** + * Created by GUY on 2016/2/2. + * + * @class BI.IconComboTrigger + * @extend BI.Widget + */ +BI.IconComboTrigger = BI.inherit(BI.Trigger, { + _defaultConfig: function () { + return BI.extend(BI.IconComboTrigger.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-icon-combo-trigger", + el: {}, + items: [], + iconClass: "", + width: 25, + height: 25, + isShowDown: true + }); + }, + + _init: function () { + BI.IconComboTrigger.superclass._init.apply(this, arguments); + var o = this.options, self = this; + this.button = BI.createWidget(o.el, { + type: "bi.icon_change_button", + cls: "icon-combo-trigger-icon " + o.iconClass, + disableSelected: true, + width: o.width, + height: o.height, + iconWidth: o.iconWidth, + iconHeight: o.iconHeight + }); + this.down = BI.createWidget({ + type: "bi.icon_button", + disableSelected: true, + cls: "icon-combo-down-icon trigger-triangle-font", + width: 12, + height: 8 + }); + this.down.setVisible(o.isShowDown); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.button, + left: 0, + right: 0, + top: 0, + bottom: 0 + }, { + el: this.down, + right: 0, + bottom: 0 + }] + }); + if (BI.isKey(o.value)) { + this.setValue(o.value); + } + }, + + populate: function (items) { + var o = this.options; + this.options.items = items || []; + this.button.setIcon(o.iconClass); + this.button.setSelected(false); + this.down.setSelected(false); + }, + + setValue: function (v) { + BI.IconComboTrigger.superclass.setValue.apply(this, arguments); + var o = this.options; + var iconClass = ""; + v = BI.isArray(v) ? v[0] : v; + if (BI.any(this.options.items, function (i, item) { + if (v === item.value) { + iconClass = item.iconClass; + return true; + } + })) { + this.button.setIcon(iconClass); + this.button.setSelected(true); + this.down.setSelected(true); + } else { + this.button.setIcon(o.iconClass); + this.button.setSelected(false); + this.down.setSelected(false); + } + } +}); +BI.IconComboTrigger.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.icon_combo_trigger", BI.IconComboTrigger);/** + * 单选combo + * + * @class BI.StaticCombo + * @extend BI.Widget + */ +BI.StaticCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.StaticCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-static-combo", + height: 30, + text: "", + el: {}, + items: [], + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }) + }, + + _init: function () { + BI.StaticCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget(o.el, { + type: "bi.text_icon_item", + cls: "bi-select-text-trigger bi-border pull-down-font", + text: o.text, + readonly: true, + textLgap: 5, + height: o.height - 2 + }); + this.popup = BI.createWidget({ + type: "bi.text_value_combo_popup", + textAlign: o.textAlign, + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { + self.combo.hideView(); + self.fireEvent(BI.StaticCombo.EVENT_CHANGE, arguments); + }); + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup + } + }); + }, + + populate: function (items) { + this.combo.populate(items); + }, + + setValue: function (v) { + this.combo.setValue(v); + }, + + getValue: function () { + return this.combo.getValue(); + } +}); +BI.StaticCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.static_combo", BI.StaticCombo);/** + * @class BI.TextValueCheckCombo + * @extend BI.Widget + * combo : text + icon, popup : check + text + */ +BI.TextValueCheckCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.TextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { + baseClass: "bi-text-value-check-combo", + width: 100, + height: 30, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + text: "" + }) + }, + + _init: function () { + BI.TextValueCheckCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.select_text_trigger", + items: o.items, + height: o.height, + text: o.text + }); + this.popup = BI.createWidget({ + type: "bi.text_value_check_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.textIconCheckCombo.hideView(); + self.fireEvent(BI.TextValueCheckCombo.EVENT_CHANGE); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.textIconCheckCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup, + maxHeight: 300 + } + }); + }, + + setTitle: function (title) { + this.trigger.setTitle(title); + }, + + setValue: function (v) { + this.textIconCheckCombo.setValue(v); + }, + + setWarningTitle: function (title) { + this.trigger.setWarningTitle(title); + }, + + getValue: function () { + return this.textIconCheckCombo.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.textIconCheckCombo.populate(items); + } +}); +BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** + * @class BI.SmallTextValueCheckCombo + * @extend BI.Widget + * combo : text + icon, popup : check + text + */ +BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { + width: 100, + height: 24, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + text: "" + }) + }, + + _init: function () { + BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.small_select_text_trigger", + items: o.items, + height: o.height, + text: o.text + }); + this.popup = BI.createWidget({ + type: "bi.text_value_check_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.SmallTextIconCheckCombo.hideView(); + self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.SmallTextIconCheckCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup, + maxHeight: 300 + } + }); + }, + + setValue: function (v) { + this.SmallTextIconCheckCombo.setValue(v); + }, + + getValue: function () { + return this.SmallTextIconCheckCombo.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.SmallTextIconCheckCombo.populate(items); + } +}); +BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { + _defaultConfig: function () { + return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-text-icon-popup", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }); + }, + + _init: function () { + BI.TextValueCheckComboPopup.superclass._init.apply(this, arguments); + var o = this.options, self = this; + this.popup = BI.createWidget({ + type: "bi.button_group", + items: this._formatItems(o.items), + chooseType: o.chooseType, + layouts: [{ + type: "bi.vertical" + }] + }); + + this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.TextValueCheckComboPopup.EVENT_CHANGE, val, obj); + } + }); + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.popup] + }); + }, + + _formatItems: function (items) { + return BI.map(items, function (i, item) { + return BI.extend({ + type: "bi.icon_text_item", + cls: "item-check-font bi-list-item", + height: 30 + }, item); + }); + }, + + populate: function (items) { + BI.TextValueCheckComboPopup.superclass.populate.apply(this, arguments); + this.popup.populate(this._formatItems(items)); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + setValue: function (v) { + this.popup.setValue(v); + } + +}); +BI.TextValueCheckComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.text_value_check_combo_popup", BI.TextValueCheckComboPopup);/** + * @class BI.TextValueCombo + * @extend BI.Widget + * combo : text + icon, popup : text + * 参见场景dashboard布局方式选择 + */ +BI.TextValueCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.TextValueCombo.superclass._defaultConfig.apply(this, arguments), { + baseClass: "bi-text-value-combo", + height: 30, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + text: "", + el: {} + }) + }, + + _init: function () { + BI.TextValueCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget(o.el, { + type: "bi.select_text_trigger", + items: o.items, + height: o.height, + text: o.text + }); + this.popup = BI.createWidget({ + type: "bi.text_value_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.textIconCombo.hideView(); + self.fireEvent(BI.TextValueCombo.EVENT_CHANGE, arguments); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.textIconCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup, + maxHeight: 300 + } + }); + }, + + setValue: function (v) { + this.textIconCombo.setValue(v); + }, + + getValue: function () { + return this.textIconCombo.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.textIconCombo.populate(items); + } +}); +BI.TextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.text_value_combo", BI.TextValueCombo);/** + * @class BI.SmallTextValueCombo + * @extend BI.Widget + * combo : text + icon, popup : text + * 参见场景dashboard布局方式选择 + */ +BI.SmallTextValueCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.SmallTextValueCombo.superclass._defaultConfig.apply(this, arguments), { + width: 100, + height: 24, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + el: {}, + text: "" + }) + }, + + _init: function () { + BI.SmallTextValueCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget(o.el, { + type: "bi.small_select_text_trigger", + items: o.items, + height: o.height, + text: o.text + }); + this.popup = BI.createWidget({ + type: "bi.text_value_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.SmallTextValueCombo.hideView(); + self.fireEvent(BI.SmallTextValueCombo.EVENT_CHANGE); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.SmallTextValueCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup, + maxHeight: 300 + } + }); + }, + + setValue: function (v) { + this.SmallTextValueCombo.setValue(v); + }, + + getValue: function () { + return this.SmallTextValueCombo.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.SmallTextValueCombo.populate(items); + } +}); +BI.SmallTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo);BI.TextValueComboPopup = BI.inherit(BI.Pane, { + _defaultConfig: function () { + return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-text-icon-popup", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }); + }, + + _init: function () { + BI.TextValueComboPopup.superclass._init.apply(this, arguments); + var o = this.options, self = this; + this.popup = BI.createWidget({ + type: "bi.button_group", + items: BI.createItems(o.items, { + type: "bi.single_select_item", + textAlign: o.textAlign, + height: 30 + }), + chooseType: o.chooseType, + layouts: [{ + type: "bi.vertical" + }] + }); + + this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj); + } + }); + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.popup] + }); + }, + + populate: function (items) { + BI.TextValueComboPopup.superclass.populate.apply(this, arguments); + items = BI.createItems(items, { + type: "bi.single_select_item", + height: 30 + }); + this.popup.populate(items); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + setValue: function (v) { + this.popup.setValue(v); + } + +}); +BI.TextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup);/** + * @class BI.TextValueDownListCombo + * @extend BI.Widget + */ +BI.TextValueDownListCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.TextValueDownListCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-text-value-down-list-combo", + height: 30, + text: "" + }) + }, + + _init: function () { + BI.TextValueDownListCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this._createValueMap(); + + this.trigger = BI.createWidget({ + type: "bi.down_list_select_text_trigger", + height: o.height, + items: o.items + }); + + this.combo = BI.createWidget({ + type: "bi.down_list_combo", + element: this, + chooseType: BI.Selection.Single, + adjustLength: 2, + height: o.height, + el: this.trigger, + items: BI.deepClone(o.items) + }); + + this.combo.on(BI.DownListCombo.EVENT_CHANGE, function () { + self.setValue(self.combo.getValue()[0].value); + self.fireEvent(BI.TextValueDownListCombo.EVENT_CHANGE); + }); + + this.combo.on(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, function () { + self.setValue(self.combo.getValue()[0].childValue); + self.fireEvent(BI.TextValueDownListCombo.EVENT_CHANGE); + }); + }, + + _createValueMap: function () { + var self = this; + this.valueMap = {}; + BI.each(BI.flatten(this.options.items), function (idx, item) { + if (BI.has(item, "el")) { + BI.each(item.children, function (id, it) { + self.valueMap[it.value] = {value: item.el.value, childValue: it.value} + }); + } else { + self.valueMap[item.value] = {value: item.value}; + } + }); + }, + + setValue: function (v) { + v = this.valueMap[v]; + this.combo.setValue([v]); + this.trigger.setValue(v.childValue || v.value); + }, + + getValue: function () { + var v = this.combo.getValue()[0]; + return [v.childValue || v.value]; + }, + + populate: function (items) { + this.options.items = BI.flatten(items); + this.combo.populate(items); + this._createValueMap(); + } +}); +BI.TextValueDownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.text_value_down_list_combo", BI.TextValueDownListCombo);/** + * 选择字段trigger, downlist专用 + * 显示形式为 父亲值(儿子值) + * + * @class BI.DownListSelectTextTrigger + * @extends BI.Trigger + */ +BI.DownListSelectTextTrigger = BI.inherit(BI.Trigger, { + + _defaultConfig: function () { + return BI.extend(BI.DownListSelectTextTrigger.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-down-list-select-text-trigger", + height: 24, + text: "" + }); + }, + + _init: function () { + BI.DownListSelectTextTrigger.superclass._init.apply(this, arguments); + var o = this.options; + this.trigger = BI.createWidget({ + type: "bi.select_text_trigger", + element: this, + height: o.height, + items: this._formatItemArray(o.items), + text: o.text + }); + }, + + _formatItemArray: function(){ + var sourceArray = BI.flatten(BI.deepClone(this.options.items)); + var targetArray = []; + BI.each(sourceArray, function(idx, item){ + if(BI.has(item, "el")){ + BI.each(item.children, function(id, it){ + it.text = item.el.text + "(" + it.text + ")"; + }); + targetArray = BI.concat(targetArray, item.children); + }else{ + targetArray.push(item); + } + }); + return targetArray; + }, + + setValue: function (vals) { + this.trigger.setValue(vals); + }, + + populate: function (items) { + this.trigger.populate(this._formatItemArray(items)); + } +}); +BI.shortcut("bi.down_list_select_text_trigger", BI.DownListSelectTextTrigger);/** + * 有清楚按钮的文本框 + * Created by GUY on 2015/9/29. + * @class BI.SmallTextEditor + * @extends BI.SearchEditor + */ +BI.ClearEditor = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.ClearEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: "bi-clear-editor", + height: 30, + errorText: "", + watermark: "", + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn + }); + }, + _init: function () { + BI.ClearEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.editor", + height: o.height, + watermark: o.watermark, + allowBlank: true, + errorText: o.errorText, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker + }); + this.clear = BI.createWidget({ + type: "bi.icon_button", + stopEvent: true, + cls: "search-close-h-font" + }); + this.clear.on(BI.IconButton.EVENT_CHANGE, function () { + self.setValue(""); + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT); + self.fireEvent(BI.ClearEditor.EVENT_CLEAR); + }); + BI.createWidget({ + element: this, + type: "bi.htape", + items: [ + { + el: this.editor + }, + { + el: this.clear, + width: 25 + }] + }); + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.editor.on(BI.Editor.EVENT_FOCUS, function () { + self.fireEvent(BI.ClearEditor.EVENT_FOCUS); + }); + this.editor.on(BI.Editor.EVENT_BLUR, function () { + self.fireEvent(BI.ClearEditor.EVENT_BLUR); + }); + this.editor.on(BI.Editor.EVENT_CLICK, function () { + self.fireEvent(BI.ClearEditor.EVENT_CLICK); + }); + this.editor.on(BI.Editor.EVENT_CHANGE, function () { + self._checkClear(); + self.fireEvent(BI.ClearEditor.EVENT_CHANGE); + }); + this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { + self.fireEvent(BI.ClearEditor.EVENT_KEY_DOWN, v); + }); + this.editor.on(BI.Editor.EVENT_SPACE, function () { + self.fireEvent(BI.ClearEditor.EVENT_SPACE) + }); + this.editor.on(BI.Editor.EVENT_BACKSPACE, function () { + self.fireEvent(BI.ClearEditor.EVENT_BACKSPACE) + }); + + + this.editor.on(BI.Editor.EVENT_VALID, function () { + self.fireEvent(BI.ClearEditor.EVENT_VALID) + }); + this.editor.on(BI.Editor.EVENT_ERROR, function () { + self.fireEvent(BI.ClearEditor.EVENT_ERROR) + }); + this.editor.on(BI.Editor.EVENT_ENTER, function () { + self.fireEvent(BI.ClearEditor.EVENT_ENTER); + }); + this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + self.fireEvent(BI.ClearEditor.EVENT_RESTRICT) + }); + this.editor.on(BI.Editor.EVENT_EMPTY, function () { + self._checkClear(); + self.fireEvent(BI.ClearEditor.EVENT_EMPTY) + }); + this.editor.on(BI.Editor.EVENT_REMOVE, function () { + self.fireEvent(BI.ClearEditor.EVENT_REMOVE) + }); + this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + self.fireEvent(BI.ClearEditor.EVENT_CONFIRM) + }); + this.editor.on(BI.Editor.EVENT_START, function () { + self.fireEvent(BI.ClearEditor.EVENT_START); + }); + this.editor.on(BI.Editor.EVENT_PAUSE, function () { + self.fireEvent(BI.ClearEditor.EVENT_PAUSE); + }); + this.editor.on(BI.Editor.EVENT_STOP, function () { + self.fireEvent(BI.ClearEditor.EVENT_STOP); + }); + + this.clear.invisible(); + }, + + _checkClear: function () { + if (!this.getValue()) { + this.clear.invisible(); + } else { + this.clear.visible(); + } + }, + + focus: function () { + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); + }, + + getValue: function () { + if (this.isValid()) { + var res = this.editor.getValue().match(/[\S]+/g); + return BI.isNull(res) ? "" : res[res.length - 1]; + } + }, + + setValue: function (v) { + this.editor.setValue(v); + if (BI.isKey(v)) { + this.clear.visible(); + } + }, + + isValid: function () { + return this.editor.isValid(); + } +}); +BI.ClearEditor.EVENT_CHANGE = "EVENT_CHANGE"; +BI.ClearEditor.EVENT_FOCUS = "EVENT_FOCUS"; +BI.ClearEditor.EVENT_BLUR = "EVENT_BLUR"; +BI.ClearEditor.EVENT_CLICK = "EVENT_CLICK"; +BI.ClearEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; +BI.ClearEditor.EVENT_SPACE = "EVENT_SPACE"; +BI.ClearEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE"; +BI.ClearEditor.EVENT_CLEAR = "EVENT_CLEAR"; + +BI.ClearEditor.EVENT_START = "EVENT_START"; +BI.ClearEditor.EVENT_PAUSE = "EVENT_PAUSE"; +BI.ClearEditor.EVENT_STOP = "EVENT_STOP"; +BI.ClearEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.ClearEditor.EVENT_VALID = "EVENT_VALID"; +BI.ClearEditor.EVENT_ERROR = "EVENT_ERROR"; +BI.ClearEditor.EVENT_ENTER = "EVENT_ENTER"; +BI.ClearEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; +BI.ClearEditor.EVENT_REMOVE = "EVENT_REMOVE"; +BI.ClearEditor.EVENT_EMPTY = "EVENT_EMPTY"; +BI.shortcut("bi.clear_editor", BI.ClearEditor);/** + * Created by roy on 15/9/14. + */ +BI.SearchEditor = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.SearchEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: "bi-search-editor bi-border", + height: 30, + errorText: "", + watermark: BI.i18nText("BI-Basic_Search"), + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn + }); + }, + _init: function () { + this.options.height -= 2; + BI.SearchEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.editor", + height: o.height, + watermark: o.watermark, + allowBlank: true, + errorText: o.errorText, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker + }); + this.clear = BI.createWidget({ + type: "bi.icon_button", + stopEvent: true, + cls: "search-close-h-font" + }); + this.clear.on(BI.IconButton.EVENT_CHANGE, function () { + self.setValue(""); + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.STOPEDIT); + self.fireEvent(BI.SearchEditor.EVENT_CLEAR); + }); + BI.createWidget({ + element: this, + type: "bi.htape", + items: [ + { + el: { + type: "bi.center_adapt", + cls: "search-font", + items: [{ + el: { + type: "bi.icon" + } + }] + }, + width: 25 + }, + { + el: self.editor + }, + { + el: this.clear, + width: 25 + } + ] + }); + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.editor.on(BI.Editor.EVENT_FOCUS, function () { + self.fireEvent(BI.SearchEditor.EVENT_FOCUS); + }); + this.editor.on(BI.Editor.EVENT_BLUR, function () { + self.fireEvent(BI.SearchEditor.EVENT_BLUR); + }); + this.editor.on(BI.Editor.EVENT_CLICK, function () { + self.fireEvent(BI.SearchEditor.EVENT_CLICK); + }); + this.editor.on(BI.Editor.EVENT_CHANGE, function () { + self._checkClear(); + self.fireEvent(BI.SearchEditor.EVENT_CHANGE); + }); + this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { + self.fireEvent(BI.SearchEditor.EVENT_KEY_DOWN, v); + }); + this.editor.on(BI.Editor.EVENT_SPACE, function () { + self.fireEvent(BI.SearchEditor.EVENT_SPACE) + }); + this.editor.on(BI.Editor.EVENT_BACKSPACE, function () { + self.fireEvent(BI.SearchEditor.EVENT_BACKSPACE) + }); + + + this.editor.on(BI.Editor.EVENT_VALID, function () { + self.fireEvent(BI.SearchEditor.EVENT_VALID) + }); + this.editor.on(BI.Editor.EVENT_ERROR, function () { + self.fireEvent(BI.SearchEditor.EVENT_ERROR) + }); + this.editor.on(BI.Editor.EVENT_ENTER, function () { + self.fireEvent(BI.SearchEditor.EVENT_ENTER); + }); + this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + self.fireEvent(BI.SearchEditor.EVENT_RESTRICT) + }); + this.editor.on(BI.Editor.EVENT_EMPTY, function () { + self._checkClear(); + self.fireEvent(BI.SearchEditor.EVENT_EMPTY) + }); + this.editor.on(BI.Editor.EVENT_REMOVE, function () { + self.fireEvent(BI.SearchEditor.EVENT_REMOVE) + }); + this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + self.fireEvent(BI.SearchEditor.EVENT_CONFIRM) + }); + this.editor.on(BI.Editor.EVENT_START, function () { + self.fireEvent(BI.SearchEditor.EVENT_START); + }); + this.editor.on(BI.Editor.EVENT_PAUSE, function () { + self.fireEvent(BI.SearchEditor.EVENT_PAUSE); + }); + this.editor.on(BI.Editor.EVENT_STOP, function () { + self.fireEvent(BI.SearchEditor.EVENT_STOP); + }); + + this.clear.invisible(); + }, + + _checkClear: function () { + if (!this.getValue()) { + this.clear.invisible(); + } else { + this.clear.visible(); + } + }, + + focus: function () { + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); + }, + + getValue: function () { + if (this.isValid()) { + var res = this.editor.getValue().match(/[\S]+/g); + return BI.isNull(res) ? "" : res[res.length - 1]; + } + }, + + getLastValidValue: function () { + return this.editor.getLastValidValue(); + }, + + setValue: function (v) { + this.editor.setValue(v); + if (BI.isKey(v)) { + this.clear.visible(); + } + }, + + isEditing: function () { + return this.editor.isEditing(); + }, + + isValid: function () { + return this.editor.isValid(); + } +}); +BI.SearchEditor.EVENT_CHANGE = "EVENT_CHANGE"; +BI.SearchEditor.EVENT_FOCUS = "EVENT_FOCUS"; +BI.SearchEditor.EVENT_BLUR = "EVENT_BLUR"; +BI.SearchEditor.EVENT_CLICK = "EVENT_CLICK"; +BI.SearchEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; +BI.SearchEditor.EVENT_SPACE = "EVENT_SPACE"; +BI.SearchEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE"; +BI.SearchEditor.EVENT_CLEAR = "EVENT_CLEAR"; + +BI.SearchEditor.EVENT_START = "EVENT_START"; +BI.SearchEditor.EVENT_PAUSE = "EVENT_PAUSE"; +BI.SearchEditor.EVENT_STOP = "EVENT_STOP"; +BI.SearchEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.SearchEditor.EVENT_VALID = "EVENT_VALID"; +BI.SearchEditor.EVENT_ERROR = "EVENT_ERROR"; +BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER"; +BI.SearchEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; +BI.SearchEditor.EVENT_REMOVE = "EVENT_REMOVE"; +BI.SearchEditor.EVENT_EMPTY = "EVENT_EMPTY"; +BI.shortcut("bi.search_editor", BI.SearchEditor);/** + * 小号搜索框 + * Created by GUY on 2015/9/29. + * @class BI.SmallSearchEditor + * @extends BI.SearchEditor + */ +BI.SmallSearchEditor = BI.inherit(BI.SearchEditor, { + _defaultConfig: function () { + var conf = BI.SmallSearchEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-small-search-editor", + height: 24 + }); + }, + + _init: function () { + BI.SmallSearchEditor.superclass._init.apply(this, arguments); + } +}); +BI.shortcut("bi.small_search_editor", BI.SmallSearchEditor);/** + * 带标记的文本框 + * Created by GUY on 2016/1/25. + * @class BI.ShelterEditor + * @extends BI.Widget + */ +BI.ShelterEditor = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.ShelterEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-shelter-editor", + hgap: 4, + vgap: 2, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + mouseOut: false, + allowBlank: true, + watermark: "", + errorText: "", + height: 30, + textAlign: "left" + }) + }, + + _init: function () { + BI.ShelterEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.editor", + height: o.height, + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + value: o.value, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker, + mouseOut: o.mouseOut, + allowBlank: o.allowBlank, + watermark: o.watermark, + errorText: o.errorText + }); + this.text = BI.createWidget({ + type: "bi.text_button", + cls: "shelter-editor-text", + title: o.title, + warningTitle: o.warningTitle, + tipType: o.tipType, + textAlign: o.textAlign, + height: o.height, + hgap: 4 + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.text, + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + }); + this.text.on(BI.Controller.EVENT_CHANGE, function () { + arguments[2] = self; + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.text.on(BI.TextButton.EVENT_CHANGE, function () { + self.fireEvent(BI.ShelterEditor.EVENT_CLICK_LABEL); + }); + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.Editor.EVENT_FOCUS, function () { + self.fireEvent(BI.ShelterEditor.EVENT_FOCUS, arguments); + }); + this.editor.on(BI.Editor.EVENT_BLUR, function () { + self.fireEvent(BI.ShelterEditor.EVENT_BLUR, arguments); + }); + this.editor.on(BI.Editor.EVENT_CLICK, function () { + self.fireEvent(BI.ShelterEditor.EVENT_CLICK, arguments); + }); + this.editor.on(BI.Editor.EVENT_CHANGE, function () { + self.fireEvent(BI.ShelterEditor.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { + self.fireEvent(BI.ShelterEditor.EVENT_KEY_DOWN, arguments); + }); + + this.editor.on(BI.Editor.EVENT_VALID, function () { + self.fireEvent(BI.ShelterEditor.EVENT_VALID, arguments); + }); + this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + self._showHint(); + self._checkText(); + self.fireEvent(BI.ShelterEditor.EVENT_CONFIRM, arguments); + }); + this.editor.on(BI.Editor.EVENT_START, function () { + self.fireEvent(BI.ShelterEditor.EVENT_START, arguments); + }); + this.editor.on(BI.Editor.EVENT_PAUSE, function () { + self.fireEvent(BI.ShelterEditor.EVENT_PAUSE, arguments); + }); + this.editor.on(BI.Editor.EVENT_STOP, function () { + self.fireEvent(BI.ShelterEditor.EVENT_STOP, arguments); + }); + this.editor.on(BI.Editor.EVENT_SPACE, function () { + self.fireEvent(BI.ShelterEditor.EVENT_SPACE, arguments); + }); + this.editor.on(BI.Editor.EVENT_ERROR, function () { + self._checkText(); + self.fireEvent(BI.ShelterEditor.EVENT_ERROR, arguments); + }); + this.editor.on(BI.Editor.EVENT_ENTER, function () { + self.fireEvent(BI.ShelterEditor.EVENT_ENTER, arguments); + }); + this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + self.fireEvent(BI.ShelterEditor.EVENT_RESTRICT, arguments); + }); + this.editor.on(BI.Editor.EVENT_EMPTY, function () { + self.fireEvent(BI.ShelterEditor.EVENT_EMPTY, arguments); + }); + BI.createWidget({ + type: "bi.vertical", + scrolly: false, + element: this, + items: [this.editor] + }); + this._showHint(); + self._checkText(); + }, + + _checkText: function () { + var o = this.options; + if (this.editor.getValue() === "") { + this.text.setValue(o.watermark || ""); + this.text.element.addClass("bi-water-mark"); + } else { + this.text.setValue(this.editor.getValue()); + this.text.element.removeClass("bi-water-mark"); + } + }, + + _showInput: function () { + this.editor.visible(); + this.text.invisible(); + }, + + _showHint: function () { + this.editor.invisible(); + this.text.visible(); + }, + + setTitle: function (title) { + this.text.setTitle(title); + }, + + setWarningTitle: function (title) { + this.text.setWarningTitle(title); + }, + + focus: function () { + this._showInput(); + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); + this._showHint(); + this._checkText(); + }, + + doRedMark: function () { + if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { + return; + } + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { + return; + } + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + isValid: function () { + return this.editor.isValid(); + }, + + setErrorText: function (text) { + this.editor.setErrorText(text); + }, + + getErrorText: function () { + return this.editor.getErrorText(); + }, + + isEditing: function () { + return this.editor.isEditing(); + }, + + getLastValidValue: function () { + return this.editor.getLastValidValue(); + }, + + setTextStyle: function (style) { + this.text.setStyle(style); + }, + + setValue: function (k) { + this.editor.setValue(k); + this._checkText(); + }, + + getValue: function () { + return this.editor.getValue(); + }, + + getState: function () { + return this.text.getValue(); + }, + + setState: function (v) { + this._showHint(); + this.text.setValue(v); + } +}); +BI.ShelterEditor.EVENT_CHANGE = "EVENT_CHANGE"; +BI.ShelterEditor.EVENT_FOCUS = "EVENT_FOCUS"; +BI.ShelterEditor.EVENT_BLUR = "EVENT_BLUR"; +BI.ShelterEditor.EVENT_CLICK = "EVENT_CLICK"; +BI.ShelterEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; +BI.ShelterEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; + +BI.ShelterEditor.EVENT_START = "EVENT_START"; +BI.ShelterEditor.EVENT_PAUSE = "EVENT_PAUSE"; +BI.ShelterEditor.EVENT_STOP = "EVENT_STOP"; +BI.ShelterEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.ShelterEditor.EVENT_VALID = "EVENT_VALID"; +BI.ShelterEditor.EVENT_ERROR = "EVENT_ERROR"; +BI.ShelterEditor.EVENT_ENTER = "EVENT_ENTER"; +BI.ShelterEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; +BI.ShelterEditor.EVENT_SPACE = "EVENT_SPACE"; +BI.ShelterEditor.EVENT_EMPTY = "EVENT_EMPTY"; + +BI.shortcut("bi.shelter_editor", BI.ShelterEditor);/** + * Created by User on 2017/7/28. + */ +BI.SignInitialEditor = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.SignInitialEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-sign-initial-editor", + hgap: 4, + vgap: 2, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + mouseOut: false, + allowBlank: true, + watermark: "", + errorText: "", + value: "", + text: "", + height: 30 + }) + }, + + _init: function () { + BI.SignInitialEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.editor", + height: o.height, + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + value: o.value, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker, + mouseOut: o.mouseOut, + allowBlank: o.allowBlank, + watermark: o.watermark, + errorText: o.errorText + }); + this.text = BI.createWidget({ + type: "bi.text_button", + cls: "sign-editor-text", + title: o.title, + warningTitle: o.warningTitle, + tipType: o.tipType, + textAlign: "left", + height: o.height, + hgap: 4, + handler: function () { + self._showInput(); + self.editor.focus(); + self.editor.selectAll(); + } + }); + this.text.on(BI.TextButton.EVENT_CHANGE, function () { + BI.nextTick(function () { + self.fireEvent(BI.SignInitialEditor.EVENT_CLICK_LABEL) + }); + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.text, + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + }); + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.Editor.EVENT_FOCUS, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_FOCUS, arguments); + }); + this.editor.on(BI.Editor.EVENT_BLUR, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_BLUR, arguments); + }); + this.editor.on(BI.Editor.EVENT_CLICK, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_CLICK, arguments); + }); + this.editor.on(BI.Editor.EVENT_CHANGE, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { + self.fireEvent(BI.SignInitialEditor.EVENT_KEY_DOWN, arguments); + }); + + this.editor.on(BI.Editor.EVENT_VALID, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_VALID, arguments); + }); + this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + self._showHint(); + self._checkText(); + self.fireEvent(BI.SignInitialEditor.EVENT_CONFIRM, arguments); + }); + this.editor.on(BI.Editor.EVENT_START, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_START, arguments); + }); + this.editor.on(BI.Editor.EVENT_PAUSE, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_PAUSE, arguments); + }); + this.editor.on(BI.Editor.EVENT_STOP, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_STOP, arguments); + }); + this.editor.on(BI.Editor.EVENT_SPACE, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_SPACE, arguments); + }); + this.editor.on(BI.Editor.EVENT_ERROR, function () { + self._checkText(); + self.fireEvent(BI.SignInitialEditor.EVENT_ERROR, arguments); + }); + this.editor.on(BI.Editor.EVENT_ENTER, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_ENTER, arguments); + }); + this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_RESTRICT, arguments); + }); + this.editor.on(BI.Editor.EVENT_EMPTY, function () { + self.fireEvent(BI.SignInitialEditor.EVENT_EMPTY, arguments); + }); + BI.createWidget({ + type: "bi.vertical", + scrolly: false, + element: this, + items: [this.editor] + }); + this._showHint(); + self._checkText(); + }, + + _checkText: function () { + var o = this.options; + BI.nextTick(BI.bind(function () { + if (this.editor.getValue() === "") { + this.text.setValue(o.watermark || ""); + this.text.element.addClass("bi-water-mark"); + } else { + var v = this.editor.getValue(); + v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; + this.text.setValue(v); + this.text.element.removeClass("bi-water-mark"); + } + }, this)); + }, + + _showInput: function () { + this.editor.visible(); + this.text.invisible(); + }, + + _showHint: function () { + this.editor.invisible(); + this.text.visible(); + }, + + setTitle: function (title) { + this.text.setTitle(title); + }, + + setWarningTitle: function (title) { + this.text.setWarningTitle(title); + }, + + focus: function () { + this._showInput(); + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); + this._showHint(); + this._checkText(); + }, + + doRedMark: function () { + if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { + return; + } + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { + return; + } + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + isValid: function () { + return this.editor.isValid(); + }, + + setErrorText: function (text) { + this.editor.setErrorText(text); + }, + + getErrorText: function () { + return this.editor.getErrorText(); + }, + + isEditing: function () { + return this.editor.isEditing(); + }, + + getLastValidValue: function () { + return this.editor.getLastValidValue(); + }, + + setValue: function (v) { + var o = this.options; + this.editor.setValue(v.value); + o.text = v.text || o.text; + this._checkText(); + }, + + getValue: function () { + return { + value: this.editor.getValue(), + text: this.options.text + } + }, + + getState: function () { + return this.text.getValue(); + }, + + setState: function (v) { + var o = this.options; + this._showHint(); + v = (BI.isEmpty(v) || v == o.text) ? o.text : v + "(" + o.text + ")"; + this.text.setValue(v); + } +}); +BI.SignInitialEditor.EVENT_CHANGE = "EVENT_CHANGE"; +BI.SignInitialEditor.EVENT_FOCUS = "EVENT_FOCUS"; +BI.SignInitialEditor.EVENT_BLUR = "EVENT_BLUR"; +BI.SignInitialEditor.EVENT_CLICK = "EVENT_CLICK"; +BI.SignInitialEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; +BI.SignInitialEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; + +BI.SignInitialEditor.EVENT_START = "EVENT_START"; +BI.SignInitialEditor.EVENT_PAUSE = "EVENT_PAUSE"; +BI.SignInitialEditor.EVENT_STOP = "EVENT_STOP"; +BI.SignInitialEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.SignInitialEditor.EVENT_VALID = "EVENT_VALID"; +BI.SignInitialEditor.EVENT_ERROR = "EVENT_ERROR"; +BI.SignInitialEditor.EVENT_ENTER = "EVENT_ENTER"; +BI.SignInitialEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; +BI.SignInitialEditor.EVENT_SPACE = "EVENT_SPACE"; +BI.SignInitialEditor.EVENT_EMPTY = "EVENT_EMPTY"; + +BI.shortcut("bi.sign_initial_editor", BI.SignInitialEditor);/** + * 带标记的文本框 + * Created by GUY on 2015/8/28. + * @class BI.SignEditor + * @extends BI.Widget + */ +BI.SignEditor = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.SignEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-sign-editor", + hgap: 4, + vgap: 2, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + mouseOut: false, + allowBlank: true, + watermark: "", + errorText: "", + height: 30 + }) + }, + + _init: function () { + BI.SignEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.editor", + height: o.height, + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + value: o.value, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker, + mouseOut: o.mouseOut, + allowBlank: o.allowBlank, + watermark: o.watermark, + errorText: o.errorText + }); + this.text = BI.createWidget({ + type: "bi.text_button", + cls: "sign-editor-text", + title: o.title, + warningTitle: o.warningTitle, + tipType: o.tipType, + textAlign: "left", + height: o.height, + hgap: 4, + handler: function () { + self._showInput(); + self.editor.focus(); + self.editor.selectAll(); + } + }); + this.text.on(BI.TextButton.EVENT_CHANGE, function () { + BI.nextTick(function () { + self.fireEvent(BI.SignEditor.EVENT_CLICK_LABEL) + }); + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.text, + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + }); + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.Editor.EVENT_FOCUS, function () { + self.fireEvent(BI.SignEditor.EVENT_FOCUS, arguments); + }); + this.editor.on(BI.Editor.EVENT_BLUR, function () { + self.fireEvent(BI.SignEditor.EVENT_BLUR, arguments); + }); + this.editor.on(BI.Editor.EVENT_CLICK, function () { + self.fireEvent(BI.SignEditor.EVENT_CLICK, arguments); + }); + this.editor.on(BI.Editor.EVENT_CHANGE, function () { + self.fireEvent(BI.SignEditor.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { + self.fireEvent(BI.SignEditor.EVENT_KEY_DOWN, arguments); + }); + + this.editor.on(BI.Editor.EVENT_VALID, function () { + self.fireEvent(BI.SignEditor.EVENT_VALID, arguments); + }); + this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + self._showHint(); + self._checkText(); + self.fireEvent(BI.SignEditor.EVENT_CONFIRM, arguments); + }); + this.editor.on(BI.Editor.EVENT_START, function () { + self.fireEvent(BI.SignEditor.EVENT_START, arguments); + }); + this.editor.on(BI.Editor.EVENT_PAUSE, function () { + self.fireEvent(BI.SignEditor.EVENT_PAUSE, arguments); + }); + this.editor.on(BI.Editor.EVENT_STOP, function () { + self.fireEvent(BI.SignEditor.EVENT_STOP, arguments); + }); + this.editor.on(BI.Editor.EVENT_SPACE, function () { + self.fireEvent(BI.SignEditor.EVENT_SPACE, arguments); + }); + this.editor.on(BI.Editor.EVENT_ERROR, function () { + self._checkText(); + self.fireEvent(BI.SignEditor.EVENT_ERROR, arguments); + }); + this.editor.on(BI.Editor.EVENT_ENTER, function () { + self.fireEvent(BI.SignEditor.EVENT_ENTER, arguments); + }); + this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + self.fireEvent(BI.SignEditor.EVENT_RESTRICT, arguments); + }); + this.editor.on(BI.Editor.EVENT_EMPTY, function () { + self.fireEvent(BI.SignEditor.EVENT_EMPTY, arguments); + }); + BI.createWidget({ + type: "bi.vertical", + scrolly: false, + element: this, + items: [this.editor] + }); + this._showHint(); + self._checkText(); + }, + + _checkText: function () { + var o = this.options; + BI.nextTick(BI.bind(function () { + if (this.editor.getValue() === "") { + this.text.setValue(o.watermark || ""); + this.text.element.addClass("bi-water-mark"); + } else { + this.text.setValue(this.editor.getValue()); + this.text.element.removeClass("bi-water-mark"); + } + }, this)); + }, + + _showInput: function () { + this.editor.visible(); + this.text.invisible(); + }, + + _showHint: function () { + this.editor.invisible(); + this.text.visible(); + }, + + setTitle: function (title) { + this.text.setTitle(title); + }, + + setWarningTitle: function (title) { + this.text.setWarningTitle(title); + }, + + focus: function () { + this._showInput(); + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); + this._showHint(); + this._checkText(); + }, + + doRedMark: function () { + if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { + return; + } + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { + return; + } + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + isValid: function () { + return this.editor.isValid(); + }, + + setErrorText: function (text) { + this.editor.setErrorText(text); + }, + + getErrorText: function () { + return this.editor.getErrorText(); + }, + + isEditing: function () { + return this.editor.isEditing(); + }, + + getLastValidValue: function () { + return this.editor.getLastValidValue(); + }, + + setValue: function (k) { + this.editor.setValue(k); + this._checkText(); + }, + + getValue: function () { + return this.editor.getValue(); + }, + + getState: function () { + return this.text.getValue(); + }, + + setState: function (v) { + this._showHint(); + this.text.setValue(v); + } +}); +BI.SignEditor.EVENT_CHANGE = "EVENT_CHANGE"; +BI.SignEditor.EVENT_FOCUS = "EVENT_FOCUS"; +BI.SignEditor.EVENT_BLUR = "EVENT_BLUR"; +BI.SignEditor.EVENT_CLICK = "EVENT_CLICK"; +BI.SignEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; +BI.SignEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; + +BI.SignEditor.EVENT_START = "EVENT_START"; +BI.SignEditor.EVENT_PAUSE = "EVENT_PAUSE"; +BI.SignEditor.EVENT_STOP = "EVENT_STOP"; +BI.SignEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.SignEditor.EVENT_VALID = "EVENT_VALID"; +BI.SignEditor.EVENT_ERROR = "EVENT_ERROR"; +BI.SignEditor.EVENT_ENTER = "EVENT_ENTER"; +BI.SignEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; +BI.SignEditor.EVENT_SPACE = "EVENT_SPACE"; +BI.SignEditor.EVENT_EMPTY = "EVENT_EMPTY"; + +BI.shortcut("bi.sign_editor", BI.SignEditor);/** + * guy + * 记录状态的输入框 + * @class BI.StateEditor + * @extends BI.Single + */ +BI.StateEditor = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.StateEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-state-editor", + hgap: 4, + vgap: 2, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + mouseOut: false, + allowBlank: true, + watermark: "", + errorText: "", + height: 30 + }) + }, + + _init: function () { + BI.StateEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.editor", + height: o.height, + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + value: o.value, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker, + mouseOut: o.mouseOut, + allowBlank: o.allowBlank, + watermark: o.watermark, + errorText: o.errorText + }); + this.text = BI.createWidget({ + type: "bi.text_button", + cls: "state-editor-infinite-text bi-disabled", + textAlign: "left", + height: o.height, + text: BI.i18nText("BI-Basic_Unrestricted"), + hgap: 4, + handler: function () { + self._showInput(); + self.editor.focus(); + self.editor.setValue(""); + } + }); + this.text.on(BI.TextButton.EVENT_CHANGE, function () { + BI.nextTick(function () { + self.fireEvent(BI.StateEditor.EVENT_CLICK_LABEL); + }); + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.text, + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + }); + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.Editor.EVENT_FOCUS, function () { + self.fireEvent(BI.StateEditor.EVENT_FOCUS, arguments); + }); + this.editor.on(BI.Editor.EVENT_BLUR, function () { + self.fireEvent(BI.StateEditor.EVENT_BLUR, arguments); + }); + this.editor.on(BI.Editor.EVENT_CLICK, function () { + self.fireEvent(BI.StateEditor.EVENT_CLICK, arguments); + }); + this.editor.on(BI.Editor.EVENT_CHANGE, function () { + self.fireEvent(BI.StateEditor.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { + self.fireEvent(BI.StateEditor.EVENT_KEY_DOWN, arguments); + }); + + this.editor.on(BI.Editor.EVENT_VALID, function () { + self.fireEvent(BI.StateEditor.EVENT_VALID, arguments); + }); + this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + self._showHint(); + self.fireEvent(BI.StateEditor.EVENT_CONFIRM, arguments); + }); + this.editor.on(BI.Editor.EVENT_START, function () { + self.fireEvent(BI.StateEditor.EVENT_START, arguments); + }); + this.editor.on(BI.Editor.EVENT_PAUSE, function () { + self.fireEvent(BI.StateEditor.EVENT_PAUSE, arguments); + }); + this.editor.on(BI.Editor.EVENT_STOP, function () { + self.fireEvent(BI.StateEditor.EVENT_STOP, arguments); + }); + this.editor.on(BI.Editor.EVENT_SPACE, function () { + self.fireEvent(BI.StateEditor.EVENT_SPACE, arguments); + }); + this.editor.on(BI.Editor.EVENT_ERROR, function () { + self.fireEvent(BI.StateEditor.EVENT_ERROR, arguments); + }); + this.editor.on(BI.Editor.EVENT_ENTER, function () { + self.fireEvent(BI.StateEditor.EVENT_ENTER, arguments); + }); + this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + self.fireEvent(BI.StateEditor.EVENT_RESTRICT, arguments); + }); + this.editor.on(BI.Editor.EVENT_EMPTY, function () { + self.fireEvent(BI.StateEditor.EVENT_EMPTY, arguments); + }); + BI.createWidget({ + type: "bi.vertical", + scrolly: false, + element: this, + items: [this.editor] + }); + this._showHint(); + }, + + doRedMark: function () { + if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { + return; + } + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { + return; + } + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + focus: function () { + if (this.options.disabled === false) { + this._showInput(); + this.editor.focus(); + } + }, + + blur: function () { + this.editor.blur(); + this._showHint(); + }, + + _showInput: function () { + this.editor.visible(); + this.text.invisible(); + }, + + _showHint: function () { + this.editor.invisible(); + this.text.visible(); + }, + + isValid: function () { + return this.editor.isValid(); + }, + + setErrorText: function (text) { + this.editor.setErrorText(text); + }, + + getErrorText: function () { + return this.editor.getErrorText(); + }, + + isEditing: function () { + return this.editor.isEditing(); + }, + + getLastValidValue: function () { + return this.editor.getLastValidValue(); + }, + + setValue: function (k) { + this.editor.setValue(k); + }, + + getValue: function () { + return this.editor.getValue(); + }, + + getState: function () { + return this.editor.getValue().match(/[^\s]+/g); + }, + + setState: function (v) { + BI.StateEditor.superclass.setValue.apply(this, arguments); + if (BI.isNumber(v)) { + if (v === BI.Selection.All) { + this.text.setText(BI.i18nText("BI-Select_All")); + this.text.setTitle(""); + this.text.element.removeClass("state-editor-infinite-text"); + } else if (v === BI.Selection.Multi) { + this.text.setText(BI.i18nText("BI-Select_Part")); + this.text.setTitle(""); + this.text.element.removeClass("state-editor-infinite-text"); + } else { + this.text.setText(BI.i18nText("BI-Basic_Unrestricted")); + this.text.setTitle(""); + this.text.element.addClass("state-editor-infinite-text"); + } + return; + } + if (BI.isString(v)) { + // if (BI.isEmpty(v)) { + // this.text.setText(BI.i18nText("BI-Basic_Unrestricted")); + // this.text.setTitle(""); + // this.text.element.addClass("state-editor-infinite-text"); + // } else { + this.text.setText(v); + this.text.setTitle(v); + this.text.element.removeClass("state-editor-infinite-text"); + // } + return; + } + if (BI.isArray(v)) { + if (BI.isEmpty(v)) { + this.text.setText(BI.i18nText("BI-Basic_Unrestricted")); + this.text.element.addClass("state-editor-infinite-text"); + } else if (v.length === 1) { + this.text.setText(v[0]); + this.text.setTitle(v[0]); + this.text.element.removeClass("state-editor-infinite-text"); + } else { + this.text.setText(BI.i18nText("BI-Select_Part")); + this.text.setTitle(""); + this.text.element.removeClass("state-editor-infinite-text"); + } + } + } +}); +BI.StateEditor.EVENT_CHANGE = "EVENT_CHANGE"; +BI.StateEditor.EVENT_FOCUS = "EVENT_FOCUS"; +BI.StateEditor.EVENT_BLUR = "EVENT_BLUR"; +BI.StateEditor.EVENT_CLICK = "EVENT_CLICK"; +BI.StateEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; +BI.StateEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; + +BI.StateEditor.EVENT_START = "EVENT_START"; +BI.StateEditor.EVENT_PAUSE = "EVENT_PAUSE"; +BI.StateEditor.EVENT_STOP = "EVENT_STOP"; +BI.StateEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.StateEditor.EVENT_VALID = "EVENT_VALID"; +BI.StateEditor.EVENT_ERROR = "EVENT_ERROR"; +BI.StateEditor.EVENT_ENTER = "EVENT_ENTER"; +BI.StateEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; +BI.StateEditor.EVENT_SPACE = "EVENT_SPACE"; +BI.StateEditor.EVENT_EMPTY = "EVENT_EMPTY"; + +BI.shortcut("bi.state_editor", BI.StateEditor);/** + * 无限制-已选择状态输入框 + * Created by GUY on 2016/5/18. + * @class BI.SimpleStateEditor + * @extends BI.Single + */ +BI.SimpleStateEditor = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.SimpleStateEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-simple-state-editor", + hgap: 4, + vgap: 2, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + mouseOut: false, + allowBlank: true, + watermark: "", + errorText: "", + height: 30 + }) + }, + + _init: function () { + BI.SimpleStateEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.editor", + height: o.height, + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + value: o.value, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker, + mouseOut: o.mouseOut, + allowBlank: o.allowBlank, + watermark: o.watermark, + errorText: o.errorText + }); + this.text = BI.createWidget({ + type: "bi.text_button", + cls: "state-editor-infinite-text bi-disabled", + textAlign: "left", + height: o.height, + text: BI.i18nText("BI-Basic_Unrestricted"), + hgap: 4, + handler: function () { + self._showInput(); + self.editor.focus(); + self.editor.setValue(""); + } + }); + this.text.on(BI.TextButton.EVENT_CHANGE, function () { + BI.nextTick(function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_CLICK_LABEL); + }); + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.text, + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + }); + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.Editor.EVENT_FOCUS, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_FOCUS, arguments); + }); + this.editor.on(BI.Editor.EVENT_BLUR, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_BLUR, arguments); + }); + this.editor.on(BI.Editor.EVENT_CLICK, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_CLICK, arguments); + }); + this.editor.on(BI.Editor.EVENT_CHANGE, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { + self.fireEvent(BI.SimpleStateEditor.EVENT_KEY_DOWN, arguments); + }); + + this.editor.on(BI.Editor.EVENT_VALID, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_VALID, arguments); + }); + this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + self._showHint(); + self.fireEvent(BI.SimpleStateEditor.EVENT_CONFIRM, arguments); + }); + this.editor.on(BI.Editor.EVENT_START, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_START, arguments); + }); + this.editor.on(BI.Editor.EVENT_PAUSE, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_PAUSE, arguments); + }); + this.editor.on(BI.Editor.EVENT_STOP, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_STOP, arguments); + }); + this.editor.on(BI.Editor.EVENT_SPACE, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_SPACE, arguments); + }); + this.editor.on(BI.Editor.EVENT_ERROR, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_ERROR, arguments); + }); + this.editor.on(BI.Editor.EVENT_ENTER, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_ENTER, arguments); + }); + this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_RESTRICT, arguments); + }); + this.editor.on(BI.Editor.EVENT_EMPTY, function () { + self.fireEvent(BI.SimpleStateEditor.EVENT_EMPTY, arguments); + }); + BI.createWidget({ + type: "bi.vertical", + scrolly: false, + element: this, + items: [this.editor] + }); + this._showHint(); + }, + + doRedMark: function () { + if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { + return; + } + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doHighLight: function () { + if (this.editor.getValue() === "" && BI.isKey(this.options.watermark)) { + return; + } + this.text.doHighLight.apply(this.text, arguments); + }, + + unHighLight: function () { + this.text.unHighLight.apply(this.text, arguments); + }, + + focus: function () { + this._showInput(); + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); + this._showHint(); + }, + + _showInput: function () { + this.editor.visible(); + this.text.invisible(); + }, + + _showHint: function () { + this.editor.invisible(); + this.text.visible(); + }, + + isValid: function () { + return this.editor.isValid(); + }, + + setErrorText: function (text) { + this.editor.setErrorText(text); + }, + + getErrorText: function () { + return this.editor.getErrorText(); + }, + + isEditing: function () { + return this.editor.isEditing(); + }, + + getLastValidValue: function () { + return this.editor.getLastValidValue(); + }, + + setValue: function (k) { + this.editor.setValue(k); + }, + + getValue: function () { + return this.editor.getValue(); + }, + + getState: function () { + return this.editor.getValue().match(/[^\s]+/g); + }, + + setState: function (v) { + BI.SimpleStateEditor.superclass.setValue.apply(this, arguments); + if (BI.isNumber(v)) { + if (v === BI.Selection.All) { + this.text.setText(BI.i18nText("BI-Already_Selected")); + this.text.element.removeClass("state-editor-infinite-text"); + } else if (v === BI.Selection.Multi) { + this.text.setText(BI.i18nText("BI-Already_Selected")); + this.text.element.removeClass("state-editor-infinite-text"); + } else { + this.text.setText(BI.i18nText("BI-Basic_Unrestricted")); + this.text.element.addClass("state-editor-infinite-text"); + } + return; + } + if (!BI.isArray(v) || v.length === 1) { + this.text.setText(v); + this.text.setTitle(v); + this.text.element.removeClass("state-editor-infinite-text"); + } else if (BI.isEmpty(v)) { + this.text.setText(BI.i18nText("BI-Basic_Unrestricted")); + this.text.element.addClass("state-editor-infinite-text"); + } else { + this.text.setText(BI.i18nText("BI-Already_Selected")); + this.text.element.removeClass("state-editor-infinite-text"); + } + } +}); +BI.SimpleStateEditor.EVENT_CHANGE = "EVENT_CHANGE"; +BI.SimpleStateEditor.EVENT_FOCUS = "EVENT_FOCUS"; +BI.SimpleStateEditor.EVENT_BLUR = "EVENT_BLUR"; +BI.SimpleStateEditor.EVENT_CLICK = "EVENT_CLICK"; +BI.SimpleStateEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; +BI.SimpleStateEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; + +BI.SimpleStateEditor.EVENT_START = "EVENT_START"; +BI.SimpleStateEditor.EVENT_PAUSE = "EVENT_PAUSE"; +BI.SimpleStateEditor.EVENT_STOP = "EVENT_STOP"; +BI.SimpleStateEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.SimpleStateEditor.EVENT_VALID = "EVENT_VALID"; +BI.SimpleStateEditor.EVENT_ERROR = "EVENT_ERROR"; +BI.SimpleStateEditor.EVENT_ENTER = "EVENT_ENTER"; +BI.SimpleStateEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; +BI.SimpleStateEditor.EVENT_SPACE = "EVENT_SPACE"; +BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY"; + +BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/** + * guy + * @class BI.TextEditor + * @extends BI.Single + */ +BI.TextEditor = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.TextEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + extraCls: "bi-text-editor bi-border", + hgap: 4, + vgap: 2, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + mouseOut: false, + allowBlank: false, + watermark: "", + errorText: "", + height: 30 + }) + }, + + _init: function () { + BI.TextEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isNumber(o.height)) { + this.element.css({height: o.height - 2}); + } + if (BI.isNumber(o.width)) { + this.element.css({width: o.width - 2}); + } + this.editor = BI.createWidget({ + type: "bi.editor", + height: o.height - 2, + hgap: o.hgap, + vgap: o.vgap, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + value: o.value, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker, + mouseOut: o.mouseOut, + allowBlank: o.allowBlank, + watermark: o.watermark, + errorText: o.errorText + }); + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.editor.on(BI.Editor.EVENT_FOCUS, function () { + self.fireEvent(BI.TextEditor.EVENT_FOCUS); + }); + this.editor.on(BI.Editor.EVENT_BLUR, function () { + self.fireEvent(BI.TextEditor.EVENT_BLUR); + }); + this.editor.on(BI.Editor.EVENT_CLICK, function () { + self.fireEvent(BI.TextEditor.EVENT_CLICK); + }); + this.editor.on(BI.Editor.EVENT_CHANGE, function () { + self.fireEvent(BI.TextEditor.EVENT_CHANGE); + }); + this.editor.on(BI.Editor.EVENT_KEY_DOWN, function (v) { + self.fireEvent(BI.TextEditor.EVENT_KEY_DOWN); + }); + this.editor.on(BI.Editor.EVENT_SPACE, function (v) { + self.fireEvent(BI.TextEditor.EVENT_SPACE); + }); + this.editor.on(BI.Editor.EVENT_BACKSPACE, function (v) { + self.fireEvent(BI.TextEditor.EVENT_BACKSPACE); + }); + + + this.editor.on(BI.Editor.EVENT_VALID, function () { + self.fireEvent(BI.TextEditor.EVENT_VALID); + }); + this.editor.on(BI.Editor.EVENT_CONFIRM, function () { + self.fireEvent(BI.TextEditor.EVENT_CONFIRM); + }); + this.editor.on(BI.Editor.EVENT_REMOVE, function (v) { + self.fireEvent(BI.TextEditor.EVENT_REMOVE); + }); + this.editor.on(BI.Editor.EVENT_START, function () { + self.fireEvent(BI.TextEditor.EVENT_START); + }); + this.editor.on(BI.Editor.EVENT_PAUSE, function () { + self.fireEvent(BI.TextEditor.EVENT_PAUSE); + }); + this.editor.on(BI.Editor.EVENT_STOP, function () { + self.fireEvent(BI.TextEditor.EVENT_STOP); + }); + this.editor.on(BI.Editor.EVENT_ERROR, function () { + self.fireEvent(BI.TextEditor.EVENT_ERROR, arguments); + }); + this.editor.on(BI.Editor.EVENT_ENTER, function () { + self.fireEvent(BI.TextEditor.EVENT_ENTER); + }); + this.editor.on(BI.Editor.EVENT_RESTRICT, function () { + self.fireEvent(BI.TextEditor.EVENT_RESTRICT); + }); + this.editor.on(BI.Editor.EVENT_EMPTY, function () { + self.fireEvent(BI.TextEditor.EVENT_EMPTY); + }); + BI.createWidget({ + type: "bi.vertical", + scrolly: false, + element: this, + items: [this.editor] + }); + }, + + focus: function () { + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); + }, + + setErrorText: function (text) { + this.editor.setErrorText(text); + }, + + getErrorText: function () { + return this.editor.getErrorText(); + }, + + isValid: function () { + return this.editor.isValid(); + }, + + setValue: function (v) { + this.editor.setValue(v); + }, + + getValue: function () { + return this.editor.getValue(); + } +}); +BI.TextEditor.EVENT_CHANGE = "EVENT_CHANGE"; +BI.TextEditor.EVENT_FOCUS = "EVENT_FOCUS"; +BI.TextEditor.EVENT_BLUR = "EVENT_BLUR"; +BI.TextEditor.EVENT_CLICK = "EVENT_CLICK"; +BI.TextEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; +BI.TextEditor.EVENT_SPACE = "EVENT_SPACE"; +BI.TextEditor.EVENT_BACKSPACE = "EVENT_BACKSPACE"; + +BI.TextEditor.EVENT_START = "EVENT_START"; +BI.TextEditor.EVENT_PAUSE = "EVENT_PAUSE"; +BI.TextEditor.EVENT_STOP = "EVENT_STOP"; +BI.TextEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.TextEditor.EVENT_VALID = "EVENT_VALID"; +BI.TextEditor.EVENT_ERROR = "EVENT_ERROR"; +BI.TextEditor.EVENT_ENTER = "EVENT_ENTER"; +BI.TextEditor.EVENT_RESTRICT = "EVENT_RESTRICT"; +BI.TextEditor.EVENT_REMOVE = "EVENT_REMOVE"; +BI.TextEditor.EVENT_EMPTY = "EVENT_EMPTY"; + +BI.shortcut("bi.text_editor", BI.TextEditor);/** + * 小号搜索框 + * Created by GUY on 2015/9/29. + * @class BI.SmallTextEditor + * @extends BI.SearchEditor + */ +BI.SmallTextEditor = BI.inherit(BI.TextEditor, { + _defaultConfig: function () { + var conf = BI.SmallTextEditor.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-small-text-editor", + height: 25 + }); + }, + + _init: function () { + BI.SmallTextEditor.superclass._init.apply(this, arguments); + } +}); +BI.shortcut("bi.small_text_editor", BI.SmallTextEditor);/** + * 有确定取消按钮的弹出层 + * @class BI.BarFloatSection + * @extends BI.FloatSection + * @abstract + */ +BI.BarFloatSection = BI.inherit(BI.FloatSection, { + _defaultConfig: function () { + return BI.extend(BI.BarFloatSection.superclass._defaultConfig.apply(this, arguments), { + btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText("BI-Basic_Cancel")] + }) + }, + + _init: function () { + BI.BarFloatSection.superclass._init.apply(this, arguments); + var self = this; + var flatten = ["_init", "_defaultConfig", "_vessel", "_render", "getName", "listenEnd", "local", "refresh", "load", "change"]; + flatten = BI.makeObject(flatten, true); + BI.each(this.constructor.caller.caller.caller.caller.prototype, function (key) { + if (flatten[key]) { + return; + } + var f = self[key]; + if (BI.isFunction(f)) { + self[key] = BI.bind(function () { + if (this.model._start === true) { + this._F.push({f: f, arg: arguments}); + return; + } + return f.apply(this, arguments); + }, self); + } + }) + }, + + rebuildSouth: function (south) { + var self = this, o = this.options; + this.sure = BI.createWidget({ + type: 'bi.button', + text: this.options.btns[0], + height: 30, + value: 0, + handler: function (v) { + self.end(); + self.close(v); + } + }); + this.cancel = BI.createWidget({ + type: 'bi.button', + text: this.options.btns[1], + height: 30, + value: 1, + level: 'ignore', + handler: function (v) { + self.close(v); + } + }); + BI.createWidget({ + type: 'bi.right_vertical_adapt', + element: south, + hgap: 5, + items: [this.cancel, this.sure] + }); + } +}); + +/** + * 有确定取消按钮的弹出层 + * @class BI.BarPopoverSection + * @extends BI.PopoverSection + * @abstract + */ +BI.BarPopoverSection = BI.inherit(BI.PopoverSection, { + _defaultConfig: function () { + return BI.extend(BI.BarPopoverSection.superclass._defaultConfig.apply(this, arguments), { + btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] + }) + }, + + _init: function () { + BI.BarPopoverSection.superclass._init.apply(this, arguments); + }, + + rebuildSouth: function (south) { + var self = this, o = this.options; + this.sure = BI.createWidget({ + type: 'bi.button', + text: this.options.btns[0], + warningTitle: o.warningTitle, + height: 30, + value: 0, + handler: function (v) { + self.end(); + self.close(v); + } + }); + this.cancel = BI.createWidget({ + type: 'bi.button', + text: this.options.btns[1], + height: 30, + value: 1, + level: 'ignore', + handler: function (v) { + self.close(v); + } + }); + BI.createWidget({ + type: 'bi.right_vertical_adapt', + element: south, + hgap: 5, + items: [this.cancel, this.sure] + }); + }, + + setConfirmButtonEnable: function(v){ + this.sure.setEnable(!!v); + } +});/** + * 下拉框弹出层的多选版本,toolbar带有若干按钮, zIndex在1000w + * @class BI.MultiPopupView + * @extends BI.Widget + */ + +BI.MultiPopupView = BI.inherit(BI.PopupView, { + + _defaultConfig: function () { + var conf = BI.MultiPopupView.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-multi-list-view", + buttons: [BI.i18nText("BI-Basic_Sure")] + }) + }, + + _init: function () { + BI.MultiPopupView.superclass._init.apply(this, arguments); + }, + + _createToolBar: function () { + var o = this.options, self = this; + if (o.buttons.length === 0) { + return; + } + + var text = []; //构造[{text:content},……] + BI.each(o.buttons, function (idx, item) { + text.push({ + text: item, + value: idx + }) + }); + + this.buttongroup = BI.createWidget({ + type: "bi.button_group", + cls: "list-view-toolbar bi-high-light bi-border-top", + height: 30, + items: BI.createItems(text, { + type: "bi.text_button", + once: false, + shadow: true, + isShadowShowingOnSelected: true + }), + layouts: [{ + type: "bi.center", + hgap: 0, + vgap: 0 + }] + }); + + this.buttongroup.on(BI.ButtonGroup.EVENT_CHANGE, function (value, obj) { + self.fireEvent(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, value, obj); + }); + + return this.buttongroup; + } + +}); + +BI.MultiPopupView.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; + +BI.shortcut("bi.multi_popup_view", BI.MultiPopupView);/** + * 可以理解为MultiPopupView和Panel两个面板的结合体 + * @class BI.PopupPanel + * @extends BI.MultiPopupView + */ + +BI.PopupPanel = BI.inherit(BI.MultiPopupView, { + + _defaultConfig: function () { + var conf = BI.PopupPanel.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-popup-panel", + title: "" + }) + }, + + _init: function () { + BI.PopupPanel.superclass._init.apply(this, arguments); + }, + + _createTool: function () { + var self = this, o = this.options; + var close = BI.createWidget({ + type: "bi.icon_button", + cls: "close-h-font", + width: 25, + height: 25 + }); + close.on(BI.IconButton.EVENT_CHANGE, function () { + self.setVisible(false); + self.fireEvent(BI.PopupPanel.EVENT_CLOSE); + }); + return BI.createWidget({ + type: "bi.htape", + cls: "popup-panel-title bi-background bi-border", + height: 25, + items: [{ + el: { + type: "bi.label", + textAlign: "left", + text: o.title, + height: 25, + lgap: 10 + } + }, { + el: close, + width: 25 + }] + }); + } +}); + +BI.PopupPanel.EVENT_CHANGE = "EVENT_CHANGE"; +BI.PopupPanel.EVENT_CLOSE = "EVENT_CLOSE"; +BI.PopupPanel.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; + +BI.shortcut("bi.popup_panel", BI.PopupPanel);/** + * list面板 + * + * Created by GUY on 2015/10/30. + * @class BI.ListPane + * @extends BI.Pane + */ +BI.ListPane = BI.inherit(BI.Pane, { + + _defaultConfig: function () { + var conf = BI.ListPane.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-list-pane", + logic: { + dynamic: true + }, + lgap: 0, + rgap: 0, + tgap: 0, + bgap: 0, + vgap: 0, + hgap: 0, + items: [], + itemsCreator: BI.emptyFn, + hasNext: BI.emptyFn, + onLoaded: BI.emptyFn, + el: { + type: "bi.button_group" + } + }) + }, + _init: function () { + BI.ListPane.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.button_group = BI.createWidget(o.el, { + type: "bi.button_group", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + behaviors: {}, + items: o.items, + itemsCreator: function (op, calback) { + if (op.times === 1) { + self.empty(); + BI.nextTick(function () { + self.loading() + }); + } + o.itemsCreator(op, function () { + calback.apply(self, arguments); + op.times === 1 && BI.nextTick(function () { + self.loaded(); + }); + }); + }, + hasNext: o.hasNext, + layouts: [{ + type: "bi.vertical" + }] + }); + + this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.ListPane.EVENT_CHANGE, value, obj); + } + }); + this.check(); + + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Top), BI.extend({ + scrolly: true, + lgap: o.lgap, + rgap: o.rgap, + tgap: o.tgap, + bgap: o.bgap, + vgap: o.vgap, + hgap: o.hgap + }, o.logic, { + items: BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Top, this.button_group) + })))); + }, + + hasPrev: function () { + return this.button_group.hasPrev && this.button_group.hasPrev(); + }, + + hasNext: function () { + return this.button_group.hasNext && this.button_group.hasNext(); + }, + + prependItems: function (items) { + this.options.items = items.concat(this.options.items); + this.button_group.prependItems.apply(this.button_group, arguments); + this.check(); + }, + + addItems: function (items) { + this.options.items = this.options.items.concat(items); + this.button_group.addItems.apply(this.button_group, arguments); + this.check(); + }, + + removeItemAt: function (indexes) { + indexes = indexes || []; + BI.removeAt(this.options.items, indexes); + this.button_group.removeItemAt.apply(this.button_group, arguments); + this.check(); + }, + + populate: function (items) { + var self = this, o = this.options; + if (arguments.length === 0 && (BI.isFunction(this.button_group.attr("itemsCreator")))) {//接管loader的populate方法 + this.button_group.attr("itemsCreator").apply(this, [{times: 1}, function () { + if (arguments.length === 0) { + throw new Error("参数不能为空"); + } + self.populate.apply(self, arguments); + }]); + return; + } + BI.ListPane.superclass.populate.apply(this, arguments); + this.button_group.populate.apply(this.button_group, arguments); + }, + + empty: function () { + this.button_group.empty(); + }, + + setNotSelectedValue: function () { + this.button_group.setNotSelectedValue.apply(this.button_group, arguments); + }, + + getNotSelectedValue: function () { + return this.button_group.getNotSelectedValue(); + }, + + setValue: function () { + this.button_group.setValue.apply(this.button_group, arguments); + }, + + getValue: function () { + return this.button_group.getValue.apply(this.button_group, arguments); + }, + + getAllButtons: function () { + return this.button_group.getAllButtons(); + }, + + getAllLeaves: function () { + return this.button_group.getAllLeaves(); + }, + + getSelectedButtons: function () { + return this.button_group.getSelectedButtons(); + }, + + getNotSelectedButtons: function () { + return this.button_group.getNotSelectedButtons(); + }, + + getIndexByValue: function (value) { + return this.button_group.getIndexByValue(value); + }, + + getNodeById: function (id) { + return this.button_group.getNodeById(id); + }, + + getNodeByValue: function (value) { + return this.button_group.getNodeByValue(value); + } +}); +BI.ListPane.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.list_pane", BI.ListPane);/** + * 带有标题栏的pane + * @class BI.Panel + * @extends BI.Widget + */ +BI.Panel = BI.inherit(BI.Widget,{ + _defaultConfig : function(){ + return BI.extend(BI.Panel.superclass._defaultConfig.apply(this,arguments),{ + baseCls: "bi-panel bi-border", + title:"", + titleButtons:[], + el:{}, + logic:{ + dynamic: false + } + }); + }, + + _init:function(){ + BI.Panel.superclass._init.apply(this,arguments); + var o = this.options; + + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic("vertical", BI.extend(o.logic, { + items: BI.LogicFactory.createLogicItemsByDirection("top", this._createTitle() + ,this.options.el) + })))); + }, + + _createTitle:function(){ + var self = this, o = this.options; + this.text = BI.createWidget({ + type: "bi.label", + cls: "panel-title-text", + text: o.title, + height: 30 + }); + + this.button_group = BI.createWidget({ + type:"bi.button_group", + items: o.titleButtons, + layouts: [{ + type: "bi.center_adapt", + lgap:10 + }] + }); + + this.button_group.on(BI.Controller.EVENT_CHANGE, function(){ + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.button_group.on(BI.ButtonGroup.EVENT_CHANGE, function(value, obj){ + self.fireEvent(BI.Panel.EVENT_CHANGE, value, obj); + }); + + return { + el: { + type: "bi.left_right_vertical_adapt", + cls: "panel-title bi-tips bi-border-bottom bi-background", + height: 30, + items: { + left: [this.text], + right: [this.button_group] + }, + lhgap: 10, + rhgap: 10 + }, + height: 30 + }; + }, + + setTitle: function(title){ + this.text.setValue(title); + } +}); +BI.Panel.EVENT_CHANGE = "Panel.EVENT_CHANGE"; + +BI.shortcut("bi.panel",BI.Panel);/** + * 选择列表 + * + * Created by GUY on 2015/11/1. + * @class BI.SelectList + * @extends BI.Widget + */ +BI.SelectList = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.SelectList.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-select-list", + direction: BI.Direction.Top,//toolbar的位置 + logic: { + dynamic: true + }, + items: [], + itemsCreator: BI.emptyFn, + hasNext: BI.emptyFn, + onLoaded: BI.emptyFn, + toolbar: { + type: "bi.multi_select_bar" + }, + el: { + type: "bi.list_pane" + } + }) + }, + _init: function () { + BI.SelectList.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + //全选 + this.toolbar = BI.createWidget(o.toolbar); + this.toolbar.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { + var isAllSelected = this.isSelected(); + if (type === BI.Events.CLICK) { + self.setAllSelected(isAllSelected); + self.fireEvent(BI.SelectList.EVENT_CHANGE, value, obj); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.list = BI.createWidget(o.el, { + type: "bi.list_pane", + items: o.items, + itemsCreator: function (op, callback) { + op.times === 1 && self.toolbar.setVisible(false); + o.itemsCreator(op, function (items) { + callback.apply(self, arguments); + if (op.times === 1) { + self.toolbar.setVisible(items && items.length > 0); + self.toolbar.setEnable(items && items.length > 0); + } + self._checkAllSelected(); + }); + }, + onLoaded: o.onLoaded, + hasNext: o.hasNext + }); + + this.list.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { + if (type === BI.Events.CLICK) { + self._checkAllSelected(); + self.fireEvent(BI.SelectList.EVENT_CHANGE, value, obj); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({ + scrolly: true + }, o.logic, { + items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.toolbar, this.list) + })))); + + if (o.items.length <= 0) { + this.toolbar.setVisible(false); + this.toolbar.setEnable(false); + } + }, + + _checkAllSelected: function () { + var selectLength = this.list.getValue().length; + var notSelectLength = this.getAllLeaves().length - selectLength; + var hasNext = this.list.hasNext(); + var isAlreadyAllSelected = this.toolbar.isSelected(); + var isHalf = selectLength > 0 && (notSelectLength > 0 || (!isAlreadyAllSelected && hasNext)); + isHalf = isHalf || (notSelectLength > 0 && hasNext && isAlreadyAllSelected); + this.toolbar.setHalfSelected(isHalf); + !isHalf && this.toolbar.setSelected(selectLength > 0 && notSelectLength <= 0 && (!hasNext || isAlreadyAllSelected)); + }, + + setAllSelected: function (v) { + BI.each(this.getAllButtons(), function (i, btn) { + (btn.setSelected || btn.setAllSelected).apply(btn, [v]); + }); + this.toolbar.setSelected(v); + this.toolbar.setHalfSelected(false); + }, + + setToolBarVisible: function (b) { + this.toolbar.setVisible(b); + }, + + isAllSelected: function () { + return this.toolbar.isSelected(); + }, + + hasPrev: function () { + return this.list.hasPrev(); + }, + + hasNext: function () { + return this.list.hasNext(); + }, + + prependItems: function (items) { + this.list.prependItems.apply(this.list, arguments); + }, + + addItems: function (items) { + this.list.addItems.apply(this.list, arguments); + }, + + setValue: function (data) { + var selectAll = data.type === BI.ButtonGroup.CHOOSE_TYPE_ALL; + this.setAllSelected(selectAll); + this.list[selectAll ? "setNotSelectedValue" : "setValue"](data.value); + this._checkAllSelected(); + }, + + getValue: function () { + if (this.isAllSelected() === false) { + return { + type: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + value: this.list.getValue(), + assist: this.list.getNotSelectedValue() + }; + } else { + return { + type: BI.ButtonGroup.CHOOSE_TYPE_ALL, + value: this.list.getNotSelectedValue(), + assist: this.list.getValue() + }; + } + }, + + empty: function () { + this.list.empty(); + }, + + populate: function (items) { + this.toolbar.setVisible(!BI.isEmptyArray(items)); + this.toolbar.setEnable(!BI.isEmptyArray(items)); + this.list.populate.apply(this.list, arguments); + this._checkAllSelected(); + }, + + _setEnable: function (enable) { + BI.SelectList.superclass._setEnable.apply(this, arguments); + this.toolbar.setEnable(enable); + }, + + resetHeight: function (h) { + var toolHeight = ( this.toolbar.element.outerHeight() || 25) * ( this.toolbar.isVisible() ? 1 : 0); + this.list.resetHeight ? this.list.resetHeight(h - toolHeight) : + this.list.element.css({"max-height": h - toolHeight + "px"}) + }, + + setNotSelectedValue: function () { + this.list.setNotSelectedValue.apply(this.list, arguments); + this._checkAllSelected(); + }, + + getNotSelectedValue: function () { + return this.list.getNotSelectedValue(); + }, + + getAllButtons: function () { + return this.list.getAllButtons(); + }, + + getAllLeaves: function () { + return this.list.getAllLeaves(); + }, + + getSelectedButtons: function () { + return this.list.getSelectedButtons(); + }, + + getNotSelectedButtons: function () { + return this.list.getNotSelectedButtons(); + }, + + getIndexByValue: function (value) { + return this.list.getIndexByValue(value); + }, + + getNodeById: function (id) { + return this.list.getNodeById(id); + }, + + getNodeByValue: function (value) { + return this.list.getNodeByValue(value); + } +}); +BI.SelectList.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.select_list", BI.SelectList);/** + * Created by roy on 15/11/6. + */ +BI.LazyLoader = BI.inherit(BI.Widget, { + _const: { + PAGE: 100 + }, + _defaultConfig: function () { + return BI.extend(BI.LazyLoader.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-lazy-loader", + el: {} + }) + }, + + _init: function () { + var self = this, o = this.options; + BI.LazyLoader.superclass._init.apply(this, arguments); + var all = o.items.length; + this.loader = BI.createWidget({ + type: "bi.loader", + element: this, + //下面是button_group的属性 + el: o.el, + + itemsCreator: function (options, populate) { + populate(self._getNextItems(options)); + }, + hasNext: function (option) { + return option.count < all; + } + }); + + this.loader.on(BI.Loader.EVENT_CHANGE, function (obj) { + self.fireEvent(BI.LazyLoader.EVENT_CHANGE, obj) + }) + }, + _getNextItems: function (options) { + var self = this, o = this.options; + var lastNum = o.items.length - this._const.PAGE * (options.times - 1); + var lastItems = BI.last(o.items, lastNum); + var nextItems = BI.first(lastItems, this._const.PAGE); + return nextItems; + }, + + populate: function (items) { + this.loader.populate(items); + }, + + addItems: function (items) { + this.loader.addItems(items); + }, + + empty: function () { + this.loader.empty(); + }, + + setNotSelectedValue: function () { + this.loader.setNotSelectedValue.apply(this.loader, arguments); + }, + + getNotSelectedValue: function () { + return this.loader.getNotSelectedValue(); + }, + + setValue: function () { + this.loader.setValue.apply(this.loader, arguments); + }, + + getValue: function () { + return this.loader.getValue.apply(this.loader, arguments); + }, + + getAllButtons: function () { + return this.loader.getAllButtons(); + }, + + getAllLeaves: function () { + return this.loader.getAllLeaves(); + }, + + getSelectedButtons: function () { + return this.loader.getSelectedButtons(); + }, + + getNotSelectedButtons: function () { + return this.loader.getNotSelectedButtons(); + }, + + getIndexByValue: function (value) { + return this.loader.getIndexByValue(value); + }, + + getNodeById: function (id) { + return this.loader.getNodeById(id); + }, + + getNodeByValue: function (value) { + return this.loader.getNodeByValue(value); + } +}); +BI.LazyLoader.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.lazy_loader", BI.LazyLoader);/** + * 恶心的加载控件, 为解决排序问题引入的控件 + * + * Created by GUY on 2015/11/12. + * @class BI.ListLoader + * @extends BI.Widget + */ +BI.ListLoader = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.ListLoader.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-list-loader", + + isDefaultInit: true,//是否默认初始化数据 + + //下面是button_group的属性 + el: { + type: "bi.button_group" + }, + + items: [], + itemsCreator: BI.emptyFn, + onLoaded: BI.emptyFn, + + //下面是分页信息 + count: false, + next: {}, + hasNext: BI.emptyFn + }) + }, + + _nextLoad: function () { + var self = this, o = this.options; + this.next.setLoading(); + o.itemsCreator.apply(this, [{times: ++this.times}, function () { + self.next.setLoaded(); + self.addItems.apply(self, arguments); + }]); + }, + + _init: function () { + BI.ListLoader.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (o.itemsCreator === false) { + o.next = false; + } + + this.button_group = BI.createWidget(o.el, { + type: "bi.button_group", + element: this, + chooseType: 0, + items: o.items, + behaviors: {}, + layouts: [{ + type: "bi.vertical" + }] + }); + this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.ListLoader.EVENT_CHANGE, obj); + } + }); + + if (o.next !== false) { + this.next = BI.createWidget(BI.extend({ + type: "bi.loading_bar" + }, o.next)); + this.next.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self._nextLoad(); + } + }) + } + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.next] + }); + + o.isDefaultInit && BI.isEmpty(o.items) && BI.nextTick(BI.bind(function () { + this.populate(); + }, this)); + if (BI.isNotEmptyArray(o.items)) { + this.populate(o.items); + } + }, + + hasNext: function () { + var o = this.options; + if (BI.isNumber(o.count)) { + return this.count < o.count; + } + return !!o.hasNext.apply(this, [{ + times: this.times, + count: this.count + }]) + }, + + addItems: function (items) { + this.count += items.length; + if (BI.isObject(this.next)) { + if (this.hasNext()) { + this.options.items = this.options.items.concat(items); + this.next.setLoaded(); + } else { + this.next.setEnd(); + } + } + this.button_group.addItems.apply(this.button_group, arguments); + this.next.element.appendTo(this.element); + }, + + populate: function (items) { + var self = this, o = this.options; + if (arguments.length === 0 && (BI.isFunction(o.itemsCreator))) { + o.itemsCreator.apply(this, [{times: 1}, function () { + if (arguments.length === 0) { + throw new Error("参数不能为空"); + } + self.populate.apply(self, arguments); + o.onLoaded(); + }]); + return; + } + this.options.items = items; + this.times = 1; + this.count = 0; + this.count += items.length; + if (BI.isObject(this.next)) { + if (this.hasNext()) { + this.next.setLoaded(); + } else { + this.next.invisible(); + } + } + BI.DOM.hang([this.next]); + this.button_group.populate.apply(this.button_group, arguments); + this.next.element.appendTo(this.element); + }, + + empty: function () { + BI.DOM.hang([this.next]); + this.button_group.empty(); + this.next.element.appendTo(this.element); + BI.each([this.next], function (i, ob) { + ob && ob.setVisible(false); + }); + }, + + setNotSelectedValue: function () { + this.button_group.setNotSelectedValue.apply(this.button_group, arguments); + }, + + getNotSelectedValue: function () { + return this.button_group.getNotSelectedValue(); + }, + + setValue: function () { + this.button_group.setValue.apply(this.button_group, arguments); + }, + + getValue: function () { + return this.button_group.getValue.apply(this.button_group, arguments); + }, + + getAllButtons: function () { + return this.button_group.getAllButtons(); + }, + + getAllLeaves: function () { + return this.button_group.getAllLeaves(); + }, + + getSelectedButtons: function () { + return this.button_group.getSelectedButtons(); + }, + + getNotSelectedButtons: function () { + return this.button_group.getNotSelectedButtons(); + }, + + getIndexByValue: function (value) { + return this.button_group.getIndexByValue(value); + }, + + getNodeById: function (id) { + return this.button_group.getNodeById(id); + }, + + getNodeByValue: function (value) { + return this.button_group.getNodeByValue(value); + } +}); +BI.ListLoader.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.list_loader", BI.ListLoader);/** + * Created by GUY on 2016/4/29. + * + * @class BI.SortList + * @extends BI.Widget + */ +BI.SortList = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.SortList.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-sort-list", + + isDefaultInit: true,//是否默认初始化数据 + + //下面是button_group的属性 + el: { + type: "bi.button_group" + }, + + items: [], + itemsCreator: BI.emptyFn, + onLoaded: BI.emptyFn, + + //下面是分页信息 + count: false, + next: {}, + hasNext: BI.emptyFn + + //containment: this.element, + //connectWith: ".bi-sort-list", + }) + }, + + _init: function () { + BI.SortList.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.loader = BI.createWidget({ + type: "bi.list_loader", + element: this, + isDefaultInit: o.isDefaultInit, + el: o.el, + items: this._formatItems(o.items), + itemsCreator: function (op, callback) { + o.itemsCreator(op, function (items) { + callback(self._formatItems(items)); + }); + }, + onLoaded: o.onLoaded, + count: o.count, + next: o.next, + hasNext: o.hasNext + }); + this.loader.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.SortList.EVENT_CHANGE, value, obj); + } + }); + + this.loader.element.sortable({ + containment: o.containment || this.element, + connectWith: o.connectWith || ".bi-sort-list", + items: ".sort-item", + cursor: o.cursor || "drag", + tolerance: o.tolerance || "intersect", + placeholder: { + element: function ($currentItem) { + var holder = BI.createWidget({ + type: "bi.layout", + cls: "bi-sortable-holder", + height: $currentItem.outerHeight() + }); + holder.element.css({ + "margin-left": $currentItem.css("margin-left"), + "margin-right": $currentItem.css("margin-right"), + "margin-top": $currentItem.css("margin-top"), + "margin-bottom": $currentItem.css("margin-bottom"), + "margin": $currentItem.css("margin") + }); + return holder.element; + }, + update: function () { + + } + }, + start: function (event, ui) { + + }, + stop: function (event, ui) { + self.fireEvent(BI.SortList.EVENT_CHANGE); + }, + over: function (event, ui) { + + } + }); + }, + + _formatItems: function (items) { + BI.each(items, function (i, item) { + item = BI.stripEL(item); + item.cls = item.cls ? item.cls + " sort-item" : "sort-item"; + item.attributes = { + sorted: item.value + }; + }); + return items; + }, + + hasNext: function () { + return this.loader.hasNext(); + }, + + addItems: function (items) { + this.loader.addItems(items); + }, + + populate: function (items) { + if (items) { + arguments[0] = this._formatItems(items); + } + this.loader.populate.apply(this.loader, arguments); + }, + + empty: function () { + this.loader.empty(); + }, + + setNotSelectedValue: function () { + this.loader.setNotSelectedValue.apply(this.loader, arguments); + }, + + getNotSelectedValue: function () { + return this.loader.getNotSelectedValue(); + }, + + setValue: function () { + this.loader.setValue.apply(this.loader, arguments); + }, + + getValue: function () { + return this.loader.getValue(); + }, + + getAllButtons: function () { + return this.loader.getAllButtons(); + }, + + getAllLeaves: function () { + return this.loader.getAllLeaves(); + }, + + getSelectedButtons: function () { + return this.loader.getSelectedButtons(); + }, + + getNotSelectedButtons: function () { + return this.loader.getNotSelectedButtons(); + }, + + getIndexByValue: function (value) { + return this.loader.getIndexByValue(value); + }, + + getNodeById: function (id) { + return this.loader.getNodeById(id); + }, + + getNodeByValue: function (value) { + return this.loader.getNodeByValue(value); + }, + + getSortedValues: function () { + return this.loader.element.sortable("toArray", {attribute: "sorted"}); + } +}); +BI.SortList.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.sort_list", BI.SortList);/** + * 有总页数和总行数的分页控件 + * Created by Young's on 2016/10/13. + */ +BI.AllCountPager = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.AllCountPager.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-all-count-pager", + height: 30, + pages: 1, //必选项 + curr: 1, //初始化当前页, pages为数字时可用, + count: 1 //总行数 + }) + }, + _init: function () { + BI.AllCountPager.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.small_text_editor", + cls: "pager-editor", + validationChecker: function (v) { + return (self.rowCount.getValue() === 0 && v === "0") || BI.isPositiveInteger(v); + }, + hgap: 4, + vgap: 0, + value: o.curr, + errorText: BI.i18nText("BI-Please_Input_Positive_Integer"), + width: 35, + height: 20 + }); + + this.pager = BI.createWidget({ + type: "bi.pager", + width: 36, + layouts: [{ + type: "bi.horizontal", + hgap: 1, + vgap: 1 + }], + + dynamicShow: false, + pages: o.pages, + curr: o.curr, + groups: 0, + + first: false, + last: false, + prev: { + type: "bi.icon_button", + value: "prev", + title: BI.i18nText("BI-Previous_Page"), + warningTitle: BI.i18nText("BI-Current_Is_First_Page"), + height: 20, + cls: "all-pager-prev column-pre-page-h-font" + }, + next: { + type: "bi.icon_button", + value: "next", + title: BI.i18nText("BI-Next_Page"), + warningTitle: BI.i18nText("BI-Current_Is_Last_Page"), + height: 20, + cls: "all-pager-next column-next-page-h-font" + }, + + hasPrev: o.hasPrev, + hasNext: o.hasNext, + firstPage: o.firstPage, + lastPage: o.lastPage + }); + + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function () { + self.pager.setValue(BI.parseInt(self.editor.getValue())); + self.fireEvent(BI.AllCountPager.EVENT_CHANGE); + }); + this.pager.on(BI.Pager.EVENT_CHANGE, function () { + self.fireEvent(BI.AllCountPager.EVENT_CHANGE); + }); + this.pager.on(BI.Pager.EVENT_AFTER_POPULATE, function () { + self.editor.setValue(self.pager.getCurrentPage()); + }); + + this.allPages = BI.createWidget({ + type: "bi.label", + width: 30, + title: o.pages, + text: "/" + o.pages + }); + + this.rowCount = BI.createWidget({ + type: "bi.label", + height: o.height, + hgap: 5, + text: o.count, + title: o.count + }); + + var count = BI.createWidget({ + type: "bi.left", + height: o.height, + scrollable: false, + items: [{ + type: "bi.label", + height: o.height, + text: BI.i18nText("BI-Basic_Total"), + width: 15 + }, this.rowCount, { + type: "bi.label", + height: o.height, + text: BI.i18nText("BI-Tiao_Data"), + width: 50, + textAlign: "left" + }] + }); + BI.createWidget({ + type: "bi.center_adapt", + element: this, + columnSize: ["", 35, 40, 36], + items: [count, this.editor, this.allPages, this.pager] + }) + }, + + alwaysShowPager: true, + + setAllPages: function (v) { + this.allPages.setText("/" + v); + this.allPages.setTitle(v); + this.pager.setAllPages(v); + this.editor.setEnable(v >= 1); + }, + + setValue: function (v) { + this.pager.setValue(v); + }, + + setVPage: function (v) { + this.pager.setValue(v); + }, + + setCount: function (count) { + this.rowCount.setText(count); + this.rowCount.setTitle(count); + }, + + getCurrentPage: function () { + return this.pager.getCurrentPage(); + }, + + hasPrev: function () { + return this.pager.hasPrev(); + }, + + hasNext: function () { + return this.pager.hasNext(); + }, + + setPagerVisible: function (b) { + this.editor.setVisible(b); + this.allPages.setVisible(b); + this.pager.setVisible(b); + }, + + populate: function () { + this.pager.populate(); + } +}); +BI.AllCountPager.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.all_count_pager", BI.AllCountPager);/** + * 显示页码的分页控件 + * + * Created by GUY on 2016/6/30. + * @class BI.DirectionPager + * @extends BI.Widget + */ +BI.DirectionPager = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.DirectionPager.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-direction-pager", + height: 30, + horizontal: { + pages: false, //总页数 + curr: 1, //初始化当前页, pages为数字时可用 + + hasPrev: BI.emptyFn, + hasNext: BI.emptyFn, + firstPage: 1, + lastPage: BI.emptyFn + }, + vertical: { + pages: false, //总页数 + curr: 1, //初始化当前页, pages为数字时可用 + + hasPrev: BI.emptyFn, + hasNext: BI.emptyFn, + firstPage: 1, + lastPage: BI.emptyFn + } + }) + }, + _init: function () { + BI.DirectionPager.superclass._init.apply(this, arguments); + var self = this, o = this.options; + var v = o.vertical, h = o.horizontal; + this._createVPager(); + this._createHPager(); + this.layout = BI.createWidget({ + type: "bi.absolute", + scrollable: false, + element: this, + items: [{ + el: this.vpager, + top: 5, + right: 74 + }, { + el: this.vlabel, + top: 5, + right: 111 + }, { + el: this.hpager, + top: 5, + right: -9 + }, { + el: this.hlabel, + top: 5, + right: 28 + }] + }); + }, + + _createVPager: function () { + var self = this, o = this.options; + var v = o.vertical; + this.vlabel = BI.createWidget({ + type: "bi.label", + width: 24, + height: 20, + value: v.curr, + title: v.curr + }); + this.vpager = BI.createWidget({ + type: "bi.pager", + width: 76, + layouts: [{ + type: "bi.horizontal", + scrollx: false, + rgap: 24, + vgap: 1 + }], + + dynamicShow: false, + pages: v.pages, + curr: v.curr, + groups: 0, + + first: false, + last: false, + prev: { + type: "bi.icon_button", + value: "prev", + title: BI.i18nText("BI-Up_Page"), + warningTitle: BI.i18nText("BI-Current_Is_First_Page"), + height: 20, + iconWidth: 16, + iconHeight: 16, + cls: "direction-pager-prev column-pre-page-h-font" + }, + next: { + type: "bi.icon_button", + value: "next", + title: BI.i18nText("BI-Down_Page"), + warningTitle: BI.i18nText("BI-Current_Is_Last_Page"), + height: 20, + iconWidth: 16, + iconHeight: 16, + cls: "direction-pager-next column-next-page-h-font" + }, + + hasPrev: v.hasPrev, + hasNext: v.hasNext, + firstPage: v.firstPage, + lastPage: v.lastPage + }); + + this.vpager.on(BI.Pager.EVENT_CHANGE, function () { + self.fireEvent(BI.DirectionPager.EVENT_CHANGE); + }); + this.vpager.on(BI.Pager.EVENT_AFTER_POPULATE, function () { + self.vlabel.setValue(this.getCurrentPage()); + self.vlabel.setTitle(this.getCurrentPage()); + }); + }, + + _createHPager: function () { + var self = this, o = this.options; + var h = o.horizontal; + this.hlabel = BI.createWidget({ + type: "bi.label", + width: 24, + height: 20, + value: h.curr, + title: h.curr + }); + this.hpager = BI.createWidget({ + type: "bi.pager", + width: 76, + layouts: [{ + type: "bi.horizontal", + scrollx: false, + rgap: 24, + vgap: 1 + }], + + dynamicShow: false, + pages: h.pages, + curr: h.curr, + groups: 0, + + first: false, + last: false, + prev: { + type: "bi.icon_button", + value: "prev", + title: BI.i18nText("BI-Left_Page"), + warningTitle: BI.i18nText("BI-Current_Is_First_Page"), + height: 20, + iconWidth: 16, + iconHeight: 16, + cls: "direction-pager-prev row-pre-page-h-font" + }, + next: { + type: "bi.icon_button", + value: "next", + title: BI.i18nText("BI-Right_Page"), + warningTitle: BI.i18nText("BI-Current_Is_Last_Page"), + height: 20, + iconWidth: 16, + iconHeight: 16, + cls: "direction-pager-next row-next-page-h-font" + }, + + hasPrev: h.hasPrev, + hasNext: h.hasNext, + firstPage: h.firstPage, + lastPage: h.lastPage + }); + + this.hpager.on(BI.Pager.EVENT_CHANGE, function () { + self.fireEvent(BI.DirectionPager.EVENT_CHANGE); + }); + this.hpager.on(BI.Pager.EVENT_AFTER_POPULATE, function () { + self.hlabel.setValue(this.getCurrentPage()); + self.hlabel.setTitle(this.getCurrentPage()); + }); + }, + + getVPage: function () { + return this.vpager.getCurrentPage(); + }, + + getHPage: function () { + return this.hpager.getCurrentPage(); + }, + + setVPage: function (v) { + this.vpager.setValue(v); + this.vlabel.setValue(v); + this.vlabel.setTitle(v); + }, + + setHPage: function (v) { + this.hpager.setValue(v); + this.hlabel.setValue(v); + this.hlabel.setTitle(v); + }, + + hasVNext: function () { + return this.vpager.hasNext(); + }, + + hasHNext: function () { + return this.hpager.hasNext(); + }, + + hasVPrev: function () { + return this.vpager.hasPrev(); + }, + + hasHPrev: function () { + return this.hpager.hasPrev(); + }, + + setHPagerVisible: function (b) { + this.hpager.setVisible(b); + this.hlabel.setVisible(b); + }, + + setVPagerVisible: function (b) { + this.vpager.setVisible(b); + this.vlabel.setVisible(b); + }, + + populate: function () { + this.vpager.populate(); + this.hpager.populate(); + var vShow = false, hShow = false; + if (!this.hasHNext() && !this.hasHPrev()) { + this.setHPagerVisible(false); + } else { + this.setHPagerVisible(true); + hShow = true; + } + if (!this.hasVNext() && !this.hasVPrev()) { + this.setVPagerVisible(false); + } else { + this.setVPagerVisible(true); + vShow = true; + } + this.setVisible(hShow || vShow); + var num = [74, 111, -9, 28]; + var items = this.layout.attr("items"); + + if (vShow === true && hShow === true) { + items[0].right = num[0]; + items[1].right = num[1]; + items[2].right = num[2]; + items[3].right = num[3]; + } else if (vShow === true) { + items[0].right = num[2]; + items[1].right = num[3]; + } else if (hShow === true) { + items[2].right = num[2]; + items[3].right = num[3]; + } + this.layout.attr("items", items); + this.layout.resize(); + }, + + clear: function () { + this.vpager.attr("curr", 1); + this.hpager.attr("curr", 1); + } +}); +BI.DirectionPager.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.direction_pager", BI.DirectionPager);/** + * 分页控件 + * + * Created by GUY on 2015/8/31. + * @class BI.DetailPager + * @extends BI.Widget + */ +BI.DetailPager = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.DetailPager.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-detail-pager", + behaviors: {}, + layouts: [{ + type: "bi.horizontal", + hgap: 10, + vgap: 0 + }], + + dynamicShow: true, //是否动态显示上一页、下一页、首页、尾页, 若为false,则指对其设置使能状态 + //dynamicShow为false时以下两个有用 + dynamicShowFirstLast: false,//是否动态显示首页、尾页 + dynamicShowPrevNext: false,//是否动态显示上一页、下一页 + pages: false, //总页数 + curr: function () { + return 1; + }, //初始化当前页 + groups: 0, //连续显示分页数 + jump: BI.emptyFn, //分页的回调函数 + + first: false, //是否显示首页 + last: false, //是否显示尾页 + prev: "上一页", + next: "下一页", + + firstPage: 1, + lastPage: function () { //在万不得已时才会调用这个函数获取最后一页的页码, 主要作用于setValue方法 + return 1; + }, + hasPrev: BI.emptyFn, //pages不可用时有效 + hasNext: BI.emptyFn //pages不可用时有效 + }) + }, + _init: function () { + BI.DetailPager.superclass._init.apply(this, arguments); + var self = this; + this.currPage = BI.result(this.options, "curr"); + //翻页太灵敏 + this._lock = false; + this._debouce = BI.debounce(function () { + self._lock = false; + }, 300); + this._populate(); + }, + + _populate: function () { + var self = this, o = this.options, view = [], dict = {}; + this.empty(); + var pages = BI.result(o, "pages"); + var curr = BI.result(this, "currPage"); + var groups = BI.result(o, "groups"); + var first = BI.result(o, "first"); + var last = BI.result(o, "last"); + var prev = BI.result(o, "prev"); + var next = BI.result(o, "next"); + + if (pages === false) { + groups = 0; + first = false; + last = false; + } else { + groups > pages && (groups = pages); + } + + //计算当前组 + dict.index = Math.ceil((curr + ((groups > 1 && groups !== pages) ? 1 : 0)) / (groups === 0 ? 1 : groups)); + + //当前页非首页,则输出上一页 + if (((!o.dynamicShow && !o.dynamicShowPrevNext) || curr > 1) && prev !== false) { + if (BI.isKey(prev)) { + view.push({ + text: prev, + value: "prev", + disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false) + }) + } else { + view.push(BI.extend({ + disabled: pages === false ? o.hasPrev(curr) === false : !(curr > 1 && prev !== false) + }, prev)); + } + } + + //当前组非首组,则输出首页 + if (((!o.dynamicShow && !o.dynamicShowFirstLast) || (dict.index > 1 && groups !== 0)) && first) { + view.push({ + text: first, + value: "first", + disabled: !(dict.index > 1 && groups !== 0) + }); + if (dict.index > 1 && groups !== 0) { + view.push({ + type: "bi.label", + cls: "page-ellipsis", + text: "\u2026" + }); + } + } + + //输出当前页组 + dict.poor = Math.floor((groups - 1) / 2); + dict.start = dict.index > 1 ? curr - dict.poor : 1; + dict.end = dict.index > 1 ? (function () { + var max = curr + (groups - dict.poor - 1); + return max > pages ? pages : max; + }()) : groups; + if (dict.end - dict.start < groups - 1) { //最后一组状态 + dict.start = dict.end - groups + 1; + } + var s = dict.start, e = dict.end; + if (first && last && (dict.index > 1 && groups !== 0) && (pages > groups && dict.end < pages && groups !== 0)) { + s++; + e--; + } + for (; s <= e; s++) { + if (s === curr) { + view.push({ + text: s, + value: s, + selected: true + }) + } else { + view.push({ + text: s, + value: s + }) + } + } + + //总页数大于连续分页数,且当前组最大页小于总页,输出尾页 + if (((!o.dynamicShow && !o.dynamicShowFirstLast) || (pages > groups && dict.end < pages && groups !== 0)) && last) { + if (pages > groups && dict.end < pages && groups !== 0) { + view.push({ + type: "bi.label", + cls: "page-ellipsis", + text: "\u2026" + }); + } + view.push({ + text: last, + value: "last", + disabled: !(pages > groups && dict.end < pages && groups !== 0) + }) + } + + //当前页不为尾页时,输出下一页 + dict.flow = !prev && groups === 0; + if (((!o.dynamicShow && !o.dynamicShowPrevNext) && next) || (curr !== pages && next || dict.flow)) { + view.push((function () { + if (BI.isKey(next)) { + if (pages === false) { + return {text: next, value: "next", disabled: o.hasNext(curr) === false} + } + return (dict.flow && curr === pages) + ? + {text: next, value: "next", disabled: true} + : + {text: next, value: "next", disabled: !(curr !== pages && next || dict.flow)}; + } else { + return BI.extend({ + disabled: pages === false ? o.hasNext(curr) === false : !(curr !== pages && next || dict.flow) + }, next); + } + }())); + } + + this.button_group = BI.createWidget({ + type: "bi.button_group", + element: this, + items: BI.createItems(view, { + cls: "page-item bi-border bi-list-item-active", + height: 23, + hgap: 10 + }), + behaviors: o.behaviors, + layouts: o.layouts + }); + this.button_group.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { + if (self._lock === true) { + return; + } + self._lock = true; + self._debouce(); + if (type === BI.Events.CLICK) { + var v = self.button_group.getValue()[0]; + switch (v) { + case "first": + self.currPage = 1; + break; + case "last": + self.currPage = pages; + break; + case "prev": + self.currPage--; + break; + case "next": + self.currPage++; + break; + default: + self.currPage = v; + break; + } + o.jump.apply(self, [{ + pages: pages, + curr: self.currPage + }]); + self._populate(); + self.fireEvent(BI.DetailPager.EVENT_CHANGE, obj); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.fireEvent(BI.DetailPager.EVENT_AFTER_POPULATE); + }, + + getCurrentPage: function () { + return this.currPage; + }, + + setAllPages: function (pages) { + this.options.pages = pages; + }, + + hasPrev: function (v) { + v || (v = 1); + var o = this.options; + var pages = this.options.pages; + return pages === false ? o.hasPrev(v) : v > 1; + }, + + hasNext: function (v) { + v || (v = 1); + var o = this.options; + var pages = this.options.pages; + return pages === false ? o.hasNext(v) : v < pages; + }, + + setValue: function (v) { + var o = this.options; + v = v | 0; + v = v < 1 ? 1 : v; + if (o.pages === false) { + var lastPage = BI.result(o, "lastPage"), firstPage = 1; + this.currPage = v > lastPage ? lastPage : ((firstPage = BI.result(o, "firstPage")), (v < firstPage ? firstPage : v)); + } else { + v = v > o.pages ? o.pages : v; + this.currPage = v; + } + this._populate(); + }, + + getValue: function () { + var val = this.button_group.getValue()[0]; + switch (val) { + case "prev": + return -1; + case "next": + return 1; + case "first": + return BI.MIN; + case "last": + return BI.MAX; + default : + return val; + } + }, + + attr: function (key, value) { + BI.DetailPager.superclass.attr.apply(this, arguments); + if (key === "curr") { + this.currPage = BI.result(this.options, "curr"); + } + }, + + populate: function () { + this._populate(); + } +}); +BI.DetailPager.EVENT_CHANGE = "EVENT_CHANGE"; +BI.DetailPager.EVENT_AFTER_POPULATE = "EVENT_AFTER_POPULATE"; +BI.shortcut("bi.detail_pager", BI.DetailPager);/** + * 分段控件使用的button + * + * Created by GUY on 2015/9/7. + * @class BI.SegmentButton + * @extends BI.BasicButton + */ +BI.SegmentButton = BI.inherit(BI.BasicButton, { + + _defaultConfig: function () { + var conf = BI.SegmentButton.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + ' bi-segment-button bi-list-item-active', + shadow: true, + readonly: true, + hgap: 5 + }) + }, + + _init: function () { + BI.SegmentButton.superclass._init.apply(this, arguments); + var opts = this.options, self = this; + //if (BI.isNumber(opts.height) && BI.isNull(opts.lineHeight)) { + // this.element.css({lineHeight : (opts.height - 2) + 'px'}); + //} + this.text = BI.createWidget({ + type: "bi.label", + element: this, + height: opts.height - 2, + whiteSpace: opts.whiteSpace, + text: opts.text, + value: opts.value, + hgap: opts.hgap + }) + }, + + setSelected: function () { + BI.SegmentButton.superclass.setSelected.apply(this, arguments); + }, + + setText: function (text) { + BI.SegmentButton.superclass.setText.apply(this, arguments); + this.text.setText(text); + }, + + destroy: function () { + BI.SegmentButton.superclass.destroy.apply(this, arguments); + } +}); +BI.shortcut('bi.segment_button', BI.SegmentButton);/** + * 单选按钮组 + * + * Created by GUY on 2015/9/7. + * @class BI.Segment + * @extends BI.Widget + */ +BI.Segment = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.Segment.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-segment", + items: [], + height: 30 + }); + }, + _init: function () { + BI.Segment.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.buttonGroup = BI.createWidget({ + element: this, + type: "bi.button_group", + items: BI.createItems(o.items, { + type: "bi.segment_button", + height: o.height - 2, + whiteSpace: o.whiteSpace + }), + layout: [ + { + type: "bi.center" + } + ] + }) + this.buttonGroup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments) + }); + this.buttonGroup.on(BI.ButtonGroup.EVENT_CHANGE, function (value, obj) { + self.fireEvent(BI.Segment.EVENT_CHANGE, value, obj) + }) + }, + + setValue: function (v) { + this.buttonGroup.setValue(v); + }, + + setEnabledValue: function (v) { + this.buttonGroup.setEnabledValue(v); + }, + + getValue: function () { + return this.buttonGroup.getValue(); + } +}); +BI.Segment.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.segment', BI.Segment);/** + * 自适应宽度的表格 + * + * Created by GUY on 2016/2/3. + * @class BI.AdaptiveTable + * @extends BI.Widget + */ +BI.AdaptiveTable = BI.inherit(BI.Widget, { + + _const: { + perColumnSize: 100 + }, + + _defaultConfig: function () { + return BI.extend(BI.AdaptiveTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-adaptive-table", + el: { + type: "bi.resizable_table" + }, + isNeedResize: true, + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 + + isNeedMerge: false,//是否需要合并单元格 + mergeCols: [], //合并的单元格列号 + mergeRule: BI.emptyFn, + + columnSize: [], + minColumnSize: [], + maxColumnSize: [], + + headerRowSize: 25, + rowSize: 25, + + regionColumnSize: [], + + header: [], + items: [], //二维数组 + + //交叉表头 + crossHeader: [], + crossItems: [] + }); + }, + + _init: function () { + BI.AdaptiveTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + var data = this._digest(); + this.table = BI.createWidget(o.el, { + type: "bi.resizable_table", + element: this, + width: o.width, + height: o.height, + isNeedResize: o.isNeedResize, + isResizeAdapt: false, + + isNeedFreeze: o.isNeedFreeze, + freezeCols: data.freezeCols, + + isNeedMerge: o.isNeedMerge, + mergeCols: o.mergeCols, + mergeRule: o.mergeRule, + + columnSize: data.columnSize, + + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + + regionColumnSize: data.regionColumnSize, + + header: o.header, + items: o.items, + //交叉表头 + crossHeader: o.crossHeader, + crossItems: o.crossItems + }); + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + self._populate(); + self.table.populate(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); + }); + + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + o.columnSize = this.getColumnSize(); + self._populate(); + self.table.populate(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); + }); + }, + + _getFreezeColLength: function () { + return this.options.isNeedFreeze === true ? this.options.freezeCols.length : 0; + }, + + _digest: function () { + var o = this.options; + var columnSize = o.columnSize.slice(); + var regionColumnSize = o.regionColumnSize.slice(); + var freezeCols = o.freezeCols.slice(); + var regionSize = o.regionColumnSize[0]; + var freezeColLength = this._getFreezeColLength(); + if (!regionSize || regionSize > o.width - 10 || regionSize < 10) { + regionSize = (freezeColLength > o.columnSize.length / 2 ? 2 / 3 : 1 / 3) * o.width; + } + if (freezeColLength === 0) { + regionSize = 0; + } + if (freezeCols.length >= columnSize.length) { + freezeCols = []; + } + if (!BI.isNumber(columnSize[0])) { + columnSize = o.minColumnSize.slice(); + } + var summaryFreezeColumnSize = 0, summaryColumnSize = 0; + BI.each(columnSize, function (i, size) { + if (i < freezeColLength) { + summaryFreezeColumnSize += size; + } + summaryColumnSize += size; + }); + if (freezeColLength > 0) { + columnSize[freezeColLength - 1] = BI.clamp(regionSize - (summaryFreezeColumnSize - columnSize[freezeColLength - 1]), + o.minColumnSize[freezeColLength - 1] || 10, o.maxColumnSize[freezeColLength - 1] || Number.MAX_VALUE); + } + if (columnSize.length > 0) { + columnSize[columnSize.length - 1] = BI.clamp(o.width - BI.GridTableScrollbar.SIZE - regionSize - (summaryColumnSize - summaryFreezeColumnSize - columnSize[columnSize.length - 1]), + o.minColumnSize[columnSize.length - 1] || 10, o.maxColumnSize[columnSize.length - 1] || Number.MAX_VALUE); + } + regionColumnSize[0] = regionSize; + + return { + freezeCols: freezeCols, + columnSize: columnSize, + regionColumnSize: regionColumnSize + } + }, + + _populate: function () { + var o = this.options; + var data = this._digest(); + o.regionColumnSize = data.regionColumnSize; + o.columnSize = data.columnSize; + this.table.setColumnSize(data.columnSize); + this.table.setRegionColumnSize(data.regionColumnSize); + this.table.attr("freezeCols", data.freezeCols); + }, + + setWidth: function (width) { + BI.AdaptiveTable.superclass.setWidth.apply(this, arguments); + this.table.setWidth(width); + }, + + setHeight: function (height) { + BI.AdaptiveTable.superclass.setHeight.apply(this, arguments); + this.table.setHeight(height); + }, + + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + }, + + getColumnSize: function () { + return this.table.getColumnSize(); + }, + + setRegionColumnSize: function (regionColumnSize) { + this.options.regionColumnSize = regionColumnSize; + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, + + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + attr: function (key, value) { + var v = BI.AdaptiveTable.superclass.attr.apply(this, arguments); + if (key === "freezeCols") { + return v; + } + return this.table.attr.apply(this.table, arguments); + }, + + restore: function () { + this.table.restore(); + }, + + populate: function (items) { + var self = this, o = this.options; + this._populate(); + this.table.populate.apply(this.table, arguments); + }, + + destroy: function () { + this.table.destroy(); + BI.AdaptiveTable.superclass.destroy.apply(this, arguments); + } +}); +BI.shortcut('bi.adaptive_table', BI.AdaptiveTable);/** + * + * 层级树状结构的表格 + * + * Created by GUY on 2016/8/12. + * @class BI.DynamicSummaryLayerTreeTable + * @extends BI.Widget + */ +BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.DynamicSummaryLayerTreeTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-dynamic-summary-layer-tree-table", + + el: { + type: "bi.resizable_table" + }, + isNeedResize: true,//是否需要调整列宽 + isResizeAdapt: true,//是否需要在调整列宽或区域宽度的时候它们自适应变化 + + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为tree时生效 + + isNeedMerge: true,//是否需要合并单元格 + mergeCols: [], + mergeRule: BI.emptyFn, + + columnSize: [], + minColumnSize: [], + maxColumnSize: [], + headerRowSize: 25, + footerRowSize: 25, + rowSize: 25, + + regionColumnSize: [], + + //行表头 + rowHeaderCreator: null, + + headerCellStyleGetter: BI.emptyFn, + summaryCellStyleGetter: BI.emptyFn, + sequenceCellStyleGetter: BI.emptyFn, + + header: [], + footer: false, + items: [], + + //交叉表头 + crossHeader: [], + crossItems: [] + }) + }, + + _getVDeep: function () { + return this.options.crossHeader.length;//纵向深度 + }, + + _getHDeep: function () { + var o = this.options; + return Math.max(o.mergeCols.length, o.freezeCols.length, BI.TableTree.maxDeep(o.items) - 1); + }, + + _createHeader: function (vDeep) { + var self = this, o = this.options; + var header = o.header || [], crossHeader = o.crossHeader || []; + var items = BI.TableTree.formatCrossItems(o.crossItems, vDeep, o.headerCellStyleGetter); + var result = []; + BI.each(items, function (row, node) { + var c = [crossHeader[row]]; + result.push(c.concat(node || [])); + }); + if (header && header.length > 0) { + var newHeader = this._formatColumns(header); + var deep = this._getHDeep(); + if (deep <= 0) { + newHeader.unshift(o.rowHeaderCreator || { + type: "bi.table_style_cell", + text: BI.i18nText("BI-Row_Header"), + styleGetter: o.headerCellStyleGetter + }); + } else { + newHeader[0] = o.rowHeaderCreator || { + type: "bi.table_style_cell", + text: BI.i18nText("BI-Row_Header"), + styleGetter: o.headerCellStyleGetter + }; + } + result.push(newHeader); + } + return result; + }, + + _formatItems: function (nodes, header, deep) { + var self = this, o = this.options; + var result = []; + + function track(node, layer) { + node.type || (node.type = "bi.layer_tree_table_cell"); + node.layer = layer; + var next = [node]; + next = next.concat(node.values || []); + if (next.length > 0) { + result.push(next); + } + if (BI.isNotEmptyArray(node.children)) { + BI.each(node.children, function (index, child) { + track(child, layer + 1); + }); + } + } + + BI.each(nodes, function (i, node) { + BI.each(node.children, function (j, c) { + track(c, 0); + }); + if (BI.isArray(node.values)) { + var next = [{ + type: "bi.table_style_cell", + text: BI.i18nText("BI-Summary_Values"), + styleGetter: function () { + return o.summaryCellStyleGetter(true); + } + }].concat(node.values); + result.push(next) + } + }); + return BI.DynamicSummaryTreeTable.formatSummaryItems(result, header, o.crossItems, 1); + }, + + _formatColumns: function (columns, deep) { + if (BI.isNotEmptyArray(columns)) { + deep = deep || this._getHDeep(); + return columns.slice(Math.max(0, deep - 1)); + } + return columns; + }, + + _formatFreezeCols: function () { + if (this.options.freezeCols.length > 0) { + return [0]; + } + return []; + }, + + _formatColumnSize: function (columnSize, deep) { + if (columnSize.length <= 0) { + return []; + } + var result = [0]; + deep = deep || this._getHDeep(); + BI.each(columnSize, function (i, size) { + if (i < deep) { + result[0] += size; + return; + } + result.push(size); + }); + return result; + }, + + _recomputeColumnSize: function () { + var o = this.options; + o.regionColumnSize = this.table.getRegionColumnSize(); + var columnSize = this.table.getColumnSize().slice(); + if (o.freezeCols.length > 1) { + for (var i = 0; i < o.freezeCols.length - 1; i++) { + columnSize.splice(1, 0, 0); + } + } + o.columnSize = columnSize; + }, + + _digest: function () { + var o = this.options; + var deep = this._getHDeep(); + var vDeep = this._getVDeep(); + var header = this._createHeader(vDeep); + var data = this._formatItems(o.items, header, deep); + var columnSize = o.columnSize.slice(); + var minColumnSize = o.minColumnSize.slice(); + var maxColumnSize = o.maxColumnSize.slice(); + BI.removeAt(columnSize, data.deletedCols); + BI.removeAt(minColumnSize, data.deletedCols); + BI.removeAt(maxColumnSize, data.deletedCols); + return { + header: data.header, + items: data.items, + columnSize: this._formatColumnSize(columnSize, deep), + minColumnSize: this._formatColumns(minColumnSize, deep), + maxColumnSize: this._formatColumns(maxColumnSize, deep), + freezeCols: this._formatFreezeCols() + } + }, + + _init: function () { + BI.DynamicSummaryLayerTreeTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + var data = this._digest(); + this.table = BI.createWidget(o.el, { + type: "bi.resizable_table", + element: this, + width: o.width, + height: o.height, + isNeedResize: o.isNeedResize, + isResizeAdapt: o.isResizeAdapt, + isNeedFreeze: o.isNeedFreeze, + freezeCols: data.freezeCols, + isNeedMerge: o.isNeedMerge, + mergeCols: [], + mergeRule: o.mergeRule, + columnSize: data.columnSize, + minColumnSize: data.minColumnSize, + maxColumnSize: data.maxColumnSize, + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + regionColumnSize: o.regionColumnSize, + header: data.header, + items: data.items + }); + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + self._recomputeColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + self._recomputeColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); + }); + }, + + setWidth: function (width) { + BI.DynamicSummaryLayerTreeTable.superclass.setWidth.apply(this, arguments); + this.table.setWidth(width); + }, + + setHeight: function (height) { + BI.DynamicSummaryLayerTreeTable.superclass.setHeight.apply(this, arguments); + this.table.setHeight(height); + }, + + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + }, + + getColumnSize: function () { + return this.options.columnSize; + }, + + setRegionColumnSize: function (columnSize) { + this.options.regionColumnSize = columnSize; + this.table.setRegionColumnSize(columnSize); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, + + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + attr: function (key, value) { + var self = this; + if (BI.isObject(key)) { + BI.each(key, function (k, v) { + self.attr(k, v); + }); + return; + } + BI.DynamicSummaryLayerTreeTable.superclass.attr.apply(this, arguments); + switch (key) { + case "columnSize": + case "minColumnSize": + case "maxColumnSize": + case "freezeCols": + case "mergeCols": + return; + } + this.table.attr.apply(this.table, [key, value]); + }, + + restore: function () { + this.table.restore(); + }, + + populate: function (items, header, crossItems, crossHeader) { + var o = this.options; + if (items) { + o.items = items; + } + if (header) { + o.header = header; + } + if (crossItems) { + o.crossItems = crossItems; + } + if (crossHeader) { + o.crossHeader = crossHeader; + } + var data = this._digest(); + this.table.setColumnSize(data.columnSize); + this.table.attr("minColumnSize", data.minColumnSize); + this.table.attr("maxColumnSize", data.maxColumnSize); + this.table.attr("freezeCols", data.freezeCols); + this.table.populate(data.items, data.header); + }, + + destroy: function () { + this.table.destroy(); + BI.DynamicSummaryLayerTreeTable.superclass.destroy.apply(this, arguments); + } +}); + +BI.shortcut("bi.dynamic_summary_layer_tree_table", BI.DynamicSummaryLayerTreeTable);/** + * + * 树状结构的表格 + * + * Created by GUY on 2015/8/12. + * @class BI.DynamicSummaryTreeTable + * @extends BI.Widget + */ +BI.DynamicSummaryTreeTable = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.DynamicSummaryTreeTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-dynamic-summary-tree-table", + el: { + type: "bi.resizable_table" + }, + + isNeedResize: true,//是否需要调整列宽 + isResizeAdapt: true,//是否需要在调整列宽或区域宽度的时候它们自适应变化 + + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为tree时生效 + + isNeedMerge: true,//是否需要合并单元格 + mergeCols: [], + mergeRule: BI.emptyFn, + + columnSize: [], + minColumnSize: [], + maxColumnSize: [], + headerRowSize: 25, + footerRowSize: 25, + rowSize: 25, + + regionColumnSize: [], + + headerCellStyleGetter: BI.emptyFn, + summaryCellStyleGetter: BI.emptyFn, + sequenceCellStyleGetter: BI.emptyFn, + + header: [], + footer: false, + items: [], + + //交叉表头 + crossHeader: [], + crossItems: [] + }) + }, + + _getVDeep: function () { + return this.options.crossHeader.length;//纵向深度 + }, + + _getHDeep: function () { + var o = this.options; + return Math.max(o.mergeCols.length, o.freezeCols.length, BI.TableTree.maxDeep(o.items) - 1); + }, + + _init: function () { + BI.DynamicSummaryTreeTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + var data = this._digest(); + this.table = BI.createWidget(o.el, { + type: "bi.resizable_table", + element: this, + width: o.width, + height: o.height, + + isNeedResize: o.isNeedResize, + isResizeAdapt: o.isResizeAdapt, + + isNeedFreeze: o.isNeedFreeze, + freezeCols: o.freezeCols, + isNeedMerge: o.isNeedMerge, + mergeCols: o.mergeCols, + mergeRule: o.mergeRule, + + columnSize: o.columnSize, + minColumnSize: o.minColumnSize, + maxColumnSize: o.maxColumnSize, + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + + regionColumnSize: o.regionColumnSize, + + header: data.header, + items: data.items + }); + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + var columnSize = this.getColumnSize(); + var length = o.columnSize.length - columnSize.length; + o.columnSize = columnSize.slice(); + o.columnSize = o.columnSize.concat(BI.makeArray(length, 0)); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + var columnSize = this.getColumnSize(); + var length = o.columnSize.length - columnSize.length; + o.columnSize = columnSize.slice(); + o.columnSize = o.columnSize.concat(BI.makeArray(length, 0)); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); + }); + }, + + _digest: function () { + var o = this.options; + var deep = this._getHDeep(); + var vDeep = this._getVDeep(); + var header = BI.TableTree.formatHeader(o.header, o.crossHeader, o.crossItems, deep, vDeep, o.headerCellStyleGetter); + var items = BI.DynamicSummaryTreeTable.formatHorizontalItems(o.items, deep, false, o.summaryCellStyleGetter); + var data = BI.DynamicSummaryTreeTable.formatSummaryItems(items, header, o.crossItems, deep); + var columnSize = o.columnSize.slice(); + var minColumnSize = o.minColumnSize.slice(); + var maxColumnSize = o.maxColumnSize.slice(); + BI.removeAt(columnSize, data.deletedCols); + BI.removeAt(minColumnSize, data.deletedCols); + BI.removeAt(maxColumnSize, data.deletedCols); + return { + header: data.header, + items: data.items, + columnSize: columnSize, + minColumnSize: minColumnSize, + maxColumnSize: maxColumnSize + }; + }, + + setWidth: function (width) { + BI.DynamicSummaryTreeTable.superclass.setWidth.apply(this, arguments); + this.table.setWidth(width); + }, + + setHeight: function (height) { + BI.DynamicSummaryTreeTable.superclass.setHeight.apply(this, arguments); + this.table.setHeight(height); + }, + + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + }, + + getColumnSize: function () { + return this.options.columnSize; + }, + + setRegionColumnSize: function (columnSize) { + this.options.regionColumnSize = columnSize; + this.table.setRegionColumnSize(columnSize); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, + + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + attr: function (key) { + BI.DynamicSummaryTreeTable.superclass.attr.apply(this, arguments); + switch (key) { + case "minColumnSize": + case "maxColumnSize": + return; + } + this.table.attr.apply(this.table, arguments); + }, + + restore: function () { + this.table.restore(); + }, + + populate: function (items, header, crossItems, crossHeader) { + var o = this.options; + if (items) { + o.items = items; + } + if (header) { + o.header = header; + } + if (crossItems) { + o.crossItems = crossItems; + } + if (crossHeader) { + o.crossHeader = crossHeader; + } + var data = this._digest(); + this.table.setColumnSize(data.columnSize); + this.table.attr("minColumnSize", data.minColumnSize); + this.table.attr("maxColumnSize", data.maxColumnSize); + this.table.populate(data.items, data.header); + }, + + destroy: function () { + this.table.destroy(); + BI.DynamicSummaryTreeTable.superclass.destroy.apply(this, arguments); + } +}); + +BI.extend(BI.DynamicSummaryTreeTable, { + + formatHorizontalItems: function (nodes, deep, isCross, styleGetter) { + var result = []; + + function track(store, node) { + var next; + if (BI.isArray(node.children)) { + BI.each(node.children, function (index, child) { + var next; + if (store != -1) { + next = store.slice(); + next.push(node); + } else { + next = []; + } + track(next, child); + }); + if (store != -1) { + next = store.slice(); + next.push(node); + } else { + next = []; + } + if ((store == -1 || node.children.length > 1) && BI.isNotEmptyArray(node.values)) { + var summary = { + text: BI.i18nText("BI-Summary_Values"), + type: "bi.table_style_cell", + styleGetter: function () { + return styleGetter(store === -1) + } + }; + for (var i = next.length; i < deep; i++) { + next.push(summary); + } + if (!isCross) { + next = next.concat(node.values); + } + if (next.length > 0) { + if (!isCross) { + result.push(next); + } else { + for (var k = 0, l = node.values.length; k < l; k++) { + result.push(next); + } + } + } + } + return; + } + if (store != -1) { + next = store.slice(); + for (var i = next.length; i < deep; i++) { + next.push(node); + } + } else { + next = []; + } + if (!isCross && BI.isArray(node.values)) { + next = next.concat(node.values); + } + if (isCross && BI.isArray(node.values)) { + for (var i = 0, len = node.values.length; i < len - 1; i++) { + if (next.length > 0) { + result.push(next); + } + } + } + if (next.length > 0) { + result.push(next); + } + } + + BI.each(nodes, function (i, node) { + track(-1, node); + }); + //填充空位 + BI.each(result, function (i, line) { + var last = BI.last(line); + for (var j = line.length; j < deep; j++) { + line.push(last); + } + }); + return result; + }, + + formatSummaryItems: function (items, header, crossItems, deep) { + //求纵向需要去除的列 + var cols = []; + var leaf = 0; + + function track(node) { + if (BI.isArray(node.children)) { + BI.each(node.children, function (index, child) { + track(child); + }); + if (BI.isNotEmptyArray(node.values)) { + if (node.children.length === 1) { + for (var i = 0; i < node.values.length; i++) { + cols.push(leaf + i + deep); + } + } + leaf += node.values.length; + } + return; + } + if (node.values && node.values.length > 1) { + leaf += node.values.length; + } else { + leaf++; + } + } + + BI.each(crossItems, function (i, node) { + track(node); + }); + + if (cols.length > 0) { + var nHeader = [], nItems = []; + BI.each(header, function (i, node) { + var nNode = node.slice(); + BI.removeAt(nNode, cols); + nHeader.push(nNode); + }); + BI.each(items, function (i, node) { + var nNode = node.slice(); + BI.removeAt(nNode, cols); + nItems.push(nNode);; + }); + header = nHeader; + items = nItems; + } + return {items: items, header: header, deletedCols: cols}; + } +}); + +BI.shortcut("bi.dynamic_summary_tree_table", BI.DynamicSummaryTreeTable);/** + * + * 层级树状结构的表格 + * + * Created by GUY on 2016/5/7. + * @class BI.LayerTreeTable + * @extends BI.Widget + */ +BI.LayerTreeTable = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.LayerTreeTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-layer-tree-table", + el: { + type: "bi.resizable_table" + }, + + isNeedResize: false,//是否需要调整列宽 + isResizeAdapt: true,//是否需要在调整列宽或区域宽度的时候它们自适应变化 + + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为tree时生效 + + isNeedMerge: true,//是否需要合并单元格 + mergeCols: [], + mergeRule: BI.emptyFn, + + columnSize: [], + minColumnSize: [], + maxColumnSize: [], + + headerRowSize: 25, + rowSize: 25, + + regionColumnSize: [], + + rowHeaderCreator: null, + + headerCellStyleGetter: BI.emptyFn, + summaryCellStyleGetter: BI.emptyFn, + sequenceCellStyleGetter: BI.emptyFn, + + header: [], + items: [], + + //交叉表头 + crossHeader: [], + crossItems: [] + }) + }, + + _getVDeep: function () { + return this.options.crossHeader.length;//纵向深度 + }, + + _getHDeep: function () { + var o = this.options; + return Math.max(o.mergeCols.length, o.freezeCols.length, BI.TableTree.maxDeep(o.items) - 1); + }, + + _createHeader: function (vDeep) { + var self = this, o = this.options; + var header = o.header || [], crossHeader = o.crossHeader || []; + var items = BI.TableTree.formatCrossItems(o.crossItems, vDeep, o.headerCellStyleGetter); + var result = []; + BI.each(items, function (row, node) { + var c = [crossHeader[row]]; + result.push(c.concat(node || [])); + }); + if (header && header.length > 0) { + var newHeader = this._formatColumns(header); + var deep = this._getHDeep(); + if (deep <= 0) { + newHeader.unshift(o.rowHeaderCreator || { + type: "bi.table_style_cell", + text: BI.i18nText("BI-Row_Header"), + styleGetter: o.headerCellStyleGetter + }); + } else { + newHeader[0] = o.rowHeaderCreator || { + type: "bi.table_style_cell", + text: BI.i18nText("BI-Row_Header"), + styleGetter: o.headerCellStyleGetter + }; + } + result.push(newHeader); + } + return result; + }, + + _formatItems: function (nodes) { + var self = this, o = this.options; + var result = []; + + function track(node, layer) { + node.type || (node.type = "bi.layer_tree_table_cell"); + node.layer = layer; + var next = [node]; + next = next.concat(node.values || []); + if (next.length > 0) { + result.push(next); + } + if (BI.isNotEmptyArray(node.children)) { + BI.each(node.children, function (index, child) { + track(child, layer + 1); + }); + } + } + + BI.each(nodes, function (i, node) { + BI.each(node.children, function (j, c) { + track(c, 0); + }); + if (BI.isArray(node.values)) { + var next = [{ + type: "bi.table_style_cell", text: BI.i18nText("BI-Summary_Values"), styleGetter: function () { + return o.summaryCellStyleGetter(true); + } + }].concat(node.values); + result.push(next) + } + }); + return result; + }, + + _formatColumns: function (columns, deep) { + if (BI.isNotEmptyArray(columns)) { + deep = deep || this._getHDeep(); + return columns.slice(Math.max(0, deep - 1)); + } + return columns; + }, + + _formatFreezeCols: function () { + if (this.options.freezeCols.length > 0) { + return [0]; + } + return []; + }, + + _formatColumnSize: function (columnSize, deep) { + if (columnSize.length <= 0) { + return []; + } + var result = [0]; + deep = deep || this._getHDeep(); + BI.each(columnSize, function (i, size) { + if (i < deep) { + result[0] += size; + return; + } + result.push(size); + }); + return result; + }, + + _digest: function () { + var o = this.options; + var deep = this._getHDeep(); + var vDeep = this._getVDeep(); + return { + header: this._createHeader(vDeep), + items: this._formatItems(o.items), + columnSize: this._formatColumnSize(o.columnSize, deep), + minColumnSize: this._formatColumns(o.minColumnSize, deep), + maxColumnSize: this._formatColumns(o.maxColumnSize, deep), + freezeCols: this._formatFreezeCols() + } + }, + + _init: function () { + BI.LayerTreeTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + var data = this._digest(); + this.table = BI.createWidget(o.el, { + type: "bi.resizable_table", + element: this, + width: o.width, + height: o.height, + isNeedResize: o.isNeedResize, + isResizeAdapt: o.isResizeAdapt, + isNeedFreeze: o.isNeedFreeze, + freezeCols: data.freezeCols, + isNeedMerge: o.isNeedMerge, + mergeCols: [], + mergeRule: o.mergeRule, + columnSize: data.columnSize, + minColumnSize: data.minColumnSize, + maxColumnSize: data.maxColumnSize, + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + regionColumnSize: o.regionColumnSize, + header: data.header, + items: data.items + }); + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); + }); + }, + + setWidth: function (width) { + BI.LayerTreeTable.superclass.setWidth.apply(this, arguments); + this.table.setWidth(width); + }, + + setHeight: function (height) { + BI.LayerTreeTable.superclass.setHeight.apply(this, arguments); + this.table.setHeight(height); + }, + + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + }, + + getColumnSize: function () { + var columnSize = this.table.getColumnSize(); + var deep = this._getHDeep(); + var pre = []; + if (deep > 0) { + pre = BI.makeArray(deep, columnSize[0] / deep); + } + return pre.concat(columnSize.slice(1)); + }, + + setRegionColumnSize: function (columnSize) { + this.options.regionColumnSize = columnSize; + this.table.setRegionColumnSize(columnSize); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, + + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + attr: function (key, value) { + var self = this; + if (BI.isObject(key)) { + BI.each(key, function (k, v) { + self.attr(k, v); + }); + return; + } + BI.LayerTreeTable.superclass.attr.apply(this, arguments); + switch (key) { + case "columnSize": + case "minColumnSize": + case "maxColumnSize": + case "freezeCols": + case "mergeCols": + return; + } + this.table.attr.apply(this.table, [key, value]); + }, + + restore: function () { + this.table.restore(); + }, + + populate: function (items, header, crossItems, crossHeader) { + var o = this.options; + o.items = items || []; + if (header) { + o.header = header; + } + if (crossItems) { + o.crossItems = crossItems; + } + if (crossHeader) { + o.crossHeader = crossHeader; + } + var data = this._digest(); + this.table.setColumnSize(data.columnSize); + this.table.attr("freezeCols", data.freezeCols); + this.table.attr("minColumnSize", data.minColumnSize); + this.table.attr("maxColumnSize", data.maxColumnSize); + this.table.populate(data.items, data.header); + }, + + destroy: function () { + this.table.destroy(); + BI.LayerTreeTable.superclass.destroy.apply(this, arguments); + } +}); + +BI.shortcut("bi.layer_tree_table", BI.LayerTreeTable);/** + * + * Created by GUY on 2016/5/26. + * @class BI.TableStyleCell + * @extends BI.Single + */ +BI.TableStyleCell = BI.inherit(BI.Single, { + + _defaultConfig: function () { + return BI.extend(BI.TableStyleCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-table-style-cell", + styleGetter: BI.emptyFn + }); + }, + + _init: function () { + BI.TableStyleCell.superclass._init.apply(this, arguments); + var o = this.options; + this.text = BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "left", + forceCenter: true, + hgap: 5, + text: o.text + }); + this._digestStyle(); + }, + + _digestStyle: function () { + var o = this.options; + var style = o.styleGetter(); + if (style) { + this.text.element.css(style); + } + }, + + setText: function (text) { + this.text.setText(text); + }, + + populate: function () { + this._digestStyle(); + } +}); +BI.shortcut('bi.table_style_cell', BI.TableStyleCell);/** + * + * 树状结构的表格 + * + * Created by GUY on 2015/9/22. + * @class BI.TableTree + * @extends BI.Widget + */ +BI.TableTree = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.TableTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-table-tree", + el: { + type: "bi.resizable_table" + }, + isNeedResize: true,//是否需要调整列宽 + isResizeAdapt: true,//是否需要在调整列宽或区域宽度的时候它们自适应变化 + + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为tree时生效 + + isNeedMerge: true,//是否需要合并单元格 + mergeCols: [], + mergeRule: BI.emptyFn, + + columnSize: [], + minColumnSize: [], + maxColumnSize: [], + headerRowSize: 25, + rowSize: 25, + + regionColumnSize: [], + + headerCellStyleGetter: BI.emptyFn, + summaryCellStyleGetter: BI.emptyFn, + sequenceCellStyleGetter: BI.emptyFn, + + header: [], + items: [], + + //交叉表头 + crossHeader: [], + crossItems: [] + }) + }, + + _getVDeep: function () { + return this.options.crossHeader.length;//纵向深度 + }, + + _getHDeep: function () { + var o = this.options; + return Math.max(o.mergeCols.length, o.freezeCols.length, BI.TableTree.maxDeep(o.items) - 1); + }, + + _init: function () { + BI.TableTree.superclass._init.apply(this, arguments); + var self = this, o = this.options; + var data = this._digest(); + this.table = BI.createWidget(o.el, { + type: "bi.resizable_table", + element: this, + width: o.width, + height: o.height, + isNeedResize: o.isNeedResize, + isResizeAdapt: o.isResizeAdapt, + + isNeedFreeze: o.isNeedFreeze, + freezeCols: o.freezeCols, + isNeedMerge: o.isNeedMerge, + mergeCols: o.mergeCols, + mergeRule: o.mergeRule, + + columnSize: o.columnSize, + minColumnSize: o.minColumnSize, + maxColumnSize: o.maxColumnSize, + + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + + regionColumnSize: o.regionColumnSize, + + header: data.header, + items: data.items + }); + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); + }); + }, + + _digest: function () { + var self = this, o = this.options; + var deep = this._getHDeep(); + var vDeep = this._getVDeep(); + var header = BI.TableTree.formatHeader(o.header, o.crossHeader, o.crossItems, deep, vDeep, o.headerCellStyleGetter); + var items = BI.TableTree.formatItems(o.items, deep, false, o.summaryCellStyleGetter); + return { + header: header, + items: items + } + }, + + setWidth: function (width) { + BI.TableTree.superclass.setWidth.apply(this, arguments); + this.table.setWidth(width); + }, + + setHeight: function (height) { + BI.TableTree.superclass.setHeight.apply(this, arguments); + this.table.setHeight(height); + }, + + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this.table.setColumnSize(columnSize); + }, + + getColumnSize: function () { + return this.table.getColumnSize(); + }, + + setRegionColumnSize: function (columnSize) { + this.options.regionColumnSize = columnSize; + this.table.setRegionColumnSize(columnSize); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, + + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + attr: function () { + BI.TableTree.superclass.attr.apply(this, arguments); + this.table.attr.apply(this.table, arguments); + }, + + restore: function () { + this.table.restore(); + }, + + populate: function (items, header, crossItems, crossHeader) { + var o = this.options; + if (items) { + o.items = items || []; + } + if (header) { + o.header = header; + } + if (crossItems) { + o.crossItems = crossItems; + } + if (crossHeader) { + o.crossHeader = crossHeader; + } + var data = this._digest(); + this.table.populate(data.items, data.header); + }, + + destroy: function () { + this.table.destroy(); + BI.TableTree.superclass.destroy.apply(this, arguments); + } +}); + +BI.extend(BI.TableTree, { + formatHeader: function (header, crossHeader, crossItems, hDeep, vDeep, styleGetter) { + var items = BI.TableTree.formatCrossItems(crossItems, vDeep, styleGetter); + var result = []; + for (var i = 0; i < vDeep; i++) { + var c = []; + for (var j = 0; j < hDeep; j++) { + c.push(crossHeader[i]); + } + result.push(c.concat(items[i] || [])); + } + if (header && header.length > 0) { + result.push(header); + } + return result; + }, + + formatItems: function (nodes, deep, isCross, styleGetter) { + var self = this; + var result = []; + + function track(store, node) { + var next; + if (BI.isArray(node.children)) { + BI.each(node.children, function (index, child) { + var next; + if (store != -1) { + next = store.slice(); + next.push(node); + } else { + next = []; + } + track(next, child); + }); + if (store != -1) { + next = store.slice(); + next.push(node); + } else { + next = []; + } + if (/**(store == -1 || node.children.length > 1) &&**/ BI.isNotEmptyArray(node.values)) { + var summary = { + text: BI.i18nText("BI-Summary_Values"), + type: "bi.table_style_cell", + styleGetter: function () { + return styleGetter(store === -1) + } + }; + for (var i = next.length; i < deep; i++) { + next.push(summary); + } + if (!isCross) { + next = next.concat(node.values); + } + if (next.length > 0) { + if (!isCross) { + result.push(next); + } else { + for (var k = 0, l = node.values.length; k < l; k++) { + result.push(next); + } + } + } + } + + return; + } + if (store != -1) { + next = store.slice(); + for (var i = next.length; i < deep; i++) { + next.push(node); + } + } else { + next = []; + } + if (!isCross && BI.isArray(node.values)) { + next = next.concat(node.values); + } + if (isCross && BI.isArray(node.values)) { + for (var i = 0, len = node.values.length; i < len - 1; i++) { + if (next.length > 0) { + result.push(next); + } + } + } + if (next.length > 0) { + result.push(next); + } + } + + BI.each(nodes, function (i, node) { + track(-1, node); + }); + //填充空位 + BI.each(result, function (i, line) { + var last = BI.last(line); + for (var j = line.length; j < deep; j++) { + line.push(last); + } + }); + return result; + }, + + formatCrossItems: function (nodes, deep, styleGetter) { + var items = BI.TableTree.formatItems(nodes, deep, true, styleGetter); + return BI.unzip(items); + }, + + maxDeep: function (nodes) { + function track(deep, node) { + var d = deep; + if (BI.isNotEmptyArray(node.children)) { + BI.each(node.children, function (index, child) { + d = Math.max(d, track(deep + 1, child)); + }); + } + return d; + } + + var deep = 1; + if (BI.isObject(nodes)) { + BI.each(nodes, function (i, node) { + deep = Math.max(deep, track(1, node)); + }); + } + return deep; + } +}); + +BI.shortcut("bi.tree_table", BI.TableTree);/** + * guy + * 复选导航条 + * Created by GUY on 2015/8/25. + * @class BI.MultiSelectBar + * @extends BI.BasicButton + */ +BI.MultiSelectBar = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.MultiSelectBar.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-multi-select-bar", + height: 25, + text: BI.i18nText('BI-Select_All'), + isAllCheckedBySelectedValue: BI.emptyFn, + //手动控制选中 + disableSelected: true, + isHalfCheckedBySelectedValue: function (selectedValues) { + return selectedValues.length > 0; + } + }) + }, + _init: function () { + BI.MultiSelectBar.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.checkbox", + stopPropagation: true, + handler: function () { + self.setSelected(self.isSelected()); + } + }); + this.half = BI.createWidget({ + type: "bi.half_icon_button", + stopPropagation: true, + handler: function () { + self.setSelected(true); + } + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CLICK, self.isSelected(), self); + }); + this.half.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CLICK, self.isSelected(), self); + }); + this.half.on(BI.HalfIconButton.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectBar.EVENT_CHANGE, self.isSelected(), self); + }); + this.checkbox.on(BI.Checkbox.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectBar.EVENT_CHANGE, self.isSelected(), self); + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + keyword: o.keyword, + value: o.value, + py: o.py + }); + BI.createWidget({ + type: "bi.htape", + element: this, + items: [{ + width: 36, + el: { + type: "bi.center_adapt", + items: [this.checkbox, this.half] + } + }, { + el: this.text + }] + }); + this.half.invisible(); + }, + + //自己手动控制选中 + beforeClick: function () { + var isHalf = this.isHalfSelected(), isSelected = this.isSelected(); + if (isHalf === true) { + this.setSelected(true); + } else { + this.setSelected(!isSelected); + } + }, + + setSelected: function (v) { + this.checkbox.setSelected(v); + this.setHalfSelected(false); + }, + + setHalfSelected: function (b) { + this._half = !!b; + if (b === true) { + this.half.visible(); + this.checkbox.invisible(); + } else { + this.half.invisible(); + this.checkbox.visible(); + } + }, + + isHalfSelected: function () { + return !!this._half; + }, + + isSelected: function () { + return this.checkbox.isSelected(); + }, + + setValue: function (selectedValues) { + BI.MultiSelectBar.superclass.setValue.apply(this, arguments); + var isAllChecked = this.options.isAllCheckedBySelectedValue.apply(this, arguments); + this.setSelected(isAllChecked); + !isAllChecked && this.setHalfSelected(this.options.isHalfCheckedBySelectedValue.apply(this, arguments)); + } +}); +BI.MultiSelectBar.EVENT_CHANGE = "MultiSelectBar.EVENT_CHANGE"; +BI.shortcut("bi.multi_select_bar", BI.MultiSelectBar);/** + * 倒立的Branch + * @class BI.HandStandBranchExpander + * @extend BI.Widget + * create by young + */ +BI.HandStandBranchExpander = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.HandStandBranchExpander.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-handstand-branch-expander", + direction: BI.Direction.Top, + logic: { + dynamic: true + }, + el: {type: "bi.label"}, + popup: {} + }) + }, + + _init: function () { + BI.HandStandBranchExpander.superclass._init.apply(this, arguments); + var o = this.options; + this._initExpander(); + this._initBranchView(); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({}, o.logic, { + items: BI.LogicFactory.createLogicItemsByDirection(o.direction, { + type: "bi.center_adapt", + items: [this.expander] + }, this.branchView) + })))); + }, + + _initExpander: function () { + var self = this, o = this.options; + this.expander = BI.createWidget(o.el); + this.expander.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + }, + + _initBranchView: function () { + var self = this, o = this.options; + this.branchView = BI.createWidget(o.popup, {}); + this.branchView.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + }, + + populate: function (items) { + this.branchView.populate.apply(this.branchView, arguments); + }, + + getValue: function () { + return this.branchView.getValue(); + } +}); +BI.HandStandBranchExpander.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.handstand_branch_expander", BI.HandStandBranchExpander);/** + * @class BI.BranchExpander + * @extend BI.Widget + * create by young + */ +BI.BranchExpander = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.BranchExpander.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-branch-expander", + direction: BI.Direction.Left, + logic: { + dynamic: true + }, + el: {}, + popup: {} + }) + }, + + _init: function () { + BI.BranchExpander.superclass._init.apply(this, arguments); + var o = this.options; + this._initExpander(); + this._initBranchView(); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({}, o.logic, { + items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.expander, this.branchView) + })))); + }, + + _initExpander: function () { + var self = this, o = this.options; + this.expander = BI.createWidget(o.el, { + type: "bi.label", + width: 30, + height: "100%" + }); + this.expander.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + }, + + _initBranchView: function () { + var self = this, o = this.options; + this.branchView = BI.createWidget(o.popup, {}); + this.branchView.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + }, + + populate: function (items) { + this.branchView.populate.apply(this.branchView, arguments); + }, + + getValue: function () { + return this.branchView.getValue(); + } +}); +BI.BranchExpander.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.branch_expander", BI.BranchExpander);/** + * @class BI.HandStandBranchTree + * @extends BI.Widget + * create by young + * 横向分支的树 + */ +BI.HandStandBranchTree = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.HandStandBranchTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-handstand-branch-tree", + expander: {}, + el: {}, + items: [] + }) + }, + _init: function () { + BI.HandStandBranchTree.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.branchTree = BI.createWidget({ + type: "bi.custom_tree", + element: this, + expander: BI.extend({ + type: "bi.handstand_branch_expander", + el: {}, + popup: { + type: "bi.custom_tree" + } + }, o.expander), + el: BI.extend({ + type: "bi.button_tree", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + layouts: [{ + type: "bi.horizontal_adapt" + }] + }, o.el), + items: this.options.items + }); + this.branchTree.on(BI.CustomTree.EVENT_CHANGE, function(){ + self.fireEvent(BI.HandStandBranchTree.EVENT_CHANGE, arguments); + }); + this.branchTree.on(BI.Controller.EVENT_CHANGE, function(){ + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + }, + + populate: function () { + this.branchTree.populate.apply(this.branchTree, arguments); + }, + + getValue: function () { + return this.branchTree.getValue(); + } +}); +BI.HandStandBranchTree.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.handstand_branch_tree", BI.HandStandBranchTree);/** + * @class BI.BranchTree + * @extends BI.Widget + * create by young + * 横向分支的树 + */ +BI.BranchTree = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.BranchTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-branch-tree", + expander: {}, + el: {}, + items: [] + }) + }, + _init: function () { + BI.BranchTree.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.branchTree = BI.createWidget({ + type: "bi.custom_tree", + element: this, + expander: BI.extend({ + type: "bi.branch_expander", + el: {}, + popup: { + type: "bi.custom_tree" + } + }, o.expander), + el: BI.extend({ + type: "bi.button_tree", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + layouts: [{ + type: "bi.vertical" + }] + }, o.el), + items: this.options.items + }); + this.branchTree.on(BI.CustomTree.EVENT_CHANGE, function(){ + self.fireEvent(BI.BranchTree.EVENT_CHANGE, arguments); + }); + this.branchTree.on(BI.Controller.EVENT_CHANGE, function(){ + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + }, + + populate: function () { + this.branchTree.populate.apply(this.branchTree, arguments); + }, + + getValue: function () { + return this.branchTree.getValue(); + } +}); +BI.BranchTree.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.branch_tree", BI.BranchTree);/** + * guy + * 异步树 + * @class BI.DisplayTree + * @extends BI.TreeView + */ +BI.DisplayTree = BI.inherit(BI.TreeView, { + _defaultConfig: function () { + return BI.extend(BI.DisplayTree.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-display-tree" + }) + }, + _init: function () { + BI.DisplayTree.superclass._init.apply(this, arguments); + }, + + //配置属性 + _configSetting: function () { + var setting = { + view: { + selectedMulti: false, + dblClickExpand: false, + showIcon: false, + showTitle: false + }, + data: { + key: { + title: "title", + name: "text" + }, + simpleData: { + enable: true + } + }, + callback: { + beforeCollapse: beforeCollapse + } + }; + + function beforeCollapse(treeId, treeNode) { + return false; + } + + return setting; + }, + + _dealWidthNodes: function (nodes) { + nodes = BI.DisplayTree.superclass._dealWidthNodes.apply(this, arguments); + var self = this, o = this.options; + BI.each(nodes, function (i, node) { + if (node.count > 0) { + node.text = node.value + "(" + BI.i18nText("BI-Basic_Altogether") + node.count + BI.i18nText("BI-Basic_Count") + ")"; + } else { + node.text = node.value; + } + }); + return nodes; + }, + + initTree: function (nodes, setting) { + var setting = setting || this._configSetting(); + this.nodes = $.fn.zTree.init(this.tree.element, setting, nodes); + }, + + destroy: function () { + BI.DisplayTree.superclass.destroy.apply(this, arguments); + } +}); +BI.DisplayTree.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.shortcut("bi.display_tree", BI.DisplayTree);/** + * guy + * 二级树 + * @class BI.LevelTree + * @extends BI.Single + */ +BI.LevelTree = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.LevelTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-level-tree", + el: { + chooseType: 0 + }, + expander: {}, + items: [] + }) + }, + + _init: function () { + BI.LevelTree.superclass._init.apply(this, arguments); + + this.initTree(this.options.items); + }, + + _formatItems: function (nodes, layer) { + var self = this; + BI.each(nodes, function (i, node) { + var extend = {layer: layer}; + if (!BI.isKey(node.id)) { + node.id = BI.UUID(); + } + if (node.isParent === true || BI.isNotEmptyArray(node.children)) { + switch (i) { + case 0 : + extend.type = "bi.first_plus_group_node"; + break; + case nodes.length - 1 : + extend.type = "bi.last_plus_group_node"; + break; + default : + extend.type = "bi.mid_plus_group_node"; + break; + } + BI.defaults(node, extend); + self._formatItems(node.children, layer + 1); + } else { + switch (i) { + case nodes.length - 1: + extend.type = "bi.last_tree_leaf_item"; + break; + default : + extend.type = "bi.mid_tree_leaf_item"; + } + BI.defaults(node, extend); + } + }); + return nodes; + }, + + _assertId: function (sNodes) { + BI.each(sNodes, function (i, node) { + if (!BI.isKey(node.id)) { + node.id = BI.UUID(); + } + }); + }, + + //构造树结构, + initTree: function (nodes) { + var self = this, o = this.options; + this.empty(); + this._assertId(nodes); + this.tree = BI.createWidget({ + type: "bi.custom_tree", + element: this, + expander: BI.extend({ + el: {}, + popup: { + type: "bi.custom_tree" + } + }, o.expander), + + items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + + el: BI.extend({ + type: "bi.button_tree", + chooseType: 0, + layouts: [{ + type: "bi.vertical" + }] + }, o.el) + }); + this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.LevelTree.EVENT_CHANGE, arguments); + } + }) + }, + + //生成树方法 + stroke: function (nodes) { + this.tree.stroke.apply(this.tree, arguments); + }, + + populate: function (items) { + items = this._formatItems(BI.Tree.transformToTreeFormat(items), 0); + this.tree.populate(items); + }, + + setValue: function (v) { + this.tree.setValue(v); + }, + + getValue: function () { + return this.tree.getValue(); + }, + + getAllLeaves: function () { + return this.tree.getAllLeaves(); + }, + + getNodeById: function (id) { + return this.tree.getNodeById(id); + }, + + getNodeByValue: function (id) { + return this.tree.getNodeByValue(id); + } +}); +BI.LevelTree.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.shortcut("bi.level_tree", BI.LevelTree);/** + * 简单的多选树 + * + * Created by GUY on 2016/2/16. + * @class BI.SimpleTreeView + * @extends BI.Widget + */ +BI.SimpleTreeView = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.SimpleTreeView.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-simple-tree", + itemsCreator: BI.emptyFn, + items: null + }) + }, + _init: function () { + BI.SimpleTreeView.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.structure = new BI.Tree(); + this.tree = BI.createWidget({ + type: "bi.tree_view", + element: this, + itemsCreator: function (op, callback) { + var fn = function (items) { + callback({ + items: items + }); + self.structure.initTree(BI.Tree.transformToTreeFormat(items)); + }; + if (BI.isNotNull(o.items)) { + fn(o.items); + } else { + o.itemsCreator(op, fn); + } + } + }); + this.tree.on(BI.TreeView.EVENT_CHANGE, function () { + self.fireEvent(BI.SimpleTreeView.EVENT_CHANGE, arguments); + }); + if (BI.isNotEmptyArray(o.items)) { + this.populate(); + } + }, + + populate: function (items, keyword) { + if (items) { + this.options.items = items; + } + this.tree.stroke({ + keyword: keyword + }); + }, + + setValue: function (v) { + v || (v = []); + var self = this, map = {}; + var selected = []; + BI.each(v, function (i, val) { + var node = self.structure.search(val, "value"); + if (node) { + var p = node; + p = p.getParent(); + if (p) { + if (!map[p.value]) { + map[p.value] = 0; + } + map[p.value]++; + } + + while (p && p.getChildrenLength() <= map[p.value]) { + selected.push(p.value); + p = p.getParent(); + if (p) { + if (!map[p.value]) { + map[p.value] = 0; + } + map[p.value]++; + } + } + } + }); + + this.tree.setValue(BI.makeObject(v.concat(selected))); + }, + + _getValue: function () { + var self = this, result = [], val = this.tree.getValue(); + var track = function (nodes) { + BI.each(nodes, function (key, node) { + if (BI.isEmpty(node)) { + result.push(key); + } else { + track(node); + } + }) + }; + track(val); + return result; + }, + + empty: function () { + this.tree.empty(); + }, + + getValue: function () { + var self = this, result = [], val = this._getValue(); + BI.each(val, function (i, key) { + var target = self.structure.search(key, "value"); + if (target) { + self.structure._traverse(target, function (node) { + if (node.isLeaf()) { + result.push(node.value); + } + }) + } + }); + return result; + } +}); +BI.SimpleTreeView.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.simple_tree", BI.SimpleTreeView); +/** + * 文本输入框trigger + * + * Created by GUY on 2015/9/15. + * @class BI.EditorTrigger + * @extends BI.Trigger + */ +BI.EditorTrigger = BI.inherit(BI.Trigger, { + _const: { + hgap: 4 + }, + + _defaultConfig: function () { + var conf = BI.EditorTrigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-editor-trigger bi-border", + height: 30, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + allowBlank: false, + watermark: "", + errorText: "", + triggerWidth: 30 + }); + }, + + _init: function () { + this.options.height -= 2; + BI.EditorTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options, c = this._const; + this.editor = BI.createWidget({ + type: "bi.sign_editor", + height: o.height, + value: o.value, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker, + mouseOut: false, + allowBlank: o.allowBlank, + watermark: o.watermark, + errorText: o.errorText + }); + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { + self.fireEvent(BI.EditorTrigger.EVENT_CHANGE, arguments); + }); + + BI.createWidget({ + element: this, + type: 'bi.htape', + items: [ + { + el: this.editor + }, { + el: { + type: "bi.trigger_icon_button", + cls: "bi-border-left", + width: o.triggerWidth + }, + width: o.triggerWidth + } + ] + }); + }, + + getValue: function () { + return this.editor.getValue(); + }, + + setValue: function (value) { + this.editor.setValue(value); + }, + + setText: function (text) { + this.editor.setState(text); + } +}); +BI.EditorTrigger.EVENT_CHANGE = "BI.EditorTrigger.EVENT_CHANGE"; +BI.shortcut("bi.editor_trigger", BI.EditorTrigger);/** + * 图标按钮trigger + * + * Created by GUY on 2015/10/8. + * @class BI.IconTrigger + * @extends BI.Trigger + */ +BI.IconTrigger = BI.inherit(BI.Trigger, { + + _defaultConfig: function () { + return BI.extend(BI.IconTrigger.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-icon-trigger", + el: {}, + height: 30 + }); + }, + _init: function () { + var o = this.options; + BI.IconTrigger.superclass._init.apply(this, arguments); + this.iconButton = BI.createWidget(o.el, { + type: "bi.trigger_icon_button", + element: this, + width: o.width, + height: o.height + }); + } +}); +BI.shortcut('bi.icon_trigger', BI.IconTrigger);/** + * 文字trigger + * + * Created by GUY on 2015/9/15. + * @class BI.TextTrigger + * @extends BI.Trigger + */ +BI.TextTrigger = BI.inherit(BI.Trigger, { + _const: { + hgap: 4, + triggerWidth: 30 + }, + + _defaultConfig: function () { + var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-text-trigger", + height: 30 + }); + }, + + _init: function () { + BI.TextTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options, c = this._const; + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + height: o.height, + text: o.text, + hgap: c.hgap + }); + this.trigerButton = BI.createWidget({ + type: "bi.trigger_icon_button", + cls: "bi-border-left", + width: c.triggerWidth + }); + + BI.createWidget({ + element: this, + type: 'bi.htape', + items: [ + { + el: this.text + }, { + el: this.trigerButton, + width: c.triggerWidth + } + ] + }); + }, + + setValue: function (value) { + this.text.setValue(value); + this.text.setTitle(value); + }, + + setText: function (text) { + this.text.setText(text); + this.text.setTitle(text); + } +}); +BI.shortcut("bi.text_trigger", BI.TextTrigger);/** + * 选择字段trigger + * + * Created by GUY on 2015/9/15. + * @class BI.SelectTextTrigger + * @extends BI.Trigger + */ +BI.SelectTextTrigger = BI.inherit(BI.Trigger, { + + _defaultConfig: function () { + return BI.extend(BI.SelectTextTrigger.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-select-text-trigger bi-border", + height: 24 + }); + }, + + _init: function () { + this.options.height -= 2; + BI.SelectTextTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.text_trigger", + element: this, + height: o.height + }); + if (BI.isKey(o.text)) { + this.setValue(o.text); + } + }, + + setValue: function (vals) { + var o = this.options; + vals = BI.isArray(vals) ? vals : [vals]; + var result = []; + var items = BI.Tree.transformToArrayFormat(this.options.items); + BI.each(items, function (i, item) { + if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) { + result.push(item.text || item.value); + } + }); + + if (result.length > 0) { + this.trigger.setText(result.join(",")); + } else { + this.trigger.setText(o.text); + } + }, + + populate: function (items) { + this.options.items = items; + } +}); +BI.shortcut("bi.select_text_trigger", BI.SelectTextTrigger);/** + * 选择字段trigger小一号的 + * + * @class BI.SmallSelectTextTrigger + * @extends BI.Trigger + */ +BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, { + + _defaultConfig: function () { + return BI.extend(BI.SmallSelectTextTrigger.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-small-select-text-trigger bi-border", + height: 20 + }); + }, + + _init: function () { + this.options.height -= 2; + BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.small_text_trigger", + element: this, + height: o.height - 2 + }); + if (BI.isKey(o.text)) { + this.setValue(o.text); + } + }, + + setValue: function (vals) { + var o = this.options; + vals = BI.isArray(vals) ? vals : [vals]; + var result = []; + var items = BI.Tree.transformToArrayFormat(this.options.items); + BI.each(items, function (i, item) { + if (BI.deepContains(vals, item.value) && !result.contains(item.text || item.value)) { + result.push(item.text || item.value); + } + }); + + if (result.length > 0) { + this.trigger.element.removeClass("bi-water-mark"); + this.trigger.setText(result.join(",")); + } else { + this.trigger.element.addClass("bi-water-mark"); + this.trigger.setText(o.text); + } + }, + + populate: function (items) { + this.options.items = items; + } +}); +BI.shortcut("bi.small_select_text_trigger", BI.SmallSelectTextTrigger);/** + * 文字trigger(右边小三角小一号的) == + * + * @class BI.SmallTextTrigger + * @extends BI.Trigger + */ +BI.SmallTextTrigger = BI.inherit(BI.Trigger, { + _const: { + hgap: 4, + triggerWidth: 20 + }, + + _defaultConfig: function () { + var conf = BI.SmallTextTrigger.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-text-trigger", + height: 20 + }); + }, + + _init: function () { + BI.SmallTextTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options, c = this._const; + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + height: o.height, + text: o.text, + hgap: c.hgap + }); + this.trigerButton = BI.createWidget({ + type: "bi.trigger_icon_button", + width: c.triggerWidth + }); + + BI.createWidget({ + element: this, + type: 'bi.htape', + items: [ + { + el: this.text + }, { + el: this.trigerButton, + width: c.triggerWidth + } + ] + }); + }, + + setValue: function (value) { + this.text.setValue(value); + }, + + setText: function (text) { + this.text.setText(text); + } +}); +BI.shortcut("bi.small_text_trigger", BI.SmallTextTrigger);/** + * + * Created by GUY on 2016/5/26. + * @class BI.SequenceTableTreeNumber + * @extends BI.Widget + */ +BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.SequenceTableTreeNumber.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-sequence-table-tree-number", + isNeedFreeze: false, + startSequence: 1,//开始的序号 + scrollTop: 0, + headerRowSize: 25, + rowSize: 25, + + sequenceHeaderCreator: null, + + header: [], + items: [], //二维数组 + + //交叉表头 + crossHeader: [], + crossItems: [] + }); + }, + + _init: function () { + BI.SequenceTableTreeNumber.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.vCurr = 1; + this.hCurr = 1; + this.tasks = []; + this.renderedCells = []; + this.renderedKeys = []; + + this.container = BI.createWidget({ + type: "bi.absolute", + width: 60, + scrollable: false + }); + + this.scrollContainer = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.container] + }); + + this.headerContainer = BI.createWidget({ + type: "bi.absolute", + cls: "bi-border", + width: 58, + scrollable: false + }); + + this.layout = BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: this.headerContainer, + height: this._getHeaderHeight() - 2 + }, {el: {type: "bi.layout"}, height: 2}, { + el: this.scrollContainer + }] + }); + //缓存第一行对应的序号 + this.start = this.options.startSequence; + this.cache = {}; + this._nextState(); + + this._populate(); + }, + + _getNextSequence: function (nodes) { + var self = this; + var start = this.start; + var cnt = this.start; + + function track(node) { + //如果已经有缓存了就不改计数了,复杂表会出现这种情况 + self.cache[node.text || node.value] || (self.cache[node.text || node.value] = cnt); + cnt++; + } + + BI.each(nodes, function (i, node) { + if (BI.isNotEmptyArray(node.children)) { + BI.each(node.children, function (index, child) { + if (index === 0) { + if (self.cache[child.text || child.value]) { + start = cnt = self.cache[child.text || child.value]; + } + } + track(child) + }); + } + }); + this.start = cnt; + return start; + }, + + _getStart: function (nodes) { + var self = this; + var start = this.start; + BI.some(nodes, function (i, node) { + if (BI.isNotEmptyArray(node.children)) { + return BI.some(node.children, function (index, child) { + if (index === 0) { + if (self.cache[child.text || child.value]) { + start = self.cache[child.text || child.value]; + return true; + } + } + }); + } + }); + return start; + }, + + _formatNumber: function (nodes) { + var self = this, o = this.options; + var result = []; + var count = this._getStart(nodes); + + function getLeafCount(node) { + var cnt = 0; + if (BI.isNotEmptyArray(node.children)) { + BI.each(node.children, function (index, child) { + cnt += getLeafCount(child); + }); + if (/**node.children.length > 1 && **/BI.isNotEmptyArray(node.values)) { + cnt++; + } + } else { + cnt++; + } + return cnt; + } + + var start = 0, top = 0; + BI.each(nodes, function (i, node) { + if (BI.isArray(node.children)) { + BI.each(node.children, function (index, child) { + var cnt = getLeafCount(child); + result.push({ + text: count++, + start: start, + top: top, + cnt: cnt, + index: index, + height: cnt * o.rowSize + }); + start += cnt; + top += cnt * o.rowSize; + }); + if (BI.isNotEmptyArray(node.values)) { + result.push({ + text: BI.i18nText("BI-Summary_Values"), + start: start++, + top: top, + cnt: 1, + isSummary: true, + height: o.rowSize + }); + top += o.rowSize; + } + } + }); + return result; + }, + + _layout: function () { + var self = this, o = this.options; + var headerHeight = this._getHeaderHeight() - 2; + var items = this.layout.attr("items"); + if (o.isNeedFreeze === false) { + items[0].height = 0; + items[1].height = 0; + } else if (o.isNeedFreeze === true) { + items[0].height = headerHeight; + items[1].height = 2; + } + this.layout.attr("items", items); + this.layout.resize(); + try { + this.scrollContainer.element.scrollTop(o.scrollTop); + } catch (e) { + + } + }, + + _getHeaderHeight: function () { + var o = this.options; + return o.headerRowSize * (o.crossHeader.length + (o.header.length > 0 ? 1 : 0)); + }, + + _nextState: function () { + var o = this.options; + this._getNextSequence(o.items); + }, + + _prevState: function () { + var self = this, o = this.options; + var firstChild; + BI.some(o.items, function (i, node) { + if (BI.isNotEmptyArray(node.children)) { + return BI.some(node.children, function (j, child) { + firstChild = child; + return true; + }); + } + }); + if (firstChild && BI.isNotEmptyObject(this.cache)) { + this.start = this.cache[firstChild.text || firstChild.value]; + } else { + this.start = 1; + } + this._nextState(); + }, + + _getMaxScrollTop: function (numbers) { + var cnt = 0; + BI.each(numbers, function (i, number) { + cnt += number.cnt; + }); + return Math.max(0, cnt * this.options.rowSize - (this.options.height - this._getHeaderHeight()) + BI.DOM.getScrollWidth()); + }, + + _createHeader: function () { + var o = this.options; + BI.createWidget({ + type: "bi.absolute", + element: this.headerContainer, + items: [{ + el: o.sequenceHeaderCreator || { + type: "bi.table_style_cell", + cls: "sequence-table-title-cell", + styleGetter: o.headerCellStyleGetter, + text: BI.i18nText("BI-Number_Index") + }, + left: 0, + top: 0, + right: 0, + bottom: 0 + }] + }); + }, + + _calculateChildrenToRender: function () { + var self = this, o = this.options; + + var renderedCells = [], renderedKeys = []; + var numbers = this._formatNumber(o.items); + var intervalTree = BI.PrefixIntervalTree.uniform(numbers.length, 0); + BI.each(numbers, function (i, number) { + intervalTree.set(i, number.height); + }); + var scrollTop = BI.clamp(o.scrollTop, 0, this._getMaxScrollTop(numbers)); + var index = intervalTree.greatestLowerBound(scrollTop); + var offsetTop = -(scrollTop - (index > 0 ? intervalTree.sumTo(index - 1) : 0)); + var height = offsetTop; + var bodyHeight = o.height - this._getHeaderHeight(); + while (height < bodyHeight && index < numbers.length) { + renderedKeys.push(index); + offsetTop += numbers[index].height; + height += numbers[index].height; + index++; + } + + BI.each(renderedKeys, function (i, key) { + var index = BI.deepIndexOf(self.renderedKeys, key); + if (index > -1) { + if (numbers[key].height !== self.renderedCells[index]._height) { + self.renderedCells[index]._height = numbers[key].height; + self.renderedCells[index].el.setHeight(numbers[key].height); + } + if (numbers[key].top !== self.renderedCells[index].top) { + self.renderedCells[index].top = numbers[key].top; + self.renderedCells[index].el.element.css("top", numbers[key].top + "px"); + } + renderedCells.push(self.renderedCells[index]); + } else { + var child = BI.createWidget(BI.extend({ + type: "bi.table_style_cell", + cls: "sequence-table-number-cell bi-border-left bi-border-right bi-border-bottom", + width: 60, + styleGetter: numbers[key].isSummary === true ? function () { + return o.summaryCellStyleGetter(true); + } : function (key) { + return function () { + return o.sequenceCellStyleGetter(key); + } + }(numbers[key].index) + }, numbers[key])); + renderedCells.push({ + el: child, + left: 0, + top: numbers[key].top, + _height: numbers[key].height + }); + } + }); + + //已存在的, 需要添加的和需要删除的 + var existSet = {}, addSet = {}, deleteArray = []; + BI.each(renderedKeys, function (i, key) { + if (BI.deepContains(self.renderedKeys, key)) { + existSet[i] = key; + } else { + addSet[i] = key; + } + }); + BI.each(this.renderedKeys, function (i, key) { + if (BI.deepContains(existSet, key)) { + return; + } + if (BI.deepContains(addSet, key)) { + return; + } + deleteArray.push(i); + }); + BI.each(deleteArray, function (i, index) { + self.renderedCells[index].el.destroy(); + }); + var addedItems = []; + BI.each(addSet, function (index) { + addedItems.push(renderedCells[index]) + }); + BI.createWidget({ + type: "bi.absolute", + element: this.container, + items: addedItems + }); + this.renderedCells = renderedCells; + this.renderedKeys = renderedKeys; + + this.container.setHeight(intervalTree.sumUntil(numbers.length)); + }, + + _restore: function () { + BI.each(this.renderedCells, function (i, cell) { + cell.el.destroy(); + }); + this.renderedCells = []; + this.renderedKeys = []; + }, + + _populate: function () { + var self = this; + BI.each(this.tasks, function (i, task) { + task.apply(self); + }); + this.tasks = []; + this.headerContainer.empty(); + this._createHeader(); + this._layout(); + this._calculateChildrenToRender(); + }, + + setVerticalScroll: function (scrollTop) { + if (this.options.scrollTop !== scrollTop) { + this.options.scrollTop = scrollTop; + try { + this.scrollContainer.element.scrollTop(scrollTop); + } catch (e) { + + } + } + }, + + getVerticalScroll: function () { + return this.options.scrollTop; + }, + + setVPage: function (v) { + if (v <= 1) { + this.cache = {}; + this.start = this.options.startSequence; + this._restore(); + this.tasks.push(this._nextState); + } else if (v === this.vCurr + 1) { + this.tasks.push(this._nextState); + } else if (v === this.vCurr - 1) { + this.tasks.push(this._prevState); + } + this.vCurr = v; + }, + + setHPage: function (v) { + if (v !== this.hCurr) { + this.tasks.push(this._prevState); + } + this.hCurr = v; + }, + + restore: function () { + this._restore(); + }, + + populate: function (items, header, crossItems, crossHeader) { + var o = this.options; + if (items && items !== this.options.items) { + o.items = items; + this._restore(); + this.tasks.push(this._prevState); + } + if (header && header !== this.options.header) { + o.header = header; + } + if (crossItems && crossItems !== this.options.crossItems) { + o.crossItems = crossItems; + } + if (crossHeader && crossHeader !== this.options.crossHeader) { + o.crossHeader = crossHeader; + } + this._populate(); + } +}); +BI.shortcut('bi.sequence_table_tree_number', BI.SequenceTableTreeNumber);/** + * 自适应布局 + * + * 1、resize + * 2、吸附 + * 3、当前组件在最上方 + * 4、可以撤销 + * 5、上下之间插入组件 + * + * Created by GUY on 2016/2/23. + * @class BI.AdaptiveArrangement + * @extends BI.Widget + */ +BI.AdaptiveArrangement = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.AdaptiveArrangement.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-adaptive-arrangement", + resizable: true, + layoutType: BI.Arrangement.LAYOUT_TYPE.FREE, + items: [] + }); + }, + + _init: function () { + BI.AdaptiveArrangement.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.arrangement = BI.createWidget({ + type: "bi.arrangement", + element: this, + layoutType: o.layoutType, + items: o.items + }); + this.arrangement.on(BI.Arrangement.EVENT_SCROLL, function () { + self.fireEvent(BI.AdaptiveArrangement.EVENT_SCROLL, arguments); + }); + this.zIndex = 0; + BI.each(o.items, function (i, item) { + self._initResizable(item.el); + }); + + $(document).mousedown(function (e) { + BI.each(self.getAllRegions(), function (i, region) { + if (region.el.element.find(e.target).length === 0) { + region.el.element.removeClass("selected"); + } + }); + }); + BI.ResizeDetector.addResizeListener(this, function () { + self.arrangement.resize(); + self.fireEvent(BI.AdaptiveArrangement.EVENT_RESIZE); + }); + }, + + _isEqual: function () { + return this.arrangement._isEqual.apply(this.arrangement, arguments); + }, + + _setSelect: function (item) { + if (!item.element.hasClass("selected")) { + item.element.css("zIndex", ++this.zIndex); + BI.each(this.getAllRegions(), function (i, region) { + region.el.element.removeClass("selected"); + }); + item.element.addClass("selected"); + } + }, + + _initResizable: function (item) { + var self = this, o = this.options; + item.element.css("zIndex", ++this.zIndex); + item.element.mousedown(function () { + self._setSelect(item) + }); + // o.resizable && item.element.resizable({ + // handles: "e, s, se", + // minWidth: 20, + // minHeight: 20, + // autoHide: true, + // helper: "bi-resizer", + // start: function () { + // item.element.css("zIndex", ++self.zIndex); + // self.fireEvent(BI.AdaptiveArrangement.EVENT_ELEMENT_START_RESIZE); + // }, + // resize: function (e, ui) { + // // self._resize(item.attr("id"), ui.size); + // self._resize(item.attr("id"), e, ui.size, ui.position); + // }, + // stop: function (e, ui) { + // self._stopResize(item.attr("id"), ui.size); + // self.fireEvent(BI.AdaptiveArrangement.EVENT_ELEMENT_STOP_RESIZE, item.attr("id"), ui.size); + // self.fireEvent(BI.AdaptiveArrangement.EVENT_RESIZE); + // } + // }); + }, + + // _resize: function (name, e, size, position) { + // var self = this; + // this.scrollInterval(e, false, true, function (changedSize) { + // size.width += changedSize.offsetX; + // size.height += changedSize.offsetY; + // var containerWidth = self.arrangement.container.element.width(); + // var containerHeight = self.arrangement.container.element.height(); + // self.arrangement.container.element.width(containerWidth + changedSize.offsetX); + // self.arrangement.container.element.height(containerHeight + changedSize.offsetY); + // switch (self.getLayoutType()) { + // case BI.Arrangement.LAYOUT_TYPE.FREE: + // break; + // case BI.Arrangement.LAYOUT_TYPE.GRID: + // self.setRegionSize(name, size); + // break; + // } + // self.fireEvent(BI.AdaptiveArrangement.EVENT_ELEMENT_RESIZE, name, size); + // }); + // }, + // + // _stopResize: function (name, size) { + // var self = this; + // this.scrollEnd(); + // switch (this.getLayoutType()) { + // case BI.Arrangement.LAYOUT_TYPE.FREE: + // this.setRegionSize(name, size); + // break; + // case BI.Arrangement.LAYOUT_TYPE.GRID: + // this.setRegionSize(name, size); + // break; + // } + // }, + + _getScrollOffset: function () { + return this.arrangement._getScrollOffset(); + }, + + getClientWidth: function () { + return this.arrangement.getClientWidth(); + }, + + getClientHeight: function () { + return this.arrangement.getClientHeight(); + }, + + addRegion: function (region, position) { + this._initResizable(region.el); + this._setSelect(region.el); + var self = this, flag; + var old = this.arrangement.getAllRegions(); + if (flag = this.arrangement.addRegion(region, position)) { + this._old = old; + } + return flag; + }, + + deleteRegion: function (name) { + var flag; + var old = this.getAllRegions(); + if (flag = this.arrangement.deleteRegion(name)) { + this._old = old; + } else { + this._old = this.getAllRegions(); + this.relayout(); + } + return flag; + }, + + setRegionSize: function (name, size) { + var flag; + var old = this.getAllRegions(); + if (flag = this.arrangement.setRegionSize(name, size)) { + this._old = old; + } + return flag; + }, + + setPosition: function (position, size) { + var self = this; + return this.arrangement.setPosition(position, size); + }, + + setRegionPosition: function (name, position) { + var region = this.getRegionByName(name); + return this.arrangement.setRegionPosition(name, position); + }, + + setDropPosition: function (position, size) { + return this.arrangement.setDropPosition(position, size); + }, + + scrollInterval: function (e, isBorderScroll, isOverflowScroll, cb) { + var self = this; + var map = { + top: [-1, 0], + bottom: [1, 0], + left: [0, -1], + right: [0, 1] + }; + var clientSize = this.element.bounds(); + + function scrollTo(direction, callback) { + if (direction === "") { + self.lastActiveRegion = ""; + if (self._scrollInterval) { + clearInterval(self._scrollInterval); + self._scrollInterval = null; + } + return; + } + if (self.lastActiveRegion !== direction) { + self.lastActiveRegion = direction; + if (self._scrollInterval) { + clearInterval(self._scrollInterval); + self._scrollInterval = null; + } + var count = 0; + self._scrollInterval = setInterval(function () { + count++; + if (count <= 3) { + return; + } + var offset = self._getScrollOffset(); + var t = offset.top + map[direction][0] * 40; + var l = offset.left + map[direction][1] * 40; + if (t < 0 || l < 0) { + return; + } + callback({ + offsetX: map[direction][1] * 40, + offsetY: map[direction][0] * 40 + }); + self.scrollTo({ + top: t, + left: l + }); + }, 300); + } + } + + cb({ + offsetX: 0, + offsetY: 0 + }); + var offset = this.element.offset(); + var p = { + left: e.pageX - offset.left, + top: e.pageY - offset.top + }; + //向上滚 + if (isBorderScroll && p.top >= 0 && p.top <= 30) { + scrollTo("top", cb) + } + //向下滚 + else if (isBorderScroll && p.top >= clientSize.height - 30 && p.top <= clientSize.height) { + scrollTo("bottom", cb) + } + //向左滚 + else if (isBorderScroll && p.left >= 0 && p.left <= 30) { + scrollTo("left", cb) + } + //向右滚 + else if (isBorderScroll && p.left >= clientSize.width - 30 && p.left <= clientSize.width) { + scrollTo("right", cb) + } else { + if (isOverflowScroll === true) { + if (p.top < 0) { + scrollTo("top", cb); + } + else if (p.top > clientSize.height) { + scrollTo("bottom", cb); + } + else if (p.left < 0) { + scrollTo("left", cb); + } + else if (p.left > clientSize.width) { + scrollTo("right", cb); + } else { + scrollTo("", cb); + } + } else { + scrollTo("", cb); + } + } + }, + + scrollEnd: function () { + this.lastActiveRegion = ""; + if (this._scrollInterval) { + clearInterval(this._scrollInterval); + this._scrollInterval = null; + } + }, + + scrollTo: function (scroll) { + this.arrangement.scrollTo(scroll); + }, + + zoom: function (ratio) { + this.arrangement.zoom(ratio); + }, + + resize: function () { + this.arrangement.resize(); + }, + + relayout: function () { + return this.arrangement.relayout(); + }, + + setLayoutType: function (type) { + var self = this; + this.arrangement.setLayoutType(type); + }, + + getLayoutType: function () { + return this.arrangement.getLayoutType(); + }, + + getLayoutRatio: function () { + return this.arrangement.getLayoutRatio(); + }, + + getHelper: function () { + return this.arrangement.getHelper(); + }, + + getRegionByName: function (name) { + return this.arrangement.getRegionByName(name); + }, + + getAllRegions: function () { + return this.arrangement.getAllRegions(); + }, + + revoke: function () { + if (this._old) { + this.populate(BI.toArray(this._old)); + } + }, + + populate: function (items) { + var self = this; + BI.each(items, function (i, item) { + self._initResizable(item.el); + }); + this.arrangement.populate(items); + } +}); +BI.AdaptiveArrangement.EVENT_ELEMENT_START_RESIZE = "AdaptiveArrangement.EVENT_ELEMENT_START_RESIZE"; +BI.AdaptiveArrangement.EVENT_ELEMENT_RESIZE = "AdaptiveArrangement.EVENT_ELEMENT_RESIZE"; +BI.AdaptiveArrangement.EVENT_ELEMENT_STOP_RESIZE = "AdaptiveArrangement.EVENT_ELEMENT_STOP_RESIZE"; +BI.AdaptiveArrangement.EVENT_RESIZE = "AdaptiveArrangement.EVENT_RESIZE"; +BI.AdaptiveArrangement.EVENT_SCROLL = "AdaptiveArrangement.EVENT_SCROLL"; +BI.shortcut('bi.adaptive_arrangement', BI.AdaptiveArrangement);/** + * Arrangement的block面板 + * + * Created by GUY on 2016/3/1. + * @class BI.ArrangementBlock + * @extends BI.Widget + */ +BI.ArrangementBlock = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.ArrangementBlock.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-arrangement-block bi-mask" + }); + } +}); +BI.shortcut('bi.arrangement_block', BI.ArrangementBlock);/** + * Arrangement的drop面板 + * + * Created by GUY on 2016/3/1. + * @class BI.ArrangementDroppable + * @extends BI.Widget + */ +BI.ArrangementDroppable = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.ArrangementDroppable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-arrangement-droppable bi-resizer" + }); + } +}); +BI.shortcut('bi.arrangement_droppable', BI.ArrangementDroppable);/** + * 布局 + * + * Created by GUY on 2016/2/23. + * @class BI.Arrangement + * @extends BI.Widget + */ +BI.Arrangement = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.Arrangement.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-arrangement", + layoutType: BI.Arrangement.LAYOUT_TYPE.GRID, + items: [] + }); + }, + + _init: function () { + BI.Arrangement.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.arrangement = BI.createWidget({ + type: "bi.arrangement_droppable", + cls: "arrangement-block", + invisible: true + }); + this.block = BI.createWidget({ + type: "bi.arrangement_block", + invisible: true + }); + this.container = BI.createWidget({ + type: "bi.absolute", + items: o.items.concat([this.block, this.arrangement]) + }); + + this.scrollContainer = BI.createWidget({ + type: "bi.adaptive", + width: "100%", + height: "100%", + scrollable: true, + items: [this.container] + }); + this.scrollContainer.element.scroll(function () { + self.fireEvent(BI.Arrangement.EVENT_SCROLL, { + scrollLeft: self.scrollContainer.element.scrollLeft(), + scrollTop: self.scrollContainer.element.scrollTop(), + clientWidth: self.scrollContainer.element[0].clientWidth, + clientHeight: self.scrollContainer.element[0].clientHeight + }); + }); + + BI.createWidget({ + type: "bi.adaptive", + element: this, + items: [this.scrollContainer] + }); + this.regions = {}; + if (o.items.length > 0) { + BI.nextTick(function () { + self.populate(o.items); + }); + } + }, + + ////初始化操作//// + _calculateRegions: function (items) { + var self = this, o = this.options; + this.regions = {}; + BI.each(items, function (i, item) { + var region = self._createOneRegion(item); + self.regions[region.id] = region; + }); + }, + + _isEqual: function (num1, num2) { + return Math.abs(num1 - num2) < 2; + }, + + _isLessThan: function (num1, num2) { + return num1 < num2 && !this._isEqual(num1, num2); + }, + + _isMoreThan: function (num1, num2) { + return num1 > num2 && !this._isEqual(num1, num2); + }, + + _isLessThanEqual: function (num1, num2) { + return num1 <= num2 || this._isEqual(num1, num2); + }, + + _isMoreThanEqual: function (num1, num2) { + return num1 >= num2 || this._isEqual(num1, num2); + }, + + //获取占有的最大Region + _getRegionOccupied: function (regions) { + var self = this, o = this.options; + if (BI.size(regions || this.regions) <= 0) { + return { + left: 0, + top: 0, + width: 0, + height: 0 + } + } + var minLeft = BI.MAX, maxLeft = BI.MIN, minTop = BI.MAX, maxTop = BI.MIN; + BI.each(regions || this.regions, function (id, region) { + minLeft = Math.min(minLeft, region.left); + maxLeft = Math.max(maxLeft, region.left + region.width); + minTop = Math.min(minTop, region.top); + maxTop = Math.max(maxTop, region.top + region.height); + }); + return { + left: minLeft, + top: minTop, + width: maxLeft - minLeft, + height: maxTop - minTop + } + }, + + //两个区域的交叉面积 + _getCrossArea: function (region1, region2) { + if (region1.left <= region2.left) { + if (region1.top <= region2.top) { + if (region1.top + region1.height > region2.top && region1.left + region1.width > region2.left) { + if (this._isEqual(region1.top + region1.height, region2.top) || this._isEqual(region1.left + region1.width, region2.left)) { + return 0; + } + return (region1.top + region1.height - region2.top) * (region1.left + region1.width - region2.left); + } + } else { + if (region2.top + region2.height > region1.top && region1.left + region1.width > region2.left) { + if (this._isEqual(region2.top + region2.height, region1.top) || this._isEqual(region1.left + region1.width, region2.left)) { + return 0; + } + return (region2.top + region2.height - region1.top) * (region1.left + region1.width - region2.left); + } + } + } else { + if (region1.top <= region2.top) { + if (region1.top + region1.height > region2.top && region2.left + region2.width > region1.left) { + if (this._isEqual(region1.top + region1.height, region2.top) || this._isEqual(region2.left + region2.width, region1.left)) { + return 0; + } + return (region1.top + region1.height - region2.top) * (region2.left + region2.width - region1.left); + } + } else { + if (region2.top + region2.height > region1.top && region2.left + region2.width > region1.left) { + if (this._isEqual(region2.top + region2.height, region1.top) || this._isEqual(region2.left + region2.width, region1.left)) { + return 0; + } + return (region2.top + region2.height - region1.top) * (region2.left + region2.width - region1.left); + } + } + } + return 0; + }, + + //是否有覆盖的组件 + _isRegionOverlay: function (regions) { + var reg = []; + BI.each(regions || this.regions, function (id, region) { + reg.push(new BI.Region(region.left, region.top, region.width, region.height)); + }); + for (var i = 0, len = reg.length; i < len; i++) { + for (var j = i + 1; j < len; j++) { + var area1 = { + left: reg[i].x, + top: reg[i].y, + width: reg[i].w, + height: reg[i].h + }; + var area2 = { + left: reg[j].x, + top: reg[j].y, + width: reg[j].w, + height: reg[j].h + }; + if (reg[i].isIntersects(reg[j]) && this._getCrossArea(area1, area2) > 1) { + return true; + } + } + } + return false; + }, + + //布局是否是优良的 + _isArrangeFine: function (regions) { + switch (this.options.layoutType) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + return true; + case BI.Arrangement.LAYOUT_TYPE.GRID: + // if (this._isRegionOverlay()) { + // return false; + // } + } + return true; + }, + + _getRegionNames: function (regions) { + var names = []; + BI.each(regions || this.regions, function (i, region) { + names.push(region.id || region.attr("id")); + }); + return names; + }, + + _getRegionsByNames: function (names, regions) { + names = BI.isArray(names) ? names : [names]; + regions = regions || this.regions; + if (BI.isArray(regions)) { + var result = []; + BI.each(regions, function (i, region) { + if (names.contains(region.id || region.attr("id"))) { + result.push(region); + } + }); + } else { + var result = {}; + BI.each(names, function (i, name) { + result[name] = regions[name]; + }); + } + return result; + }, + + _cloneRegion: function (regions) { + var clone = {}; + BI.each(regions || this.regions, function (id, region) { + clone[id] = {}; + clone[id].el = region.el; + clone[id].id = region.id; + clone[id].left = region.left; + clone[id].top = region.top; + clone[id].width = region.width; + clone[id].height = region.height; + }); + return clone; + }, + + //测试合法性 + _test: function (regions) { + var self = this; + return !BI.any(regions || this.regions, function (i, region) { + if (BI.isNaN(region.width) || BI.isNaN(region.height) || region.width <= 21 || region.height <= 21) { + return true; + } + }) + }, + + _getScrollOffset: function () { + return { + left: this.scrollContainer.element[0].scrollLeft, + top: this.scrollContainer.element[0].scrollTop + } + }, + + ////操作//// + _createOneRegion: function (item) { + var el = BI.createWidget(item.el); + el.setVisible(true); + return { + id: el.attr("id"), + left: item.left, + top: item.top, + width: item.width, + height: item.height, + el: el + } + }, + + _applyRegion: function (regions) { + var self = this, o = this.options; + BI.each(regions || this.regions, function (i, region) { + region.el.element.css({ + left: region.left, + top: region.top, + width: region.width, + height: region.height + }); + }); + this._applyContainer(); + this.ratio = this.getLayoutRatio(); + }, + + _renderRegion: function () { + var self = this; + BI.createWidget({ + type: "bi.absolute", + element: this.container, + items: BI.toArray(this.regions) + }); + }, + + getClientWidth: function () { + return this.scrollContainer.element[0].clientWidth; + }, + + getClientHeight: function () { + return this.scrollContainer.element[0].clientHeight; + }, + + _applyContainer: function () { + //先掩藏后显示能够明确滚动条是否出现 + this.scrollContainer.element.css("overflow", "hidden"); + var occupied = this._getRegionOccupied(); + this.container.element.width(occupied.left + occupied.width).height(occupied.top + occupied.height); + this.scrollContainer.element.css("overflow", "auto"); + return occupied; + }, + + _modifyRegion: function (regions) { + BI.each(this.regions, function (id, region) { + if (regions[id]) { + region.left = regions[id].left; + region.top = regions[id].top; + region.width = regions[id].width; + region.height = regions[id].height; + } + }); + }, + + _addRegion: function (item) { + var region = this._createOneRegion(item); + this.regions[region.id] = region; + BI.createWidget({ + type: "bi.absolute", + element: this.container, + items: [region] + }); + }, + + _deleteRegionByName: function (name) { + this.regions[name].el.setVisible(false); + delete this.regions[name]; + }, + + _setArrangeSize: function (size) { + this.arrangement.element.css({ + left: size.left, + top: size.top, + width: size.width, + height: size.height + }) + }, + + //Grid + _getOneWidthPortion: function () { + return this.getClientWidth() / BI.Arrangement.PORTION; + }, + _getOneHeightPortion: function () { + return this.getClientHeight() / BI.Arrangement.H_PORTION; + }, + + _getGridPositionAndSize: function (position) { + var perWidth = this._getOneWidthPortion(); + var perHeight = this._getOneHeightPortion(); + var widthPortion = Math.round(position.width / perWidth); + var leftPortion = Math.round(position.left / perWidth); + var topPortion = Math.round(position.top / perHeight); + var heightPortion = Math.round(position.height / perHeight); + // if (leftPortion > BI.Arrangement.PORTION) { + // leftPortion = BI.Arrangement.PORTION; + // } + // if (widthPortion > BI.Arrangement.PORTION) { + // widthPortion = BI.Arrangement.PORTION; + // } + // if (leftPortion + widthPortion > BI.Arrangement.PORTION) { + // leftPortion = BI.Arrangement.PORTION - widthPortion; + // } + if (widthPortion === 0) { + widthPortion = 1; + } + if (heightPortion === 0) { + heightPortion = 1; + } + return { + x: leftPortion, + y: topPortion, + w: widthPortion, + h: heightPortion + } + }, + + _getBlockPositionAndSize: function (position) { + var perWidth = this._getOneWidthPortion(); + var perHeight = this._getOneHeightPortion(); + return { + left: position.x * perWidth, + top: position.y * perHeight, + width: position.w * perWidth, + height: position.h * perHeight + }; + }, + + _getLayoutsByRegions: function (regions) { + var self = this; + var result = []; + BI.each(regions || this.regions, function (id, region) { + result.push(BI.extend(self._getGridPositionAndSize(region), { + i: region.id + })) + }); + return result; + }, + + _getLayoutIndexByName: function (layout, name) { + return BI.findIndex(layout, function (i, l) { + return l.i === name; + }); + }, + + _setBlockPositionAndSize: function (size) { + this.block.element.css({ + left: size.left, + top: size.top, + width: size.width, + height: size.height + }); + }, + + _getRegionsByLayout: function (layout) { + var self = this; + var regions = {}; + BI.each(layout, function (i, ly) { + regions[ly.i] = BI.extend(self._getBlockPositionAndSize(ly), { + id: ly.i + }); + }); + return regions; + }, + + _setRegionsByLayout: function (regions, layout) { + var self = this; + regions || (regions = this.regions); + BI.each(layout, function (i, ly) { + if (regions[ly.i]) { + BI.extend(regions[ly.i], self._getBlockPositionAndSize(ly)); + } + }); + return regions; + }, + + _moveElement: function (layout, l, x, y, isUserAction) { + var self = this; + if (l._static) { + return layout; + } + + if (l.y === y && l.x === x) { + return layout; + } + + var movingUp = y && l.y > y; + if (typeof x === 'number') { + l.x = x; + } + if (typeof y === 'number') { + l.y = y; + } + l.moved = true; + + var sorted = this._sortLayoutItemsByRowCol(layout); + if (movingUp) { + sorted = sorted.reverse(); + } + var collisions = getAllCollisions(sorted, l); + + for (var i = 0, len = collisions.length; i < len; i++) { + var collision = collisions[i]; + if (collision.moved) { + continue; + } + + if (l.y > collision.y && l.y - collision.y > collision.h / 4) { + continue; + } + + if (collision._static) { + layout = this._moveElementAwayFromCollision(layout, collision, l, isUserAction); + } else { + layout = this._moveElementAwayFromCollision(layout, l, collision, isUserAction); + } + } + + return layout; + + function getAllCollisions(layout, layoutItem) { + return BI.filter(layout, function (i, l) { + return self._collides(l, layoutItem); + }); + } + }, + + _sortLayoutItemsByRowCol: function (layout) { + return [].concat(layout).sort(function (a, b) { + if (a.y > b.y || (a.y === b.y && a.x > b.x)) { + return 1; + } + return -1; + }); + }, + + _collides: function (l1, l2) { + if (l1 === l2) { + return false; + } // same element + if (l1.x + l1.w <= l2.x) { + return false; + } // l1 is left of l2 + if (l1.x >= l2.x + l2.w) { + return false; + } // l1 is right of l2 + if (l1.y + l1.h <= l2.y) { + return false; + } // l1 is above l2 + if (l1.y >= l2.y + l2.h) { + return false; + } // l1 is below l2 + return true; // boxes overlap + }, + + _getFirstCollision: function (layout, layoutItem) { + for (var i = 0, len = layout.length; i < len; i++) { + if (this._collides(layout[i], layoutItem)) { + return layout[i]; + } + } + }, + + _moveElementAwayFromCollision: function (layout, collidesWith, + itemToMove, isUserAction) { + if (isUserAction) { + var fakeItem = { + x: itemToMove.x, + y: itemToMove.y, + w: itemToMove.w, + h: itemToMove.h, + i: '-1' + }; + fakeItem.y = Math.max(collidesWith.y - itemToMove.h, 0); + if (!this._getFirstCollision(layout, fakeItem)) { + return this._moveElement(layout, itemToMove, undefined, fakeItem.y); + } + } + + return this._moveElement(layout, itemToMove, undefined, itemToMove.y + 1); + }, + + _compactItem: function (compareWith, l, verticalCompact) { + if (verticalCompact) { + while (l.y > 0 && !this._getFirstCollision(compareWith, l)) { + l.y--; + } + } + + var collides; + while ((collides = this._getFirstCollision(compareWith, l))) { + l.y = collides.y + collides.h; + } + return l; + }, + + compact: function (layout, verticalCompact) { + var compareWith = getStatics(layout); + var sorted = this._sortLayoutItemsByRowCol(layout); + var out = []; + + for (var i = 0, len = sorted.length; i < len; i++) { + var l = sorted[i]; + + if (!l._static) { + l = this._compactItem(compareWith, l, verticalCompact); + + compareWith.push(l); + } + + out[layout.indexOf(l)] = l; + + l.moved = false; + } + + return out; + function getStatics(layout) { + return BI.filter(layout, function (i, l) { + return l._static; + }); + } + }, + + ////公有方法//// + getRegionByName: function (name) { + var obj = {}; + obj[name] = this.regions[name]; + return this._cloneRegion(obj)[name]; + }, + + getAllRegions: function () { + return BI.toArray(this._cloneRegion()); + }, + + getHelper: function () { + var helper = BI.createWidget({ + type: "bi.layout", + width: 18, + height: 18, + cls: "arrangement-helper bi-border" + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [helper] + }); + return helper; + }, + + _start: function () { + if (this.options.layoutType === BI.Arrangement.LAYOUT_TYPE.GRID) { + this.block.setVisible(true); + } else { + this.arrangement.setVisible(true); + } + }, + + _stop: function () { + this.arrangement.setVisible(false); + this.block.setVisible(false); + }, + + ////公有操作//// + setLayoutType: function (type) { + var self = this, o = this.options; + if (type !== o.layoutType) { + o.layoutType = type; + switch (o.layoutType) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + this.relayout(); + break; + } + } + }, + + getLayoutType: function () { + return this.options.layoutType; + }, + + getLayoutRatio: function () { + var occupied = this._getRegionOccupied(); + var width = this.getClientWidth(), height = this.getClientHeight(); + return { + x: BI.parseFloat(BI.contentFormat((occupied.left + occupied.width) / width, "#.##;-#.##")), + y: BI.parseFloat(BI.contentFormat((occupied.top + occupied.height) / height, "#.##;-#.##")) + } + }, + + addRegion: function (region, position) { + if (position) { + this.setPosition(position, region); + } + var self = this, o = this.options; + if (!this.position) { + return false; + } + var test = this._cloneRegion(); + BI.each(this.position.regions, function (i, region) { + test[region.id].left = region.left; + test[region.id].top = region.top; + test[region.id].width = region.width; + test[region.id].height = region.height; + + }); + var item = BI.extend({}, region, { + left: this.position.insert.left, + top: this.position.insert.top, + width: this.position.insert.width, + height: this.position.insert.height + }); + var added = this._createOneRegion(item); + test[added.id] = added; + if (this._test(test)) { + delete test[added.id]; + this._modifyRegion(test); + this._addRegion(item); + this._populate(this.getAllRegions()); + return true; + } + return false; + }, + + deleteRegion: function (name) { + if (!this.regions[name]) { + return false; + } + var self = this, o = this.options; + switch (o.layoutType) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + this._deleteRegionByName(name); + this._populate(this.getAllRegions()); + return true; + case BI.Arrangement.LAYOUT_TYPE.GRID: + this._deleteRegionByName(name); + this._populate(this.getAllRegions()); + this.resize(); + return true; + } + return false; + }, + + setRegionSize: function (name, size) { + var self = this, o = this.options; + var flag = false; + switch (o.layoutType) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + var clone = this._cloneRegion(); + BI.extend(clone[name], { + width: size.width, + height: size.height + }); + if (this._test(clone)) { + this._modifyRegion(clone); + flag = true; + } + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + var clone = this._cloneRegion(); + BI.extend(clone[name], { + width: size.width, + height: size.height + }); + if (this._test(clone)) { + var layout = this._getLayoutsByRegions(clone); + layout = this.compact(layout, true); + var regions = this._getRegionsByLayout(layout); + this._modifyRegion(regions); + flag = true; + } + break; + } + this._applyRegion(); + return flag; + }, + + setPosition: function (position, size) { + var self = this, o = this.options; + var insert, regions = [], cur; + if (position.left < 0 || position.top < 0) { + switch (o.layoutType) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + this.resize(); + break; + } + this._stop(); + this.position = null; + return null; + } + var offset = this._getScrollOffset(); + position = { + left: position.left + offset.left, + top: position.top + offset.top + }; + switch (o.layoutType) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + var insert = { + top: position.top < 0 ? 0 : position.top, + left: position.left < 0 ? 0 : position.left, + width: size.width, + height: size.height + }; + this.position = { + insert: insert + }; + this._setArrangeSize(insert); + this._start(); + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + var p = { + top: position.top < 0 ? 0 : position.top, + left: position.left < 0 ? 0 : position.left, + width: size.width, + height: size.height + }; + this._setArrangeSize(p); + var cur = this._getGridPositionAndSize(p); + var layout = [{ + x: 0, y: BI.MAX, w: cur.w, h: cur.h, i: cur.i + }].concat(this._getLayoutsByRegions()); + layout = this._moveElement(layout, layout[0], cur.x, cur.y, true); + layout = this.compact(layout, true); + var regions = this._setRegionsByLayout(this._cloneRegion(), layout); + var insert = this._getBlockPositionAndSize(layout[0]); + this.position = { + insert: insert, + regions: regions + }; + this._applyRegion(regions); + this._setBlockPositionAndSize(insert); + this._start(); + break; + } + return this.position; + }, + + setRegionPosition: function (name, position) { + var self = this, o = this.options; + var offset = this._getScrollOffset(); + position = BI.extend(position, { + left: position.left + offset.left, + top: position.top + offset.top + }); + switch (o.layoutType) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + BI.extend(this.regions[name], { + left: position.left < 0 ? 0 : position.left, + top: position.top < 0 ? 0 : position.top + }); + this._applyRegion(); + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + if (!position.stop) { + BI.extend(this.regions[name], { + left: position.left < 0 ? 0 : position.left, + top: position.top < 0 ? 0 : position.top + }); + var cloned = this._cloneRegion(); + var cur = this._getGridPositionAndSize(BI.extend(cloned[name], { + left: position.left < 0 ? 0 : position.left, + top: position.top < 0 ? 0 : position.top + })); + var x = cur.x, y = cur.y; + cur = BI.extend(cur, { + x: 0, y: BI.MAX, i: -1 + }); + delete cloned[name]; + var layout = this._getLayoutsByRegions(cloned); + layout = this._moveElement([cur].concat(layout), cur, x, y, true); + layout = this.compact(layout, true); + var regions = this._getRegionsByLayout(layout); + this._modifyRegion(regions); + this._applyRegion(); + + this._setBlockPositionAndSize(this._getBlockPositionAndSize(cur)); + this.block.setVisible(true); + } else { + BI.extend(this.regions[name], { + left: position.left < 0 ? 0 : position.left, + top: position.top < 0 ? 0 : position.top + }); + var cloned = this._cloneRegion(); + var layout = this._getLayoutsByRegions(cloned); + layout = this.compact(layout, true); + var regions = this._getRegionsByLayout(layout); + this._modifyRegion(regions); + this._applyRegion(); + this.block.setVisible(false); + } + break; + } + }, + + setDropPosition: function (position, size) { + var self = this; + this.arrangement.setVisible(true); + var offset = this._getScrollOffset(); + this._setArrangeSize(BI.extend({}, size, { + left: position.left + offset.left, + top: position.top + offset.top + })); + return function () { + self.arrangement.setVisible(false); + } + }, + + scrollTo: function (scroll) { + this.scrollContainer.element.scrollTop(scroll.top); + this.scrollContainer.element.scrollLeft(scroll.left); + }, + + zoom: function (ratio) { + var self = this, o = this.options; + if (!ratio) { + return; + } + var occupied = this._applyContainer(); + switch (this.getLayoutType()) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + if (this._isArrangeFine()) { + var width = this.getClientWidth(); + var xRatio = (ratio.x || 1) * width / (occupied.left + occupied.width); + //var yRatio = ratio.y * height / (occupied.top + occupied.height); + var regions = this._cloneRegion(); + BI.each(regions, function (i, region) { + region.left = region.left * xRatio; + //region.top = region.top * yRatio; + region.width = region.width * xRatio; + //region.height = region.height * yRatio; + }); + if (this._test(regions)) { + this._modifyRegion(regions); + this._applyRegion(); + } + this.resize(); + // } else { + this.relayout(); + } + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + if (this._isArrangeFine()) { + var width = this.getClientWidth(), height = this.getClientHeight(); + var xRatio = (ratio.x || 1) * width / (occupied.left + occupied.width); + var yRatio = (ratio.y || 1) * height / (occupied.top + occupied.height); + var regions = this._cloneRegion(); + BI.each(regions, function (i, region) { + region.left = region.left * xRatio; + region.width = region.width * xRatio; + region.top = region.top * yRatio; + region.height = region.height * yRatio; + //做一下自适应布局到网格布局的兼容 + var perWidth = self._getOneWidthPortion(); + var widthPortion = Math.round(region.width / perWidth); + var leftPortion = Math.round(region.left / perWidth); + var comparePortion = Math.round((region.width + region.left) / perWidth); + if (leftPortion + widthPortion !== comparePortion) { + region.left = leftPortion * perWidth; + region.width = comparePortion * perWidth - region.left; + } + }); + if (this._test(regions)) { + var layout = this._getLayoutsByRegions(regions); + layout = this.compact(layout, true); + regions = this._getRegionsByLayout(layout); + this._modifyRegion(regions); + this._applyRegion(); + } + } else { + this.relayout(); + } + break; + } + }, + + resize: function () { + var self = this, o = this.options; + switch (o.layoutType) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + this.zoom(this.ratio); + var regions = this._cloneRegion(); + var layout = this._getLayoutsByRegions(regions); + layout = this.compact(layout, true); + regions = this._getRegionsByLayout(layout); + this._modifyRegion(regions); + this._applyRegion(); + break; + } + }, + + relayout: function () { + var self = this, o = this.options; + switch (o.layoutType) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + if (!this._isArrangeFine()) { + var perHeight = this._getOneHeightPortion(); + var width = this.getClientWidth(), height = this.getClientHeight(); + var regions = this._cloneRegion(); + var clone = BI.toArray(regions); + clone.sort(function (r1, r2) { + if (self._isEqual(r1.top, r2.top)) { + return r1.left - r2.left; + } + return r1.top - r2.top; + }); + var count = clone.length; + var cols = 4, rows = Math.floor((count - 1) / 4 + 1); + var w = width / cols, h = height / rows; + var store = {}; + BI.each(clone, function (i, region) { + var row = Math.floor(i / 4), col = i % 4; + BI.extend(region, { + top: row * perHeight * 6, + left: col * w, + width: w, + height: perHeight * 6 + }); + if (!store[row]) { + store[row] = {}; + } + store[row][col] = region; + }); + //非4的倍数 + // if (count % 4 !== 0) { + // var lasts = store[rows - 1]; + // var perWidth = width / (count % 4); + // BI.each(lasts, function (i, region) { + // BI.extend(region, { + // left: BI.parseInt(i) * perWidth, + // width: perWidth + // }); + // }); + // } + if (this._test(clone)) { + var layout = this._getLayoutsByRegions(regions); + layout = this.compact(layout, true); + regions = this._getRegionsByLayout(layout); + this._modifyRegion(regions); + this._populate(clone); + } + } else { + this.resize(); + } + break; + } + }, + + _populate: function (items) { + this._stop(); + this._calculateRegions(items); + this._applyRegion(); + }, + + populate: function (items) { + var self = this; + BI.each(this.regions, function (name, region) { + self.regions[name].el.setVisible(false); + delete self.regions[name]; + }); + this._populate(items); + this._renderRegion(); + } +}); +BI.Arrangement.EVENT_SCROLL = "EVENT_SCROLL"; +BI.extend(BI.Arrangement, { + PORTION: 36, + H_PORTION: 18, + LAYOUT_TYPE: { + GRID: 0, + FREE: 1 + } +}); +BI.shortcut('bi.arrangement', BI.Arrangement);/** + * 表关联树 + * + * Created by GUY on 2015/12/15. + * @class BI.BranchRelation + * @extends BI.Widget + */ +BI.BranchRelation = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.BranchRelation.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-branch-relation-tree", + items: [], + + centerOffset: 0,//重心偏移量 + direction: BI.Direction.Bottom, + align: BI.VerticalAlign.Top + }) + }, + + _init: function () { + BI.BranchRelation.superclass._init.apply(this, arguments); + this.populate(this.options.items); + }, + + //树分层 + _stratification: function () { + var levels = []; + this.tree.recursion(function (node, route) { + //node.isRoot = route.length <= 1; + node.leaf = node.isLeaf(); + if (!levels[route.length - 1]) { + levels[route.length - 1] = []; + } + levels[route.length - 1].push(node); + }); + return levels; + }, + + //计算所有节点的叶子结点个数 + _calculateLeaves: function () { + var count = 0; + + function track(node) { + var c = 0; + if (node.isLeaf()) { + return 1; + } + BI.each(node.getChildren(), function (i, child) { + c += track(child); + }); + node.set("leaves", c); + return c; + } + + count = track(this.tree.getRoot()); + return count; + }, + + //树平移 + _translate: function (levels) { + var adjust = []; + var maxLevel = levels.length; + BI.each(levels, function (i, nodes) { + if (!adjust[i]) { + adjust[i] = []; + } + BI.each(nodes, function (j, node) { + if (node.isLeaf() && i < maxLevel - 1) { + var newNode = new BI.Node(BI.UUID()); + //newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot; + newNode.isNew = true; + //把node向下一层移 + var tar = 0; + if (j > 0) { + var c = nodes[j - 1].getLastChild(); + tar = levels[i + 1].indexOf(c) + 1; + } + levels[i + 1].splice(tar, 0, node); + //新增一个临时树节点 + var index = node.parent.getChildIndex(node.id); + node.parent.removeChildByIndex(index); + node.parent.addChild(newNode, index); + newNode.addChild(node); + adjust[i].push(newNode); + nodes[j] = newNode; + } else { + adjust[i].push(node); + } + }) + }); + return adjust; + }, + + //树补白 + _fill: function (levels) { + var adjust = []; + var maxLevel = levels.length; + BI.each(levels, function (i, nodes) { + if (!adjust[i]) { + adjust[i] = []; + } + BI.each(nodes, function (j, node) { + if (node.isLeaf() && i < maxLevel - 1) { + var newNode = new BI.Node(BI.UUID()); + newNode.leaf = true; + newNode.width = node.width; + newNode.height = node.height; + newNode.isNew = true; + //把node向下一层移 + var tar = 0; + if (j > 0) { + var c = nodes[j - 1].getLastChild(); + tar = levels[i + 1].indexOf(c) + 1; + } + levels[i + 1].splice(tar, 0, newNode); + //新增一个临时树节点 + node.addChild(newNode); + } + adjust[i].push(node); + }) + }); + return adjust; + }, + + //树调整 + _adjust: function (adjust) { + while (true) { + var isAllNeedAjust = false; + BI.backEach(adjust, function (i, nodes) { + BI.each(nodes, function (j, node) { + if (!node.isNew) { + var needAdjust = true; + BI.any(node.getChildren(), function (k, n) { + if (!n.isNew) { + needAdjust = false; + return true; + } + }); + if (!node.isLeaf() && needAdjust === true) { + var allChilds = []; + BI.each(node.getChildren(), function (k, n) { + allChilds = allChilds.concat(n.getChildren()); + }); + node.removeAllChilds(); + BI.each(allChilds, function (k, c) { + node.addChild(c); + }); + var newNode = new BI.Node(BI.UUID()); + //newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot; + newNode.isNew = true; + var index = node.parent.getChildIndex(node.id); + node.parent.removeChildByIndex(index); + node.parent.addChild(newNode, index); + newNode.addChild(node); + isAllNeedAjust = true; + } + } + }) + }); + if (isAllNeedAjust === false) { + break; + } else {//树重构 + adjust = this._stratification(); + } + } + return adjust; + }, + + _calculateWidth: function () { + var o = this.options; + var width = 0; + + function track1(node) { + var w = 0; + if (node.isLeaf()) { + return node.width; + } + BI.each(node.getChildren(), function (i, child) { + w += track1(child); + }); + return w; + } + + function track2(node) { + var w = 0; + if (node.isLeaf()) { + return node.height; + } + BI.each(node.getChildren(), function (i, child) { + w += track2(child); + }); + return w; + } + + if (this._isVertical()) { + width = track1(this.tree.getRoot()); + } else { + width = track2(this.tree.getRoot()); + } + + return width; + }, + + _isVertical: function () { + var o = this.options; + return o.direction === BI.Direction.Top || o.direction === BI.Direction.Bottom; + }, + + _calculateHeight: function () { + var o = this.options; + var height = 0; + + function track1(node) { + var h = 0; + BI.each(node.getChildren(), function (i, child) { + h = Math.max(h, track1(child)); + }); + return h + (node.height || 0); + } + + function track2(node) { + var h = 0; + BI.each(node.getChildren(), function (i, child) { + h = Math.max(h, track2(child)); + }); + return h + (node.width || 0); + } + + if (this._isVertical()) { + height = track1(this.tree.getRoot()); + } else { + height = track2(this.tree.getRoot()); + } + return height; + }, + + _calculateXY: function (levels) { + var o = this.options; + var width = this._calculateWidth(); + var height = this._calculateHeight(); + var levelCount = levels.length; + var allLeavesCount = this._calculateLeaves(); + //计算坐标 + var xy = {}; + var levelHeight = height / levelCount; + BI.each(levels, function (i, nodes) { + //计算权重 + var weights = []; + BI.each(nodes, function (j, node) { + weights[j] = (node.get("leaves") || 1) / allLeavesCount; + }); + BI.each(nodes, function (j, node) { + //求前j个元素的权重 + var weight = BI.sum(weights.slice(0, j)); + //求坐标 + var x = weight * width + weights[j] * width / 2; + var y = i * levelHeight + levelHeight / 2; + xy[node.id] = {x: x, y: y}; + }) + }); + return xy; + }, + + _stroke: function (levels, xy) { + var height = this._calculateHeight(); + var levelCount = levels.length; + var levelHeight = height / levelCount; + var self = this, o = this.options; + switch (o.direction) { + case BI.Direction.Top: + BI.each(levels, function (i, nodes) { + BI.each(nodes, function (j, node) { + if (node.getChildrenLength() > 0 && !node.leaf) { + var path = ""; + var start = xy[node.id]; + var split = start.y + levelHeight / 2; + path += "M" + start.x + "," + (start.y + o.centerOffset) + "L" + start.x + "," + split; + var end = []; + BI.each(node.getChildren(), function (t, c) { + var e = end[t] = xy[c.id]; + path += "M" + e.x + "," + (e.y + o.centerOffset) + "L" + e.x + "," + split; + }); + if (end.length > 0) { + path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split; + } + self.svg.path(path).attr("stroke", "#d4dadd"); + } + }) + }); + break; + case BI.Direction.Bottom: + BI.each(levels, function (i, nodes) { + BI.each(nodes, function (j, node) { + if (node.getChildrenLength() > 0 && !node.leaf) { + var path = ""; + var start = xy[node.id]; + var split = start.y - levelHeight / 2; + path += "M" + start.x + "," + (start.y - o.centerOffset) + "L" + start.x + "," + split; + var end = []; + BI.each(node.getChildren(), function (t, c) { + var e = end[t] = xy[c.id]; + path += "M" + e.x + "," + (e.y - o.centerOffset) + "L" + e.x + "," + split; + }); + if (end.length > 0) { + path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split; + } + self.svg.path(path).attr("stroke", "#d4dadd"); + } + }) + }); + break; + case BI.Direction.Left: + BI.each(levels, function (i, nodes) { + BI.each(nodes, function (j, node) { + if (node.getChildrenLength() > 0 && !node.leaf) { + var path = ""; + var start = xy[node.id]; + var split = start.y + levelHeight / 2; + path += "M" + (start.y + o.centerOffset) + "," + start.x + "L" + split + "," + start.x; + var end = []; + BI.each(node.getChildren(), function (t, c) { + var e = end[t] = xy[c.id]; + path += "M" + (e.y + o.centerOffset) + "," + e.x + "L" + split + "," + e.x; + }); + if (end.length > 0) { + path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x; + } + self.svg.path(path).attr("stroke", "#d4dadd"); + } + }) + }); + break; + case BI.Direction.Right: + BI.each(levels, function (i, nodes) { + BI.each(nodes, function (j, node) { + if (node.getChildrenLength() > 0 && !node.leaf) { + var path = ""; + var start = xy[node.id]; + var split = start.y - levelHeight / 2; + path += "M" + (start.y - o.centerOffset) + "," + start.x + "L" + split + "," + start.x; + var end = []; + BI.each(node.getChildren(), function (t, c) { + var e = end[t] = xy[c.id]; + path += "M" + (e.y - o.centerOffset) + "," + e.x + "L" + split + "," + e.x; + }); + if (end.length > 0) { + path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x; + } + self.svg.path(path).attr("stroke", "#d4dadd"); + } + }) + }); + break; + } + }, + + _createBranches: function (levels) { + var self = this, o = this.options; + if (o.direction === BI.Direction.Bottom || o.direction === BI.Direction.Right) { + levels = levels.reverse(); + } + var xy = this._calculateXY(levels); + //画图 + this._stroke(levels, xy); + }, + + _isNeedAdjust: function () { + var o = this.options; + return o.direction === BI.Direction.Top && o.align === BI.VerticalAlign.Bottom || o.direction === BI.Direction.Bottom && o.align === BI.VerticalAlign.Top + || o.direction === BI.Direction.Left && o.align === BI.HorizontalAlign.Right || o.direction === BI.Direction.Right && o.align === BI.HorizontalAlign.Left + }, + + setValue: function (value) { + + }, + + getValue: function () { + + }, + + _transformToTreeFormat: function (sNodes) { + var i, l; + if (!sNodes) { + return []; + } + + if (BI.isArray(sNodes)) { + var r = []; + var tmpMap = []; + for (i = 0, l = sNodes.length; i < l; i++) { + tmpMap[sNodes[i].id] = sNodes[i]; + } + for (i = 0, l = sNodes.length; i < l; i++) { + if (tmpMap[sNodes[i].pId] && sNodes[i].id != sNodes[i].pId) { + if (!tmpMap[sNodes[i].pId].children) { + tmpMap[sNodes[i].pId].children = []; + } + tmpMap[sNodes[i].pId].children.push(sNodes[i]); + } else { + r.push(sNodes[i]); + } + } + return r; + } else { + return [sNodes]; + } + }, + + populate: function (items) { + var self = this, o = this.options; + o.items = items || []; + this.empty(); + items = this._transformToTreeFormat(o.items); + this.tree = new BI.Tree(); + this.tree.initTree(items); + + this.svg = BI.createWidget({ + type: "bi.svg" + }); + + //树分层 + var levels = this._stratification(); + + if (this._isNeedAdjust()) { + //树平移 + var adjust = this._translate(levels); + //树调整 + adjust = this._adjust(adjust); + + this._createBranches(adjust); + } else { + var adjust = this._fill(levels); + + this._createBranches(adjust); + } + + var container = BI.createWidget({ + type: "bi.layout", + width: this._isVertical() ? this._calculateWidth() : this._calculateHeight(), + height: this._isVertical() ? this._calculateHeight() : this._calculateWidth() + }); + BI.createWidget({ + type: "bi.absolute", + element: container, + items: [{ + el: this.svg, + top: 0, + left: 0, + right: 0, + bottom: 0 + }] + }); + if (this._isVertical()) { + items = [{ + type: "bi.handstand_branch_tree", + expander: { + direction: o.direction + }, + el: { + layouts: [{ + type: "bi.horizontal_adapt", + verticalAlign: o.align + }] + }, + items: items + }] + } else { + items = [{ + type: "bi.branch_tree", + expander: { + direction: o.direction + }, + el: { + layouts: [{ + type: "bi.vertical" + }, { + type: o.align === BI.HorizontalAlign.Left ? "bi.left" : "bi.right" + }] + }, + items: items + }] + } + BI.createWidget({ + type: "bi.adaptive", + element: container, + items: items + }); + BI.createWidget({ + type: "bi.center_adapt", + scrollable: true, + element: this, + items: [container] + }); + } +}); +BI.BranchRelation.EVENT_CHANGE = "BranchRelation.EVENT_CHANGE"; +BI.shortcut("bi.branch_relation", BI.BranchRelation);/** + * 日期控件中的月份下拉框 + * + * Created by GUY on 2015/9/7. + * @class BI.MonthDateCombo + * @extends BI.Trigger + */ +BI.MonthDateCombo = BI.inherit(BI.Trigger, { + _defaultConfig: function() { + return BI.extend( BI.MonthDateCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-month-combo", + height: 25 + }); + }, + _init: function() { + BI.MonthDateCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.trigger = BI.createWidget({ + type: "bi.date_triangle_trigger" + }); + + this.popup = BI.createWidget({ + type: "bi.month_popup" + }); + + this.popup.on(BI.YearPopup.EVENT_CHANGE, function(){ + self.setValue(self.popup.getValue()); + }) + + + this.combo = BI.createWidget({ + type: "bi.combo", + offsetStyle: "center", + element: this, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: this.trigger, + popup: { + minWidth: 85, + stopPropagation: false, + el: this.popup + } + }) + this.combo.on(BI.Combo.EVENT_CHANGE, function(){ + self.combo.hideView(); + self.fireEvent(BI.MonthDateCombo.EVENT_CHANGE); + }); + }, + + setValue: function(v){ + this.trigger.setValue(v + 1); + this.popup.setValue(v); + }, + + getValue: function(){ + return this.popup.getValue(); + } +}); +BI.MonthDateCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.month_date_combo', BI.MonthDateCombo);/** + * 年份下拉框 + * + * Created by GUY on 2015/9/7. + * @class BI.YearDateCombo + * @extends BI.Trigger + */ +BI.YearDateCombo = BI.inherit(BI.Trigger, { + _defaultConfig: function() { + return BI.extend( BI.YearDateCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-year-combo", + min: '1900-01-01', //最小日期 + max: '2099-12-31', //最大日期 + height: 25 + }); + }, + _init: function() { + BI.YearDateCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.trigger = BI.createWidget({ + type: "bi.date_triangle_trigger" + }); + + this.popup = BI.createWidget({ + type: "bi.year_popup", + min: o.min, + max: o.max + }); + + this.popup.on(BI.YearPopup.EVENT_CHANGE, function(){ + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.YearDateCombo.EVENT_CHANGE); + }) + + + this.combo = BI.createWidget({ + type: "bi.combo", + offsetStyle: "center", + element: this, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: this.trigger, + popup: { + minWidth: 85, + stopPropagation: false, + el: this.popup + } + }) + this.combo.on(BI.Combo.EVENT_CHANGE, function(){ + self.fireEvent(BI.YearDateCombo.EVENT_CHANGE); + }) + }, + + setValue: function(v){ + this.trigger.setValue(v); + this.popup.setValue(v); + }, + + getValue: function(){ + return this.popup.getValue(); + } +}); +BI.YearDateCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.year_date_combo', BI.YearDateCombo);/** + * Created by GUY on 2015/9/7. + * @class BI.DatePicker + * @extends BI.Widget + */ +BI.DatePicker = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.DatePicker.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: "bi-date-picker bi-background", + height: 25, + min: '1900-01-01', //最小日期 + max: '2099-12-31' //最大日期 + }) + }, + + _init: function () { + BI.DatePicker.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this._year = new Date().getFullYear(); + this._month = new Date().getMonth(); + this.left = BI.createWidget({ + type: "bi.icon_button", + cls: "pre-page-h-font", + width: 25, + height: 25 + }); + this.left.on(BI.IconButton.EVENT_CHANGE, function () { + if (self._month === 0) { + self.setValue({ + year: self.year.getValue() - 1, + month: 11 + }) + } else { + self.setValue({ + year: self.year.getValue(), + month: self.month.getValue() - 1 + }) + } + self.fireEvent(BI.DatePicker.EVENT_CHANGE); + }); + + this.right = BI.createWidget({ + type: "bi.icon_button", + cls: "next-page-h-font", + width: 25, + height: 25 + }); + + this.right.on(BI.IconButton.EVENT_CHANGE, function () { + if (self._month === 11) { + self.setValue({ + year: self.year.getValue() + 1, + month: 0 + }) + } else { + self.setValue({ + year: self.year.getValue(), + month: self.month.getValue() + 1 + }) + } + self.fireEvent(BI.DatePicker.EVENT_CHANGE); + }); + + this.year = BI.createWidget({ + type: "bi.year_date_combo", + min: o.min, + max: o.max + }); + this.year.on(BI.YearDateCombo.EVENT_CHANGE, function () { + self.setValue({ + year: self.year.getValue(), + month: self.month.getValue() + }); + self.fireEvent(BI.DatePicker.EVENT_CHANGE); + }) + this.month = BI.createWidget({ + type: "bi.month_date_combo" + }); + this.month.on(BI.MonthDateCombo.EVENT_CHANGE, function () { + self.setValue({ + year: self.year.getValue(), + month: self.month.getValue() + }); + self.fireEvent(BI.DatePicker.EVENT_CHANGE); + }); + + BI.createWidget({ + type: "bi.htape", + element: this, + items: [{ + el: this.left, + width: 25 + }, { + type: "bi.center_adapt", + items: [{ + type: "bi.horizontal", + width: 100, + items: [this.year, this.month] + }] + }, { + el: this.right, + width: 25 + }] + }) + this.setValue({ + year: this._year, + month: this._month + }) + }, + + setValue: function (ob) { + this._year = ob.year; + this._month = ob.month; + this.year.setValue(ob.year); + this.month.setValue(ob.month); + }, + + getValue: function () { + return { + year: this.year.getValue(), + month: this.month.getValue() + } + } +}); +BI.DatePicker.EVENT_CHANGE = "EVENT_CHANGE" +BI.shortcut("bi.date_picker", BI.DatePicker);/** + * Created by GUY on 2015/9/7. + * @class BI.DateCalendarPopup + * @extends BI.Widget + */ +BI.DateCalendarPopup = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.DateCalendarPopup.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: "bi-date-calendar-popup", + min: '1900-01-01', //最小日期 + max: '2099-12-31', //最大日期 + selectedTime: null + }) + }, + + _createNav: function (v) { + var date = BI.Calendar.getDateJSONByPage(v); + var calendar = BI.createWidget({ + type: "bi.calendar", + logic: { + dynamic: true + }, + min: this.options.min, + max: this.options.max, + year: date.year, + month: date.month, + day: this.selectedTime.day + }); + return calendar + }, + + _init: function () { + BI.DateCalendarPopup.superclass._init.apply(this, arguments); + var self = this, + o = this.options; + this.today = new Date(); + this._year = this.today.getFullYear(); + this._month = this.today.getMonth(); + this._day = this.today.getDate(); + + this.selectedTime = o.selectedTime || { + year: this._year, + month: this._month, + day: this._day + }; + this.datePicker = BI.createWidget({ + type: "bi.date_picker", + min: o.min, + max: o.max + }); + + this.calendar = BI.createWidget({ + direction: "top", + element: this, + logic: { + dynamic: true + }, + type: "bi.navigation", + tab: this.datePicker, + cardCreator: BI.bind(this._createNav, this), + + afterCardCreated: function () { + + }, + + afterCardShow: function () { + this.setValue(self.selectedTime); + } + }); + + this.datePicker.on(BI.DatePicker.EVENT_CHANGE, function () { + self.selectedTime = self.datePicker.getValue(); + self.selectedTime.day = 1; + self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); + }); + + this.calendar.on(BI.Navigation.EVENT_CHANGE, function () { + self.selectedTime = self.calendar.getValue(); + self.setValue(self.selectedTime); + self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); + }); + }, + + setValue: function (timeOb) { + this.datePicker.setValue(timeOb); + this.calendar.setSelect(BI.Calendar.getPageByDateJSON(timeOb)); + this.calendar.setValue(timeOb); + this.selectedTime = timeOb; + }, + + getValue: function () { + return this.selectedTime; + } +}); +BI.DateCalendarPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.date_calendar_popup", BI.DateCalendarPopup);/** + * 日期控件中的年份或月份trigger + * + * Created by GUY on 2015/9/7. + * @class BI.DateTriangleTrigger + * @extends BI.Trigger + */ +BI.DateTriangleTrigger = BI.inherit(BI.Trigger, { + _const: { + height: 25, + iconWidth: 16, + iconHeight: 13 + }, + + _defaultConfig: function() { + return BI.extend( BI.DateTriangleTrigger.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-date-triangle-trigger pull-down-ha-font cursor-pointer", + height: 25 + }); + }, + _init: function() { + BI.DateTriangleTrigger.superclass._init.apply(this, arguments); + var o = this.options, c = this._const; + this.text = BI.createWidget({ + type: "bi.label", + cls: "list-item-text", + textAlign: "right", + text: o.text, + value: o.value, + height: c.height + }) + this.icon = BI.createWidget({ + type: "bi.icon", + width: c.iconWidth, + height: c.iconHeight + }); + + BI.createWidget({ + type: "bi.center_adapt", + element: this, + items: [{ + type: "bi.center_adapt", + width: 50, + height: c.height, + items: [this.text, this.icon] + }] + }) + }, + + setValue: function(v){ + this.text.setValue(v); + }, + + getValue: function(){ + return this.text.getValue(); + }, + + setText: function(v){ + this.text.setText(v); + }, + + getText: function(){ + return this.item.getText(); + }, + + getKey: function(){ + + } +}); +BI.shortcut('bi.date_triangle_trigger', BI.DateTriangleTrigger);/** + * 日期下拉框 + * + * Created by GUY on 2015/9/7. + * @class BI.DateCombo + * @extends BI.Widget + */ +BI.DateCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.DateCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-date-combo bi-border", + height: 30 + }); + }, + _init: function () { + BI.DateCombo.superclass._init.apply(this, arguments); + var self = this, + o = this.options; + + this.trigger = BI.createWidget({ + type: "bi.date_trigger" + }); + + this.trigger.on(BI.DateTrigger.EVENT_TRIGGER_CLICK, function () { + self.combo.toggle(); + }); + + this.popup = BI.createWidget({ + type: "bi.date_calendar_popup" + }); + + this.popup.on(BI.DateCalendarPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + toggle: false, + element: this, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: this.trigger, + popup: { + width: 270, + el: this.popup, + stopPropagation: false + } + }) + }, + + setValue: function (v) { + this.trigger.setValue(v); + this.popup.setValue(v); + }, + + getValue: function () { + return this.popup.getValue(); + } +}); +BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigger, { + _const: { + hgap: 4, + vgap: 2, + triggerWidth: 30, + yearLength: 4, + yearMonthLength: 7 + }, + + _defaultConfig: function () { + return BI.extend(BI.DateTrigger.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-date-trigger", + min: '1900-01-01', //最小日期 + max: '2099-12-31', //最大日期 + height: 25 + }); + }, + _init: function () { + BI.DateTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options, c = this._const; + this.editor = BI.createWidget({ + type: "bi.sign_editor", + height: o.height, + validationChecker: function (v) { + var date = v.match(/\d+/g); + self._autoAppend(v, date); + return self._dateCheck(v) && Date.checkLegal(v) && self._checkVoid({ + year: date[0], + month: date[1], + day: date[2] + }); + }, + quitChecker: function () { + return false; + }, + hgap: c.hgap, + vgap: c.vgap, + allowBlank: true, + watermark: BI.i18nText("BI-Basic_Unrestricted"), + errorText: function () { + if (self.editor.isEditing()) { + return BI.i18nText("BI-Date_Trigger_Error_Text"); + } + return BI.i18nText("BI-Year_Trigger_Invalid_Text"); + } + }); + this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () { + self.fireEvent(BI.DateTrigger.EVENT_KEY_DOWN) + }); + this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { + self.fireEvent(BI.DateTrigger.EVENT_FOCUS); + }); + this.editor.on(BI.SignEditor.EVENT_STOP, function () { + self.fireEvent(BI.DateTrigger.EVENT_STOP); + }); + this.editor.on(BI.SignEditor.EVENT_VALID, function () { + self.fireEvent(BI.DateTrigger.EVENT_VALID); + }); + this.editor.on(BI.SignEditor.EVENT_ERROR, function () { + self.fireEvent(BI.DateTrigger.EVENT_ERROR); + }); + this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () { + var value = self.editor.getValue(); + if (BI.isNotNull(value)) { + self.editor.setState(value); + } + + if (BI.isNotEmptyString(value)) { + var date = value.split("-"); + self.store_value = { + type: BI.DateTrigger.MULTI_DATE_CALENDAR, + value:{ + year: date[0] | 0, + month: date[1] - 1, + day: date[2] | 0 + } + }; + } + self.fireEvent(BI.DateTrigger.EVENT_CONFIRM); + }); + this.editor.on(BI.SignEditor.EVENT_SPACE, function () { + if (self.editor.isValid()) { + self.editor.blur(); + } + }); + this.editor.on(BI.SignEditor.EVENT_START, function () { + self.fireEvent(BI.DateTrigger.EVENT_START); + }); + this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { + self.fireEvent(BI.DateTrigger.EVENT_CHANGE); + }); + BI.createWidget({ + type: "bi.htape", + element: this, + items: [{ + el: BI.createWidget(), + width: 30 + }, { + el: this.editor + }] + }) + }, + _dateCheck: function (date) { + return Date.parseDateTime(date, "%Y-%x-%d").print("%Y-%x-%d") == date || Date.parseDateTime(date, "%Y-%X-%d").print("%Y-%X-%d") == date || Date.parseDateTime(date, "%Y-%x-%e").print("%Y-%x-%e") == date || Date.parseDateTime(date, "%Y-%X-%e").print("%Y-%X-%e") == date; + }, + _checkVoid: function (obj) { + return !Date.checkVoid(obj.year, obj.month, obj.day, this.options.min, this.options.max)[0]; + }, + _autoAppend: function (v, dateObj) { + var self = this; + var date = Date.parseDateTime(v, "%Y-%X-%d").print("%Y-%X-%d"); + var yearCheck = function (v) { + return Date.parseDateTime(v, "%Y").print("%Y") == v && date >= self.options.min && date <= self.options.max; + }; + var monthCheck = function (v) { + return Date.parseDateTime(v, "%Y-%X").print("%Y-%X") == v && date >= self.options.min && date <= self.options.max; + }; + if (BI.isNotNull(dateObj) && Date.checkLegal(v)) { + switch (v.length) { + case this._const.yearLength: + if (yearCheck(v)) { + this.editor.setValue(v + "-"); + } + break; + case this._const.yearMonthLength: + if (monthCheck(v)) { + this.editor.setValue(v + "-"); + } + break; + } + } + }, + + setValue: function (v) { + var type, value, self = this; + var date = new Date(); + this.store_value = v; + if (BI.isNotNull(v)) { + type = v.type || BI.DateTrigger.MULTI_DATE_CALENDAR; value = v.value; + if(BI.isNull(value)){ + value = v; + } + } + var _setInnerValue = function (date, text) { + var dateStr = date.print("%Y-%x-%e"); + self.editor.setState(dateStr); + self.editor.setValue(dateStr); + self.setTitle(text + ":" + dateStr); + }; + switch (type) { + case BI.DateTrigger.MULTI_DATE_YEAR_PREV: + var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV]; + date = new Date((date.getFullYear() - 1 * value), date.getMonth(), date.getDate()); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_YEAR_AFTER: + var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER]; + date = new Date((date.getFullYear() + 1 * value), date.getMonth(), date.getDate()); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_YEAR_BEGIN: + var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN]; + date = new Date(date.getFullYear(), 0, 1); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_YEAR_END: + var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END]; + date = new Date(date.getFullYear(), 11, 31); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_QUARTER_PREV: + var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV]; + date = new Date().getBeforeMulQuarter(value); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_QUARTER_AFTER: + var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER]; + date = new Date().getAfterMulQuarter(value); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN: + var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN]; + date = new Date().getQuarterStartDate(); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_QUARTER_END: + var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END]; + date = new Date().getQuarterEndDate(); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_MONTH_PREV: + var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV]; + date = new Date().getBeforeMultiMonth(value); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_MONTH_AFTER: + var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER]; + date = new Date().getAfterMultiMonth(value); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_MONTH_BEGIN: + var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN]; + date = new Date(date.getFullYear(), date.getMonth(), 1); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_MONTH_END: + var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END]; + date = new Date(date.getFullYear(), date.getMonth(), (date.getLastDateOfMonth()).getDate()); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_WEEK_PREV: + var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_WEEK_PREV]; + date = date.getOffsetDate(-7 * value); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_WEEK_AFTER: + var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_WEEK_AFTER]; + date = date.getOffsetDate(7 * value); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_DAY_PREV: + var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_PREV]; + date = date.getOffsetDate(-1 * value); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_DAY_AFTER: + var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_AFTER]; + date = date.getOffsetDate(1 * value); + _setInnerValue(date, text); + break; + case BI.DateTrigger.MULTI_DATE_DAY_TODAY: + var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY]; + date = new Date(); + _setInnerValue(date, text); + break; + default: + if (BI.isNull(value) || BI.isNull(value.day)) { + this.editor.setState(""); + this.editor.setValue(""); + this.setTitle(""); + } else { + var dateStr = value.year + "-" + (value.month + 1) + "-" + value.day; + this.editor.setState(dateStr); + this.editor.setValue(dateStr); + this.setTitle(dateStr); + } + break; + } + }, + + getKey: function () { + return this.editor.getValue(); + }, + getValue: function () { + return this.store_value; + } + +}); + +BI.DateTrigger.MULTI_DATE_YEAR_PREV = 1; +BI.DateTrigger.MULTI_DATE_YEAR_AFTER = 2; +BI.DateTrigger.MULTI_DATE_YEAR_BEGIN = 3; +BI.DateTrigger.MULTI_DATE_YEAR_END = 4; + +BI.DateTrigger.MULTI_DATE_MONTH_PREV = 5; +BI.DateTrigger.MULTI_DATE_MONTH_AFTER = 6; +BI.DateTrigger.MULTI_DATE_MONTH_BEGIN = 7; +BI.DateTrigger.MULTI_DATE_MONTH_END = 8; + +BI.DateTrigger.MULTI_DATE_QUARTER_PREV = 9; +BI.DateTrigger.MULTI_DATE_QUARTER_AFTER = 10; +BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN = 11; +BI.DateTrigger.MULTI_DATE_QUARTER_END = 12; + +BI.DateTrigger.MULTI_DATE_WEEK_PREV = 13; +BI.DateTrigger.MULTI_DATE_WEEK_AFTER = 14; + +BI.DateTrigger.MULTI_DATE_DAY_PREV = 15; +BI.DateTrigger.MULTI_DATE_DAY_AFTER = 16; +BI.DateTrigger.MULTI_DATE_DAY_TODAY = 17; + +BI.DateTrigger.MULTI_DATE_PARAM = 18; +BI.DateTrigger.MULTI_DATE_CALENDAR = 19; + +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM = {}; +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV] = BI.i18nText("BI-Multi_Date_Year_Prev"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER] = BI.i18nText("BI-Multi_Date_Year_Next"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN] = BI.i18nText("BI-Multi_Date_Year_Begin"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END] = BI.i18nText("BI-Multi_Date_Year_End"); + +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV] = BI.i18nText("BI-Multi_Date_Quarter_Prev"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER] = BI.i18nText("BI-Multi_Date_Quarter_Next"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN] = BI.i18nText("BI-Multi_Date_Quarter_Begin"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END] = BI.i18nText("BI-Multi_Date_Quarter_End"); + +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV] = BI.i18nText("BI-Multi_Date_Month_Prev"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER] = BI.i18nText("BI-Multi_Date_Month_Next"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN] = BI.i18nText("BI-Multi_Date_Month_Begin"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END] = BI.i18nText("BI-Multi_Date_Month_End"); + +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_WEEK_PREV] = BI.i18nText("BI-Multi_Date_Week_Prev"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_WEEK_AFTER] = BI.i18nText("BI-Multi_Date_Week_Next"); + +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_PREV] = BI.i18nText("BI-Multi_Date_Day_Prev"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_AFTER] = BI.i18nText("BI-Multi_Date_Day_Next"); +BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY] = BI.i18nText("BI-Multi_Date_Today"); + +BI.DateTrigger.EVENT_FOCUS = "EVENT_FOCUS"; +BI.DateTrigger.EVENT_START = "EVENT_START"; +BI.DateTrigger.EVENT_STOP = "EVENT_STOP"; +BI.DateTrigger.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.DateTrigger.EVENT_CHANGE = "EVENT_CHANGE"; +BI.DateTrigger.EVENT_VALID = "EVENT_VALID"; +BI.DateTrigger.EVENT_ERROR = "EVENT_ERROR"; +BI.DateTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK"; +BI.DateTrigger.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; +BI.shortcut("bi.date_trigger", BI.DateTrigger);/** + * Created by zcf on 2017/2/20. + */ +BI.DatePaneWidget = BI.inherit(BI.Widget, { + _defaultConfig: function () { + var conf = BI.DatePaneWidget.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: "bi-date-pane-widget", + min: '1900-01-01', //最小日期 + max: '2099-12-31', //最大日期 + selectedTime: null + }) + }, + _init: function () { + BI.DatePaneWidget.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.today = new Date(); + this._year = this.today.getFullYear(); + this._month = this.today.getMonth(); + + this.selectedTime = o.selectedTime || { + year: this._year, + month: this._month + }; + + this.datePicker = BI.createWidget({ + type: "bi.date_picker", + min: o.min, + max: o.max + }); + this.datePicker.on(BI.DatePicker.EVENT_CHANGE, function () { + self.selectedTime = self.datePicker.getValue(); + // self.selectedTime.day = 1; + self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); + }); + + this.calendar = BI.createWidget({ + direction: "top", + element: this, + logic: { + dynamic: false + }, + type: "bi.navigation", + tab: this.datePicker, + cardCreator: BI.bind(this._createNav, this) + + // afterCardCreated: function () { + // + // }, + // + // afterCardShow: function () { + // // this.setValue(self.selectedTime); + // } + }); + this.calendar.on(BI.Navigation.EVENT_CHANGE, function () { + self.selectedTime = self.calendar.getValue(); + self.calendar.empty(); + self.setValue(self.selectedTime); + self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); + }); + + }, + + _createNav: function (v) { + var date = BI.Calendar.getDateJSONByPage(v); + var calendar = BI.createWidget({ + type: "bi.calendar", + logic: { + dynamic: false + }, + min: this.options.min, + max: this.options.max, + year: date.year, + month: date.month, + day: this.selectedTime.day + }); + return calendar; + }, + + _getNewCurrentDate: function () { + var today = new Date(); + return { + year: today.getFullYear(), + month: today.getMonth() + } + }, + + _setCalenderValue: function (date) { + this.calendar.setSelect(BI.Calendar.getPageByDateJSON(date)); + this.calendar.setValue(date); + this.selectedTime = date; + }, + + _setDatePicker: function (timeOb) { + if (BI.isNull(timeOb) || BI.isNull(timeOb.year) || BI.isNull(timeOb.month)) { + this.datePicker.setValue(this._getNewCurrentDate()); + } else { + this.datePicker.setValue(timeOb); + } + }, + + _setCalendar: function (timeOb) { + if (BI.isNull(timeOb) || BI.isNull(timeOb.day)) { + this.calendar.empty(); + this._setCalenderValue(this._getNewCurrentDate()); + } else { + this._setCalenderValue(timeOb) + } + }, + + setValue: function (timeOb) { + this._setDatePicker(timeOb); + this._setCalendar(timeOb); + }, + + getValue: function () { + return this.selectedTime; + } + +}); +BI.shortcut("bi.date_pane_widget", BI.DatePaneWidget);/** + * Created by Urthur on 2017/7/14. + */ +BI.DateTimeCombo = BI.inherit(BI.Single, { + constants: { + popupHeight: 290, + popupWidth: 270, + comboAdjustHeight: 1, + border: 1, + DATE_MIN_VALUE: "1900-01-01", + DATE_MAX_VALUE: "2099-12-31" + }, + _defaultConfig: function () { + return BI.extend(BI.DateTimeCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-date-time-combo bi-border', + height: 24 + }); + }, + _init: function () { + BI.DateTimeCombo.superclass._init.apply(this, arguments); + var self = this, opts = this.options; + var date = new Date(); + this.storeValue = { + year: date.getFullYear(), + month: date.getMonth(), + day: date.getDate(), + hour: date.getHours(), + minute: date.getMinutes(), + second: date.getSeconds() + }; + this.trigger = BI.createWidget({ + type: 'bi.date_time_trigger', + min: this.constants.DATE_MIN_VALUE, + max: this.constants.DATE_MAX_VALUE + }); + + this.popup = BI.createWidget({ + type: "bi.date_time_popup", + min: this.constants.DATE_MIN_VALUE, + max: this.constants.DATE_MAX_VALUE + }); + self.setValue(this.storeValue); + + this.popup.on(BI.DateTimePopup.BUTTON_CANCEL_EVENT_CHANGE, function () { + self.setValue(self.storeValue); + self.hidePopupView(); + self.fireEvent(BI.DateTimeCombo.EVENT_CANCEL); + }); + this.popup.on(BI.DateTimePopup.BUTTON_OK_EVENT_CHANGE, function () { + self.storeValue = self.popup.getValue(); + self.setValue(self.storeValue); + self.hidePopupView(); + self.fireEvent(BI.DateTimeCombo.EVENT_CONFIRM); + }); + this.popup.on(BI.DateTimePopup.CALENDAR_EVENT_CHANGE, function () { + self.trigger.setValue(self.popup.getValue()); + self.fireEvent(BI.DateTimeCombo.EVENT_CHANGE); + }); + this.combo = BI.createWidget({ + type: 'bi.combo', + toggle: false, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: this.trigger, + adjustLength: this.constants.comboAdjustHeight, + popup: { + el: this.popup, + maxHeight: this.constants.popupHeight, + width: this.constants.popupWidth, + stopPropagation: false + } + }); + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self.popup.setValue(self.storeValue); + self.fireEvent(BI.DateTimeCombo.EVENT_BEFORE_POPUPVIEW); + }); + + var triggerBtn = BI.createWidget({ + type: "bi.trigger_icon_button", + cls: "bi-trigger-date-button chart-date-normal-font bi-border-right", + width: 30, + height: 24 + }); + triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { + if (self.combo.isViewVisible()) { + self.combo.hideView(); + } else { + self.combo.showView(); + } + }); + + BI.createWidget({ + type: "bi.htape", + element: this, + items: [{ + type: "bi.absolute", + items: [{ + el: this.combo, + top: 0, + left: 0, + right: 0, + bottom: 0 + }, { + el: triggerBtn, + top: 0, + left: 0 + }] + }] + }) + }, + + setValue: function (v) { + this.storeValue = v; + this.popup.setValue(v); + this.trigger.setValue(v); + }, + getValue: function () { + return this.storeValue; + }, + + hidePopupView: function () { + this.combo.hideView(); + } +}); + +BI.DateTimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; +BI.DateTimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.DateTimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.DateTimeCombo.EVENT_BEFORE_POPUPVIEW = "BI.DateTimeCombo.EVENT_BEFORE_POPUPVIEW"; +BI.shortcut('bi.date_time_combo', BI.DateTimeCombo); +/** + * Created by Urthur on 2017/7/14. + */ +BI.CustomDateTimeCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.CustomDateTimeCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-custom-date-time-combo" + }) + }, + + _init: function () { + BI.CustomDateTimeCombo.superclass._init.apply(this, arguments); + var self = this; + this.DateTime = BI.createWidget({ + type: "bi.date_time_combo", + element: this + }); + this.DateTime.on(BI.DateTimeCombo.EVENT_CANCEL, function () { + self.fireEvent(BI.CustomDateTimeCombo.EVENT_CHANGE); + self.fireEvent(BI.CustomDateTimeCombo.EVENT_CANCEL); + }); + + this.DateTime.on(BI.DateTimeCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.CustomDateTimeCombo.EVENT_CHANGE); + self.fireEvent(BI.CustomDateTimeCombo.EVENT_CONFIRM); + }); + + this.DateTime.on(BI.DateTimeCombo.EVENT_CHANGE, function () { + self.fireEvent(BI.CustomDateTimeCombo.EVENT_CHANGE); + }); + }, + + getValue: function () { + return this.DateTime.getValue(); + }, + + setValue: function (v) { + this.DateTime.setValue(v); + } +}); +BI.CustomDateTimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.CustomDateTimeCombo.EVENT_CANCEL = "EVENT_CANCEL"; +BI.CustomDateTimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.shortcut("bi.custom_date_time_combo", BI.CustomDateTimeCombo); +/** + * Created by Urthur on 2017/7/14. + */ +BI.DateTimePopup = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.DateTimePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-date-time-popup', + width: 268, + height: 290 + }); + }, + _init: function () { + BI.DateTimePopup.superclass._init.apply(this, arguments); + var self = this, opts = this.options; + this.cancelButton = BI.createWidget({ + type: 'bi.text_button', + forceCenter: true, + cls: 'bi-multidate-popup-button bi-border-top bi-border-right', + shadow: true, + text: BI.i18nText("BI-Basic_Cancel") + }); + this.cancelButton.on(BI.TextButton.EVENT_CHANGE, function () { + self.fireEvent(BI.DateTimePopup.BUTTON_CANCEL_EVENT_CHANGE); + }); + + this.okButton = BI.createWidget({ + type: "bi.text_button", + forceCenter: true, + cls: 'bi-multidate-popup-button bi-border-top', + shadow: true, + text: BI.i18nText("BI-Basic_OK") + }); + this.okButton.on(BI.TextButton.EVENT_CHANGE, function () { + self.fireEvent(BI.DateTimePopup.BUTTON_OK_EVENT_CHANGE); + }); + + this.dateCombo = BI.createWidget({ + type: "bi.date_calendar_popup", + min: self.options.min, + max: self.options.max + }); + self.dateCombo.on(BI.DateCalendarPopup.EVENT_CHANGE, function () { + self.fireEvent(BI.DateTimePopup.CALENDAR_EVENT_CHANGE); + }); + + this.dateSelect = BI.createWidget({ + type: "bi.horizontal", + cls: "bi-border-top", + items: [{ + type: "bi.label", + text: BI.i18nText("BI-Basic_Time"), + width: 45 + },{ + type: "bi.date_time_select", + max: 23, + min: 0, + width: 60, + height: 30, + ref: function (_ref) { + self.hour = _ref; + self.hour.on(BI.DateTimeSelect.EVENT_CONFIRM, function () { + self.fireEvent(BI.DateTimePopup.CALENDAR_EVENT_CHANGE); + }); + } + },{ + type: "bi.label", + text: ":", + width: 15 + },{ + type: "bi.date_time_select", + max: 59, + min: 0, + width: 60, + height: 30, + ref: function (_ref) { + self.minute = _ref; + self.minute.on(BI.DateTimeSelect.EVENT_CONFIRM, function () { + self.fireEvent(BI.DateTimePopup.CALENDAR_EVENT_CHANGE); + }); + } + },{ + type: "bi.label", + text: ":", + width: 15 + },{ + type: "bi.date_time_select", + max: 59, + min: 0, + width: 60, + height: 30, + ref: function (_ref) { + self.second = _ref; + self.second.on(BI.DateTimeSelect.EVENT_CONFIRM, function () { + self.fireEvent(BI.DateTimePopup.CALENDAR_EVENT_CHANGE); + }); + } + }] + }); + + var date = new Date(); + this.dateCombo.setValue({ + year: date.getFullYear(), + month: date.getMonth(), + day: date.getDate() + }); + this.hour.setValue(date.getHours()); + this.minute.setValue(date.getMinutes()); + this.second.setValue(date.getSeconds()); + + this.dateButton = BI.createWidget({ + type: "bi.grid", + items: [[this.cancelButton, this.okButton]] + }); + BI.createWidget({ + element: this, + type: "bi.vtape", + items: [{ + el: this.dateCombo + }, { + el: this.dateSelect, + height: 50 + },{ + el: this.dateButton, + height: 30 + }] + }); + }, + + setValue: function (v) { + var value = v, date; + if (BI.isNull(value)) { + date = new Date(); + this.dateCombo.setValue({ + year: date.getFullYear(), + month: date.getMonth(), + day: date.getDate() + }); + this.hour.setValue(date.getHours()); + this.minute.setValue(date.getMinutes()); + this.second.setValue(date.getSeconds()); + } else { + this.dateCombo.setValue({ + year: value.year, + month: value.month, + day: value.day + }); + this.hour.setValue(value.hour); + this.minute.setValue(value.minute); + this.second.setValue(value.second); + } + }, + + getValue: function () { + return { + year: this.dateCombo.getValue().year, + month: this.dateCombo.getValue().month, + day: this.dateCombo.getValue().day, + hour: this.hour.getValue(), + minute: this.minute.getValue(), + second: this.second.getValue() + } + } +}); +BI.DateTimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; +BI.DateTimePopup.BUTTON_CANCEL_EVENT_CHANGE = "BUTTON_CANCEL_EVENT_CHANGE"; +BI.DateTimePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; +BI.shortcut('bi.date_time_popup', BI.DateTimePopup); +/** + * Created by Urthur on 2017/7/14. + */ +BI.DateTimeSelect = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.DateTimeSelect.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-date-time-select bi-border", + max: 23, + min: 0 + }) + }, + + _init: function () { + BI.DateTimeSelect.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.sign_editor", + value: this._alertInEditorValue(o.min), + errorText: BI.i18nText("BI-Please_Input_Natural_Number"), + validationChecker: function(v){ + return BI.isNaturalNumber(v); + } + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function(){ + self._finetuning(0); + self.fireEvent(BI.DateTimeSelect.EVENT_CONFIRM); + }); + this.topBtn = BI.createWidget({ + type: "bi.icon_button", + cls: "column-pre-page-h-font top-button bi-border-left bi-border-bottom" + }); + this.topBtn.on(BI.IconButton.EVENT_CHANGE, function(){ + self._finetuning(1); + self.fireEvent(BI.DateTimeSelect.EVENT_CONFIRM); + }); + this.bottomBtn = BI.createWidget({ + type: "bi.icon_button", + cls: "column-next-page-h-font bottom-button bi-border-left" + }); + this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function(){ + self._finetuning(-1); + self.fireEvent(BI.DateTimeSelect.EVENT_CONFIRM); + }); + this._finetuning(0); + BI.createWidget({ + type: "bi.htape", + element: this, + items: [this.editor, { + el: { + type: "bi.grid", + columns: 1, + rows: 2, + items: [{ + column: 0, + row: 0, + el: this.topBtn + }, { + column: 0, + row: 1, + el: this.bottomBtn + }] + }, + width: 30 + }] + }); + }, + + _alertOutEditorValue: function(v){ + if (v > this.options.max){ + v = this.options.min; + } + if (v < this.options.min){ + v = this.options.max + } + return BI.parseInt(v); + }, + + _alertInEditorValue: function(v){ + if (v > this.options.max){ + v = this.options.min; + } + if (v < this.options.min){ + v = this.options.max; + } + v = v < 10 ? "0" + v : v; + return v; + }, + + _finetuning: function(add){ + var v = BI.parseInt(this._alertOutEditorValue(this.editor.getValue())); + this.editor.setValue(this._alertInEditorValue(v + add)); + }, + + getValue: function () { + var v = this.editor.getValue(); + return this._alertOutEditorValue(v); + }, + + setValue: function (v) { + this.editor.setValue(this._alertInEditorValue(v)); + this._finetuning(0); + } + +}); +BI.DateTimeSelect.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.shortcut("bi.date_time_select", BI.DateTimeSelect);/** + * Created by Urthur on 2017/7/14. + */ +BI.DateTimeTrigger = BI.inherit(BI.Trigger, { + _const: { + hgap: 4, + triggerWidth: 30 + }, + + _defaultConfig: function () { + return BI.extend(BI.DateTimeTrigger.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-date-time-trigger", + min: '1900-01-01', //最小日期 + max: '2099-12-31', //最大日期 + height: 24, + width: 200 + }); + }, + _init: function () { + BI.DateTimeTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options, c = this._const; + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + height: o.height, + width: o.width, + hgap: c.hgap + }); + + BI.createWidget({ + type: "bi.htape", + element: this, + items: [{ + el: BI.createWidget(), + width: c.triggerWidth + }, { + el: this.text + }] + }) + }, + + _printTime: function (v) { + return v < 10 ? "0" + v : v; + }, + + setValue: function (v) { + var self = this; + var value = v, dateStr; + if(BI.isNull(value)){ + value = new Date(); + dateStr = value.print("%Y-%X-%d %H:%M:%S"); + } else { + var date = new Date(value.year,value.month,value.day,value.hour,value.minute,value.second); + dateStr = date.print("%Y-%X-%d %H:%M:%S"); + + } + this.text.setText(dateStr); + this.text.setTitle(dateStr); + } + +}); +BI.shortcut("bi.date_time_trigger", BI.DateTimeTrigger);/** + * 带有方向的pathchooser + * + * Created by GUY on 2016/4/21. + * @class BI.DirectionPathChooser + * @extends BI.Widget + */ +BI.DirectionPathChooser = BI.inherit(BI.Widget, { + + _const: { + lineColor: "#808080", + selectLineColor: "#009de3" + }, + + _defaultConfig: function () { + return BI.extend(BI.DirectionPathChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-excel-table", + items: [] + }); + }, + + _init: function () { + BI.DirectionPathChooser.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.pathChooser = BI.createWidget({ + type: "bi.path_chooser", + element: this, + items: o.items + }); + this.pathChooser.on(BI.PathChooser.EVENT_CHANGE, function (start, index) { + //self._unselectAllArrows(); + self._setValue(start, index); + self.fireEvent(BI.DirectionPathChooser.EVENT_CHANGE); + }); + this._drawArrows(); + + }, + + _unselectAllArrows: function () { + var self = this, lineColor = this._const.lineColor; + BI.each(this.arrows, function (region, rs) { + BI.each(rs, function (idx, arrows) { + BI.each(arrows, function (i, arrow) { + arrow.attr({fill: lineColor, stroke: lineColor}); + }); + }); + }); + }, + + _drawOneArrow: function (dot, direction) { + //0,1,2,3 上右下左 + var lineColor = this._const.lineColor; + var selectLineColor = this._const.selectLineColor; + var svg = this.pathChooser.svg; + var path = ""; + switch (direction) { + case 0: + path = "M" + dot.x + "," + dot.y + + "L" + (dot.x - 3) + "," + (dot.y + 5) + + "L" + (dot.x + 3) + "," + (dot.y + 5) + + "L" + dot.x + "," + dot.y; + break; + case 1: + path = "M" + dot.x + "," + dot.y + + "L" + (dot.x - 5) + "," + (dot.y - 3) + + "L" + (dot.x - 5) + "," + (dot.y + 3) + + "L" + dot.x + "," + dot.y; + break; + case 2: + path = "M" + dot.x + "," + dot.y + + "L" + (dot.x - 3) + "," + (dot.y - 5) + + "L" + (dot.x + 3) + "," + (dot.y - 5) + + "L" + dot.x + "," + dot.y; + break; + case 3: + path = "M" + dot.x + "," + dot.y + + "L" + (dot.x + 5) + "," + (dot.y - 3) + + "L" + (dot.x + 5) + "," + (dot.y + 3) + + "L" + dot.x + "," + dot.y; + break; + } + return svg.path(path).attr({fill: lineColor, stroke: lineColor}); + }, + + _drawArrows: function () { + var self = this, o = this.options; + var routes = this.pathChooser.routes; + var pathes = this.pathChooser.pathes; + var store = this.pathChooser.store; + this.arrows = {}; + BI.each(routes, function (region, ps) { + self.arrows[region] = []; + BI.each(ps, function (idx, path) { + self.arrows[region][idx] = []; + var dots = pathes[region][idx]; + BI.each(dots, function (i, dot) { + if (i > 0 && i < dots.length - 1) { + var arrow; + if (dot.y === dots[i - 1].y) { + if (dots[i + 1].y != dot.y) { + if (store[path[path.length - 2]].direction === -1) { + if (i - 1 > 0) { + arrow = self._drawOneArrow(dots[i - 1], 3); + } + } else { + arrow = self._drawOneArrow(dots[i], 1); + } + } + } else if (dot.x === dots[i - 1].x) { + if (dot.y > dots[i - 1].y) { + if (store[BI.first(path)].direction === -1) { + arrow = self._drawOneArrow(dots[i - 1], 0); + } else { + arrow = self._drawOneArrow(dot, 2); + } + } else { + if (store[path[path.length - 2]].direction === -1) { + arrow = self._drawOneArrow(dots[i - 1], 2); + } else { + arrow = self._drawOneArrow(dot, 0); + } + } + } + if (arrow) { + self.arrows[region][idx].push(arrow); + } + } + }); + BI.each(path, function (i, node) { + if (i !== 0) { + var arrow; + var from = path[i - 1]; + if (store[from].direction === -1) { + var regionIndex = self.pathChooser.getRegionIndexById(from); + var x = getXoffsetByRegionIndex(regionIndex, -1); + var y = getYByXoffset(dots, x); + arrow = self._drawOneArrow({x: x, y: y}, 3); + } else { + var regionIndex = self.pathChooser.getRegionIndexById(node); + var x = getXoffsetByRegionIndex(regionIndex); + var y = getYByXoffset(dots, x); + arrow = self._drawOneArrow({x: x, y: y}, 1); + } + if (arrow) { + self.arrows[region][idx].push(arrow); + } + } + }); + }) + }); + + function getXoffsetByRegionIndex(regionIndex, diregion) { + if (diregion === -1) { + return 100 * (regionIndex + 1) - 20; + } + return 100 * regionIndex + 20; + } + + function getYByXoffset(dots, xoffset) { + var finded = BI.find(dots, function (i, dot) { + if (i > 0) { + if (dots[i - 1].x < xoffset && dots[i].x > xoffset) { + return true; + } + } + }); + return finded.y; + } + }, + + _setValue: function (start, index) { + var self = this; + var lineColor = this._const.lineColor; + var selectLineColor = this._const.selectLineColor; + var routes = this.pathChooser.routes; + var starts = this.pathChooser.start; + var each = [start]; + if (starts.contains(start)) { + each = starts; + } + BI.each(each, function (i, s) { + BI.each(self.arrows[s], function (j, arrows) { + BI.each(arrows, function (k, arrow) { + arrow.attr({fill: lineColor, stroke: lineColor}).toFront(); + }); + }); + }); + BI.each(this.arrows[start][index], function (i, arrow) { + arrow.attr({fill: selectLineColor, stroke: selectLineColor}).toFront(); + }); + var current = BI.last(routes[start][index]); + while (current && routes[current] && routes[current].length === 1) { + BI.each(self.arrows[current][0], function (i, arrow) { + arrow.attr({fill: selectLineColor, stroke: selectLineColor}).toFront(); + }); + current = BI.last(routes[current][0]); + } + }, + + setValue: function (v) { + this.pathChooser.setValue(v); + this._unselectAllArrows(); + var routes = this.pathChooser.routes; + var nodes = BI.keys(routes), self = this; + var result = [], array = []; + BI.each(v, function (i, val) { + if (BI.contains(nodes, val)) { + if (array.length > 0) { + array.push(val); + result.push(array); + array = []; + } + } + array.push(val); + }); + if (array.length > 0) { + result.push(array); + } + //画这n条路径 + BI.each(result, function (idx, path) { + var start = path[0]; + var index = BI.findIndex(routes[start], function (idx, p) { + if (BI.isEqual(path, p)) { + return true; + } + }); + if (index >= 0) { + self._setValue(start, index); + } + }); + }, + + getValue: function () { + return this.pathChooser.getValue(); + }, + + populate: function (items) { + this.pathChooser.populate(items); + this._drawArrows(); + } +}); +BI.DirectionPathChooser.EVENT_CHANGE = "DirectionPathChooser.EVENT_CHANGE"; +BI.shortcut('bi.direction_path_chooser', BI.DirectionPathChooser);/** + * Created by roy on 15/8/14. + */ +BI.DownListCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-down-list-combo", + invalid: false, + height: 25, + items: [], + adjustLength: 0, + direction: "bottom", + trigger: "click", + el: {} + }) + }, + + _init: function () { + BI.DownListCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.popupview = BI.createWidget({ + type: "bi.down_list_popup", + items: o.items, + chooseType: o.chooseType + }); + + this.popupview.on(BI.DownListPopup.EVENT_CHANGE, function (value) { + self.fireEvent(BI.DownListCombo.EVENT_CHANGE, value); + self.downlistcombo.hideView(); + }); + + this.popupview.on(BI.DownListPopup.EVENT_SON_VALUE_CHANGE, function (value, fatherValue) { + self.fireEvent(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, value, fatherValue); + self.downlistcombo.hideView(); + }); + + + this.downlistcombo = BI.createWidget({ + element: this, + type: 'bi.combo', + trigger: o.trigger, + isNeedAdjustWidth: false, + adjustLength: o.adjustLength, + direction: o.direction, + el: BI.createWidget(o.el, { + type: "bi.icon_trigger", + extraCls: o.iconCls ? o.iconCls : "pull-down-font", + width: o.width, + height: o.height + }), + popup: { + el: this.popupview, + stopPropagation: true, + maxHeight: 1000 + } + }); + + this.downlistcombo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.DownListCombo.EVENT_BEFORE_POPUPVIEW); + }); + }, + + hideView: function () { + this.downlistcombo.hideView(); + }, + + showView: function () { + this.downlistcombo.showView(); + }, + + populate: function (items) { + this.popupview.populate(items); + }, + + setValue: function (v) { + this.popupview.setValue(v); + }, + getValue: function () { + return this.popupview.getValue() + } +}); +BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; +BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; + +BI.shortcut("bi.down_list_combo", BI.DownListCombo);/** + * Created by roy on 15/9/6. + */ +BI.DownListGroup = BI.inherit(BI.Widget, { + constants: { + iconCls: "check-mark-ha-font" + }, + _defaultConfig: function () { + return BI.extend(BI.DownListGroup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-down-list-group", + items: [ + { + el: {} + } + ] + }) + }, + _init: function () { + BI.DownListGroup.superclass._init.apply(this, arguments); + var o = this.options, self = this; + + this.downlistgroup = BI.createWidget({ + element: this, + type: "bi.button_tree", + items: o.items, + chooseType: 0,//0单选,1多选 + layouts: [{ + type: "bi.vertical", + hgap: 0, + vgap: 0 + }] + }); + this.downlistgroup.on(BI.Controller.EVENT_CHANGE, function (type) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if(type === BI.Events.CLICK) { + self.fireEvent(BI.DownListGroup.EVENT_CHANGE, arguments); + } + }) + }, + getValue:function(){ + return this.downlistgroup.getValue(); + }, + setValue:function(v){ + this.downlistgroup.setValue(v); + } + + +}) +BI.DownListGroup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.down_list_group", BI.DownListGroup);BI.DownListItem = BI.inherit(BI.Single, { + _defaultConfig: function () { + var conf = BI.DownListItem.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: "bi-down-list-item bi-list-item-active", + cls: "", + height: 25, + logic: { + dynamic: true + }, + selected: false, + iconHeight: null, + iconWidth: null, + textHgap: 0, + textVgap: 0, + textLgap: 0, + textRgap: 0 + }) + }, + _init: function () { + BI.DownListItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.text = BI.createWidget({ + type: "bi.icon_text_item", + element: this, + height: o.height, + text: o.text, + value: o.value, + logic: o.logic, + selected: o.selected, + disabled: o.disabled, + iconHeight: o.iconHeight, + iconWidth: o.iconWidth, + textHgap: o.textHgap, + textVgap: o.textVgap, + textLgap: o.textLgap, + textRgap: o.textRgap, + father: o.father + }); + this.text.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.text.on(BI.IconTextItem.EVENT_CHANGE, function () { + self.fireEvent(BI.DownListItem.EVENT_CHANGE); + }); + // this.setSelected(o.selected); + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + isSelected: function () { + return this.text.isSelected(); + }, + + setSelected: function (b) { + this.text.setSelected(b); + // if (b === true) { + // this.element.addClass("dot-e-font"); + // } else { + // this.element.removeClass("dot-e-font"); + // } + }, + + setValue: function (v) { + this.text.setValue(v); + }, + + getValue: function () { + return this.text.getValue(); + } +}); +BI.DownListItem.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.down_list_item", BI.DownListItem);BI.DownListGroupItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + var conf = BI.DownListGroupItem.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-down-list-group-item", + logic: { + dynamic: false + }, + // invalid: true, + iconCls1: "dot-e-font", + iconCls2: "pull-right-e-font" + }) + }, + _init: function () { + BI.DownListGroupItem.superclass._init.apply(this, arguments); + var o = this.options; + var self = this; + this.text = BI.createWidget({ + type: "bi.label", + cls: "list-group-item-text", + textAlign: "left", + text: o.text, + value: o.value, + height: o.height + }); + + this.icon1 = BI.createWidget({ + type: "bi.icon_button", + cls: o.iconCls1, + width: 25, + forceNotSelected: true + }); + + this.icon2 = BI.createWidget({ + type: "bi.icon_button", + cls: o.iconCls2, + width: 25, + forceNotSelected: true + }); + + var blank = BI.createWidget({ + type: "bi.layout", + width: 25 + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.icon2, + top: 0, + bottom: 0, + right: 0 + }] + }); + + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic("horizontal", BI.extend(o.logic, { + items: BI.LogicFactory.createLogicItemsByDirection("left", this.icon1, this.text, blank) + })))); + + this.element.hover(function () { + if (self.isEnabled()) { + self.hover(); + } + }, function () { + if (self.isEnabled()) { + self.dishover() + } + }); + }, + + hover: function () { + BI.DownListGroupItem.superclass.hover.apply(this, arguments); + this.icon1.element.addClass("hover"); + this.icon2.element.addClass("hover"); + + }, + + dishover: function () { + BI.DownListGroupItem.superclass.dishover.apply(this, arguments); + this.icon1.element.removeClass("hover"); + this.icon2.element.removeClass("hover"); + }, + + doClick: function () { + BI.DownListGroupItem.superclass.doClick.apply(this, arguments); + if (this.isValid()) { + this.fireEvent(BI.DownListGroupItem.EVENT_CHANGE, this.getValue()); + } + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + setValue: function (v) { + var self = this, o = this.options; + v = BI.isArray(v) ? v : [v]; + BI.find(v, function (idx, value) { + if (BI.contains(o.childValues, value)) { + self.icon1.setSelected(true); + return true; + } else { + self.icon1.setSelected(false); + } + }) + } +}); +BI.DownListGroupItem.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.down_list_group_item", BI.DownListGroupItem);/** + * Created by roy on 15/9/8. + * 处理popup中的item分组样式 + * 一个item分组中的成员大于一时,该分组设置为单选,并且默认状态第一个成员设置为已选择项 + */ +BI.DownListPopup = BI.inherit(BI.Pane, { + constants: { + nextIcon: "pull-right-e-font", + height: 25, + iconHeight: 12, + iconWidth: 12, + hgap: 0, + vgap: 0, + border: 1 + }, + _defaultConfig: function () { + var conf = BI.DownListPopup.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: "bi-down-list-popup", + items: [], + chooseType: BI.Selection.Multi + }) + }, + _init: function () { + BI.DownListPopup.superclass._init.apply(this, arguments); + this.singleValues = []; + this.childValueMap = {}; + this.fatherValueMap = {}; + var self = this, o = this.options, children = this._createChildren(o.items); + this.popup = BI.createWidget({ + type: "bi.button_tree", + items: BI.createItems(children, + {}, { + adjustLength: -2 + } + ), + layouts: [{ + type: "bi.vertical", + hgap: this.constants.hgap, + vgap: this.constants.vgap + }], + chooseType: o.chooseType + }); + + this.popup.on(BI.ButtonTree.EVENT_CHANGE, function (value, object) { + var changedValue = value; + if (BI.isNotNull(self.childValueMap[value])) { + changedValue = self.childValueMap[value]; + self.fireEvent(BI.DownListPopup.EVENT_SON_VALUE_CHANGE, changedValue, self.fatherValueMap[value]) + } else { + self.fireEvent(BI.DownListPopup.EVENT_CHANGE, changedValue, object); + } + + + if (!self.singleValues.contains(changedValue)) { + var item = self.getValue(); + var result = []; + BI.each(item, function (i, valueObject) { + if (valueObject.value != changedValue) { + result.push(valueObject); + } + }); + self.setValue(result); + } + + }); + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.popup] + }); + + }, + _createChildren: function (items) { + var self = this, result = []; + BI.each(items, function (i, it) { + var item_done = { + type: "bi.down_list_group", + items: [] + }; + + BI.each(it, function (i, item) { + if (BI.isNotEmptyArray(item.children) && !BI.isEmpty(item.el)) { + item.type = "bi.combo_group"; + item.cls = "down-list-group"; + item.trigger = "hover"; + item.isNeedAdjustWidth = false; + item.el.title = item.el.title || item.el.text; + item.el.type = "bi.down_list_group_item"; + item.el.logic = { + dynamic: true + }; + item.el.height = self.constants.height; + item.el.iconCls2 = self.constants.nextIcon; + item.popup = { + lgap: 4, + el: { + type: "bi.button_tree", + chooseType: 0, + layouts: [{ + type: "bi.vertical" + }] + + } + }; + item.el.childValues = []; + BI.each(item.children, function (i, child) { + var fatherValue = BI.deepClone(item.el.value); + var childValue = BI.deepClone(child.value); + self.singleValues.push(child.value); + child.type = "bi.down_list_item"; + child.extraCls = " child-down-list-item"; + child.title = child.title || child.text; + child.textRgap = 10; + child.isNeedAdjustWidth = false; + child.logic = { + dynamic: true + }; + child.father = fatherValue; + self.fatherValueMap[self._createChildValue(fatherValue, childValue)] = fatherValue; + self.childValueMap[self._createChildValue(fatherValue, childValue)] = childValue; + child.value = self._createChildValue(fatherValue, childValue); + item.el.childValues.push(child.value); + }) + } else { + item.type = "bi.down_list_item"; + item.title = item.title || item.text; + item.textRgap = 10; + item.isNeedAdjustWidth = false; + item.logic = { + dynamic: true + } + } + var el_done = {}; + el_done.el = item; + item_done.items.push(el_done); + }); + if (self._isGroup(item_done.items)) { + BI.each(item_done.items, function (i, item) { + self.singleValues.push(item.el.value); + }) + } + + result.push(item_done); + if (self._needSpliter(i, items.length)) { + var spliter_container = BI.createWidget({ + type: "bi.vertical", + items: [{ + el: { + type: "bi.layout", + cls: "bi-down-list-spliter bi-border-top cursor-pointer", + height: 0 + } + + }], + cls: "bi-down-list-spliter-container cursor-pointer", + lgap: 10, + rgap: 10 + }); + result.push(spliter_container); + } + }); + return result; + }, + + _isGroup: function (i) { + return i.length > 1; + }, + + _needSpliter: function (i, itemLength) { + return i < itemLength - 1; + }, + + _createChildValue: function (fatherValue, childValue) { + return fatherValue + "_" + childValue + }, + + populate: function (items) { + BI.DownListPopup.superclass.populate.apply(this, arguments); + var self = this; + self.childValueMap = {}; + self.fatherValueMap = {}; + self.singleValues = []; + var children = self._createChildren(items); + var popupItem = BI.createItems(children, + {}, { + adjustLength: -2 + } + ); + self.popup.populate(popupItem); + }, + + setValue: function (valueItem) { + var self = this; + var valueArray = []; + BI.each(valueItem, function (i, item) { + var value; + if (BI.isNotNull(item.childValue)) { + value = self._createChildValue(item.value, item.childValue); + } else { + value = item.value; + } + valueArray.push(value); + } + ); + this.popup.setValue(valueArray); + }, + + getValue: function () { + var self = this, result = []; + var values = this.popup.getValue(); + BI.each(values, function (i, value) { + var valueItem = {}; + if (BI.isNotNull(self.childValueMap[value])) { + var fartherValue = self.fatherValueMap[value]; + valueItem.childValue = self.childValueMap[value]; + valueItem.value = fartherValue; + } else { + valueItem.value = value; + } + result.push(valueItem); + }); + return result; + } + + +}); + +BI.DownListPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.DownListPopup.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; +BI.shortcut("bi.down_list_popup", BI.DownListPopup);/** + * + * Created by GUY on 2016/3/28. + * @class BI.ExcelTableCell + * @extends BI.Widget + */ +BI.ExcelTableCell = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.ExcelTableCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-excel-table-cell", + text: "" + }); + }, + + _init: function () { + BI.ExcelTableCell.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "left", + whiteSpace: "normal", + height: this.options.height, + text: this.options.text, + value: this.options.value + }) + } +}); +BI.shortcut('bi.excel_table_cell', BI.ExcelTableCell);/** + * + * Created by GUY on 2016/3/28. + * @class BI.ExcelTableHeaderCell + * @extends BI.Widget + */ +BI.ExcelTableHeaderCell = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.ExcelTableHeaderCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-excel-table-header-cell bi-background", + text: "" + }); + }, + + _init: function () { + BI.ExcelTableHeaderCell.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + BI.createWidget({ + type: "bi.label", + element: this, + textAlign: BI.HorizontalAlign.Center, + whiteSpace: "normal", + height: this.options.height, + text: this.options.text, + value: this.options.value + }) + } +}); +BI.shortcut('bi.excel_table_header_cell', BI.ExcelTableHeaderCell);/** + * Excel表格 + * + * Created by GUY on 2016/3/28. + * @class BI.ExcelTable + * @extends BI.Widget + */ +BI.ExcelTable = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.ExcelTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-excel-table", + el: { + type: "bi.responsive_table" + }, + + isNeedResize: false, + isResizeAdapt: true, + + isNeedMerge: false,//是否需要合并单元格 + mergeCols: [], //合并的单元格列号 + mergeRule: function (row1, row2) { //合并规则, 默认相等时合并 + return BI.isEqual(row1, row2); + }, + + columnSize: [], + headerRowSize: 37, + footerRowSize: 37, + rowSize: 37, + + regionColumnSize: false, + + items: [] //二维数组 + }); + }, + + _init: function () { + BI.ExcelTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + var mergeCols = []; + BI.each(o.mergeCols, function (i, col) { + mergeCols.push(col + 1); + }); + this.table = BI.createWidget(o.el, { + type: "bi.table_view", + element: this, + + isNeedFreeze: false, + + isNeedMerge: o.isNeedMerge, + mergeCols: mergeCols, + mergeRule: o.mergeRule, + + columnSize: [""].concat(o.columnSize), + headerRowSize: 18, + rowSize: o.rowSize, + + regionColumnSize: o.regionColumnSize || [82, ""] + }); + + if (BI.isNotEmptyArray(o.items)) { + this.populate(o.items); + } + BI.nextTick(function () { + self.setRegionColumnSize(o.regionColumnSize || [82, ""]); + }); + }, + + resize: function () { + this.table.resize(); + }, + + setColumnSize: function (columnSize) { + this.table.setColumnSize(columnSize); + }, + + getColumnSize: function () { + return this.table.getColumnSize(); + }, + + getCalculateColumnSize: function () { + return this.table.getCalculateColumnSize(); + }, + + setHeaderColumnSize: function (columnSize) { + this.table.setHeaderColumnSize(columnSize); + }, + + setRegionColumnSize: function (columnSize) { + this.table.setRegionColumnSize(columnSize); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + getCalculateRegionColumnSize: function () { + return this.table.getCalculateRegionColumnSize(); + }, + + getCalculateRegionRowSize: function () { + return this.table.getCalculateRegionRowSize(); + }, + + getClientRegionColumnSize: function () { + return this.table.getClientRegionColumnSize(); + }, + + getScrollRegionColumnSize: function () { + return this.table.getScrollRegionColumnSize(); + }, + + getScrollRegionRowSize: function () { + return this.table.getScrollRegionRowSize(); + }, + + hasVerticalScroll: function () { + return this.table.hasVerticalScroll(); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, + + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + getColumns: function () { + return this.table.getColumns(); + }, + + resizeHeader: function () { + this.table.resize(); + this.table._resizeHeader && this.table._resizeHeader(); + }, + + attr: function (key,value) { + var self = this; + if (BI.isObject(key)) { + BI.each(key, function (k, v) { + self.attr(k, v); + }); + return; + } + BI.ExcelTable.superclass.attr.apply(this, arguments); + switch (key){ + case "mergeCols": + var mCols = []; + BI.each(value, function (i, col) { + mCols.push(col + 1); + }); + value=mCols; + break; + } + this.table.attr.apply(this.table, arguments); + }, + + populate: function (rows) { + var self = this; + var columnSize = this.getColumnSize(); + var items = []; + var header = [{ + type: "bi.excel_table_header_cell" + }]; + if (BI.isNotNull(rows)) { + BI.each(columnSize, function (i, size) { + header.push({ + type: "bi.excel_table_header_cell", + text: BI.int2Abc(i + 1) + }); + }); + BI.each(rows, function (i, row) { + items.push([{ + type: "bi.excel_table_header_cell", + text: (i + 1) + }].concat(row)); + }); + } + this.table.populate(items, [header]); + }, + + destroy: function () { + this.table.destroy(); + BI.ExcelTable.superclass.destroy.apply(this, arguments); + } +}); +BI.shortcut('bi.excel_table', BI.ExcelTable);/** + * 文件管理控件组 + * + * Created by GUY on 2015/12/11. + * @class BI.FileManagerButtonGroup + * @extends BI.Widget + */ +BI.FileManagerButtonGroup = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.FileManagerButtonGroup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-file-manager-button_group", + items: [] + }) + }, + + _init: function () { + BI.FileManagerButtonGroup.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.button_group = BI.createWidget({ + type: "bi.button_tree", + element: this, + chooseType: BI.Selection.Multi, + items: this._formatItems(o.items), + layouts: [{ + type: "bi.vertical" + }] + }); + this.button_group.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + }, + + _formatItems: function (items) { + var self = this, o = this.options; + BI.each(items, function (i, item) { + if (item.children && item.children.length > 0) { + item.type = "bi.file_manager_folder_item"; + } else { + item.type = "bi.file_manager_file_item"; + } + }); + return items; + }, + + setValue: function (v) { + this.button_group.setValue(v); + }, + + getValue: function () { + return this.button_group.getValue(); + }, + + getNotSelectedValue: function () { + return this.button_group.getNotSelectedValue(); + }, + + getAllLeaves: function () { + return this.button_group.getAllLeaves(); + }, + + getAllButtons: function () { + return this.button_group.getAllButtons(); + }, + + getSelectedButtons: function () { + return this.button_group.getSelectedButtons(); + }, + + getNotSelectedButtons: function () { + return this.button_group.getNotSelectedButtons(); + }, + + populate: function (items) { + this.button_group.populate(this._formatItems(items)); + } +}); +BI.FileManagerButtonGroup.EVENT_CHANGE = "FileManagerButtonGroup.EVENT_CHANGE"; +BI.shortcut("bi.file_manager_button_group", BI.FileManagerButtonGroup);/** + * 文件管理控件 + * + * Created by GUY on 2015/12/11. + * @class BI.FileManager + * @extends BI.Widget + */ +BI.FileManager = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.FileManager.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-file-manager", + el: {}, + items: [] + }) + }, + + _init: function () { + BI.FileManager.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.tree = new BI.Tree(); + var items = BI.Tree.transformToTreeFormat(o.items); + this.tree.initTree(items); + this.selectedValues = []; + this.nav = BI.createWidget({ + type: "bi.file_manager_nav", + items: BI.deepClone(items) + }); + this.nav.on(BI.FileManagerNav.EVENT_CHANGE, function (value, obj) { + if (value == "-1") {//根节点 + self.populate({children: self.tree.toJSON()}); + } else { + var node = self.tree.search(obj.attr("id")); + self.populate(BI.extend({id: node.id}, node.get("data"), {children: self.tree.toJSON(node)})); + } + self.setValue(self.selectedValues); + }); + this.list = BI.createWidget(o.el, { + type: "bi.file_manager_list", + items: items + }); + this.list.on(BI.Controller.EVENT_CHANGE, function (type, selected, obj) { + if (type === BI.Events.CHANGE) { + var node = self.tree.search(obj.attr("id")); + self.populate(BI.extend({id: node.id}, node.get("data"), {children: self.tree.toJSON(node)})); + } else if (type === BI.Events.CLICK) { + var values = []; + if (obj instanceof BI.MultiSelectBar) { + var t = self.list.getValue(); + selected = t.type === BI.Selection.All; + values = BI.concat(t.assist, t.value); + } else { + values = obj.getAllLeaves(); + } + BI.each(values, function (i, v) { + if (selected === true) { + self.selectedValues.pushDistinct(v); + } else { + self.selectedValues.remove(v); + } + }); + } + self.setValue(self.selectedValues); + }); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.list, + left: 0, + right: 0, + top: 0, + bottom: 10 + }, { + el: this.nav, + left: 40, + right: 100, + top: 0 + }] + }); + }, + + setValue: function (value) { + this.selectedValues = value || []; + this.list.setValue(this.selectedValues); + }, + + getValue: function () { + var obj = this.list.getValue(); + var res = obj.type === BI.Selection.All ? obj.assist : obj.value; + res.pushDistinctArray(this.selectedValues); + return res; + }, + + _populate: function (items) { + this.list.populate(items); + }, + + getSelectedValue: function () { + return this.nav.getValue()[0]; + }, + + getSelectedId: function () { + return this.nav.getId()[0]; + }, + + populate: function (node) { + var clone = BI.deepClone(node); + this._populate(node.children); + this.nav.populate(clone); + } +}); +BI.FileManager.EVENT_CHANGE = "FileManager.EVENT_CHANGE"; +BI.shortcut("bi.file_manager", BI.FileManager);/** + * 文件管理控件 + * + * Created by GUY on 2015/12/11. + * @class BI.FileManagerFileItem + * @extends BI.Single + */ +BI.FileManagerFileItem = BI.inherit(BI.Single, { + + _defaultConfig: function () { + return BI.extend(BI.FileManagerFileItem.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-file-manager-file-item bi-list-item bi-border-bottom", + height: 30 + }) + }, + + _init: function () { + BI.FileManagerFileItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checked = BI.createWidget({ + type: "bi.multi_select_bar", + text: "", + width: 36, + height: o.height + }); + this.checked.on(BI.Controller.EVENT_CHANGE, function () { + arguments[2] = self; + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + BI.createWidget({ + type: "bi.htape", + element: this, + items: [{ + el: this.checked, + width: 36 + }, { + el: { + type: "bi.icon_button", + cls: "create-by-me-file-font" + }, + width: 20 + }, { + el: { + type: "bi.label", + textAlign: "left", + height: o.height, + text: o.text, + value: o.value + } + }] + }) + }, + + getAllLeaves: function(){ + return [this.options.value]; + }, + + isSelected: function () { + return this.checked.isSelected(); + }, + + setSelected: function (v) { + this.checked.setSelected(v); + } +}); +BI.FileManagerFileItem.EVENT_CHANGE = "FileManagerFileItem.EVENT_CHANGE"; +BI.shortcut("bi.file_manager_file_item", BI.FileManagerFileItem);/** + * 文件管理控件 + * + * Created by GUY on 2015/12/11. + * @class BI.FileManagerFolderItem + * @extends BI.Single + */ +BI.FileManagerFolderItem = BI.inherit(BI.Single, { + + _defaultConfig: function () { + return BI.extend(BI.FileManagerFolderItem.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-file-manager-folder-item bi-list-item bi-border-bottom", + height: 30 + }) + }, + + _init: function () { + BI.FileManagerFolderItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checked = BI.createWidget({ + type: "bi.multi_select_bar", + text: "", + width: 36, + height: o.height + }); + this.checked.on(BI.Controller.EVENT_CHANGE, function () { + arguments[2] = self; + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.button = BI.createWidget({ + type: "bi.text_button", + textAlign: "left", + height: o.height, + text: o.text, + value: o.value + }); + this.button.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.CHANGE, o.value, self); + }); + + this.tree = new BI.Tree(); + this.tree.initTree([{ + id: o.id, + children: o.children + }]); + this.selectValue = []; + + BI.createWidget({ + type: "bi.htape", + element: this, + items: [{ + el: this.checked, + width: 36 + }, { + el: { + type: "bi.icon_button", + cls: "create-by-me-folder-font" + }, + width: 20 + }, { + el: this.button + }] + }) + }, + + setAllSelected: function (v) { + this.checked.setSelected(v); + this.selectValue = []; + }, + + setHalfSelected: function (v) { + this.checked.setHalfSelected(v); + if(!v){ + this.selectValue = []; + } + }, + + setValue: function (v) { + var self = this, o = this.options; + var isHalf = false; + var selectValue = []; + this.tree.traverse(function (node) { + if (node.isLeaf()) { + if (BI.contains(v, node.get("data").value)) { + selectValue.push(node.get("data").value); + } else { + isHalf = true; + } + } + }); + this.setAllSelected(selectValue.length > 0 && !isHalf); + this.setHalfSelected(selectValue.length > 0 && isHalf); + if (this.checked.isHalfSelected()) { + this.selectValue = selectValue; + } + }, + + getAllButtons: function () { + return [this]; + }, + + getAllLeaves: function () { + var o = this.options; + var res = []; + this.tree.traverse(function (node) { + if (node.isLeaf()) { + res.push(node.get("data").value) + } + }); + return res; + }, + + getNotSelectedValue: function () { + var self = this, o = this.options; + var res = []; + var isAllSelected = this.checked.isSelected(); + if (isAllSelected === true) { + return res; + } + var isHalfSelected = this.checked.isHalfSelected(); + this.tree.traverse(function (node) { + if (node.isLeaf()) { + var v = node.get("data").value; + if (isHalfSelected === true) { + if (!BI.contains(self.selectValue, node.get("data").value)) { + res.push(v); + } + } else { + res.push(v); + } + } + }); + return res; + }, + + getValue: function () { + var res = []; + if (this.checked.isSelected()) { + this.tree.traverse(function (node) { + if (node.isLeaf()) { + res.push(node.get("data").value); + } + }); + return res; + } + if (this.checked.isHalfSelected()) { + return this.selectValue; + } + return []; + } +}); +BI.FileManagerFolderItem.EVENT_CHANGE = "FileManagerFolderItem.EVENT_CHANGE"; +BI.shortcut("bi.file_manager_folder_item", BI.FileManagerFolderItem);/** + * 文件管理控件列表 + * + * Created by GUY on 2015/12/11. + * @class BI.FileManagerList + * @extends BI.Widget + */ +BI.FileManagerList = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.FileManagerList.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-file-manager-list", + el: {}, + items: [] + }) + }, + + _init: function () { + BI.FileManagerList.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.list = BI.createWidget({ + type: "bi.select_list", + element: this, + items: o.items, + toolbar: { + type: "bi.multi_select_bar", + height: 40, + text: "" + }, + el: { + type: "bi.list_pane", + el: BI.isWidget(o.el) ? o.el : BI.extend({ + type: "bi.file_manager_button_group" + }, o.el) + } + }); + this.list.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + }, + + setValue: function (v) { + this.list.setValue({ + value: v + }); + }, + + getValue: function () { + return this.list.getValue(); + }, + + populate: function (items) { + this.list.populate(items); + this.list.setToolBarVisible(true); + } +}); +BI.FileManagerList.EVENT_CHANGE = "FileManagerList.EVENT_CHANGE"; +BI.shortcut("bi.file_manager_list", BI.FileManagerList);/** + * 文件管理导航按钮 + * + * Created by GUY on 2015/12/11. + * @class BI.FileManagerNavButton + * @extends BI.Widget + */ +BI.FileManagerNavButton = BI.inherit(BI.Widget, { + + _const: { + normal_color: "#ffffff", + select_color: "#eff1f4" + }, + _defaultConfig: function () { + return BI.extend(BI.FileManagerNavButton.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-file-manager-nav-button", + selected: false, + height: 40 + }) + }, + + _init: function () { + BI.FileManagerNavButton.superclass._init.apply(this, arguments); + var self = this, o = this.options, c = this._const; + this.button = BI.createWidget({ + type: "bi.text_button", + cls: "file-manager-nav-button-text bi-card", + once: true, + selected: o.selected, + text: o.text, + title: o.text, + value: o.value, + height: o.height, + lgap: 20, + rgap: 10 + }); + this.button.on(BI.Controller.EVENT_CHANGE, function () { + arguments[2] = self; + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + var svg = BI.createWidget({ + type: "bi.svg", + cls: "file-manager-nav-button-triangle", + width: 15, + height: o.height + }); + var path = svg.path("M0,0L15,20L0,40").attr({ + "stroke": c.select_color, + "fill": o.selected ? c.select_color : c.normal_color + }); + this.button.on(BI.TextButton.EVENT_CHANGE, function () { + if (this.isSelected()) { + path.attr("fill", c.select_color); + } else { + path.attr("fill", c.normal_color); + } + }); + BI.createWidget({ + type: "bi.default", + element: this, + items: [this.button] + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: svg, + right: -15, + top: 0, + bottom: 0 + }] + }) + }, + + isSelected: function () { + return this.button.isSelected(); + }, + + setValue: function (v) { + this.button.setValue(v); + }, + + getValue: function () { + return this.button.getValue(); + }, + + populate: function (items) { + + } +}); +BI.FileManagerNavButton.EVENT_CHANGE = "FileManagerNavButton.EVENT_CHANGE"; +BI.shortcut("bi.file_manager_nav_button", BI.FileManagerNavButton);/** + * 文件管理导航 + * + * Created by GUY on 2015/12/11. + * @class BI.FileManagerNav + * @extends BI.Widget + */ +BI.FileManagerNav = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.FileManagerNav.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-file-manager-nav bi-border-left", + height: 40, + items: [] + }) + }, + + _init: function () { + BI.FileManagerNav.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.tree = new BI.Tree(); + this.refreshTreeData(o.items); + this.tree.getRoot().set("data", { + text: BI.i18nText("BI-Created_By_Me"), + value: BI.FileManagerNav.ROOT_CREATE_BY_ME, + id: BI.FileManagerNav.ROOT_CREATE_BY_ME + }); + this.button_group = BI.createWidget({ + type: "bi.button_group", + element: this, + items: [{ + type: "bi.file_manager_nav_button", + text: BI.i18nText("BI-Created_By_Me"), + selected: true, + id: BI.FileManagerNav.ROOT_CREATE_BY_ME, + value: BI.FileManagerNav.ROOT_CREATE_BY_ME + }], + layouts: [{ + type: "bi.horizontal" + }] + }); + this.button_group.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.button_group.on(BI.ButtonGroup.EVENT_CHANGE, function (value, obj) { + self.fireEvent(BI.FileManagerNav.EVENT_CHANGE, arguments); + }); + }, + + _getAllParents: function (id) { + var node, res = []; + if (!id) { + node = this.tree.getRoot(); + } else { + node = this.tree.search(id); + } + while (node.parent) { + res.push(node); + node = node.parent; + } + res.push(node); + return res.reverse(); + }, + + _formatNodes: function (nodes) { + var res = []; + BI.each(nodes, function (i, node) { + res.push(BI.extend({ + type: "bi.file_manager_nav_button", + id: node.id + }, node.get("data"))); + }); + BI.last(res).selected = true; + return res; + }, + + getValue: function () { + return this.button_group.getValue(); + }, + + getId: function () { + var ids = []; + BI.each(this.button_group.getSelectedButtons(), function (i, btn) { + ids.push(btn.attr("id")); + }); + return ids; + }, + + refreshTreeData: function(items){ + this.tree.initTree(BI.Tree.transformToTreeFormat(items)); + this.tree.getRoot().set("data", { + text: BI.i18nText("BI-Created_By_Me"), + value: BI.FileManagerNav.ROOT_CREATE_BY_ME, + id: BI.FileManagerNav.ROOT_CREATE_BY_ME + }); + }, + + populate: function (node) { + var parents = BI.isNull(node) ? [this.tree.getRoot()] : this._getAllParents(node.id); + this.button_group.populate(this._formatNodes(parents)); + } +}); +BI.extend(BI.FileManagerNav, { + ROOT_CREATE_BY_ME: "-1" +}); +BI.FileManagerNav.EVENT_CHANGE = "FileManagerNav.EVENT_CHANGE"; +BI.shortcut("bi.file_manager_nav", BI.FileManagerNav);/** + * Created by windy on 2017/3/13. + * 数值微调器 + */ +BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.FineTuningNumberEditor.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-fine-tuning-number-editor bi-border", + value: -1 + }) + }, + + _init: function () { + BI.FineTuningNumberEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: "bi.sign_editor", + height: o.height, + value: this._alertInEditorValue(o.value), + errorText: BI.i18nText("BI-Please_Input_Natural_Number"), + validationChecker: function(v){ + return BI.isNaturalNumber(v) || self._alertOutEditorValue(v) === -1; + } + }); + this.editor.on(BI.TextEditor.EVENT_CONFIRM, function(){ + self._finetuning(0); + self.fireEvent(BI.FineTuningNumberEditor.EVENT_CONFIRM); + }); + this.topBtn = BI.createWidget({ + type: "bi.icon_button", + trigger: "lclick,", + cls: "column-pre-page-h-font top-button bi-border-left bi-border-bottom" + }); + this.topBtn.on(BI.IconButton.EVENT_CHANGE, function(){ + self._finetuning(1); + self.fireEvent(BI.FineTuningNumberEditor.EVENT_CONFIRM); + }); + this.bottomBtn = BI.createWidget({ + type: "bi.icon_button", + trigger: "lclick,", + cls: "column-next-page-h-font bottom-button bi-border-left bi-border-top" + }); + this.bottomBtn.on(BI.IconButton.EVENT_CHANGE, function(){ + self._finetuning(-1); + self.fireEvent(BI.FineTuningNumberEditor.EVENT_CONFIRM); + }); + this._finetuning(0); + BI.createWidget({ + type: "bi.htape", + element: this, + items: [this.editor, { + el: { + type: "bi.grid", + columns: 1, + rows: 2, + items: [{ + column: 0, + row: 0, + el: this.topBtn + }, { + column: 0, + row: 1, + el: this.bottomBtn + }] + }, + width: 23 + }] + }); + }, + + _alertOutEditorValue: function(v){ + return v === BI.i18nText("BI-Basic_Auto") ? -1 : v; + }, + + _alertInEditorValue: function(v){ + return BI.parseInt(v) === -1 ? BI.i18nText("BI-Basic_Auto") : v; + }, + + //微调 + _finetuning: function(add){ + var v = BI.parseInt(this._alertOutEditorValue(this.editor.getValue())); + this.editor.setValue(this._alertInEditorValue(v + add)); + this.bottomBtn.setEnable((v + add) > -1); + }, + + getValue: function () { + var v = this.editor.getValue(); + return this._alertOutEditorValue(v); + }, + + setValue: function (v) { + this.editor.setValue(this._alertInEditorValue(v)); + this._finetuning(0); + } + +}); +BI.FineTuningNumberEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.shortcut("bi.fine_tuning_number_editor", BI.FineTuningNumberEditor);/** + * 交互行为布局 + * + * + * Created by GUY on 2016/7/23. + * @class BI.InteractiveArrangement + * @extends BI.Widget + */ +BI.InteractiveArrangement = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.InteractiveArrangement.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-interactive-arrangement", + resizable: true, + layoutType: BI.Arrangement.LAYOUT_TYPE.GRID, + items: [] + }); + }, + + _init: function () { + BI.InteractiveArrangement.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.arrangement = BI.createWidget({ + type: "bi.adaptive_arrangement", + element: this, + resizable: o.resizable, + layoutType: o.layoutType, + items: o.items + }); + this.arrangement.on(BI.AdaptiveArrangement.EVENT_SCROLL, function () { + self.fireEvent(BI.InteractiveArrangement.EVENT_SCROLL, arguments); + }); + this.arrangement.on(BI.AdaptiveArrangement.EVENT_RESIZE, function () { + self.fireEvent(BI.InteractiveArrangement.EVENT_RESIZE, arguments); + }); + + this.arrangement.on(BI.AdaptiveArrangement.EVENT_ELEMENT_RESIZE, function (id, size) { + var p = self._getRegionClientPosition(id); + self.draw({ + left: p.left, + top: p.top + }, size, id); + }); + this.arrangement.on(BI.AdaptiveArrangement.EVENT_ELEMENT_STOP_RESIZE, function (id, size) { + self.stopDraw(); + self.setRegionSize(id, size); + }); + + this.tags = []; + + }, + + _isEqual: function (num1, num2) { + return this.arrangement._isEqual(num1, num2); + }, + + _getScrollOffset: function () { + return this.arrangement._getScrollOffset(); + }, + + _positionAt: function (position, regions) { + var self = this; + regions = regions || this.getAllRegions(); + var left = [], center = [], right = [], top = [], middle = [], bottom = []; + BI.each(regions, function (i, region) { + var client = self._getRegionClientPosition(region.id); + if (Math.abs(client.left - position.left) <= 3) { + left.push(region); + } + if (Math.abs(client.left + client.width / 2 - position.left) <= 3) { + center.push(region); + } + if (Math.abs(client.left + client.width - position.left) <= 3) { + right.push(region); + } + if (Math.abs(client.top - position.top) <= 3) { + top.push(region); + } + if (Math.abs(client.top + client.height / 2 - position.top) <= 3) { + middle.push(region); + } + if (Math.abs(client.top + client.height - position.top) <= 3) { + bottom.push(region); + } + }); + return { + left: left, + center: center, + right: right, + top: top, + middle: middle, + bottom: bottom + } + }, + + _getRegionClientPosition: function (name) { + var region = this.getRegionByName(name); + var offset = this.arrangement._getScrollOffset(); + return { + top: region.top - offset.top, + left: region.left - offset.left, + width: region.width, + height: region.height, + id: region.id + } + }, + + _vAlign: function (position, regions) { + var self = this; + var vs = this._positionAt(position, regions); + var positions = []; + var l; + if (vs.left.length > 0) { + l = this._getRegionClientPosition(vs.left[0].id).left; + } else if (vs.right.length > 0) { + var temp = this._getRegionClientPosition(vs.right[0].id); + l = temp.left + temp.width; + } + var rs = vs.left.concat(vs.right); + BI.each(rs, function (i, region) { + var p = self._getRegionClientPosition(region.id); + if (self._isEqual(p.left, l) || self._isEqual(p.left + p.width, l)) { + var topPoint = { + top: p.top + p.height / 2, + left: l + }; + positions.push({ + id: region.id, + start: topPoint, + end: { + left: l, + top: position.top + } + }); + } + }); + return positions; + }, + + _leftAlign: function (position, size, regions) { + var self = this; + return this._vAlign({ + left: position.left, + top: position.top + size.height / 2 + }, regions); + }, + + _rightAlign: function (position, size, regions) { + var self = this; + return this._vAlign({ + left: position.left + size.width, + top: position.top + size.height / 2 + }, regions); + }, + + _hAlign: function (position, regions) { + var self = this; + var hs = this._positionAt(position, regions); + var positions = []; + var t; + if (hs.top.length > 0) { + var temp = this._getRegionClientPosition(hs.top[0].id); + t = temp.top; + } else if (hs.bottom.length > 0) { + var temp = this._getRegionClientPosition(hs.bottom[0].id); + t = temp.top + temp.height; + } + var rs = hs.top.concat(hs.bottom); + BI.each(rs, function (i, region) { + var p = self._getRegionClientPosition(region.id); + if (self._isEqual(p.top, t) || self._isEqual(p.top + p.height, t)) { + var leftPoint = { + top: t, + left: p.left + p.width / 2 + }; + positions.push({ + id: p.id, + start: leftPoint, + end: { + left: position.left, + top: t + } + }); + } + }); + return positions; + }, + + _topAlign: function (position, size, regions) { + var self = this; + return this._hAlign({ + left: position.left + size.width / 2, + top: position.top + }, regions); + }, + + _bottomAlign: function (position, size, regions) { + var self = this; + return this._hAlign({ + left: position.left + size.width / 2, + top: position.top + size.height + }, regions); + }, + + _centerAlign: function (position, size, regions) { + var self = this; + var cs = this._positionAt({ + left: position.left + size.width / 2, + top: position.top + size.height / 2 + }, regions); + var positions = []; + var l; + if (cs.center.length > 0) { + var temp = this._getRegionClientPosition(cs.center[0].id); + l = temp.left + temp.width / 2; + } + BI.each(cs.center, function (i, region) { + var p = self._getRegionClientPosition(region.id); + if (self._isEqual(p.left + p.width / 2, l)) { + var topPoint = { + top: p.top + p.height / 2, + left: p.left + p.width / 2 + }; + positions.push({ + id: p.id, + start: topPoint, + end: { + left: l, + top: position.top + size.height / 2 + } + }); + } + }); + return positions; + }, + + _middleAlign: function (position, size, regions) { + var self = this; + var cs = this._positionAt({ + left: position.left + size.width / 2, + top: position.top + size.height / 2 + }, regions); + var positions = []; + var t; + if (cs.middle.length > 0) { + var temp = this._getRegionClientPosition(cs.middle[0].id); + t = temp.top + temp.height / 2; + } + BI.each(cs.middle, function (i, region) { + var p = self._getRegionClientPosition(region.id); + if (self._isEqual(p.top + p.height / 2, t)) { + var topPoint = { + top: p.top + p.height / 2, + left: p.left + p.width / 2 + }; + positions.push({ + id: p.id, + start: topPoint, + end: { + left: position.left + size.width / 2, + top: t + } + }); + } + }); + return positions; + }, + + + _drawOneTag: function (start, end) { + var s = BI.createWidget({ + type: "bi.icon_button", + //invisible: true, + width: 13, + height: 13, + cls: "drag-tag-font interactive-arrangement-dragtag-icon" + }); + var e = BI.createWidget({ + type: "bi.icon_button", + //invisible: true, + width: 13, + height: 13, + cls: "drag-tag-font interactive-arrangement-dragtag-icon" + }); + if (this._isEqual(start.left, end.left)) { + var line = BI.createWidget({ + type: "bi.layout", + //invisible: true, + cls: "interactive-arrangement-dragtag-line", + width: 1, + height: Math.abs(start.top - end.top) + }); + } else { + var line = BI.createWidget({ + type: "bi.layout", + //invisible: true, + cls: "interactive-arrangement-dragtag-line", + height: 1, + width: Math.abs(start.left - end.left) + }); + } + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: s, + left: start.left - 6, + top: start.top - 7 + }, { + el: e, + left: end.left - 6, + top: end.top - 7 + }, { + el: line, + left: Math.min(start.left, end.left), + top: Math.min(start.top, end.top) + }] + }); + this.tags.push(s); + this.tags.push(e); + this.tags.push(line); + }, + + stopDraw: function () { + BI.each(this.tags, function (i, w) { + w.destroy(); + }); + this.tags = []; + }, + + _getRegionExcept: function (name, regions) { + var other = []; + BI.each(regions || this.getAllRegions(), function (i, region) { + if (!(name && region.id === name)) { + other.push(region); + } + }); + return other; + }, + + getClientWidth: function () { + return this.arrangement.getClientWidth(); + }, + + getClientHeight: function () { + return this.arrangement.getClientHeight(); + }, + + getPosition: function (name, position, size) { + var regions = this.getAllRegions(); + var me; + if (name) { + me = this._getRegionClientPosition(name); + } + var other = this._getRegionExcept(name, regions); + position = position || { + left: me.left, + top: me.top + }; + size = size || { + width: me.width, + height: me.height + }; + var left = this._leftAlign(position, size, other); + var right = this._rightAlign(position, size, other); + var top = this._topAlign(position, size, other, other); + var bottom = this._bottomAlign(position, size, other); + var center = this._centerAlign(position, size, other); + var middle = this._middleAlign(position, size, other); + + BI.each(center, function (i, pos) { + position.left = pos.end.left - size.width / 2; + }); + BI.each(right, function (i, pos) { + position.left = pos.end.left - size.width; + }); + BI.each(left, function (i, pos) { + position.left = pos.end.left; + }); + BI.each(middle, function (i, pos) { + position.top = pos.end.top - size.height / 2; + }); + BI.each(bottom, function (i, pos) { + position.top = pos.end.top - size.height; + }); + BI.each(top, function (i, pos) { + position.top = pos.end.top; + }); + return position; + }, + + //position不动 变size + getSize: function (name, position, size) { + var regions = this.getAllRegions(); + var me; + if (name) { + me = this._getRegionClientPosition(name); + } + var other = this._getRegionExcept(name, regions); + position = position || { + left: me.left, + top: me.top + }; + size = size || { + width: me.width, + height: me.height + }; + var left = this._leftAlign(position, size, other); + var right = this._rightAlign(position, size, other); + var top = this._topAlign(position, size, other, other); + var bottom = this._bottomAlign(position, size, other); + var center = this._centerAlign(position, size, other); + var middle = this._middleAlign(position, size, other); + + BI.each(center, function (i, pos) { + size.width = (pos.end.left - position.left) * 2; + }); + BI.each(right, function (i, pos) { + size.width = pos.end.left - position.left; + }); + BI.each(left, function (i, pos) { + }); + BI.each(middle, function (i, pos) { + size.height = (pos.end.top - position.top) * 2; + }); + BI.each(bottom, function (i, pos) { + size.height = pos.end.top - position.top; + }); + BI.each(top, function (i, pos) { + }); + return size; + }, + + draw: function (position, size, name) { + var self = this; + this.stopDraw(); + switch (this.getLayoutType()) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + var other = this._getRegionExcept(name); + var left = this._leftAlign(position, size, other); + var right = this._rightAlign(position, size, other); + var top = this._topAlign(position, size, other); + var bottom = this._bottomAlign(position, size, other); + var center = this._centerAlign(position, size, other); + var middle = this._middleAlign(position, size, other); + + BI.each(center, function (i, pos) { + self._drawOneTag(pos.start, pos.end); + }); + BI.each(right, function (i, pos) { + self._drawOneTag(pos.start, pos.end); + }); + BI.each(left, function (i, pos) { + self._drawOneTag(pos.start, pos.end); + }); + BI.each(middle, function (i, pos) { + self._drawOneTag(pos.start, pos.end); + }); + BI.each(bottom, function (i, pos) { + self._drawOneTag(pos.start, pos.end); + }); + BI.each(top, function (i, pos) { + self._drawOneTag(pos.start, pos.end); + }); + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + break; + } + }, + + addRegion: function (region, position) { + this.stopDraw(); + return this.arrangement.addRegion(region, position); + }, + + deleteRegion: function (name) { + return this.arrangement.deleteRegion(name); + }, + + setRegionSize: function (name, size) { + size = this.getSize(name, null, size); + return this.arrangement.setRegionSize(name, size); + }, + + setPosition: function (position, size) { + var self = this; + this.stopDraw(); + if (position.left > 0 && position.top > 0) { + switch (this.getLayoutType()) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + position = this.getPosition(null, position, size); + this.draw(position, size); + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + break; + } + } + var at = this.arrangement.setPosition(position, size); + return at; + }, + + setRegionPosition: function (name, position) { + if (position.left > 0 && position.top > 0) { + switch (this.getLayoutType()) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + position = this.getPosition(name, position); + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + break; + } + } + return this.arrangement.setRegionPosition(name, position); + }, + + setDropPosition: function (position, size) { + var self = this; + this.stopDraw(); + if (position.left > 0 && position.top > 0) { + switch (this.getLayoutType()) { + case BI.Arrangement.LAYOUT_TYPE.FREE: + position = this.getPosition(null, position, size); + this.draw(position, size); + break; + case BI.Arrangement.LAYOUT_TYPE.GRID: + break; + } + } + var callback = self.arrangement.setDropPosition(position, size); + return function () { + callback(); + self.stopDraw(); + } + }, + + scrollInterval: function () { + this.arrangement.scrollInterval.apply(this.arrangement, arguments); + }, + + scrollEnd: function () { + this.arrangement.scrollEnd.apply(this.arrangement, arguments); + }, + + scrollTo: function (scroll) { + this.arrangement.scrollTo(scroll); + }, + + zoom: function (ratio) { + this.arrangement.zoom(ratio); + }, + + resize: function () { + return this.arrangement.resize(); + }, + + relayout: function () { + return this.arrangement.relayout(); + }, + + setLayoutType: function (type) { + this.arrangement.setLayoutType(type); + }, + + getLayoutType: function () { + return this.arrangement.getLayoutType(); + }, + + getLayoutRatio: function () { + return this.arrangement.getLayoutRatio(); + }, + + getHelper: function () { + return this.arrangement.getHelper(); + }, + + getRegionByName: function (name) { + return this.arrangement.getRegionByName(name); + }, + + getAllRegions: function () { + return this.arrangement.getAllRegions(); + }, + + revoke: function () { + return this.arrangement.revoke(); + }, + + populate: function (items) { + var self = this; + this.arrangement.populate(items); + } +}); +BI.InteractiveArrangement.EVENT_RESIZE = "InteractiveArrangement.EVENT_RESIZE"; +BI.InteractiveArrangement.EVENT_SCROLL = "InteractiveArrangement.EVENT_SCROLL"; +BI.shortcut('bi.interactive_arrangement', BI.InteractiveArrangement);/** + * 月份下拉框 + * + * Created by GUY on 2015/8/28. + * @class BI.MonthCombo + * @extends BI.Trigger + */ +BI.MonthCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.MonthCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-month-combo", + behaviors: {}, + height: 25 + }); + }, + _init: function () { + BI.MonthCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.trigger = BI.createWidget({ + type: "bi.month_trigger" + }); + + this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM, function (v) { + if (this.getKey() && this.getKey() !== self.storeValue) { + self.setValue(this.getValue()); + } else if (!this.getKey()) { + self.setValue(); + } + self.fireEvent(BI.MonthCombo.EVENT_CONFIRM); + }); + this.trigger.on(BI.MonthTrigger.EVENT_FOCUS, function () { + self.storeValue = this.getKey(); + }); + this.trigger.on(BI.MonthTrigger.EVENT_START, function () { + self.combo.hideView(); + }); + this.trigger.on(BI.MonthTrigger.EVENT_STOP, function () { + if (!self.combo.isViewVisible()) { + self.combo.showView(); + } + }); + this.trigger.on(BI.MonthTrigger.EVENT_CHANGE, function () { + self.combo.isViewVisible() && self.combo.hideView(); + }); + + this.popup = BI.createWidget({ + type: "bi.month_popup", + behaviors: o.behaviors + }); + this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.MonthCombo.EVENT_CONFIRM); + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: this.trigger, + popup: { + minWidth: 85, + el: this.popup + } + }); + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW); + }); + }, + + setValue: function (v) { + this.trigger.setValue(v); + this.popup.setValue(v); + }, + + getValue: function () { + return this.popup.getValue(); + } +}); + +BI.MonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.MonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.shortcut('bi.month_combo', BI.MonthCombo);/** + * 月份展示面板 + * + * Created by GUY on 2015/9/2. + * @class BI.MonthPopup + * @extends BI.Trigger + */ +BI.MonthPopup = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MonthPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-month-popup", + behaviors: {} + }); + }, + + _init: function () { + BI.MonthPopup.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + //纵向排列月 + var month = [0, 6, 1, 7, 2, 8, 3, 9, 4, 10, 5, 11]; + var items = []; + items.push(month.slice(0, 2)); + items.push(month.slice(2, 4)); + items.push(month.slice(4, 6)); + items.push(month.slice(6, 8)); + items.push(month.slice(8, 10)); + items.push(month.slice(10, 12)); + items = BI.map(items, function (i, item) { + return BI.map(item, function (j, td) { + return { + type: "bi.text_item", + cls: "bi-list-item-active", + textAlign: "center", + whiteSpace: "nowrap", + once: false, + forceSelected: true, + height: 23, + width: 38, + value: td, + text: td + 1 + }; + }); + }); + + this.month = BI.createWidget({ + type: "bi.button_group", + element: this, + behaviors: o.behaviors, + items: BI.createItems(items, {}), + layouts: [BI.LogicFactory.createLogic("table", BI.extend({ + dynamic: true + }, { + columns: 2, + rows: 6, + columnSize: [1 / 2, 1 / 2], + rowSize: 25 + })), { + type: "bi.center_adapt", + vgap: 1, + hgap: 2 + }] + }); + + this.month.on(BI.Controller.EVENT_CHANGE, function (type) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.MonthPopup.EVENT_CHANGE); + } + }) + }, + + getValue: function () { + return this.month.getValue()[0]; + }, + + setValue: function (v) { + this.month.setValue([v]); + } +}); +BI.MonthPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.month_popup", BI.MonthPopup);/** + * 月份trigger + * + * Created by GUY on 2015/8/21. + * @class BI.MonthTrigger + * @extends BI.Trigger + */ +BI.MonthTrigger = BI.inherit(BI.Trigger, { + _const: { + hgap: 4, + vgap: 2, + triggerWidth: 25, + errorText: BI.i18nText("BI-Month_Trigger_Error_Text") + }, + + _defaultConfig: function () { + return BI.extend(BI.MonthTrigger.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-month-trigger bi-border", + height: 25 + }); + }, + _init: function () { + BI.MonthTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options, c = this._const; + this.editor = BI.createWidget({ + type: "bi.sign_editor", + height: o.height, + validationChecker: function (v) { + return v === "" || (BI.isPositiveInteger(v) && v >= 1 && v <= 12); + }, + quitChecker: function (v) { + return false; + }, + hgap: c.hgap, + vgap: c.vgap, + allowBlank: true, + errorText: c.errorText + }); + this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { + self.fireEvent(BI.MonthTrigger.EVENT_FOCUS); + }); + this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { + self.fireEvent(BI.MonthTrigger.EVENT_CHANGE); + }); + this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () { + var value = self.editor.getValue(); + if (BI.isNotNull(value)) { + self.editor.setValue(value); + self.editor.setTitle(value); + } + self.fireEvent(BI.MonthTrigger.EVENT_CONFIRM); + }); + this.editor.on(BI.SignEditor.EVENT_SPACE, function () { + if (self.editor.isValid()) { + self.editor.blur(); + } + }); + this.editor.on(BI.SignEditor.EVENT_START, function () { + self.fireEvent(BI.MonthTrigger.EVENT_START); + }); + this.editor.on(BI.SignEditor.EVENT_STOP, function () { + self.fireEvent(BI.MonthTrigger.EVENT_STOP); + }); + BI.createWidget({ + element: this, + type: 'bi.htape', + items: [ + { + el: this.editor + }, { + el: { + type: "bi.text_button", + text: BI.i18nText("BI-Multi_Date_Month"), + baseCls: "bi-trigger-month-text", + width: c.triggerWidth + }, + width: c.triggerWidth + }, { + el: { + type: "bi.trigger_icon_button", + width: c.triggerWidth + }, + width: c.triggerWidth + } + ] + }); + }, + setValue: function (v) { + if(BI.isNotNull(v)){ + this.editor.setState(v + 1); + this.editor.setValue(v + 1); + this.editor.setTitle(v + 1); + return; + } + this.editor.setState(); + this.editor.setValue(); + this.editor.setTitle(); + }, + getKey: function () { + return this.editor.getValue() | 0; + }, + getValue: function () { + return this.editor.getValue() - 1; + } +}); +BI.MonthTrigger.EVENT_FOCUS = "EVENT_FOCUS"; +BI.MonthTrigger.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.MonthTrigger.EVENT_START = "EVENT_START"; +BI.MonthTrigger.EVENT_STOP = "EVENT_STOP"; +BI.MonthTrigger.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.month_trigger", BI.MonthTrigger);/** + * @class BI.MultiLayerSelectTreeCombo + * @extends BI.Widget + */ +BI.MultiLayerSelectTreeCombo = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSelectTreeCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multilayer_select_tree-combo", + isDefaultInit: false, + height: 30, + text: "", + items: [] + }); + }, + + _init: function () { + BI.MultiLayerSelectTreeCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.trigger = BI.createWidget({ + type: "bi.single_tree_trigger", + text: o.text, + height: o.height, + items: o.items + }); + + this.popup = BI.createWidget({ + type: "bi.multilayer_select_tree_popup", + isDefaultInit: o.isDefaultInit, + items: o.items + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup + } + }); + + this.combo.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.popup.on(BI.MultiLayerSelectTreePopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.MultiLayerSelectTreeCombo.EVENT_CHANGE); + }); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.trigger.setValue(v); + this.popup.setValue(v); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + populate: function (items) { + this.combo.populate(items); + } +}); +BI.MultiLayerSelectTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.multilayer_select_tree_combo", BI.MultiLayerSelectTreeCombo);/** + * guy + * 二级树 + * @class BI.MultiLayerSelectLevelTree + * @extends BI.Select + */ +BI.MultiLayerSelectLevelTree = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSelectLevelTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multilayer-select-level-tree", + isDefaultInit: false, + items: [], + itemsCreator: BI.emptyFn + }) + }, + + _init: function () { + BI.MultiLayerSelectLevelTree.superclass._init.apply(this, arguments); + + this.initTree(this.options.items); + }, + + _formatItems: function (nodes, layer) { + var self = this; + BI.each(nodes, function (i, node) { + var extend = {}; + node.layer = layer; + if (!BI.isKey(node.id)) { + node.id = BI.UUID(); + } + if (node.isParent === true || BI.isNotEmptyArray(node.children)) { + switch (i) { + case 0 : + extend.type = "bi.multilayer_select_tree_first_plus_group_node"; + break; + case nodes.length - 1 : + extend.type = "bi.multilayer_select_tree_last_plus_group_node"; + break; + default : + extend.type = "bi.multilayer_select_tree_mid_plus_group_node"; + break; + } + BI.defaults(node, extend); + + self._formatItems(node.children, layer + 1); + } else { + switch (i) { + case nodes.length - 1: + extend.type = "bi.multilayer_single_tree_last_tree_leaf_item"; + break; + default : + extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item"; + } + BI.defaults(node, extend); + } + }); + return nodes; + }, + + _assertId: function (sNodes) { + BI.each(sNodes, function (i, node) { + node.id = node.id || BI.UUID(); + }); + }, + + //构造树结构, + initTree: function (nodes) { + var self = this, o = this.options; + this.empty(); + this._assertId(nodes); + this.tree = BI.createWidget({ + type: "bi.custom_tree", + element: this, + expander: { + type: "bi.select_tree_expander", + isDefaultInit: o.isDefaultInit, + el: {}, + popup: { + type: "bi.custom_tree" + } + }, + + items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + itemsCreator: o.itemsCreator, + + el: { + type: "bi.button_tree", + chooseType: BI.Selection.Single, + layouts: [{ + type: "bi.vertical" + }] + } + }); + this.tree.on(BI.Controller.EVENT_CHANGE, function (type) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, arguments); + } + }) + }, + + populate: function (nodes) { + this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); + }, + + setValue: function (v) { + this.tree.setValue(v); + }, + + getValue: function () { + return this.tree.getValue(); + }, + + getAllLeaves: function () { + return this.tree.getAllLeaves(); + }, + + getNodeById: function (id) { + return this.tree.getNodeById(id); + }, + + getNodeByValue: function (id) { + return this.tree.getNodeByValue(id); + } +}); +BI.MultiLayerSelectLevelTree.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.shortcut("bi.multilayer_select_level_tree", BI.MultiLayerSelectLevelTree);/** + * Created by GUY on 2016/1/26. + * + * @class BI.MultiLayerSelectTreePopup + * @extends BI.Pane + */ + +BI.MultiLayerSelectTreePopup = BI.inherit(BI.Pane, { + + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multilayer-select-tree-popup", + tipText: BI.i18nText("BI-No_Selected_Item"), + isDefaultInit: false, + itemsCreator: BI.emptyFn, + items: [] + }); + }, + + _init: function () { + BI.MultiLayerSelectTreePopup.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + + this.tree = BI.createWidget({ + type: 'bi.multilayer_select_level_tree', + isDefaultInit: o.isDefaultInit, + items: o.items, + itemsCreator: o.itemsCreator + }); + + BI.createWidget({ + type: "bi.vertical", + scrolly: false, + scrollable: true, + element: this, + items: [this.tree] + }); + + this.tree.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); + }); + + this.check(); + }, + + getValue: function () { + return this.tree.getValue(); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.tree.setValue(v); + }, + + populate: function (items) { + BI.MultiLayerSelectTreePopup.superclass.populate.apply(this, arguments); + this.tree.populate(items); + } +}); + +BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup);/** + * 加号表示的组节点 + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSelectTreeFirstPlusGroupNode + * @extends BI.NodeButton + */ +BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + extraCls: "bi-multilayer-select-tree-first-plus-group-node bi-list-item-active", + layer: 0,//第几层级 + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.node = BI.createWidget({ + type: "bi.select_tree_first_plus_group_node", + cls: "bi-list-item-none", + stopPropagation: true, + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.node.on(BI.Controller.EVENT_CHANGE, function (type) { + self.setSelected(self.isSelected()); + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + }) + }); + items.push(this.node); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + isOnce: function () { + return true; + }, + + doRedMark: function () { + this.node.doRedMark.apply(this.node, arguments); + }, + + unRedMark: function () { + this.node.unRedMark.apply(this.node, arguments); + }, + + isSelected: function () { + return this.node.isSelected(); + }, + + setSelected: function (b) { + BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass.setSelected.apply(this, arguments); + this.node.setSelected(b); + }, + + doClick: function () { + BI.NodeButton.superclass.doClick.apply(this, arguments); + this.node.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass.setOpened.apply(this, arguments); + this.node.setOpened(v); + } +}); + +BI.shortcut("bi.multilayer_select_tree_first_plus_group_node", BI.MultiLayerSelectTreeFirstPlusGroupNode);/** + * 加号表示的组节点 + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSelectTreeLastPlusGroupNode + * @extends BI.NodeButton + */ +BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.MultiLayerSelectTreeLastPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + extraCls: "bi-multilayer-select-tree-last-plus-group-node bi-list-item-active", + layer: 0,//第几层级 + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSelectTreeLastPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.node = BI.createWidget({ + type: "bi.select_tree_last_plus_group_node", + cls: "bi-list-item-none", + stopPropagation: true, + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.node.on(BI.Controller.EVENT_CHANGE, function (type) { + self.setSelected(self.isSelected()); + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + }) + }); + items.push(this.node); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + doRedMark: function () { + this.node.doRedMark.apply(this.node, arguments); + }, + + unRedMark: function () { + this.node.unRedMark.apply(this.node, arguments); + }, + + isSelected: function () { + return this.node.isSelected(); + }, + + setSelected: function (b) { + BI.MultiLayerSelectTreeLastPlusGroupNode.superclass.setSelected.apply(this, arguments); + this.node.setSelected(b); + }, + + doClick: function () { + BI.MultiLayerSelectTreeLastPlusGroupNode.superclass.doClick.apply(this, arguments); + this.node.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.MultiLayerSelectTreeLastPlusGroupNode.superclass.setOpened.apply(this, arguments); + this.node.setOpened(v); + } +}); + +BI.shortcut("bi.multilayer_select_tree_last_plus_group_node", BI.MultiLayerSelectTreeLastPlusGroupNode);/** + * 加号表示的组节点 + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSelectTreeMidPlusGroupNode + * @extends BI.NodeButton + */ +BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.MultiLayerSelectTreeMidPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + extraCls: "bi-multilayer-select-tree-mid-plus-group-node bi-list-item-active", + layer: 0,//第几层级 + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSelectTreeMidPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.node = BI.createWidget({ + type: "bi.select_tree_mid_plus_group_node", + cls: "bi-list-item-none", + stopPropagation: true, + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.node.on(BI.Controller.EVENT_CHANGE, function (type) { + self.setSelected(self.isSelected()); + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + }) + }); + items.push(this.node); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + doRedMark: function () { + this.node.doRedMark.apply(this.node, arguments); + }, + + unRedMark: function () { + this.node.unRedMark.apply(this.node, arguments); + }, + + isSelected: function () { + return this.node.isSelected(); + }, + + setSelected: function (b) { + BI.MultiLayerSelectTreeMidPlusGroupNode.superclass.setSelected.apply(this, arguments); + this.node.setSelected(b); + }, + + doClick: function () { + BI.MultiLayerSelectTreeMidPlusGroupNode.superclass.doClick.apply(this, arguments); + this.node.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.MultiLayerSelectTreeMidPlusGroupNode.superclass.setOpened.apply(this, arguments); + this.node.setOpened(v); + } +}); + +BI.shortcut("bi.multilayer_select_tree_mid_plus_group_node", BI.MultiLayerSelectTreeMidPlusGroupNode);/** + * 多层级下拉单选树 + * Created by GUY on 2016/1/26. + * + * @class BI.MultiLayerSingleTreeCombo + * @extends BI.Widget + */ +BI.MultiLayerSingleTreeCombo = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSingleTreeCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multilayer-singletree-combo", + isDefaultInit: false, + height: 30, + text: "", + itemsCreator: BI.emptyFn, + items: [] + }); + }, + + _init: function () { + BI.MultiLayerSingleTreeCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.trigger = BI.createWidget({ + type: "bi.single_tree_trigger", + text: o.text, + height: o.height, + items: o.items + }); + + this.popup = BI.createWidget({ + type: "bi.multilayer_single_tree_popup", + isDefaultInit: o.isDefaultInit, + items: o.items + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup + } + }); + + this.combo.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.popup.on(BI.MultiLayerSingleTreePopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.MultiLayerSingleTreeCombo.EVENT_CHANGE); + }); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.trigger.setValue(v); + this.popup.setValue(v); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + populate: function (items) { + this.combo.populate(items); + } +}); + +BI.MultiLayerSingleTreeCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.multilayer_single_tree_combo", BI.MultiLayerSingleTreeCombo);/** + * guy + * 二级树 + * @class BI.MultiLayerSingleLevelTree + * @extends BI.Single + */ +BI.MultiLayerSingleLevelTree = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSingleLevelTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multilayer-single-level-tree", + isDefaultInit: false, + items: [], + itemsCreator: BI.emptyFn + }) + }, + + _init: function () { + BI.MultiLayerSingleLevelTree.superclass._init.apply(this, arguments); + + this.initTree(this.options.items); + }, + + _formatItems: function (nodes, layer) { + var self = this; + BI.each(nodes, function (i, node) { + var extend = {}; + node.layer = layer; + if (!BI.isKey(node.id)) { + node.id = BI.UUID(); + } + if (node.isParent === true || BI.isNotEmptyArray(node.children)) { + switch (i) { + case 0 : + extend.type = "bi.multilayer_single_tree_first_plus_group_node"; + break; + case nodes.length - 1 : + extend.type = "bi.multilayer_single_tree_last_plus_group_node"; + break; + default : + extend.type = "bi.multilayer_single_tree_mid_plus_group_node"; + break; + } + BI.defaults(node, extend); + + self._formatItems(node.children, layer + 1); + } else { + switch (i) { + case nodes.length - 1: + extend.type = "bi.multilayer_single_tree_last_tree_leaf_item"; + break; + default : + extend.type = "bi.multilayer_single_tree_mid_tree_leaf_item"; + } + BI.defaults(node, extend); + } + }); + return nodes; + }, + + _assertId: function (sNodes) { + BI.each(sNodes, function (i, node) { + node.id = node.id || BI.UUID(); + }); + }, + + //构造树结构, + initTree: function (nodes) { + var self = this, o = this.options; + this.empty(); + this._assertId(nodes); + this.tree = BI.createWidget({ + type: "bi.custom_tree", + element: this, + expander: { + isDefaultInit: o.isDefaultInit, + el: {}, + popup: { + type: "bi.custom_tree" + } + }, + + items: this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0), + itemsCreator: function (op, callback) { + o.itemsCreator(op, function (items) { + callback(BI.Tree.transformToTreeFormat(items), 0) + }) + }, + + el: { + type: "bi.button_tree", + chooseType: BI.Selection.Single, + layouts: [{ + type: "bi.vertical" + }] + } + }); + this.tree.on(BI.Controller.EVENT_CHANGE, function (type, v) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, v); + } + }) + }, + + populate: function (nodes) { + this.tree.populate(this._formatItems(BI.Tree.transformToTreeFormat(nodes), 0)); + }, + + setValue: function (v) { + this.tree.setValue(v); + }, + + getValue: function () { + return this.tree.getValue(); + }, + + getAllLeaves: function () { + return this.tree.getAllLeaves(); + }, + + getNodeById: function (id) { + return this.tree.getNodeById(id); + }, + + getNodeByValue: function (id) { + return this.tree.getNodeByValue(id); + } +}); +BI.MultiLayerSingleLevelTree.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.shortcut("bi.multilayer_single_level_tree", BI.MultiLayerSingleLevelTree); +/** + * Created by GUY on 2016/1/26. + * + * @class BI.MultiLayerSingleTreePopup + * @extends BI.Pane + */ + +BI.MultiLayerSingleTreePopup = BI.inherit(BI.Pane, { + + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSingleTreePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multilayer-singletree-popup", + tipText: BI.i18nText("BI-No_Selected_Item"), + isDefaultInit: false, + itemsCreator: BI.emptyFn, + items: [] + }); + }, + + _init: function () { + BI.MultiLayerSingleTreePopup.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + + this.tree = BI.createWidget({ + type: 'bi.multilayer_single_level_tree', + isDefaultInit: o.isDefaultInit, + items: o.items, + itemsCreator: o.itemsCreator + }); + + BI.createWidget({ + type: "bi.vertical", + scrolly: false, + scrollable: true, + element: this, + items: [this.tree] + }); + + this.tree.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.tree.on(BI.MultiLayerSingleLevelTree.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiLayerSingleTreePopup.EVENT_CHANGE); + }); + + this.check(); + }, + + getValue: function () { + return this.tree.getValue(); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.tree.setValue(v); + }, + + populate: function (items) { + BI.MultiLayerSingleTreePopup.superclass.populate.apply(this, arguments); + this.tree.populate(items); + } +}); + +BI.MultiLayerSingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.multilayer_single_tree_popup", BI.MultiLayerSingleTreePopup);/** + * 加号表示的组节点 + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSingleTreeFirstPlusGroupNode + * @extends BI.NodeButton + */ +BI.MultiLayerSingleTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.MultiLayerSingleTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + extraCls: "bi-multilayer-single-tree-first-plus-group-node bi-list-item", + layer: 0,//第几层级 + id: "", + pId: "", + open: false, + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSingleTreeFirstPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.node = BI.createWidget({ + type: "bi.first_plus_group_node", + cls: "bi-list-item-none", + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.node.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) {//本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + }) + }); + items.push(this.node); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + doRedMark: function () { + this.node.doRedMark.apply(this.node, arguments); + }, + + unRedMark: function () { + this.node.unRedMark.apply(this.node, arguments); + }, + + doClick: function () { + BI.MultiLayerSingleTreeFirstPlusGroupNode.superclass.doClick.apply(this, arguments); + this.node.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.MultiLayerSingleTreeFirstPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.node)) { + this.node.setOpened(v); + } + } +}); + +BI.shortcut("bi.multilayer_single_tree_first_plus_group_node", BI.MultiLayerSingleTreeFirstPlusGroupNode);/** + * 加号表示的组节点 + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSingleTreeLastPlusGroupNode + * @extends BI.NodeButton + */ +BI.MultiLayerSingleTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.MultiLayerSingleTreeLastPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + extraCls: "bi-multilayer-single-tree-last-plus-group-node bi-list-item", + layer: 0,//第几层级 + id: "", + pId: "", + open: false, + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSingleTreeLastPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.node = BI.createWidget({ + type: "bi.last_plus_group_node", + cls: "bi-list-item-none", + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.node.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) {//本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + }) + }); + items.push(this.node); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + doRedMark: function () { + this.node.doRedMark.apply(this.node, arguments); + }, + + unRedMark: function () { + this.node.unRedMark.apply(this.node, arguments); + }, + + doClick: function () { + BI.MultiLayerSingleTreeLastPlusGroupNode.superclass.doClick.apply(this, arguments); + this.node.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.MultiLayerSingleTreeLastPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.node)) { + this.node.setOpened(v); + } + } +}); + +BI.shortcut("bi.multilayer_single_tree_last_plus_group_node", BI.MultiLayerSingleTreeLastPlusGroupNode);/** + * 加号表示的组节点 + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSingleTreeMidPlusGroupNode + * @extends BI.NodeButton + */ +BI.MultiLayerSingleTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.MultiLayerSingleTreeMidPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + extraCls: "bi-multilayer-single-tree-mid-plus-group-node bi-list-item", + layer: 0,//第几层级 + id: "", + pId: "", + open: false, + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSingleTreeMidPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.node = BI.createWidget({ + type: "bi.mid_plus_group_node", + cls: "bi-list-item-none", + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + open: o.open, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.node.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) {//本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + }) + }); + items.push(this.node); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + doRedMark: function () { + this.node.doRedMark.apply(this.node, arguments); + }, + + unRedMark: function () { + this.node.unRedMark.apply(this.node, arguments); + }, + + doClick: function () { + BI.MultiLayerSingleTreeMidPlusGroupNode.superclass.doClick.apply(this, arguments); + this.node.setSelected(this.isSelected()); + }, + + setOpened: function (v) { + BI.MultiLayerSingleTreeMidPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.node)) { + this.node.setOpened(v); + } + } +}); + +BI.shortcut("bi.multilayer_single_tree_mid_plus_group_node", BI.MultiLayerSingleTreeMidPlusGroupNode);/** + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSingleTreeFirstTreeLeafItem + * @extends BI.BasicButton + */ +BI.MultiLayerSingleTreeFirstTreeLeafItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSingleTreeFirstTreeLeafItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-multilayer-single-tree-first-tree-leaf-item bi-list-item-active", + logic: { + dynamic: false + }, + layer: 0, + id: "", + pId: "", + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSingleTreeFirstTreeLeafItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.item = BI.createWidget({ + type: "bi.first_tree_leaf_item", + cls: "bi-list-item-none", + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.item.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) {//本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + }) + }); + items.push(this.item); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + doRedMark: function () { + this.item.doRedMark.apply(this.item, arguments); + }, + + unRedMark: function () { + this.item.unRedMark.apply(this.item, arguments); + }, + + doHighLight: function () { + this.item.doHighLight.apply(this.item, arguments); + }, + + unHighLight: function () { + this.item.unHighLight.apply(this.item, arguments); + }, + + getId: function () { + return this.options.id; + }, + + getPId: function () { + return this.options.pId; + }, + + doClick: function () { + BI.MultiLayerSingleTreeFirstTreeLeafItem.superclass.doClick.apply(this, arguments); + this.item.setSelected(this.isSelected()); + }, + + setSelected: function (v) { + BI.MultiLayerSingleTreeFirstTreeLeafItem.superclass.setSelected.apply(this, arguments); + this.item.setSelected(v); + } +}); + +BI.shortcut("bi.multilayer_single_tree_first_tree_leaf_item", BI.MultiLayerSingleTreeFirstTreeLeafItem);/** + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSingleTreeLastTreeLeafItem + * @extends BI.BasicButton + */ +BI.MultiLayerSingleTreeLastTreeLeafItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSingleTreeLastTreeLeafItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-multilayer-single-tree-last-tree-leaf-item bi-list-item-active", + logic: { + dynamic: false + }, + layer: 0, + id: "", + pId: "", + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSingleTreeLastTreeLeafItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.item = BI.createWidget({ + type: "bi.last_tree_leaf_item", + cls: "bi-list-item-none", + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.item.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) {//本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + }) + }); + items.push(this.item); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + doRedMark: function () { + this.item.doRedMark.apply(this.item, arguments); + }, + + unRedMark: function () { + this.item.unRedMark.apply(this.item, arguments); + }, + + doHighLight: function () { + this.item.doHighLight.apply(this.item, arguments); + }, + + unHighLight: function () { + this.item.unHighLight.apply(this.item, arguments); + }, + + getId: function () { + return this.options.id; + }, + + getPId: function () { + return this.options.pId; + }, + + doClick: function () { + BI.MultiLayerSingleTreeLastTreeLeafItem.superclass.doClick.apply(this, arguments); + this.item.setSelected(this.isSelected()); + }, + + setSelected: function (v) { + BI.MultiLayerSingleTreeLastTreeLeafItem.superclass.setSelected.apply(this, arguments); + this.item.setSelected(v); + } +}); + +BI.shortcut("bi.multilayer_single_tree_last_tree_leaf_item", BI.MultiLayerSingleTreeLastTreeLeafItem);/** + * + * Created by GUY on 2016/1/27. + * @class BI.MultiLayerSingleTreeMidTreeLeafItem + * @extends BI.BasicButton + */ +BI.MultiLayerSingleTreeMidTreeLeafItem = BI.inherit(BI.BasicButton, { + _defaultConfig: function () { + return BI.extend(BI.MultiLayerSingleTreeMidTreeLeafItem.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-multilayer-single-tree-mid-tree-leaf-item bi-list-item-active", + logic: { + dynamic: false + }, + layer: 0, + id: "", + pId: "", + height: 25 + }) + }, + _init: function () { + BI.MultiLayerSingleTreeMidTreeLeafItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.item = BI.createWidget({ + type: "bi.mid_tree_leaf_item", + cls: "bi-list-item-none", + logic: { + dynamic: true + }, + id: o.id, + pId: o.pId, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.item.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) {//本身实现click功能 + return; + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + var items = []; + BI.count(0, o.layer, function () { + items.push({ + type: "bi.layout", + cls: "base-line-conn-background", + width: 13, + height: o.height + }) + }); + items.push(this.item); + BI.createWidget({ + type: "bi.td", + element: this, + columnSize: BI.makeArray(o.layer, 13), + items: [items] + }) + }, + + doRedMark: function () { + this.item.doRedMark.apply(this.item, arguments); + }, + + unRedMark: function () { + this.item.unRedMark.apply(this.item, arguments); + }, + + doHighLight: function () { + this.item.doHighLight.apply(this.item, arguments); + }, + + unHighLight: function () { + this.item.unHighLight.apply(this.item, arguments); + }, + + getId: function () { + return this.options.id; + }, + + getPId: function () { + return this.options.pId; + }, + + doClick: function () { + BI.MultiLayerSingleTreeMidTreeLeafItem.superclass.doClick.apply(this, arguments); + this.item.setSelected(this.isSelected()); + }, + + setSelected: function (v) { + BI.MultiLayerSingleTreeMidTreeLeafItem.superclass.setSelected.apply(this, arguments); + this.item.setSelected(v); + } +}); + +BI.shortcut("bi.multilayer_single_tree_mid_tree_leaf_item", BI.MultiLayerSingleTreeMidTreeLeafItem);/** + * + * @class BI.MultiSelectCheckPane + * @extends BI.Widget + */ +BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { + + constants: { + height: 25, + lgap: 10, + tgap: 5 + }, + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectCheckPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-select-check-pane bi-background", + items: [], + itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn, + onClickContinueSelect: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiSelectCheckPane.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + + this.storeValue = {}; + this.display = BI.createWidget({ + type: 'bi.display_selected_list', + items: opts.items, + itemsCreator: function (op, callback) { + op = BI.extend(op || {}, { + selectedValues: self.storeValue.value + }); + if (self.storeValue.type === BI.Selection.Multi) { + callback({ + items: BI.map(self.storeValue.value, function (i, v) { + var txt = opts.valueFormatter(v) || v; + return { + text: txt, + value: v, + title: txt + } + }) + }); + return; + } + opts.itemsCreator(op, callback); + } + }); + + this.continueSelect = BI.createWidget({ + type: 'bi.text_button', + text: BI.i18nText('BI-Continue_Select'), + cls: 'multi-select-check-selected bi-high-light' + }); + + this.continueSelect.on(BI.TextButton.EVENT_CHANGE, function () { + opts.onClickContinueSelect(); + }); + + BI.createWidget({ + type: 'bi.vtape', + element: this, + items: [{ + height: this.constants.height, + el: { + type: 'bi.left', + cls: 'multi-select-continue-select', + items: [ + { + el: { + type: "bi.label", + text: BI.i18nText('BI-Selected_Data') + }, + lgap: this.constants.lgap, + tgap: this.constants.tgap + }, + { + el: this.continueSelect, + lgap: this.constants.lgap, + tgap: this.constants.tgap + }] + } + }, { + height: 'fill', + el: this.display + }] + }); + }, + + setValue: function (v) { + this.storeValue = v || {}; + }, + + empty: function () { + this.display.empty(); + }, + + populate: function () { + this.display.populate.apply(this.display, arguments); + } +}); + +BI.shortcut("bi.multi_select_check_pane", BI.MultiSelectCheckPane);/** + * + * + * 查看已选弹出层的展示面板 + * @class BI.DisplaySelectedList + * @extends BI.Widget + */ +BI.DisplaySelectedList = BI.inherit(BI.Pane, { + + constants: { + height: 25, + lgap: 10 + }, + + _defaultConfig: function () { + return BI.extend(BI.DisplaySelectedList.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-display-list", + itemsCreator: BI.emptyFn, + items: [] + }); + }, + + _init: function () { + BI.DisplaySelectedList.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + + this.hasNext = false; + + this.button_group = BI.createWidget({ + type: "bi.list_pane", + element: this, + el: { + type: "bi.loader", + isDefaultInit: false, + logic: { + dynamic: true, + scrolly: true + }, + items: this._createItems(opts.items), + chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + layouts: [{ + type: "bi.vertical", + lgap: 10 + }] + }, + itemsCreator: function (options, callback) { + + opts.itemsCreator(options, function (ob) { + self.hasNext = !!ob.hasNext; + callback(self._createItems(ob.items)); + }) + }, + hasNext: function () { + return self.hasNext; + } + }); + }, + + _createItems: function (items) { + return BI.createItems(items, { + type: 'bi.icon_text_item', + cls: 'cursor-default check-font display-list-item bi-tips', + once: true, + invalid: true, + selected: true, + height: this.constants.height, + logic: { + dynamic: true + } + }); + }, + + empty: function () { + this.button_group.empty(); + }, + + populate: function (items) { + if (arguments.length === 0) { + this.button_group.populate(); + } else { + this.button_group.populate(this._createItems(items)); + } + } +}); + +BI.shortcut('bi.display_selected_list', BI.DisplaySelectedList);/** + * + * @class BI.MultiSelectCombo + * @extends BI.Single + */ +BI.MultiSelectCombo = BI.inherit(BI.Single, { + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-combo', + itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn, + height: 28 + }); + }, + + _init: function () { + BI.MultiSelectCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + var assertShowValue = function () { + BI.isKey(self._startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](self._startValue); + self.trigger.getSearcher().setState(self.storeValue); + self.trigger.getCounter().setButtonChecked(self.storeValue); + }; + this.storeValue = {}; + //标记正在请求数据 + this.requesting = false; + + this.trigger = BI.createWidget({ + type: "bi.multi_select_trigger", + height: o.height, + // adapter: this.popup, + masker: { + offset: { + left: 1, + top: 1, + right: 2, + bottom: 33 + } + }, + valueFormatter: o.valueFormatter, + itemsCreator: function (op, callback) { + o.itemsCreator(op, function (res) { + if (op.times === 1 && BI.isNotNull(op.keywords)) { + //预防trigger内部把当前的storeValue改掉 + self.trigger.setValue(BI.deepClone(self.getValue())); + } + callback.apply(self, arguments); + }); + } + }); + + this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { + self._setStartValue(""); + this.getSearcher().setValue(self.storeValue); + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { + self._setStartValue(""); + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_PAUSE, function () { + if (this.getSearcher().hasMatched()) { + var keyword = this.getSearcher().getKeyword(); + self._join({ + type: BI.Selection.Multi, + value: [keyword] + }, function () { + self.combo.setValue(self.storeValue); + self._setStartValue(keyword); + assertShowValue(); + self.populate(); + self._setStartValue(""); + }) + } + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_SEARCHING, function (keywords) { + var last = BI.last(keywords); + keywords = BI.initial(keywords || []); + if (keywords.length > 0) { + self._joinKeywords(keywords, function () { + if (BI.isEndWithBlank(last)) { + self.combo.setValue(self.storeValue); + assertShowValue(); + self.combo.populate(); + self._setStartValue(""); + } else { + self.combo.setValue(self.storeValue); + assertShowValue(); + } + }); + } + }); + + this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function (value, obj) { + if (obj instanceof BI.MultiSelectBar) { + self._joinAll(this.getValue(), function () { + assertShowValue(); + }); + } else { + self._join(this.getValue(), function () { + assertShowValue(); + }); + } + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { + this.getCounter().setValue(self.storeValue); + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { + if (!self.combo.isViewVisible()) { + self.combo.showView(); + } + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + toggle: false, + el: this.trigger, + adjustLength: 1, + popup: { + type: 'bi.multi_select_popup_view', + ref: function () { + self.popup = this; + self.trigger.setAdapter(this); + }, + listeners: [{ + eventName: BI.MultiSelectPopupView.EVENT_CHANGE, + action: function () { + self.storeValue = this.getValue(); + self._adjust(function () { + assertShowValue(); + }); + } + }, { + eventName: BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM, + action: function () { + self._defaultState(); + } + }, { + eventName: BI.MultiSelectPopupView.EVENT_CLICK_CLEAR, + action: function () { + self.setValue(); + self._defaultState(); + } + }], + itemsCreator: o.itemsCreator, + valueFormatter: o.valueFormatter, + onLoaded: function () { + BI.nextTick(function () { + self.combo.adjustWidth(); + self.combo.adjustHeight(); + self.trigger.getCounter().adjustView(); + self.trigger.getSearcher().adjustView(); + }); + } + }, + hideChecker: function (e) { + return triggerBtn.element.find(e.target).length === 0; + } + }); + + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + this.setValue(self.storeValue); + BI.nextTick(function () { + self.populate(); + }); + }); + //当退出的时候如果还在处理请求,则等请求结束后再对外发确定事件 + this.wants2Quit = false; + this.combo.on(BI.Combo.EVENT_AFTER_HIDEVIEW, function () { + //important:关闭弹出时又可能没有退出编辑状态 + self.trigger.stopEditing(); + if (self.requesting === true) { + self.wants2Quit = true; + } else { + self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); + } + }); + + var triggerBtn = BI.createWidget({ + type: "bi.trigger_icon_button", + width: o.height, + height: o.height, + cls: "multi-select-trigger-icon-button bi-border-left" + }); + triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { + self.trigger.getCounter().hideView(); + if (self.combo.isViewVisible()) { + self.combo.hideView(); + } else { + self.combo.showView(); + } + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.combo, + left: 0, + right: 0, + top: 0, + bottom: 0 + }, { + el: triggerBtn, + right: 0, + top: 0, + bottom: 0 + }] + }) + }, + + _defaultState: function () { + this.trigger.stopEditing(); + this.combo.hideView(); + }, + + _assertValue: function (val) { + val || (val = {}); + val.type || (val.type = BI.Selection.Multi); + val.value || (val.value = []); + }, + + _makeMap: function (values) { + return BI.makeObject(values || []); + }, + + _joinKeywords: function (keywords, callback) { + var self = this, o = this.options; + this._assertValue(this.storeValue); + this.requesting = true; + o.itemsCreator({ + type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, + keywords: keywords + }, function (ob) { + var values = BI.pluck(ob.items, "value"); + digest(values); + }); + + function digest(items) { + var selectedMap = self._makeMap(items); + BI.each(keywords, function (i, val) { + if (BI.isNotNull(selectedMap[val])) { + self.storeValue.value[self.storeValue.type === BI.Selection.Multi ? "pushDistinct" : "remove"](val); + } + }); + self._adjust(callback); + } + }, + + _joinAll: function (res, callback) { + var self = this, o = this.options; + this._assertValue(res); + this.requesting = true; + o.itemsCreator({ + type: BI.MultiSelectCombo.REQ_GET_ALL_DATA, + keywords: [this.trigger.getKey()] + }, function (ob) { + var items = BI.pluck(ob.items, "value"); + if (self.storeValue.type === res.type) { + var change = false; + var map = self._makeMap(self.storeValue.value); + BI.each(items, function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (self.storeValue.value = BI.values(map)); + self._adjust(callback); + return; + } + var selectedMap = self._makeMap(self.storeValue.value); + var notSelectedMap = self._makeMap(res.value); + var newItems = []; + BI.each(items, function (i, item) { + if (BI.isNotNull(selectedMap[items[i]])) { + delete selectedMap[items[i]]; + } + if (BI.isNull(notSelectedMap[items[i]])) { + newItems.push(item); + } + }); + self.storeValue.value = newItems.concat(BI.values(selectedMap)); + self._adjust(callback); + }) + }, + + _adjust: function (callback) { + var self = this, o = this.options; + if (!this._count) { + o.itemsCreator({ + type: BI.MultiSelectCombo.REQ_GET_DATA_LENGTH + }, function (res) { + self._count = res.count; + adjust(); + callback(); + }); + } else { + adjust(); + callback(); + } + function adjust() { + if (self.storeValue.type === BI.Selection.All && self.storeValue.value.length >= self._count) { + self.storeValue = { + type: BI.Selection.Multi, + value: [] + } + } else if (self.storeValue.type === BI.Selection.Multi && self.storeValue.value.length >= self._count) { + self.storeValue = { + type: BI.Selection.All, + value: [] + } + } + if (self.wants2Quit === true) { + self.fireEvent(BI.MultiSelectCombo.EVENT_CONFIRM); + self.wants2Quit = false; + } + self.requesting = false; + } + }, + + _join: function (res, callback) { + var self = this, o = this.options; + this._assertValue(res); + this._assertValue(this.storeValue); + if (this.storeValue.type === res.type) { + var map = this._makeMap(this.storeValue.value); + BI.each(res.value, function (i, v) { + if (!map[v]) { + self.storeValue.value.push(v); + map[v] = v; + } + }); + var change = false; + BI.each(res.assist, function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + self._adjust(callback); + return; + } + this._joinAll(res, callback); + }, + + _setStartValue: function (value) { + this._startValue = value; + this.popup.setStartValue(value); + }, + + setValue: function (v) { + this.storeValue = v || {}; + this._assertValue(this.storeValue); + this.combo.setValue(this.storeValue); + }, + + getValue: function () { + return this.storeValue; + }, + + populate: function () { + this._count = null; + this.combo.populate.apply(this.combo, arguments); + } +}); + +BI.extend(BI.MultiSelectCombo, { + REQ_GET_DATA_LENGTH: 0, + REQ_GET_ALL_DATA: -1 +}); + +BI.MultiSelectCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; + +BI.shortcut('bi.multi_select_combo', BI.MultiSelectCombo);/** + * 多选加载数据面板 + * Created by guy on 15/11/2. + * @class BI.MultiSelectLoader + * @extends Widget + */ +BI.MultiSelectLoader = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectLoader.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-loader', + logic: { + dynamic: true + }, + el: { + height: 400 + }, + valueFormatter: BI.emptyFn, + itemsCreator: BI.emptyFn, + onLoaded: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiSelectLoader.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + var hasNext = false; + + this.button_group = BI.createWidget({ + type: "bi.select_list", + element: this, + logic: opts.logic, + el: BI.extend({ + onLoaded: opts.onLoaded, + el: { + type: "bi.loader", + isDefaultInit: false, + logic: { + dynamic: true, + scrolly: true + }, + el: { + chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + behaviors: { + redmark: function () { + return true; + } + }, + layouts: [{ + type: "bi.vertical" + }] + } + } + }, opts.el), + itemsCreator: function (op, callback) { + var startValue = self._startValue; + self.storeValue && (op = BI.extend(op || {}, { + selectedValues: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi + ? self.storeValue.value.concat(startValue) : self.storeValue.value + })); + opts.itemsCreator(op, function (ob) { + hasNext = ob.hasNext; + var firstItems = []; + if (op.times === 1 && self.storeValue) { + var json = BI.map(self.storeValue.value, function (i, v) { + var txt = opts.valueFormatter(v) || v; + return { + text: txt, + value: v, + title: txt, + selected: self.storeValue.type === BI.Selection.Multi + } + }); + if (BI.isKey(self._startValue) && !self.storeValue.value.contains(self._startValue)) { + var txt = opts.valueFormatter(startValue) || startValue; + json.unshift({ + text: txt, + value: startValue, + title: txt, + selected: true + }) + } + firstItems = self._createItems(json); + } + callback(firstItems.concat(self._createItems(ob.items)), ob.keyword || ""); + if (op.times === 1 && self.storeValue) { + BI.isKey(startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](startValue); + self.setValue(self.storeValue); + } + (op.times === 1) && self._scrollToTop(); + }); + }, + hasNext: function () { + return hasNext; + } + }); + this.button_group.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectLoader.EVENT_CHANGE, arguments); + }); + }, + + _createItems: function (items) { + return BI.createItems(items, { + type: "bi.multi_select_item", + logic: this.options.logic, + height: 25, + selected: this.isAllSelected() + }) + }, + + _scrollToTop: function () { + var self = this; + BI.delay(function () { + self.button_group.element.scrollTop(0); + }, 30); + }, + + isAllSelected: function () { + return this.button_group.isAllSelected(); + }, + + _assertValue: function (val) { + val || (val = {}); + val.type || (val.type = BI.Selection.Multi); + val.value || (val.value = []); + }, + + setStartValue: function (v) { + this._startValue = v; + }, + + setValue: function (v) { + this.storeValue = v || {}; + this._assertValue(this.storeValue); + this.button_group.setValue(this.storeValue); + }, + + getValue: function () { + return this.button_group.getValue(); + }, + + getAllButtons: function () { + return this.button_group.getAllButtons(); + }, + + empty: function () { + this.button_group.empty(); + }, + + populate: function (items) { + this.button_group.populate.apply(this.button_group, arguments); + }, + + resetHeight: function (h) { + this.button_group.resetHeight(h); + }, + + resetWidth: function (w) { + this.button_group.resetWidth(w); + } +}); + +BI.MultiSelectLoader.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.multi_select_loader', BI.MultiSelectLoader);/** + * 带加载的多选下拉面板 + * @class BI.MultiSelectPopupView + * @extends Widget + */ +BI.MultiSelectPopupView = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectPopupView.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-popup-view', + maxWidth: 'auto', + minWidth: 135, + maxHeight: 400, + valueFormatter: BI.emptyFn, + itemsCreator: BI.emptyFn, + onLoaded: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiSelectPopupView.superclass._init.apply(this, arguments); + var self = this, opts = this.options; + + this.loader = BI.createWidget({ + type: "bi.multi_select_loader", + itemsCreator: opts.itemsCreator, + valueFormatter: opts.valueFormatter, + onLoaded: opts.onLoaded + }); + + this.popupView = BI.createWidget({ + type: "bi.multi_popup_view", + stopPropagation: false, + maxWidth: opts.maxWidth, + minWidth: opts.minWidth, + maxHeight: opts.maxHeight, + element: this, + buttons: [BI.i18nText('BI-Basic_Clears'), BI.i18nText('BI-Basic_Sure')], + el: this.loader + }); + + this.popupView.on(BI.MultiPopupView.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectPopupView.EVENT_CHANGE); + }); + this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function (index) { + switch (index) { + case 0: + self.fireEvent(BI.MultiSelectPopupView.EVENT_CLICK_CLEAR); + break; + case 1: + self.fireEvent(BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM); + break; + } + }); + }, + + isAllSelected: function () { + return this.loader.isAllSelected(); + }, + + setStartValue: function (v) { + this.loader.setStartValue(v); + }, + + setValue: function (v) { + this.popupView.setValue(v); + }, + + getValue: function () { + return this.popupView.getValue(); + }, + + populate: function (items) { + this.popupView.populate.apply(this.popupView, arguments); + }, + + resetHeight: function (h) { + this.popupView.resetHeight(h); + }, + + resetWidth: function (w) { + this.popupView.resetWidth(w); + } +}); + +BI.MultiSelectPopupView.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiSelectPopupView.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; +BI.MultiSelectPopupView.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; + + +BI.shortcut('bi.multi_select_popup_view', BI.MultiSelectPopupView);/** + * + * 复选下拉框 + * @class BI.MultiSelectTrigger + * @extends BI.Trigger + */ + +BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { + + constants: { + height: 14, + rgap: 4, + lgap: 4 + }, + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectTrigger.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-select-trigger bi-border", + itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn, + searcher: {}, + switcher: {}, + + adapter: null, + masker: {} + }); + }, + + _init: function () { + BI.MultiSelectTrigger.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + if (o.height) { + this.setHeight(o.height - 2); + } + + this.searcher = BI.createWidget(o.searcher, { + type: "bi.multi_select_searcher", + height: o.height, + itemsCreator: o.itemsCreator, + valueFormatter: o.valueFormatter, + popup: {}, + adapter: o.adapter, + masker: o.masker + }); + this.searcher.on(BI.MultiSelectSearcher.EVENT_START, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_START); + }); + this.searcher.on(BI.MultiSelectSearcher.EVENT_PAUSE, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_PAUSE); + }); + this.searcher.on(BI.MultiSelectSearcher.EVENT_SEARCHING, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_SEARCHING, arguments); + }); + this.searcher.on(BI.MultiSelectSearcher.EVENT_STOP, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_STOP); + }); + this.searcher.on(BI.MultiSelectSearcher.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_CHANGE, arguments); + }); + this.numberCounter = BI.createWidget(o.switcher, { + type: 'bi.multi_select_check_selected_switcher', + valueFormatter: o.valueFormatter, + itemsCreator: o.itemsCreator, + adapter: o.adapter, + masker: o.masker + }); + this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK); + }); + this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW); + }); + + var wrapNumberCounter = BI.createWidget({ + type: 'bi.right_vertical_adapt', + hgap: 4, + items: [{ + el: this.numberCounter + }] + }); + + var wrapper = BI.createWidget({ + type: 'bi.htape', + element: this, + items: [ + { + el: this.searcher, + width: 'fill' + }, { + el: wrapNumberCounter, + width: 0 + }, { + el: BI.createWidget(), + width: 30 + }] + }); + + this.numberCounter.on(BI.Events.VIEW, function (b) { + BI.nextTick(function () {//自动调整宽度 + wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0); + wrapper.resize(); + }); + }); + + this.element.click(function (e) { + if (self.element.__isMouseInBounds__(e) && !self.numberCounter.element.__isMouseInBounds__(e)) { + self.numberCounter.hideView(); + } + }); + }, + + getCounter: function () { + return this.numberCounter; + }, + + getSearcher: function () { + return this.searcher; + }, + + stopEditing: function () { + this.searcher.stopSearch(); + this.numberCounter.hideView(); + }, + + setAdapter: function (adapter) { + this.searcher.setAdapter(adapter); + this.numberCounter.setAdapter(adapter); + }, + + setValue: function (ob) { + this.searcher.setValue(ob); + this.numberCounter.setValue(ob); + }, + + getKey: function () { + return this.searcher.getKey(); + }, + + getValue: function () { + return this.searcher.getValue(); + } +}); + +BI.MultiSelectTrigger.EVENT_TRIGGER_CLICK = "EVENT_TRIGGER_CLICK"; +BI.MultiSelectTrigger.EVENT_COUNTER_CLICK = "EVENT_COUNTER_CLICK"; +BI.MultiSelectTrigger.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiSelectTrigger.EVENT_START = "EVENT_START"; +BI.MultiSelectTrigger.EVENT_STOP = "EVENT_STOP"; +BI.MultiSelectTrigger.EVENT_PAUSE = "EVENT_PAUSE"; +BI.MultiSelectTrigger.EVENT_SEARCHING = "EVENT_SEARCHING"; +BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW = "EVENT_BEFORE_COUNTER_POPUPVIEW"; + +BI.shortcut('bi.multi_select_trigger', BI.MultiSelectTrigger);/** + * 多选加载数据搜索loader面板 + * Created by guy on 15/11/4. + * @class BI.MultiSelectSearchLoader + * @extends Widget + */ +BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectSearchLoader.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-search-loader', + itemsCreator: BI.emptyFn, + keywordGetter: BI.emptyFn, + valueFormatter: BI.emptyFn, + }); + }, + + _init: function () { + BI.MultiSelectSearchLoader.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + var hasNext = false; + + this.button_group = BI.createWidget({ + type: "bi.select_list", + element: this, + logic: { + dynamic: false + }, + el: { + tipText: BI.i18nText("BI-No_Select"), + el: { + type: "bi.loader", + isDefaultInit: false, + logic: { + dynamic: true, + scrolly: true + }, + el: { + chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + behaviors: { + redmark: function () { + return true; + } + }, + layouts: [{ + type: "bi.vertical" + }] + } + } + }, + itemsCreator: function (op, callback) { + self.storeValue && (op = BI.extend(op || {}, { + selectedValues: self.storeValue.value + })); + opts.itemsCreator(op, function (ob) { + var keyword = ob.keyword = opts.keywordGetter(); + hasNext = ob.hasNext; + var firstItems = []; + if (op.times === 1 && self.storeValue) { + var json = self._filterValues(self.storeValue); + firstItems = self._createItems(json); + } + callback(firstItems.concat(self._createItems(ob.items)), keyword); + if (op.times === 1 && self.storeValue) { + self.setValue(self.storeValue); + } + }); + }, + hasNext: function () { + return hasNext; + } + }); + this.button_group.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectSearchLoader.EVENT_CHANGE, arguments); + }); + }, + + _createItems: function (items) { + return BI.createItems(items, { + type: "bi.multi_select_item", + logic: { + dynamic: false + }, + height: 25, + selected: this.isAllSelected() + }) + }, + + isAllSelected: function () { + return this.button_group.isAllSelected(); + }, + + _filterValues: function (src) { + var o = this.options; + var keyword = o.keywordGetter(); + var values = BI.deepClone(src.value) || []; + var newValues = BI.map(values, function (i, v) { + return { + text: o.valueFormatter(v) || v, + value: v + }; + }); + if (BI.isKey(keyword)) { + var search = BI.Func.getSearchResult(newValues, keyword); + values = search.matched.concat(search.finded); + } + return BI.map(values, function (i, v) { + return { + text: v.text, + title: v.text, + value: v.value, + selected: src.type === BI.Selection.All + } + }) + }, + + setValue: function (v) { + //暂存的值一定是新的值,不然v改掉后,storeValue也跟着改了 + this.storeValue = BI.deepClone(v); + this.button_group.setValue(v); + }, + + getValue: function () { + return this.button_group.getValue(); + }, + + getAllButtons: function () { + return this.button_group.getAllButtons(); + }, + + empty: function () { + this.button_group.empty(); + }, + + populate: function (items) { + this.button_group.populate.apply(this.button_group, arguments); + }, + + resetHeight: function (h) { + this.button_group.resetHeight(h); + }, + + resetWidth: function (w) { + this.button_group.resetWidth(w); + } +}); + +BI.MultiSelectSearchLoader.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.multi_select_search_loader', BI.MultiSelectSearchLoader);/** + * + * 在搜索框中输入文本弹出的面板 + * @class BI.MultiSelectSearchPane + * @extends Widget + */ + +BI.MultiSelectSearchPane = BI.inherit(BI.Widget, { + + constants: { + height: 25, + lgap: 10, + tgap: 5 + }, + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectSearchPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-select-search-pane bi-card", + itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn, + keywordGetter: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiSelectSearchPane.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.tooltipClick = BI.createWidget({ + type: "bi.label", + invisible: true, + text: BI.i18nText('BI-Click_Blank_To_Select'), + cls: 'multi-select-toolbar', + height: this.constants.height + }); + + this.loader = BI.createWidget({ + type: "bi.multi_select_search_loader", + keywordGetter: o.keywordGetter, + valueFormatter: o.valueFormatter, + itemsCreator: function (op, callback) { + o.itemsCreator.apply(self, [op, function (res) { + callback(res); + self.setKeyword(o.keywordGetter()); + }]); + } + }); + this.loader.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.resizer = BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: this.tooltipClick, + height: 0 + }, { + el: this.loader + }] + }); + this.tooltipClick.setVisible(false); + }, + + setKeyword: function (keyword) { + var btn; + var isVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && (keyword === btn.getValue()); + if (isVisible !== this.tooltipClick.isVisible()) { + this.tooltipClick.setVisible(isVisible); + this.resizer.attr("items")[0].height = (isVisible ? this.constants.height : 0); + this.resizer.resize(); + } + }, + + isAllSelected: function () { + return this.loader.isAllSelected(); + }, + + hasMatched: function () { + return this.tooltipClick.isVisible(); + }, + + setValue: function (v) { + this.loader.setValue(v); + }, + + getValue: function () { + return this.loader.getValue(); + }, + + empty: function () { + this.loader.empty(); + }, + + populate: function (items) { + this.loader.populate.apply(this.loader, arguments); + } +}); + +BI.MultiSelectSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.shortcut("bi.multi_select_search_pane", BI.MultiSelectSearchPane);/** + * 查看已选按钮 + * Created by guy on 15/11/3. + * @class BI.MultiSelectCheckSelectedButton + * @extends BI.Single + */ +BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { + + _const: { + checkSelected: BI.i18nText('BI-Check_Selected') + }, + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectCheckSelectedButton.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-check-selected-button bi-high-light', + itemsCreator: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiSelectCheckSelectedButton.superclass._init.apply(this, arguments); + var self = this; + this.numberCounter = BI.createWidget({ + type: 'bi.text_button', + element: this, + hgap: 4, + text: "0", + textAlign: 'center', + textHeight: 15 + }); + this.numberCounter.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.numberCounter.on(BI.TextButton.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectCheckSelectedButton.EVENT_CHANGE, arguments); + }); + + this.numberCounter.element.hover(function () { + self.numberCounter.setTag(self.numberCounter.getText()); + self.numberCounter.setText(self._const.checkSelected); + }, function () { + self.numberCounter.setText(self.numberCounter.getTag()); + }); + this.setVisible(false); + }, + + setValue: function (ob) { + var self = this, o = this.options; + ob || (ob = {}); + ob.type || (ob.type = BI.Selection.Multi); + ob.value || (ob.value = []); + if (ob.type === BI.Selection.All) { + o.itemsCreator({ + type: BI.MultiSelectCombo.REQ_GET_DATA_LENGTH + }, function (res) { + var length = res.count - ob.value.length; + BI.nextTick(function(){ + self.numberCounter.setText(length); + self.setVisible(length > 0); + }); + }); + return; + } + BI.nextTick(function(){ + self.numberCounter.setText(ob.value.length); + self.setVisible(ob.value.length > 0); + }) + }, + + getValue: function () { + + } +}); + +BI.MultiSelectCheckSelectedButton.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.multi_select_check_selected_button', BI.MultiSelectCheckSelectedButton);/** + * 多选输入框 + * Created by guy on 15/11/3. + * @class BI.MultiSelectEditor + * @extends Widget + */ +BI.MultiSelectEditor = BI.inherit(BI.Widget, { + + _const: { + checkSelected: BI.i18nText('BI-Check_Selected') + }, + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectEditor.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-editor', + el: {} + }); + }, + + _init: function () { + BI.MultiSelectEditor.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget(o.el, { + type: 'bi.state_editor', + element: this, + height: o.height, + watermark: BI.i18nText('BI-Basic_Search'), + allowBlank: true + }); + + this.editor.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.editor.on(BI.StateEditor.EVENT_PAUSE, function () { + self.fireEvent(BI.MultiSelectEditor.EVENT_PAUSE); + }); + this.editor.on(BI.StateEditor.EVENT_CLICK_LABEL, function () { + + }); + }, + + focus: function () { + this.editor.focus(); + }, + + blur: function () { + this.editor.blur(); + }, + + setState: function (state) { + this.editor.setState(state); + }, + + setValue: function (v) { + this.editor.setValue(v); + }, + + getValue: function () { + var v = this.editor.getState(); + if (BI.isArray(v) && v.length > 0) { + return v[v.length - 1]; + } else { + return ""; + } + }, + + getKeywords: function () { + var val = this.editor.getLastValidValue(); + var keywords = val.match(/[\S]+/g); + if (BI.isEndWithBlank(val)) { + return keywords.concat([' ']); + } + return keywords; + }, + + populate: function (items) { + + } +}); +BI.MultiSelectEditor.EVENT_PAUSE = "MultiSelectEditor.EVENT_PAUSE"; +BI.shortcut('bi.multi_select_editor', BI.MultiSelectEditor);/** + * searcher + * Created by guy on 15/11/3. + * @class BI.MultiSelectSearcher + * @extends Widget + */ +BI.MultiSelectSearcher = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectSearcher.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-searcher', + itemsCreator: BI.emptyFn, + el: {}, + popup: {}, + valueFormatter: BI.emptyFn, + adapter: null, + masker: {} + }); + }, + + _init: function () { + BI.MultiSelectSearcher.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget(o.el, { + type: 'bi.multi_select_editor', + height: o.height + }); + + this.searcher = BI.createWidget({ + type: "bi.searcher", + element: this, + height: o.height, + isAutoSearch: false, + isAutoSync: false, + onSearch: function (op, callback) { + callback(); + }, + el: this.editor, + + popup: BI.extend({ + type: "bi.multi_select_search_pane", + valueFormatter: o.valueFormatter, + keywordGetter: function () { + return self.editor.getValue(); + }, + itemsCreator: function (op, callback) { + op.keyword = self.editor.getValue(); + this.setKeyword(op.keyword); + o.itemsCreator(op, callback); + } + }, o.popup), + + adapter: o.adapter, + masker: o.masker + }); + this.searcher.on(BI.Searcher.EVENT_START, function () { + self.fireEvent(BI.MultiSelectSearcher.EVENT_START); + }); + this.searcher.on(BI.Searcher.EVENT_PAUSE, function () { + if (this.hasMatched()) { + + } + self.fireEvent(BI.MultiSelectSearcher.EVENT_PAUSE); + }); + this.searcher.on(BI.Searcher.EVENT_STOP, function () { + self.fireEvent(BI.MultiSelectSearcher.EVENT_STOP); + }); + this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectSearcher.EVENT_CHANGE, arguments); + }); + this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () { + var keywords = this.getKeywords(); + self.fireEvent(BI.MultiSelectSearcher.EVENT_SEARCHING, keywords); + }); + }, + + adjustView: function () { + this.searcher.adjustView(); + }, + + isSearching: function () { + return this.searcher.isSearching(); + }, + + stopSearch: function () { + this.searcher.stopSearch(); + }, + + getKeyword: function () { + return this.editor.getValue(); + }, + + hasMatched: function () { + return this.searcher.hasMatched(); + }, + + hasChecked: function () { + return this.searcher.getView() && this.searcher.getView().hasChecked(); + }, + + setAdapter: function (adapter) { + this.searcher.setAdapter(adapter); + }, + + setState: function (ob) { + var o = this.options; + ob || (ob = {}); + ob.value || (ob.value = []); + if (ob.type === BI.Selection.All) { + if (BI.size(ob.assist) === 1) { + this.editor.setState(o.valueFormatter(ob.assist[0] + "") || (ob.assist[0] + "")); + } else { + this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); + } + } else { + if (BI.size(ob.value) === 1) { + this.editor.setState(o.valueFormatter(ob.value[0] + "") || (ob.value[0] + "")); + } else { + this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); + } + } + }, + + setValue: function (ob) { + this.setState(ob); + this.searcher.setValue(ob); + }, + + getKey: function () { + return this.editor.getValue(); + }, + + getValue: function () { + return this.searcher.getValue(); + }, + + populate: function (items) { + this.searcher.populate.apply(this.searcher, arguments); + } +}); + +BI.MultiSelectSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.MultiSelectSearcher.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiSelectSearcher.EVENT_START = "EVENT_START"; +BI.MultiSelectSearcher.EVENT_STOP = "EVENT_STOP"; +BI.MultiSelectSearcher.EVENT_PAUSE = "EVENT_PAUSE"; +BI.MultiSelectSearcher.EVENT_SEARCHING = "EVENT_SEARCHING"; +BI.shortcut('bi.multi_select_searcher', BI.MultiSelectSearcher);/** + * 查看已选switcher + * Created by guy on 15/11/3. + * @class BI.MultiSelectCheckSelectedSwitcher + * @extends Widget + */ +BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiSelectCheckSelectedSwitcher.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-check-selected-switcher', + itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn, + el: {}, + popup: {}, + adapter: null, + masker: {} + }); + }, + + _init: function () { + BI.MultiSelectCheckSelectedSwitcher.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.button = BI.createWidget(o.el, { + type: "bi.multi_select_check_selected_button", + itemsCreator: o.itemsCreator + }); + this.button.on(BI.Events.VIEW, function () { + self.fireEvent(BI.Events.VIEW, arguments); + }); + this.switcher = BI.createWidget({ + type: "bi.switcher", + toggle: false, + element: this, + el: this.button, + popup: BI.extend({ + type: "bi.multi_select_check_pane", + valueFormatter: o.valueFormatter, + itemsCreator: o.itemsCreator, + onClickContinueSelect: function () { + self.switcher.hideView(); + } + }, o.popup), + adapter: o.adapter, + masker: o.masker + }); + this.switcher.on(BI.Switcher.EVENT_TRIGGER_CHANGE, function () { + self.fireEvent(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE); + }); + this.switcher.on(BI.Switcher.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW); + }); + this.switcher.on(BI.Switcher.EVENT_AFTER_POPUPVIEW, function () { + var me = this; + BI.nextTick(function () { + me.populate(); + }); + }); + + this.switcher.element.click(function (e) { + e.stopPropagation(); + }); + }, + + adjustView: function () { + this.switcher.adjustView(); + }, + + hideView: function () { + this.switcher.empty(); + this.switcher.hideView(); + }, + + setAdapter: function (adapter) { + this.switcher.setAdapter(adapter); + }, + + setValue: function (v) { + this.switcher.setValue(v); + }, + + setButtonChecked: function (v) { + this.button.setValue(v) + }, + + getValue: function () { + + }, + + populate: function (items) { + this.switcher.populate.apply(this.switcher, arguments); + } +}); + +BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE = "MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE"; +BI.MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW = "MultiSelectCheckSelectedSwitcher.EVENT_BEFORE_POPUPVIEW"; +BI.shortcut('bi.multi_select_check_selected_switcher', BI.MultiSelectCheckSelectedSwitcher);/** + * Created by zcf_1 on 2017/5/2. + */ +BI.MultiSelectList = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.MultiSelectList.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-list', + itemsCreator: BI.emptyFn, + valueFormatter: BI.emptyFn + }) + }, + _init: function () { + BI.MultiSelectList.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + this.storeValue = {}; + + var assertShowValue = function () { + BI.isKey(self._startValue) && self.storeValue.value[self.storeValue.type === BI.Selection.All ? "remove" : "pushDistinct"](self._startValue); + // self.trigger.setValue(self.storeValue); + }; + + this.adapter = BI.createWidget({ + type: "bi.multi_select_loader", + cls: "popup-multi-select-list bi-border-left bi-border-right bi-border-bottom", + itemsCreator: o.itemsCreator, + valueFormatter: o.valueFormatter, + // onLoaded: o.onLoaded, + el: { + height: "" + } + }); + this.adapter.on(BI.MultiSelectLoader.EVENT_CHANGE, function () { + self.storeValue = this.getValue(); + self._adjust(function () { + assertShowValue(); + self.fireEvent(BI.MultiSelectList.EVENT_CHANGE); + }); + }); + + this.searcherPane = BI.createWidget({ + type: "bi.multi_select_search_pane", + cls: "bi-border-left bi-border-right bi-border-bottom", + valueFormatter: o.valueFormatter, + keywordGetter: function () { + return self.trigger.getKeyword(); + }, + itemsCreator: function (op, callback) { + op.keyword = self.trigger.getKeyword(); + this.setKeyword(op.keyword); + o.itemsCreator(op, callback); + } + }); + this.searcherPane.setVisible(false); + + this.trigger = BI.createWidget({ + type: "bi.searcher", + isAutoSearch: false, + isAutoSync: false, + onSearch: function (op, callback) { + callback(); + }, + adapter: this.adapter, + popup: this.searcherPane, + height: 200, + masker: false, + listeners: [{ + eventName: BI.Searcher.EVENT_START, + action: function () { + self._showSearcherPane(); + self._setStartValue(""); + this.setValue(BI.deepClone(self.storeValue)); + } + }, { + eventName: BI.Searcher.EVENT_STOP, + action: function () { + self._showAdapter(); + self._setStartValue(""); + self.adapter.setValue(self.storeValue); + //需要刷新回到初始界面,否则搜索的结果不能放在最前面 + self.adapter.populate(); + } + }, { + eventName: BI.Searcher.EVENT_PAUSE, + action: function () { + if (this.hasMatched()) { + var keyword = this.getKeyword(); + self._join({ + type: BI.Selection.Multi, + value: [keyword] + }, function () { + self._showAdapter(); + self.adapter.setValue(self.storeValue); + self._setStartValue(keyword); + assertShowValue(); + self._setStartValue(""); + self.fireEvent(BI.MultiSelectList.EVENT_CHANGE); + }) + } else { + self._showAdapter(); + } + } + }, { + eventName: BI.Searcher.EVENT_SEARCHING, + action: function () { + var keywords = this.getKeyword(); + var last = BI.last(keywords); + keywords = BI.initial(keywords || []); + if (keywords.length > 0) { + self._joinKeywords(keywords, function () { + if (BI.isEndWithBlank(last)) { + self.adapter.setValue(self.storeValue); + assertShowValue(); + self.adapter.populate(); + self._setStartValue(""); + } else { + self.adapter.setValue(self.storeValue); + assertShowValue(); + } + }); + } + } + }, { + eventName: BI.Searcher.EVENT_CHANGE, + action: function (value, obj) { + if (obj instanceof BI.MultiSelectBar) { + self._joinAll(this.getValue(), function () { + assertShowValue(); + }); + } else { + self._join(this.getValue(), function () {//安徽省 北京 + assertShowValue(); + }); + } + } + }] + }); + + BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: this.trigger, + height: 30 + }, { + el: this.adapter, + height: "fill" + }] + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.searcherPane, + top: 30, + bottom: 0, + left: 0, + right: 0 + }] + }) + }, + + _showAdapter: function () { + this.adapter.setVisible(true); + this.searcherPane.setVisible(false); + }, + + _showSearcherPane: function () { + this.searcherPane.setVisible(true); + this.adapter.setVisible(false); + }, + + _defaultState: function () { + this.trigger.stopEditing(); + }, + + _assertValue: function (val) { + val || (val = {}); + val.type || (val.type = BI.Selection.Multi); + val.value || (val.value = []); + }, + + _makeMap: function (values) { + return BI.makeObject(values || []); + }, + + _joinKeywords: function (keywords, callback) { + var self = this, o = this.options; + this._assertValue(this.storeValue); + if (!this._allData) { + o.itemsCreator({ + type: BI.MultiSelectList.REQ_GET_ALL_DATA + }, function (ob) { + self._allData = BI.pluck(ob.items, "value"); + digest(self._allData); + }) + } else { + digest(this._allData) + } + + function digest(items) { + var selectedMap = self._makeMap(items); + BI.each(keywords, function (i, val) { + if (BI.isNotNull(selectedMap[val])) { + self.storeValue.value[self.storeValue.type === BI.Selection.Multi ? "pushDistinct" : "remove"](val); + } + }); + self._adjust(callback); + } + }, + + _joinAll: function (res, callback) { + var self = this, o = this.options; + this._assertValue(res); + o.itemsCreator({ + type: BI.MultiSelectList.REQ_GET_ALL_DATA, + keyword: self.trigger.getKeyword() + }, function (ob) { + var items = BI.pluck(ob.items, "value"); + if (self.storeValue.type === res.type) { + var change = false; + var map = self._makeMap(self.storeValue.value); + BI.each(items, function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (self.storeValue.value = BI.values(map)); + self._adjust(callback); + return; + } + var selectedMap = self._makeMap(self.storeValue.value); + var notSelectedMap = self._makeMap(res.value); + var newItems = []; + BI.each(items, function (i, item) { + if (BI.isNotNull(selectedMap[items[i]])) { + delete selectedMap[items[i]]; + } + if (BI.isNull(notSelectedMap[items[i]])) { + newItems.push(item); + } + }); + self.storeValue.value = newItems.concat(BI.values(selectedMap)); + self._adjust(callback); + }) + }, + + _adjust: function (callback) { + var self = this, o = this.options; + if (!this._count) { + o.itemsCreator({ + type: BI.MultiSelectList.REQ_GET_DATA_LENGTH + }, function (res) { + self._count = res.count; + adjust(); + callback(); + }); + } else { + adjust(); + callback(); + } + function adjust() { + if (self.storeValue.type === BI.Selection.All && self.storeValue.value.length >= self._count) { + self.storeValue = { + type: BI.Selection.Multi, + value: [] + } + } else if (self.storeValue.type === BI.Selection.Multi && self.storeValue.value.length >= self._count) { + self.storeValue = { + type: BI.Selection.All, + value: [] + } + } + } + }, + + _join: function (res, callback) { + var self = this, o = this.options; + this._assertValue(res); + this._assertValue(this.storeValue); + if (this.storeValue.type === res.type) { + var map = this._makeMap(this.storeValue.value); + BI.each(res.value, function (i, v) { + if (!map[v]) { + self.storeValue.value.push(v); + map[v] = v; + } + }); + var change = false; + BI.each(res.assist, function (i, v) { + if (BI.isNotNull(map[v])) { + change = true; + delete map[v]; + } + }); + change && (this.storeValue.value = BI.values(map)); + self._adjust(callback); + return; + } + this._joinAll(res, callback); + }, + + _setStartValue: function (value) { + this._startValue = value; + this.adapter.setStartValue(value); + }, + + isAllSelected: function () { + return this.adapter.isAllSelected(); + }, + + resize: function () { + // this.trigger.getCounter().adjustView(); + // this.trigger.adjustView(); + }, + setValue: function (v) { + this.storeValue = v || {}; + this._assertValue(this.storeValue); + this.adapter.setValue(this.storeValue); + this.trigger.setValue(this.storeValue); + }, + + getValue: function () { + return this.storeValue; + }, + + populate: function () { + this._count = null; + this._allData = null; + this.adapter.populate.apply(this.adapter, arguments); + this.trigger.populate.apply(this.trigger, arguments); + } +}); + +BI.extend(BI.MultiSelectList, { + REQ_GET_DATA_LENGTH: 0, + REQ_GET_ALL_DATA: -1 +}); + +BI.MultiSelectList.EVENT_CHANGE = "BI.MultiSelectList.EVENT_CHANGE"; +BI.shortcut("bi.multi_select_list", BI.MultiSelectList);/** + * Created by zcf_1 on 2017/5/11. + */ +BI.MultiSelectTree = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.MultiSelectTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-select-tree', + itemsCreator: BI.emptyFn + }) + }, + + _init: function () { + BI.MultiSelectTree.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.storeValue = {value: {}}; + + this.adapter = BI.createWidget({ + type: "bi.multi_select_tree_popup", + itemsCreator: o.itemsCreator + }); + this.adapter.on(BI.MultiSelectTreePopup.EVENT_CHANGE, function () { + if (self.searcher.isSearching()) { + self.storeValue = {value: self.searcherPane.getValue()}; + } else { + self.storeValue = {value: self.adapter.getValue()}; + } + self.setSelectedValue(self.storeValue.value); + self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); + }); + + //搜索中的时候用的是parttree,同adapter中的synctree不一样 + this.searcherPane = BI.createWidget({ + type: "bi.multi_tree_search_pane", + cls: "bi-border-left bi-border-right bi-border-bottom", + keywordGetter: function () { + return self.searcher.getKeyword(); + }, + itemsCreator: function (op, callback) { + op.keyword = self.searcher.getKeyword(); + o.itemsCreator(op, callback); + } + }); + this.searcherPane.setVisible(false); + + this.searcher = BI.createWidget({ + type: "bi.searcher", + isAutoSearch: false, + isAutoSync: false, + onSearch: function (op, callback) { + callback({ + keyword: self.searcher.getKeyword() + }); + }, + adapter: this.adapter, + popup: this.searcherPane, + masker: false, + listeners: [{ + eventName: BI.Searcher.EVENT_START, + action: function () { + self._showSearcherPane(); + // self.storeValue = {value: self.adapter.getValue()}; + // self.searcherPane.setSelectedValue(self.storeValue.value); + } + }, { + eventName: BI.Searcher.EVENT_STOP, + action: function () { + self._showAdapter(); + // self.storeValue = {value: self.searcherPane.getValue()}; + // self.adapter.setSelectedValue(self.storeValue.value); + BI.nextTick(function () { + self.adapter.populate(); + }); + } + }, { + eventName: BI.Searcher.EVENT_CHANGE, + action: function () { + if (self.searcher.isSearching()) { + self.storeValue = {value: self.searcherPane.getValue()}; + } else { + self.storeValue = {value: self.adapter.getValue()}; + } + self.setSelectedValue(self.storeValue.value); + self.fireEvent(BI.MultiSelectTree.EVENT_CHANGE); + } + }, { + eventName: BI.Searcher.EVENT_PAUSE, + action: function () { + self._showAdapter(); + } + }] + }); + + BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: this.searcher, + height: 30 + }, { + el: this.adapter, + height: "fill" + }] + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.searcherPane, + top: 30, + bottom: 0, + left: 0, + right: 0 + }] + }) + + }, + + _showAdapter: function () { + this.adapter.setVisible(true); + this.searcherPane.setVisible(false); + }, + + _showSearcherPane: function () { + this.searcherPane.setVisible(true); + this.adapter.setVisible(false); + }, + + resize: function () { + + }, + + setSelectedValue: function (v) { + this.storeValue.value = v || {}; + this.adapter.setSelectedValue(v); + this.searcherPane.setSelectedValue(v); + this.searcher.setValue({ + value: v || {} + }); + }, + + setValue: function (v) { + this.adapter.setValue(v); + }, + + stopSearch: function () { + this.searcher.stopSearch(); + }, + + updateValue: function (v) { + this.adapter.updateValue(v); + }, + + getValue: function () { + return this.storeValue.value; + }, + + populate: function () { + this.searcher.populate.apply(this.searcher, arguments); + this.adapter.populate.apply(this.adapter, arguments); + } +}); +BI.MultiSelectTree.EVENT_CHANGE = "BI.MultiSelectTree.EVENT_CHANGE"; +BI.shortcut("bi.multi_select_tree", BI.MultiSelectTree);/** + * Created by zcf on 2016/12/21. + */ +BI.MultiSelectTreePopup = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.MultiSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-select-tree-popup bi-border-left bi-border-right bi-border-bottom", + itemsCreator: BI.emptyFn + }); + }, + _init: function () { + BI.MultiSelectTreePopup.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.popup = BI.createWidget({ + type: "bi.async_tree", + element: this, + itemsCreator: o.itemsCreator + }); + this.popup.on(BI.TreeView.EVENT_AFTERINIT, function () { + self.fireEvent(BI.MultiSelectTreePopup.EVENT_AFTER_INIT) + }); + this.popup.on(BI.TreeView.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectTreePopup.EVENT_CHANGE) + }); + }, + + hasChecked: function () { + return this.popup.hasChecked(); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + setValue: function (v) { + v || (v = {}); + this.popup.setValue(v); + }, + + setSelectedValue: function (v) { + v || (v = {}); + this.popup.setSelectedValue(v); + }, + + updateValue: function (v) { + this.popup.updateValue(v); + this.popup.refresh(); + }, + + populate: function (config) { + this.popup.stroke(config); + } + +}); +BI.MultiSelectTreePopup.EVENT_AFTER_INIT = "BI.MultiSelectTreePopup.EVENT_AFTER_INIT"; +BI.MultiSelectTreePopup.EVENT_CHANGE = "BI.MultiSelectTreePopup.EVENT_CHANGE"; +BI.shortcut("bi.multi_select_tree_popup", BI.MultiSelectTreePopup);/** + * + * @class BI.MultiTreeCheckPane + * @extends BI.Pane + */ +BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { + + constants: { + height: 25, + lgap: 10, + tgap: 5 + }, + + _defaultConfig: function () { + return BI.extend(BI.MultiTreeCheckPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-tree-check-pane bi-background", + onClickContinueSelect: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiTreeCheckPane.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + + this.selectedValues = {}; + + var continueSelect = BI.createWidget({ + type: 'bi.text_button', + text: BI.i18nText('BI-Continue_Select'), + cls: 'multi-tree-check-selected' + }); + continueSelect.on(BI.TextButton.EVENT_CHANGE, function () { + opts.onClickContinueSelect(); + BI.nextTick(function () { + self.empty(); + }); + }); + + var backToPopup = BI.createWidget({ + type: 'bi.left', + cls: 'multi-tree-continue-select', + items: [ + { + el: { + type: "bi.label", + text: BI.i18nText('BI-Selected_Data') + }, + lgap: this.constants.lgap, + tgap: this.constants.tgap + }, + { + el: continueSelect, + lgap: this.constants.lgap, + tgap: this.constants.tgap + }] + }); + + this.display = BI.createWidget({ + type: "bi.display_tree", + cls: "bi-multi-tree-display", + itemsCreator: function (op, callback) { + op.type = BI.TreeView.REQ_TYPE_GET_SELECTED_DATA; + opts.itemsCreator(op, callback); + } + }); + + this.display.on(BI.Events.AFTERINIT, function () { + self.fireEvent(BI.Events.AFTERINIT); + }); + + this.display.on(BI.TreeView.EVENT_INIT, function () { + backToPopup.setVisible(false); + }); + + this.display.on(BI.TreeView.EVENT_AFTERINIT, function () { + backToPopup.setVisible(true); + }); + + BI.createWidget({ + type: 'bi.vtape', + element: this, + items: [{ + height: this.constants.height, + el: backToPopup + }, { + height: 'fill', + el: this.display + }] + }); + + }, + + empty: function () { + this.display.empty(); + }, + + populate: function (configs) { + this.display.stroke(configs); + }, + + setValue: function (v) { + v || (v = {}); + this.display.setSelectedValue(v.value); + }, + + getValue: function () { + + } +}); + +BI.MultiTreeCheckPane.EVENT_CONTINUE_CLICK = "EVENT_CONTINUE_CLICK"; + + +BI.shortcut("bi.multi_tree_check_pane", BI.MultiTreeCheckPane);/** + * + * @class BI.MultiTreeCombo + * @extends BI.Single + */ + +BI.MultiTreeCombo = BI.inherit(BI.Single, { + + constants: { + offset: { + top: 1, + left: 1, + right: 2, + bottom: 33 + } + }, + + _defaultConfig: function () { + return BI.extend(BI.MultiTreeCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-tree-combo', + itemsCreator: BI.emptyFn, + height: 25 + }); + }, + + _init: function () { + BI.MultiTreeCombo.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + + var isInit = false; + var want2showCounter = false; + + this.trigger = BI.createWidget({ + type: "bi.multi_select_trigger", + height: o.height, + // adapter: this.popup, + masker: { + offset: this.constants.offset + }, + searcher: { + type: "bi.multi_tree_searcher", + itemsCreator: o.itemsCreator + }, + switcher: { + el: { + type: "bi.multi_tree_check_selected_button" + }, + popup: { + type: "bi.multi_tree_check_pane", + itemsCreator: o.itemsCreator + } + } + + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + toggle: false, + el: this.trigger, + adjustLength: 1, + popup: { + type: 'bi.multi_tree_popup_view', + ref: function () { + self.popup = this; + self.trigger.setAdapter(this); + }, + listeners: [{ + eventName: BI.MultiTreePopup.EVENT_AFTERINIT, + action: function () { + self.trigger.getCounter().adjustView(); + isInit = true; + if (want2showCounter === true) { + showCounter(); + } + } + }, { + eventName: BI.MultiTreePopup.EVENT_CHANGE, + action: function () { + change = true; + var val = { + type: BI.Selection.Multi, + value: this.hasChecked() ? {1: 1} : {} + }; + self.trigger.getSearcher().setState(val); + self.trigger.getCounter().setButtonChecked(val); + } + }, { + eventName: BI.MultiTreePopup.EVENT_CLICK_CONFIRM, + action: function () { + self.combo.hideView(); + } + }, { + eventName: BI.MultiTreePopup.EVENT_CLICK_CLEAR, + action: function () { + clear = true; + self.setValue(); + self._defaultState(); + } + }], + itemsCreator: o.itemsCreator, + onLoaded: function () { + BI.nextTick(function () { + self.trigger.getCounter().adjustView(); + self.trigger.getSearcher().adjustView(); + }); + } + }, + hideChecker: function (e) { + return triggerBtn.element.find(e.target).length === 0; + } + }); + + this.storeValue = {value: {}}; + var change = false; + var clear = false; //标识当前是否点击了清空 + + var isSearching = function () { + return self.trigger.getSearcher().isSearching(); + }; + + var isPopupView = function () { + return self.combo.isViewVisible(); + }; + + this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { + self.storeValue = {value: self.combo.getValue()}; + this.setValue(self.storeValue); + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_STOP, function () { + self.storeValue = {value: this.getValue()}; + self.combo.setValue(self.storeValue); + BI.nextTick(function () { + if (isPopupView()) { + self.combo.populate(); + } + }); + }); + function showCounter() { + if (isSearching()) { + self.storeValue = {value: self.trigger.getValue()}; + } else if (isPopupView()) { + self.storeValue = {value: self.combo.getValue()}; + } + self.trigger.setValue(self.storeValue); + } + + this.trigger.on(BI.MultiSelectTrigger.EVENT_BEFORE_COUNTER_POPUPVIEW, function () { + if (want2showCounter === false) { + want2showCounter = true; + } + if (isInit === true) { + want2showCounter = null; + showCounter(); + } + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_TRIGGER_CLICK, function () { + self.combo.toggle(); + }); + this.trigger.on(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK, function () { + if (!self.combo.isViewVisible()) { + self.combo.showView(); + } + }); + + this.trigger.on(BI.MultiSelectTrigger.EVENT_CHANGE, function () { + var val = { + type: BI.Selection.Multi, + value: this.getSearcher().hasChecked() ? {1: 1} : {} + }; + this.getSearcher().setState(val); + this.getCounter().setButtonChecked(val); + }); + + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + if (isSearching()) { + return; + } + if (change === true) { + self.storeValue = {value: self.combo.getValue()}; + change = false; + } + self.combo.setValue(self.storeValue); + self.populate(); + + }); + this.combo.on(BI.Combo.EVENT_BEFORE_HIDEVIEW, function () { + if (isSearching()) { + self.trigger.stopEditing(); + self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); + }else{ + if (isPopupView()) { + self.trigger.stopEditing(); + self.storeValue = {value: self.combo.getValue()}; + if (clear === true) { + self.storeValue = {value: {}}; + } + self.fireEvent(BI.MultiTreeCombo.EVENT_CONFIRM); + } + } + clear = false; + change = false; + }); + + var triggerBtn = BI.createWidget({ + type: "bi.trigger_icon_button", + width: o.height, + height: o.height, + cls: "multi-select-trigger-icon-button bi-border-left" + }); + triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () { + self.trigger.getCounter().hideView(); + if (self.combo.isViewVisible()) { + self.combo.hideView(); + } else { + self.combo.showView(); + } + }); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.combo, + left: 0, + right: 0, + top: 0, + bottom: 0 + }, { + el: triggerBtn, + right: 0, + top: 0, + bottom: 0 + }] + }) + }, + + _defaultState: function () { + this.trigger.stopEditing(); + this.combo.hideView(); + }, + + setValue: function (v) { + this.storeValue.value = v || {}; + this.combo.setValue({ + value: v || {} + }); + }, + + getValue: function () { + return this.storeValue.value; + }, + + populate: function () { + this.combo.populate.apply(this.combo, arguments); + } +}); + +BI.MultiTreeCombo.EVENT_CONFIRM = "MultiTreeCombo.EVENT_CONFIRM"; + +BI.shortcut('bi.multi_tree_combo', BI.MultiTreeCombo);/** + * 带加载的多选下拉面板 + * @class BI.MultiTreePopup + * @extends BI.Pane + */ +BI.MultiTreePopup = BI.inherit(BI.Pane, { + + _defaultConfig: function () { + return BI.extend(BI.MultiTreePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-tree-popup', + maxWidth: 'auto', + minWidth: 100, + maxHeight: 400, + onLoaded: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiTreePopup.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + + this.selectedValues = {}; + + this.tree = BI.createWidget({ + type: "bi.async_tree", + height: 400, + cls:"popup-view-tree", + itemsCreator: opts.itemsCreator, + onLoaded: opts.onLoaded + }); + + this.popupView = BI.createWidget({ + type: "bi.multi_popup_view", + element: this, + stopPropagation: false, + maxWidth: opts.maxWidth, + minWidth: opts.minWidth, + maxHeight: opts.maxHeight, + buttons: [BI.i18nText('BI-Basic_Clears'), BI.i18nText('BI-Basic_Sure')], + el: this.tree + }); + + this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function (index) { + switch (index) { + case 0: + self.fireEvent(BI.MultiTreePopup.EVENT_CLICK_CLEAR); + break; + case 1: + self.fireEvent(BI.MultiTreePopup.EVENT_CLICK_CONFIRM); + break; + } + }); + + this.tree.on(BI.TreeView.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiTreePopup.EVENT_CHANGE); + }); + + this.tree.on(BI.TreeView.EVENT_AFTERINIT, function () { + self.fireEvent(BI.MultiTreePopup.EVENT_AFTERINIT); + }); + + }, + + getValue: function () { + return this.tree.getValue(); + }, + + setValue: function (v) { + v || (v = {}); + this.tree.setSelectedValue(v.value); + }, + + populate: function (config) { + this.tree.stroke(config); + }, + + hasChecked: function () { + return this.tree.hasChecked(); + }, + + resetHeight: function (h) { + this.popupView.resetHeight(h); + }, + + resetWidth: function (w) { + this.popupView.resetWidth(w); + } +}); + +BI.MultiTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiTreePopup.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; +BI.MultiTreePopup.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; +BI.MultiTreePopup.EVENT_AFTERINIT = "EVENT_AFTERINIT"; + + +BI.shortcut('bi.multi_tree_popup_view', BI.MultiTreePopup);/** + * + * 在搜索框中输入文本弹出的面板 + * @class BI.MultiTreeSearchPane + * @extends BI.Pane + */ + +BI.MultiTreeSearchPane = BI.inherit(BI.Pane, { + + _defaultConfig: function () { + return BI.extend(BI.MultiTreeSearchPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-multi-tree-search-pane bi-card", + itemsCreator: BI.emptyFn, + keywordGetter: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiTreeSearchPane.superclass._init.apply(this, arguments); + + var self = this, opts = this.options; + + this.partTree = BI.createWidget({ + type: "bi.part_tree", + element: this, + tipText: BI.i18nText("BI-No_Select"), + itemsCreator: function (op, callback) { + op.keyword = opts.keywordGetter(); + opts.itemsCreator(op, callback); + } + }); + + this.partTree.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.partTree.on(BI.TreeView.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiTreeSearchPane.EVENT_CHANGE); + }); + }, + + hasChecked: function () { + return this.partTree.hasChecked(); + }, + + setValue: function (v) { + this.setSelectedValue(v.value); + }, + + setSelectedValue: function (v) { + v || (v = {}); + this.partTree.setSelectedValue(v); + }, + + getValue: function () { + return this.partTree.getValue(); + }, + + empty: function () { + this.partTree.empty(); + }, + + populate: function (op) { + this.partTree.stroke.apply(this.partTree, arguments); + } +}); + +BI.MultiTreeSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; + +BI.MultiTreeSearchPane.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; +BI.MultiTreeSearchPane.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; + +BI.shortcut("bi.multi_tree_search_pane", BI.MultiTreeSearchPane);/** + * 查看已选按钮 + * Created by guy on 15/11/3. + * @class BI.MultiTreeCheckSelectedButton + * @extends BI.Single + */ +BI.MultiTreeCheckSelectedButton = BI.inherit(BI.Single, { + + _const: { + checkSelected: BI.i18nText('BI-Check_Selected') + }, + + _defaultConfig: function () { + return BI.extend(BI.MultiTreeCheckSelectedButton.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-tree-check-selected-button', + itemsCreator: BI.emptyFn + }); + }, + + _init: function () { + BI.MultiTreeCheckSelectedButton.superclass._init.apply(this, arguments); + var self = this; + this.indicator = BI.createWidget({ + type: 'bi.icon_button', + cls: 'check-font trigger-check-selected', + width: 15, + height: 15, + stopPropagation: true + }); + + this.checkSelected = BI.createWidget({ + type: 'bi.text_button', + cls: "trigger-check-selected", + invisible: true, + hgap: 4, + text: this._const.checkSelected, + textAlign: 'center', + textHeight: 15 + }); + this.checkSelected.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.checkSelected.on(BI.TextButton.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiSelectCheckSelectedButton.EVENT_CHANGE, arguments); + }); + + BI.createWidget({ + type: "bi.horizontal", + element: this, + items: [this.indicator, this.checkSelected] + }) + + this.element.hover(function () { + self.indicator.setVisible(false); + self.checkSelected.setVisible(true); + }, function () { + self.indicator.setVisible(true); + self.checkSelected.setVisible(false); + }); + this.setVisible(false); + }, + + setValue: function (v) { + v || (v = {}); + this.setVisible(BI.size(v.value) > 0); + } +}); + +BI.MultiTreeCheckSelectedButton.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut('bi.multi_tree_check_selected_button', BI.MultiTreeCheckSelectedButton);/** + * searcher + * Created by guy on 15/11/3. + * @class BI.MultiTreeSearcher + * @extends Widget + */ +BI.MultiTreeSearcher = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.MultiTreeSearcher.superclass._defaultConfig.apply(this, arguments), { + baseCls: 'bi-multi-tree-searcher', + itemsCreator: BI.emptyFn, + popup: {}, + + adapter: null, + masker: {} + }); + }, + + _init: function () { + BI.MultiTreeSearcher.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.editor = BI.createWidget({ + type: 'bi.multi_select_editor', + height: o.height, + el: { + type: "bi.simple_state_editor", + height: o.height + } + }); + + this.searcher = BI.createWidget({ + type: "bi.searcher", + element: this, + isAutoSearch: false, + isAutoSync: false, + onSearch: function (op, callback) { + callback({ + keyword: self.editor.getValue() + }); + }, + el: this.editor, + + popup: BI.extend({ + type: "bi.multi_tree_search_pane", + keywordGetter: function () { + return self.editor.getValue(); + }, + itemsCreator: function (op, callback) { + op.keyword = self.editor.getValue(); + o.itemsCreator(op, callback); + } + }, o.popup), + + adapter: o.adapter, + masker: o.masker + }); + this.searcher.on(BI.Searcher.EVENT_START, function () { + self.fireEvent(BI.MultiTreeSearcher.EVENT_START); + }); + this.searcher.on(BI.Searcher.EVENT_PAUSE, function () { + if (this.hasMatched()) { + + } + self.fireEvent(BI.MultiTreeSearcher.EVENT_PAUSE); + }); + this.searcher.on(BI.Searcher.EVENT_STOP, function () { + self.fireEvent(BI.MultiTreeSearcher.EVENT_STOP); + }); + this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { + self.fireEvent(BI.MultiTreeSearcher.EVENT_CHANGE, arguments); + }); + }, + + adjustView: function () { + this.searcher.adjustView(); + }, + + setAdapter: function (adapter) { + this.searcher.setAdapter(adapter); + }, + + isSearching: function () { + return this.searcher.isSearching(); + }, + + stopSearch: function () { + this.searcher.stopSearch(); + }, + + getKeyword: function () { + return this.editor.getValue(); + }, + + hasMatched: function () { + return this.searcher.hasMatched(); + }, + + hasChecked: function () { + return this.searcher.getView() && this.searcher.getView().hasChecked(); + }, + + setState: function (ob) { + ob || (ob = {}); + ob.value || (ob.value = []); + if (ob.type === BI.Selection.All) { + this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.All); + } else { + this.editor.setState(BI.size(ob.value) > 0 ? BI.Selection.Multi : BI.Selection.None); + } + }, + + setValue: function (ob) { + this.setState(ob); + this.searcher.setValue(ob); + }, + + getKey: function () { + return this.editor.getValue(); + }, + + getValue: function () { + return this.searcher.getValue(); + }, + + populate: function (items) { + this.searcher.populate.apply(this.searcher, arguments); + } +}); + +BI.MultiTreeSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.MultiTreeSearcher.EVENT_CHANGE = "EVENT_CHANGE"; +BI.MultiTreeSearcher.EVENT_START = "EVENT_START"; +BI.MultiTreeSearcher.EVENT_STOP = "EVENT_STOP"; +BI.MultiTreeSearcher.EVENT_PAUSE = "EVENT_PAUSE"; +BI.shortcut('bi.multi_tree_searcher', BI.MultiTreeSearcher);//小于号的值为:0,小于等于号的值为:1 +//closeMIn:最小值的符号,closeMax:最大值的符号 +/** + * Created by roy on 15/9/17. + * + */ +BI.NumericalInterval = BI.inherit(BI.Single, { + constants: { + typeError: "typeBubble", + numberError: "numberBubble", + signalError: "signalBubble", + editorWidth: 114, + columns: 5, + width: 30, + rows: 1, + numberErrorCls: "number-error", + border: 1, + less: 0, + less_equal: 1, + numTip: "" + }, + _defaultConfig: function () { + var conf = BI.NumericalInterval.superclass._defaultConfig.apply(this, arguments) + return BI.extend(conf, { + extraCls: "bi-numerical-interval", + height: 25, + validation: "valid" + }) + }, + _init: function () { + var self = this, c = this.constants, o = this.options; + BI.NumericalInterval.superclass._init.apply(this, arguments) + this.smallEditor = BI.createWidget({ + type: "bi.editor", + height: o.height - 2, + watermark: BI.i18nText("BI-Basic_Unrestricted"), + allowBlank: true, + value: o.min, + level: "warning", + tipType: "warning", + quitChecker: function () { + return false; + }, + validationChecker: function (v) { + if (!BI.isNumeric(v)) { + self.smallEditorBubbleType = c.typeError; + return false; + } + return true; + }, + cls: "numerical-interval-small-editor bi-border-top bi-border-bottom bi-border-left" + }); + + this.smallTip = BI.createWidget({ + type: "bi.label", + text: o.numTip, + height: o.height - 2, + invisible: true + }); + BI.createWidget({ + type: "bi.absolute", + element: this.smallEditor.element, + items: [{ + el: this.smallTip, + top: 0, + right: 5 + }] + }); + + this.bigEditor = BI.createWidget({ + type: "bi.editor", + height: o.height - 2, + watermark: BI.i18nText("BI-Basic_Unrestricted"), + allowBlank: true, + value: o.max, + level: "warning", + tipType: "warning", + quitChecker: function () { + return false; + }, + validationChecker: function (v) { + if (!BI.isNumeric(v)) { + self.bigEditorBubbleType = c.typeError; + return false; + } + return true; + }, + cls: "numerical-interval-big-editor bi-border-top bi-border-bottom bi-border-right" + }); + + this.bigTip = BI.createWidget({ + type: "bi.label", + text: o.numTip, + height: o.height - 2, + invisible: true + }); + BI.createWidget({ + type: "bi.absolute", + element: this.bigEditor.element, + items: [{ + el: this.bigTip, + top: 0, + right: 5 + }] + }); + + //this.smallCombo = BI.createWidget({ + // type: "bi.numerical_interval_combo", + // cls: "numerical-interval-small-combo", + // height: o.height, + // value: o.closemin ? 1 : 0, + // offsetStyle: "left" + //}); + // + //this.bigCombo = BI.createWidget({ + // type: "bi.numerical_interval_combo", + // cls: "numerical-interval-big-combo", + // height: o.height, + // value: o.closemax ? 1 : 0, + // offsetStyle: "left" + //}); + this.smallCombo = BI.createWidget({ + type: "bi.icon_combo", + cls: "numerical-interval-small-combo bi-border", + height: o.height - 2, + items: [{ + text: "(" + BI.i18nText("BI-Less_Than") + ")", + iconClass: "less-font", + value: 0 + }, { + text: "(" + BI.i18nText("BI-Less_And_Equal") + ")", + value: 1, + iconClass: "less-equal-font" + }] + }); + if (o.closemin === true) { + this.smallCombo.setValue(1); + } else { + this.smallCombo.setValue(0); + } + this.bigCombo = BI.createWidget({ + type: "bi.icon_combo", + cls: "numerical-interval-big-combo bi-border", + height: o.height - 2, + items: [{ + text: "(" + BI.i18nText("BI-Less_Than") + ")", + iconClass: "less-font", + value: 0 + }, { + text: "(" + BI.i18nText("BI-Less_And_Equal") + ")", + value: 1, + iconClass: "less-equal-font" + }] + }); + if (o.closemax === true) { + this.bigCombo.setValue(1); + } else { + this.bigCombo.setValue(0); + } + this.label = BI.createWidget({ + type: "bi.label", + text: BI.i18nText("BI-Basic_Value"), + textHeight: o.height - c.border * 2, + width: c.width - c.border * 2, + height: o.height - c.border * 2, + level: "warning", + tipType: "warning" + }); + this.left = BI.createWidget({ + type: "bi.htape", + items: [{ + el: self.smallEditor + }, { + el: self.smallCombo, + width: c.width - c.border * 2 + }] + + }); + this.right = BI.createWidget({ + type: "bi.htape", + items: [{ + el: self.bigCombo, + width: c.width - c.border * 2 + }, { + el: self.bigEditor + }] + }); + + + BI.createWidget({ + element: self, + type: "bi.center", + hgap: 15, + height: o.height, + items: [ + { + type: "bi.absolute", + items: [{ + el: self.left, + left: -15, + right: 0, + top: 0, + bottom: 0 + }] + }, { + type: "bi.absolute", + items: [{ + el: self.right, + left: 0, + right: -15, + top: 0, + bottom: 0 + }] + } + ] + }); + + BI.createWidget({ + element: self, + type: "bi.horizontal_auto", + items: [ + self.label + ] + }); + + + self._setValidEvent(self.bigEditor, c.bigEditor); + self._setValidEvent(self.smallEditor, c.smallEditor); + self._setErrorEvent(self.bigEditor, c.bigEditor); + self._setErrorEvent(self.smallEditor, c.smallEditor); + self._setBlurEvent(self.bigEditor); + self._setBlurEvent(self.smallEditor); + self._setFocusEvent(self.bigEditor); + self._setFocusEvent(self.smallEditor); + self._setComboValueChangedEvent(self.bigCombo); + self._setComboValueChangedEvent(self.smallCombo); + self._setEditorValueChangedEvent(self.bigEditor); + self._setEditorValueChangedEvent(self.smallEditor); + }, + + _checkValidation: function () { + var self = this, c = this.constants, o = this.options; + self._setTitle(""); + BI.Bubbles.hide(c.typeError); + BI.Bubbles.hide(c.numberError); + BI.Bubbles.hide(c.signalError); + if (!self.smallEditor.isValid() || !self.bigEditor.isValid()) { + self.element.removeClass("number-error"); + o.validation = "invalid"; + return c.typeError; + } else { + if (BI.isEmptyString(self.smallEditor.getValue()) || BI.isEmptyString(self.bigEditor.getValue())) { + self.element.removeClass("number-error"); + o.validation = "valid"; + return ""; + } else { + var smallValue = parseFloat(self.smallEditor.getValue()), bigValue = parseFloat(self.bigEditor.getValue()), + bigComboValue = self.bigCombo.getValue(), smallComboValue = self.smallCombo.getValue(); + if (bigComboValue[0] === c.less_equal && smallComboValue[0] === c.less_equal) { + if (smallValue > bigValue) { + self.element.addClass("number-error"); + o.validation = "invalid"; + return c.numberError; + } else { + self.element.removeClass("number-error"); + o.validation = "valid"; + return ""; + } + } else { + if (smallValue > bigValue) { + self.element.addClass("number-error"); + o.validation = "invalid"; + return c.numberError; + } else if (smallValue === bigValue) { + self.element.addClass("number-error"); + o.validation = "invalid"; + return c.signalError; + } else { + self.element.removeClass("number-error"); + o.validation = "valid"; + return ""; + } + } + } + + } + }, + + _setTitle: function (v) { + var self = this; + self.bigEditor.setTitle(v); + self.smallEditor.setTitle(v); + self.label.setTitle(v); + }, + + _setFocusEvent: function (w) { + var self = this, c = this.constants; + w.on(BI.Editor.EVENT_FOCUS, function () { + self._setTitle(""); + switch (self._checkValidation()) { + case c.typeError: + BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { + offsetStyle: "center" + }); + break; + case c.numberError: + BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, { + offsetStyle: "center" + }); + break; + case c.signalError: + BI.Bubbles.show(c.signalError, BI.i18nText("BI-Numerical_Interval_Signal_Value"), self, { + offsetStyle: "center" + }); + break; + default : + return + } + + }) + }, + _setBlurEvent: function (w) { + var c = this.constants, self = this; + w.on(BI.Editor.EVENT_BLUR, function () { + BI.Bubbles.hide(c.typeError); + BI.Bubbles.hide(c.numberError); + BI.Bubbles.hide(c.signalError); + switch (self._checkValidation()) { + case c.typeError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Input_Data")); + break; + case c.numberError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Number_Value")); + break; + case c.signalError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Signal_Value")); + break; + default: + self._setTitle(""); + } + }) + }, + + _setErrorEvent: function (w) { + var c = this.constants, self = this + w.on(BI.Editor.EVENT_ERROR, function () { + self._checkValidation(); + BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { + offsetStyle: "center" + }); + self.fireEvent(BI.NumericalInterval.EVENT_ERROR); + }) + }, + + + _setValidEvent: function (w) { + var self = this, c = this.constants; + w.on(BI.Editor.EVENT_VALID, function () { + switch (self._checkValidation()) { + case c.numberError: + BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, { + offsetStyle: "center" + }); + self.fireEvent(BI.NumericalInterval.EVENT_ERROR); + break; + case c.signalError: + BI.Bubbles.show(c.signalError, BI.i18nText("BI-Numerical_Interval_Signal_Value"), self, { + offsetStyle: "center" + }); + self.fireEvent(BI.NumericalInterval.EVENT_ERROR); + break; + default: + self.fireEvent(BI.NumericalInterval.EVENT_VALID); + } + }) + }, + + + _setEditorValueChangedEvent: function (w) { + var self = this, c = this.constants; + w.on(BI.Editor.EVENT_CHANGE, function () { + switch (self._checkValidation()) { + case c.typeError: + BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { + offsetStyle: "center" + }); + break; + case c.numberError: + BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, { + offsetStyle: "center" + }); + break; + case c.signalError: + BI.Bubbles.show(c.signalError, BI.i18nText("BI-Numerical_Interval_Signal_Value"), self, { + offsetStyle: "center" + }); + break; + default : + break; + } + self.fireEvent(BI.NumericalInterval.EVENT_CHANGE); + }); + }, + + _setComboValueChangedEvent: function (w) { + var self = this, c = this.constants; + w.on(BI.IconCombo.EVENT_CHANGE, function () { + switch (self._checkValidation()) { + case c.typeError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Input_Data")); + self.fireEvent(BI.NumericalInterval.EVENT_ERROR); + break; + case c.numberError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Number_Value")); + self.fireEvent(BI.NumericalInterval.EVENT_ERROR); + break; + case c.signalError: + self._setTitle(BI.i18nText("BI-Numerical_Interval_Signal_Value")); + self.fireEvent(BI.NumericalInterval.EVENT_ERROR); + break; + default : + self.fireEvent(BI.NumericalInterval.EVENT_CHANGE); + self.fireEvent(BI.NumericalInterval.EVENT_VALID); + } + }) + }, + + isStateValid: function () { + return this.options.validation === "valid"; + }, + + setMinEnable: function (b) { + this.smallEditor.setEnable(b); + }, + + setCloseMinEnable: function (b) { + this.smallCombo.setEnable(b); + }, + + setMaxEnable: function (b) { + this.bigEditor.setEnable(b); + }, + + setCloseMaxEnable: function (b) { + this.bigCombo.setEnable(b); + }, + + showNumTip: function () { + this.smallTip.setVisible(true); + this.bigTip.setVisible(true); + }, + + hideNumTip: function () { + this.smallTip.setVisible(false); + this.bigTip.setVisible(false); + }, + + setNumTip: function(numTip) { + this.smallTip.setText(numTip); + this.bigTip.setText(numTip); + }, + + getNumTip: function() { + return this.smallTip.getText(); + }, + + setValue: function (data) { + data = data || {}; + var self = this, combo_value; + if (BI.isNumeric(data.min) || BI.isEmptyString(data.min)) { + self.smallEditor.setValue(data.min); + } + + if (!BI.isNotNull(data.min)) { + self.smallEditor.setValue(""); + } + + if (BI.isNumeric(data.max) || BI.isEmptyString(data.max)) { + self.bigEditor.setValue(data.max); + } + + if (!BI.isNotNull(data.max)) { + self.bigEditor.setValue(""); + } + + if (!BI.isNull(data.closemin)) { + if (data.closemin === true) { + combo_value = 1 + } else { + combo_value = 0 + } + self.smallCombo.setValue(combo_value); + } + + if (!BI.isNull(data.closemax)) { + if (data.closemax === true) { + combo_value = 1 + } else { + combo_value = 0 + } + self.bigCombo.setValue(combo_value); + } + }, + + + getValue: function () { + var self = this, value = {}, minComboValue = self.smallCombo.getValue(), maxComboValue = self.bigCombo.getValue(); + value.min = self.smallEditor.getValue(); + value.max = self.bigEditor.getValue(); + if (minComboValue[0] === 0) { + value.closemin = false + } else { + value.closemin = true + } + + if (maxComboValue[0] === 0) { + value.closemax = false + } else { + value.closemax = true + } + return value; + } +}); +BI.NumericalInterval.EVENT_CHANGE = "EVENT_CHANGE"; +BI.NumericalInterval.EVENT_VALID = "EVENT_VALID"; +BI.NumericalInterval.EVENT_ERROR = "EVENT_ERROR"; +BI.shortcut("bi.numerical_interval", BI.NumericalInterval);/** + * + * 表格 + * + * Created by GUY on 2015/9/22. + * @class BI.PageTableCell + * @extends BI.Single + */ +BI.PageTableCell = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.PageTableCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-page-table-cell", + text: "", + title: "" + }) + }, + + _init: function () { + BI.PageTableCell.superclass._init.apply(this, arguments); + var label = BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "left", + whiteSpace: "nowrap", + height: this.options.height, + text: this.options.text, + title: this.options.title, + value: this.options.value, + lgap: 5, + rgap: 5 + }); + + if (BI.isNotNull(this.options.styles) && BI.isObject(this.options.styles)) { + this.element.css(this.options.styles); + } + } +}); + +BI.shortcut("bi.page_table_cell", BI.PageTableCell);/** + * 分页表格 + * + * Created by GUY on 2016/2/15. + * @class BI.PageTable + * @extends BI.Widget + */ +BI.PageTable = BI.inherit(BI.Widget, { + + _const: { + scrollWidth: 18, + minScrollWidth: 100 + }, + + _defaultConfig: function () { + return BI.extend(BI.PageTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-page-table", + el: { + type: "bi.sequence_table" + }, + pager: { + horizontal: { + pages: false, //总页数 + curr: 1, //初始化当前页, pages为数字时可用 + + hasPrev: BI.emptyFn, + hasNext: BI.emptyFn, + firstPage: 1, + lastPage: BI.emptyFn + }, + vertical: { + pages: false, //总页数 + curr: 1, //初始化当前页, pages为数字时可用 + + hasPrev: BI.emptyFn, + hasNext: BI.emptyFn, + firstPage: 1, + lastPage: BI.emptyFn + } + }, + + itemsCreator: BI.emptyFn, + + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 + + isNeedMerge: false,//是否需要合并单元格 + mergeCols: [], //合并的单元格列号 + mergeRule: BI.emptyFn, + + columnSize: [], + minColumnSize: [], + maxColumnSize: [], + headerRowSize: 25, + rowSize: 25, + + regionColumnSize: [], + + headerCellStyleGetter: BI.emptyFn, + summaryCellStyleGetter: BI.emptyFn, + sequenceCellStyleGetter: BI.emptyFn, + + header: [], + items: [], //二维数组 + + //交叉表头 + crossHeader: [], + crossItems: [] + }); + }, + + _init: function () { + BI.PageTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.hCurr = 1; + this.vCurr = 1; + + this.table = BI.createWidget(o.el, { + type: "bi.sequence_table", + width: o.width, + height: o.height && o.height - 30, + + isNeedResize: true, + isResizeAdapt: false, + + isNeedFreeze: o.isNeedFreeze, + freezeCols: o.freezeCols, + + isNeedMerge: o.isNeedMerge, + mergeCols: o.mergeCols, + mergeRule: o.mergeRule, + + columnSize: o.columnSize, + minColumnSize: o.minColumnSize, + maxColumnSize: o.maxColumnSize, + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + + regionColumnSize: o.regionColumnSize, + + headerCellStyleGetter: o.headerCellStyleGetter, + summaryCellStyleGetter: o.summaryCellStyleGetter, + sequenceCellStyleGetter: o.sequenceCellStyleGetter, + + header: o.header, + items: o.items, + //交叉表头 + crossHeader: o.crossHeader, + crossItems: o.crossItems + }); + + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); + }); + + this.pager = BI.createWidget(o.pager, { + type: "bi.direction_pager", + height: 30 + }); + this.pager.on(BI.Pager.EVENT_CHANGE, function () { + var vpage = this.getVPage && this.getVPage(); + if (BI.isNull(vpage)) { + vpage = this.getCurrentPage(); + } + var hpage = this.getHPage && this.getHPage(); + o.itemsCreator({ + vpage: vpage, + hpage: hpage + }, function (items, header, crossItems, crossHeader) { + self.table.setVPage ? self.table.setVPage(vpage) : self.table.setValue(vpage); + self.table.setHPage && self.table.setHPage(hpage); + self.populate.apply(self, arguments); + }); + }); + + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.table, + left: 0, + top: 0 + }, { + el: this.pager, + left: 0, + right: 0, + bottom: 0 + }] + }) + }, + + setHPage: function (v) { + this.hCurr = v; + this.pager.setHPage && this.pager.setHPage(v); + this.table.setHPage && this.table.setHPage(v); + }, + + setVPage: function (v) { + this.vCurr = v; + this.pager.setVPage && this.pager.setVPage(v); + this.table.setVPage && this.table.setVPage(v); + }, + + getHPage: function () { + var hpage = this.pager.getHPage && this.pager.getHPage(); + if (BI.isNotNull(hpage)) { + return hpage; + } + hpage = this.pager.getCurrentPage && this.pager.getCurrentPage(); + if (BI.isNotNull(hpage)) { + return hpage; + } + return this.hpage; + }, + + getVPage: function () { + var vpage = this.pager.getVPage && this.pager.getVPage(); + if (BI.isNotNull(vpage)) { + return vpage; + } + vpage = this.pager.getCurrentPage && this.pager.getCurrentPage(); + if (BI.isNotNull(vpage)) { + return vpage; + } + return this.vpage; + }, + + setWidth: function (width) { + BI.PageTable.superclass.setWidth.apply(this, arguments); + this.table.setWidth(width); + }, + + setHeight: function (height) { + BI.PageTable.superclass.setHeight.apply(this, arguments); + var showPager = false; + if (this.pager.alwaysShowPager) { + showPager = true; + } else if (this.pager.hasHNext && this.pager.hasHNext()) { + showPager = true; + } else if (this.pager.hasHPrev && this.pager.hasHPrev()) { + showPager = true; + } else if (this.pager.hasVNext && this.pager.hasVNext()) { + showPager = true; + } else if (this.pager.hasVPrev && this.pager.hasVPrev()) { + showPager = true; + } else if (this.pager.hasNext && this.pager.hasNext()) { + showPager = true; + } else if (this.pager.hasPrev && this.pager.hasPrev()) { + showPager = true; + } + this.table.setHeight(height - (showPager ? 30 : 0)); + }, + + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this.table.setColumnSize(columnSize); + }, + + getColumnSize: function () { + return this.table.getColumnSize(); + }, + + setRegionColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this.table.setRegionColumnSize(columnSize); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, + + restore: function () { + this.table.restore(); + }, + + attr: function () { + BI.PageTable.superclass.attr.apply(this, arguments); + this.table.attr.apply(this.table, arguments); + }, + + populate: function () { + this.pager.populate(); + this.table.populate.apply(this.table, arguments); + }, + + destroy: function () { + this.table.destroy(); + this.pager && this.pager.destroy(); + BI.PageTable.superclass.destroy.apply(this, arguments); + } +}); +BI.shortcut('bi.page_table', BI.PageTable);/** + * 路径选择 + * + * Created by GUY on 2015/12/4. + * @class BI.PathChooser + * @extends BI.Widget + */ +BI.PathChooser = BI.inherit(BI.Widget, { + + _const: { + lineColor: "#d4dadd", + selectLineColor: "#3f8ce8" + }, + + _defaultConfig: function () { + return BI.extend(BI.PathChooser.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-path-chooser", + items: [] + }) + }, + + _init: function () { + BI.PathChooser.superclass._init.apply(this, arguments); + this.populate(this.options.items); + }, + + _createRegions: function (regions) { + var self = this; + this.regions = BI.createWidgets(BI.map(regions, function (i, region) { + return { + type: "bi.path_region", + title: self.texts[region] || region + } + })); + this.regionMap = {}; + BI.each(regions, function (i, region) { + self.regionMap[region] = i; + }); + this.container = BI.createWidget({ + type: "bi.horizontal", + verticalAlign: "top", + scrollx: false, + scrolly: false, + hgap: 10, + items: this.regions + }); + BI.createWidget({ + type: "bi.vertical_adapt", + element: this, + scrollable: true, + hgap: 10, + items: [this.container] + }); + }, + + getRegionIndexById: function (id) { + var node = this.store[id]; + var regionType = node.get("region"); + return this.regionMap[regionType]; + }, + + _drawPath: function (start, offset, index) { + var self = this; + var starts = []; + if (BI.contains(this.start, start)) { + starts = this.start; + } else { + starts = [start]; + } + + BI.each(starts, function (i, s) { + BI.each(self.radios[s], function (i, rad) { + rad.setSelected(false); + }); + BI.each(self.lines[s], function (i, line) { + line.attr("stroke", self._const.lineColor); + }); + BI.each(self.regionIndexes[s], function (i, idx) { + self.regions[idx].reset(); + }); + }); + + BI.each(this.routes[start][index], function (i, id) { + var regionIndex = self.getRegionIndexById(id); + self.regions[regionIndex].setSelect(offset + index, id); + }); + var current = BI.last(this.routes[start][index]); + + while (current && this.routes[current] && this.routes[current].length === 1) { + BI.each(this.routes[current][0], function (i, id) { + var regionIndex = self.getRegionIndexById(id); + self.regions[regionIndex].setSelect(0, id); + }); + this.lines[current][0].attr("stroke", self._const.selectLineColor).toFront(); + current = BI.last(this.routes[current][0]); + } + this.lines[start][index].attr("stroke", self._const.selectLineColor).toFront(); + this.radios[start] && this.radios[start][index] && this.radios[start][index].setSelected(true); + }, + + _drawRadio: function (start, offset, index, x, y) { + var self = this; + var radio = BI.createWidget({ + type: "bi.radio", + cls: "path-chooser-radio", + selected: offset + index === 0, + start: start, + index: index + }); + radio.on(BI.Radio.EVENT_CHANGE, function () { + self._drawPath(start, offset, index); + self.fireEvent(BI.PathChooser.EVENT_CHANGE, start, index); + }); + if (!this.radios[start]) { + this.radios[start] = []; + } + this.radios[start].push(radio); + BI.createWidget({ + type: "bi.absolute", + element: this.container, + items: [{ + el: radio, + left: x - 6.5, + top: y - 6.5 + }] + }) + }, + + _drawLine: function (start, lines) { + var self = this; + if (!this.lines[start]) { + this.lines[start] = []; + } + if (!this.pathes[start]) { + this.pathes[start] = []; + } + var startRegionIndex = this.getRegionIndexById(start); + //start所在的位置,然后接着往下画其他的路径 + var offset = this.regions[startRegionIndex].getIndexByValue(start); + BI.each(lines, function (i, line) { + self.pathes[start][i] = []; + var idx = i + offset; + var path = ""; + var stop = 47.5 + 29 * idx; + var sleft = 50 + 100 * startRegionIndex; + var radioStartX = sleft, radioStartY = stop; + var etop = stop; + var endRegionIndex = self.getRegionIndexById(BI.last(line)); + var endOffset = self.regions[endRegionIndex].getIndexByValue(BI.last(line)); + var eleft = 50 + 100 * endRegionIndex; + if (BI.contains(self.start, start)) { + radioStartX = sleft - 50; + path += "M" + (sleft - 50) + "," + stop; + self.pathes[start][i].push({ + x: sleft - 50, + y: stop + }) + } else if (idx === 0) { + radioStartX = sleft + 50; + path += "M" + sleft + "," + stop; + self.pathes[start][i].push({ + x: sleft, + y: stop + }) + } else { + radioStartX = sleft + 50; + path += "M" + sleft + "," + 47.5 + "L" + (sleft + 50) + "," + 47.5 + "L" + (sleft + 50) + "," + stop; + self.pathes[start][i].push({ + x: sleft, + y: 47.5 + }); + self.pathes[start][i].push({ + x: sleft + 50, + y: 47.5 + }); + self.pathes[start][i].push({ + x: sleft + 50, + y: stop + }); + } + if (idx > 0) { + var endY = endOffset * 29 + 47.5; + path += "L" + (eleft - 50) + "," + etop + "L" + (eleft - 50) + "," + endY + "L" + eleft + "," + endY; + self.pathes[start][i].push({ + x: eleft - 50, + y: etop + }); + self.pathes[start][i].push({ + x: eleft - 50, + y: endY + }); + self.pathes[start][i].push({ + x: eleft, + y: endY + }); + } else { + path += "L" + eleft + "," + etop; + self.pathes[start][i].push({ + x: eleft, + y: etop + }); + } + + var graph = self.svg.path(path) + .attr({ + stroke: idx === 0 ? self._const.selectLineColor : self._const.lineColor, + 'stroke-dasharray': '-' + }); + self.lines[start].push(graph); + if (lines.length > 1) { + self.lines[start][0].toFront(); + } + //第一个元素无论有多少个都要显示radio + if (BI.contains(self.start, start)) { + self.lines[self.regions[0].getValueByIndex(0)][0].toFront(); + } + if (lines.length > 1 || BI.contains(self.start, start)) { + self._drawRadio(start, offset, i, radioStartX, radioStartY); + } + }); + }, + + _drawLines: function (routes) { + var self = this; + this.lines = {}; + this.pathes = {}; + this.radios = {}; + this.regionIndexes = {}; + BI.each(routes, function (k, route) { + if (!self.regionIndexes[k]) { + self.regionIndexes[k] = []; + } + BI.each(route, function (i, rs) { + BI.each(rs, function (j, id) { + var regionIndex = self.getRegionIndexById(id); + if (!BI.contains(self.regionIndexes[k], regionIndex)) { + self.regionIndexes[k].push(regionIndex); + } + }); + }) + }); + BI.each(routes, function (k, route) { + self._drawLine(k, route); + }); + }, + + _pushNodes: function (nodes) { + var self = this; + var indexes = []; + for (var i = 0; i < nodes.length; i++) { + var id = nodes[i]; + var index = self.getRegionIndexById(id); + indexes.push(index); + var region = self.regions[index]; + if (i === nodes.length - 1) { + if (!region.hasItem(id)) { + region.addItem(id, self.texts[id]); + } + break; + } + if (i > 0 || BI.contains(self.start, id)) { + region.addItem(id, self.texts[id]); + } + } + for (var i = BI.first(indexes); i < BI.last(indexes); i++) { + if (!BI.contains(indexes, i)) { + self.regions[i].addItem(""); + } + } + }, + + _createNodes: function () { + var self = this, o = this.options; + this.store = {}; + this.texts = {}; + this.start = []; + this.end = []; + BI.each(o.items, function (i, item) { + self.start.push(BI.first(item).value); + self.end.push(BI.last(item).value); + }); + this.start = BI.uniq(this.start); + this.end = BI.uniq(this.end); + var regions = []; + var tree = new BI.Tree(); + var branches = {}, max = 0; + BI.each(o.items, function (i, items) { + BI.each(items, function (j, item) { + if (!BI.has(branches, item.value)) { + branches[item.value] = 0; + } + branches[item.value]++; + max = Math.max(max, branches[item.value]); + var prev = {}; + if (j > 0) { + prev = items[j - 1]; + } + var parent = self.store[prev.value || ""]; + var node = self.store[item.value] || new BI.Node(item.value); + node.set(item); + self.store[item.value] = node; + self.texts[item.value] = item.text; + self.texts[item.region] = item.regionText; + parent = BI.isNull(parent) ? tree.getRoot() : parent; + if (parent.getChildIndex(item.value) === -1) { + tree.addNode(parent, node); + } + }) + }); + + //算出区域列表 + tree.traverse(function (node) { + BI.each(node.getChildren(), function (i, child) { + if (BI.contains(regions, child.get("region"))) { + var index1 = BI.indexOf(regions, node.get("region")); + var index2 = BI.indexOf(regions, child.get("region")); + //交换区域 + if (index1 > index2) { + var t = regions[index2]; + for (var j = index2; j < index1; j++) { + regions[j] = regions[j + 1]; + } + regions[index1] = t; + } + } else { + regions.push(child.get("region")); + } + }); + }); + this._createRegions(regions); + + //算出节点 + BI.each(branches, function (k, branch) { + if (branch < max) { + delete branches[k]; + } + }); + + //过滤节点 + var nodes = []; + var n = tree.getRoot(); + while (n && n.getChildrenLength() === 1) { + if (BI.has(branches, n.getChildren()[0].id)) { + delete branches[n.getChildren()[0].id]; + n = n.getChildren()[0]; + } else { + n = null; + } + } + tree.traverse(function (node) { + if (BI.has(branches, node.id)) { + nodes.push(node.id); + delete branches[node.id]; + } + }); + + //填充节点 + var routes = {}; + var s, e; + for (var i = 0, len = nodes.length; i < len + 1; i++) { + if (len === 0) { + s = []; + BI.each(this.start, function (i, id) { + s.push(tree.search(id)); + }); + e = []; + BI.each(this.end, function (i, id) { + e.push(tree.search(id)); + }); + } else if (i === len) { + s = e; + e = []; + BI.each(this.end, function (i, id) { + e.push(tree.search(id)); + }); + } else if (i === 0) { + s = []; + BI.each(this.start, function (i, id) { + s.push(tree.search(id)); + }); + e = [tree.search(nodes[i])]; + } else { + s = [tree.search(e[0] || tree.getRoot(), nodes[i - 1])]; + e = [tree.search(s[0], nodes[i])]; + } + BI.each(s, function (i, n) { + tree._recursion(n, [n.id], function (node, route) { + if (BI.contains(e, node)) { + if (!routes[n.id]) { + routes[n.id] = []; + } + routes[n.id].push(route); + self._pushNodes(route); + if (e.length <= 1) { + return true; + } + } + }) + }); + } + this.routes = routes; + this._drawLines(routes); + }, + + _unselectAllPath: function () { + var self = this; + BI.each(this.radios, function (idx, rad) { + BI.each(rad, function (i, r) { + r.setSelected(false); + }); + }); + BI.each(this.lines, function (idx, line) { + BI.each(line, function (i, li) { + li.attr("stroke", self._const.lineColor); + }); + }); + BI.each(this.regions, function (idx, region) { + region.reset(); + }); + }, + + populate: function (items) { + this.options.items = items || []; + var self = this; + this.empty(); + if (this.options.items.length <= 0) { + return; + } + this.svg = BI.createWidget({ + type: "bi.svg" + }); + this._createNodes(); + BI.createWidget({ + type: "bi.absolute", + element: this.container, + items: [{ + el: this.svg, + top: 0, + left: 0, + right: 0, + bottom: 0 + }] + }); + }, + + setValue: function (v) { + this._unselectAllPath(); + var nodes = BI.keys(this.routes), self = this; + var result = [], array = []; + BI.each(v, function (i, val) { + if (BI.contains(nodes, val)) { + if (array.length > 0) { + array.push(val); + result.push(array); + array = []; + } + } + array.push(val); + }); + if (array.length > 0) { + result.push(array); + } + //画这n条路径 + BI.each(result, function (idx, path) { + var start = path[0]; + var index = BI.findIndex(self.routes[start], function (idx, p) { + if (BI.isEqual(path, p)) { + return true; + } + }); + if (index >= 0) { + var startRegionIndex = self.getRegionIndexById(start); + var offset = self.regions[startRegionIndex].getIndexByValue(start); + self._drawPath(start, offset, index); + } + }); + }, + + getValue: function () { + var path = []; + BI.each(this.regions, function (i, region) { + var val = region.getValue(); + if (BI.isKey(val)) { + path.push(val); + } + }); + return path; + } +}); +BI.PathChooser.EVENT_CHANGE = "PathChooser.EVENT_CHANGE"; +BI.shortcut("bi.path_chooser", BI.PathChooser);/** + * 路径选择区域 + * + * Created by GUY on 2015/12/4. + * @class BI.PathRegion + * @extends BI.Widget + */ +BI.PathRegion = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.PathRegion.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-path-region bi-background", + width: 80, + title: "" + }) + }, + + _init: function () { + BI.PathRegion.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.zIndex = 100; + var title = BI.createWidget({ + type: "bi.label", + text: o.title, + title: o.title, + height: 30 + }); + title.element.css("zIndex", this.zIndex--); + this.items = []; + this.vertical = BI.createWidget({ + type: "bi.vertical", + element: this, + bgap: 5, + hgap: 10, + items: [title] + }) + }, + + hasItem: function (val) { + return BI.any(this.items, function (i, item) { + return val === item.getValue(); + }); + }, + + addItem: function (value, text) { + if (BI.isKey(value)) { + var label = BI.createWidget({ + type: "bi.label", + cls: "path-region-label bi-card bi-border bi-list-item-select", + text: text, + value: value, + title: text || value, + height: 22 + }); + } else { + var label = BI.createWidget({ + type: "bi.layout", + height: 24 + }); + } + label.element.css("zIndex", this.zIndex--); + this.items.push(label); + this.vertical.addItem(label); + if (this.items.length === 1) { + this.setSelect(0, value); + } + }, + + reset: function () { + BI.each(this.items, function (i, item) { + item.element.removeClass("active"); + }); + }, + + setSelect: function (index, value) { + this.reset(); + if (this.items.length <= 0) { + return; + } + if (this.items.length === 1) { + this.items[0].element.addClass("active"); + return; + } + if (this.items[index].attr("value") === value) { + this.items[index].element.addClass("active"); + } + }, + + setValue: function (value) { + this.setSelect(this.getIndexByValue(value), value); + }, + + getValueByIndex: function (idx) { + return this.items[idx].attr("value"); + }, + + getIndexByValue: function (value) { + return BI.findIndex(this.items, function (i, item) { + return item.attr("value") === value; + }); + }, + + getValue: function () { + var res; + BI.any(this.items, function (i, item) { + if (item.element.hasClass("active")) { + res = item.getValue(); + return true; + } + }); + return res; + } +}); +BI.PathRegion.EVENT_CHANGE = "PathRegion.EVENT_CHANGE"; +BI.shortcut("bi.path_region", BI.PathRegion);/** + * 预览表列 + * + * Created by GUY on 2015/12/25. + * @class BI.PreviewTableCell + * @extends BI.Widget + */ +BI.PreviewTableCell = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-preview-table-cell", + text: "" + }); + }, + + _init: function () { + BI.PreviewTableCell.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "left", + whiteSpace: "normal", + height: this.options.height, + text: this.options.text, + value: this.options.value + }) + } +}); +BI.shortcut('bi.preview_table_cell', BI.PreviewTableCell);/** + * 预览表 + * + * Created by GUY on 2015/12/25. + * @class BI.PreviewTableHeaderCell + * @extends BI.Widget + */ +BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-preview-table-header-cell", + text: "" + }); + }, + + _init: function () { + BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "left", + whiteSpace: "normal", + height: this.options.height, + text: this.options.text, + value: this.options.value + }) + } +}); +BI.shortcut('bi.preview_table_header_cell', BI.PreviewTableHeaderCell);/** + * 预览表 + * + * Created by GUY on 2015/12/25. + * @class BI.PreviewTable + * @extends BI.Widget + */ +BI.PreviewTable = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-preview-table", + isNeedFreeze: false, + freezeCols: [], + rowSize: null, + columnSize: [], + headerRowSize: 30, + header: [], + items: [] + }); + }, + + _init: function () { + BI.PreviewTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.table = BI.createWidget({ + type: "bi.table_view", + element: this, + isNeedResize: false, + + isResizeAdapt: false, + + isNeedFreeze: o.isNeedFreeze, + freezeCols: o.freezeCols, + + rowSize: o.rowSize, + columnSize: o.columnSize, + headerRowSize: o.headerRowSize, + + header: BI.map(o.header, function (i, items) { + return BI.map(items, function (j, item) { + return BI.extend({ + type: "bi.preview_table_header_cell" + }, item); + }); + }), + items: BI.map(o.items, function (i, items) { + return BI.map(items, function (j, item) { + return BI.extend({ + type: "bi.preview_table_cell" + }, item); + }); + }) + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () { + self._adjustColumns(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () { + self._adjustColumns(); + }); + }, + + //是否有自适应调节的列,即列宽为"" + _hasAdaptCol: function (columnSize) { + return BI.any(columnSize, function (i, size) { + return size === ""; + }) + }, + + _isPercentage: function (columnSize) { + return columnSize[0] <= 1; + }, + + _adjustColumns: function () { + var self = this, o = this.options; + if (o.isNeedFreeze === true) { + //如果存在百分比的情况 + if (this._isPercentage(o.columnSize)) { + if (this._hasAdaptCol(o.columnSize)) { + var findCols = [], remain = 0; + BI.each(o.columnSize, function (i, size) { + if (size === "") { + findCols.push(i); + } else { + remain += size; + } + }); + remain = 1 - remain; + var average = remain / findCols.length; + BI.each(findCols, function (i, col) { + o.columnSize[col] = average; + }); + } + var isRight = BI.first(o.freezeCols) !== 0; + var freezeSize = [], notFreezeSize = []; + BI.each(o.columnSize, function (i, size) { + if (o.freezeCols.contains(i)) { + freezeSize.push(size); + } else { + notFreezeSize.push(size); + } + }); + var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize); + BI.each(freezeSize, function (i, size) { + freezeSize[i] = size / sumFreezeSize; + }); + BI.each(notFreezeSize, function (i, size) { + notFreezeSize[i] = size / sumNotFreezeSize; + }); + this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]); + this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize))); + } + } else { + //如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100% + if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) { + this.table.setRegionColumnSize(["100%"]); + } + } + }, + + setColumnSize: function (columnSize) { + return this.table.setColumnSize(columnSize); + }, + + getColumnSize: function () { + return this.table.getColumnSize(); + }, + + getCalculateColumnSize: function () { + return this.table.getCalculateColumnSize(); + }, + + setHeaderColumnSize: function (columnSize) { + return this.table.setHeaderColumnSize(columnSize); + }, + + setRegionColumnSize: function (columnSize) { + return this.table.setRegionColumnSize(columnSize); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + getCalculateRegionColumnSize: function () { + return this.table.getCalculateRegionColumnSize(); + }, + + getCalculateRegionRowSize: function () { + return this.table.getCalculateRegionRowSize(); + }, + + getClientRegionColumnSize: function () { + return this.table.getClientRegionColumnSize(); + }, + + getScrollRegionColumnSize: function () { + return this.table.getScrollRegionColumnSize() + }, + + getScrollRegionRowSize: function () { + return this.table.getScrollRegionRowSize() + }, + + hasVerticalScroll: function () { + return this.table.hasVerticalScroll(); + }, + + setVerticalScroll: function (scrollTop) { + return this.table.setVerticalScroll(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + return this.table.setLeftHorizontalScroll(scrollLeft) + }, + + setRightHorizontalScroll: function (scrollLeft) { + return this.table.setRightHorizontalScroll(scrollLeft); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, + + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + getColumns: function () { + return this.table.getColumns(); + }, + + populate: function (items, header) { + this.table.populate(items, header); + } +}); +BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE"; +BI.shortcut('bi.preview_table', BI.PreviewTable);/** + * 季度下拉框 + * + * Created by GUY on 2015/8/28. + * @class BI.QuarterCombo + * @extends BI.Widget + */ +BI.QuarterCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.QuarterCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-quarter-combo", + behaviors: {}, + height: 25 + }); + }, + _init: function () { + BI.QuarterCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.storeValue = ""; + this.trigger = BI.createWidget({ + type: "bi.quarter_trigger" + }); + + this.trigger.on(BI.QuarterTrigger.EVENT_FOCUS, function () { + self.storeValue = this.getKey(); + }); + this.trigger.on(BI.QuarterTrigger.EVENT_CHANGE, function () { + self.combo.isViewVisible() && self.combo.hideView(); + }); + this.trigger.on(BI.QuarterTrigger.EVENT_START, function () { + self.combo.isViewVisible() && self.combo.hideView(); + }); + this.trigger.on(BI.QuarterTrigger.EVENT_STOP, function () { + if (!self.combo.isViewVisible()) { + self.combo.showView(); + } + }); + this.trigger.on(BI.QuarterTrigger.EVENT_CONFIRM, function () { + if (self.combo.isViewVisible()) { + return; + } + if (this.getKey() && this.getKey() !== self.storeValue) { + self.setValue(this.getKey()); + } else if (!this.getKey()) { + self.setValue(); + } + self.fireEvent(BI.QuarterCombo.EVENT_CONFIRM); + }); + this.popup = BI.createWidget({ + type: "bi.quarter_popup", + behaviors: o.behaviors + }); + + this.popup.on(BI.QuarterPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.QuarterCombo.EVENT_CONFIRM); + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: this.trigger, + popup: { + minWidth: 85, + el: this.popup + } + }); + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW); + }); + }, + + setValue: function (v) { + this.trigger.setValue(v); + this.popup.setValue(v); + }, + + getValue: function () { + return this.popup.getValue() || ""; + } +}); + +BI.QuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.shortcut('bi.quarter_combo', BI.QuarterCombo);/** + * 季度展示面板 + * + * Created by GUY on 2015/9/2. + * @class BI.QuarterPopup + * @extends BI.Trigger + */ +BI.QuarterPopup = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.QuarterPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-quarter-popup", + behaviors: {} + }); + }, + + _init: function () { + BI.QuarterPopup.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + var items = [{ + text: Date._QN[01], + value: 1 + }, { + text: Date._QN[2], + value: 2 + }, { + text: Date._QN[3], + value: 3 + }, { + text: Date._QN[4], + value: 4 + }]; + items = BI.map(items, function (j, item) { + return BI.extend(item, { + type: "bi.text_item", + cls: "bi-list-item-active", + textAlign: "left", + whiteSpace: "nowrap", + once: false, + forceSelected: true, + height: 25 + }); + }); + + this.quarter = BI.createWidget({ + type: "bi.button_group", + element: this, + behaviors: o.behaviors, + items: BI.createItems(items, {}), + layouts: [{ + type: "bi.vertical" + }] + }); + + this.quarter.on(BI.Controller.EVENT_CHANGE, function (type) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.MonthPopup.EVENT_CHANGE); + } + }) + }, + + getValue: function () { + return this.quarter.getValue()[0]; + }, + + setValue: function (v) { + this.quarter.setValue([v]); + } +}); +BI.QuarterPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.quarter_popup", BI.QuarterPopup);/** + * 季度trigger + * + * Created by GUY on 2015/8/21. + * @class BI.QuarterTrigger + * @extends BI.Trigger + */ +BI.QuarterTrigger = BI.inherit(BI.Trigger, { + _const: { + hgap: 4, + vgap: 2, + triggerWidth: 30, + textWidth: 40, + errorText: BI.i18nText("BI-Quarter_Trigger_Error_Text") + }, + + _defaultConfig: function () { + return BI.extend(BI.QuarterTrigger.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-quarter-trigger bi-border", + height: 25 + }); + }, + _init: function () { + BI.QuarterTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options, c = this._const; + this.editor = BI.createWidget({ + type: "bi.sign_editor", + height: o.height, + validationChecker: function (v) { + return v === "" || (BI.isPositiveInteger(v) && v >= 1 && v <= 4); + }, + quitChecker: function (v) { + return false; + }, + hgap: c.hgap, + vgap: c.vgap, + allowBlank: true, + errorText: c.errorText + }); + this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { + self.fireEvent(BI.QuarterTrigger.EVENT_FOCUS); + }); + this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { + self.fireEvent(BI.QuarterTrigger.EVENT_CHANGE); + }); + this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () { + var value = self.editor.getValue(); + if (BI.isNotNull(value)) { + self.editor.setValue(value); + self.editor.setTitle(value); + } + self.fireEvent(BI.QuarterTrigger.EVENT_CONFIRM); + }); + this.editor.on(BI.SignEditor.EVENT_SPACE, function () { + if (self.editor.isValid()) { + self.editor.blur(); + } + }); + this.editor.on(BI.SignEditor.EVENT_START, function () { + self.fireEvent(BI.QuarterTrigger.EVENT_START); + }); + this.editor.on(BI.SignEditor.EVENT_STOP, function () { + self.fireEvent(BI.QuarterTrigger.EVENT_STOP); + }); + + BI.createWidget({ + element: this, + type: 'bi.htape', + items: [ + { + el: this.editor + }, { + el: { + type: "bi.text_button", + baseCls: "bi-trigger-quarter-text", + text: BI.i18nText("BI-Multi_Date_Quarter"), + width: c.textWidth + }, + width: c.textWidth + }, { + el: { + type: "bi.trigger_icon_button", + width: c.triggerWidth + }, + width: c.triggerWidth + } + ] + }); + }, + + setValue: function (v) { + this.editor.setState(v); + this.editor.setValue(v); + this.editor.setTitle(v); + }, + + getKey: function () { + return this.editor.getValue(); + } +}); +BI.QuarterTrigger.EVENT_FOCUS = "EVENT_FOCUS"; +BI.QuarterTrigger.EVENT_CHANGE = "EVENT_CHANGE"; +BI.QuarterTrigger.EVENT_START = "EVENT_START"; +BI.QuarterTrigger.EVENT_STOP = "EVENT_STOP"; +BI.QuarterTrigger.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.shortcut("bi.quarter_trigger", BI.QuarterTrigger);/** + * 关联视图字段Item + * + * Created by GUY on 2015/12/23. + * @class BI.RelationViewItem + * @extends BI.Widget + */ +BI.RelationViewItem = BI.inherit(BI.BasicButton, { + + _defaultConfig: function () { + return BI.extend(BI.RelationViewItem.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-relation-view-item bi-list-item-active", + height: 25, + hoverIn: BI.emptyFn, + hoverOut: BI.emptyFn + }); + }, + + _init: function () { + BI.RelationViewItem.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.element.hover(o.hoverIn, o.hoverOut); + var items = []; + if (o.isPrimary) { + items.push({ + type: "bi.icon", + width: 16, + height: 16, + title: BI.i18nText("BI-Primary_Key") + }); + } + items.push({ + type: "bi.label", + text: o.text, + value: o.value, + height: o.height, + textAlign: "left", + width: o.isPrimary ? 70 : 90 + }); + BI.createWidget({ + type: "bi.vertical_adapt", + element: this, + items: items, + cls: "primary-key-font", + lgap: 5 + }); + }, + + enableHover: function (opt) { + BI.RelationViewRegion.superclass.enableHover.apply(this, [{ + container: "body" + }]); + }, + + setSelected: function (b) { + this.element[b ? "addClass" : "removeClass"]("active"); + } +}); +BI.shortcut('bi.relation_view_item', BI.RelationViewItem);/** + * 关联视图 + * + * Created by GUY on 2015/12/22. + * @class BI.RelationView + * @extends BI.Widget + */ +BI.RelationView = BI.inherit(BI.Widget, { + + _const: { + lineColor: "#c4c6c6", + selectLineColor: "#009de3" + }, + + _defaultConfig: function () { + return BI.extend(BI.RelationView.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-relation-view", + items: [] + }); + }, + + _init: function () { + BI.RelationView.superclass._init.apply(this, arguments); + this.populate(this.options.items); + }, + + _calculateWidths: function () { + var widths = []; + BI.each(this.views, function (i, items) { + BI.each(items, function (j, obj) { + if (!widths[j]) { + widths[j] = BI.MIN; + } + widths[j] = Math.max(widths[j], obj.getWidth()); + }) + }); + return widths; + }, + + _calculateHeights: function () { + var heights = BI.makeArray(BI.size(this.views), BI.MIN); + BI.each(this.views, function (i, items) { + BI.each(items, function (j, obj) { + heights[i] = Math.max(heights[i], obj.getHeight()); + }) + }); + return heights; + }, + + _hoverIn: function (target) { + var self = this, c = this._const; + BI.each(this.relations, function (start, rs) { + BI.each(rs, function (end, relation) { + if (relation[0].primary.value === target || relation[0].foreign.value === target) { + self.lines[start][end].attr("stroke", c.selectLineColor).toFront(); + self.storeViews[start].setValue(relation[0].primary.value); + self.storeViews[end].setValue(relation[0].foreign.value); + } + }); + }); + }, + + _hoverOut: function (target) { + var self = this, c = this._const; + BI.each(this.relations, function (start, rs) { + BI.each(rs, function (end, relation) { + if (relation[0].primary.value === target || relation[0].foreign.value === target) { + self.lines[start][end].attr("stroke", c.lineColor); + self.storeViews[start].setValue([]); + self.storeViews[end].setValue([]); + } + }); + }); + }, + + previewRelationTables: function(relationTables, show) { + if (!show) { + BI.each(this.storeViews, function (i, view) { + view.toggleRegion(true); + view.setPreviewSelected(false); + }); + BI.each(this.lines, function (i, lines) { + BI.each(lines, function (j, line) { + line.show(); + }); + }); + return; + } + BI.each(this.storeViews, function (id, view) { + if (!relationTables.contains(id)) { + view.toggleRegion(false); + } else { + view.setPreviewSelected(true); + } + }); + BI.each(this.lines, function (id, lines) { + BI.each(lines, function (cId, line) { + if (!relationTables.contains(id) || !relationTables.contains(cId)) { + line.hide(); + } + }); + }); + }, + + populate: function (items) { + var self = this, o = this.options, c = this._const; + o.items = items || []; + this.empty(); + this.svg = BI.createWidget({ + type: "bi.svg" + }); + + //算出所有的区域和关联 + var regions = this.regions = {}, relations = this.relations = {}; + BI.each(items, function (i, item) { + var pr = item.primary.region, fr = item.foreign && item.foreign.region; + if (pr && !relations[pr]) { + relations[pr] = {}; + } + if (pr && fr && !relations[pr][fr]) { + relations[pr][fr] = []; + } + if (pr && !regions[pr]) { + regions[pr] = []; + } + if (fr && !regions[fr]) { + regions[fr] = []; + } + if (pr && !BI.deepContains(regions[pr], item.primary)) { + regions[pr].push(item.primary); + } + if (fr && !BI.deepContains(regions[fr], item.foreign)) { + regions[fr].push(item.foreign); + } + pr && fr && relations[pr][fr].push(item); + }); + //求拓扑 + var topology = []; + var rs = BI.clone(regions), store = {}; + while (!BI.isEmpty(rs)) { + var clone = BI.clone(rs); + BI.each(o.items, function (i, item) { + if (!store[item.primary.region]) { + delete clone[item.foreign && item.foreign.region]; + } + }); + topology.push(BI.keys(clone)); + BI.extend(store, clone); + BI.each(clone, function (k, v) { + delete rs[k]; + }); + } + //构建视图 + var views = this.views = {}, storeViews = this.storeViews = {}, indexes = this.indexes = {}; + var verticals = []; + BI.each(topology, function (i, items) { + if (!views[i]) { + views[i] = {}; + } + var horizontal = []; + BI.each(items, function (j, region) { + var items = regions[region]; + views[i][j] = storeViews[region] = BI.createWidget({ + type: "bi.relation_view_region_container", + value: region, + header: items[0].regionTitle, + text: items.length > 0 ? items[0].regionText : "", + handler: items.length > 0 ? items[0].regionHandler : BI.emptyFn, + items: items, + belongPackage: items.length > 0 ? items[0].belongPackage : true + }); + if (BI.isNotNull(items[0]) && BI.isNotNull(items[0].keyword)) { + views[i][j].doRedMark(items[0].keyword); + } + views[i][j].on(BI.RelationViewRegionContainer.EVENT_HOVER_IN, function (v) { + self._hoverIn(v); + }); + views[i][j].on(BI.RelationViewRegionContainer.EVENT_HOVER_OUT, function (v) { + self._hoverOut(v); + }); + views[i][j].on(BI.RelationViewRegionContainer.EVENT_PREVIEW, function (v) { + self.fireEvent(BI.RelationView.EVENT_PREVIEW, region, v); + }); + indexes[region] = {i: i, j: j}; + horizontal.push(views[i][j]); + }); + verticals.push({ + type: "bi.horizontal", + items: horizontal + }) + }); + + //求每一行的高度 + var heights = this._calculateHeights(); + + //求每一列的宽度 + var widths = this._calculateWidths(); + + //求相对宽度和高度 + var offsetWidths = [0], offsetHeights = [0]; + BI.each(heights, function (i, h) { + if (i === 0) { + return; + } + offsetHeights[i] = offsetHeights[i - 1] + heights[i - 1]; + }); + BI.each(widths, function (i, w) { + if (i === 0) { + return; + } + offsetWidths[i] = offsetWidths[i - 1] + widths[i - 1]; + }); + + //画线 + var lines = this.lines = {};//缓存所有的线 + BI.each(relations, function (start, rs) { + BI.each(rs, function (end, relation) { + var startIndex = indexes[start], endIndex = indexes[end]; + var top = 0, right = 1, bottom = 2, left = 3; + var startDirection = bottom, endDirection = top; + // if (startIndex.j > endIndex.j) { + // startDirection = left; + // endDirection = right; + // } else if (startIndex.j < endIndex.j) { + // startDirection = right; + // endDirection = left; + // } else if (startIndex.i < endIndex.i) { + // startDirection = bottom; + // endDirection = top; + // } else if (startIndex.i > endIndex.i) { + // startDirection = top; + // endDirection = bottom; + // } + var draw = function (i, j, direction, isForeign) { + var x = offsetWidths[j] + (widths[j] - views[i][j].getWidth()) / 2; + var y = offsetHeights[i] + (heights[i] - views[i][j].getHeight()) / 2; + var path = "", position; + switch (direction) { + case top: + position = isForeign ? views[i][j].getTopRightPosition() : views[i][j].getTopLeftPosition(); + x += position.x; + y += position.y; + path = "M" + x + "," + y + "L" + x + "," + (y - 10); + y -= 10; + break; + case right: + position = views[i][j].getRightPosition(); + x += position.x; + y += position.y; + path = "M" + x + "," + y + "L" + (x + 10) + "," + y; + x += 10; + break; + case bottom: + position = views[i][j].getBottomPosition(); + x += position.x; + y += position.y; + path = "M" + x + "," + y + "L" + x + "," + (y + 10); + y += 10; + break; + case left: + position = views[i][j].getLeftPosition(); + x += position.x; + y += position.y; + path = "M" + x + "," + y + "L" + (x - 10) + "," + y; + x -= 10; + break; + } + return {x: x, y: y, path: path}; + }; + var path = ""; + var si = draw(startIndex.i, startIndex.j, startDirection); + var ei = draw(endIndex.i, endIndex.j, endDirection, true); + path += si.path + ei.path; + if (!lines[start]) { + lines[start] = {}; + } + path += "M" + si.x + "," + si.y + "L" + ei.x + "," + ei.y; + var line = lines[start][end] = self.svg.path(path) + .attr({"stroke": c.lineColor, "stroke-width": "2"}) + .hover(function () { + line.attr("stroke", c.selectLineColor).toFront(); + storeViews[start].setValue(relation[0].primary.value); + storeViews[end].setValue(relation[0].foreign.value); + }, function () { + line.attr("stroke", c.lineColor); + storeViews[start].setValue([]); + storeViews[end].setValue([]); + }); + }); + }); + var container = BI.createWidget(); + BI.createWidget({ + type: "bi.vertical", + element: container, + items: verticals + }); + BI.createWidget({ + type: "bi.absolute", + element: container, + items: [{ + el: this.svg, + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + }); + + BI.createWidget({ + type: "bi.center_adapt", + scrollable: true, + element: this, + items: [container] + }); + } +}); +BI.RelationView.EVENT_CHANGE = "RelationView.EVENT_CHANGE"; +BI.RelationView.EVENT_PREVIEW = "EVENT_PREVIEW"; +BI.shortcut('bi.relation_view', BI.RelationView);/** + * Created by Young's on 2017/3/10. + */ +BI.RelationViewRegionContainer = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.RelationViewRegionContainer.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-relation-view-region-container", + width: 150 + }); + }, + + _init: function () { + BI.RelationViewRegionContainer.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.region = BI.createWidget({ + type: "bi.relation_view_region", + value: o.value, + header: o.header, + text: o.text, + handler: o.handler, + items: o.items, + belongPackage: o.belongPackage + }); + this.region.on(BI.RelationViewRegion.EVENT_PREVIEW, function (v) { + self.fireEvent(BI.RelationViewRegionContainer.EVENT_PREVIEW, v); + }); + this.region.on(BI.RelationViewRegion.EVENT_HOVER_IN, function (v) { + self.fireEvent(BI.RelationViewRegionContainer.EVENT_HOVER_IN, v); + }); + this.region.on(BI.RelationViewRegion.EVENT_HOVER_OUT, function (v) { + self.fireEvent(BI.RelationViewRegionContainer.EVENT_HOVER_OUT, v); + }); + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.region], + width: this.region.getWidth(), + height: this.region.getHeight() + }); + }, + + doRedMark: function () { + this.region.doRedMark.apply(this.region, arguments); + }, + + unRedMark: function () { + this.region.unRedMark.apply(this.region, arguments); + }, + + getWidth: function () { + return this.region.getWidth(); + }, + + getHeight: function () { + return this.region.getHeight(); + }, + + //获取上方开始划线的位置 + getTopLeftPosition: function () { + return this.region.getTopLeftPosition(); + }, + + getTopRightPosition: function () { + return this.region.getTopRightPosition(); + }, + + getBottomPosition: function () { + return this.region.getBottomPosition(); + }, + + getLeftPosition: function () { + return this.region.getLeftPosition(); + }, + + getRightPosition: function () { + return this.region.getRightPosition(); + }, + + setValue: function (v) { + this.region.setValue(v); + }, + + toggleRegion: function (v) { + v === true ? this.region.element.fadeIn() : this.region.element.fadeOut(); + }, + + setPreviewSelected: function(v) { + this.region.setPreviewSelected(v); + } +}); +BI.RelationViewRegionContainer.EVENT_HOVER_IN = "RelationViewRegion.EVENT_HOVER_IN"; +BI.RelationViewRegionContainer.EVENT_HOVER_OUT = "RelationViewRegion.EVENT_HOVER_OUT"; +BI.RelationViewRegionContainer.EVENT_PREVIEW = "RelationViewRegion.EVENT_PREVIEW"; +BI.shortcut("bi.relation_view_region_container", BI.RelationViewRegionContainer);/** + * 关联视图 + * + * Created by GUY on 2015/12/23. + * @class BI.RelationViewRegion + * @extends BI.BasicButton + */ +BI.RelationViewRegion = BI.inherit(BI.BasicButton, { + + _defaultConfig: function () { + return BI.extend(BI.RelationViewRegion.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-relation-view-region cursor-pointer", + width: 150, + text: "", + value: "", + header: "", + items: [], + belongPackage: true + }); + }, + + _init: function () { + BI.RelationViewRegion.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.preview = BI.createWidget({ + type: "bi.icon_button", + cls: "relation-table-preview-font", + width: 25, + height: 25, + stopPropagation: true + }); + this.preview.on(BI.IconButton.EVENT_CHANGE, function () { + self.fireEvent(BI.RelationViewRegion.EVENT_PREVIEW, this.isSelected()); + }); + + this.title = BI.createWidget({ + type: "bi.label", + height: 25, + width: 70, + text: o.text, + value: o.value, + textAlign: "left" + }); + //title放body上 + if (BI.isKey(o.header)) { + this.title.setTitle(o.header, { + container: "body" + }) + } + + this.button_group = BI.createWidget({ + type: "bi.button_group", + items: this._createItems(o.items), + layouts: [{ + type: "bi.vertical" + }] + }); + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [{ + type: "bi.vertical", + cls: "relation-view-region-container bi-card bi-border " + (o.belongPackage ? "" : "other-package"), + items: [{ + type: "bi.vertical_adapt", + cls: "relation-view-region-title bi-border-bottom", + items: [this.preview, this.title] + }, this.button_group] + }], + hgap: 25, + vgap: 20 + }) + }, + + _createItems: function (items) { + var self = this; + return BI.map(items, function (i, item) { + return BI.extend(item, { + type: "bi.relation_view_item", + hoverIn: function () { + self.setValue(item.value); + self.fireEvent(BI.RelationViewRegion.EVENT_HOVER_IN, item.value); + }, + hoverOut: function () { + self.setValue([]); + self.fireEvent(BI.RelationViewRegion.EVENT_HOVER_OUT, item.value); + } + }) + }); + }, + + doRedMark: function () { + this.title.doRedMark.apply(this.title, arguments); + }, + + unRedMark: function () { + this.title.unRedMark.apply(this.title, arguments); + }, + + getWidth: function () { + return this.options.width; + }, + + getHeight: function () { + return this.button_group.getAllButtons().length * 25 + 25 + 2 * 20 + 3; + }, + + //获取上方开始划线的位置 + getTopLeftPosition: function () { + return { + x: 25 + 10, + y: 20 + } + }, + + getTopRightPosition: function () { + return { + x: this.getWidth() - 25 - 10, + y: 20 + } + }, + + getBottomPosition: function () { + return { + x: 25 + 10, + y: this.getHeight() - 20 + } + }, + + getLeftPosition: function () { + return { + x: 25, + y: 20 + 10 + } + }, + + getRightPosition: function () { + return { + x: this.getWidth() - 25, + y: 20 + 10 + } + }, + + setValue: function (v) { + this.button_group.setValue(v); + }, + + setPreviewSelected: function(v) { + this.preview.setSelected(v); + } +}); +BI.RelationViewRegion.EVENT_HOVER_IN = "RelationViewRegion.EVENT_HOVER_IN"; +BI.RelationViewRegion.EVENT_HOVER_OUT = "RelationViewRegion.EVENT_HOVER_OUT"; +BI.RelationViewRegion.EVENT_PREVIEW = "RelationViewRegion.EVENT_PREVIEW"; +BI.shortcut('bi.relation_view_region', BI.RelationViewRegion);/** + * 自适应宽度的表格 + * + * Created by GUY on 2016/2/3. + * @class BI.ResponisveTable + * @extends BI.Widget + */ +BI.ResponisveTable = BI.inherit(BI.Widget, { + + _const: { + perColumnSize: 100 + }, + + _defaultConfig: function () { + return BI.extend(BI.ResponisveTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-responsive-table", + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 + + isNeedMerge: false,//是否需要合并单元格 + mergeCols: [], //合并的单元格列号 + mergeRule: function (row1, row2) { //合并规则, 默认相等时合并 + return BI.isEqual(row1, row2); + }, + + columnSize: [], + headerRowSize: 25, + footerRowSize: 25, + rowSize: 25, + + regionColumnSize: false, + + header: [], + footer: false, + items: [], //二维数组 + + //交叉表头 + crossHeader: [], + crossItems: [] + }); + }, + + _init: function () { + BI.ResponisveTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.table = BI.createWidget({ + type: "bi.table_view", + element: this, + + isNeedFreeze: o.isNeedFreeze, + freezeCols: o.freezeCols, + + isNeedMerge: o.isNeedMerge, + mergeCols: o.mergeCols, + mergeRule: o.mergeRule, + + columnSize: o.columnSize, + headerRowSize: o.headerRowSize, + footerRowSize: o.footerRowSize, + rowSize: o.rowSize, + + regionColumnSize: o.regionColumnSize, + + header: o.header, + footer: o.footer, + items: o.items, + //交叉表头 + crossHeader: o.crossHeader, + crossItems: o.crossItems + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () { + self._initRegionSize(); + self.table.resize(); + self._resizeHeader(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () { + self._resizeRegion(); + self._resizeHeader(); + self.fireEvent(BI.Table.EVENT_TABLE_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () { + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE, function () { + self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_REGION_RESIZE, function () { + //important:在冻结并自适应列宽的情况下要随时变更表头宽度 + if (o.isNeedResize === true && self._isAdaptiveColumn()) { + self._resizeHeader(); + } + self.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + self._resizeHeader(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); + }); + + this.table.on(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE, function () { + self._resizeBody(); + self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_COLUMN_RESIZE, function () { + self.fireEvent(BI.Table.EVENT_TABLE_COLUMN_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + self._resizeRegion(); + self._resizeHeader(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); + }); + }, + + _initRegionSize: function () { + var o = this.options; + if (o.isNeedFreeze === true) { + var regionColumnSize = this.table.getRegionColumnSize(); + var maxWidth = this.table.element.width(); + if (!regionColumnSize[0] || (regionColumnSize[0] === 'fill') || regionColumnSize[0] > maxWidth || regionColumnSize[1] > maxWidth) { + var freezeCols = o.freezeCols; + if (freezeCols.length === 0) { + this.table.setRegionColumnSize([0, "fill"]); + } else if (freezeCols.length > 0 && freezeCols.length < o.columnSize.length) { + var size = maxWidth / 3; + if (freezeCols.length > o.columnSize.length / 2) { + size = maxWidth * 2 / 3; + } + this.table.setRegionColumnSize([size, "fill"]); + } else { + this.table.setRegionColumnSize(["fill", 0]); + } + } + } + }, + + _getBlockSize: function () { + var o = this.options; + var columnSize = this.table.getCalculateColumnSize(); + if (o.isNeedFreeze === true) { + var columnSizeLeft = [], columnSizeRight = []; + BI.each(columnSize, function (i, size) { + if (o.freezeCols.contains(i)) { + columnSizeLeft.push(size); + } else { + columnSizeRight.push(size); + } + }); + //因为有边框,所以加上数组长度的参数调整 + var sumLeft = BI.sum(columnSizeLeft) + columnSizeLeft.length, + sumRight = BI.sum(columnSizeRight) + columnSizeRight.length; + return { + sumLeft: sumLeft, + sumRight: sumRight, + left: columnSizeLeft, + right: columnSizeRight + } + } + return { + size: columnSize, + sum: BI.sum(columnSize) + columnSize.length + }; + }, + + _isAdaptiveColumn: function (columnSize) { + return !(BI.last(columnSize || this.table.getColumnSize()) > 1.05); + }, + + _resizeHeader: function () { + var self = this, o = this.options; + if (o.isNeedFreeze === true) { + //若是当前处于自适应调节阶段 + if (this._isAdaptiveColumn()) { + var columnSize = this.table.getCalculateColumnSize(); + this.table.setHeaderColumnSize(columnSize); + } else { + var regionColumnSize = this.table.getClientRegionColumnSize(); + var block = this._getBlockSize(); + var sumLeft = block.sumLeft, sumRight = block.sumRight; + var columnSizeLeft = block.left, columnSizeRight = block.right; + columnSizeLeft[columnSizeLeft.length - 1] += regionColumnSize[0] - sumLeft; + columnSizeRight[columnSizeRight.length - 1] += regionColumnSize[1] - sumRight; + + var newLeft = BI.clone(columnSizeLeft), newRight = BI.clone(columnSizeRight); + newLeft[newLeft.length - 1] = ""; + newRight[newRight.length - 1] = ""; + this.table.setColumnSize(newLeft.concat(newRight)); + + block = self._getBlockSize(); + if (columnSizeLeft[columnSizeLeft.length - 1] < block.left[block.left.length - 1]) { + columnSizeLeft[columnSizeLeft.length - 1] = block.left[block.left.length - 1] + } + if (columnSizeRight[columnSizeRight.length - 1] < block.right[block.right.length - 1]) { + columnSizeRight[columnSizeRight.length - 1] = block.right[block.right.length - 1] + } + + self.table.setColumnSize(columnSizeLeft.concat(columnSizeRight)); + } + } else { + if (!this._isAdaptiveColumn()) { + var regionColumnSize = this.table.getClientRegionColumnSize(); + var block = this._getBlockSize(); + var sum = block.sum; + var size = block.size; + + size[size.length - 1] += regionColumnSize[0] - sum; + + var newSize = BI.clone(size); + newSize[newSize.length - 1] = ""; + this.table.setColumnSize(newSize); + block = this._getBlockSize(); + + if (size[size.length - 1] < block.size[block.size.length - 1]) { + size[size.length - 1] = block.size[block.size.length - 1] + } + this.table.setColumnSize(size); + } + } + }, + + _resizeBody: function () { + if (this._isAdaptiveColumn()) { + var columnSize = this.table.getCalculateColumnSize(); + this.setColumnSize(columnSize); + } + }, + + _adjustRegion: function () { + var o = this.options; + var regionColumnSize = this.table.getCalculateRegionColumnSize(); + if (o.isNeedFreeze === true && o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) { + var block = this._getBlockSize(); + var sumLeft = block.sumLeft, sumRight = block.sumRight; + if (sumLeft < regionColumnSize[0] || regionColumnSize[0] >= (sumLeft + sumRight)) { + this.table.setRegionColumnSize([sumLeft, "fill"]); + } + this._resizeRegion(); + } + }, + + _resizeRegion: function () { + var o = this.options; + var regionColumnSize = this.table.getCalculateRegionColumnSize(); + if (o.isNeedFreeze === true && o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) { + var maxWidth = this.table.element.width(); + if (regionColumnSize[0] < 15 || regionColumnSize[1] < 15) { + var freezeCols = o.freezeCols; + var size = maxWidth / 3; + if (freezeCols.length > o.columnSize.length / 2) { + size = maxWidth * 2 / 3; + } + this.table.setRegionColumnSize([size, "fill"]); + } + } + }, + + + resize: function () { + this.table.resize(); + this._resizeRegion(); + this._resizeHeader(); + }, + + setColumnSize: function (columnSize) { + this.table.setColumnSize(columnSize); + this._adjustRegion(); + this._resizeHeader(); + }, + + getColumnSize: function () { + return this.table.getColumnSize(); + }, + + getCalculateColumnSize: function () { + return this.table.getCalculateColumnSize(); + }, + + setHeaderColumnSize: function (columnSize) { + this.table.setHeaderColumnSize(columnSize); + this._adjustRegion(); + this._resizeHeader(); + }, + + setRegionColumnSize: function (columnSize) { + this.table.setRegionColumnSize(columnSize); + this._resizeHeader(); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + getCalculateRegionColumnSize: function () { + return this.table.getCalculateRegionColumnSize(); + }, + + getCalculateRegionRowSize: function () { + return this.table.getCalculateRegionRowSize(); + }, + + getClientRegionColumnSize: function () { + return this.table.getClientRegionColumnSize(); + }, + + getScrollRegionColumnSize: function () { + return this.table.getScrollRegionColumnSize(); + }, + + getScrollRegionRowSize: function () { + return this.table.getScrollRegionRowSize(); + }, + + hasVerticalScroll: function () { + return this.table.hasVerticalScroll(); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + getLeftHorizontalScroll: function () { + return this.table.getLeftHorizontalScroll(); + }, + + getRightHorizontalScroll: function () { + return this.table.getRightHorizontalScroll(); + }, + + getColumns: function () { + return this.table.getColumns(); + }, + + attr: function () { + BI.ResponisveTable.superclass.attr.apply(this, arguments); + this.table.attr.apply(this.table, arguments); + }, + + populate: function (items) { + var self = this, o = this.options; + this.table.populate.apply(this.table, arguments); + if (o.isNeedFreeze === true) { + BI.nextTick(function () { + self._initRegionSize(); + self.table.resize(); + self._resizeHeader(); + }); + } + } +}); +BI.shortcut('bi.responsive_table', BI.ResponisveTable);/** + * 加号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.SelectTreeFirstPlusGroupNode + * @extends BI.NodeButton + */ +BI.SelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.SelectTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-select-tree-first-plus-group-node bi-list-item-active", + logic: { + dynamic: false + }, + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) + }, + _init: function () { + BI.SelectTreeFirstPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.first_tree_node_checkbox", + stopPropagation: true + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.triggerExpand(); + } else { + self.triggerCollapse(); + } + } + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + isOnce: function () { + return true; + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.NodeButton.superclass.doClick.apply(this, arguments); + }, + + setOpened: function (v) { + BI.SelectTreeFirstPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.checkbox)) { + this.checkbox.setSelected(v); + } + } +}); + +BI.shortcut("bi.select_tree_first_plus_group_node", BI.SelectTreeFirstPlusGroupNode);/** + * 加号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.SelectTreeLastPlusGroupNode + * @extends BI.NodeButton + */ +BI.SelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.SelectTreeLastPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-select-tree-last-plus-group-node bi-list-item-active", + logic: { + dynamic: false + }, + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) + }, + _init: function () { + BI.SelectTreeLastPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.last_tree_node_checkbox", + stopPropagation: true + }) + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.triggerExpand(); + } else { + self.triggerCollapse(); + } + } + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + isOnce: function () { + return true; + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.NodeButton.superclass.doClick.apply(this, arguments); + }, + + setOpened: function (v) { + BI.SelectTreeLastPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.checkbox)) { + this.checkbox.setSelected(v); + } + } +}); + +BI.shortcut("bi.select_tree_last_plus_group_node", BI.SelectTreeLastPlusGroupNode);/** + * 加号表示的组节点 + * Created by GUY on 2015/9/6. + * @class BI.SelectTreeMidPlusGroupNode + * @extends BI.NodeButton + */ +BI.SelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { + _defaultConfig: function () { + var conf = BI.SelectTreeMidPlusGroupNode.superclass._defaultConfig.apply(this, arguments); + return BI.extend(conf, { + baseCls: (conf.baseCls || "") + " bi-select-tree-mid-plus-group-node bi-list-item-active", + logic: { + dynamic: false + }, + id: "", + pId: "", + readonly: true, + open: false, + height: 25 + }) + }, + _init: function () { + BI.SelectTreeMidPlusGroupNode.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.checkbox = BI.createWidget({ + type: "bi.mid_tree_node_checkbox", + stopPropagation: true + }); + this.text = BI.createWidget({ + type: "bi.label", + textAlign: "left", + whiteSpace: "nowrap", + textHeight: o.height, + height: o.height, + hgap: o.hgap, + text: o.text, + value: o.value, + py: o.py + }); + this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.triggerExpand(); + } else { + self.triggerCollapse(); + } + } + }); + var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); + var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { + width: 25, + el: this.checkbox + }, this.text); + BI.createWidget(BI.extend({ + element: this + }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { + items: items + })))); + }, + + isOnce: function () { + return true; + }, + + doRedMark: function () { + this.text.doRedMark.apply(this.text, arguments); + }, + + unRedMark: function () { + this.text.unRedMark.apply(this.text, arguments); + }, + + doClick: function () { + BI.NodeButton.superclass.doClick.apply(this, arguments); + }, + + setOpened: function (v) { + BI.SelectTreeMidPlusGroupNode.superclass.setOpened.apply(this, arguments); + if (BI.isNotNull(this.checkbox)) { + this.checkbox.setSelected(v); + } + } +}); + +BI.shortcut("bi.select_tree_mid_plus_group_node", BI.SelectTreeMidPlusGroupNode);/** + * @class BI.SelectTreeCombo + * @extends BI.Widget + */ +BI.SelectTreeCombo = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.SelectTreeCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-select-tree-combo", + height: 30, + text: "", + items: [] + }); + }, + + _init: function () { + BI.SelectTreeCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.trigger = BI.createWidget({ + type: "bi.single_tree_trigger", + text: o.text, + height: o.height, + items: o.items + }); + + this.popup = BI.createWidget({ + type: "bi.select_tree_popup", + items: o.items + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup + } + }); + + this.combo.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.popup.on(BI.SingleTreePopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + }); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.trigger.setValue(v); + this.popup.setValue(v); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + populate: function (items) { + this.combo.populate(items); + } +}); + + +BI.shortcut("bi.select_tree_combo", BI.SelectTreeCombo);/** + * @class BI.SelectTreeExpander + * @extends BI.Widget + */ +BI.SelectTreeExpander = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.SelectTreeExpander.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-select-tree-expander", + trigger: "click", + toggle: true, + direction: "bottom", + isDefaultInit: true, + el: {}, + popup: {} + }); + }, + + _init: function () { + BI.SelectTreeExpander.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.trigger = BI.createWidget(BI.extend({stopPropagation: true}, o.el)); + this.trigger.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + if (this.isSelected()) { + self.expander.setValue([]); + } + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.expander = BI.createWidget({ + type: "bi.expander", + element: this, + trigger: o.trigger, + toggle: o.toggle, + direction: o.direction, + isDefaultInit: o.isDefaultInit, + el: this.trigger, + popup: o.popup + }); + this.expander.on(BI.Controller.EVENT_CHANGE, function (type) { + if (type === BI.Events.CLICK) { + self.trigger.setSelected(false); + } + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + }, + + setValue: function (v) { + if (BI.contains(v, this.trigger.getValue())) { + this.trigger.setSelected(true); + this.expander.setValue([]); + } else { + this.trigger.setSelected(false); + this.expander.setValue(v); + } + }, + + getValue: function () { + if (this.trigger.isSelected()) { + return [this.trigger.getValue()]; + } + return this.expander.getValue(); + }, + + populate: function (items) { + this.expander.populate(items); + } +}); + +BI.shortcut("bi.select_tree_expander", BI.SelectTreeExpander);/** + * @class BI.SelectTreePopup + * @extends BI.Pane + */ + +BI.SelectTreePopup = BI.inherit(BI.Pane, { + + _defaultConfig: function () { + return BI.extend(BI.SelectTreePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-select-tree-popup", + tipText: BI.i18nText("BI-No_Selected_Item"), + items: [] + }); + }, + + _formatItems: function (nodes, layer) { + var self = this; + BI.each(nodes, function (i, node) { + var extend = {layer: layer}; + node.id = node.id || BI.UUID(); + if (node.isParent === true || BI.isNotEmptyArray(node.children)) { + switch (i) { + case 0 : + extend.type = "bi.select_tree_first_plus_group_node"; + break; + case nodes.length - 1 : + extend.type = "bi.select_tree_last_plus_group_node"; + break; + default : + extend.type = "bi.select_tree_mid_plus_group_node"; + break; + } + BI.defaults(node, extend); + self._formatItems(node.children); + } else { + switch (i) { + case nodes.length - 1: + extend.type = "bi.last_tree_leaf_item"; + break; + default : + extend.type = "bi.mid_tree_leaf_item"; + } + BI.defaults(node, extend); + } + }); + return nodes; + }, + + _init: function () { + BI.SelectTreePopup.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + + this.tree = BI.createWidget({ + type: 'bi.level_tree', + expander: { + type: "bi.select_tree_expander", + isDefaultInit: true + }, + items: this._formatItems(BI.Tree.transformToTreeFormat(o.items)), + chooseType: BI.Selection.Single + }); + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.tree] + }); + + this.tree.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.tree.on(BI.LevelTree.EVENT_CHANGE, function () { + self.fireEvent(BI.SelectTreePopup.EVENT_CHANGE); + }); + + this.check(); + }, + + getValue: function () { + return this.tree.getValue(); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.tree.setValue(v); + }, + + populate: function (items) { + BI.SelectTreePopup.superclass.populate.apply(this, arguments); + this.tree.populate(items); + } +}); + +BI.SelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.select_tree_popup", BI.SelectTreePopup);/** + * + * Created by GUY on 2016/8/10. + * @class BI.SequenceTableDynamicNumber + * @extends BI.SequenceTableTreeNumber + */ +BI.SequenceTableDynamicNumber = BI.inherit(BI.SequenceTableTreeNumber, { + + _defaultConfig: function () { + return BI.extend(BI.SequenceTableDynamicNumber.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-sequence-table-dynamic-number" + }); + }, + + _init: function () { + BI.SequenceTableDynamicNumber.superclass._init.apply(this, arguments); + }, + + _formatNumber: function (nodes) { + var self = this, o = this.options; + var result = []; + var count = this._getStart(nodes); + + function getLeafCount(node) { + var cnt = 0; + if (BI.isNotEmptyArray(node.children)) { + BI.each(node.children, function (index, child) { + cnt += getLeafCount(child); + }); + if (node.children.length > 1 && BI.isNotEmptyArray(node.values)) { + cnt++; + } + } else { + cnt++; + } + return cnt; + } + + var start = 0, top = 0; + BI.each(nodes, function (i, node) { + if (BI.isArray(node.children)) { + BI.each(node.children, function (index, child) { + var cnt = getLeafCount(child); + result.push({ + text: count++, + start: start, + top: top, + cnt: cnt, + index: index, + height: cnt * o.rowSize + }); + start += cnt; + top += cnt * o.rowSize; + }); + if (BI.isNotEmptyArray(node.values)) { + result.push({ + text: BI.i18nText("BI-Summary_Values"), + start: start++, + top: top, + cnt: 1, + isSummary: true, + height: o.rowSize + }); + top += o.rowSize; + } + } + }); + return result; + } +}); +BI.shortcut('bi.sequence_table_dynamic_number', BI.SequenceTableDynamicNumber);/** + * + * Created by GUY on 2016/5/26. + * @class BI.SequenceTableListNumber + * @extends BI.Widget + */ +BI.SequenceTableListNumber = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.SequenceTableListNumber.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-sequence-table-list-number", + isNeedFreeze: false, + scrollTop: 0, + startSequence: 1,//开始的序号 + headerRowSize: 25, + rowSize: 25, + + sequenceHeaderCreator: null, + + header: [], + items: [], //二维数组 + + //交叉表头 + crossHeader: [], + crossItems: [], + + pageSize: 20 + }); + }, + + _init: function () { + BI.SequenceTableListNumber.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.start = o.startSequence; + this.renderedCells = []; + this.renderedKeys = []; + + this.container = BI.createWidget({ + type: "bi.absolute", + width: 60, + scrollable: false + }); + + this.scrollContainer = BI.createWidget({ + type: "bi.vertical", + scrollable: false, + scrolly: false, + items: [this.container] + }); + + this.headerContainer = BI.createWidget({ + type: "bi.absolute", + cls: "bi-border", + width: 58, + scrollable: false + }); + + this.layout = BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: this.headerContainer, + height: o.headerRowSize * o.header.length - 2 + }, { + el: {type: "bi.layout"}, + height: 2 + }, { + el: this.scrollContainer + }] + }); + this._populate(); + }, + + _layout: function () { + var self = this, o = this.options; + var headerHeight = o.headerRowSize * o.header.length - 2; + var items = this.layout.attr("items"); + if (o.isNeedFreeze === false) { + items[0].height = 0; + items[1].height = 0; + } else if (o.isNeedFreeze === true) { + items[0].height = headerHeight; + items[1].height = 2; + } + this.layout.attr("items", items); + this.layout.resize(); + this.container.setHeight(o.items.length * o.rowSize); + try { + this.scrollContainer.element.scrollTop(o.scrollTop); + } catch (e) { + + } + }, + + _createHeader: function () { + var o = this.options; + BI.createWidget({ + type: "bi.absolute", + element: this.headerContainer, + items: [{ + el: o.sequenceHeaderCreator || { + type: "bi.table_style_cell", + cls: "sequence-table-title-cell", + styleGetter: o.headerCellStyleGetter, + text: BI.i18nText("BI-Number_Index") + }, + left: 0, + top: 0, + right: 0, + bottom: 0 + }] + }); + }, + + _calculateChildrenToRender: function () { + var self = this, o = this.options; + var scrollTop = BI.clamp(o.scrollTop, 0, o.rowSize * o.items.length - (o.height - o.header.length * o.headerRowSize) + BI.DOM.getScrollWidth()); + var start = Math.floor(scrollTop / o.rowSize); + var end = start + Math.floor((o.height - o.header.length * o.headerRowSize) / o.rowSize); + var renderedCells = [], renderedKeys = []; + for (var i = start, cnt = 0; i <= end && i < o.items.length; i++, cnt++) { + var index = BI.deepIndexOf(this.renderedKeys, this.start + i); + var top = i * o.rowSize; + if (index > -1) { + if (o.rowSize !== this.renderedCells[index]._height) { + this.renderedCells[index]._height = o.rowSize; + this.renderedCells[index].el.setHeight(o.rowSize); + } + if (this.renderedCells[index].top !== top) { + this.renderedCells[index].top = top; + this.renderedCells[index].el.element.css("top", top + "px"); + } + renderedCells.push(this.renderedCells[index]); + } else { + var child = BI.createWidget(BI.extend({ + type: "bi.table_style_cell", + cls: "sequence-table-number-cell bi-border-left bi-border-right bi-border-bottom", + width: 60, + height: o.rowSize, + text: this.start + i, + styleGetter: function (index) { + return function () { + return o.sequenceCellStyleGetter(self.start + i - 1); + } + }(cnt) + })); + renderedCells.push({ + el: child, + left: 0, + top: top, + _height: o.rowSize + }); + } + renderedKeys.push(this.start + i); + } + + //已存在的, 需要添加的和需要删除的 + var existSet = {}, addSet = {}, deleteArray = []; + BI.each(renderedKeys, function (i, key) { + if (BI.deepContains(self.renderedKeys, key)) { + existSet[i] = key; + } else { + addSet[i] = key; + } + }); + BI.each(this.renderedKeys, function (i, key) { + if (BI.deepContains(existSet, key)) { + return; + } + if (BI.deepContains(addSet, key)) { + return; + } + deleteArray.push(i); + }); + BI.each(deleteArray, function (i, index) { + self.renderedCells[index].el.destroy(); + }); + var addedItems = []; + BI.each(addSet, function (index) { + addedItems.push(renderedCells[index]) + }); + BI.createWidget({ + type: "bi.absolute", + element: this.container, + items: addedItems + }); + this.renderedCells = renderedCells; + this.renderedKeys = renderedKeys; + }, + + _populate: function () { + this.headerContainer.empty(); + this._createHeader(); + this._layout(); + this._calculateChildrenToRender(); + }, + + setVerticalScroll: function (scrollTop) { + if (this.options.scrollTop !== scrollTop) { + this.options.scrollTop = scrollTop; + try { + this.scrollContainer.element.scrollTop(scrollTop); + } catch (e) { + + } + } + }, + + getVerticalScroll: function () { + return this.options.scrollTop; + }, + + setVPage: function (v) { + v = v < 1 ? 1 : v; + var o = this.options; + this.start = (v - 1) * o.pageSize + 1; + }, + + _restore: function () { + var o = this.options; + BI.each(this.renderedCells, function (i, cell) { + cell.el.destroy(); + }); + this.renderedCells = []; + this.renderedKeys = []; + }, + + restore: function () { + this._restore(); + }, + + populate: function (items, header) { + var o = this.options; + if (items && items !== this.options.items) { + o.items = items; + this._restore(); + } + if (header && header !== this.options.header) { + o.header = header; + } + this._populate(); + } +}); +BI.shortcut('bi.sequence_table_list_number', BI.SequenceTableListNumber);/** + * 带有序号的表格 + * + * Created by GUY on 2016/5/26. + * @class BI.SequenceTable + * @extends BI.Widget + */ +BI.SequenceTable = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.SequenceTable.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-sequence-table", + el: { + type: "bi.adaptive_table" + }, + + sequence: {}, + + isNeedResize: true, + isResizeAdapt: false, + + isNeedFreeze: false,//是否需要冻结单元格 + freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效 + + isNeedMerge: false,//是否需要合并单元格 + mergeCols: [], //合并的单元格列号 + mergeRule: BI.emptyFn, + + columnSize: [], + minColumnSize: [], + maxColumnSize: [], + headerRowSize: 25, + rowSize: 25, + + regionColumnSize: [], + + headerCellStyleGetter: BI.emptyFn, + summaryCellStyleGetter: BI.emptyFn, + sequenceCellStyleGetter: BI.emptyFn, + + header: [], + items: [], //二维数组 + + //交叉表头 + crossHeader: [], + crossItems: [], + + showSequence: false, + startSequence: 1//开始的序号 + }); + }, + + _init: function () { + BI.SequenceTable.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.sequence = BI.createWidget(o.sequence, { + type: "bi.sequence_table_list_number", + invisible: o.showSequence === false, + startSequence: o.startSequence, + isNeedFreeze: o.isNeedFreeze, + header: o.header, + items: o.items, + crossHeader: o.crossHeader, + crossItems: o.crossItems, + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + width: 60, + height: o.height && o.height - BI.GridTableScrollbar.SIZE, + + headerCellStyleGetter: o.headerCellStyleGetter, + summaryCellStyleGetter: o.summaryCellStyleGetter, + sequenceCellStyleGetter: o.sequenceCellStyleGetter + }); + this.table = BI.createWidget(o.el, { + type: "bi.adaptive_table", + width: o.showSequence === true ? o.width - 60 : o.width, + height: o.height, + isNeedResize: o.isNeedResize, + isResizeAdapt: o.isResizeAdapt, + + isNeedFreeze: o.isNeedFreeze, + freezeCols: o.freezeCols, + + isNeedMerge: o.isNeedMerge, + mergeCols: o.mergeCols, + mergeRule: o.mergeRule, + + columnSize: o.columnSize, + minColumnSize: o.minColumnSize, + maxColumnSize: o.maxColumnSize, + headerRowSize: o.headerRowSize, + rowSize: o.rowSize, + + regionColumnSize: o.regionColumnSize, + + headerCellStyleGetter: o.headerCellStyleGetter, + summaryCellStyleGetter: o.summaryCellStyleGetter, + sequenceCellStyleGetter: o.sequenceCellStyleGetter, + + header: o.header, + items: o.items, + //交叉表头 + crossHeader: o.crossHeader, + crossItems: o.crossItems + }); + + this.table.on(BI.Table.EVENT_TABLE_SCROLL, function (scroll) { + if (self.sequence.getVerticalScroll() !== this.getVerticalScroll()) { + self.sequence.setVerticalScroll(this.getVerticalScroll()); + self.sequence.populate(); + } + self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments); + }); + this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () { + o.regionColumnSize = this.getRegionColumnSize(); + o.columnSize = this.getColumnSize(); + self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments); + }); + + this.htape = BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.sequence, + left: 0, + top: 0 + }, { + el: this.table, + top: 0, + left: o.showSequence === true ? 60 : 0 + }] + }); + this._populate(); + }, + + _populate: function () { + var o = this.options; + if (o.showSequence === true) { + this.sequence.setVisible(true); + this.table.element.css("left", "60px"); + this.table.setWidth(o.width - 60); + } else { + this.sequence.setVisible(false); + this.table.element.css("left", "0px"); + this.table.setWidth(o.width); + } + }, + + setWidth: function (width) { + BI.PageTable.superclass.setWidth.apply(this, arguments); + this.table.setWidth(this.options.showSequence ? width - 60 : width); + }, + + setHeight: function (height) { + BI.PageTable.superclass.setHeight.apply(this, arguments); + this.table.setHeight(height); + this.sequence.setHeight(height - BI.GridTableScrollbar.SIZE); + }, + + setColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this.table.setColumnSize(columnSize); + }, + + getColumnSize: function () { + return this.table.getColumnSize(); + }, + + setRegionColumnSize: function (columnSize) { + this.options.columnSize = columnSize; + this.table.setRegionColumnSize(columnSize); + }, + + getRegionColumnSize: function () { + return this.table.getRegionColumnSize(); + }, + + hasLeftHorizontalScroll: function () { + return this.table.hasLeftHorizontalScroll(); + }, + + hasRightHorizontalScroll: function () { + return this.table.hasRightHorizontalScroll(); + }, + + setLeftHorizontalScroll: function (scrollLeft) { + this.table.setLeftHorizontalScroll(scrollLeft); + }, + + setRightHorizontalScroll: function (scrollLeft) { + this.table.setRightHorizontalScroll(scrollLeft); + }, + + setVerticalScroll: function (scrollTop) { + this.table.setVerticalScroll(scrollTop); + this.sequence.setVerticalScroll(scrollTop); + }, + + getVerticalScroll: function () { + return this.table.getVerticalScroll(); + }, + + setVPage: function (page) { + this.sequence.setVPage && this.sequence.setVPage(page); + }, + + setHPage: function (page) { + this.sequence.setHPage && this.sequence.setHPage(page); + }, + + attr: function () { + BI.SequenceTable.superclass.attr.apply(this, arguments); + this.table.attr.apply(this.table, arguments); + this.sequence.attr.apply(this.sequence, arguments); + }, + + restore: function () { + this.table.restore(); + this.sequence.restore(); + }, + + populate: function (items, header, crossItems, crossHeader) { + var o = this.options; + if (items) { + o.items = items; + } + if (header) { + o.header = header; + } + if (crossItems) { + o.crossItems = crossItems; + } + if (crossHeader) { + o.crossHeader = crossHeader; + } + this._populate(); + this.table.populate.apply(this.table, arguments); + this.sequence.populate.apply(this.sequence, arguments); + this.sequence.setVerticalScroll(this.table.getVerticalScroll()); + }, + + destroy: function () { + this.table.destroy(); + BI.SequenceTable.superclass.destroy.apply(this, arguments); + } +}); +BI.shortcut('bi.sequence_table', BI.SequenceTable);/** + * @class BI.SingleTreeCombo + * @extends BI.Widget + */ +BI.SingleTreeCombo = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.SingleTreeCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-single-tree-combo", + trigger: {}, + height: 30, + text: "", + items: [] + }); + }, + + _init: function () { + BI.SingleTreeCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.trigger = BI.createWidget(BI.extend({ + type: "bi.single_tree_trigger", + text: o.text, + height: o.height, + items: o.items + }, o.trigger)); + + this.popup = BI.createWidget({ + type: "bi.single_tree_popup", + items: o.items + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup + } + }); + + this.combo.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.SingleTreeCombo.EVENT_BEFORE_POPUPVIEW, arguments); + }); + + this.popup.on(BI.SingleTreePopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.SingleTreeCombo.EVENT_CHANGE); + }); + }, + + populate: function (items) { + this.combo.populate(items); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.trigger.setValue(v); + this.popup.setValue(v); + }, + + getValue: function () { + return this.popup.getValue(); + } +}); + +BI.SingleTreeCombo.EVENT_CHANGE = "SingleTreeCombo.EVENT_CHANGE"; +BI.SingleTreeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.shortcut("bi.single_tree_combo", BI.SingleTreeCombo);/** + * @class BI.SingleTreePopup + * @extends BI.Pane + */ + +BI.SingleTreePopup = BI.inherit(BI.Pane, { + + _defaultConfig: function () { + return BI.extend(BI.SingleTreePopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-single-tree-popup", + tipText: BI.i18nText("BI-No_Selected_Item"), + items: [] + }); + }, + + _init: function () { + BI.SingleTreePopup.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + + this.tree = BI.createWidget({ + type: 'bi.level_tree', + expander: { + isDefaultInit: true + }, + items: o.items, + chooseType: BI.Selection.Single + }); + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.tree] + }); + + this.tree.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + + this.tree.on(BI.LevelTree.EVENT_CHANGE, function () { + self.fireEvent(BI.SingleTreePopup.EVENT_CHANGE); + }); + + this.check(); + }, + + getValue: function () { + return this.tree.getValue(); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.tree.setValue(v); + }, + + populate: function (items) { + BI.SingleTreePopup.superclass.populate.apply(this, arguments); + this.tree.populate(items); + } +}); + +BI.SingleTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.single_tree_popup", BI.SingleTreePopup);/** + * @class BI.SingleTreeTrigger + * @extends BI.Trigger + */ + +BI.SingleTreeTrigger = BI.inherit(BI.Trigger, { + + _defaultConfig: function () { + return BI.extend(BI.SingleTreeTrigger.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-single-tree-trigger", + height: 30, + text: "", + items: [] + }); + }, + + _init: function () { + BI.SingleTreeTrigger.superclass._init.apply(this, arguments); + + var self = this, o = this.options; + + this.trigger = BI.createWidget({ + type: "bi.select_text_trigger", + element: this, + text: o.text, + items: o.items, + height: o.height + }); + }, + + _checkTitle: function () { + var self = this, val = this.getValue(); + BI.any(this.options.items, function (i, item) { + if (val.contains(item.value)) { + self.trigger.setTitle(item.text || item.value); + return true; + } + }); + }, + + setValue: function (v) { + v = BI.isArray(v) ? v : [v]; + this.options.value = v; + this.trigger.setValue(v); + this._checkTitle(); + }, + + getValue: function () { + return this.options.value || []; + }, + + populate: function (items) { + BI.SingleTreeTrigger.superclass.populate.apply(this, arguments); + this.trigger.populate(items); + } + +}); + +BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);/** + * 可以单选多选切换的树 + * + * Created by GUY on 2015/12/21. + * @class BI.SwitchTree + * @extends BI.Widget + */ +BI.SwitchTree = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.SwitchTree.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-switch-tree", + items: [] + }); + }, + + _init: function () { + BI.SwitchTree.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.tab = BI.createWidget({ + type: "bi.tab", + element: this, + tab: null, + defaultShowIndex: BI.SwitchTree.SelectType.SingleSelect, + cardCreator: BI.bind(this._createTree, this) + }); + }, + + _createTree: function (type) { + var self = this, o = this.options; + switch (type) { + case BI.SwitchTree.SelectType.SingleSelect: + this.levelTree = BI.createWidget({ + type: "bi.multilayer_single_level_tree", + isDefaultInit: true, + items: BI.deepClone(o.items) + }); + this.levelTree.on(BI.LevelTree.EVENT_CHANGE, function () { + self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); + }); + return this.levelTree; + case BI.SwitchTree.SelectType.MultiSelect: + this.tree = BI.createWidget({ + type: "bi.simple_tree", + items: this._removeIsParent(BI.deepClone(o.items)) + }); + this.tree.on(BI.SimpleTreeView.EVENT_CHANGE, function () { + self.fireEvent(BI.SwitchTree.EVENT_CHANGE, arguments); + }); + return this.tree; + } + }, + + _removeIsParent: function(items) { + BI.each(items, function(i, item) { + BI.isNotNull(item.isParent) && delete item.isParent; + }); + return items; + }, + + switchSelect: function () { + switch (this.getSelect()) { + case BI.SwitchTree.SelectType.SingleSelect: + this.setSelect(BI.SwitchTree.SelectType.MultiSelect); + break; + case BI.SwitchTree.SelectType.MultiSelect: + this.setSelect(BI.SwitchTree.SelectType.SingleSelect); + break; + } + }, + + setSelect: function (v) { + this.tab.setSelect(v); + }, + + getSelect: function () { + return this.tab.getSelect(); + }, + + setValue: function (v) { + this.storeValue = v; + switch (this.getSelect()) { + case BI.SwitchTree.SelectType.SingleSelect: + this.levelTree.setValue(v); + break; + case BI.SwitchTree.SelectType.MultiSelect: + this.tree.setValue(v); + break; + } + }, + + getValue: function () { + return this.tab.getValue(); + }, + + populate: function (items) { + this.options.items = items; + if (BI.isNotNull(this.levelTree)) { + this.levelTree.populate(BI.deepClone(items)); + } + if (BI.isNotNull(this.tree)) { + this.tree.populate(this._removeIsParent(BI.deepClone(items))); + } + } +}); +BI.SwitchTree.EVENT_CHANGE = "SwitchTree.EVENT_CHANGE"; +BI.SwitchTree.SelectType = { + SingleSelect: BI.Selection.Single, + MultiSelect: BI.Selection.Multi +}; +BI.shortcut('bi.switch_tree', BI.SwitchTree); +/** + * 年份下拉框 + * + * Created by GUY on 2015/8/28. + * @class BI.YearCombo + * @extends BI.Widget + */ +BI.YearCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.YearCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-year-combo", + behaviors: {}, + min: '1900-01-01', //最小日期 + max: '2099-12-31', //最大日期 + height: 25 + }); + }, + _init: function () { + BI.YearCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.storeValue = ""; + this.trigger = BI.createWidget({ + type: "bi.year_trigger", + min: o.min, + max: o.max + }); + this.trigger.on(BI.YearTrigger.EVENT_FOCUS, function () { + self.storeValue = this.getKey(); + }); + this.trigger.on(BI.YearTrigger.EVENT_START, function () { + self.combo.isViewVisible() && self.combo.hideView(); + }); + this.trigger.on(BI.YearTrigger.EVENT_STOP, function () { + self.combo.showView(); + }); + this.trigger.on(BI.YearTrigger.EVENT_ERROR, function () { + self.combo.isViewVisible() && self.combo.hideView(); + }); + this.trigger.on(BI.YearTrigger.EVENT_CONFIRM, function () { + if (self.combo.isViewVisible()) { + return; + } + if (this.getKey() && this.getKey() !== self.storeValue) { + self.setValue(this.getKey()); + } else if (!this.getKey()) { + self.setValue(); + } + self.fireEvent(BI.YearCombo.EVENT_CONFIRM); + }); + + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + destroyWhenHide: true, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + el: this.trigger, + popup: { + minWidth: 85, + stopPropagation: false, + el: { + type: "bi.year_popup", + ref: function () { + self.popup = this; + }, + listeners: [{ + eventName: BI.YearPopup.EVENT_CHANGE, + action: function () { + self.setValue(self.popup.getValue()); + self.combo.hideView(); + self.fireEvent(BI.YearCombo.EVENT_CONFIRM); + } + }], + behaviors: o.behaviors, + min: o.min, + max: o.max + } + } + }); + this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { + var value = self.trigger.getKey(); + if (BI.isNotNull(value)) { + self.popup.setValue(value); + } else if (!value && value !== self.storeValue) { + self.popup.setValue(self.storeValue); + } else { + self.setValue(); + } + self.fireEvent(BI.YearCombo.EVENT_BEFORE_POPUPVIEW); + }); + }, + + setValue: function (v) { + this.combo.setValue(v); + }, + + getValue: function () { + return this.popup.getValue(); + } +}); +BI.YearCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.YearCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.shortcut('bi.year_combo', BI.YearCombo);/** + * 年份展示面板 + * + * Created by GUY on 2015/9/2. + * @class BI.YearPopup + * @extends BI.Trigger + */ +BI.YearPopup = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.YearPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-year-popup", + behaviors: {}, + min: '1900-01-01', //最小日期 + max: '2099-12-31' //最大日期 + }); + }, + + _createYearCalendar: function (v) { + var o = this.options, y = this._year; + + var calendar = BI.createWidget({ + type: "bi.year_calendar", + behaviors: o.behaviors, + min: o.min, + max: o.max, + logic: { + dynamic: true + }, + year: y + v * 12 + }); + calendar.setValue(this._year); + return calendar; + }, + + _init: function () { + BI.YearPopup.superclass._init.apply(this, arguments); + var self = this; + + this.selectedYear = this._year = new Date().getFullYear(); + + var backBtn = BI.createWidget({ + type: "bi.icon_button", + cls: "pre-page-h-font", + width: 25, + height: 25, + value: -1 + }); + + var preBtn = BI.createWidget({ + type: "bi.icon_button", + cls: "next-page-h-font", + width: 25, + height: 25, + value: 1 + }); + + this.navigation = BI.createWidget({ + type: "bi.navigation", + element: this, + single: true, + logic: { + dynamic: true + }, + tab: { + cls: "year-popup-navigation bi-high-light bi-border-top", + height: 25, + items: [backBtn, preBtn] + }, + cardCreator: BI.bind(this._createYearCalendar, this), + + afterCardShow: function () { + this.setValue(self.selectedYear); + var calendar = this.getSelectedCard(); + backBtn.setEnable(!calendar.isFrontYear()); + preBtn.setEnable(!calendar.isFinalYear()); + } + }); + + this.navigation.on(BI.Navigation.EVENT_CHANGE, function () { + self.selectedYear = this.getValue(); + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + self.fireEvent(BI.YearPopup.EVENT_CHANGE, self.selectedYear); + }); + }, + + getValue: function () { + return this.selectedYear; + }, + + setValue: function (v) { + var o = this.options; + if (Date.checkVoid(v, 1, 1, o.min, o.max)[0]) { + v = new Date().getFullYear(); + this.selectedYear = ""; + this.navigation.setSelect(BI.YearCalendar.getPageByYear(v)); + this.navigation.setValue(""); + } else { + this.selectedYear = v; + this.navigation.setSelect(BI.YearCalendar.getPageByYear(v)); + this.navigation.setValue(v); + } + } +}); +BI.YearPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.shortcut("bi.year_popup", BI.YearPopup);/** + * 年份trigger + * + * Created by GUY on 2015/8/21. + * @class BI.YearTrigger + * @extends BI.Trigger + */ +BI.YearTrigger = BI.inherit(BI.Trigger, { + _const: { + hgap: 4, + vgap: 2, + triggerWidth: 25, + errorText: BI.i18nText("BI-Please_Input_Positive_Integer"), + errorTextInvalid: BI.i18nText("BI-Year_Trigger_Invalid_Text") + }, + + _defaultConfig: function () { + return BI.extend(BI.YearTrigger.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-year-trigger bi-border", + min: '1900-01-01', //最小日期 + max: '2099-12-31', //最大日期 + height: 25 + }); + }, + _init: function () { + BI.YearTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options, c = this._const; + this.editor = BI.createWidget({ + type: "bi.sign_editor", + height: o.height, + validationChecker: function (v) { + self.editor.setErrorText(!BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid); + return v === "" || (BI.isPositiveInteger(v) && !Date.checkVoid(v, 1, 1, o.min, o.max)[0]); + }, + quitChecker: function (v) { + return false; + }, + hgap: c.hgap, + vgap: c.vgap, + allowBlank: true, + errorText: c.errorText + }) + this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { + self.fireEvent(BI.YearTrigger.EVENT_FOCUS); + }); + this.editor.on(BI.SignEditor.EVENT_STOP, function () { + self.fireEvent(BI.YearTrigger.EVENT_STOP); + }); + this.editor.on(BI.SignEditor.EVENT_CONFIRM, function () { + var value = self.editor.getValue(); + if (BI.isNotNull(value)) { + self.editor.setValue(value); + self.editor.setTitle(value); + } + self.fireEvent(BI.YearTrigger.EVENT_CONFIRM); + }); + this.editor.on(BI.SignEditor.EVENT_SPACE, function () { + if (self.editor.isValid()) { + self.editor.blur(); + } + }); + this.editor.on(BI.SignEditor.EVENT_START, function () { + self.fireEvent(BI.YearTrigger.EVENT_START); + }); + this.editor.on(BI.SignEditor.EVENT_ERROR, function () { + self.fireEvent(BI.YearTrigger.EVENT_ERROR); + }); + BI.createWidget({ + element: this, + type: 'bi.htape', + items: [ + { + el: this.editor + }, { + el: { + type: "bi.text_button", + baseCls: "bi-trigger-year-text", + text: BI.i18nText("BI-Multi_Date_Year"), + width: c.triggerWidth + }, + width: c.triggerWidth + }, { + el: { + type: "bi.trigger_icon_button", + width: c.triggerWidth + }, + width: c.triggerWidth + } + ] + }); + }, + setValue: function (v) { + this.editor.setState(v); + this.editor.setValue(v); + this.editor.setTitle(v); + }, + getKey: function () { + return this.editor.getValue() | 0; + } +}); +BI.YearTrigger.EVENT_FOCUS = "EVENT_FOCUS"; +BI.YearTrigger.EVENT_ERROR = "EVENT_ERROR"; +BI.YearTrigger.EVENT_START = "EVENT_START"; +BI.YearTrigger.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.YearTrigger.EVENT_STOP = "EVENT_STOP"; +BI.shortcut("bi.year_trigger", BI.YearTrigger);/** + * 年份 + 月份下拉框 + * + * @class BI.YearMonthCombo + * @extends BI.Widget + */ +BI.YearMonthCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.YearMonthCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-year-month-combo", + yearBehaviors: {}, + monthBehaviors: {}, + height: 25 + }); + }, + _init: function () { + BI.YearMonthCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.year = BI.createWidget({ + type: "bi.year_combo", + behaviors: o.yearBehaviors + }); + + this.month = BI.createWidget({ + type: "bi.month_combo", + behaviors: o.monthBehaviors + }); + + this.year.on(BI.YearCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM); + }); + this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW); + }); + + this.month.on(BI.MonthCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.YearMonthCombo.EVENT_CONFIRM); + }); + this.month.on(BI.MonthCombo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW); + }); + + BI.createWidget({ + type: "bi.center", + element: this, + hgap: 5, + items: [this.year, this.month] + }); + + }, + + setValue: function (v) { + v = v || {}; + this.month.setValue(v.month); + this.year.setValue(v.year); + }, + + getValue: function () { + return { + year: this.year.getValue(), + month: this.month.getValue() + }; + } +}); +BI.YearMonthCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.YearMonthCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.shortcut('bi.year_month_combo', BI.YearMonthCombo);/** + * 年份 + 月份下拉框 + * + * @class BI.YearQuarterCombo + * @extends BI.Widget + */ +BI.YearQuarterCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.YearQuarterCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-year-quarter-combo", + yearBehaviors: {}, + quarterBehaviors: {}, + height: 25 + }); + }, + _init: function () { + BI.YearQuarterCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this.year = BI.createWidget({ + type: "bi.year_combo", + behaviors: o.yearBehaviors + }); + + this.quarter = BI.createWidget({ + type: "bi.quarter_combo", + behaviors: o.quarterBehaviors + }); + + this.year.on(BI.YearCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM); + }); + this.year.on(BI.YearCombo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW); + }); + + this.quarter.on(BI.QuarterCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.YearQuarterCombo.EVENT_CONFIRM); + }); + this.quarter.on(BI.QuarterCombo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW); + }); + + BI.createWidget({ + type: "bi.center", + element: this, + hgap: 5, + items: [this.year, this.quarter] + }); + + }, + + setValue: function (v) { + v = v || {}; + this.quarter.setValue(v.quarter); + this.year.setValue(v.year); + }, + + getValue: function () { + return { + year: this.year.getValue(), + quarter: this.quarter.getValue() + }; + } +}); +BI.YearQuarterCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.YearQuarterCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.shortcut('bi.year_quarter_combo', BI.YearQuarterCombo);/** + * 简单的复选下拉框控件, 适用于数据量少的情况, 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值 + * 封装了字段处理逻辑 + * + * Created by GUY on 2015/10/29. + * @class BI.AbstractAllValueChooser + * @extends BI.Widget + */ +BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { + + _const: { + perPage: 100 + }, + + _defaultConfig: function () { + return BI.extend(BI.AbstractAllValueChooser.superclass._defaultConfig.apply(this, arguments), { + width: 200, + height: 30, + items: null, + itemsCreator: BI.emptyFn, + cache: true + }); + }, + + _valueFormatter: function (v) { + var text = v; + if (BI.isNotNull(this.items)) { + BI.some(this.items, function (i, item) { + if (item.value === v) { + text = item.text; + return true; + } + }); + } + return text; + }, + + _itemsCreator: function (options, callback) { + var self = this, o = this.options; + if (!o.cache || !this.items) { + o.itemsCreator({}, function (items) { + self.items = items; + call(items); + }); + } else { + call(this.items); + } + function call(items) { + var keywords = (options.keywords || []).slice(); + if (options.keyword) { + keywords.push(options.keyword); + } + BI.each(keywords, function (i, kw) { + var search = BI.Func.getSearchResult(items, kw); + items = search.matched.concat(search.finded); + }); + if (options.selectedValues) {//过滤 + var filter = BI.makeObject(options.selectedValues, true); + items = BI.filter(items, function (i, ob) { + return !filter[ob.value]; + }); + } + if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + callback({ + items: items + }); + return; + } + if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + callback({count: items.length}); + return; + } + callback({ + items: items, + hasNext: false + }); + } + } +});/** + * 简单的复选下拉框控件, 适用于数据量少的情况, 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值 + * 封装了字段处理逻辑 + * + * Created by GUY on 2015/10/29. + * @class BI.AllValueChooserCombo + * @extends BI.AbstractAllValueChooser + */ +BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { + + _defaultConfig: function () { + return BI.extend(BI.AllValueChooserCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-all-value-chooser-combo", + width: 200, + height: 30, + items: null, + itemsCreator: BI.emptyFn, + cache: true + }); + }, + + _init: function () { + BI.AllValueChooserCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isNotNull(o.items)) { + this.items = o.items; + } + this.combo = BI.createWidget({ + type: 'bi.multi_select_combo', + element: this, + itemsCreator: BI.bind(this._itemsCreator, this), + valueFormatter: BI.bind(this._valueFormatter, this), + width: o.width, + height: o.height + }); + + this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.AllValueChooserCombo.EVENT_CONFIRM); + }); + }, + + setValue: function (v) { + this.combo.setValue({ + type: BI.Selection.Multi, + value: v || [] + }); + }, + + getValue: function () { + var val = this.combo.getValue() || {}; + if (val.type === BI.Selection.All) { + return val.assist; + } + return val.value || []; + }, + + populate: function () { + this.combo.populate.apply(this, arguments); + } +}); +BI.AllValueChooserCombo.EVENT_CONFIRM = "AllValueChooserCombo.EVENT_CONFIRM"; +BI.shortcut('bi.all_value_chooser_combo', BI.AllValueChooserCombo);/** + * 简单的复选下拉框控件, 适用于数据量少的情况, 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值 + * 封装了字段处理逻辑 + * + * Created by GUY on 2015/10/29. + * @class BI.AllValueChooserPane + * @extends BI.AbstractAllValueChooser + */ +BI.AllValueChooserPane = BI.inherit(BI.AbstractAllValueChooser, { + + _defaultConfig: function () { + return BI.extend(BI.AllValueChooserPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-all-value-chooser-pane", + width: 200, + height: 30, + items: null, + itemsCreator: BI.emptyFn, + cache: true + }); + }, + + _init: function () { + BI.AllValueChooserPane.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isNotNull(o.items)) { + this.items = o.items; + } + this.list = BI.createWidget({ + type: 'bi.multi_select_list', + element: this, + itemsCreator: BI.bind(this._itemsCreator, this), + valueFormatter: BI.bind(this._valueFormatter, this), + width: o.width, + height: o.height + }); + + this.list.on(BI.MultiSelectList.EVENT_CHANGE, function () { + self.fireEvent(BI.AllValueChooserPane.EVENT_CHANGE); + }); + }, + + setValue: function (v) { + this.list.setValue({ + type: BI.Selection.Multi, + value: v || [] + }); + }, + + getValue: function () { + var val = this.list.getValue() || {}; + if (val.type === BI.Selection.All) { + return val.assist; + } + return val.value || []; + }, + + populate: function () { + this.list.populate.apply(this.list, arguments); + } +}); +BI.AllValueChooserPane.EVENT_CHANGE = "AllValueChooserPane.EVENT_CHANGE"; +BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, { + + _const: { + perPage: 100 + }, + + _defaultConfig: function () { + return BI.extend(BI.AbstractTreeValueChooser.superclass._defaultConfig.apply(this, arguments), { + items: null, + itemsCreator: BI.emptyFn + }); + }, + + _initData: function (items) { + this.items = items; + var nodes = BI.Tree.treeFormat(items); + this.tree = new BI.Tree(); + this.tree.initTree(nodes); + }, + + _itemsCreator: function (options, callback) { + var self = this, o = this.options; + if (!this.items) { + o.itemsCreator({}, function (items) { + self._initData(items); + call(); + }); + } else { + call(); + } + function call() { + switch (options.type) { + case BI.TreeView.REQ_TYPE_INIT_DATA: + self._reqInitTreeNode(options, callback); + break; + case BI.TreeView.REQ_TYPE_ADJUST_DATA: + self._reqAdjustTreeNode(options, callback); + break; + case BI.TreeView.REQ_TYPE_SELECT_DATA: + self._reqSelectedTreeNode(options, callback); + break; + case BI.TreeView.REQ_TYPE_GET_SELECTED_DATA: + self._reqDisplayTreeNode(options, callback); + break; + default : + self._reqTreeNode(options, callback); + break; + } + } + }, + + _reqDisplayTreeNode: function (op, callback) { + var self = this; + var result = []; + var selectedValues = op.selectedValues; + + if (selectedValues == null || BI.isEmpty(selectedValues)) { + callback({}); + return; + } + + doCheck([], this.tree.getRoot(), selectedValues); + + callback({ + items: result + }); + + function doCheck(parentValues, node, selected) { + if (selected == null || BI.isEmpty(selected)) { + BI.each(node.getChildren(), function (i, child) { + var newParents = BI.clone(parentValues); + newParents.push(child.value); + var llen = self._getChildCount(newParents); + createOneJson(child, node.id, llen); + doCheck(newParents, child, {}); + }); + return; + } + BI.each(selected, function (k) { + var node = self._getTreeNode(parentValues, k); + var newParents = BI.clone(parentValues); + newParents.push(node.value); + createOneJson(node, node.parent && node.parent.id, getCount(selected[k], newParents)); + doCheck(newParents, node, selected[k]); + }) + } + + function getCount(jo, parentValues) { + if (jo == null) { + return 0; + } + if (BI.isEmpty(jo)) { + return self._getChildCount(parentValues); + } + + return BI.size(jo); + } + + function createOneJson(node, pId, llen) { + result.push({ + id: node.id, + pId: pId, + text: node.text + (llen > 0 ? ("(" + BI.i18nText("BI-Basic_Altogether") + llen + BI.i18nText("BI-Basic_Count") + ")") : ""), + value: node.value, + open: true + }); + } + }, + + _reqSelectedTreeNode: function (op, callback) { + var self = this; + var selectedValues = BI.deepClone(op.selectedValues); + var notSelectedValue = op.notSelectedValue || {}; + var keyword = op.keyword || ""; + var parentValues = op.parentValues || []; + + if (selectedValues == null || BI.isEmpty(selectedValues)) { + callback({}); + return; + } + + dealWithSelectedValues(selectedValues); + callback(selectedValues); + + + function dealWithSelectedValues(selectedValues) { + var p = parentValues.concat(notSelectedValue); + //存储的值中存在这个值就把它删掉 + //例如选中了中国-江苏-南京, 取消中国或江苏或南京 + if (canFindKey(selectedValues, p)) { + //如果搜索的值在父亲链中 + if (isSearchValueInParent(p)) { + //例如选中了 中国-江苏, 搜索江苏, 取消江苏 + //例如选中了 中国-江苏, 搜索江苏, 取消中国 + self._deleteNode(selectedValues, p); + } else { + var searched = []; + var finded = search(parentValues, notSelectedValue, [], searched); + if (finded && BI.isNotEmptyArray(searched)) { + BI.each(searched, function (i, arr) { + var node = self._getNode(selectedValues, arr); + if (node) { + //例如选中了 中国-江苏-南京,搜索南京,取消中国 + self._deleteNode(selectedValues, arr); + } else { + //例如选中了 中国-江苏,搜索南京,取消中国 + expandSelectedValue(selectedValues, arr, BI.last(arr)); + } + }) + } + } + } + + //存储的值中不存在这个值,但父亲节点是全选的情况 + //例如选中了中国-江苏,取消南京 + //important 选中了中国-江苏,取消了江苏,但是搜索的是南京 + if (isChild(selectedValues, p)) { + var result = [], finded = false; + //如果parentValues中有匹配的值,说明搜索结果不在当前值下 + if (isSearchValueInParent(p)) { + finded = true; + } else { + //从当前值开始搜 + finded = search(parentValues, notSelectedValue, result); + p = parentValues; + } + + if (finded === true) { + //去掉点击的节点之后的结果集 + expandSelectedValue(selectedValues, p, notSelectedValue); + //添加去掉搜索的结果集 + if (result.length > 0) { + BI.each(result, function (i, strs) { + self._buildTree(selectedValues, strs); + }) + } + } + } + + } + + function expandSelectedValue(selectedValues, parents, notSelectedValue) { + var next = selectedValues; + var childrenCount = []; + var path = []; + //去掉点击的节点之后的结果集 + BI.some(parents, function (i, v) { + var t = next[v]; + if (t == null) { + if (i === 0) { + return true; + } + if (BI.isEmpty(next)) { + var split = parents.slice(0, i); + var expanded = self._getChildren(split); + path.push(split); + childrenCount.push(expanded.length); + //如果只有一个值且取消的就是这个值 + if (i === parents.length - 1 && expanded.length === 1 && expanded[0] === notSelectedValue) { + for (var j = childrenCount.length - 1; j >= 0; j--) { + if (childrenCount[j] === 1) { + self._deleteNode(selectedValues, path[j]); + } else { + break; + } + } + } else { + BI.each(expanded, function (m, child) { + if (i === parents.length - 1 && child.value === notSelectedValue) { + return true; + } + next[child.value] = {}; + }); + } + next = next[v]; + } else { + return true; + // next = {}; + // next[v] = {}; + } + } else { + next = t; + } + }); + } + + function search(parents, current, result, searched) { + var newParents = BI.clone(parents); + newParents.push(current); + if (self._isMatch(parents, current, keyword)) { + searched && searched.push(newParents); + return true; + } + + var children = self._getChildren(newParents); + + var notSearch = []; + var can = false; + + BI.each(children, function (i, child) { + if (search(newParents, child.value, result, searched)) { + can = true; + } else { + notSearch.push(child.value); + } + }); + if (can === true) { + BI.each(notSearch, function (i, v) { + var next = BI.clone(newParents); + next.push(v); + result.push(next); + }); + } + return can; + } + + function isSearchValueInParent(parentValues) { + for (var i = 0, len = parentValues.length; i < len; i++) { + if (self._isMatch(parentValues.slice(0, parentValues.length - 1), parentValues[i], keyword)) { + return true; + } + } + return false; + } + + function canFindKey(selectedValues, parents) { + var t = selectedValues; + for (var i = 0; i < parents.length; i++) { + var v = parents[i]; + t = t[v]; + if (t == null) { + return false; + } + } + return true; + } + + function isChild(selectedValues, parents) { + var t = selectedValues; + for (var i = 0; i < parents.length; i++) { + var v = parents[i]; + if (!BI.has(t, v)) { + return false; + } + t = t[v]; + if (BI.isEmpty(t)) { + return true; + } + } + return false; + } + }, + + _reqAdjustTreeNode: function (op, callback) { + var self = this; + var result = []; + var selectedValues = op.selectedValues; + if (selectedValues == null || BI.isEmpty(selectedValues)) { + callback({}); + return; + } + BI.each(selectedValues, function (k, v) { + result.push([k]); + }); + + dealWithSelectedValues(selectedValues, []); + + var jo = {}; + BI.each(result, function (i, strs) { + self._buildTree(jo, strs); + }); + callback(jo); + + function dealWithSelectedValues(selected, parents) { + if (selected == null || BI.isEmpty(selected)) { + return true; + } + var can = true; + BI.each(selected, function (k, v) { + var p = BI.clone(parents); + p.push(k); + if (!dealWithSelectedValues(selected[k], p)) { + BI.each(selected[k], function (nk, nv) { + var t = BI.clone(p); + t.push(nk); + result.push(t); + }); + can = false; + } + }); + return can && isAllSelected(selected, parents); + } + + function isAllSelected(selected, parents) { + return BI.isEmpty(selected) || self._getChildCount(parents) === BI.size(selected); + } + }, + + _reqInitTreeNode: function (op, callback) { + var self = this; + var result = []; + var keyword = op.keyword || ""; + var selectedValues = op.selectedValues; + var lastSearchValue = op.lastSearchValue || ""; + var output = search(); + BI.nextTick(function () { + callback({ + hasNext: output.length > self._const.perPage, + items: result, + lastSearchValue: BI.last(output) + }) + }); + + function search() { + var children = self._getChildren([]); + var start = children.length; + if (lastSearchValue !== "") { + for (var j = 0, len = start; j < len; j++) { + if (children[j].value === lastSearchValue) { + start = j + 1; + break; + } + } + } else { + start = 0; + } + var output = []; + for (var i = start, len = children.length; i < len; i++) { + if (output.length < self._const.perPage) { + var find = nodeSearch(1, [], children[i].value, false, result); + } else if (output.length === self._const.perPage) { + var find = nodeSearch(1, [], children[i].value, false, []); + } + if (find[0] === true) { + output.push(children[i].value); + } + if (output.length > self._const.perPage) { + break; + } + } + return output; + } + + function nodeSearch(deep, parentValues, current, isAllSelect, result) { + if (self._isMatch(parentValues, current, keyword)) { + var checked = isAllSelect || isSelected(parentValues, current); + createOneJson(parentValues, current, false, checked, !isAllSelect && isHalf(parentValues, current), true, result); + return [true, checked]; + } + var newParents = BI.clone(parentValues); + newParents.push(current); + var children = self._getChildren(newParents); + + var can = false, checked = false; + + var isCurAllSelected = isAllSelect || isAllSelected(parentValues, current); + BI.each(children, function (i, child) { + var state = nodeSearch(deep + 1, newParents, child.value, isCurAllSelected, result); + if (state[1] === true) { + checked = true; + } + if (state[0] === true) { + can = true; + } + }); + if (can === true) { + checked = isCurAllSelected || (isSelected(parentValues, current) && checked); + createOneJson(parentValues, current, true, checked, false, false, result); + } + return [can, checked]; + } + + function createOneJson(parentValues, value, isOpen, checked, half, flag, result) { + var node = self._getTreeNode(parentValues, value) + result.push({ + id: node.id, + pId: node.pId, + text: node.text, + value: node.value, + title: node.title, + isParent: node.getChildrenLength() > 0, + open: isOpen, + checked: checked, + halfCheck: half, + flag: flag + }); + } + + function isHalf(parentValues, value) { + var find = findSelectedObj(parentValues); + if (find == null) { + return null; + } + return BI.any(find, function (v, ob) { + if (v === value) { + if (ob != null && !BI.isEmpty(ob)) { + return true; + } + } + }); + } + + function isAllSelected(parentValues, value) { + var find = findSelectedObj(parentValues); + if (find == null) { + return null; + } + return BI.any(find, function (v, ob) { + if (v === value) { + if (ob != null && BI.isEmpty(ob)) { + return true; + } + } + }); + } + + function isSelected(parentValues, value) { + var find = findSelectedObj(parentValues); + if (find == null) { + return false; + } + return BI.any(find, function (v) { + if (v === value) { + return true; + } + }); + } + + function findSelectedObj(parentValues) { + var find = selectedValues; + if (find == null) { + return null; + } + BI.every(parentValues, function (i, v) { + find = find[v]; + if (find == null) { + return false; + } + return true; + }); + return find; + } + }, + + _reqTreeNode: function (op, callback) { + var self = this; + var result = []; + var times = op.times; + var checkState = op.checkState || {}; + var parentValues = op.parentValues || []; + var selectedValues = op.selectedValues || {}; + var valueMap = {}; + // if (judgeState(parentValues, selectedValues, checkState)) { + valueMap = dealWidthSelectedValue(parentValues, selectedValues); + // } + var nodes = this._getChildren(parentValues); + for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { + var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState); + result.push({ + id: nodes[i].id, + pId: nodes[i].pId, + value: nodes[i].value, + text: nodes[i].text, + times: 1, + isParent: nodes[i].getChildrenLength() > 0, + checked: state[0], + halfCheck: state[1] + }) + } + BI.nextTick(function () { + callback({ + items: result, + hasNext: nodes.length > times * self._const.perPage + }); + }); + + function judgeState(parentValues, selected_value, checkState) { + var checked = checkState.checked, half = checkState.half; + if (parentValues.length > 0 && !checked) { + return false; + } + return (parentValues.length === 0 || (checked && half) && !BI.isEmpty(selected_value)); + } + + function dealWidthSelectedValue(parentValues, selectedValues) { + var valueMap = {}; + BI.each(parentValues, function (i, v) { + selectedValues = selectedValues[v] || {}; + }); + BI.each(selectedValues, function (value, obj) { + if (BI.isNull(obj)) { + valueMap[value] = [0, 0]; + return; + } + if (BI.isEmpty(obj)) { + valueMap[value] = [2, 0]; + return; + } + var nextNames = {}; + BI.each(obj, function (t, o) { + if (BI.isNull(o) || BI.isEmpty(o)) { + nextNames[t] = true; + } + }); + valueMap[value] = [1, BI.size(nextNames)]; + }); + return valueMap; + } + + function getCheckState(current, parentValues, valueMap, checkState) { + var checked = checkState.checked, half = checkState.half; + var tempCheck = false, halfCheck = false; + if (BI.has(valueMap, current)) { + //可能是半选 + if (valueMap[current][0] === 1) { + var values = BI.clone(parentValues); + values.push(current); + var childCount = self._getChildCount(values); + if (childCount > 0 && childCount !== valueMap[current][1]) { + halfCheck = true; + } + } else if (valueMap[current][0] === 2) { + tempCheck = true; + } + } + var check; + if (!checked && !halfCheck && !tempCheck) { + check = BI.has(valueMap, current); + } else { + check = ((tempCheck || checked) && !half) || BI.has(valueMap, current); + } + return [check, halfCheck]; + } + }, + + _getNode: function (selectedValues, parentValues) { + var pNode = selectedValues; + for (var i = 0, len = parentValues.length; i < len; i++) { + if (pNode == null) { + return null; + } + pNode = pNode[parentValues[i]]; + } + return pNode; + }, + + _deleteNode: function (selectedValues, values) { + var name = values[values.length - 1]; + var p = values.slice(0, values.length - 1); + var pNode = this._getNode(selectedValues, p); + if (pNode != null && pNode[name]) { + delete pNode[name]; + //递归删掉空父节点 + while (p.length > 0 && BI.isEmpty(pNode)) { + name = p[p.length - 1]; + p = p.slice(0, p.length - 1); + pNode = this._getNode(selectedValues, p); + if (pNode != null) { + delete pNode[name]; + } + } + } + }, + + _buildTree: function (jo, values) { + var t = jo; + BI.each(values, function (i, v) { + if (!BI.has(t, v)) { + t[v] = {}; + } + t = t[v]; + }); + }, + + _isMatch: function (parentValues, value, keyword) { + var node = this._getTreeNode(parentValues, value); + var finded = BI.Func.getSearchResult([node.text || node.value], keyword); + return finded.finded.length > 0 || finded.matched.length > 0; + }, + + _getTreeNode: function (parentValues, v) { + var self = this; + var findedParentNode; + var index = 0; + this.tree.traverse(function (node) { + if (self.tree.isRoot(node)) { + return; + } + if (index > parentValues.length) { + return false; + } + if (index === parentValues.length && node.value === v) { + findedParentNode = node; + return false; + } + if (node.value === parentValues[index]) { + index++; + return; + } + return true; + }); + return findedParentNode; + }, + + _getChildren: function (parentValues) { + if (parentValues.length > 0) { + var value = BI.last(parentValues); + var parent = this._getTreeNode(parentValues.slice(0, parentValues.length - 1), value); + } else { + var parent = this.tree.getRoot(); + } + return parent.getChildren(); + }, + + _getChildCount: function (parentValues) { + return this._getChildren(parentValues).length; + } +});/** + * 简单的复选下拉树控件, 适用于数据量少的情况 + * + * Created by GUY on 2015/10/29. + * @class BI.TreeValueChooserCombo + * @extends BI.Widget + */ +BI.TreeValueChooserCombo = BI.inherit(BI.AbstractTreeValueChooser, { + + _defaultConfig: function () { + return BI.extend(BI.TreeValueChooserCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-tree-value-chooser-combo", + width: 200, + height: 30, + items: null, + itemsCreator: BI.emptyFn + }); + }, + + _init: function () { + BI.TreeValueChooserCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isNotNull(o.items)) { + this._initData(o.items); + } + this.combo = BI.createWidget({ + type: 'bi.multi_tree_combo', + element: this, + itemsCreator: BI.bind(this._itemsCreator, this), + width: o.width, + height: o.height + }); + + this.combo.on(BI.MultiTreeCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.TreeValueChooserCombo.EVENT_CONFIRM); + }); + }, + + setValue: function (v) { + this.combo.setValue(v); + }, + + getValue: function () { + return this.combo.getValue(); + }, + + populate: function () { + this.combo.populate.apply(this.combo, arguments); + } +}); +BI.TreeValueChooserCombo.EVENT_CONFIRM = "TreeValueChooserCombo.EVENT_CONFIRM"; +BI.shortcut('bi.tree_value_chooser_combo', BI.TreeValueChooserCombo);/** + * 简单的复选下拉树控件, 适用于数据量少的情况 + * + * Created by GUY on 2015/10/29. + * @class BI.TreeValueChooserPane + * @extends BI.AbstractTreeValueChooser + */ +BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, { + + _defaultConfig: function () { + return BI.extend(BI.TreeValueChooserPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-tree-value-chooser-pane", + items: null, + itemsCreator: BI.emptyFn + }); + }, + + _init: function () { + BI.TreeValueChooserPane.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.pane = BI.createWidget({ + type: 'bi.multi_select_tree', + element: this, + itemsCreator: BI.bind(this._itemsCreator, this) + }); + + this.pane.on(BI.MultiSelectTree.EVENT_CHANGE, function () { + self.fireEvent(BI.TreeValueChooserPane.EVENT_CHANGE); + }); + if (BI.isNotNull(o.items)) { + this._initData(o.items); + this.populate(); + } + }, + + setSelectedValue: function (v) { + this.pane.setSelectedValue(v); + }, + + setValue: function (v) { + this.pane.setValue(v); + }, + + getValue: function () { + return this.pane.getValue(); + }, + + populate: function () { + this.pane.populate.apply(this.pane, arguments); + } +}); +BI.TreeValueChooserPane.EVENT_CHANGE = "TreeValueChooserPane.EVENT_CHANGE"; +BI.shortcut('bi.tree_value_chooser_pane', BI.TreeValueChooserPane);/** + * 简单的复选下拉框控件, 适用于数据量少的情况 + * 封装了字段处理逻辑 + * + * Created by GUY on 2015/10/29. + * @class BI.AbstractValueChooser + * @extends BI.Widget + */ +BI.AbstractValueChooser = BI.inherit(BI.Widget, { + + _const: { + perPage: 100 + }, + + _defaultConfig: function () { + return BI.extend(BI.AbstractValueChooser.superclass._defaultConfig.apply(this, arguments), { + items: null, + itemsCreator: BI.emptyFn, + cache: true + }); + }, + + _valueFormatter: function (v) { + var text = v; + if (BI.isNotNull(this.items)) { + BI.some(this.items, function (i, item) { + if (item.value === v) { + text = item.text; + return true; + } + }); + } + return text; + }, + + _getItemsByTimes: function (items, times) { + var res = []; + for (var i = (times - 1) * this._const.perPage; items[i] && i < times * this._const.perPage; i++) { + res.push(items[i]); + } + return res; + }, + + _hasNextByTimes: function (items, times) { + return times * this._const.perPage < items.length; + }, + + _itemsCreator: function (options, callback) { + var self = this, o = this.options; + if (!o.cache || !this.items) { + o.itemsCreator({}, function (items) { + self.items = items; + call(items); + }); + } else { + call(this.items); + } + function call(items) { + var keywords = (options.keywords || []).slice(); + if (options.keyword) { + keywords.push(options.keyword); + } + BI.each(keywords, function (i, kw) { + var search = BI.Func.getSearchResult(items, kw); + items = search.matched.concat(search.finded); + }); + if (options.selectedValues) {//过滤 + var filter = BI.makeObject(options.selectedValues, true); + items = BI.filter(items, function (i, ob) { + return !filter[ob.value]; + }); + } + if (options.type === BI.MultiSelectCombo.REQ_GET_ALL_DATA) { + callback({ + items: items + }); + return; + } + if (options.type === BI.MultiSelectCombo.REQ_GET_DATA_LENGTH) { + callback({count: items.length}); + return; + } + callback({ + items: self._getItemsByTimes(items, options.times), + hasNext: self._hasNextByTimes(items, options.times) + }); + } + } +});/** + * 简单的复选下拉框控件, 适用于数据量少的情况 + * 封装了字段处理逻辑 + * + * Created by GUY on 2015/10/29. + * @class BI.ValueChooserCombo + * @extends BI.Widget + */ +BI.ValueChooserCombo = BI.inherit(BI.AbstractValueChooser, { + + _defaultConfig: function () { + return BI.extend(BI.ValueChooserCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-value-chooser-combo", + width: 200, + height: 30, + items: null, + itemsCreator: BI.emptyFn, + cache: true + }); + }, + + _init: function () { + BI.ValueChooserCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + if (BI.isNotNull(o.items)) { + this.items = o.items; + } + this.combo = BI.createWidget({ + type: 'bi.multi_select_combo', + element: this, + itemsCreator: BI.bind(this._itemsCreator, this), + valueFormatter: BI.bind(this._valueFormatter, this), + width: o.width, + height: o.height + }); + + this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { + self.fireEvent(BI.ValueChooserCombo.EVENT_CONFIRM); + }); + }, + + setValue: function (v) { + this.combo.setValue(v); + }, + + getValue: function () { + var val = this.combo.getValue() || {}; + return { + type: val.type, + value: val.value + } + }, + + populate: function () { + this.combo.populate.apply(this, arguments); + } +}); +BI.ValueChooserCombo.EVENT_CONFIRM = "ValueChooserCombo.EVENT_CONFIRM"; +BI.shortcut('bi.value_chooser_combo', BI.ValueChooserCombo);/** + * 简单的复选下拉框控件, 适用于数据量少的情况 + * 封装了字段处理逻辑 + * + * Created by GUY on 2015/10/29. + * @class BI.ValueChooserPane + * @extends BI.Widget + */ +BI.ValueChooserPane = BI.inherit(BI.AbstractValueChooser, { + + _defaultConfig: function () { + return BI.extend(BI.ValueChooserPane.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-value-chooser-pane", + items: null, + itemsCreator: BI.emptyFn, + cache: true + }); + }, + + _init: function () { + BI.ValueChooserPane.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.list = BI.createWidget({ + type: 'bi.multi_select_list', + element: this, + itemsCreator: BI.bind(this._itemsCreator, this), + valueFormatter: BI.bind(this._valueFormatter, this) + }); + + this.list.on(BI.MultiSelectList.EVENT_CHANGE, function () { + self.fireEvent(BI.ValueChooserPane.EVENT_CHANGE); + }); + if (BI.isNotNull(o.items)) { + this.items = o.items; + this.populate(); + } + }, + + setValue: function (v) { + this.list.setValue(v); + }, + + getValue: function () { + var val = this.list.getValue() || {}; + return { + type: val.type, + value: val.value + } + }, + + populate: function () { + this.list.populate.apply(this.list, arguments); + } +}); +BI.ValueChooserPane.EVENT_CHANGE = "ValueChooserPane.EVENT_CHANGE"; +BI.shortcut('bi.value_chooser_pane', BI.ValueChooserPane); \ No newline at end of file diff --git a/docs/core.js b/docs/core.js index 1c727cb83..bdc6cf8af 100644 --- a/docs/core.js +++ b/docs/core.js @@ -15826,16 +15826,12 @@ BI.View = BI.inherit(BI.V, { this.off(); } });(function () { - - var kv = {}; // alex:键(编辑器简称,如text)值(也是一个字符串,如FR.TextEditor)对 + var kv = {}; BI.shortcut = function (xtype, cls) { if (kv[xtype] != null) { throw ("shortcut:[" + xtype + "] has been registed"); } kv[xtype] = cls; - _.extend(cls.prototype, { - xtype: xtype - }) }; // 根据配置属性生成widget @@ -15844,9 +15840,6 @@ BI.View = BI.inherit(BI.V, { return new (new Function('return ' + config['classType'] + ';')())(config); } - if (!config.type) { - - } var xtype = config.type.toLowerCase(); var cls = kv[xtype]; return new cls(config); @@ -17795,6 +17788,10 @@ $.extend(BI, { ? entry : entry.value }; + + p.has = function (key) { + return this._keymap[key] != null; + } })();; !(function () { var MD5 = function (hexcase) { @@ -18391,22 +18388,7 @@ $.extend(BI, { }); } } -})();if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { - -} else { - Set = function () { - this.set = {} - }; - Set.prototype.has = function (key) { - return this.set[key] !== undefined; - }; - Set.prototype.add = function (key) { - this.set[key] = 1 - }; - Set.prototype.clear = function () { - this.set = {} - }; -}; +})();; (function () { var clamp = function (value, min, max) { if (value < min) { @@ -19103,359 +19085,360 @@ BI.Region.prototype = { pos.push(this.y + this.h / 2); return pos; } -};; -!(function (BI) { - - if (BI.isIE()) { - XMLSerializer = null; - DOMParser = null; - } - - - var XML = { - Document: { - NodeType: { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 - } - } - }; - - XML.ResultType = { - single: 'single', - array: 'array' - }; - - XML.fromString = function (xmlStr) { - try { - var parser = new DOMParser(); - return parser.parseFromString(xmlStr, "text/xml"); - } catch (e) { - var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; - for (var i = 0; i < arrMSXML.length; i++) { - try { - var xmlDoc = new ActiveXObject(arrMSXML[i]); - xmlDoc.setProperty("SelectionLanguage", "XPath"); - xmlDoc.async = false; - xmlDoc.loadXML(xmlStr); - return xmlDoc; - } catch (xmlError) { - } - } - } - }; - - XML.toString = function (xmlNode) { - if (!BI.isIE()) { - var xmlSerializer = new XMLSerializer(); - return xmlSerializer.serializeToString(xmlNode); - } else - return xmlNode.xml; - }; - - XML.getNSResolver = function (str) { - if (!str) { - return null; - } - var list = str.split(' '); - var namespaces = {}; - for (var i = 0; i < list.length; i++) { - var pair = list[i].split('='); - var fix = BI.trim(pair[0]).replace("xmlns:", ""); - namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); - } - return function (prefix) { - return namespaces[prefix]; - }; - }; - - XML.eval = function (context, xpathExp, resultType, namespaces) { - if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { - return XML.eval2(context, xpathExp, resultType, namespaces); - } else { - if (BI.isIE()) { - namespaces = namespaces ? namespaces : ""; - var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; - doc.setProperty("SelectionNamespaces", namespaces); - var result; - if (resultType == this.ResultType.single) { - result = context.selectSingleNode(xpathExp); - } else { - result = context.selectNodes(xpathExp) || []; - } - doc.setProperty("SelectionNamespaces", ""); - return result; - } else { - var node = context; - var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; - var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; - var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); - - if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { - return col.singleNodeValue; - } else { - var thisColMemb = col.iterateNext(); - var rowsCol = []; - while (thisColMemb) { - rowsCol[rowsCol.length] = thisColMemb; - thisColMemb = col.iterateNext(); - } - return rowsCol; - } - } - } - }; - - XML.eval2 = function (context, xpathExp, resultType, namespaces) { - if (resultType !== "single" && resultType !== undefined && resultType !== null) { - throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); - } - - if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { - return context; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs, i; - if (xpathExp.indexOf("/") != -1) { - var items = xpathExp.split("/"); - var isAbs = xpathExp.substring(0, 1) == "/"; - for (i = 0; i < items.length; i++) { - var item = items[i]; - if (item === "") { - continue; - } else { - var next = null; - var ii = i + 1; - for (; ii < items.length; ii++) { - if (next === null) { - next = items[ii]; - } else { - next = next + "/" + items[ii]; - } - } - - if (item == ".") { - return this.eval(context, next, resultType); - - } else if (item == "..") { - return this.eval2(context.parentNode, next, resultType); - - } else if (item == "*") { - if (isAbs) { - return this.eval2(context, next, resultType); - - } else { - childs = context.childNodes; - for (var j = 0; j < childs.length; j++) { - var tmp = this.eval2(childs[j], next, resultType); - if (tmp !== null) { - return tmp; - } - } - return null; - } - - } else { - if (isAbs) { - if (context.nodeName == item) { - return this.eval2(context, next, resultType); - } else { - return null; - } - } else { - var child = this.getChildByName(context, item); - if (child !== null) { - return this.eval2(child, next, resultType); - } else { - return null; - } - - } - } - - } - } - - return null; - - } else { - if ("text()" == xpathExp) { - childs = context.childNodes; - for (i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.TEXT) { - return childs[i]; - } - } - return null; - } else { - return this.getChildByName(context, xpathExp); - } - } - }; - - XML.getChildByName = function (context, name) { - if (context === null || context === undefined || name === null || name === undefined) { - return null; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs = context.childNodes; - for (var i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { - return childs[i]; - } - } - - return null; - }; - - XML.appendChildren = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - if (isBefore && finded[i].firstNode) { - this._insertBefore(finded[i], nodes, finded[i].firstNode); - } else { - for (var j = 0; j < nodes.length; j++) { - finded[i].appendChild(nodes[j]); - } - } - } - return count; - }; - - XML.removeNodes = function (context, xpathExp) { - var nodes = this.eval(context, xpathExp); - for (var i = 0; i < nodes.length; i++) { - nodes[i].parentNode.removeChild(nodes[i]); - } - }; - - XML._insertBefore = function (parent, newchildren, refchild) { - for (var i = 0; i < newchildren.length; i++) { - parent.insertBefore(newchildren[i], refchild); - } - }; - - XML.insertNodes = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; - this._insertBefore(finded[i].parentNode, nodes, refnode); - } - return count; - }; - - XML.replaceNodes = function (context, xpathExp, nodes) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = finded[i]; - var parent = refnode.parentNode; - this._insertBefore(parent, nodes, refnode); - parent.removeChild(refnode); - } - return count; - }; - - XML.setNodeText = function (context, xpathExp, text) { - var finded = this.eval(context, xpathExp, this.ResultType.single); - if (finded === null) { - return; - } - if (finded.nodeType == XML.Document.NodeType.ELEMENT) { - var textNode = this.eval(finded, "./text()", this.ResultType.single); - if (!textNode) { - textNode = finded.ownerDocument.createTextNode(""); - finded.appendChild(textNode); - } - textNode.nodeValue = text; - } else { - finded.nodeValue = text; - } - return; - }; - - XML.getNodeText = function (context, xpathExp, defaultValue) { - var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; - if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { - finded = this.eval(finded, "./text()", this.ResultType.single); - } - return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; - }; - - XML.Namespaces = { - XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", - XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", - XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", - XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', - XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', - XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', - XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', - XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', - XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', - XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', - XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', - XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', - JUSTEPSCHEMA: "http://www.justep.com/xbiz#", - RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - JUSTEP: "http://www.justep.com/x5#", - 'get': function (type) { - type = type ? type.toLowerCase() : "string"; - if ("string" == type) { - return XML.Namespaces.XMLSCHEMA_STRING; - } - else if ("integer" == type) { - return XML.Namespaces.XMLSCHEMA_INTEGER; - } - else if ("long" == type) { - return XML.Namespaces.XMLSCHEMA_LONG; - } - else if ("float" == type) { - return XML.Namespaces.XMLSCHEMA_FLOAT; - } - else if ("double" == type) { - return XML.Namespaces.XMLSCHEMA_DOUBLE; - } - else if ("decimal" == type) { - return XML.Namespaces.XMLSCHEMA_DECIMAL; - } - else if ("date" == type) { - return XML.Namespaces.XMLSCHEMA_DATE; - } - else if ("time" == type) { - return XML.Namespaces.XMLSCHEMA_TIME; - } - else if ("datetime" == type) { - return XML.Namespaces.XMLSCHEMA_DATETIME; - } - else if ("boolean" == type) { - return XML.Namespaces.XMLSCHEMA_BOOLEAN; - } - } - }; -})(BI);BI.BehaviorFactory = { +};// ; +// !(function (BI) { +// +// if (BI.isIE()) { +// XMLSerializer = null; +// DOMParser = null; +// } +// +// +// var XML = { +// Document: { +// NodeType: { +// ELEMENT: 1, +// ATTRIBUTE: 2, +// TEXT: 3, +// CDATA_SECTION: 4, +// ENTITY_REFERENCE: 5, +// ENTITY: 6, +// PROCESSING_INSTRUCTION: 7, +// COMMENT: 8, +// DOCUMENT: 9, +// DOCUMENT_TYPE: 10, +// DOCUMENT_FRAGMENT: 11, +// NOTATION: 12 +// } +// } +// }; +// +// XML.ResultType = { +// single: 'single', +// array: 'array' +// }; +// +// XML.fromString = function (xmlStr) { +// try { +// var parser = new DOMParser(); +// return parser.parseFromString(xmlStr, "text/xml"); +// } catch (e) { +// var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; +// for (var i = 0; i < arrMSXML.length; i++) { +// try { +// var xmlDoc = new ActiveXObject(arrMSXML[i]); +// xmlDoc.setProperty("SelectionLanguage", "XPath"); +// xmlDoc.async = false; +// xmlDoc.loadXML(xmlStr); +// return xmlDoc; +// } catch (xmlError) { +// } +// } +// } +// }; +// +// XML.toString = function (xmlNode) { +// if (!BI.isIE()) { +// var xmlSerializer = new XMLSerializer(); +// return xmlSerializer.serializeToString(xmlNode); +// } else +// return xmlNode.xml; +// }; +// +// XML.getNSResolver = function (str) { +// if (!str) { +// return null; +// } +// var list = str.split(' '); +// var namespaces = {}; +// for (var i = 0; i < list.length; i++) { +// var pair = list[i].split('='); +// var fix = BI.trim(pair[0]).replace("xmlns:", ""); +// namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); +// } +// return function (prefix) { +// return namespaces[prefix]; +// }; +// }; +// +// XML.eval = function (context, xpathExp, resultType, namespaces) { +// if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { +// return XML.eval2(context, xpathExp, resultType, namespaces); +// } else { +// if (BI.isIE()) { +// namespaces = namespaces ? namespaces : ""; +// var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; +// doc.setProperty("SelectionNamespaces", namespaces); +// var result; +// if (resultType == this.ResultType.single) { +// result = context.selectSingleNode(xpathExp); +// } else { +// result = context.selectNodes(xpathExp) || []; +// } +// doc.setProperty("SelectionNamespaces", ""); +// return result; +// } else { +// var node = context; +// var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; +// var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; +// var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); +// +// if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { +// return col.singleNodeValue; +// } else { +// var thisColMemb = col.iterateNext(); +// var rowsCol = []; +// while (thisColMemb) { +// rowsCol[rowsCol.length] = thisColMemb; +// thisColMemb = col.iterateNext(); +// } +// return rowsCol; +// } +// } +// } +// }; +// +// XML.eval2 = function (context, xpathExp, resultType, namespaces) { +// if (resultType !== "single" && resultType !== undefined && resultType !== null) { +// throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); +// } +// +// if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { +// return context; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs, i; +// if (xpathExp.indexOf("/") != -1) { +// var items = xpathExp.split("/"); +// var isAbs = xpathExp.substring(0, 1) == "/"; +// for (i = 0; i < items.length; i++) { +// var item = items[i]; +// if (item === "") { +// continue; +// } else { +// var next = null; +// var ii = i + 1; +// for (; ii < items.length; ii++) { +// if (next === null) { +// next = items[ii]; +// } else { +// next = next + "/" + items[ii]; +// } +// } +// +// if (item == ".") { +// return this.eval(context, next, resultType); +// +// } else if (item == "..") { +// return this.eval2(context.parentNode, next, resultType); +// +// } else if (item == "*") { +// if (isAbs) { +// return this.eval2(context, next, resultType); +// +// } else { +// childs = context.childNodes; +// for (var j = 0; j < childs.length; j++) { +// var tmp = this.eval2(childs[j], next, resultType); +// if (tmp !== null) { +// return tmp; +// } +// } +// return null; +// } +// +// } else { +// if (isAbs) { +// if (context.nodeName == item) { +// return this.eval2(context, next, resultType); +// } else { +// return null; +// } +// } else { +// var child = this.getChildByName(context, item); +// if (child !== null) { +// return this.eval2(child, next, resultType); +// } else { +// return null; +// } +// +// } +// } +// +// } +// } +// +// return null; +// +// } else { +// if ("text()" == xpathExp) { +// childs = context.childNodes; +// for (i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.TEXT) { +// return childs[i]; +// } +// } +// return null; +// } else { +// return this.getChildByName(context, xpathExp); +// } +// } +// }; +// +// XML.getChildByName = function (context, name) { +// if (context === null || context === undefined || name === null || name === undefined) { +// return null; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs = context.childNodes; +// for (var i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { +// return childs[i]; +// } +// } +// +// return null; +// }; +// +// XML.appendChildren = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// if (isBefore && finded[i].firstNode) { +// this._insertBefore(finded[i], nodes, finded[i].firstNode); +// } else { +// for (var j = 0; j < nodes.length; j++) { +// finded[i].appendChild(nodes[j]); +// } +// } +// } +// return count; +// }; +// +// XML.removeNodes = function (context, xpathExp) { +// var nodes = this.eval(context, xpathExp); +// for (var i = 0; i < nodes.length; i++) { +// nodes[i].parentNode.removeChild(nodes[i]); +// } +// }; +// +// XML._insertBefore = function (parent, newchildren, refchild) { +// for (var i = 0; i < newchildren.length; i++) { +// parent.insertBefore(newchildren[i], refchild); +// } +// }; +// +// XML.insertNodes = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; +// this._insertBefore(finded[i].parentNode, nodes, refnode); +// } +// return count; +// }; +// +// XML.replaceNodes = function (context, xpathExp, nodes) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = finded[i]; +// var parent = refnode.parentNode; +// this._insertBefore(parent, nodes, refnode); +// parent.removeChild(refnode); +// } +// return count; +// }; +// +// XML.setNodeText = function (context, xpathExp, text) { +// var finded = this.eval(context, xpathExp, this.ResultType.single); +// if (finded === null) { +// return; +// } +// if (finded.nodeType == XML.Document.NodeType.ELEMENT) { +// var textNode = this.eval(finded, "./text()", this.ResultType.single); +// if (!textNode) { +// textNode = finded.ownerDocument.createTextNode(""); +// finded.appendChild(textNode); +// } +// textNode.nodeValue = text; +// } else { +// finded.nodeValue = text; +// } +// return; +// }; +// +// XML.getNodeText = function (context, xpathExp, defaultValue) { +// var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; +// if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { +// finded = this.eval(finded, "./text()", this.ResultType.single); +// } +// return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; +// }; +// +// XML.Namespaces = { +// XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", +// XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", +// XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", +// XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', +// XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', +// XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', +// XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', +// XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', +// XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', +// XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', +// XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', +// XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', +// JUSTEPSCHEMA: "http://www.justep.com/xbiz#", +// RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", +// JUSTEP: "http://www.justep.com/x5#", +// 'get': function (type) { +// type = type ? type.toLowerCase() : "string"; +// if ("string" == type) { +// return XML.Namespaces.XMLSCHEMA_STRING; +// } +// else if ("integer" == type) { +// return XML.Namespaces.XMLSCHEMA_INTEGER; +// } +// else if ("long" == type) { +// return XML.Namespaces.XMLSCHEMA_LONG; +// } +// else if ("float" == type) { +// return XML.Namespaces.XMLSCHEMA_FLOAT; +// } +// else if ("double" == type) { +// return XML.Namespaces.XMLSCHEMA_DOUBLE; +// } +// else if ("decimal" == type) { +// return XML.Namespaces.XMLSCHEMA_DECIMAL; +// } +// else if ("date" == type) { +// return XML.Namespaces.XMLSCHEMA_DATE; +// } +// else if ("time" == type) { +// return XML.Namespaces.XMLSCHEMA_TIME; +// } +// else if ("datetime" == type) { +// return XML.Namespaces.XMLSCHEMA_DATETIME; +// } +// else if ("boolean" == type) { +// return XML.Namespaces.XMLSCHEMA_BOOLEAN; +// } +// } +// }; +// })(BI); +BI.BehaviorFactory = { createBehavior: function(key, options){ var behavior; switch (key){ @@ -20127,6 +20110,11 @@ BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { } else { return _numberFormat((-text) + "", format.substr(numMod + 1)); } + } else { + //兼容格式处理负数的情况(copy:fr-jquery.format.js) + if (+text < 0 && format.charAt(0) !== '-') { + return _numberFormat((-text) + "", '-' + format); + } } var tp = text.split('.'), fp = format.split('.'), tleft = tp[0] || '', fleft = fp[0] || '', diff --git a/docs/core.js.orig b/docs/core.js.orig deleted file mode 100644 index 1658c3c94..000000000 --- a/docs/core.js.orig +++ /dev/null @@ -1,57374 +0,0 @@ -<<<<<<< HEAD -/*! - * jQuery JavaScript Library v1.9.1 - * http://jquery.com/ - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * - * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-2-4 - */ -(function( window, undefined ) { - -// Can't do this because several apps including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -// Support: Firefox 18+ -//"use strict"; -var - // The deferred used on DOM ready - readyList, - - // A central reference to the root jQuery(document) - rootjQuery, - - // Support: IE<9 - // For `typeof node.method` instead of `node.method !== undefined` - core_strundefined = typeof undefined, - - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - location = window.location, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // [[Class]] -> type pairs - class2type = {}, - - // List of deleted data cache ids, so we can reuse them - core_deletedIds = [], - - core_version = "1.9.1", - - // Save a reference to some core methods - core_concat = core_deletedIds.concat, - core_push = core_deletedIds.push, - core_slice = core_deletedIds.slice, - core_indexOf = core_deletedIds.indexOf, - core_toString = class2type.toString, - core_hasOwn = class2type.hasOwnProperty, - core_trim = core_version.trim, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, - - // Used for splitting on whitespace - core_rnotwhite = /\S+/g, - - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // A simple way to check for HTML strings - // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // The ready event handler - completed = function( event ) { - - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } - }, - // Clean-up method for dom ready events - detach = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: core_version, - - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - if ( scripts ) { - jQuery( scripts ).remove(); - } - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: function( data ) { - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - if ( data === null ) { - return data; - } - - if ( typeof data === "string" ) { - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - if ( data ) { - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - } - } - } - - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - core_push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return core_concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); - - if ( jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( list && ( !fired || stack ) ) { - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); -jQuery.support = (function() { - - var support, all, a, - input, select, fragment, - opt, eventName, isSupported, i, - div = document.createElement("div"); - - // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; - - // Support tests won't run in some limited or non-browser environments - all = div.getElementsByTagName("*"); - a = div.getElementsByTagName("a")[ 0 ]; - if ( !all || !a || !all.length ) { - return {}; - } - - // First batch of tests - select = document.createElement("select"); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName("input")[ 0 ]; - - a.style.cssText = "top:1px;float:left;opacity:.5"; - support = { - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: div.firstChild.nodeType === 3, - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: a.getAttribute("href") === "/a", - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.5/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) - checkOn: !!input.value, - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Tests for enctype support on a form (#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", - - // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode - boxModel: document.compatMode === "CSS1Compat", - - // Will be defined later - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - boxSizingReliable: true, - pixelPosition: false - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Support: IE<9 - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - // Check if we can trust getAttribute("value") - input = document.createElement("input"); - input.setAttribute( "value", "" ); - support.input = input.getAttribute( "value" ) === ""; - - // Check if an input maintains its value after becoming a radio - input.value = "t"; - input.setAttribute( "type", "radio" ); - support.radioValue = input.value === "t"; - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "checked", "t" ); - input.setAttribute( "name", "t" ); - - fragment = document.createDocumentFragment(); - fragment.appendChild( input ); - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php - for ( i in { submit: true, change: true, focusin: true }) { - div.setAttribute( eventName = "on" + i, "t" ); - - support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; - } - - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, marginDiv, tds, - divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - container = document.createElement("div"); - container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - - body.appendChild( container ).appendChild( div ); - - // Support: IE8 - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; - tds = div.getElementsByTagName("td"); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Support: IE8 - // Check if empty table cells still have offsetWidth/Height - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check box-sizing and margin behavior - div.innerHTML = ""; - div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; - support.boxSizing = ( div.offsetWidth === 4 ); - support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); - - // Use window.getComputedStyle because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = div.appendChild( document.createElement("div") ); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - if ( typeof div.style.zoom !== core_strundefined ) { - // Support: IE<8 - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - div.innerHTML = ""; - div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Support: IE6 - // Check if elements with layout shrink-wrap their children - div.style.display = "block"; - div.innerHTML = "<div></div>"; - div.firstChild.style.width = "5px"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - - if ( support.inlineBlockNeedsLayout ) { - // Prevent IE 6 from affecting layout for positioned elements #11048 - // Prevent IE from shrinking the body in IE 7 mode #12869 - // Support: IE<8 - body.style.zoom = 1; - } - } - - body.removeChild( container ); - - // Null elements to avoid leaks in IE - container = div = tds = marginDiv = null; - }); - - // Null elements to avoid leaks in IE - all = select = fragment = opt = a = input = null; - - return support; -})(); - -var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; - -function internalData( elem, name, data, pvt /* Internal Use Only */ ){ - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; -} - -function internalRemoveData( elem, name, pvt ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var i, l, thisCache, - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } else { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = name.concat( jQuery.map( name, jQuery.camelCase ) ); - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } - - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); - - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - } else if ( jQuery.support.deleteExpando || cache != cache.window ) { - delete cache[ id ]; - - // When all else fails, null - } else { - cache[ id ] = null; - } -} - -jQuery.extend({ - cache: {}, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data ) { - return internalData( elem, name, data ); - }, - - removeData: function( elem, name ) { - return internalRemoveData( elem, name ); - }, - - // For internal use only. - _data: function( elem, name, data ) { - return internalData( elem, name, data, true ); - }, - - _removeData: function( elem, name ) { - return internalRemoveData( elem, name, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - // Do not set data on non-element because it will not be cleared (#8335). - if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { - return false; - } - - var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; - - // nodes accept data unless otherwise specified; rejection can be conditional - return !noData || noData !== true && elem.getAttribute("classid") === noData; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var attrs, name, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attrs = elem.attributes; - for ( ; i < attrs.length; i++ ) { - name = attrs[i].name; - - if ( !name.indexOf( "data-" ) ) { - name = jQuery.camelCase( name.slice(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - // Try to fetch any internally stored data first - return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; - } - - this.each(function() { - jQuery.data( this, key, value ); - }); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - hooks.cur = fn; - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery._removeData( elem, type + "queue" ); - jQuery._removeData( elem, key ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var nodeHook, boolHook, - rclass = /[\t\r\n]/g, - rreturn = /\r/g, - rfocusable = /^(?:input|select|textarea|button|object)$/i, - rclickable = /^(?:a|area)$/i, - rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, - ruseDefault = /^(?:checked|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - getSetInput = jQuery.support.input; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call( this, j, this.className ) ); - }); - } - - if ( proceed ) { - // The disjunction here is for better compressibility (see removeClass) - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - " " - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - elem.className = jQuery.trim( cur ); - - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = arguments.length === 0 || typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call( this, j, this.className ) ); - }); - } - if ( proceed ) { - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - "" - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - elem.className = value ? jQuery.trim( cur ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.match( core_rnotwhite ) || []; - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - // Toggle whole class name - } else if ( type === core_strundefined || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // If the element has a class name or if we're passed "false", - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var ret, hooks, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val, - self = jQuery(this); - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // oldIE doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attr: function( elem, name, value ) { - var hooks, notxml, ret, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === core_strundefined ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - - } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - // In IE9+, Flash objects don't have .getAttribute (#12945) - // Support: IE9+ - if ( typeof elem.getAttribute !== core_strundefined ) { - ret = elem.getAttribute( name ); - } - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var name, propName, - i = 0, - attrNames = value && value.match( core_rnotwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( (name = attrNames[i++]) ) { - propName = jQuery.propFix[ name ] || name; - - // Boolean attributes get special treatment (#10870) - if ( rboolean.test( name ) ) { - // Set corresponding property to false for boolean attributes - // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 - if ( !getSetAttribute && ruseDefault.test( name ) ) { - elem[ jQuery.camelCase( "default-" + name ) ] = - elem[ propName ] = false; - } else { - elem[ propName ] = false; - } - - // See #9699 for explanation of this approach (setting first, then removal) - } else { - jQuery.attr( elem, name, "" ); - } - - elem.removeAttribute( getSetAttribute ? name : propName ); - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to default in case type is set after value during creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - var - // Use .prop to determine if this attribute is understood as boolean - prop = jQuery.prop( elem, name ), - - // Fetch it accordingly - attr = typeof prop === "boolean" && elem.getAttribute( name ), - detail = typeof prop === "boolean" ? - - getSetInput && getSetAttribute ? - attr != null : - // oldIE fabricates an empty string for missing boolean attributes - // and conflates checked/selected into attroperties - ruseDefault.test( name ) ? - elem[ jQuery.camelCase( "default-" + name ) ] : - !!attr : - - // fetch an attribute node for properties not recognized as boolean - elem.getAttributeNode( name ); - - return detail && detail.value !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - // IE<8 needs the *property* name - elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); - - // Use defaultChecked and defaultSelected for oldIE - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; - } - - return name; - } -}; - -// fix oldIE value attroperty -if ( !getSetInput || !getSetAttribute ) { - jQuery.attrHooks.value = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return jQuery.nodeName( elem, "input" ) ? - - // Ignore the value *property* by using defaultValue - elem.defaultValue : - - ret && ret.specified ? ret.value : undefined; - }, - set: function( elem, value, name ) { - if ( jQuery.nodeName( elem, "input" ) ) { - // Does not return so that setAttribute is also used - elem.defaultValue = value; - } else { - // Use nodeHook if defined (#1954); otherwise setAttribute is fine - return nodeHook && nodeHook.set( elem, value, name ); - } - } - }; -} - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? - ret.value : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - elem.setAttributeNode( - (ret = elem.ownerDocument.createAttribute( name )) - ); - } - - ret.value = value += ""; - - // Break association with cloned elements by also using setAttribute (#9646) - return name === "value" || value === elem.getAttribute( name ) ? - value : - undefined; - } - }; - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - nodeHook.set( elem, value === "" ? false : value, name ); - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); -} - - -// Some attributes require a special call on IE -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret == null ? undefined : ret; - } - }); - }); - - // href/src property should get the full normalized URL (#10299/#12915) - jQuery.each([ "href", "src" ], function( i, name ) { - jQuery.propHooks[ name ] = { - get: function( elem ) { - return elem.getAttribute( name, 4 ); - } - }; - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Note: IE uppercases css property names, but if we were to .toLowerCase() - // .cssText, that would destroy case senstitivity in URL's, like in "background" - return elem.style.cssText || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); -var rformElems = /^(?:input|select|textarea)$/i, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - var tmp, events, t, handleObjIn, - special, eventHandle, handleObj, - handlers, type, namespaces, origType, - elemData = jQuery._data( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - var j, handleObj, tmp, - origCount, t, events, - special, handlers, type, - namespaces, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery._removeData( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - var handle, ontype, cur, - bubbleType, special, tmp, i, - eventPath = [ elem || document ], - type = core_hasOwn.call( event, "type" ) ? event.type : event, - namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - event.isTrigger = true; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - try { - elem[ type ](); - } catch ( e ) { - // IE<9 dies on focus/blur to hidden element (#1486,#12518) - // only reproducible on winXP IE8 native, not IE9 in IE8 mode - } - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, ret, handleObj, matched, j, - handlerQueue = [], - args = core_slice.call( arguments ), - handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - var obj = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ); - if(obj.apply){ - ret = obj.apply( matched.elem, args ); - } - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var sel, handleObj, matches, i, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG <use> instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - for ( ; cur != this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - } - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== document.activeElement && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === document.activeElement && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - - beforeunload: { - postDispatch: function( event ) { - - // Even when returnValue equals to undefined Firefox will still show alert - if ( event.result !== undefined ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === core_strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); -/*! - * Sizzle CSS Selector Engine - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license - * http://sizzlejs.com/ - */ -(function( window, undefined ) { - -var i, - cachedruns, - Expr, - getText, - isXML, - compile, - hasDuplicate, - outermostContext, - - // Local document vars - setDocument, - document, - docElem, - documentIsXML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - sortOrder, - - // Instance-specific data - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - support = {}, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - - // General-purpose constants - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - // Array methods - arr = [], - pop = arr.pop, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - operators = "([*^$|!~]?=)", - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rsibling = /[\x20\t\r\n\f]*[+~]/, - - rnative = /^[^{]+\{\s*\[native code/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rescape = /'|\\/g, - rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, - funescape = function( _, escaped ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - return high !== high ? - escaped : - // BMP codepoint - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -// Use a stripped-down slice if we can't use a native one -try { - slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType; -} catch ( e ) { - slice = function( i ) { - var elem, - results = []; - while ( (elem = this[i++]) ) { - results.push( elem ); - } - return results; - }; -} - -/** - * For feature detection - * @param {Function} fn The function to test for native support - */ -function isNative( fn ) { - return rnative.test( fn + "" ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var cache, - keys = []; - - return (cache = function( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key ] = value); - }); -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return fn( div ); - } catch (e) { - return false; - } finally { - // release memory in IE - div = null; - } -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( !documentIsXML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { - push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); - return results; - } - } - - // QSA path - if ( support.qsa && !rbuggyQSA.test(selector) ) { - old = true; - nid = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, slice.call( newContext.querySelectorAll( - newSelector - ), 0 ) ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Detect xml - * @param {Element|Object} elem An element or a document - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - - // Support tests - documentIsXML = isXML( doc ); - - // Check if getElementsByTagName("*") returns only elements - support.tagNameNoComments = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Check if attributes should be retrieved by attribute nodes - support.attributes = assert(function( div ) { - div.innerHTML = "<select></select>"; - var type = typeof div.lastChild.getAttribute("multiple"); - // IE8 returns a string for some attributes even when not present - return type !== "boolean" && type !== "string"; - }); - - // Check if getElementsByClassName can be trusted - support.getByClassName = assert(function( div ) { - // Opera can't find a second classname (in 9.6) - div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; - if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { - return false; - } - - // Safari 3.2 caches class attributes and doesn't catch changes - div.lastChild.className = "e"; - return div.getElementsByClassName("e").length === 2; - }); - - // Check if getElementById returns elements by name - // Check if getElementsByName privileges form controls or returns elements by ID - support.getByName = assert(function( div ) { - // Inject content - div.id = expando + 0; - div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; - docElem.insertBefore( div, docElem.firstChild ); - - // Test - var pass = doc.getElementsByName && - // buggy browsers will return fewer than the correct 2 - doc.getElementsByName( expando ).length === 2 + - // buggy browsers will return more than the correct 0 - doc.getElementsByName( expando + 0 ).length; - support.getIdNotName = !doc.getElementById( expando ); - - // Cleanup - docElem.removeChild( div ); - - return pass; - }); - - // IE6/7 return modified attributes - Expr.attrHandle = assert(function( div ) { - div.innerHTML = "<a href='#'></a>"; - return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && - div.firstChild.getAttribute("href") === "#"; - }) ? - {} : - { - "href": function( elem ) { - return elem.getAttribute( "href", 2 ); - }, - "type": function( elem ) { - return elem.getAttribute("type"); - } - }; - - // ID find and filter - if ( support.getIdNotName ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && !documentIsXML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && !documentIsXML ) { - var m = context.getElementById( id ); - - return m ? - m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? - [m] : - undefined : - []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.tagNameNoComments ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Name - Expr.find["NAME"] = support.getByName && function( tag, context ) { - if ( typeof context.getElementsByName !== strundefined ) { - return context.getElementsByName( name ); - } - }; - - // Class - Expr.find["CLASS"] = support.getByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { - return context.getElementsByClassName( className ); - } - }; - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21), - // no need to also add to buggyMatches since matches checks buggyQSA - // A support test would require too much code (would include document ready) - rbuggyQSA = [ ":focus" ]; - - if ( (support.qsa = isNative(doc.querySelectorAll)) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explictly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = "<select><option selected=''></option></select>"; - - // IE8 - Some boolean attributes are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - - // Opera 10-12/IE8 - ^= $= *= and empty values - // Should not select anything - div.innerHTML = "<input type='hidden' i=''/>"; - if ( div.querySelectorAll("[i^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || - docElem.mozMatchesSelector || - docElem.webkitMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - // Document order sorting - sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - var compare; - - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { - if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { - if ( a === doc || contains( preferredDoc, a ) ) { - return -1; - } - if ( b === doc || contains( preferredDoc, b ) ) { - return 1; - } - return 0; - } - return compare & 4 ? -1 : 1; - } - - return a.compareDocumentPosition ? -1 : 1; - } : - function( a, b ) { - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Parentless nodes are either documents or disconnected - } else if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - // Always assume the presence of duplicates if sort doesn't - // pass them to our comparison function (as in Google Chrome). - hasDuplicate = false; - [0, 0].sort( sortOrder ); - support.detectDuplicates = hasDuplicate; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - // rbuggyQSA always contains :focus, so no need for an existence check - if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - var val; - - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - if ( !documentIsXML ) { - name = name.toLowerCase(); - } - if ( (val = Expr.attrHandle[ name ]) ) { - return val( elem ); - } - if ( documentIsXML || support.attributes ) { - return elem.getAttribute( name ); - } - return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? - name : - val && val.specified ? val.value : null; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -// Document sorting and removing duplicates -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - i = 1, - j = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( ; (elem = results[i]); i++ ) { - if ( elem === results[ i - 1 ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - return results; -}; - -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -// Returns a function to use in pseudos for input types -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -// Returns a function to use in pseudos for buttons -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -// Returns a function to use in pseudos for positionals -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[5] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[4] ) { - match[2] = match[4]; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeName ) { - if ( nodeName === "*" ) { - return function() { return true; }; - } - - nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifider - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsXML ? - elem.getAttribute("xml:lang") || elem.getAttribute("lang") : - elem.lang) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( tokens = [] ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push( { - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - } ); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push( { - value: matched, - type: type, - matches: match - } ); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var data, cache, outerCache, - dirkey = dirruns + " " + doneName; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { - if ( (data = cache[1]) === true || data === cachedruns ) { - return data === true; - } - } else { - cache = outerCache[ dir ] = [ dirkey ]; - cache[1] = matcher( elem, context, xml ) || cachedruns; - if ( cache[1] === true ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - // A counter to specify which element is currently being matched - var matcherCachedRuns = 0, - bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); - - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = matcherCachedRuns; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++matcherCachedRuns; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { - var i, tokens, token, type, find, - match = tokenize( selector ); - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - context.nodeType === 9 && !documentIsXML && - Expr.relative[ tokens[1].type ] ) { - - context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; - if ( !context ) { - return results; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && context.parentNode || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, slice.call( seed, 0 ) ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - documentIsXML, - results, - rsibling.test( selector ) - ); - return results; -} - -// Deprecated -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Easy API for creating new setFilters -function setFilters() {} -Expr.filters = setFilters.prototype = Expr.pseudos; -Expr.setFilters = new setFilters(); - -// Initialize with the default document -setDocument(); - -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})( window ); -var runtil = /Until$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - isSimple = /^.[^:#\[\.,]*$/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, ret, self, - len = this.length; - - if ( typeof selector !== "string" ) { - self = this; - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - ret = []; - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, this[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; - return ret; - }, - - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false) ); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true) ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - rneedsContext.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - cur = this[i]; - - while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - } - cur = cur.parentNode; - } - } - - return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( jQuery.unique(all) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -jQuery.fn.andSelf = jQuery.fn.addBack; - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( this.length > 1 && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /<tbody/i, - rhtml = /<|&#?\w+;/, - rnoInnerhtml = /<(?:script|style|link)/i, - manipulation_rcheckableType = /^(?:checkbox|radio)$/i, - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /^$|\/(?:java|ecma)script/i, - rscriptTypeMasked = /^true\/(.*)/, - rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "<select multiple='multiple'>", "</select>" ], - legend: [ 1, "<fieldset>", "</fieldset>" ], - area: [ 1, "<map>", "</map>" ], - param: [ 1, "<object>", "</object>" ], - thead: [ 1, "<table>", "</table>" ], - tr: [ 2, "<table><tbody>", "</tbody></table>" ], - col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], - td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - }, - - append: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.insertBefore( elem, this.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, false, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, false, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1></$2>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function( value ) { - var isFunc = jQuery.isFunction( value ); - - // Make sure that the elements are removed from the DOM before they are inserted - // this can help fix replacing a parent with child elements - if ( !isFunc && typeof value !== "string" ) { - value = jQuery( value ).not( this ).detach(); - } - - return this.domManip( [ value ], true, function( elem ) { - var next = this.nextSibling, - parent = this.parentNode; - - if ( parent ) { - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - }); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, table, callback ) { - - // Flatten any nested arrays - args = core_concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, table ? self.html() : undefined ); - } - self.domManip( args, table, callback ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - table = table && jQuery.nodeName( first, "tr" ); - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( - table && jQuery.nodeName( this[i], "table" ) ? - findOrAppend( this[i], "tbody" ) : - this[i], - node, - i - ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Hope ajax is available... - jQuery.ajax({ - url: node.src, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -function findOrAppend( elem, tag ) { - return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - var attr = elem.getAttributeNode("type"); - elem.type = ( attr && attr.specified ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - core_push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( manipulation_rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted <tbody> from table fragments - if ( !jQuery.support.tbody ) { - - // String was a <table>, *may* have spurious <tbody> - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare <thead> or <tfoot> - wrap[1] === "<table>" && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== core_strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - core_deletedIds.push( id ); - } - } - } - } - } -}); -var iframe, getStyles, curCSS, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity\s*=\s*([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -function showHide( elements, show ) { - var display, elem, hidden, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - values[ index ] = jQuery._data( elem, "olddisplay" ); - display = elem.style.display; - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); - } - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - var len, styles, - map = {}, - i = 0; - - if ( jQuery.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - var bool = typeof state === "boolean"; - - return this.each(function() { - if ( bool ? state : isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Exclude the following css properties to add px - cssNumber: { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var num, val, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -// NOTE: we've included the "window" in window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - getStyles = function( elem ) { - return window.getComputedStyle( elem, null ); - }; - - curCSS = function( elem, name, _computed ) { - var width, minWidth, maxWidth, - computed = _computed || getStyles( elem ), - - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, - style = elem.style; - - if ( computed ) { - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; - }; -} else if ( document.documentElement.currentStyle ) { - getStyles = function( elem ) { - return elem.currentStyle; - }; - - curCSS = function( elem, name, _computed ) { - var left, rs, rsLeft, - computed = _computed || getStyles( elem ), - ret = computed ? computed[ name ] : undefined, - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - - // Remember the original values - left = style.left; - rs = elem.runtimeStyle; - rsLeft = rs && rs.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - rs.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - rs.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); - } - - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } else { - // at this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - styles = getStyles( elem ), - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, styles ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles - ) - ) + "px"; -} - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - // Use the already-created iframe if possible - iframe = ( iframe || - jQuery("<iframe frameborder='0' width='0' height='0'/>") - .css( "cssText", "display:block !important" ) - ).appendTo( doc.documentElement ); - - // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse - doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document; - doc.write("<!doctype html><html><body>"); - doc.close(); - - display = actualDisplay( nodeName, doc ); - iframe.detach(); - } - - // Store the correct default display - elemdisplay[ nodeName ] = display; - } - - return display; -} - -// Called ONLY from within css_defaultDisplay -function actualDisplay( name, doc ) { - var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), - display = jQuery.css( elem[0], "display" ); - elem.remove(); - return display; -} - -jQuery.each([ "height", "width" ], function( i, name ) { - jQuery.cssHooks[ name ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - // certain elements can have dimension info if we invisibly show them - // however, it must have a current display style that would benefit from this - return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ? - jQuery.swap( elem, cssShow, function() { - return getWidthOrHeight( elem, name, extra ); - }) : - getWidthOrHeight( elem, name, extra ); - } - }, - - set: function( elem, value, extra ) { - var styles = extra && getStyles( elem ); - return setPositiveNumber( elem, value, extra ? - augmentWidthOrHeight( - elem, - name, - extra, - jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - styles - ) : 0 - ); - } - }; -}); - -if ( !jQuery.support.opacity ) { - jQuery.cssHooks.opacity = { - get: function( elem, computed ) { - // IE uses filters for opacity - return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? - ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : - computed ? "1" : ""; - }, - - set: function( elem, value ) { - var style = elem.style, - currentStyle = elem.currentStyle, - opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", - filter = currentStyle && currentStyle.filter || style.filter || ""; - - // IE has trouble with opacity if it does not have layout - // Force it by setting the zoom level - style.zoom = 1; - - // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 - // if value === "", then remove inline opacity #12685 - if ( ( value >= 1 || value === "" ) && - jQuery.trim( filter.replace( ralpha, "" ) ) === "" && - style.removeAttribute ) { - - // Setting style.filter to null, "" & " " still leave "filter:" in the cssText - // if "filter:" is present at all, clearType is disabled, we want to avoid this - // style.removeAttribute is IE Only, but so apparently is this code path... - style.removeAttribute( "filter" ); - - // if there is no filter style applied in a css rule or unset inline opacity, we are done - if ( value === "" || currentStyle && !currentStyle.filter ) { - return; - } - } - - // otherwise, set new filter values - style.filter = ralpha.test( filter ) ? - filter.replace( ralpha, opacity ) : - filter + " " + opacity; - } - }; -} - -// These hooks cannot be added until DOM ready because the support test -// for it is not run until after DOM ready -jQuery(function() { - if ( !jQuery.support.reliableMarginRight ) { - jQuery.cssHooks.marginRight = { - get: function( elem, computed ) { - if ( computed ) { - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - // Work around by temporarily setting element display to inline-block - return jQuery.swap( elem, { "display": "inline-block" }, - curCSS, [ elem, "marginRight" ] ); - } - } - }; - } - - // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 - // getComputedStyle returns percent when specified for top/left/bottom/right - // rather than make the css module depend on the offset module, we just check for it here - if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { - jQuery.each( [ "top", "left" ], function( i, prop ) { - jQuery.cssHooks[ prop ] = { - get: function( elem, computed ) { - if ( computed ) { - computed = curCSS( elem, prop ); - // if curCSS returns percentage, fallback to offset - return rnumnonpx.test( computed ) ? - jQuery( elem ).position()[ prop ] + "px" : - computed; - } - } - }; - }); - } - -}); - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.hidden = function( elem ) { - // Support: Opera <= 12.12 - // Opera reports offsetWidths and offsetHeights less than zero on some elements - return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || - (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); - }; - - jQuery.expr.filters.visible = function( elem ) { - return !jQuery.expr.filters.hidden( elem ); - }; -} - -// These hooks are used by animate to expand properties -jQuery.each({ - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // assumes a single number if not a string - parts = typeof value === "string" ? value.split(" ") : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( !rmargin.test( prefix ) ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -}); -var r20 = /%20/g, - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -jQuery.fn.extend({ - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map(function(){ - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - }) - .filter(function(){ - var type = this.type; - // Use .is(":disabled") so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !manipulation_rcheckableType.test( type ) ); - }) - .map(function( i, elem ){ - var val = jQuery( this ).val(); - - return val == null ? - null : - jQuery.isArray( val ) ? - jQuery.map( val, function( val ){ - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }) : - { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }).get(); - } -}); - -//Serialize an array of form elements or a set of -//key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, value ) { - // If value is a function, invoke it and return its value - value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); - s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); - }; - - // Set traditional to true for jQuery <= 1.3.2 behavior. - if ( traditional === undefined ) { - traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - }); - - } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ).replace( r20, "+" ); -}; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( jQuery.isArray( obj ) ) { - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - // Item is non-scalar (array or object), encode its numeric index. - buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); - } - }); - - } else if ( !traditional && jQuery.type( obj ) === "object" ) { - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - // Serialize scalar item. - add( prefix, obj ); - } -} -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; -}); - -jQuery.fn.hover = function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); -}; -var - // Document location - ajaxLocParts, - ajaxLocation, - ajax_nonce = jQuery.now(), - - ajax_rquery = /\?/, - rhash = /#.*$/, - rts = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, - - // Keep a copy of the old load method - _load = jQuery.fn.load, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat("*"); - -// #8138, IE may throw an exception when accessing -// a field from window.location if document.domain has been set -try { - ajaxLocation = location.href; -} catch( e ) { - // Use the href attribute of an A element - // since IE will modify it given document.location - ajaxLocation = document.createElement( "a" ); - ajaxLocation.href = ""; - ajaxLocation = ajaxLocation.href; -} - -// Segment location into parts -ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || []; - - if ( jQuery.isFunction( func ) ) { - // For each dataType in the dataTypeExpression - while ( (dataType = dataTypes[i++]) ) { - // Prepend if requested - if ( dataType[0] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); - - // Otherwise append - } else { - (structure[ dataType ] = structure[ dataType ] || []).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - }); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var deep, key, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -jQuery.fn.load = function( url, params, callback ) { - if ( typeof url !== "string" && _load ) { - return _load.apply( this, arguments ); - } - - var selector, response, type, - self = this, - off = url.indexOf(" "); - - if ( off >= 0 ) { - selector = url.slice( off, url.length ); - url = url.slice( 0, off ); - } - - // If it's a function - if ( jQuery.isFunction( params ) ) { - - // We assume that it's the callback - callback = params; - params = undefined; - - // Otherwise, build a param string - } else if ( params && typeof params === "object" ) { - type = "POST"; - } - - // If we have elements to modify, make the request - if ( self.length > 0 ) { - jQuery.ajax({ - url: url, - - // if "type" variable is undefined, then "GET" method will be used - type: type, - dataType: "html", - data: params - }).done(function( responseText ) { - - // Save response for use in complete callback - response = arguments; - - self.html( selector ? - - // If a selector was specified, locate the right elements in a dummy div - // Exclude scripts to avoid IE 'Permission Denied' errors - jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : - - // Otherwise use the full result - responseText ); - - }).complete( callback && function( jqXHR, status ) { - self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); - }); - } - - return this; -}; - -// Attach a bunch of functions for handling common AJAX events -jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){ - jQuery.fn[ type ] = function( fn ){ - return this.on( type, fn ); - }; -}); - -jQuery.each( [ "get", "post" ], function( i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - // shift arguments if data argument was omitted - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - return jQuery.ajax({ - url: url, - type: method, - dataType: type, - data: data, - success: callback - }); - }; -}); - -jQuery.extend({ - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: ajaxLocation, - type: "GET", - isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /xml/, - html: /html/, - json: /json/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": window.String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": jQuery.parseJSON, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var // Cross-domain detection vars - parts, - // Loop variable - i, - // URL without anti-cache param - cacheURL, - // Response headers as string - responseHeadersString, - // timeout handle - timeoutTimer, - - // To know if global events are to be dispatched - fireGlobals, - - transport, - // Response headers - responseHeaders, - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - // Callbacks context - callbackContext = s.context || s, - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks("once memory"), - // Status-dependent callbacks - statusCode = s.statusCode || {}, - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - // The jqXHR state - state = 0, - // Default abort message - strAbort = "canceled", - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( state === 2 ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( (match = rheaders.exec( responseHeadersString )) ) { - responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; - } - } - match = responseHeaders[ key.toLowerCase() ]; - } - return match == null ? null : match; - }, - - // Raw string - getAllResponseHeaders: function() { - return state === 2 ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - var lname = name.toLowerCase(); - if ( !state ) { - name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( !state ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( state < 2 ) { - for ( code in map ) { - // Lazy-add the new callback in a way that preserves old ones - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } else { - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ).complete = completeDeferred.add; - jqXHR.success = jqXHR.done; - jqXHR.error = jqXHR.fail; - - // Remove hash character (#7531: and string promotion) - // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""]; - - // A cross-domain request is in order when we have a protocol:host:port mismatch - if ( s.crossDomain == null ) { - parts = rurl.exec( s.url.toLowerCase() ); - s.crossDomain = !!( parts && - ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || - ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != - ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) - ); - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( state === 2 ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - fireGlobals = s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger("ajaxStart"); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - cacheURL = s.url; - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // If data is available, append data to url - if ( s.data ) { - cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add anti-cache in url if needed - if ( s.cache === false ) { - s.url = rts.test( cacheURL ) ? - - // If there is already a '_' parameter, set its value - cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) : - - // Otherwise add one to the end - cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++; - } - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { - // Abort if not done already and return - return jqXHR.abort(); - } - - // aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - for ( i in { success: 1, error: 1, complete: 1 } ) { - jqXHR[ i ]( s[ i ] ); - } - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = setTimeout(function() { - jqXHR.abort("timeout"); - }, s.timeout ); - } - - try { - state = 1; - transport.send( requestHeaders, done ); - } catch ( e ) { - // Propagate exception as error if not done - if ( state < 2 ) { - done( -1, e ); - // Simply rethrow otherwise - } else { - throw e; - } - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Called once - if ( state === 2 ) { - return; - } - - // State is "done" now - state = 2; - - // Clear timeout if it exists - if ( timeoutTimer ) { - clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // If successful, handle type chaining - if ( status >= 200 && status < 300 || status === 304 ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader("Last-Modified"); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader("etag"); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 ) { - isSuccess = true; - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - isSuccess = true; - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - isSuccess = ajaxConvert( s, response ); - statusText = isSuccess.state; - success = isSuccess.data; - error = isSuccess.error; - isSuccess = !error; - } - } else { - // We extract error from statusText - // then normalize statusText and status for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger("ajaxStop"); - } - } - } - - return jqXHR; - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - } -}); - -/* Handles responses to an ajax request: - * - sets all responseXXX fields accordingly - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - var firstDataType, ct, finalDataType, type, - contents = s.contents, - dataTypes = s.dataTypes, - responseFields = s.responseFields; - - // Fill responseXXX fields - for ( type in responseFields ) { - if ( type in responses ) { - jqXHR[ responseFields[type] ] = responses[ type ]; - } - } - - // Remove auto dataType and get content-type in the process - while( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -// Chain conversions given the request and the original response -function ajaxConvert( s, response ) { - var conv2, current, conv, tmp, - converters = {}, - i = 0, - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(), - prev = dataTypes[ 0 ]; - - // Apply the dataFilter if provided - if ( s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - // Convert to each sequential dataType, tolerating list modification - for ( ; (current = dataTypes[++i]); ) { - - // There's only work to do if current dataType is non-auto - if ( current !== "*" ) { - - // Convert response if prev dataType is non-auto and differs from current - if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split(" "); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.splice( i--, 0, current ); - } - - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s["throws"] ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; - } - } - } - } - - // Update prev for next iteration - prev = current; - } - } - - return { state: "success", data: response }; -} -// Install script dataType -jQuery.ajaxSetup({ - accepts: { - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /(?:java|ecma)script/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -}); - -// Handle cache's special case and global -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - s.global = false; - } -}); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function(s) { - - // This transport only deals with cross domain requests - if ( s.crossDomain ) { - - var script, - head = document.head || jQuery("head")[0] || document.documentElement; - - return { - - send: function( _, callback ) { - - script = document.createElement("script"); - - script.async = true; - - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } - - script.src = s.url; - - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function( _, isAbort ) { - - if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - - // Remove the script - if ( script.parentNode ) { - script.parentNode.removeChild( script ); - } - - // Dereference the script - script = null; - - // Callback if not abort - if ( !isAbort ) { - callback( 200, "success" ); - } - } - }; - - // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending - // Use native DOM manipulation to avoid our domManip AJAX trickery - head.insertBefore( script, head.firstChild ); - }, - - abort: function() { - if ( script ) { - script.onload( undefined, true ); - } - } - }; - } -}); -var oldCallbacks = [], - rjsonp = /(=)\?(?=&|$)|\?\?/; - -// Default jsonp settings -jQuery.ajaxSetup({ - jsonp: "callback", - jsonpCallback: function() { - var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) ); - this[ callback ] = true; - return callback; - } -}); - -// Detect, normalize options and install callbacks for jsonp requests -jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { - - var callbackName, overwritten, responseContainer, - jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? - "url" : - typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" - ); - - // Handle iff the expected data type is "jsonp" or we have a parameter to set - if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { - - // Get callback name, remembering preexisting value associated with it - callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? - s.jsonpCallback() : - s.jsonpCallback; - - // Insert callback into url or form data - if ( jsonProp ) { - s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); - } else if ( s.jsonp !== false ) { - s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; - } - - // Use data converter to retrieve json after script execution - s.converters["script json"] = function() { - if ( !responseContainer ) { - jQuery.error( callbackName + " was not called" ); - } - return responseContainer[ 0 ]; - }; - - // force json dataType - s.dataTypes[ 0 ] = "json"; - - // Install callback - overwritten = window[ callbackName ]; - window[ callbackName ] = function() { - responseContainer = arguments; - }; - - // Clean-up function (fires after converters) - jqXHR.always(function() { - // Restore preexisting value - window[ callbackName ] = overwritten; - - // Save back as free - if ( s[ callbackName ] ) { - // make sure that re-using the options doesn't screw things around - s.jsonpCallback = originalSettings.jsonpCallback; - - // save the callback name for future use - oldCallbacks.push( callbackName ); - } - - // Call if it was a function and we have a response - if ( responseContainer && jQuery.isFunction( overwritten ) ) { - overwritten( responseContainer[ 0 ] ); - } - - responseContainer = overwritten = undefined; - }); - - // Delegate to script - return "script"; - } -}); -var xhrCallbacks, xhrSupported, - xhrId = 0, - // #5280: Internet Explorer will keep connections alive if we don't abort on unload - xhrOnUnloadAbort = window.ActiveXObject && function() { - // Abort all pending requests - var key; - for ( key in xhrCallbacks ) { - xhrCallbacks[ key ]( undefined, true ); - } - }; - -// Functions to create xhrs -function createStandardXHR() { - try { - return new window.XMLHttpRequest(); - } catch( e ) {} -} - -function createActiveXHR() { - try { - return new window.ActiveXObject("Microsoft.XMLHTTP"); - } catch( e ) {} -} - -// Create the request object -// (This is still attached to ajaxSettings for backward compatibility) -jQuery.ajaxSettings.xhr = window.ActiveXObject ? - /* Microsoft failed to properly - * implement the XMLHttpRequest in IE7 (can't request local files), - * so we use the ActiveXObject when it is available - * Additionally XMLHttpRequest can be disabled in IE7/IE8 so - * we need a fallback. - */ - function() { - return !this.isLocal && createStandardXHR() || createActiveXHR(); - } : - // For all other browsers, use the standard XMLHttpRequest object - createStandardXHR; - -// Determine support properties -xhrSupported = jQuery.ajaxSettings.xhr(); -jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -xhrSupported = jQuery.support.ajax = !!xhrSupported; - -// Create transport if the browser can provide an xhr -if ( xhrSupported ) { - - jQuery.ajaxTransport(function( s ) { - // Cross domain only allowed if supported through XMLHttpRequest - if ( !s.crossDomain || jQuery.support.cors ) { - - var callback; - - return { - send: function( headers, complete ) { - - // Get a new xhr - var handle, i, - xhr = s.xhr(); - - // Open the socket - // Passing null username, generates a login popup on Opera (#2865) - if ( s.username ) { - xhr.open( s.type, s.url, s.async, s.username, s.password ); - } else { - xhr.open( s.type, s.url, s.async ); - } - - // Apply custom fields if provided - if ( s.xhrFields ) { - for ( i in s.xhrFields ) { - xhr[ i ] = s.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( s.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( s.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !s.crossDomain && !headers["X-Requested-With"] ) { - headers["X-Requested-With"] = "XMLHttpRequest"; - } - - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - } catch( err ) {} - - // Do send the request - // This may raise an exception which is actually - // handled in jQuery.ajax (so no try/catch here) - xhr.send( ( s.hasContent && s.data ) || null ); - - // Listener - callback = function( _, isAbort ) { - var status, responseHeaders, statusText, responses; - - // Firefox throws exceptions when accessing properties - // of an xhr when a network error occurred - // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) - try { - - // Was never called and is aborted or complete - if ( callback && ( isAbort || xhr.readyState === 4 ) ) { - - // Only called once - callback = undefined; - - // Do not keep as active anymore - if ( handle ) { - xhr.onreadystatechange = jQuery.noop; - if ( xhrOnUnloadAbort ) { - delete xhrCallbacks[ handle ]; - } - } - - // If it's an abort - if ( isAbort ) { - // Abort it manually if needed - if ( xhr.readyState !== 4 ) { - xhr.abort(); - } - } else { - responses = {}; - status = xhr.status; - responseHeaders = xhr.getAllResponseHeaders(); - - // When requesting binary data, IE6-9 will throw an exception - // on any attempt to access responseText (#11426) - if ( typeof xhr.responseText === "string" ) { - responses.text = xhr.responseText; - } - - // Firefox throws an exception when accessing - // statusText for faulty cross-domain requests - try { - statusText = xhr.statusText; - } catch( e ) { - // We normalize with Webkit giving an empty statusText - statusText = ""; - } - - // Filter status for non standard behaviors - - // If the request is local and we have data: assume a success - // (success with no data won't get notified, that's the best we - // can do given current implementations) - if ( !status && s.isLocal && !s.crossDomain ) { - status = responses.text ? 200 : 404; - // IE - #1450: sometimes returns 1223 when it should be 204 - } else if ( status === 1223 ) { - status = 204; - } - } - } - } catch( firefoxAccessException ) { - if ( !isAbort ) { - complete( -1, firefoxAccessException ); - } - } - - // Call complete if needed - if ( responses ) { - complete( status, statusText, responses, responseHeaders ); - } - }; - - if ( !s.async ) { - // if we're in sync mode we fire the callback - callback(); - } else if ( xhr.readyState === 4 ) { - // (IE6 & IE7) if it's in cache and has been - // retrieved directly we need to fire the callback - setTimeout( callback ); - } else { - handle = ++xhrId; - if ( xhrOnUnloadAbort ) { - // Create the active xhrs callbacks list if needed - // and attach the unload handler - if ( !xhrCallbacks ) { - xhrCallbacks = {}; - jQuery( window ).unload( xhrOnUnloadAbort ); - } - // Add to list of active xhrs callbacks - xhrCallbacks[ handle ] = callback; - } - xhr.onreadystatechange = callback; - } - }, - - abort: function() { - if ( callback ) { - callback( undefined, true ); - } - } - }; - } - }); -} -var fxNow, timerId, - rfxtypes = /^(?:toggle|show|hide)$/, - rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), - rrun = /queueHooks$/, - animationPrefilters = [ defaultPrefilter ], - tweeners = { - "*": [function( prop, value ) { - var end, unit, - tween = this.createTween( prop, value ), - parts = rfxnum.exec( value ), - target = tween.cur(), - start = +target || 0, - scale = 1, - maxIterations = 20; - - if ( parts ) { - end = +parts[2]; - unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - - // We need to compute starting value - if ( unit !== "px" && start ) { - // Iteratively approximate from a nonzero starting point - // Prefer the current property, because this process will be trivial if it uses the same units - // Fallback to end or a simple constant - start = jQuery.css( tween.elem, prop, true ) || end || 1; - - do { - // If previous iteration zeroed out, double until we get *something* - // Use a string for doubling factor so we don't accidentally see scale as unchanged below - scale = scale || ".5"; - - // Adjust and apply - start = start / scale; - jQuery.style( tween.elem, prop, start + unit ); - - // Update scale, tolerating zero or NaN from tween.cur() - // And breaking the loop if scale is unchanged or perfect, or if we've just had enough - } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); - } - - tween.unit = unit; - tween.start = start; - // If a +=/-= token was provided, we're doing a relative animation - tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; - } - return tween; - }] - }; - -// Animations created synchronously will run synchronously -function createFxNow() { - setTimeout(function() { - fxNow = undefined; - }); - return ( fxNow = jQuery.now() ); -} - -function createTweens( animation, props ) { - jQuery.each( props, function( prop, value ) { - var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( collection[ index ].call( animation, prop, value ) ) { - - // we're done with this property - return; - } - } - }); -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = animationPrefilters.length, - deferred = jQuery.Deferred().always( function() { - // don't match elem in the :animated selector - delete tick.elem; - }), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ]); - - if ( percent < 1 && length ) { - return remaining; - } else { - deferred.resolveWith( elem, [ animation ] ); - return false; - } - }, - animation = deferred.promise({ - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { specialEasing: {} }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - // if we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // resolve when we played the last frame - // otherwise, reject - if ( gotoEnd ) { - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - }), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length ; index++ ) { - result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - return result; - } - } - - createTweens( animation, props ); - - if ( jQuery.isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - }) - ); - - // attach callbacks from options - return animation.progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); -} - -function propFilter( props, specialEasing ) { - var value, name, index, easing, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = jQuery.camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( jQuery.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // not quite $.extend, this wont overwrite keys already present. - // also - reusing 'index' from above because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweener: function( props, callback ) { - if ( jQuery.isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.split(" "); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length ; index++ ) { - prop = props[ index ]; - tweeners[ prop ] = tweeners[ prop ] || []; - tweeners[ prop ].unshift( callback ); - } - }, - - prefilter: function( callback, prepend ) { - if ( prepend ) { - animationPrefilters.unshift( callback ); - } else { - animationPrefilters.push( callback ); - } - } -}); - -function defaultPrefilter( elem, props, opts ) { - /*jshint validthis:true */ - var prop, index, length, - value, dataShow, toggle, - tween, hooks, oldfire, - anim = this, - style = elem.style, - orig = {}, - handled = [], - hidden = elem.nodeType && isHidden( elem ); - - // handle queue: false promises - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always(function() { - // doing this makes sure that the complete handler will be called - // before this completes - anim.always(function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - }); - }); - } - - // height/width overflow pass - if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { - // Make sure that nothing sneaks out - // Record all 3 overflow attributes because IE does not - // change the overflow attribute when overflowX and - // overflowY are set to the same value - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Set display property to inline-block for height/width - // animations on inline elements that are having width/height animated - if ( jQuery.css( elem, "display" ) === "inline" && - jQuery.css( elem, "float" ) === "none" ) { - - // inline-level elements accept inline-block; - // block-level elements need to be inline with layout - if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { - style.display = "inline-block"; - - } else { - style.zoom = 1; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - if ( !jQuery.support.shrinkWrapBlocks ) { - anim.always(function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - }); - } - } - - - // show/hide pass - for ( index in props ) { - value = props[ index ]; - if ( rfxtypes.exec( value ) ) { - delete props[ index ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - continue; - } - handled.push( index ); - } - } - - length = handled.length; - if ( length ) { - dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - - // store state if its toggle - enables .stop().toggle() to "reverse" - if ( toggle ) { - dataShow.hidden = !hidden; - } - if ( hidden ) { - jQuery( elem ).show(); - } else { - anim.done(function() { - jQuery( elem ).hide(); - }); - } - anim.done(function() { - var prop; - jQuery._removeData( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - }); - for ( index = 0 ; index < length ; index++ ) { - prop = handled[ index ]; - tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); - orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); - - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = tween.start; - if ( hidden ) { - tween.end = tween.start; - tween.start = prop === "width" || prop === "height" ? 1 : 0; - } - } - } - } -} - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || "swing"; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - if ( tween.elem[ tween.prop ] != null && - (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { - return tween.elem[ tween.prop ]; - } - - // passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails - // so, simple values such as "10px" are parsed to Float. - // complex values such as "rotate(1rad)" are returned as is. - result = jQuery.css( tween.elem, tween.prop, "" ); - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - // use step hook for back compat - use cssHook if its there - use .style if its - // available and use plain properties where available - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Remove in 2.0 - this supports IE8's panic based approach -// to setting things on disconnected nodes - -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -}); - -jQuery.fn.extend({ - fadeTo: function( speed, to, easing, callback ) { - - // show any hidden elements after setting opacity to 0 - return this.filter( isHidden ).css( "opacity", 0 ).show() - - // animate to the value specified - .end().animate({ opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - doAnimation.finish = function() { - anim.stop( true ); - }; - // Empty animations, or finishing resolves immediately - if ( empty || jQuery._data( this, "finish" ) ) { - anim.stop( true ); - } - }; - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue && type !== false ) { - this.queue( type || "fx", [] ); - } - - return this.each(function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = jQuery._data( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // start the next in the queue if the last step wasn't forced - // timers currently will call their complete callbacks, which will dequeue - // but only if they were gotoEnd - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - }); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each(function() { - var index, - data = jQuery._data( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // enable finishing flag on private data - data.finish = true; - - // empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.cur && hooks.cur.finish ) { - hooks.cur.finish.call( this ); - } - - // look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // turn off finishing flag - delete data.finish; - }); - } -}); - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - attrs = { height: type }, - i = 0; - - // if we include width, step value is 1 to do all cssExpand values, - // if we don't include width, step value is 2 to skip over Left and Right - includeWidth = includeWidth? 1 : 0; - for( ; i < 4 ; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -// Generate shortcuts for custom animations -jQuery.each({ - slideDown: genFx("show"), - slideUp: genFx("hide"), - slideToggle: genFx("toggle"), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -}); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - jQuery.isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing - }; - - opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : - opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; - - // normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( jQuery.isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p*Math.PI ) / 2; - } -}; - -jQuery.timers = []; -jQuery.fx = Tween.prototype.init; -jQuery.fx.tick = function() { - var timer, - timers = jQuery.timers, - i = 0; - - fxNow = jQuery.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - // Checks the timer has not already been removed - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - if ( timer() && jQuery.timers.push( timer ) ) { - jQuery.fx.start(); - } -}; - -jQuery.fx.interval = 13; - -jQuery.fx.start = function() { - if ( !timerId ) { - timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); - } -}; - -jQuery.fx.stop = function() { - clearInterval( timerId ); - timerId = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - // Default speed - _default: 400 -}; - -// Back Compat <1.8 extension point -jQuery.fx.step = {}; - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.animated = function( elem ) { - return jQuery.grep(jQuery.timers, function( fn ) { - return elem === fn.elem; - }).length; - }; -} -jQuery.fn.offset = function( options ) { - if ( arguments.length ) { - return options === undefined ? - this : - this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } - - var docElem, win, - box = { top: 0, left: 0 }, - elem = this[ 0 ], - doc = elem && elem.ownerDocument; - - if ( !doc ) { - return; - } - - docElem = doc.documentElement; - - // Make sure it's not a disconnected DOM node - if ( !jQuery.contains( docElem, elem ) ) { - return box; - } - - // If we don't have gBCR, just use 0,0 rather than error - // BlackBerry 5, iOS 3 (original iPhone) - if ( typeof elem.getBoundingClientRect !== core_strundefined ) { - box = elem.getBoundingClientRect(); - } - win = getWindow( doc ); - return { - top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), - left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) - }; -}; - -jQuery.offset = { - - setOffset: function( elem, options, i ) { - var position = jQuery.css( elem, "position" ); - - // set position first, in-case top/left are set even on static elem - if ( position === "static" ) { - elem.style.position = "relative"; - } - - var curElem = jQuery( elem ), - curOffset = curElem.offset(), - curCSSTop = jQuery.css( elem, "top" ), - curCSSLeft = jQuery.css( elem, "left" ), - calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, - props = {}, curPosition = {}, curTop, curLeft; - - // need to be able to calculate position if either top or left is auto and position is either absolute or fixed - if ( calculatePosition ) { - curPosition = curElem.position(); - curTop = curPosition.top; - curLeft = curPosition.left; - } else { - curTop = parseFloat( curCSSTop ) || 0; - curLeft = parseFloat( curCSSLeft ) || 0; - } - - if ( jQuery.isFunction( options ) ) { - options = options.call( elem, i, curOffset ); - } - - if ( options.top != null ) { - props.top = ( options.top - curOffset.top ) + curTop; - } - if ( options.left != null ) { - props.left = ( options.left - curOffset.left ) + curLeft; - } - - if ( "using" in options ) { - options.using.call( elem, props ); - } else { - curElem.css( props ); - } - } -}; - - -jQuery.fn.extend({ - - position: function() { - if ( !this[ 0 ] ) { - return; - } - - var offsetParent, offset, - parentOffset = { top: 0, left: 0 }, - elem = this[ 0 ]; - - // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent - if ( jQuery.css( elem, "position" ) === "fixed" ) { - // we assume that getBoundingClientRect is available when computed position is fixed - offset = elem.getBoundingClientRect(); - } else { - // Get *real* offsetParent - offsetParent = this.offsetParent(); - - // Get correct offsets - offset = this.offset(); - if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { - parentOffset = offsetParent.offset(); - } - - // Add offsetParent borders - parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); - parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); - } - - // Subtract parent offsets and element margins - // note: when an element has margin: auto the offsetLeft and marginLeft - // are the same in Safari causing offset.left to incorrectly be 0 - return { - top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), - left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) - }; - }, - - offsetParent: function() { - return this.map(function() { - var offsetParent = this.offsetParent || document.documentElement; - while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) { - offsetParent = offsetParent.offsetParent; - } - return offsetParent || document.documentElement; - }); - } -}); - - -// Create scrollLeft and scrollTop methods -jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { - var top = /Y/.test( prop ); - - jQuery.fn[ method ] = function( val ) { - return jQuery.access( this, function( elem, method, val ) { - var win = getWindow( elem ); - - if ( val === undefined ) { - return win ? (prop in win) ? win[ prop ] : - win.document.documentElement[ method ] : - elem[ method ]; - } - - if ( win ) { - win.scrollTo( - !top ? val : jQuery( win ).scrollLeft(), - top ? val : jQuery( win ).scrollTop() - ); - - } else { - elem[ method ] = val; - } - }, method, val, arguments.length, null ); - }; -}); - -function getWindow( elem ) { - return jQuery.isWindow( elem ) ? - elem : - elem.nodeType === 9 ? - elem.defaultView || elem.parentWindow : - false; -} -// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods -jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { - jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { - // margin is only for outerHeight, outerWidth - jQuery.fn[ funcName ] = function( margin, value ) { - var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), - extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); - - return jQuery.access( this, function( elem, type, value ) { - var doc; - - if ( jQuery.isWindow( elem ) ) { - // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there - // isn't a whole lot we can do. See pull request at this URL for discussion: - // https://github.com/jquery/jquery/pull/764 - return elem.document.documentElement[ "client" + name ]; - } - - // Get document width or height - if ( elem.nodeType === 9 ) { - doc = elem.documentElement; - - // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest - // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. - return Math.max( - elem.body[ "scroll" + name ], doc[ "scroll" + name ], - elem.body[ "offset" + name ], doc[ "offset" + name ], - doc[ "client" + name ] - ); - } - - return value === undefined ? - // Get width or height on the element, requesting but not forcing parseFloat - jQuery.css( elem, type, extra ) : - - // Set width or height on the element - jQuery.style( elem, type, value, extra ); - }, type, chainable ? margin : undefined, chainable, null ); - }; - }); -}); -// Limit scope pollution from any deprecated API -// (function() { - -// })(); -// Expose jQuery to the global object -window.jQuery = window.$ = jQuery; - -// Expose jQuery as an AMD module, but only for AMD loaders that -// understand the issues with loading multiple versions of jQuery -// in a page that all might call define(). The loader will indicate -// they have special allowances for multiple jQuery versions by -// specifying define.amd.jQuery = true. Register as a named module, -// since jQuery can be concatenated with other files that may use define, -// but not use a proper concatenation script that understands anonymous -// AMD modules. A named AMD is safest and most robust way to register. -// Lowercase jquery is used because AMD module names are derived from -// file names, and jQuery is normally delivered in a lowercase file name. -// Do this after creating the global so that if an AMD module wants to call -// noConflict to hide this version of jQuery, it will work. -if ( typeof define === "function" && define.amd && define.amd.jQuery ) { - define( "jquery", [], function () { return jQuery; } ); -} - -})( window );// Underscore.js 1.8.2 -// http://underscorejs.org -// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -// Underscore may be freely distributed under the MIT license. - -(function() { - - // Baseline setup - // -------------- - - // Establish the root object, `window` in the browser, or `exports` on the server. - var root = this; - - // Save the previous value of the `_` variable. - var previousUnderscore = root._; - - // Save bytes in the minified (but not gzipped) version: - var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; - - // Create quick reference variables for speed access to core prototypes. - var - push = ArrayProto.push, - slice = ArrayProto.slice, - toString = ObjProto.toString, - hasOwnProperty = ObjProto.hasOwnProperty; - - // All **ECMAScript 5** native function implementations that we hope to use - // are declared here. - var - nativeIsArray = Array.isArray, - nativeKeys = Object.keys, - nativeBind = FuncProto.bind, - nativeCreate = Object.create; - - // Naked function reference for surrogate-prototype-swapping. - var Ctor = function(){}; - - // Create a safe reference to the Underscore object for use below. - var _ = function(obj) { - if (obj instanceof _) return obj; - if (!(this instanceof _)) return new _(obj); - this._wrapped = obj; - }; - - // Export the Underscore object for **Node.js**, with - // backwards-compatibility for the old `require()` API. If we're in - // the browser, add `_` as a global object. - if (typeof exports !== 'undefined') { - if (typeof module !== 'undefined' && module.exports) { - exports = module.exports = _; - } - exports._ = _; - } else { - root._ = _; - } - - // Current version. - _.VERSION = '1.8.2'; - - // Internal function that returns an efficient (for current engines) version - // of the passed-in callback, to be repeatedly applied in other Underscore - // functions. - var optimizeCb = function(func, context, argCount) { - if (context === void 0) return func; - switch (argCount == null ? 3 : argCount) { - case 1: return function(value) { - return func.call(context, value); - }; - case 2: return function(value, other) { - return func.call(context, value, other); - }; - case 3: return function(value, index, collection) { - return func.call(context, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(context, accumulator, value, index, collection); - }; - } - return function() { - return func.apply(context, arguments); - }; - }; - - // A mostly-internal function to generate callbacks that can be applied - // to each element in a collection, returning the desired result 鈥? either - // identity, an arbitrary callback, a property matcher, or a property accessor. - var cb = function(value, context, argCount) { - if (value == null) return _.identity; - if (_.isFunction(value)) return optimizeCb(value, context, argCount); - if (_.isObject(value)) return _.matcher(value); - return _.property(value); - }; - _.iteratee = function(value, context) { - return cb(value, context, Infinity); - }; - - // An internal function for creating assigner functions. - var createAssigner = function(keysFunc, undefinedOnly) { - return function(obj) { - var length = arguments.length; - if (length < 2 || obj == null) return obj; - for (var index = 1; index < length; index++) { - var source = arguments[index], - keys = keysFunc(source), - l = keys.length; - for (var i = 0; i < l; i++) { - var key = keys[i]; - if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key]; - } - } - return obj; - }; - }; - - // An internal function for creating a new object that inherits from another. - var baseCreate = function(prototype) { - if (!_.isObject(prototype)) return {}; - if (nativeCreate) return nativeCreate(prototype); - Ctor.prototype = prototype; - var result = new Ctor; - Ctor.prototype = null; - return result; - }; - - // Helper for collection methods to determine whether a collection - // should be iterated as an array or as an object - // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength - var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; - var isArrayLike = function(collection) { - var length = collection != null && collection.length; - return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; - }; - - // Collection Functions - // -------------------- - - // The cornerstone, an `each` implementation, aka `forEach`. - // Handles raw objects in addition to array-likes. Treats all - // sparse array-likes as if they were dense. - _.each = _.forEach = function(obj, iteratee, context) { - iteratee = optimizeCb(iteratee, context); - var i, length; - if (isArrayLike(obj)) { - for (i = 0, length = obj.length; i < length; i++) { - iteratee(obj[i], i, obj); - } - } else { - var keys = _.keys(obj); - for (i = 0, length = keys.length; i < length; i++) { - iteratee(obj[keys[i]], keys[i], obj); - } - } - return obj; - }; - - // Return the results of applying the iteratee to each element. - _.map = _.collect = function(obj, iteratee, context) { - iteratee = cb(iteratee, context); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length, - results = Array(length); - for (var index = 0; index < length; index++) { - var currentKey = keys ? keys[index] : index; - results[index] = iteratee(obj[currentKey], currentKey, obj); - } - return results; - }; - - // Create a reducing function iterating left or right. - function createReduce(dir) { - // Optimized iterator function as using arguments.length - // in the main function will deoptimize the, see #1991. - function iterator(obj, iteratee, memo, keys, index, length) { - for (; index >= 0 && index < length; index += dir) { - var currentKey = keys ? keys[index] : index; - memo = iteratee(memo, obj[currentKey], currentKey, obj); - } - return memo; - } - - return function(obj, iteratee, memo, context) { - iteratee = optimizeCb(iteratee, context, 4); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length, - index = dir > 0 ? 0 : length - 1; - // Determine the initial value if none is provided. - if (arguments.length < 3) { - memo = obj[keys ? keys[index] : index]; - index += dir; - } - return iterator(obj, iteratee, memo, keys, index, length); - }; - } - - // **Reduce** builds up a single result from a list of values, aka `inject`, - // or `foldl`. - _.reduce = _.foldl = _.inject = createReduce(1); - - // The right-associative version of reduce, also known as `foldr`. - _.reduceRight = _.foldr = createReduce(-1); - - // Return the first value which passes a truth test. Aliased as `detect`. - _.find = _.detect = function(obj, predicate, context) { - var key; - if (isArrayLike(obj)) { - key = _.findIndex(obj, predicate, context); - } else { - key = _.findKey(obj, predicate, context); - } - if (key !== void 0 && key !== -1) return obj[key]; - }; - - // Return all the elements that pass a truth test. - // Aliased as `select`. - _.filter = _.select = function(obj, predicate, context) { - var results = []; - predicate = cb(predicate, context); - _.each(obj, function(value, index, list) { - if (predicate(value, index, list)) results.push(value); - }); - return results; - }; - - // Return all the elements for which a truth test fails. - _.reject = function(obj, predicate, context) { - return _.filter(obj, _.negate(cb(predicate)), context); - }; - - // Determine whether all of the elements match a truth test. - // Aliased as `all`. - _.every = _.all = function(obj, predicate, context) { - predicate = cb(predicate, context); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length; - for (var index = 0; index < length; index++) { - var currentKey = keys ? keys[index] : index; - if (!predicate(obj[currentKey], currentKey, obj)) return false; - } - return true; - }; - - // Determine if at least one element in the object matches a truth test. - // Aliased as `any`. - _.some = _.any = function(obj, predicate, context) { - predicate = cb(predicate, context); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length; - for (var index = 0; index < length; index++) { - var currentKey = keys ? keys[index] : index; - if (predicate(obj[currentKey], currentKey, obj)) return true; - } - return false; - }; - - // Determine if the array or object contains a given value (using `===`). - // Aliased as `includes` and `include`. - _.contains = _.includes = _.include = function(obj, target, fromIndex) { - if (!isArrayLike(obj)) obj = _.values(obj); - return _.indexOf(obj, target, typeof fromIndex == 'number' && fromIndex) >= 0; - }; - - // Invoke a method (with arguments) on every item in a collection. - _.invoke = function(obj, method) { - var args = slice.call(arguments, 2); - var isFunc = _.isFunction(method); - return _.map(obj, function(value) { - var func = isFunc ? method : value[method]; - return func == null ? func : func.apply(value, args); - }); - }; - - // Convenience version of a common use case of `map`: fetching a property. - _.pluck = function(obj, key) { - return _.map(obj, _.property(key)); - }; - - // Convenience version of a common use case of `filter`: selecting only objects - // containing specific `key:value` pairs. - _.where = function(obj, attrs) { - return _.filter(obj, _.matcher(attrs)); - }; - - // Convenience version of a common use case of `find`: getting the first object - // containing specific `key:value` pairs. - _.findWhere = function(obj, attrs) { - return _.find(obj, _.matcher(attrs)); - }; - - // Return the maximum element (or element-based computation). - _.max = function(obj, iteratee, context) { - var result = -Infinity, lastComputed = -Infinity, - value, computed; - if (iteratee == null && obj != null) { - obj = isArrayLike(obj) ? obj : _.values(obj); - for (var i = 0, length = obj.length; i < length; i++) { - value = obj[i]; - if (value > result) { - result = value; - } - } - } else { - iteratee = cb(iteratee, context); - _.each(obj, function(value, index, list) { - computed = iteratee(value, index, list); - if (computed > lastComputed || computed === -Infinity && result === -Infinity) { - result = value; - lastComputed = computed; - } - }); - } - return result; - }; - - // Return the minimum element (or element-based computation). - _.min = function(obj, iteratee, context) { - var result = Infinity, lastComputed = Infinity, - value, computed; - if (iteratee == null && obj != null) { - obj = isArrayLike(obj) ? obj : _.values(obj); - for (var i = 0, length = obj.length; i < length; i++) { - value = obj[i]; - if (value < result) { - result = value; - } - } - } else { - iteratee = cb(iteratee, context); - _.each(obj, function(value, index, list) { - computed = iteratee(value, index, list); - if (computed < lastComputed || computed === Infinity && result === Infinity) { - result = value; - lastComputed = computed; - } - }); - } - return result; - }; - - // Shuffle a collection, using the modern version of the - // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher鈥揧ates_shuffle). - _.shuffle = function(obj) { - var set = isArrayLike(obj) ? obj : _.values(obj); - var length = set.length; - var shuffled = Array(length); - for (var index = 0, rand; index < length; index++) { - rand = _.random(0, index); - if (rand !== index) shuffled[index] = shuffled[rand]; - shuffled[rand] = set[index]; - } - return shuffled; - }; - - // Sample **n** random values from a collection. - // If **n** is not specified, returns a single random element. - // The internal `guard` argument allows it to work with `map`. - _.sample = function(obj, n, guard) { - if (n == null || guard) { - if (!isArrayLike(obj)) obj = _.values(obj); - return obj[_.random(obj.length - 1)]; - } - return _.shuffle(obj).slice(0, Math.max(0, n)); - }; - - // Sort the object's values by a criterion produced by an iteratee. - _.sortBy = function(obj, iteratee, context) { - iteratee = cb(iteratee, context); - return _.pluck(_.map(obj, function(value, index, list) { - return { - value: value, - index: index, - criteria: iteratee(value, index, list) - }; - }).sort(function(left, right) { - var a = left.criteria; - var b = right.criteria; - if (a !== b) { - if (a > b || a === void 0) return 1; - if (a < b || b === void 0) return -1; - } - return left.index - right.index; - }), 'value'); - }; - - // An internal function used for aggregate "group by" operations. - var group = function(behavior) { - return function(obj, iteratee, context) { - var result = {}; - iteratee = cb(iteratee, context); - _.each(obj, function(value, index) { - var key = iteratee(value, index, obj); - behavior(result, value, key); - }); - return result; - }; - }; - - // Groups the object's values by a criterion. Pass either a string attribute - // to group by, or a function that returns the criterion. - _.groupBy = group(function(result, value, key) { - if (_.has(result, key)) result[key].push(value); else result[key] = [value]; - }); - - // Indexes the object's values by a criterion, similar to `groupBy`, but for - // when you know that your index values will be unique. - _.indexBy = group(function(result, value, key) { - result[key] = value; - }); - - // Counts instances of an object that group by a certain criterion. Pass - // either a string attribute to count by, or a function that returns the - // criterion. - _.countBy = group(function(result, value, key) { - if (_.has(result, key)) result[key]++; else result[key] = 1; - }); - - // Safely create a real, live array from anything iterable. - _.toArray = function(obj) { - if (!obj) return []; - if (_.isArray(obj)) return slice.call(obj); - if (isArrayLike(obj)) return _.map(obj, _.identity); - return _.values(obj); - }; - - // Return the number of elements in an object. - _.size = function(obj) { - if (obj == null) return 0; - return isArrayLike(obj) ? obj.length : _.keys(obj).length; - }; - - // Split a collection into two arrays: one whose elements all satisfy the given - // predicate, and one whose elements all do not satisfy the predicate. - _.partition = function(obj, predicate, context) { - predicate = cb(predicate, context); - var pass = [], fail = []; - _.each(obj, function(value, key, obj) { - (predicate(value, key, obj) ? pass : fail).push(value); - }); - return [pass, fail]; - }; - - // Array Functions - // --------------- - - // Get the first element of an array. Passing **n** will return the first N - // values in the array. Aliased as `head` and `take`. The **guard** check - // allows it to work with `_.map`. - _.first = _.head = _.take = function(array, n, guard) { - if (array == null) return void 0; - if (n == null || guard) return array[0]; - return _.initial(array, array.length - n); - }; - - // Returns everything but the last entry of the array. Especially useful on - // the arguments object. Passing **n** will return all the values in - // the array, excluding the last N. - _.initial = function(array, n, guard) { - return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); - }; - - // Get the last element of an array. Passing **n** will return the last N - // values in the array. - _.last = function(array, n, guard) { - if (array == null) return void 0; - if (n == null || guard) return array[array.length - 1]; - return _.rest(array, Math.max(0, array.length - n)); - }; - - // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. - // Especially useful on the arguments object. Passing an **n** will return - // the rest N values in the array. - _.rest = _.tail = _.drop = function(array, n, guard) { - return slice.call(array, n == null || guard ? 1 : n); - }; - - // Trim out all falsy values from an array. - _.compact = function(array) { - return _.filter(array, _.identity); - }; - - // Internal implementation of a recursive `flatten` function. - var flatten = function(input, shallow, strict, startIndex) { - var output = [], idx = 0; - for (var i = startIndex || 0, length = input && input.length; i < length; i++) { - var value = input[i]; - if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) { - //flatten current level of array or arguments object - if (!shallow) value = flatten(value, shallow, strict); - var j = 0, len = value.length; - output.length += len; - while (j < len) { - output[idx++] = value[j++]; - } - } else if (!strict) { - output[idx++] = value; - } - } - return output; - }; - - // Flatten out an array, either recursively (by default), or just one level. - _.flatten = function(array, shallow) { - return flatten(array, shallow, false); - }; - - // Return a version of the array that does not contain the specified value(s). - _.without = function(array) { - return _.difference(array, slice.call(arguments, 1)); - }; - - // Produce a duplicate-free version of the array. If the array has already - // been sorted, you have the option of using a faster algorithm. - // Aliased as `unique`. - _.uniq = _.unique = function(array, isSorted, iteratee, context) { - if (array == null) return []; - if (!_.isBoolean(isSorted)) { - context = iteratee; - iteratee = isSorted; - isSorted = false; - } - if (iteratee != null) iteratee = cb(iteratee, context); - var result = []; - var seen = []; - for (var i = 0, length = array.length; i < length; i++) { - var value = array[i], - computed = iteratee ? iteratee(value, i, array) : value; - if (isSorted) { - if (!i || seen !== computed) result.push(value); - seen = computed; - } else if (iteratee) { - if (!_.contains(seen, computed)) { - seen.push(computed); - result.push(value); - } - } else if (!_.contains(result, value)) { - result.push(value); - } - } - return result; - }; - - // Produce an array that contains the union: each distinct element from all of - // the passed-in arrays. - _.union = function() { - return _.uniq(flatten(arguments, true, true)); - }; - - // Produce an array that contains every item shared between all the - // passed-in arrays. - _.intersection = function(array) { - if (array == null) return []; - var result = []; - var argsLength = arguments.length; - for (var i = 0, length = array.length; i < length; i++) { - var item = array[i]; - if (_.contains(result, item)) continue; - for (var j = 1; j < argsLength; j++) { - if (!_.contains(arguments[j], item)) break; - } - if (j === argsLength) result.push(item); - } - return result; - }; - - // Take the difference between one array and a number of other arrays. - // Only the elements present in just the first array will remain. - _.difference = function(array) { - var rest = flatten(arguments, true, true, 1); - return _.filter(array, function(value){ - return !_.contains(rest, value); - }); - }; - - // Zip together multiple lists into a single array -- elements that share - // an index go together. - _.zip = function() { - return _.unzip(arguments); - }; - - // Complement of _.zip. Unzip accepts an array of arrays and groups - // each array's elements on shared indices - _.unzip = function(array) { - var length = array && _.max(array, 'length').length || 0; - var result = Array(length); - - for (var index = 0; index < length; index++) { - result[index] = _.pluck(array, index); - } - return result; - }; - - // Converts lists into objects. Pass either a single array of `[key, value]` - // pairs, or two parallel arrays of the same length -- one of keys, and one of - // the corresponding values. - _.object = function(list, values) { - var result = {}; - for (var i = 0, length = list && list.length; i < length; i++) { - if (values) { - result[list[i]] = values[i]; - } else { - result[list[i][0]] = list[i][1]; - } - } - return result; - }; - - // Return the position of the first occurrence of an item in an array, - // or -1 if the item is not included in the array. - // If the array is large and already in sort order, pass `true` - // for **isSorted** to use binary search. - _.indexOf = function(array, item, isSorted) { - var i = 0, length = array && array.length; - if (typeof isSorted == 'number') { - i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted; - } else if (isSorted && length) { - i = _.sortedIndex(array, item); - return array[i] === item ? i : -1; - } - if (item !== item) { - return _.findIndex(slice.call(array, i), _.isNaN); - } - for (; i < length; i++) if (array[i] === item) return i; - return -1; - }; - - _.lastIndexOf = function(array, item, from) { - var idx = array ? array.length : 0; - if (typeof from == 'number') { - idx = from < 0 ? idx + from + 1 : Math.min(idx, from + 1); - } - if (item !== item) { - return _.findLastIndex(slice.call(array, 0, idx), _.isNaN); - } - while (--idx >= 0) if (array[idx] === item) return idx; - return -1; - }; - - // Generator function to create the findIndex and findLastIndex functions - function createIndexFinder(dir) { - return function(array, predicate, context) { - predicate = cb(predicate, context); - var length = array != null && array.length; - var index = dir > 0 ? 0 : length - 1; - for (; index >= 0 && index < length; index += dir) { - if (predicate(array[index], index, array)) return index; - } - return -1; - }; - } - - // Returns the first index on an array-like that passes a predicate test - _.findIndex = createIndexFinder(1); - - _.findLastIndex = createIndexFinder(-1); - - // Use a comparator function to figure out the smallest index at which - // an object should be inserted so as to maintain order. Uses binary search. - _.sortedIndex = function(array, obj, iteratee, context) { - iteratee = cb(iteratee, context, 1); - var value = iteratee(obj); - var low = 0, high = array.length; - while (low < high) { - var mid = Math.floor((low + high) / 2); - if (iteratee(array[mid]) < value) low = mid + 1; else high = mid; - } - return low; - }; - - // Generate an integer Array containing an arithmetic progression. A port of - // the native Python `range()` function. See - // [the Python documentation](http://docs.python.org/library/functions.html#range). - _.range = function(start, stop, step) { - if (arguments.length <= 1) { - stop = start || 0; - start = 0; - } - step = step || 1; - - var length = Math.max(Math.ceil((stop - start) / step), 0); - var range = Array(length); - - for (var idx = 0; idx < length; idx++, start += step) { - range[idx] = start; - } - - return range; - }; - - // Function (ahem) Functions - // ------------------ - - // Determines whether to execute a function as a constructor - // or a normal function with the provided arguments - var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) { - if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); - var self = baseCreate(sourceFunc.prototype); - var result = sourceFunc.apply(self, args); - if (_.isObject(result)) return result; - return self; - }; - - // Create a function bound to a given object (assigning `this`, and arguments, - // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if - // available. - _.bind = function(func, context) { - if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); - if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function'); - var args = slice.call(arguments, 2); - var bound = function() { - return executeBound(func, bound, context, this, args.concat(slice.call(arguments))); - }; - return bound; - }; - - // Partially apply a function by creating a version that has had some of its - // arguments pre-filled, without changing its dynamic `this` context. _ acts - // as a placeholder, allowing any combination of arguments to be pre-filled. - _.partial = function(func) { - var boundArgs = slice.call(arguments, 1); - var bound = function() { - var position = 0, length = boundArgs.length; - var args = Array(length); - for (var i = 0; i < length; i++) { - args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i]; - } - while (position < arguments.length) args.push(arguments[position++]); - return executeBound(func, bound, this, this, args); - }; - return bound; - }; - - // Bind a number of an object's methods to that object. Remaining arguments - // are the method names to be bound. Useful for ensuring that all callbacks - // defined on an object belong to it. - _.bindAll = function(obj) { - var i, length = arguments.length, key; - if (length <= 1) throw new Error('bindAll must be passed function names'); - for (i = 1; i < length; i++) { - key = arguments[i]; - obj[key] = _.bind(obj[key], obj); - } - return obj; - }; - - // Memoize an expensive function by storing its results. - _.memoize = function(func, hasher) { - var memoize = function(key) { - var cache = memoize.cache; - var address = '' + (hasher ? hasher.apply(this, arguments) : key); - if (!_.has(cache, address)) cache[address] = func.apply(this, arguments); - return cache[address]; - }; - memoize.cache = {}; - return memoize; - }; - - // Delays a function for the given number of milliseconds, and then calls - // it with the arguments supplied. - _.delay = function(func, wait) { - var args = slice.call(arguments, 2); - return setTimeout(function(){ - return func.apply(null, args); - }, wait); - }; - - // Defers a function, scheduling it to run after the current call stack has - // cleared. - _.defer = _.partial(_.delay, _, 1); - - // Returns a function, that, when invoked, will only be triggered at most once - // during a given window of time. Normally, the throttled function will run - // as much as it can, without ever going more than once per `wait` duration; - // but if you'd like to disable the execution on the leading edge, pass - // `{leading: false}`. To disable execution on the trailing edge, ditto. - _.throttle = function(func, wait, options) { - var context, args, result; - var timeout = null; - var previous = 0; - if (!options) options = {}; - var later = function() { - previous = options.leading === false ? 0 : _.now(); - timeout = null; - result = func.apply(context, args); - if (!timeout) context = args = null; - }; - return function() { - var now = _.now(); - if (!previous && options.leading === false) previous = now; - var remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0 || remaining > wait) { - if (timeout) { - clearTimeout(timeout); - timeout = null; - } - previous = now; - result = func.apply(context, args); - if (!timeout) context = args = null; - } else if (!timeout && options.trailing !== false) { - timeout = setTimeout(later, remaining); - } - return result; - }; - }; - - // Returns a function, that, as long as it continues to be invoked, will not - // be triggered. The function will be called after it stops being called for - // N milliseconds. If `immediate` is passed, trigger the function on the - // leading edge, instead of the trailing. - _.debounce = function(func, wait, immediate) { - var timeout, args, context, timestamp, result; - - var later = function() { - var last = _.now() - timestamp; - - if (last < wait && last >= 0) { - timeout = setTimeout(later, wait - last); - } else { - timeout = null; - if (!immediate) { - result = func.apply(context, args); - if (!timeout) context = args = null; - } - } - }; - - return function() { - context = this; - args = arguments; - timestamp = _.now(); - var callNow = immediate && !timeout; - if (!timeout) timeout = setTimeout(later, wait); - if (callNow) { - result = func.apply(context, args); - context = args = null; - } - - return result; - }; - }; - - // Returns the first function passed as an argument to the second, - // allowing you to adjust arguments, run code before and after, and - // conditionally execute the original function. - _.wrap = function(func, wrapper) { - return _.partial(wrapper, func); - }; - - // Returns a negated version of the passed-in predicate. - _.negate = function(predicate) { - return function() { - return !predicate.apply(this, arguments); - }; - }; - - // Returns a function that is the composition of a list of functions, each - // consuming the return value of the function that follows. - _.compose = function() { - var args = arguments; - var start = args.length - 1; - return function() { - var i = start; - var result = args[start].apply(this, arguments); - while (i--) result = args[i].call(this, result); - return result; - }; - }; - - // Returns a function that will only be executed on and after the Nth call. - _.after = function(times, func) { - return function() { - if (--times < 1) { - return func.apply(this, arguments); - } - }; - }; - - // Returns a function that will only be executed up to (but not including) the Nth call. - _.before = function(times, func) { - var memo; - return function() { - if (--times > 0) { - memo = func.apply(this, arguments); - } - if (times <= 1) func = null; - return memo; - }; - }; - - // Returns a function that will be executed at most one time, no matter how - // often you call it. Useful for lazy initialization. - _.once = _.partial(_.before, 2); - - // Object Functions - // ---------------- - - // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. - var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString'); - var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString', - 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; - - function collectNonEnumProps(obj, keys) { - var nonEnumIdx = nonEnumerableProps.length; - var constructor = obj.constructor; - var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto; - - // Constructor is a special case. - var prop = 'constructor'; - if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop); - - while (nonEnumIdx--) { - prop = nonEnumerableProps[nonEnumIdx]; - if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) { - keys.push(prop); - } - } - } - - // Retrieve the names of an object's own properties. - // Delegates to **ECMAScript 5**'s native `Object.keys` - _.keys = function(obj) { - if (!_.isObject(obj)) return []; - if (nativeKeys) return nativeKeys(obj); - var keys = []; - for (var key in obj) if (_.has(obj, key)) keys.push(key); - // Ahem, IE < 9. - if (hasEnumBug) collectNonEnumProps(obj, keys); - return keys; - }; - - // Retrieve all the property names of an object. - _.allKeys = function(obj) { - if (!_.isObject(obj)) return []; - var keys = []; - for (var key in obj) keys.push(key); - // Ahem, IE < 9. - if (hasEnumBug) collectNonEnumProps(obj, keys); - return keys; - }; - - // Retrieve the values of an object's properties. - _.values = function(obj) { - var keys = _.keys(obj); - var length = keys.length; - var values = Array(length); - for (var i = 0; i < length; i++) { - values[i] = obj[keys[i]]; - } - return values; - }; - - // Returns the results of applying the iteratee to each element of the object - // In contrast to _.map it returns an object - _.mapObject = function(obj, iteratee, context) { - iteratee = cb(iteratee, context); - var keys = _.keys(obj), - length = keys.length, - results = {}, - currentKey; - for (var index = 0; index < length; index++) { - currentKey = keys[index]; - results[currentKey] = iteratee(obj[currentKey], currentKey, obj); - } - return results; - }; - - // Convert an object into a list of `[key, value]` pairs. - _.pairs = function(obj) { - var keys = _.keys(obj); - var length = keys.length; - var pairs = Array(length); - for (var i = 0; i < length; i++) { - pairs[i] = [keys[i], obj[keys[i]]]; - } - return pairs; - }; - - // Invert the keys and values of an object. The values must be serializable. - _.invert = function(obj) { - var result = {}; - var keys = _.keys(obj); - for (var i = 0, length = keys.length; i < length; i++) { - result[obj[keys[i]]] = keys[i]; - } - return result; - }; - - // Return a sorted list of the function names available on the object. - // Aliased as `methods` - _.functions = _.methods = function(obj) { - var names = []; - for (var key in obj) { - if (_.isFunction(obj[key])) names.push(key); - } - return names.sort(); - }; - - // Extend a given object with all the properties in passed-in object(s). - _.extend = createAssigner(_.allKeys); - - // Assigns a given object with all the own properties in the passed-in object(s) - // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) - _.extendOwn = _.assign = createAssigner(_.keys); - - // Returns the first key on an object that passes a predicate test - _.findKey = function(obj, predicate, context) { - predicate = cb(predicate, context); - var keys = _.keys(obj), key; - for (var i = 0, length = keys.length; i < length; i++) { - key = keys[i]; - if (predicate(obj[key], key, obj)) return key; - } - }; - - // Return a copy of the object only containing the whitelisted properties. - _.pick = function(object, oiteratee, context) { - var result = {}, obj = object, iteratee, keys; - if (obj == null) return result; - if (_.isFunction(oiteratee)) { - keys = _.allKeys(obj); - iteratee = optimizeCb(oiteratee, context); - } else { - keys = flatten(arguments, false, false, 1); - iteratee = function(value, key, obj) { return key in obj; }; - obj = Object(obj); - } - for (var i = 0, length = keys.length; i < length; i++) { - var key = keys[i]; - var value = obj[key]; - if (iteratee(value, key, obj)) result[key] = value; - } - return result; - }; - - // Return a copy of the object without the blacklisted properties. - _.omit = function(obj, iteratee, context) { - if (_.isFunction(iteratee)) { - iteratee = _.negate(iteratee); - } else { - var keys = _.map(flatten(arguments, false, false, 1), String); - iteratee = function(value, key) { - return !_.contains(keys, key); - }; - } - return _.pick(obj, iteratee, context); - }; - - // Fill in a given object with default properties. - _.defaults = createAssigner(_.allKeys, true); - - // Creates an object that inherits from the given prototype object. - // If additional properties are provided then they will be added to the - // created object. - _.create = function(prototype, props) { - var result = baseCreate(prototype); - if (props) _.extendOwn(result, props); - return result; - }; - - // Create a (shallow-cloned) duplicate of an object. - _.clone = function(obj) { - if (!_.isObject(obj)) return obj; - return _.isArray(obj) ? obj.slice() : _.extend({}, obj); - }; - - // Invokes interceptor with the obj, and then returns obj. - // The primary purpose of this method is to "tap into" a method chain, in - // order to perform operations on intermediate results within the chain. - _.tap = function(obj, interceptor) { - interceptor(obj); - return obj; - }; - - // Returns whether an object has a given set of `key:value` pairs. - _.isMatch = function(object, attrs) { - var keys = _.keys(attrs), length = keys.length; - if (object == null) return !length; - var obj = Object(object); - for (var i = 0; i < length; i++) { - var key = keys[i]; - if (attrs[key] !== obj[key] || !(key in obj)) return false; - } - return true; - }; - - - // Internal recursive comparison function for `isEqual`. - var eq = function(a, b, aStack, bStack) { - // Identical objects are equal. `0 === -0`, but they aren't identical. - // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). - if (a === b) return a !== 0 || 1 / a === 1 / b; - // A strict comparison is necessary because `null == undefined`. - if (a == null || b == null) return a === b; - // Unwrap any wrapped objects. - if (a instanceof _) a = a._wrapped; - if (b instanceof _) b = b._wrapped; - // Compare `[[Class]]` names. - var className = toString.call(a); - if (className !== toString.call(b)) return false; - switch (className) { - // Strings, numbers, regular expressions, dates, and booleans are compared by value. - case '[object RegExp]': - // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') - case '[object String]': - // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is - // equivalent to `new String("5")`. - return '' + a === '' + b; - case '[object Number]': - // `NaN`s are equivalent, but non-reflexive. - // Object(NaN) is equivalent to NaN - if (+a !== +a) return +b !== +b; - // An `egal` comparison is performed for other numeric values. - return +a === 0 ? 1 / +a === 1 / b : +a === +b; - case '[object Date]': - case '[object Boolean]': - // Coerce dates and booleans to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are not equivalent. - return +a === +b; - } - - var areArrays = className === '[object Array]'; - if (!areArrays) { - if (typeof a != 'object' || typeof b != 'object') return false; - - // Objects with different constructors are not equivalent, but `Object`s or `Array`s - // from different frames are. - var aCtor = a.constructor, bCtor = b.constructor; - if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && - _.isFunction(bCtor) && bCtor instanceof bCtor) - && ('constructor' in a && 'constructor' in b)) { - return false; - } - } - // Assume equality for cyclic structures. The algorithm for detecting cyclic - // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. - - // Initializing stack of traversed objects. - // It's done here since we only need them for objects and arrays comparison. - aStack = aStack || []; - bStack = bStack || []; - var length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - if (aStack[length] === a) return bStack[length] === b; - } - - // Add the first object to the stack of traversed objects. - aStack.push(a); - bStack.push(b); - - // Recursively compare objects and arrays. - if (areArrays) { - // Compare array lengths to determine if a deep comparison is necessary. - length = a.length; - if (length !== b.length) return false; - // Deep compare the contents, ignoring non-numeric properties. - while (length--) { - if (!eq(a[length], b[length], aStack, bStack)) return false; - } - } else { - // Deep compare objects. - var keys = _.keys(a), key; - length = keys.length; - // Ensure that both objects contain the same number of properties before comparing deep equality. - if (_.keys(b).length !== length) return false; - while (length--) { - // Deep compare each member - key = keys[length]; - if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false; - } - } - // Remove the first object from the stack of traversed objects. - aStack.pop(); - bStack.pop(); - return true; - }; - - // Perform a deep comparison to check if two objects are equal. - _.isEqual = function(a, b) { - return eq(a, b); - }; - - // Is a given array, string, or object empty? - // An "empty" object has no enumerable own-properties. - _.isEmpty = function(obj) { - if (obj == null) return true; - if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0; - return _.keys(obj).length === 0; - }; - - // Is a given value a DOM element? - _.isElement = function(obj) { - return !!(obj && obj.nodeType === 1); - }; - - // Is a given value an array? - // Delegates to ECMA5's native Array.isArray - _.isArray = nativeIsArray || function(obj) { - return toString.call(obj) === '[object Array]'; - }; - - // Is a given variable an object? - _.isObject = function(obj) { - var type = typeof obj; - return type === 'function' || type === 'object' && !!obj; - }; - - // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError. - _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) { - _['is' + name] = function(obj) { - return toString.call(obj) === '[object ' + name + ']'; - }; - }); - - // Define a fallback version of the method in browsers (ahem, IE < 9), where - // there isn't any inspectable "Arguments" type. - if (!_.isArguments(arguments)) { - _.isArguments = function(obj) { - return _.has(obj, 'callee'); - }; - } - - // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8, - // IE 11 (#1621), and in Safari 8 (#1929). - if (typeof /./ != 'function' && typeof Int8Array != 'object') { - _.isFunction = function(obj) { - return typeof obj == 'function' || false; - }; - } - - // Is a given object a finite number? - _.isFinite = function(obj) { - return isFinite(obj) && !isNaN(parseFloat(obj)); - }; - - // Is the given value `NaN`? (NaN is the only number which does not equal itself). - _.isNaN = function(obj) { - return _.isNumber(obj) && obj !== +obj; - }; - - // Is a given value a boolean? - _.isBoolean = function(obj) { - return obj === true || obj === false || toString.call(obj) === '[object Boolean]'; - }; - - // Is a given value equal to null? - _.isNull = function(obj) { - return obj === null; - }; - - // Is a given variable undefined? - _.isUndefined = function(obj) { - return obj === void 0; - }; - - // Shortcut function for checking if an object has a given property directly - // on itself (in other words, not on a prototype). - _.has = function(obj, key) { - return obj != null && hasOwnProperty.call(obj, key); - }; - - // Utility Functions - // ----------------- - - // Run Underscore.js in *noConflict* mode, returning the `_` variable to its - // previous owner. Returns a reference to the Underscore object. - _.noConflict = function() { - root._ = previousUnderscore; - return this; - }; - - // Keep the identity function around for default iteratees. - _.identity = function(value) { - return value; - }; - - // Predicate-generating functions. Often useful outside of Underscore. - _.constant = function(value) { - return function() { - return value; - }; - }; - - _.noop = function(){}; - - _.property = function(key) { - return function(obj) { - return obj == null ? void 0 : obj[key]; - }; - }; - - // Generates a function for a given object that returns a given property. - _.propertyOf = function(obj) { - return obj == null ? function(){} : function(key) { - return obj[key]; - }; - }; - - // Returns a predicate for checking whether an object has a given set of - // `key:value` pairs. - _.matcher = _.matches = function(attrs) { - attrs = _.extendOwn({}, attrs); - return function(obj) { - return _.isMatch(obj, attrs); - }; - }; - - // Run a function **n** times. - _.times = function(n, iteratee, context) { - var accum = Array(Math.max(0, n)); - iteratee = optimizeCb(iteratee, context, 1); - for (var i = 0; i < n; i++) accum[i] = iteratee(i); - return accum; - }; - - // Return a random integer between min and max (inclusive). - _.random = function(min, max) { - if (max == null) { - max = min; - min = 0; - } - return min + Math.floor(Math.random() * (max - min + 1)); - }; - - // A (possibly faster) way to get the current timestamp as an integer. - _.now = Date.now || function() { - return new Date().getTime(); - }; - - // List of HTML entities for escaping. - var escapeMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`' - }; - var unescapeMap = _.invert(escapeMap); - - // Functions for escaping and unescaping strings to/from HTML interpolation. - var createEscaper = function(map) { - var escaper = function(match) { - return map[match]; - }; - // Regexes for identifying a key that needs to be escaped - var source = '(?:' + _.keys(map).join('|') + ')'; - var testRegexp = RegExp(source); - var replaceRegexp = RegExp(source, 'g'); - return function(string) { - string = string == null ? '' : '' + string; - return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; - }; - }; - _.escape = createEscaper(escapeMap); - _.unescape = createEscaper(unescapeMap); - - // If the value of the named `property` is a function then invoke it with the - // `object` as context; otherwise, return it. - _.result = function(object, property, fallback) { - var value = object == null ? void 0 : object[property]; - if (value === void 0) { - value = fallback; - } - return _.isFunction(value) ? value.call(object) : value; - }; - - // Generate a unique integer id (unique within the entire client session). - // Useful for temporary DOM ids. - var idCounter = 0; - _.uniqueId = function(prefix) { - var id = ++idCounter + ''; - return prefix ? prefix + id : id; - }; - - // By default, Underscore uses ERB-style template delimiters, change the - // following template settings to use alternative delimiters. - _.templateSettings = { - evaluate : /<%([\s\S]+?)%>/g, - interpolate : /<%=([\s\S]+?)%>/g, - escape : /<%-([\s\S]+?)%>/g - }; - - // When customizing `templateSettings`, if you don't want to define an - // interpolation, evaluation or escaping regex, we need one that is - // guaranteed not to match. - var noMatch = /(.)^/; - - // Certain characters need to be escaped so that they can be put into a - // string literal. - var escapes = { - "'": "'", - '\\': '\\', - '\r': 'r', - '\n': 'n', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - var escaper = /\\|'|\r|\n|\u2028|\u2029/g; - - var escapeChar = function(match) { - return '\\' + escapes[match]; - }; - - // JavaScript micro-templating, similar to John Resig's implementation. - // Underscore templating handles arbitrary delimiters, preserves whitespace, - // and correctly escapes quotes within interpolated code. - // NB: `oldSettings` only exists for backwards compatibility. - _.template = function(text, settings, oldSettings) { - if (!settings && oldSettings) settings = oldSettings; - settings = _.defaults({}, settings, _.templateSettings); - - // Combine delimiters into one regular expression via alternation. - var matcher = RegExp([ - (settings.escape || noMatch).source, - (settings.interpolate || noMatch).source, - (settings.evaluate || noMatch).source - ].join('|') + '|$', 'g'); - - // Compile the template source, escaping string literals appropriately. - var index = 0; - var source = "__p+='"; - text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { - source += text.slice(index, offset).replace(escaper, escapeChar); - index = offset + match.length; - - if (escape) { - source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; - } else if (interpolate) { - source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; - } else if (evaluate) { - source += "';\n" + evaluate + "\n__p+='"; - } - - // Adobe VMs need the match returned to produce the correct offest. - return match; - }); - source += "';\n"; - - // If a variable is not specified, place data values in local scope. - if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; - - source = "var __t,__p='',__j=Array.prototype.join," + - "print=function(){__p+=__j.call(arguments,'');};\n" + - source + 'return __p;\n'; - - try { - var render = new Function(settings.variable || 'obj', '_', source); - } catch (e) { - e.source = source; - throw e; - } - - var template = function(data) { - return render.call(this, data, _); - }; - - // Provide the compiled source as a convenience for precompilation. - var argument = settings.variable || 'obj'; - template.source = 'function(' + argument + '){\n' + source + '}'; - - return template; - }; - - // Add a "chain" function. Start chaining a wrapped Underscore object. - _.chain = function(obj) { - var instance = _(obj); - instance._chain = true; - return instance; - }; - - // OOP - // --------------- - // If Underscore is called as a function, it returns a wrapped object that - // can be used OO-style. This wrapper holds altered versions of all the - // underscore functions. Wrapped objects may be chained. - - // Helper function to continue chaining intermediate results. - var result = function(instance, obj) { - return instance._chain ? _(obj).chain() : obj; - }; - - // Add your own custom functions to the Underscore object. - _.mixin = function(obj) { - _.each(_.functions(obj), function(name) { - var func = _[name] = obj[name]; - _.prototype[name] = function() { - var args = [this._wrapped]; - push.apply(args, arguments); - return result(this, func.apply(_, args)); - }; - }); - }; - - // Add all of the Underscore functions to the wrapper object. - _.mixin(_); - - // Add all mutator Array functions to the wrapper. - _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { - var method = ArrayProto[name]; - _.prototype[name] = function() { - var obj = this._wrapped; - method.apply(obj, arguments); - if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0]; - return result(this, obj); - }; - }); - - // Add all accessor Array functions to the wrapper. - _.each(['concat', 'join', 'slice'], function(name) { - var method = ArrayProto[name]; - _.prototype[name] = function() { - return result(this, method.apply(this._wrapped, arguments)); - }; - }); - - // Extracts the result from a wrapped and chained object. - _.prototype.value = function() { - return this._wrapped; - }; - - // Provide unwrapping proxy for some methods used in engine operations - // such as arithmetic and JSON stringification. - _.prototype.valueOf = _.prototype.toJSON = _.prototype.value; - - _.prototype.toString = function() { - return '' + this._wrapped; - }; - - // AMD registration happens at the end for compatibility with AMD loaders - // that may not enforce next-turn semantics on modules. Even though general - // practice for AMD registration is to be anonymous, underscore registers - // as a named module because, like jQuery, it is a base library that is - // popular enough to be bundled in a third party lib, but not be part of - // an AMD load request. Those cases could generate an error when an - // anonymous define() is called outside of a loader request. - if (typeof define === 'function' && define.amd) { - define('underscore', [], function() { - return _; - }); - } -}.call(this));/** - * Created by richie on 15/7/8. - */ -/** - * 初始化BI对象 - */ -if (window.BI == null) { - window.BI = {}; -}/** - * MVC工厂 - * guy - * @class BI.Factory - */ -BI.Factory = { - parsePath: function parsePath (path) { - var segments = path.split('.'); - return function (obj) { - for (var i = 0; i < segments.length; i++) { - if (!obj) { - return; - } - obj = obj[segments[i]]; - } - return obj; - } - }, - createView : function(url, viewFunc, mData, vData, context){ - var modelFunc = viewFunc.replace(/View/, "Model"); - modelFunc = this.parsePath(modelFunc)(window); - if(!_.isFunction(modelFunc)){ - modelFunc = BI.Model; - } -// try { - var model = new (modelFunc)(_.extend({}, mData, { - parent: context && context.model, - rootURL: url - }), {silent: true}); -// } catch (e) { -// -// } -// try { - var view = new (eval(viewFunc))(_.extend({}, vData, { - model: model, - parent: context, - rootURL: url - })); -// } catch (e) { -// -// } - return view; - } -};(function (root, factory) { - root.BI = factory(root, root.BI || {}, root._, (root.jQuery || root.$)); -}(this, function (root, BI, _, $) { - - var previousBI = root.BI; - - // Create local references to array methods we'll want to use later. - var array = []; - var slice = array.slice; - - // Current version of the library. Keep in sync with `package.json`. - BI.VERSION = '1.0.0'; - - // For BI's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns - // the `$` variable. - BI.$ = $; - - // Runs BI.js in *noConflict* mode, returning the `BI` variable - // to its previous owner. Returns a reference to this BI object. - BI.noConflict = function () { - root.BI = previousBI; - return this; - }; - - // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option - // will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and - // set a `X-Http-Method-Override` header. - BI.emulateHTTP = true; - - // Turn on `emulateJSON` to support legacy servers that can't deal with direct - // `application/json` requests ... this will encode the body as - // `application/x-www-form-urlencoded` instead and will send the model in a - // form param named `model`. - BI.emulateJSON = true; - - // BI.Events - // --------------- - - // A module that can be mixed in to *any object* in order to provide it with - // custom events. You may bind with `on` or remove with `off` callback - // functions to an event; `trigger`-ing an event fires all callbacks in - // succession. - // - // var object = {}; - // _.extend(object, BI.Events); - // object.on('expand', function(){ alert('expanded'); }); - // object.trigger('expand'); - // - var Events = BI.Events = { - - // Bind an event to a `callback` function. Passing `"all"` will bind - // the callback to all events fired. - on: function (name, callback, context) { - if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this; - this._events || (this._events = {}); - var events = this._events[name] || (this._events[name] = []); - events.push({callback: callback, context: context, ctx: context || this}); - return this; - }, - - // Bind an event to only be triggered a single time. After the first time - // the callback is invoked, it will be removed. - once: function (name, callback, context) { - if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this; - var self = this; - var once = _.once(function () { - self.off(name, once); - callback.apply(this, arguments); - }); - once._callback = callback; - return this.on(name, once, context); - }, - - // Remove one or many callbacks. If `context` is null, removes all - // callbacks with that function. If `callback` is null, removes all - // callbacks for the event. If `name` is null, removes all bound - // callbacks for all events. - off: function (name, callback, context) { - if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this; - - // Remove all callbacks for all events. - if (!name && !callback && !context) { - this._events = void 0; - return this; - } - - var names = name ? [name] : _.keys(this._events); - for (var i = 0, length = names.length; i < length; i++) { - name = names[i]; - - // Bail out if there are no events stored. - var events = this._events[name]; - if (!events) continue; - - // Remove all callbacks for this event. - if (!callback && !context) { - delete this._events[name]; - continue; - } - - // Find any remaining events. - var remaining = []; - for (var j = 0, k = events.length; j < k; j++) { - var event = events[j]; - if ( - callback && callback !== event.callback && - callback !== event.callback._callback || - context && context !== event.context - ) { - remaining.push(event); - } - } - - // Replace events if there are any remaining. Otherwise, clean up. - if (remaining.length) { - this._events[name] = remaining; - } else { - delete this._events[name]; - } - } - - return this; - }, - - un: function () { - this.off.apply(this, arguments); - }, - - // Trigger one or many events, firing all bound callbacks. Callbacks are - // passed the same arguments as `trigger` is, apart from the event name - // (unless you're listening on `"all"`, which will cause your callback to - // receive the true name of the event as the first argument). - trigger: function (name) { - if (!this._events) return this; - var args = slice.call(arguments, 1); - if (!eventsApi(this, 'trigger', name, args)) return this; - var events = this._events[name]; - var allEvents = this._events.all; - if (events) triggerEvents(events, args); - if (allEvents) triggerEvents(allEvents, arguments); - return this; - }, - - fireEvent: function () { - this.trigger.apply(this, arguments); - }, - - // Inversion-of-control versions of `on` and `once`. Tell *this* object to - // listen to an event in another object ... keeping track of what it's - // listening to. - listenTo: function (obj, name, callback) { - var listeningTo = this._listeningTo || (this._listeningTo = {}); - var id = obj._listenId || (obj._listenId = _.uniqueId('l')); - listeningTo[id] = obj; - if (!callback && typeof name === 'object') callback = this; - obj.on(name, callback, this); - return this; - }, - - listenToOnce: function (obj, name, callback) { - if (typeof name === 'object') { - for (var event in name) this.listenToOnce(obj, event, name[event]); - return this; - } - if (eventSplitter.test(name)) { - var names = name.split(eventSplitter); - for (var i = 0, length = names.length; i < length; i++) { - this.listenToOnce(obj, names[i], callback); - } - return this; - } - if (!callback) return this; - var once = _.once(function () { - this.stopListening(obj, name, once); - callback.apply(this, arguments); - }); - once._callback = callback; - return this.listenTo(obj, name, once); - }, - - // Tell this object to stop listening to either specific events ... or - // to every object it's currently listening to. - stopListening: function (obj, name, callback) { - var listeningTo = this._listeningTo; - if (!listeningTo) return this; - var remove = !name && !callback; - if (!callback && typeof name === 'object') callback = this; - if (obj) (listeningTo = {})[obj._listenId] = obj; - for (var id in listeningTo) { - obj = listeningTo[id]; - obj.off(name, callback, this); - if (remove || _.isEmpty(obj._events)) delete this._listeningTo[id]; - } - return this; - } - - }; - - // Regular expression used to split event strings. - var eventSplitter = /\s+/; - - // Implement fancy features of the Events API such as multiple event - // names `"change blur"` and jQuery-style event maps `{change: action}` - // in terms of the existing API. - var eventsApi = function (obj, action, name, rest) { - if (!name) return true; - - // Handle event maps. - if (typeof name === 'object') { - for (var key in name) { - obj[action].apply(obj, [key, name[key]].concat(rest)); - } - return false; - } - - // Handle space separated event names. - if (eventSplitter.test(name)) { - var names = name.split(eventSplitter); - for (var i = 0, length = names.length; i < length; i++) { - obj[action].apply(obj, [names[i]].concat(rest)); - } - return false; - } - - return true; - }; - - // A difficult-to-believe, but optimized internal dispatch function for - // triggering events. Tries to keep the usual cases speedy (most internal - // BI events have 3 arguments). - var triggerEvents = function (events, args) { - var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2]; - switch (args.length) { - case 0: - while (++i < l) (ev = events[i]).callback.call(ev.ctx); - return; - case 1: - while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); - return; - case 2: - while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); - return; - case 3: - while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); - return; - default: - while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); - return; - } - }; - - // Aliases for backwards compatibility. - Events.bind = Events.on; - Events.unbind = Events.off; - - // Allow the `BI` object to serve as a global event bus, for folks who - // want global "pubsub" in a convenient place. - _.extend(BI, Events); - - // BI.M - // -------------- - - // BI **Models** are the basic data object in the framework -- - // frequently representing a row in a table in a database on your server. - // A discrete chunk of data and a bunch of useful, related methods for - // performing computations and transformations on that data. - - // Create a new model with the specified attributes. A client id (`cid`) - // is automatically generated and assigned for you. - var M = BI.M = function (attributes, options) { - var attrs = attributes || {}; - options = options || {}; - this.cid = _.uniqueId('c'); - this.attributes = {}; - if (options.collection) this.collection = options.collection; - if (options.parse) attrs = this.parse(attrs, options) || {}; - this.options = attrs = _.defaults({}, attrs, _.result(this, '_defaultConfig')); - _.extend(this, _.pick(this.options, modelOptions)); - this.set(attrs, options); - this.changed = {}; - this._init.apply(this, arguments); - }; - - var modelOptions = ['rootURL', 'parent', 'data', 'id']; - - // Attach all inheritable methods to the M prototype. - _.extend(M.prototype, Events, { - - // A hash of attributes whose current and previous value differ. - changed: null, - - // The value returned during the last failed validation. - validationError: null, - - // The default name for the JSON `id` attribute is `"id"`. MongoDB and - // CouchDB users may want to set this to `"_id"`. - idAttribute: 'ID', - - _defaultConfig: function () { - return {} - }, - - // _init is an empty function by default. Override it with your own - // initialization logic. - _init: function () { - }, - - // Return a copy of the model's `attributes` object. - toJSON: function (options) { - return _.clone(this.attributes); - }, - - // Proxy `BI.sync` by default -- but override this if you need - // custom syncing semantics for *this* particular model. - sync: function () { - return BI.sync.apply(this, arguments); - }, - - // Get the value of an attribute. - get: function (attr) { - return this.attributes[attr]; - }, - - // Get the HTML-escaped value of an attribute. - escape: function (attr) { - return _.escape(this.get(attr)); - }, - - // Returns `true` if the attribute contains a value that is not null - // or undefined. - has: function (attr) { - return _.has(this.attributes, attr); - }, - - // Special-cased proxy to underscore's `_.matches` method. - matches: function (attrs) { - var keys = _.keys(attrs), length = keys.length; - var obj = Object(this.attributes); - for (var i = 0; i < length; i++) { - var key = keys[i]; - if (!_.isEqual(attrs[key], obj[key]) || !(key in obj)) return false; - } - return true; - }, - - // Set a hash of model attributes on the object, firing `"change"`. This is - // the core primitive operation of a model, updating the data and notifying - // anyone who needs to know about the change in state. The heart of the beast. - set: function (key, val, options) { - var attr, attrs, unset, changes, silent, changing, changed, prev, current; - if (key == null) return this; - - // Handle both `"key", value` and `{key: value}` -style arguments. - if (typeof key === 'object') { - attrs = key; - options = val; - } else { - (attrs = {})[key] = val; - } - - options || (options = {}); - - // Run validation. - if (!this._validate(attrs, options)) return false; - - // Extract attributes and options. - unset = options.unset; - silent = options.silent; - changes = []; - changing = this._changing; - this._changing = true; - - if (!changing) { - this._previousAttributes = _.clone(this.attributes); - this.changed = {}; - } - current = this.attributes, prev = this._previousAttributes; - - // Check for changes of `id`. - if (this.idAttribute in attrs) this.id = attrs[this.idAttribute]; - - // For each `set` attribute, update or delete the current value. - for (attr in attrs) { - val = attrs[attr]; - if (!_.isEqual(current[attr], val)) changes.push(attr); - if (!_.isEqual(prev[attr], val)) { - this.changed[attr] = val; - } else { - delete this.changed[attr]; - } - unset ? delete current[attr] : current[attr] = val; - } - - // Trigger all relevant attribute changes. - if (!silent) { - if (changes.length) this._pending = options; - for (var i = 0, length = changes.length; i < length; i++) { - this.trigger('change:' + changes[i], this, current[changes[i]], options); - } - } - - // You might be wondering why there's a `while` loop here. Changes can - // be recursively nested within `"change"` events. - if (changing) return this; - changed = BI.clone(this.changed); - if (!silent) { - while (this._pending) { - options = this._pending; - this._pending = false; - this.trigger('change', changed, prev, this, options); - } - } - this._pending = false; - this._changing = false; - if (!silent && changes.length) this.trigger("changed", changed, prev, this, options); - return this; - }, - - // Remove an attribute from the model, firing `"change"`. `unset` is a noop - // if the attribute doesn't exist. - unset: function (attr, options) { - return this.set(attr, void 0, _.extend({}, options, {unset: true})); - }, - - // Clear all attributes on the model, firing `"change"`. - clear: function (options) { - var attrs = {}; - for (var key in this.attributes) attrs[key] = void 0; - return this.set(attrs, _.extend({}, options, {unset: true})); - }, - - // Determine if the model has changed since the last `"change"` event. - // If you specify an attribute name, determine if that attribute has changed. - hasChanged: function (attr) { - if (attr == null) return !_.isEmpty(this.changed); - return _.has(this.changed, attr); - }, - - // Return an object containing all the attributes that have changed, or - // false if there are no changed attributes. Useful for determining what - // parts of a view need to be updated and/or what attributes need to be - // persisted to the server. Unset attributes will be set to undefined. - // You can also pass an attributes object to diff against the model, - // determining if there *would be* a change. - changedAttributes: function (diff) { - if (!diff) return this.hasChanged() ? _.clone(this.changed) : false; - var val, changed = false; - var old = this._changing ? this._previousAttributes : this.attributes; - for (var attr in diff) { - if (_.isEqual(old[attr], (val = diff[attr]))) continue; - (changed || (changed = {}))[attr] = val; - } - return changed; - }, - - // Get the previous value of an attribute, recorded at the time the last - // `"change"` event was fired. - previous: function (attr) { - if (attr == null || !this._previousAttributes) return null; - return this._previousAttributes[attr]; - }, - - // Get all of the attributes of the model at the time of the previous - // `"change"` event. - previousAttributes: function () { - return _.clone(this._previousAttributes); - }, - - // Fetch the model from the server. If the server's representation of the - // model differs from its current attributes, they will be overridden, - // triggering a `"change"` event. - fetch: function (options) { - options = options ? _.clone(options) : {}; - if (options.parse === void 0) options.parse = true; - var model = this; - var success = options.success; - options.success = function (resp) { - if (!options.noset) { - if (!model.set(model.parse(resp, options), options)) return false; - } - if (success) success(resp, model, options); - model.trigger('sync', resp, model, options).trigger('read', resp, model, options); - }; - wrapError(this, options); - return this.sync('read', this, options); - }, - - // Set a hash of model attributes, and sync the model to the server. - // If the server returns an attributes hash that differs, the model's - // state will be `set` again. - save: function (key, val, options) { - var attrs, method, xhr, attributes = this.attributes; - - // Handle both `"key", value` and `{key: value}` -style arguments. - if (key == null || typeof key === 'object') { - attrs = key; - options = val; - } else { - (attrs = {})[key] = val; - } - - options = _.extend({validate: true}, options); - - // If we're not waiting and attributes exist, save acts as - // `set(attr).save(null, opts)` with validation. Otherwise, check if - // the model will be valid when the attributes, if any, are set. - if (attrs && !options.wait) { - if (!this.set(attrs, options)) return false; - } else { - if (!this._validate(attrs, options)) return false; - } - - // Set temporary attributes if `{wait: true}`. - if (attrs && options.wait) { - this.attributes = _.extend({}, attributes, attrs); - } - - // After a successful server-side save, the client is (optionally) - // updated with the server-side state. - if (options.parse === void 0) options.parse = true; - var model = this; - var success = options.success; - options.success = function (resp) { - // Ensure attributes are restored during synchronous saves. - model.attributes = attributes; - var serverAttrs = model.parse(resp, options); - if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs); - if (_.isObject(serverAttrs) && !options.noset && !model.set(serverAttrs, options)) { - return false; - } - if (success) success(resp, model, options); - model.trigger('sync', resp, model, options) - .trigger((options.patch ? 'patch' : 'update'), resp, model, options); - }; - wrapError(this, options); - - method = /**this.isNew() ? 'create' :**/ (options.patch ? 'patch' : 'update'); - if (method === 'patch' && !options.attrs) options.attrs = attrs; - xhr = this.sync(method, this, options); - - // Restore attributes. - if (attrs && options.wait) this.attributes = attributes; - - return xhr; - }, - - // Destroy this model on the server if it was already persisted. - // Optimistically removes the model from its collection, if it has one. - // If `wait: true` is passed, waits for the server to respond before removal. - destroy: function (options) { - options = options ? _.clone(options) : {}; - var model = this; - var success = options.success; - - var destroy = function () { - model.stopListening(); - model.trigger('destroy', model.collection, model, options); - }; - - options.success = function (resp) { - if (options.wait || model.isNew()) destroy(); - if (success) success(resp, model, options); - if (!model.isNew()) model.trigger('sync', resp, model, options).trigger('delete', resp, model, options); - }; - - if (this.isNew()) { - options.success(); - return false; - } - wrapError(this, options); - - var xhr = this.sync('delete', this, options); - if (!options.wait) destroy(); - return xhr; - }, - - // Default URL for the model's representation on the server -- if you're - // using BI's restful methods, override this to change the endpoint - // that will be called. - url: function () { - var base = - _.result(this.collection, 'url'); - if (this.isNew()) return base; - return base.replace(/([^\/])$/, '$1/') + encodeURIComponent(this.id); - }, - - // **parse** converts a response into the hash of attributes to be `set` on - // the model. The default implementation is just to pass the response along. - parse: function (resp, options) { - return resp; - }, - - // Create a new model with identical attributes to this one. - clone: function () { - return new this.constructor(this.attributes); - }, - - // A model is new if it has never been saved to the server, and lacks an id. - isNew: function () { - return !this.has(this.idAttribute); - }, - - // Check if the model is currently in a valid state. - isValid: function (options) { - return this._validate({}, _.extend(options || {}, {validate: true})); - }, - - // Run validation against the next complete set of model attributes, - // returning `true` if all is well. Otherwise, fire an `"invalid"` event. - _validate: function (attrs, options) { - if (!options.validate || !this.validate) return true; - attrs = _.extend({}, this.attributes, attrs); - var error = this.validationError = this.validate(attrs, options) || null; - if (!error) return true; - this.trigger('invalid', error, this, _.extend(options, {validationError: error})); - return false; - } - - }); - - // Underscore methods that we want to implement on the M. - var modelMethods = ['keys', 'values', 'pairs', 'invert', 'pick', 'omit', 'chain', 'isEmpty']; - - // Mix in each Underscore method as a proxy to `M#attributes`. - _.each(modelMethods, function (method) { - if (!_[method]) return; - M.prototype[method] = function () { - var args = slice.call(arguments); - args.unshift(this.attributes); - return _[method].apply(_, args); - }; - }); - - // BI.Collection - // ------------------- - - // If models tend to represent a single row of data, a BI Collection is - // more analogous to a table full of data ... or a small slice or page of that - // table, or a collection of rows that belong together for a particular reason - // -- all of the messages in this particular folder, all of the documents - // belonging to this particular author, and so on. Collections maintain - // indexes of their models, both in order, and for lookup by `id`. - - // Create a new **Collection**, perhaps to contain a specific type of `model`. - // If a `comparator` is specified, the Collection will maintain - // its models in sort order, as they're added and removed. - var Collection = BI.Collection = function (models, options) { - this.options = options = options || {}; - if (options.model) this.model = options.model; - if (options.comparator !== void 0) this.comparator = options.comparator; - this._reset(); - this._init.apply(this, arguments); - if (models) this.reset(models, _.extend({silent: true}, options)); - }; - - // Default options for `Collection#set`. - var setOptions = {add: true, remove: true, merge: true}; - var addOptions = {add: true, remove: false}; - - // Define the Collection's inheritable methods. - _.extend(Collection.prototype, Events, { - - // The default model for a collection is just a **BI.M**. - // This should be overridden in most cases. - model: M, - - // _init is an empty function by default. Override it with your own - // initialization logic. - _init: function () { - }, - - // The JSON representation of a Collection is an array of the - // models' attributes. - toJSON: function (options) { - return this.map(function (model) { - return model.toJSON(options); - }); - }, - - // Proxy `BI.sync` by default. - sync: function () { - return BI.sync.apply(this, arguments); - }, - - // Add a model, or list of models to the set. - add: function (models, options) { - return this.set(models, _.extend({merge: false}, options, addOptions)); - }, - - // Remove a model, or a list of models from the set. - remove: function (models, options) { - var singular = !_.isArray(models); - models = singular ? [models] : _.clone(models); - options || (options = {}); - for (var i = 0, length = models.length; i < length; i++) { - var model = models[i] = this.get(models[i]); - if (!model) continue; - var id = this.modelId(model.attributes); - if (id != null) delete this._byId[id]; - delete this._byId[model.cid]; - var index = this.indexOf(model); - this.models.splice(index, 1); - this.length--; - if (!options.silent) { - options.index = index; - model.trigger('remove', model, this, options); - } - this._removeReference(model, options); - } - return singular ? models[0] : models; - }, - - // Update a collection by `set`-ing a new list of models, adding new ones, - // removing models that are no longer present, and merging models that - // already exist in the collection, as necessary. Similar to **M#set**, - // the core operation for updating the data contained by the collection. - set: function (models, options) { - options = _.defaults({}, options, setOptions); - if (options.parse) models = this.parse(models, options); - var singular = !_.isArray(models); - models = singular ? (models ? [models] : []) : models.slice(); - var id, model, attrs, existing, sort; - var at = options.at; - if (at != null) at = +at; - if (at < 0) at += this.length + 1; - var sortable = this.comparator && (at == null) && options.sort !== false; - var sortAttr = _.isString(this.comparator) ? this.comparator : null; - var toAdd = [], toRemove = [], modelMap = {}; - var add = options.add, merge = options.merge, remove = options.remove; - var order = !sortable && add && remove ? [] : false; - var orderChanged = false; - - // Turn bare objects into model references, and prevent invalid models - // from being added. - for (var i = 0, length = models.length; i < length; i++) { - attrs = models[i]; - - // If a duplicate is found, prevent it from being added and - // optionally merge it into the existing model. - if (existing = this.get(attrs)) { - if (remove) modelMap[existing.cid] = true; - if (merge && attrs !== existing) { - attrs = this._isModel(attrs) ? attrs.attributes : attrs; - if (options.parse) attrs = existing.parse(attrs, options); - existing.set(attrs, options); - if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true; - } - models[i] = existing; - - // If this is a new, valid model, push it to the `toAdd` list. - } else if (add) { - model = models[i] = this._prepareModel(attrs, options); - if (!model) continue; - toAdd.push(model); - this._addReference(model, options); - } - - // Do not add multiple models with the same `id`. - model = existing || model; - if (!model) continue; - id = this.modelId(model.attributes); - if (order && (model.isNew() || !modelMap[id])) { - order.push(model); - - // Check to see if this is actually a new model at this index. - orderChanged = orderChanged || !this.models[i] || model.cid !== this.models[i].cid; - } - - modelMap[id] = true; - } - - // Remove nonexistent models if appropriate. - if (remove) { - for (var i = 0, length = this.length; i < length; i++) { - if (!modelMap[(model = this.models[i]).cid]) toRemove.push(model); - } - if (toRemove.length) this.remove(toRemove, options); - } - - // See if sorting is needed, update `length` and splice in new models. - if (toAdd.length || orderChanged) { - if (sortable) sort = true; - this.length += toAdd.length; - if (at != null) { - for (var i = 0, length = toAdd.length; i < length; i++) { - this.models.splice(at + i, 0, toAdd[i]); - } - } else { - if (order) this.models.length = 0; - var orderedModels = order || toAdd; - for (var i = 0, length = orderedModels.length; i < length; i++) { - this.models.push(orderedModels[i]); - } - } - } - - // Silently sort the collection if appropriate. - if (sort) this.sort({silent: true}); - - // Unless silenced, it's time to fire all appropriate add/sort events. - if (!options.silent) { - var addOpts = at != null ? _.clone(options) : options; - for (var i = 0, length = toAdd.length; i < length; i++) { - if (at != null) addOpts.index = at + i; - (model = toAdd[i]).trigger('add', model, this, addOpts); - } - if (sort || orderChanged) this.trigger('sort', this, options); - } - - // Return the added (or merged) model (or models). - return singular ? models[0] : models; - }, - - // When you have more items than you want to add or remove individually, - // you can reset the entire set with a new list of models, without firing - // any granular `add` or `remove` events. Fires `reset` when finished. - // Useful for bulk operations and optimizations. - reset: function (models, options) { - options = options ? _.clone(options) : {}; - for (var i = 0, length = this.models.length; i < length; i++) { - this._removeReference(this.models[i], options); - } - options.previousModels = this.models; - this._reset(); - models = this.add(models, _.extend({silent: true}, options)); - if (!options.silent) this.trigger('reset', this, options); - return models; - }, - - // Add a model to the end of the collection. - push: function (model, options) { - return this.add(model, _.extend({at: this.length}, options)); - }, - - // Remove a model from the end of the collection. - pop: function (options) { - var model = this.at(this.length - 1); - this.remove(model, options); - return model; - }, - - // Add a model to the beginning of the collection. - unshift: function (model, options) { - return this.add(model, _.extend({at: 0}, options)); - }, - - // Remove a model from the beginning of the collection. - shift: function (options) { - var model = this.at(0); - this.remove(model, options); - return model; - }, - - // Slice out a sub-array of models from the collection. - slice: function () { - return slice.apply(this.models, arguments); - }, - - // Get a model from the set by id. - get: function (obj) { - if (obj == null) return void 0; - var id = this.modelId(this._isModel(obj) ? obj.attributes : obj); - return this._byId[obj] || this._byId[id] || this._byId[obj.cid]; - }, - - // Get the model at the given index. - at: function (index) { - if (index < 0) index += this.length; - return this.models[index]; - }, - - // Return models with matching attributes. Useful for simple cases of - // `filter`. - where: function (attrs, first) { - var matches = _.matches(attrs); - return this[first ? 'find' : 'filter'](function (model) { - return matches(model.attributes); - }); - }, - - // Return the first model with matching attributes. Useful for simple cases - // of `find`. - findWhere: function (attrs) { - return this.where(attrs, true); - }, - - // Force the collection to re-sort itself. You don't need to call this under - // normal circumstances, as the set will maintain sort order as each item - // is added. - sort: function (options) { - if (!this.comparator) throw new Error('Cannot sort a set without a comparator'); - options || (options = {}); - - // Run sort based on type of `comparator`. - if (_.isString(this.comparator) || this.comparator.length === 1) { - this.models = this.sortBy(this.comparator, this); - } else { - this.models.sort(_.bind(this.comparator, this)); - } - - if (!options.silent) this.trigger('sort', this, options); - return this; - }, - - // Pluck an attribute from each model in the collection. - pluck: function (attr) { - return _.invoke(this.models, 'get', attr); - }, - - // Fetch the default set of models for this collection, resetting the - // collection when they arrive. If `reset: true` is passed, the response - // data will be passed through the `reset` method instead of `set`. - fetch: function (options) { - options = options ? _.clone(options) : {}; - if (options.parse === void 0) options.parse = true; - var success = options.success; - var collection = this; - options.success = function (resp) { - var method = options.reset ? 'reset' : 'set'; - collection[method](resp, options); - if (success) success(collection, resp, options); - collection.trigger('sync', collection, resp, options); - }; - wrapError(this, options); - return this.sync('read', this, options); - }, - - // Create a new instance of a model in this collection. Add the model to the - // collection immediately, unless `wait: true` is passed, in which case we - // wait for the server to agree. - create: function (model, options) { - options = options ? _.clone(options) : {}; - if (!(model = this._prepareModel(model, options))) return false; - if (!options.wait) this.add(model, options); - var collection = this; - var success = options.success; - options.success = function (model, resp) { - if (options.wait) collection.add(model, options); - if (success) success(model, resp, options); - }; - model.save(null, options); - return model; - }, - - // **parse** converts a response into a list of models to be added to the - // collection. The default implementation is just to pass it through. - parse: function (resp, options) { - return resp; - }, - - // Create a new collection with an identical list of models as this one. - clone: function () { - return new this.constructor(this.models, { - model: this.model, - comparator: this.comparator - }); - }, - - // Define how to uniquely identify models in the collection. - modelId: function (attrs) { - return attrs[this.model.prototype.idAttribute || 'id']; - }, - - // Private method to reset all internal state. Called when the collection - // is first _initd or reset. - _reset: function () { - this.length = 0; - this.models = []; - this._byId = {}; - }, - - // Prepare a hash of attributes (or other model) to be added to this - // collection. - _prepareModel: function (attrs, options) { - if (this._isModel(attrs)) { - if (!attrs.collection) attrs.collection = this; - return attrs; - } - options = options ? _.clone(options) : {}; - options.collection = this; - var model = new this.model(attrs, options); - if (!model.validationError) return model; - this.trigger('invalid', this, model.validationError, options); - return false; - }, - - // Method for checking whether an object should be considered a model for - // the purposes of adding to the collection. - _isModel: function (model) { - return model instanceof M; - }, - - // Internal method to create a model's ties to a collection. - _addReference: function (model, options) { - this._byId[model.cid] = model; - var id = this.modelId(model.attributes); - if (id != null) this._byId[id] = model; - model.on('all', this._onModelEvent, this); - }, - - // Internal method to sever a model's ties to a collection. - _removeReference: function (model, options) { - if (this === model.collection) delete model.collection; - model.off('all', this._onModelEvent, this); - }, - - // Internal method called every time a model in the set fires an event. - // Sets need to update their indexes when models change ids. All other - // events simply proxy through. "add" and "remove" events that originate - // in other collections are ignored. - _onModelEvent: function (event, model, collection, options) { - if ((event === 'add' || event === 'remove') && collection !== this) return; - if (event === 'destroy') this.remove(model, options); - if (event === 'change') { - var prevId = this.modelId(model.previousAttributes()); - var id = this.modelId(model.attributes); - if (prevId !== id) { - if (prevId != null) delete this._byId[prevId]; - if (id != null) this._byId[id] = model; - } - } - this.trigger.apply(this, arguments); - } - - }); - - // Underscore methods that we want to implement on the Collection. - // 90% of the core usefulness of BI Collections is actually implemented - // right here: - var methods = ['forEach', 'each', 'map', 'collect', 'reduce', 'foldl', - 'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select', - 'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke', - 'max', 'min', 'toArray', 'size', 'first', 'head', 'take', 'initial', 'rest', - 'tail', 'drop', 'last', 'without', 'difference', 'indexOf', 'shuffle', - 'lastIndexOf', 'isEmpty', 'chain', 'sample', 'partition']; - - // Mix in each Underscore method as a proxy to `Collection#models`. - _.each(methods, function (method) { - if (!_[method]) return; - Collection.prototype[method] = function () { - var args = slice.call(arguments); - args.unshift(this.models); - return _[method].apply(_, args); - }; - }); - - // Underscore methods that take a property name as an argument. - var attributeMethods = ['groupBy', 'countBy', 'sortBy', 'indexBy']; - - // Use attributes instead of properties. - _.each(attributeMethods, function (method) { - if (!_[method]) return; - Collection.prototype[method] = function (value, context) { - var iterator = _.isFunction(value) ? value : function (model) { - return model.get(value); - }; - return _[method](this.models, iterator, context); - }; - }); - - // BI.V - // ------------- - - // BI Views are almost more convention than they are actual code. A V - // is simply a JavaScript object that represents a logical chunk of UI in the - // DOM. This might be a single item, an entire list, a sidebar or panel, or - // even the surrounding frame which wraps your whole app. Defining a chunk of - // UI as a **V** allows you to define your DOM events declaratively, without - // having to worry about render order ... and makes it easy for the view to - // react to specific changes in the state of your models. - - // Creating a BI.V creates its initial element outside of the DOM, - // if an existing element is not provided... - var V = BI.V = function (options) { - this.cid = _.uniqueId('view'); - options = options || {}; - this.options = _.defaults(options, _.result(this, '_defaultConfig')); - _.extend(this, _.pick(this.options, viewOptions)); - this._ensureElement(); - this._init.apply(this, arguments); - }; - - // Cached regex to split keys for `delegate`. - var delegateEventSplitter = /^(\S+)\s*(.*)$/; - - // List of view options to be merged as properties. - var viewOptions = ['rootURL', 'model', 'parent', 'collection', 'element', 'id', 'attributes', 'baseCls', 'tagName', 'events']; - - // Set up all inheritable **BI.V** properties and methods. - _.extend(V.prototype, Events, { - - // The default `tagName` of a V's element is `"div"`. - tagName: 'div', - - // jQuery delegate for element lookup, scoped to DOM elements within the - // current view. This should be preferred to global lookups where possible. - $: function (selector) { - return this.$el.find(selector); - }, - - _defaultConfig: function () { - return {} - }, - - // _init is an empty function by default. Override it with your own - // initialization logic. - _init: function () { - }, - - //容器,默认放在this.element上 - _vessel: function () { - return this - }, - // **render** is the core function that your view should override, in order - // to populate its element (`this.el`), with the appropriate HTML. The - // convention is for **render** to always return `this`. - render: function (vessel) { - return this; - }, - - // Remove this view by taking the element out of the DOM, and removing any - // applicable BI.Events listeners. - remove: function () { - this._removeElement(); - this.stopListening(); - return this; - }, - - // Remove this view's element from the document and all event listeners - // attached to it. Exposed for subclasses using an alternative DOM - // manipulation API. - _removeElement: function () { - this.$el.remove(); - if ($.browser.msie === true) { - this.el.outerHTML = ''; - } - }, - - // Change the view's element (`this.el` property) and re-delegate the - // view's events on the new element. - setElement: function (element) { - this.undelegateEvents(); - this._setElement(element); - this.vessel = this._vessel(); - this.render(this.vessel); - this.delegateEvents(); - return this; - }, - - setVisible: function (visible) { - this.options.invisible = !visible; - if (visible) { - this.element.css("display", ""); - } else { - this.element.css("display", "none"); - } - }, - - isVisible: function () { - return !this.options.invisible; - }, - - visible: function () { - this.setVisible(true); - }, - - invisible: function () { - this.setVisible(false); - }, - - // Creates the `this.el` and `this.$el` references for this view using the - // given `el`. `el` can be a CSS selector or an HTML string, a jQuery - // context or an element. Subclasses can override this to utilize an - // alternative DOM manipulation API and are only required to set the - // `this.el` property. - _setElement: function (el) { - this.$el = el instanceof BI.$ ? el : BI.$(el); - this.element = this.$el; - this.el = this.$el[0]; - }, - - // Set callbacks, where `this.events` is a hash of - // - // *{"event selector": "callback"}* - // - // { - // 'mousedown .title': 'edit', - // 'click .button': 'save', - // 'click .open': function(e) { ... } - // } - // - // pairs. Callbacks will be bound to the view, with `this` set properly. - // Uses event delegation for efficiency. - // Omitting the selector binds the event to `this.el`. - delegateEvents: function (events) { - if (!(events || (events = _.result(this, 'events')))) return this; - this.undelegateEvents(); - for (var key in events) { - var method = events[key]; - if (!_.isFunction(method)) method = this[events[key]]; - if (!method) continue; - var match = key.match(delegateEventSplitter); - this.delegate(match[1], match[2], _.bind(method, this)); - } - return this; - }, - - // Add a single event listener to the view's element (or a child element - // using `selector`). This only works for delegate-able events: not `focus`, - // `blur`, and not `change`, `submit`, and `reset` in Internet Explorer. - delegate: function (eventName, selector, listener) { - this.vessel.element.on(eventName + '.delegateEvents' + this.cid, selector, listener); - }, - - // Clears all callbacks previously bound to the view by `delegateEvents`. - // You usually don't need to use this, but may wish to if you have multiple - // BI views attached to the same DOM element. - undelegateEvents: function () { - if (this.vessel) this.vessel.element.off('.delegateEvents' + this.cid); - return this; - }, - - // A finer-grained `undelegateEvents` for removing a single delegated event. - // `selector` and `listener` are both optional. - undelegate: function (eventName, selector, listener) { - this.vessel.element.off(eventName + '.delegateEvents' + this.cid, selector, listener); - }, - - // Produces a DOM element to be assigned to your view. Exposed for - // subclasses using an alternative DOM manipulation API. - _createElement: function (tagName) { - return document.createElement(tagName); - }, - - // Ensure that the V has a DOM element to render into. - // If `this.el` is a string, pass it through `$()`, take the first - // matching element, and re-assign it to `el`. Otherwise, create - // an element from the `id`, `className` and `tagName` properties. - _ensureElement: function () { - var attrs = _.extend({}, _.result(this, 'attributes')); - if (this.baseCls) attrs['class'] = _.result(this, 'baseCls'); - if (!this.element) { - this.setElement(this._createElement(_.result(this, 'tagName'))); - } else { - this.setElement(_.result(this, 'element')); - } - this._setAttributes(attrs); - }, - - // Set attributes from a hash on this view's element. Exposed for - // subclasses using an alternative DOM manipulation API. - _setAttributes: function (attributes) { - this.$el.attr(attributes); - } - - }); - - // BI.sync - // ------------- - - // Override this function to change the manner in which BI persists - // models to the server. You will be passed the type of request, and the - // model in question. By default, makes a RESTful Ajax request - // to the model's `url()`. Some possible customizations could be: - // - // * Use `setTimeout` to batch rapid-fire updates into a single request. - // * Send up the models as XML instead of JSON. - // * Persist models via WebSockets instead of Ajax. - // - // Turn on `BI.emulateHTTP` in order to send `PUT` and `DELETE` requests - // as `POST`, with a `_method` parameter containing the true HTTP method, - // as well as all requests with the body as `application/x-www-form-urlencoded` - // instead of `application/json` with the model in a param named `model`. - // Useful when interfacing with server-side languages like **PHP** that make - // it difficult to read the body of `PUT` requests. - BI.sync = function (method, model, options) { - var type = methodMap[method]; - - // Default options, unless specified. - _.defaults(options || (options = {}), { - emulateHTTP: BI.emulateHTTP, - emulateJSON: BI.emulateJSON - }); - - // Default JSON-request options. - var params = {type: type, dataType: 'json'}; - - // Ensure that we have a URL. - if (!options.url) { - params.url = _.result(model, method + "URL") || _.result(model, 'url'); - if (!params.url) { - return; - } - } - - // Ensure that we have the appropriate request data. - if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) { - params.contentType = 'application/json'; - params.data = _.extend({id: model.id}, model.toJSON(options), options.attrs); - } - - // For older servers, emulate JSON by encoding the request into an HTML-form. - if (options.emulateJSON) { - params.contentType = 'application/x-www-form-urlencoded'; - params.data = options.data ? options.data : params.data; - } - - // For older servers, emulate HTTP by mimicking the HTTP method with `_method` - // And an `X-HTTP-Method-Override` header. - if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) { - params.type = 'POST'; - if (options.emulateJSON) params.data._method = type; - var beforeSend = options.beforeSend; - options.beforeSend = function (xhr) { - xhr.setRequestHeader('X-HTTP-Method-Override', type); - if (beforeSend) return beforeSend.apply(this, arguments); - }; - } - - // Don't process data on a non-GET request. - if (params.type !== 'GET' && !options.emulateJSON) { - params.processData = false; - } - - // Pass along `textStatus` and `errorThrown` from jQuery. - var error = options.error; - options.error = function (xhr, textStatus, errorThrown) { - options.textStatus = textStatus; - options.errorThrown = errorThrown; - if (error) error.apply(this, arguments); - }; - - // Make the request, allowing the user to override any Ajax options. - var xhr = options.xhr = BI.ajax(_.extend(params, options)); - model.trigger('request', xhr, model, options); - return xhr; - }; - - // Map from CRUD to HTTP for our default `BI.sync` implementation. - var methodMap = { - 'create': 'POST', - 'update': 'PUT', - 'patch': 'PATCH', - 'delete': 'DELETE', - 'read': 'GET' - }; - - // Set the default implementation of `BI.ajax` to proxy through to `$`. - // Override this if you'd like to use a different library. - BI.ajax = $.ajax; - - // BI.Router - // --------------- - - // Routers map faux-URLs to actions, and fire events when routes are - // matched. Creating a new one sets its `routes` hash, if not set statically. - var Router = BI.Router = function (options) { - options || (options = {}); - if (options.routes) this.routes = options.routes; - this._bindRoutes(); - this._init.apply(this, arguments); - }; - - // Cached regular expressions for matching named param parts and splatted - // parts of route strings. - var optionalParam = /\((.*?)\)/g; - var namedParam = /(\(\?)?:\w+/g; - var splatParam = /\*\w+/g; - var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g; - - // Set up all inheritable **BI.Router** properties and methods. - _.extend(Router.prototype, Events, { - - // _init is an empty function by default. Override it with your own - // initialization logic. - _init: function () { - }, - - // Manually bind a single named route to a callback. For example: - // - // this.route('search/:query/p:num', 'search', function(query, num) { - // ... - // }); - // - route: function (route, name, callback) { - if (!_.isRegExp(route)) route = this._routeToRegExp(route); - if (_.isFunction(name)) { - callback = name; - name = ''; - } - if (!callback) callback = this[name]; - var router = this; - BI.history.route(route, function (fragment) { - var args = router._extractParameters(route, fragment); - if (router.execute(callback, args, name) !== false) { - router.trigger.apply(router, ['route:' + name].concat(args)); - router.trigger('route', name, args); - BI.history.trigger('route', router, name, args); - } - }); - return this; - }, - - // Execute a route handler with the provided parameters. This is an - // excellent place to do pre-route setup or post-route cleanup. - execute: function (callback, args, name) { - if (callback) callback.apply(this, args); - }, - - // Simple proxy to `BI.history` to save a fragment into the history. - navigate: function (fragment, options) { - BI.history.navigate(fragment, options); - return this; - }, - - // Bind all defined routes to `BI.history`. We have to reverse the - // order of the routes here to support behavior where the most general - // routes can be defined at the bottom of the route map. - _bindRoutes: function () { - if (!this.routes) return; - this.routes = _.result(this, 'routes'); - var route, routes = _.keys(this.routes); - while ((route = routes.pop()) != null) { - this.route(route, this.routes[route]); - } - }, - - // Convert a route string into a regular expression, suitable for matching - // against the current location hash. - _routeToRegExp: function (route) { - route = route.replace(escapeRegExp, '\\$&') - .replace(optionalParam, '(?:$1)?') - .replace(namedParam, function (match, optional) { - return optional ? match : '([^/?]+)'; - }) - .replace(splatParam, '([^?]*?)'); - return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$'); - }, - - // Given a route, and a URL fragment that it matches, return the array of - // extracted decoded parameters. Empty or unmatched parameters will be - // treated as `null` to normalize cross-browser behavior. - _extractParameters: function (route, fragment) { - var params = route.exec(fragment).slice(1); - return _.map(params, function (param, i) { - // Don't decode the search params. - if (i === params.length - 1) return param || null; - return param ? decodeURIComponent(param) : null; - }); - } - - }); - - // BI.History - // ---------------- - - // Handles cross-browser history management, based on either - // [pushState](http://diveintohtml5.info/history.html) and real URLs, or - // [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange) - // and URL fragments. If the browser supports neither (old IE, natch), - // falls back to polling. - var History = BI.History = function () { - this.handlers = []; - _.bindAll(this, 'checkUrl'); - - // Ensure that `History` can be used outside of the browser. - if (typeof window !== 'undefined') { - this.location = window.location; - this.history = window.history; - } - }; - - // Cached regex for stripping a leading hash/slash and trailing space. - var routeStripper = /^[#\/]|\s+$/g; - - // Cached regex for stripping leading and trailing slashes. - var rootStripper = /^\/+|\/+$/g; - - // Cached regex for stripping urls of hash. - var pathStripper = /#.*$/; - - // Has the history handling already been started? - History.started = false; - - // Set up all inheritable **BI.History** properties and methods. - _.extend(History.prototype, Events, { - - // The default interval to poll for hash changes, if necessary, is - // twenty times a second. - interval: 50, - - // Are we at the app root? - atRoot: function () { - var path = this.location.pathname.replace(/[^\/]$/, '$&/'); - return path === this.root && !this.getSearch(); - }, - - // In IE6, the hash fragment and search params are incorrect if the - // fragment contains `?`. - getSearch: function () { - var match = this.location.href.replace(/#.*/, '').match(/\?.+/); - return match ? match[0] : ''; - }, - - // Gets the true hash value. Cannot use location.hash directly due to bug - // in Firefox where location.hash will always be decoded. - getHash: function (window) { - var match = (window || this).location.href.match(/#(.*)$/); - return match ? match[1] : ''; - }, - - // Get the pathname and search params, without the root. - getPath: function () { - var path = decodeURI(this.location.pathname + this.getSearch()); - var root = this.root.slice(0, -1); - if (!path.indexOf(root)) path = path.slice(root.length); - return path.charAt(0) === '/' ? path.slice(1) : path; - }, - - // Get the cross-browser normalized URL fragment from the path or hash. - getFragment: function (fragment) { - if (fragment == null) { - if (this._hasPushState || !this._wantsHashChange) { - fragment = this.getPath(); - } else { - fragment = this.getHash(); - } - } - return fragment.replace(routeStripper, ''); - }, - - // Start the hash change handling, returning `true` if the current URL matches - // an existing route, and `false` otherwise. - start: function (options) { - if (History.started) throw new Error('BI.history has already been started'); - History.started = true; - - // Figure out the initial configuration. Do we need an iframe? - // Is pushState desired ... is it available? - this.options = _.extend({root: '/'}, this.options, options); - this.root = this.options.root; - this._wantsHashChange = this.options.hashChange !== false; - this._hasHashChange = 'onhashchange' in window; - this._wantsPushState = !!this.options.pushState; - this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState); - this.fragment = this.getFragment(); - - // Normalize root to always include a leading and trailing slash. - this.root = ('/' + this.root + '/').replace(rootStripper, '/'); - - // Transition from hashChange to pushState or vice versa if both are - // requested. - if (this._wantsHashChange && this._wantsPushState) { - - // If we've started off with a route from a `pushState`-enabled - // browser, but we're currently in a browser that doesn't support it... - if (!this._hasPushState && !this.atRoot()) { - var root = this.root.slice(0, -1) || '/'; - this.location.replace(root + '#' + this.getPath()); - // Return immediately as browser will do redirect to new url - return true; - - // Or if we've started out with a hash-based route, but we're currently - // in a browser where it could be `pushState`-based instead... - } else if (this._hasPushState && this.atRoot()) { - this.navigate(this.getHash(), {replace: true}); - } - - } - - // Proxy an iframe to handle location events if the browser doesn't - // support the `hashchange` event, HTML5 history, or the user wants - // `hashChange` but not `pushState`. - if (!this._hasHashChange && this._wantsHashChange && (!this._wantsPushState || !this._hasPushState)) { - var iframe = document.createElement('iframe'); - iframe.src = 'javascript:0'; - iframe.style.display = 'none'; - iframe.tabIndex = -1; - var body = document.body; - // Using `appendChild` will throw on IE < 9 if the document is not ready. - this.iframe = body.insertBefore(iframe, body.firstChild).contentWindow; - this.iframe.document.open().close(); - this.iframe.location.hash = '#' + this.fragment; - } - - // Add a cross-platform `addEventListener` shim for older browsers. - var addEventListener = window.addEventListener || function (eventName, listener) { - return attachEvent('on' + eventName, listener); - }; - - // Depending on whether we're using pushState or hashes, and whether - // 'onhashchange' is supported, determine how we check the URL state. - if (this._hasPushState) { - addEventListener('popstate', this.checkUrl, false); - } else if (this._wantsHashChange && this._hasHashChange && !this.iframe) { - addEventListener('hashchange', this.checkUrl, false); - } else if (this._wantsHashChange) { - this._checkUrlInterval = setInterval(this.checkUrl, this.interval); - } - - if (!this.options.silent) return this.loadUrl(); - }, - - // Disable BI.history, perhaps temporarily. Not useful in a real app, - // but possibly useful for unit testing Routers. - stop: function () { - // Add a cross-platform `removeEventListener` shim for older browsers. - var removeEventListener = window.removeEventListener || function (eventName, listener) { - return detachEvent('on' + eventName, listener); - }; - - // Remove window listeners. - if (this._hasPushState) { - removeEventListener('popstate', this.checkUrl, false); - } else if (this._wantsHashChange && this._hasHashChange && !this.iframe) { - removeEventListener('hashchange', this.checkUrl, false); - } - - // Clean up the iframe if necessary. - if (this.iframe) { - document.body.removeChild(this.iframe.frameElement); - this.iframe = null; - } - - // Some environments will throw when clearing an undefined interval. - if (this._checkUrlInterval) clearInterval(this._checkUrlInterval); - History.started = false; - }, - - // Add a route to be tested when the fragment changes. Routes added later - // may override previous routes. - route: function (route, callback) { - this.handlers.unshift({route: route, callback: callback}); - }, - - // Checks the current URL to see if it has changed, and if it has, - // calls `loadUrl`, normalizing across the hidden iframe. - checkUrl: function (e) { - var current = this.getFragment(); - - // If the user pressed the back button, the iframe's hash will have - // changed and we should use that for comparison. - if (current === this.fragment && this.iframe) { - current = this.getHash(this.iframe); - } - - if (current === this.fragment) return false; - if (this.iframe) this.navigate(current); - this.loadUrl(); - }, - - // Attempt to load the current URL fragment. If a route succeeds with a - // match, returns `true`. If no defined routes matches the fragment, - // returns `false`. - loadUrl: function (fragment) { - fragment = this.fragment = this.getFragment(fragment); - return _.any(this.handlers, function (handler) { - if (handler.route.test(fragment)) { - handler.callback(fragment); - return true; - } - }); - }, - - // Save a fragment into the hash history, or replace the URL state if the - // 'replace' option is passed. You are responsible for properly URL-encoding - // the fragment in advance. - // - // The options object can contain `trigger: true` if you wish to have the - // route callback be fired (not usually desirable), or `replace: true`, if - // you wish to modify the current URL without adding an entry to the history. - navigate: function (fragment, options) { - if (!History.started) return false; - if (!options || options === true) options = {trigger: !!options}; - - // Normalize the fragment. - fragment = this.getFragment(fragment || ''); - - // Don't include a trailing slash on the root. - var root = this.root; - if (fragment === '' || fragment.charAt(0) === '?') { - root = root.slice(0, -1) || '/'; - } - var url = root + fragment; - - // Strip the hash and decode for matching. - fragment = decodeURI(fragment.replace(pathStripper, '')); - - if (this.fragment === fragment) return; - this.fragment = fragment; - - // If pushState is available, we use it to set the fragment as a real URL. - if (this._hasPushState) { - this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url); - - // If hash changes haven't been explicitly disabled, update the hash - // fragment to store history. - } else if (this._wantsHashChange) { - this._updateHash(this.location, fragment, options.replace); - if (this.iframe && (fragment !== this.getHash(this.iframe))) { - // Opening and closing the iframe tricks IE7 and earlier to push a - // history entry on hash-tag change. When replace is true, we don't - // want this. - if (!options.replace) this.iframe.document.open().close(); - this._updateHash(this.iframe.location, fragment, options.replace); - } - - // If you've told us that you explicitly don't want fallback hashchange- - // based history, then `navigate` becomes a page refresh. - } else { - return this.location.assign(url); - } - if (options.trigger) return this.loadUrl(fragment); - }, - - // Update the hash location, either replacing the current entry, or adding - // a new one to the browser history. - _updateHash: function (location, fragment, replace) { - if (replace) { - var href = location.href.replace(/(javascript:|#).*$/, ''); - location.replace(href + '#' + fragment); - } else { - // Some browsers require that `hash` contains a leading #. - location.hash = '#' + fragment; - } - } - - }); - - // Create the default BI.history. - BI.history = new History; - - // Helpers - // ------- - - // Helper function to correctly set up the prototype chain, for subclasses. - // Similar to `goog.inherits`, but uses a hash of prototype properties and - // class properties to be extended. - var extend = function (protoProps, staticProps) { - var parent = this; - var child; - - // The constructor function for the new subclass is either defined by you - // (the "constructor" property in your `extend` definition), or defaulted - // by us to simply call the parent's constructor. - if (protoProps && _.has(protoProps, 'constructor')) { - child = protoProps.constructor; - } else { - child = function () { - return parent.apply(this, arguments); - }; - } - - // Add static properties to the constructor function, if supplied. - _.extend(child, parent, staticProps); - - // Set the prototype chain to inherit from `parent`, without calling - // `parent`'s constructor function. - var Surrogate = function () { - this.constructor = child; - }; - Surrogate.prototype = parent.prototype; - child.prototype = new Surrogate; - - // Add prototype properties (instance properties) to the subclass, - // if supplied. - if (protoProps) _.extend(child.prototype, protoProps); - - // Set a convenience property in case the parent's prototype is needed - // later. - child.__super__ = parent.prototype; - - return child; - }; - - // Set up inheritance for the model, collection, router, view and history. - M.extend = Collection.extend = Router.extend = V.extend = History.extend = extend; - - // Throw an error when a URL is needed, and none is supplied. - var urlError = function () { - throw new Error('A "url" property or function must be specified'); - }; - - // Wrap an optional error callback with a fallback error event. - var wrapError = function (model, options) { - var error = options.error; - options.error = function (resp) { - if (error) error(model, resp, options); - model.trigger('error', model, resp, options); - }; - }; - - return BI; - -}));/** - * MVC路由 - * @class BI.WRouter - * @extends BI.Router - * @type {*|void|Object} - */ -BI.WRouter = BI.Router.extend({ - add: function(route, callback){ - this.handlers || (this.handlers=[]); - this.handlers.unshift({route: route, callback: callback}) - }, - - route: function(route, name, callback) { - if (!_.isRegExp(route)) route = this._routeToRegExp(route); - if (_.isFunction(name)) { - callback = name; - name = ''; - } - if (!callback) callback = this[name]; - var self = this; - this.add(route, function(fragment) { - var args = self._extractParameters(route, fragment); - var result = self.execute(callback, args, name) - if (result !== false) { - self.trigger.apply(self, ['route:' + name].concat(args)); - self.trigger('route', name, args); - } - return result; - }); - return this; - }, - - execute: function(callback, args, name) { - if (callback) return callback.apply(this, args); - return name; - }, - - get: function(fragment){ - var result = null; - _.any(this.handlers, function(handler) { - if (handler.route.test(fragment)) { - result = handler.callback(fragment); - return true; - } - }); - return result; - } -});/** - * 基本函数 - * Create By GUY 2014\11\17 - * - */ - -if (!window.BI) { - window.BI = {}; -} -; -!(function ($, undefined) { - var traverse = function (func, context) { - return function (value, key, obj) { - return func.call(context, key, value, obj); - } - }; - var _apply = function (name) { - return function () { - return _[name].apply(_, arguments); - } - }; - var _applyFunc = function (name) { - return function () { - var args = Array.prototype.slice.call(arguments, 0); - args[1] = _.isFunction(args[1]) ? traverse(args[1], args[2]) : args[1]; - return _[name].apply(_, args); - } - }; - - //Utility - _.extend(BI, { - i18nText: function (key) { - var localeText = (BI.i18n && BI.i18n[key]) || ""; - if (!localeText) { - localeText = key; - } - var len = arguments.length; - if (len > 1) { - for (var i = 1; i < len; i++) { - var key = "{R" + i + "}"; - localeText = localeText.replaceAll(key, arguments[i] + ""); - } - } - return localeText; - }, - - assert: function (v, is) { - if (this.isFunction(is)) { - if (!is(v)) { - throw new Error(v + " error"); - } else { - return true; - } - } - if (!this.isArray(is)) { - is = [is]; - } - if (!this.deepContains(is, v)) { - throw new Error(v + " error"); - } - }, - - warn: function (message) { - console.warn(message) - }, - - UUID: function () { - var f = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; - var str = ""; - for (var i = 0; i < 16; i++) { - var r = parseInt(f.length * Math.random(), 10); - str += f[r]; - } - return str; - }, - - isWidget: function (widget) { - return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); - }, - - createWidgets: function (items, options) { - if (!BI.isArray(items)) { - throw new Error("cannot create Widgets") - } - return BI.map(BI.flatten(items), function (i, item) { - return BI.createWidget(item, BI.deepClone(options)); - }); - }, - - createItems: function (data, innerAttr, outerAttr) { - innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr); - outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr); - return BI.map(data, function (i, item) { - if (BI.isArray(item)) { - return BI.createItems(item, innerAttr, outerAttr); - } - if (item instanceof BI.Widget) { - return BI.extend({}, innerAttr.shift(), outerAttr.shift(), { - type: null, - el: item - }); - } - if (innerAttr[0] instanceof BI.Widget) { - outerAttr.shift(); - return BI.extend({}, item, { - el: innerAttr.shift() - }) - } - if (item.el instanceof BI.Widget || (BI.View && item.el instanceof BI.View)) { - innerAttr.shift(); - return BI.extend({}, outerAttr.shift(), {type: null}, item); - } - if (item.el) { - return BI.extend({}, outerAttr.shift(), item, { - el: BI.extend({}, innerAttr.shift(), item.el) - }) - } - return BI.extend({}, outerAttr.shift(), { - el: BI.extend({}, innerAttr.shift(), item) - }) - }) - }, - - //用容器包装items - packageItems: function (items, layouts) { - for (var i = layouts.length - 1; i >= 0; i--) { - items = BI.map(items, function (k, it) { - return BI.extend({}, layouts[i], { - items: [ - BI.extend({}, layouts[i].el, { - el: it - }) - ] - }) - }) - } - return items; - }, - - formatEL: function (obj) { - if (obj && !obj.type && obj.el) { - return obj; - } - return { - el: obj - }; - }, - - //剥开EL - stripEL: function (obj) { - return obj.type && obj || obj.el || obj; - }, - - trans2Element: function (widgets) { - return BI.map(widgets, function (i, wi) { - return wi.element; - }); - } - }); - - //集合相关方法 - _.each(["where", "findWhere", "contains", "invoke", "pluck", "shuffle", "sample", "toArray", "size"], function (name) { - BI[name] = _apply(name) - }); - _.each(["each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min", - "sortBy", "groupBy", "indexBy", "countBy", "partition"], function (name) { - BI[name] = _applyFunc(name) - }); - _.extend(BI, { - clamp: function (value, minValue, maxValue) { - if (value < minValue) { - value = minValue; - } - if (value > maxValue) { - value = maxValue; - } - return value; - }, - //数数 - count: function (from, to, predicate) { - var t; - if (predicate) { - for (t = from; t < to; t++) { - predicate(t); - } - } - return to - from; - }, - - //倒数 - inverse: function (from, to, predicate) { - return BI.count(to, from, predicate); - }, - - firstKey: function (obj) { - var res = undefined; - BI.any(obj, function (key, value) { - res = key; - return true; - }); - return res; - }, - - lastKey: function (obj) { - var res = undefined; - BI.each(obj, function (key, value) { - res = key; - return true; - }); - return res; - }, - - firstObject: function (obj) { - var res = undefined; - BI.any(obj, function (key, value) { - res = value; - return true; - }); - return res; - }, - - lastObject: function (obj) { - var res = undefined; - BI.each(obj, function (key, value) { - res = value; - return true; - }); - return res; - }, - - concat: function (obj1, obj2) { - if (BI.isKey(obj1)) { - return obj1 + "" + obj2; - } - if (BI.isArray(obj1)) { - return obj1.concat(obj2); - } - if (BI.isObject(obj1)) { - return _.extend({}, obj1, obj2); - } - }, - - backEach: function (obj, predicate, context) { - predicate = BI.iteratee(predicate, context); - for (var index = obj.length - 1; index >= 0; index--) { - predicate(index, obj[index], obj); - } - return false; - }, - - backAny: function (obj, predicate, context) { - predicate = BI.iteratee(predicate, context); - for (var index = obj.length - 1; index >= 0; index--) { - if (predicate(index, obj[index], obj)) { - return true; - } - } - return false; - }, - - backEvery: function (obj, predicate, context) { - predicate = BI.iteratee(predicate, context); - for (var index = obj.length - 1; index >= 0; index--) { - if (!predicate(index, obj[index], obj)) { - return false; - } - } - return true; - }, - - backFindKey: function (obj, predicate, context) { - predicate = BI.iteratee(predicate, context); - var keys = _.keys(obj), key; - for (var i = keys.length - 1; i >= 0; i--) { - key = keys[i]; - if (predicate(obj[key], key, obj)) { - return key; - } - } - }, - - backFind: function (obj, predicate, context) { - var key; - if (BI.isArray(obj)) { - key = BI.findLastIndex(obj, predicate, context); - } else { - key = BI.backFindKey(obj, predicate, context); - } - if (key !== void 0 && key !== -1) { - return obj[key]; - } - }, - - remove: function (obj, target, context) { - var isFunction = BI.isFunction(target); - target = isFunction || BI.isArray(target) ? target : [target]; - var i; - if (BI.isArray(obj)) { - for (i = 0; i < obj.length; i++) { - if ((isFunction && target.apply(context, [i, obj[i]]) === true) || (!isFunction && target.contains(obj[i]))) { - obj.splice(i--, 1); - } - } - } else { - BI.each(obj, function (i, v) { - if ((isFunction && target.apply(context, [i, obj[i]]) === true) || (!isFunction && target.contains(obj[i]))) { - delete obj[i]; - } - }); - } - }, - - removeAt: function (obj, index) { - index = BI.isArray(index) ? index : [index]; - var isArray = BI.isArray(obj), i; - for (i = 0; i < index.length; i++) { - if (isArray) { - obj[index[i]] = "$deleteIndex"; - } else { - delete obj[index[i]]; - } - } - if (isArray) { - BI.remove(obj, "$deleteIndex"); - } - }, - - string2Array: function (str) { - return str.split('&-&'); - }, - - array2String: function (array) { - return array.join("&-&"); - }, - - abc2Int: function (str) { - var idx = 0, start = 'A', str = str.toUpperCase(); - for (var i = 0, len = str.length; i < len; ++i) { - idx = str.charAt(i).charCodeAt(0) - start.charCodeAt(0) + 26 * idx + 1; - if (idx > (2147483646 - str.charAt(i).charCodeAt(0) + start.charCodeAt(0)) / 26) { - return 0; - } - } - return idx; - }, - - int2Abc: function (num) { - var DIGITS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; - var idx = num, str = ""; - if (num === 0) { - return ""; - } - while (idx !== 0) { - var t = idx % 26; - if (t === 0) { - t = 26; - } - str = DIGITS[t - 1] + str; - idx = (idx - t) / 26; - } - return str; - } - }); - - //数组相关的方法 - _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range"], function (name) { - BI[name] = _apply(name) - }); - _.each(["findIndex", "findLastIndex"], function (name) { - BI[name] = _applyFunc(name) - }); - _.extend(BI, { - //构建一个长度为length的数组 - makeArray: function (length, value) { - var res = []; - for (var i = 0; i < length; i++) { - if (BI.isNull(value)) { - res.push(i); - } else { - res.push(BI.deepClone(value)); - } - } - return res; - }, - - makeObject: function (array, value) { - var map = {}; - for (var i = 0; i < array.length; i++) { - if (BI.isNull(value)) { - map[array[i]] = array[i]; - } else { - map[array[i]] = BI.deepClone(value); - } - } - return map; - }, - - makeArrayByArray: function (array, value) { - var res = []; - if (!array) { - return res; - } - for (var i = 0, len = array.length; i < len; i++) { - if (BI.isArray(array[i])) { - res.push(arguments.callee(array[i], value)); - } else { - res.push(BI.deepClone(value)); - } - } - return res; - }, - - uniq: function (array, isSorted, iteratee, context) { - if (array == null) { - return []; - } - if (!_.isBoolean(isSorted)) { - context = iteratee; - iteratee = isSorted; - isSorted = false; - } - iteratee && (iteratee = traverse(iteratee, context)); - return _.uniq.call(_, array, isSorted, iteratee, context); - } - }); - - //对象相关方法 - _.each(["keys", "allKeys", "values", "pairs", "invert", "create", "functions", "extend", "extendOwn", - "defaults", "clone", "property", "propertyOf", "matcher", "isEqual", "isMatch", "isEmpty", - "isElement", "isNumber", "isString", "isArray", "isObject", "isArguments", "isFunction", "isFinite", - "isBoolean", "isDate", "isRegExp", "isError", "isNaN", "isUndefined"], function (name) { - BI[name] = _apply(name) - }); - _.each(["mapObject", "findKey", "pick", "omit", "tap"], function (name) { - BI[name] = _applyFunc(name) - }); - _.extend(BI, { - - inherit: function (sb, sp, overrides) { - if (typeof sp == 'object') { - overrides = sp; - sp = sb; - sb = function () { - sp.apply(this, arguments); - }; - } - var F = function () { - }, spp = sp.prototype; - F.prototype = spp; - sb.prototype = new F(); - sb.superclass = spp; - _.extend(sb.prototype, overrides, { - superclass: sp - }); - return sb; - }, - - has: function (obj, keys) { - if (BI.isArray(keys)) { - if (keys.length === 0) { - return false; - } - return BI.every(keys, function (i, key) { - return _.has(obj, key); - }); - } - return _.has.apply(_, arguments); - }, - - //数字和字符串可以作为key - isKey: function (key) { - return BI.isNumber(key) || (BI.isString(key) && key.length > 0); - }, - - //忽略大小写的等于 - isCapitalEqual: function (a, b) { - a = BI.isNull(a) ? a : ("" + a).toLowerCase(); - b = BI.isNull(b) ? b : ("" + b).toLowerCase(); - return BI.isEqual(a, b); - }, - - isWidthOrHeight: function (w) { - if (typeof w == 'number') { - return w >= 0; - } else if (typeof w == 'string') { - return /^\d{1,3}%$/.exec(w) || w == 'auto' || /^\d+px$/.exec(w); - } - }, - - isNotNull: function (obj) { - return !BI.isNull(obj); - }, - - isNull: function (obj) { - return typeof obj === "undefined" || obj === null; - }, - - isPlainObject: function () { - return $.isPlainObject.apply($, arguments); - }, - - isEmptyArray: function (arr) { - return BI.isArray(arr) && BI.isEmpty(arr); - }, - - isNotEmptyArray: function (arr) { - return BI.isArray(arr) && !BI.isEmpty(arr); - }, - - isEmptyObject: function (obj) { - return BI.isEqual(obj, {}); - }, - - isNotEmptyObject: function (obj) { - return BI.isPlainObject(obj) && !BI.isEmptyObject(obj); - }, - - isEmptyString: function (obj) { - return BI.isString(obj) && obj.length === 0; - }, - - isNotEmptyString: function (obj) { - return BI.isString(obj) && !BI.isEmptyString(obj); - }, - - isWindow: function () { - return $.isWindow.apply($, arguments); - } - }); - - //deep方法 - _.extend(BI, { - /** - *完全克隆�?个js对象 - * @param obj - * @returns {*} - */ - deepClone: function (obj) { - if (obj === null || obj === undefined) { - return obj; - } - - var type = Object.prototype.toString.call(obj); - - // Date - if (type === '[object Date]') { - return new Date(obj.getTime()); - } - - var i, clone, key; - - // Array - if (type === '[object Array]') { - i = obj.length; - - clone = []; - - while (i--) { - clone[i] = BI.deepClone(obj[i]); - } - } - // Object - else if (type === '[object Object]' && obj.constructor === Object) { - clone = {}; - - for (var i in obj) { - if (_.has(obj, i)) { - clone[i] = BI.deepClone(obj[i]); - } - } - } - - return clone || obj; - }, - - isDeepMatch: function (object, attrs) { - var keys = BI.keys(attrs), length = keys.length; - if (object == null) { - return !length; - } - var obj = Object(object); - for (var i = 0; i < length; i++) { - var key = keys[i]; - if (!BI.isEqual(attrs[key], obj[key]) || !(key in obj)) { - return false; - } - } - return true; - }, - - deepContains: function (obj, copy) { - if (BI.isObject(copy)) { - return BI.any(obj, function (i, v) { - if (BI.isEqual(v, copy)) { - return true; - } - }) - } - return BI.contains(obj, copy); - }, - - deepIndexOf: function (obj, target) { - for (var i = 0; i < obj.length; i++) { - if (BI.isEqual(target, obj[i])) { - return i; - } - } - return -1; - }, - - deepRemove: function (obj, target) { - var done = false; - var i; - if (BI.isArray(obj)) { - for (i = 0; i < obj.length; i++) { - if (BI.isEqual(target, obj[i])) { - obj.splice(i--, 1); - done = true; - } - } - } else { - BI.each(obj, function (i, v) { - if (BI.isEqual(target, obj[i])) { - delete obj[i]; - done = true; - } - }); - } - return done; - }, - - deepWithout: function (obj, target) { - if (BI.isArray(obj)) { - var result = []; - for (var i = 0; i < obj.length; i++) { - if (!BI.isEqual(target, obj[i])) { - result.push(obj[i]); - } - } - return result; - } else { - var result = {}; - BI.each(obj, function (i, v) { - if (!BI.isEqual(target, obj[i])) { - result[i] = v; - } - }); - return result; - } - }, - - deepUnique: function (array) { - var result = []; - BI.each(array, function (i, item) { - if (!BI.deepContains(result, item)) { - result.push(item); - } - }); - return result; - }, - - //比较两个对象得出不一样的key值 - deepDiff: function (object, other) { - object || (object = {}); - other || (other = {}); - var result = []; - var used = []; - for (var b in object) { - if (this.has(object, b)) { - if (!this.isEqual(object[b], other[b])) { - result.push(b); - } - used.push(b); - } - } - for (var b in other) { - if (this.has(other, b) && !used.contains(b)) { - result.push(b); - } - } - return result; - } - }); - - //通用方法 - _.each(["uniqueId", "result", "chain", "iteratee", "escape", "unescape"], function (name) { - BI[name] = function () { - return _[name].apply(_, arguments); - } - }); - - //事件相关方法 - _.each(["bind", "once", "partial", "debounce", "throttle", "delay", "defer", "wrap"], function (name) { - BI[name] = function () { - return _[name].apply(_, arguments); - } - }); - - _.extend(BI, { - nextTick: (function () { - var callbacks = []; - var pending = false; - var timerFunc; - - function nextTickHandler() { - pending = false; - var copies = callbacks.slice(0); - callbacks = []; - for (var i = 0; i < copies.length; i++) { - copies[i](); - } - } - - if (typeof Promise !== 'undefined') { - var p = Promise.resolve(); - timerFunc = function () { - p.then(nextTickHandler); - } - } else - - /* istanbul ignore if */ - if (typeof MutationObserver !== 'undefined') { - var counter = 1; - var observer = new MutationObserver(nextTickHandler); - var textNode = document.createTextNode(counter + ""); - observer.observe(textNode, { - characterData: true - }); - timerFunc = function () { - counter = (counter + 1) % 2; - textNode.data = counter + ""; - } - } else { - timerFunc = function () { - setTimeout(nextTickHandler, 0) - } - } - return function queueNextTick(cb) { - var _resolve; - var args = [].slice.call(arguments, 1); - callbacks.push(function () { - if (cb) { - cb.apply(null, args); - } - if (_resolve) { - _resolve.apply(null, args); - } - }); - if (!pending) { - pending = true; - timerFunc(); - } - if (!cb && typeof Promise !== 'undefined') { - return new Promise(function (resolve) { - _resolve = resolve - }) - } - } - })() - }); - - //数字相关方法 - _.each(["random"], function (name) { - BI[name] = _apply(name) - }); - _.extend(BI, { - getTime: function () { - if (window.performance && window.performance.now) { - return window.performance.now(); - } else { - if (window.performance && window.performance.webkitNow) { - return window.performance.webkitNow(); - } else { - if (Date.now) { - return Date.now(); - } else { - return new Date().getTime(); - } - } - } - }, - - parseInt: function (number) { - var radix = 10; - if (/^0x/g.test(number)) { - radix = 16; - } - try { - return parseInt(number, radix); - } catch (e) { - throw new Error(number + "parse int error"); - return NaN; - } - }, - - parseSafeInt: function (value) { - var MAX_SAFE_INTEGER = 9007199254740991; - return value - ? this.clamp(this.parseInt(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) - : (value === 0 ? value : 0); - }, - - parseFloat: function (number) { - try { - return parseFloat(number); - } catch (e) { - throw new Error(number + "parse float error"); - return NaN; - } - }, - - isNaturalNumber: function (number) { - if (/^\d+$/.test(number)) { - return true; - } - return false; - }, - - isPositiveInteger: function (number) { - if (/^\+?[1-9][0-9]*$/.test(number)) { - return true; - } - return false; - }, - - isNegativeInteger: function (number) { - if (/^\-[1-9][0-9]*$/.test(number)) { - return true; - } - return false; - }, - - isInteger: function (number) { - if (/^\-?\d+$/.test(number)) { - return true; - } - return false; - }, - - isNumeric: function (number) { - return $.isNumeric(number); - }, - - isFloat: function (number) { - if (/^([+-]?)\\d*\\.\\d+$/.test(number)) { - return true; - } - return false; - }, - - isOdd: function (number) { - if (!BI.isInteger(number)) { - return false; - } - return number & 1 === 1; - }, - - isEven: function (number) { - if (!BI.isInteger(number)) { - return false; - } - return number & 1 === 0; - }, - - sum: function (array, iteratee, context) { - var sum = 0; - BI.each(array, function (i, item) { - if (iteratee) { - sum += Number(iteratee.apply(context, [i, item])); - } else { - sum += Number(item); - } - }); - return sum; - }, - - average: function (array, iteratee, context) { - var sum = BI.sum(array, iteratee, context); - return sum / array.length; - } - }); - - //字符串相关方法 - _.extend(BI, { - trim: function () { - return $.trim.apply($, arguments); - }, - - toUpperCase: function (string) { - return (string + "").toLocaleUpperCase(); - }, - - toLowerCase: function (string) { - return (string + "").toLocaleLowerCase(); - }, - - isEndWithBlank: function (string) { - return /(\s|\u00A0)$/.test(string); - }, - - isLiteral: function (exp) { - var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/ - return literalValueRE.test(exp) - }, - - stripQuotes: function (str) { - var a = str.charCodeAt(0) - var b = str.charCodeAt(str.length - 1) - return a === b && (a === 0x22 || a === 0x27) - ? str.slice(1, -1) - : str - }, - - //background-color => backgroundColor - camelize: function (str) { - return str.replace(/-(.)/g, function (_, character) { - return character.toUpperCase(); - }); - }, - - //backgroundColor => background-color - hyphenate: function (str) { - return str.replace(/([A-Z])/g, '-$1').toLowerCase(); - }, - - isNotEmptyString: function (str) { - return BI.isString(str) && !BI.isEmpty(str); - }, - - isEmptyString: function (str) { - return BI.isString(str) && BI.isEmpty(str); - }, - - /** - * 对字符串进行加密 {@link #decrypt} - * @static - * @param str 原始字符�? - * @param keyt 密钥 - * @returns {String} 加密后的字符�? - */ - encrypt: function (str, keyt) { - if (str == "") { - return ""; - } - str = escape(str); - if (!keyt || keyt == "") { - keyt = "655"; - } - keyt = escape(keyt); - if (keyt == null || keyt.length <= 0) { - alert("Please enter a password with which to encrypt the message."); - return null; - } - var prand = ""; - for (var i = 0; i < keyt.length; i++) { - prand += keyt.charCodeAt(i).toString(); - } - var sPos = Math.floor(prand.length / 5); - var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos * 2) + prand.charAt(sPos * 3) + prand.charAt(sPos * 4) + prand.charAt(sPos * 5)); - - var incr = Math.ceil(keyt.length / 2); - var modu = Math.pow(2, 31) - 1; - if (mult < 2) { - alert("Algorithm cannot find a suitable hash. Please choose a different password. \nPossible considerations are to choose a more complex or longer password."); - return null; - } -// var salt = Math.round(Math.random() * 1000000000) % 100000000; - var salt = 101; - prand += salt; - while (prand.length > 10) { - prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length), 10)).toString(); - } - prand = (mult * prand + incr) % modu; - var enc_chr = ""; - var enc_str = ""; - for (var i = 0; i < str.length; i++) { - enc_chr = parseInt(str.charCodeAt(i) ^ Math.floor((prand / modu) * 255)); - if (enc_chr < 16) { - enc_str += "0" + enc_chr.toString(16); - } else { - enc_str += enc_chr.toString(16); - } - prand = (mult * prand + incr) % modu; - } - salt = salt.toString(16); - while (salt.length < 8) { - salt = "0" + salt; - } - enc_str += salt; - return enc_str; - }, - - /** - * 对加密后的字符串解密 {@link #encrypt} - * @static - * @param str 加密过的字符�? - * @param keyt 密钥 - * @returns {String} 解密后的字符�? - */ - decrypt: function (str, keyt) { - if (str == "") { - return ""; - } - if (!keyt || keyt == "") { - keyt = "655"; - } - keyt = escape(keyt); - if (str == null || str.length < 8) { - return; - } - if (keyt == null || keyt.length <= 0) { - return; - } - var prand = ""; - for (var i = 0; i < keyt.length; i++) { - prand += keyt.charCodeAt(i).toString(); - } - var sPos = Math.floor(prand.length / 5); - var tempmult = prand.charAt(sPos) + prand.charAt(sPos * 2) + prand.charAt(sPos * 3) + prand.charAt(sPos * 4); - if (sPos * 5 < prand.length) { - tempmult += prand.charAt(sPos * 5); - } - var mult = parseInt(tempmult); - var incr = Math.round(keyt.length / 2); - var modu = Math.pow(2, 31) - 1; - var salt = parseInt(str.substring(str.length - 8, str.length), 16); - str = str.substring(0, str.length - 8); - prand += salt; - while (prand.length > 10) { - prand = (parseInt(prand.substring(0, 10), 10) + parseInt(prand.substring(10, prand.length), 10)).toString(); - } - prand = (mult * prand + incr) % modu; - var enc_chr = ""; - var enc_str = ""; - for (var i = 0; i < str.length; i += 2) { - enc_chr = parseInt(parseInt(str.substring(i, i + 2), 16) ^ Math.floor((prand / modu) * 255)); - enc_str += String.fromCharCode(enc_chr); - prand = (mult * prand + incr) % modu; - } - return unescape(enc_str); - } - }); - - //浏览器相关方法 - _.extend(BI, { - isIE: function () { - return /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); - }, - - isIE9Below: function () { - if (!BI.isIE()) { - return false; - } - var version = 0; - var agent = navigator.userAgent.toLowerCase(); - var v1 = agent.match(/(?:msie\s([\w.]+))/); - var v2 = agent.match(/(?:trident.*rv:([\w.]+))/); - if (v1 && v2 && v1[1] && v2[1]) { - version = Math.max(v1[1] * 1, v2[1] * 1); - } else if (v1 && v1[1]) { - version = v1[1] * 1; - } else if (v2 && v2[1]) { - version = v2[1] * 1; - } else { - version = 0; - } - return version < 9; - }, - - isEdge: function () { - return /edge/i.test(navigator.userAgent.toLowerCase()); - }, - - isChrome: function () { - return /chrome/i.test(navigator.userAgent.toLowerCase()); - }, - - isFireFox: function () { - return /firefox/i.test(navigator.userAgent.toLowerCase()); - }, - - isOpera: function () { - return /opera/i.test(navigator.userAgent.toLowerCase()); - }, - - isSafari: function () { - return /safari/i.test(navigator.userAgent.toLowerCase()); - }, - - isKhtml: function () { - return /Konqueror|Safari|KHTML/i.test(navigator.userAgent); - }, - - isMac: function () { - return /macintosh|mac os x/i.test(navigator.userAgent); - }, - - isWindows: function () { - return /windows|win32/i.test(navigator.userAgent); - }, - - isSupportCss3: function (style) { - var prefix = ['webkit', 'Moz', 'ms', 'o'], - i, len, - humpString = [], - htmlStyle = document.documentElement.style, - _toHumb = function (string) { - return string.replace(/-(\w)/g, function ($0, $1) { - return $1.toUpperCase(); - }); - }; - - for (i in prefix) { - humpString.push(_toHumb(prefix[i] + '-' + style)); - } - humpString.push(_toHumb(style)); - - for (i = 0, len = humpString.length; i < len; i++) { - if (humpString[i] in htmlStyle) { - return true; - } - } - return false; - } - }); - //BI请求 - _.extend(BI, { - - ajax: function (option) { - option || (option = {}); - var async = option.async; - option.data = BI.cjkEncodeDO(option.data || {}); - - $.ajax({ - url: option.url, - type: "POST", - data: option.data, - async: async, - error: option.error, - complete: function (res, status) { - if (BI.isFunction(option.complete)) { - option.complete(BI.jsonDecode(res.responseText), status); - } - } - }); - } - }); -})(jQuery);/** - * 客户端观察者,主要处理事件的添加、删除、执行等 - * @class BI.OB - * @abstract - */ -BI.OB = function (config) { - var props = this.props; - if (BI.isFunction(this.props)) { - props = this.props(config); - } - this.options = $.extend(this._defaultConfig(config), props, config); - this._init(); - this._initRef(); -}; -$.extend(BI.OB.prototype, { - props: {}, - init: null, - destroyed: null, - - _defaultConfig: function (config) { - return {}; - }, - - _init: function () { - this._initListeners(); - this.init && this.init(); - }, - - _initListeners: function () { - var self = this; - if (this.options.listeners != null) { - $.each(this.options.listeners, function (i, lis) { - (lis.target ? lis.target : self)[lis.once ? 'once' : 'on'] - (lis.eventName, _.bind(lis.action, self)) - }); - delete this.options.listeners; - } - }, - - //获得一个当前对象的引用 - _initRef: function () { - if (this.options.ref) { - this.options.ref.call(this, this); - } - }, - - _getEvents: function () { - if (!$.isArray(this.events)) { - this.events = [] - } - return this.events; - }, - - /** - * 给观察者绑定一个事件 - * @param {String} eventName 事件的名字 - * @param {Function} fn 事件对应的执行函数 - */ - on: function (eventName, fn) { - eventName = eventName.toLowerCase(); - var fns = this._getEvents()[eventName]; - if (!$.isArray(fns)) { - fns = []; - this._getEvents()[eventName] = fns; - } - fns.push(fn); - }, - - /** - * 给观察者绑定一个只执行一次的事件 - * @param {String} eventName 事件的名字 - * @param {Function} fn 事件对应的执行函数 - */ - once: function (eventName, fn) { - var proxy = function () { - fn.apply(this, arguments); - this.un(eventName, proxy); - }; - this.on(eventName, proxy); - }, - /** - * 解除观察者绑定的指定事件 - * @param {String} eventName 要解除绑定事件的名字 - * @param {Function} fn 事件对应的执行函数,该参数是可选的,没有该参数时,将解除绑定所有同名字的事件 - */ - un: function (eventName, fn) { - eventName = eventName.toLowerCase(); - - /*alex:如果fn是null,就是把eventName上面所有方法都un掉*/ - if (fn == null) { - delete this._getEvents()[eventName]; - } else { - var fns = this._getEvents()[eventName]; - if ($.isArray(fns)) { - var newFns = []; - $.each(fns, function (idx, ifn) { - if (ifn != fn) { - newFns.push(ifn); - } - }) - this._getEvents()[eventName] = newFns; - } - } - }, - /** - * 清除观察者的所有事件绑定 - */ - purgeListeners: function () { - /*alex:清空events*/ - this.events = []; - }, - /** - * 触发绑定过的事件 - * - * @param {String} eventName 要触发的事件的名字 - * @returns {Boolean} 如果事件函数返回false,则返回false并中断其他同名事件的执行,否则执行所有的同名事件并返回true - */ - fireEvent: function () { - var eventName = arguments[0].toLowerCase(); - var fns = this._getEvents()[eventName]; - if (BI.isArray(fns)) { - if (BI.isArguments(arguments[1])) { - for (var i = 0; i < fns.length; i++) { - if (fns[i].apply(this, arguments[1]) === false) { - return false; - } - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - for (var i = 0; i < fns.length; i++) { - if (fns[i].apply(this, args) === false) { - return false; - } - } - } - } - return true; - }, - - destroy: function () { - this.destroyed && this.destroyed(); - this.purgeListeners(); - } -});/** - * Widget超类 - * @class BI.Widget - * @extends BI.OB - * - * @cfg {JSON} options 配置属性 - */ -BI.Widget = BI.inherit(BI.OB, { - _defaultConfig: function () { - return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), { - root: false, - tagName: "div", - attributes: null, - data: null, - - tag: null, - disabled: false, - invisible: false, - invalid: false, - baseCls: "", - extraCls: "", - cls: "" - }) - }, - - //生命周期函数 - beforeCreate: null, - - created: null, - - render: null, - - beforeMounted: null, - - mounted: null, - - update: function () { - }, - - beforeDestroyed: null, - - destroyed: null, - - _init: function () { - BI.Widget.superclass._init.apply(this, arguments); - this.beforeCreate && this.beforeCreate(); - this._initRoot(); - this._initElementWidth(); - this._initElementHeight(); - this._initVisual(); - this._initState(); - this._initElement(); - this._initEffects(); - this.created && this.created(); - }, - - /** - * 初始化根节点 - * @private - */ - _initRoot: function () { - var o = this.options; - this.widgetName = o.widgetName || BI.uniqueId("widget"); - this._isRoot = o.root; - if (BI.isWidget(o.element)) { - if (o.element instanceof BI.Widget) { - this._parent = o.element; - this._parent.addWidget(this.widgetName, this); - } else { - this._isRoot = true; - } - this.element = this.options.element.element; - } else if (o.element) { - // if (o.root !== true) { - // throw new Error("root is a required property"); - // } - this.element = $(o.element); - this._isRoot = true; - } else { - this.element = $(document.createElement(o.tagName)); - } - if (o.baseCls || o.extraCls || o.cls) { - this.element.addClass((o.baseCls || "") + " " + (o.extraCls || "") + " " + (o.cls || "")); - } - if (o.attributes) { - this.element.attr(o.attributes); - } - if (o.data) { - this.element.data(o.data); - } - this._children = {}; - }, - - _initElementWidth: function () { - var o = this.options; - if (BI.isWidthOrHeight(o.width)) { - this.element.css("width", o.width); - } - }, - - _initElementHeight: function () { - var o = this.options; - if (BI.isWidthOrHeight(o.height)) { - this.element.css("height", o.height); - } - }, - - _initVisual: function () { - var o = this.options; - if (o.invisible) { - //用display属性做显示和隐藏,否则jquery会在显示时将display设为block会覆盖掉display:flex属性 - this.element.css("display", "none"); - } - }, - - _initEffects: function () { - var o = this.options; - if (o.disabled || o.invalid) { - if (this.options.disabled) { - this.setEnable(false); - } - if (this.options.invalid) { - this.setValid(false); - } - } - }, - - _initState: function () { - this._isMounted = false; - }, - - _initElement: function () { - var self = this; - var els = this.render && this.render(); - if (BI.isPlainObject(els)) { - els = [els]; - } - if (BI.isArray(els)) { - BI.each(els, function (i, el) { - BI.createWidget(el, { - element: self - }) - }) - } - // if (this._isRoot === true || !(this instanceof BI.Layout)) { - this._mount(); - // } - }, - - _setParent: function (parent) { - this._parent = parent; - }, - - _mount: function () { - var self = this; - var isMounted = this._isMounted; - if (isMounted || !this.isVisible()) { - return; - } - if (this._isRoot === true) { - isMounted = true; - } else if (this._parent && this._parent._isMounted === true) { - isMounted = true; - } - if (!isMounted) { - return; - } - this.beforeMounted && this.beforeMounted(); - this._isMounted = true; - this._mountChildren && this._mountChildren(); - BI.each(this._children, function (i, widget) { - !self.isEnabled() && widget._setEnable(false); - !self.isValid() && widget._setValid(false); - widget._mount && widget._mount(); - }); - this.mounted && this.mounted(); - }, - - _mountChildren: null, - - isMounted: function () { - return this._isMounted; - }, - - setWidth: function (w) { - this.options.width = w; - this._initElementWidth(); - }, - - setHeight: function (h) { - this.options.height = h; - this._initElementHeight(); - }, - - _setEnable: function (enable) { - if (enable === true) { - this.options.disabled = false; - } else if (enable === false) { - this.options.disabled = true; - } - //递归将所有子组件使能 - BI.each(this._children, function (i, child) { - !child._manualSetEnable && child._setEnable && child._setEnable(enable); - }); - }, - - _setValid: function (valid) { - if (valid === true) { - this.options.invalid = false; - } else if (valid === false) { - this.options.invalid = true; - } - //递归将所有子组件使有效 - BI.each(this._children, function (i, child) { - !child._manualSetValid && child._setValid && child._setValid(valid); - }); - }, - - _setVisible: function (visible) { - if (visible === true) { - this.options.invisible = false; - } else if (visible === false) { - this.options.invisible = true; - } - }, - - setEnable: function (enable) { - this._manualSetEnable = true; - this._setEnable(enable); - if (enable === true) { - this.element.removeClass("base-disabled disabled"); - } else if (enable === false) { - this.element.addClass("base-disabled disabled"); - } - }, - - setVisible: function (visible) { - this._setVisible(visible); - if (visible === true) { - //用this.element.show()会把display属性改成block - this.element.css("display", ""); - this._mount(); - } else if (visible === false) { - this.element.css("display", "none"); - } - this.fireEvent(BI.Events.VIEW, visible); - }, - - setValid: function (valid) { - this._manualSetValid = true; - this._setValid(valid); - if (valid === true) { - this.element.removeClass("base-invalid invalid"); - } else if (valid === false) { - this.element.addClass("base-invalid invalid"); - } - }, - - doBehavior: function () { - var args = arguments; - //递归将所有子组件使有效 - BI.each(this._children, function (i, child) { - child.doBehavior && child.doBehavior.apply(child, args); - }); - }, - - getWidth: function () { - return this.options.width; - }, - - getHeight: function () { - return this.options.height; - }, - - isValid: function () { - return !this.options.invalid; - }, - - addWidget: function (name, widget) { - var self = this; - if (name instanceof BI.Widget) { - widget = name; - name = widget.getName(); - } - if (BI.isKey(name)) { - name = name + ""; - } - name = name || widget.getName() || BI.uniqueId("widget"); - if (this._children[name]) { - throw new Error("name has already been existed"); - } - widget._setParent && widget._setParent(this); - widget.on(BI.Events.DESTROY, function () { - BI.remove(self._children, this); - }); - return (this._children[name] = widget); - }, - - getWidgetByName: function (name) { - if (!BI.isKey(name) || name === this.getName()) { - return this; - } - name = name + ""; - var widget = void 0, other = {}; - BI.any(this._children, function (i, wi) { - if (i === name) { - widget = wi; - return true; - } - other[i] = wi; - }); - if (!widget) { - BI.any(other, function (i, wi) { - return (widget = wi.getWidgetByName(i)); - }); - } - return widget; - }, - - removeWidget: function (nameOrWidget) { - var self = this; - if (BI.isWidget(nameOrWidget)) { - BI.remove(this._children, nameOrWidget); - } else { - delete this._children[nameOrWidget]; - } - }, - - hasWidget: function (name) { - return this._children[name] != null; - }, - - getName: function () { - return this.widgetName; - }, - - setTag: function (tag) { - this.options.tag = tag; - }, - - getTag: function () { - return this.options.tag; - }, - - attr: function (key, value) { - if (BI.isNotNull(value)) { - return this.options[key] = value; - } - return this.options[key]; - }, - - getText: function () { - - }, - - setText: function (text) { - - }, - - getValue: function () { - - }, - - setValue: function (value) { - - }, - - isEnabled: function () { - return !this.options.disabled; - }, - - isVisible: function () { - return !this.options.invisible; - }, - - disable: function () { - this.setEnable(false); - }, - - enable: function () { - this.setEnable(true); - }, - - valid: function () { - this.setValid(true); - }, - - invalid: function () { - this.setValid(false); - }, - - invisible: function () { - this.setVisible(false); - }, - - visible: function () { - this.setVisible(true); - }, - - __d: function () { - this.beforeDestroyed && this.beforeDestroyed(); - BI.each(this._children, function (i, widget) { - widget._unMount && widget._unMount(); - }); - this._children = {}; - this._parent = null; - this._isMounted = false; - this.destroyed && this.destroyed(); - }, - - _unMount: function () { - this.__d(); - this.fireEvent(BI.Events.UNMOUNT); - this.purgeListeners(); - }, - - isolate: function () { - if (this._parent) { - this._parent.removeWidget(this); - } - BI.DOM.hang([this]); - }, - - empty: function () { - BI.each(this._children, function (i, widget) { - widget._unMount && widget._unMount(); - }); - this._children = {}; - this.element.empty(); - }, - - _destroy: function () { - this.__d(); - this.element.destroy(); - this.purgeListeners(); - }, - - destroy: function () { - this.__d(); - this.element.destroy(); - this.fireEvent(BI.Events.DESTROY); - this.purgeListeners(); - } -});BI.Model = BI.inherit(BI.M, { - props: {}, - init: null, - destroyed: null, - - _defaultConfig: function () { - return BI.extend({ - "default": "just a default", - "current": void 0 - }, this.props) - }, - - _static: function () { - return {}; - }, - - _init: function () { - BI.Model.superclass._init.apply(this, arguments); - this.on("change:current", function (obj, val) { - BI.isNotNull(val) && this.refresh(val); - }).on("change", function (changed, prev, context, options) { - if (this._start === true || BI.has(changed, "current")) { - return; - } - this.actionStart(); - if (!this.local()) { - !BI.has(this._tmp, BI.keys(changed)) && this.parent && this.parent._change(this); - this._changing_ = true; - this.change(changed, prev, context, options); - this._changing_ = false; - } - }); - - this._tmp = {};//过渡属性 - - this._hass = {}; - this._gets = [];//记录交互行为 - this._start = false; - this._changing_ = false; - - this._read = BI.debounce(BI.bind(this.fetch, this), 30); - this._save = BI.debounce(BI.bind(this.save, this), 30); - this._F = []; - this.init && this.init(); - }, - - toJSON: function () { - var json = BI.Model.superclass.toJSON.apply(this, arguments); - delete json["baseCls"]; - delete json["current"]; - delete json["default"]; - delete json["parent"]; - delete json["rootURL"]; - delete json["id"]; - delete json["tag"]; - BI.each(this._gets, function (i, action) { - delete json[action]; - }); - return json; - }, - - copy: function () { - if (this._start === true || this._changing_ === true) { - this._F.push({f: this.copy, arg: arguments}); - return; - } - this.trigger("copy"); - }, - //子节点的一个类似副本 - similar: function (value, key1, key2, key3) { - return value; - }, - - _map: function (child) { - var self = this; - var map = {}, current = {}; - var mapping = function (key, ch) { - key = key + ""; - if (key === "") { - return; - } - var keys = key.split('.'); - if (!map[keys[0]]) { - map[keys[0]] = self.get(keys[0]); - } - var parent = map, last = void 0; - BI.each(keys, function (i, k) { - last && (parent = parent[last] || (parent[last] = {})); - last = k; - }); - parent[last] = ch.toJSON(); - }; - BI.each(this._childs, function (key, chs) { - if (!BI.isArray(chs)) { - chs = [chs]; - } - BI.each(chs, function (i, ch) { - if (ch === child) { - current[key] = child; - return; - } - //mapping(key, ch); - }) - }); - BI.each(current, function (key, ch) { - mapping(key, ch); - }); - var tmp = {}; - BI.each(this._tmp, function (k) { - if (map[k]) { - tmp[k] = map[k]; - delete map[k]; - } - }); - this.tmp(tmp); - return map; - }, - - _change: function (child) { - this.set(this._map(child)); - return this; - }, - - splice: function (old, key1, key2, key3) { - - }, - - duplicate: function (copy, key1, key2, key3) { - - }, - - change: function (changed, prev) { - - }, - - actionStart: function () { - this._start = true; - return this; - }, - - actionEnd: function () { - var self = this; - this._start = false; - var _gets = this._gets.slice(0), _F = this._F.slice(0); - this._gets = []; - this._hass = {}; - this._F = []; - BI.each(_gets, function (i, action) { - self.unset(action, {silent: true}); - }); - BI.each(_F, function (i, fn) { - fn.f.apply(self, fn.arg); - }); - return this; - }, - - addChild: function (name, child) { - name = name + ""; - var self = this; - this._childs || (this._childs = {}); - if (this._childs[name]) { - if (BI.isArray(this._childs[name])) { - this._childs[name].push(child); - } else { - this._childs[name] = [this._childs[name]].concat(child) - } - } else { - this._childs[name] = child; - } - child && child.on("destroy", function () { - var keys = name.split('.'); - var g = self.get(keys[0]), p, c; - var sset = !!self._tmp[keys[0]] ? "tmp" : "set", unset = "un" + sset; - - BI.each(keys, function (i, k) { - if (i === 0) { - c = g; - return; - } - p = c; - c = c[k]; - }); - self.removeChild(name, child); - var newKeys = BI.clone(keys); - keys.length > 1 ? newKeys.unshift(BI.deepClone(p[keys[keys.length - 1]])) : newKeys.unshift(BI.deepClone(g)); - keys.length > 1 ? (delete p[keys[keys.length - 1]], self[sset](keys[0], g, {silent: true})) : self[unset](name, {silent: true}); - !BI.has(self._tmp, keys[0]) && self.parent && self.parent._change(self); - self.splice.apply(self, newKeys); - self.trigger("splice", newKeys); - BI.remove(self._childs, child); - }).on("copy", function () { - var keys = name.split('.'); - var g = self.get(keys[0]), p, c; - var sset = !!self._tmp[keys[0]] ? "tmp" : "set"; - BI.each(keys, function (i, k) { - if (i === 0) { - c = g; - return; - } - p = c; - c = c[k]; - }); - var copy = BI.UUID(), newKeys = BI.clone(keys); - keys.length > 1 ? newKeys.unshift(BI.deepClone(p[keys[keys.length - 1]])) : newKeys.unshift(BI.deepClone(g)); - var backup = self.similar.apply(self, newKeys); - keys.length > 1 ? (p[copy] = backup, self[sset](keys[0], g, {silent: true})) : self[sset](copy, backup, {silent: true}); - keys.unshift(copy); - !BI.has(self._tmp, keys[0]) && self.parent && self.parent._change(self); - self.duplicate.apply(self, keys); - self.trigger("duplicate", keys); - }); - }, - - removeChild: function (name, child) { - if (BI.isArray(this._childs[name])) { - BI.remove(this._childs[name], child); - if (BI.isEmpty(this._childs[name])) { - delete this._childs[name]; - } - return; - } - delete this._childs[name]; - }, - - has: function (attr, istemp) { - if (istemp === true) { - return _.has(this.tmp, attr); - } - if (this._start === true && this._changing_ === false) { - this._hass[attr] = true; - } - return BI.Model.superclass.has.apply(this, arguments); - }, - - cat: function (attr) { - if (_.has(this._tmp, attr)) { - return this._tmp[attr]; - } - if (this._start === true && this._hass[attr]) { - delete this._hass[attr]; - switch (attr) { - case "default": - break; - case "current": - break; - default : - this._gets.push(attr); - break; - } - } - if (_.has(this.attributes, attr)) { - return this.attributes[attr]; - } - var sta = _.result(this, "_static"); - return BI.isFunction(sta[attr]) ? sta[attr].apply(this, BI.values(arguments).slice(1)) : sta[attr]; - }, - - get: function () { - return BI.deepClone(this.cat.apply(this, arguments)); - }, - - set: function (key, val, options) { - if (this._start === true || this._changing_ === true) { - this._F.push({f: this.set, arg: arguments}); - return this; - } - return BI.Model.superclass.set.apply(this, arguments); - }, - - unset: function (attr, options) { - var self = this; - BI.each(this._childs, function (key, model) { - key = key + ""; - var keys = key.split('.'); - if (_.isEqual(attr, keys[0])) { - delete self._childs[attr]; - if (!BI.isArray(model)) { - model = [model]; - } - BI.each(model, function (i, m) { - m.trigger("unset"); - }); - } - }); - return BI.Model.superclass.unset.apply(this, arguments); - }, - - tmp: function (key, val, options) { - if (this._start === true || this._changing_ === true) { - this._F.push({f: this.tmp, arg: arguments}); - return this; - } - var attr, attrs, unset, changes, silent, changing, changed, prev, current; - if (key == null) return this; - if (typeof key === 'object') { - attrs = key; - options = val; - } else { - (attrs = {})[key] = val; - } - options || (options = {}); - - unset = options.unset; - silent = options.silent; - changes = []; - changing = this._changingTmp; - this._changingTmp = true; - - if (!changing) { - this._previousTmp = _.clone(this._tmp); - this.changedTmp = {}; - } - if (!this._previousTmp) { - this._previousTmp = _.clone(this._tmp); - } - current = this._tmp, prev = this._previousTmp; - - for (attr in attrs) { - val = attrs[attr]; - if (!_.isEqual(current[attr], val)) changes.push(attr); - if (!_.isEqual(prev[attr], val)) { - this.changedTmp[attr] = val; - } else { - delete this.changedTmp[attr]; - } - unset ? delete current[attr] : current[attr] = val; - } - - if (!silent) { - if (changes.length) this._pendingTmp = options; - for (var i = 0, length = changes.length; i < length; i++) { - this.trigger('change:' + changes[i], this, current[changes[i]], options); - } - } - - if (changing) return this; - changed = BI.clone(this.changedTmp); - if (!silent) { - while (this._pendingTmp) { - options = this._pendingTmp; - this._pendingTmp = false; - this.trigger('change', changed, prev, this, options); - } - } - this._pendingTmp = false; - this._changingTmp = false; - if (!silent && changes.length) this.trigger("changed", changed, prev, this, options); - return this; - }, - - untmp: function (attr, options) { - var self = this; - BI.each(this._childs, function (key, model) { - key = key + ""; - var keys = key.split('.'); - if (_.isEqual(attr, keys[0])) { - delete self._childs[attr]; - if (!BI.isArray(model)) { - model = [model]; - } - BI.each(model, function (i, m) { - m.trigger("unset"); - }); - } - }); - return this.tmp(attr, void 0, _.extend({}, options, {unset: true})); - }, - - cancel: function (options) { - var self = this; - var tmp = BI.clone(this._tmp); - this._tmp = {}; - BI.each(tmp, function (k) { - self.untmp(k, options); - }); - }, - - submit: function () { - var tmp = BI.clone(this._tmp); - this._tmp = {}; - this.set(tmp); - return this; - }, - - urlRoot: function () { - return BI.servletURL; - }, - - parse: function (data) { - return data; - }, - - setEditing: function (edit) { - this._editing = edit; - }, - - getEditing: function () { - if (this._start !== true) { - throw new Error("getEditing函数只允许在local中调用"); - } - return this._editing; - }, - - local: function () { - - }, - - load: function (data) { - - }, - - refresh: function () { - - }, - - /** - * 更新整个model - */ - updateURL: function () { - - }, - /** - * 添加一个元素或删除一个元素或修改一个元素 - */ - patchURL: function () { - - }, - /** - * 删除整个model, destroy方法调用 - */ - deleteURL: function () { - - }, - /** - * 读取model - */ - readURL: function () { - - }, - - read: function (options) { - if (this._start == true || this._changing_ === true) { - this._F.push({f: this.read, arg: arguments}); - return; - } - this._read(options); - }, - - update: function (options) { - if (this._start == true || this._changing_ === true) { - this._F.push({f: this.update, arg: arguments}); - return; - } - this._save(null, options); - }, - - patch: function (options) { - if (this._start == true || this._changing_ === true) { - this._F.push({f: this.patch, arg: arguments}); - return; - } - this._save(null, BI.extend({}, options, { - patch: true - })); - }, - - _destroy: function () { - var children = BI.extend({}, this._childs); - this._childs = {}; - BI.each(children, function (i, child) { - child._destroy(); - }); - this.destroyed && this.destroyed(); - }, - - destroy: function () { - this._destroy(); - BI.Model.superclass.destroy.apply(this, arguments); - } -});/** - * @class BI.View - * @extends BI.V - * @type {*|void|Object} - */ -BI.View = BI.inherit(BI.V, { - - //生命周期函数 - beforeCreate: null, - - created: null, - - beforeDestroyed: null, - - destroyed: null, - - _init: function () { - BI.View.superclass._init.apply(this, arguments); - this.beforeCreate && this.beforeCreate(); - var self = this; - this.listenTo(this.model, "change:current", function (obj, val) { - if (BI.isNotNull(val) && val.length > 0) { - this.refresh(val); - } - }).listenTo(this.model, "change", function (changed) { - this.delegateEvents(); - }).listenTo(this.model, "changed", function (changed, prev, context, options) { - if (BI.has(changed, "current") && BI.size(changed) > 1) { - throw new Error("refresh操作不能调用set操作"); - } - var notLocal = !BI.has(changed, "current") && !this.local() && this.notifyParent().notify(); - this.model.actionEnd() && this.actionEnd(); - this.model._changing_ = true; - notLocal && !BI.isEmpty(changed) && this.change(changed, prev, context, options); - this.model._changing_ = false; - this.model.actionEnd() && this.actionEnd(); - }).listenTo(this.model, "destroy", function () { - this._destroy(); - }).listenTo(this.model, "unset", function () { - this._destroy(); - }).listenTo(this.model, "splice", function (arg) { - this.splice.apply(this, arg); - }).listenTo(this.model, "duplicate", function (arg) { - this.duplicate.apply(this, arg); - }); - this._F = []; - var flatten = ["_init", "_defaultConfig", "_vessel", "_render", "getName", "listenEnd", "local", "refresh", "load", "change"]; - flatten = BI.makeObject(flatten, true); - BI.each(this.constructor.caller.caller.prototype, function (key) { - if (flatten[key]) { - return; - } - var f = self[key]; - if (BI.isFunction(f)) { - self[key] = BI.bind(function () { - if (this.model._start === true) { - this._F.push({f: f, arg: arguments}); - return; - } - return f.apply(this, arguments); - }, self); - } - }); - this.created && this.created(); - }, - - change: function (changed, prev) { - - }, - - actionEnd: function () { - var self = this; - var _F = this._F.slice(0); - this._F = []; - BI.each(_F, function (i, f) { - f.f.apply(self, f.arg); - }); - return this; - }, - - delegateEvents: function (events) { - if (!(events || (events = BI.deepClone(_.result(this, 'events'))))) return this; - var delegateEventSplitter = /^(\S+)\s*(.*)$/; - for (var key in events) { - var method = events[key]; - if (!_.isFunction(method)) method = this[events[key]]; - if (!method) continue; - var match = key.match(delegateEventSplitter); - var ev = true; - switch (match[1]) { - case "draggable": - break; - case "droppable": - break; - case "sortable": - break; - case "resizable": - break; - case "hover": - break; - default : - ev = false; - break; - } - - var off = new BI.OffList({ - event: match[1] + '.delegateEvents' + this.cid - }); - - var keys = match[2].split('.'); - var handle = keys[1]; - var bind = ev ? new BI.EventList({ - event: match[1], - handle: handle, - callback: BI.bind(method, this) - }) : new BI.ListenerList({ - event: match[1] + '.delegateEvents' + this.cid, - handle: handle, - callback: BI.bind(method, this), - context: this - }); - - var list = []; - if (this[keys[0]] && (this[keys[0]] instanceof $ || this[keys[0]].element instanceof $)) { - list = [this[keys[0]]] - delete events[key]; - } else if (BI.isArray(this[keys[0]]) || BI.isPlainObject(this[keys[0]])) { - list = this[keys[0]] - delete events[key]; - } - off.populate(list); - bind.populate(list); - } - return BI.View.superclass.delegateEvents.apply(this, [events]); - }, - - _vessel: function () { - this._cardLayouts = {}; - this._cardLayouts[this.getName()] = new BI.CardLayout({ - element: this - }); - var vessel = BI.createWidget(); - this._cardLayouts[this.getName()].addCardByName(this.getName(), vessel); - return vessel; - }, - - render: function (vessel) { - return this; - }, - - /** - * 创建儿子所在容器 - * @param key - * @param vessel - * @param options isLayer:是否是弹出层, defaultShowName:默认显示项 - * @returns {BI.View} - */ - addSubVessel: function (key, vessel, options) { - options || (options = {}); - this._cardLayouts || (this._cardLayouts = {}); - var id = key + this.cid; - options.isLayer && (vessel = BI.Layers.has(id) ? BI.Layers.get(id) : BI.Layers.create(id, vessel)); - if (this._cardLayouts[key]) { - options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName); - return this; - } - this._cardLayouts[key] = BI.createWidget({ - type: "bi.card", - element: vessel, - defaultShowName: options.defaultShowName - }); - return this; - }, - - removeSubVessel: function (key) { - var self = this, id = key + this.cid; - BI.Layers.remove(id); - var cardNames = this._cardLayouts[key] && this._cardLayouts[key].getAllCardNames(); - BI.each(cardNames, function (i, name) { - delete self._cards[name]; - }); - this._cardLayouts[key] && this._cardLayouts[key]._destroy(); - return this; - }, - - createView: function (url, modelData, viewData) { - return BI.Factory.createView(url, this.get(url), modelData, viewData); - }, - - /** - * 跳转到指定的card - * @param cardName - */ - skipTo: function (cardName, layout, modelData, viewData, options) { - if (this.model._start === true || this._changing_ === true) { - this._F.push({f: this.skipTo, arg: arguments}); - return this; - } - var self = this, isValid = BI.isKey(modelData), data = void 0; - BI.isKey(layout) && (layout = layout + ""); - layout = layout || this.getName(); - options || (options = {}); - if (isValid) { - modelData = modelData + "";//避免modelData是数字 - var keys = modelData.split('.'); - BI.each(keys, function (i, k) { - if (i === 0) { - data = self.model.get(k) || {}; - } else { - data = data[k] || {}; - } - }); - data.id = options.id || keys[keys.length - 1]; - } else { - data = modelData; - } - BI.extend(data, options.data); - var action = options.action || new BI.ShowAction(); - var cardLayout = this._cardLayouts[layout]; - if (!cardLayout) { - return this; - } - cardLayout.setVisible(true); - if (BI.isKey(cardName) && !cardLayout.isCardExisted(cardName)) { - var view = this.createView(this.rootURL + "/" + cardName, data, viewData); - isValid && this.model.addChild(modelData, view.model); - view.listenTo(view.model, "destroy", function () { - delete self._cards[cardName]; - cardLayout.deleteCardByName(cardName); - if (cardLayout.isAllCardHide()) { - cardLayout.setVisible(false); - BI.Layers.hide(layout + self.cid); - } - }).listenTo(view.model, "unset", function () { - delete self._cards[cardName]; - cardLayout.deleteCardByName(cardName); - }); - cardLayout.addCardByName(cardName, view); - this._cards || (this._cards = {}); - this._cards[cardName] = view; - data = {}; - this.on("end:" + view.cid, function () { - var isNew = false, t, keys; - if (isValid) { - keys = modelData.split('.'); - BI.each(keys, function (i, k) { - if (i === 0) { - t = self.model.get(k) || (isNew = true); - } else { - t = t[k] || (isNew = true); - } - }); - } - if (isNew) { - delete self._cards[cardName]; - self.model.removeChild(modelData, view.model); - cardLayout.deleteCardByName(cardName); - view._destroy(); - cardLayout.setVisible(false); - } - action.actionBack(view, null, function () { - if (cardLayout.isAllCardHide()) { - cardLayout.setVisible(false); - BI.Layers.hide(layout + self.cid); - } - !isNew && (self.listenEnd.apply(self, isValid ? keys : [modelData]) !== false) && self.populate(); - }) - }).on("change:" + view.cid, _.bind(this.notifyParent, this)); - } - BI.isKey(cardName) && BI.Layers.show(layout + this.cid); - cardLayout.showCardByName(cardName, action, function () { - BI.isKey(cardName) && self._cards[cardName].populate(data, options); - }); - !BI.isKey(cardName) && BI.Layers.hide(layout + this.cid); - return this._cards[cardName]; - }, - - listenEnd: function (key1, key2, key3) { - return this; - }, - - /** - * 告诉父亲我的操作结束了,后面的事情任由父亲处置 - * @param force 强制下次再次进入该节点时不进行刷新操作, 默认执行刷新 - * @returns {BI.View} - */ - notifyParentEnd: function (force) { - this.parent && this.parent.trigger("end:" + this.cid); - this.trigger("end"); - !force && this.notify(); - return this; - }, - - /** - * 通知父亲我的数据发生了变化 - */ - notifyParent: function () { - this.parent && this.parent.notify().trigger("change:" + this.cid); - return this; - }, - - /** - * 告诉Model数据改变了 - */ - notify: function () { - this.model.unset("current", {silent: true}); - return this; - }, - - getName: function () { - return "VIEW" - }, - - /** - * 全局刷新 - * @param current - */ - refresh: function (current) { - }, - /** - * 局部刷新 - */ - local: function () { - return false; - }, - - load: function (data) { - - }, - - readData: function (force, options) { - options || (options = {}); - var self = this; - var args = [].slice.call(arguments, 2); - if (!force && this._readed === true) {//只从后台获取一次数据 - callback(this.model.toJSON()); - return; - } - //采用静默方式读数据,该数据变化不引起data的change事件触发 - var success = options.success; - this.model.read(BI.extend({ - silent: true - }, options, { - success: function (data, model) { - callback(data); - !force && (self._readed = true); - self.delegateEvents(); - success && success(data, model); - } - })); - function callback(data) { - self.model.load(data); - self.load(data); - BI.each(args, function (i, arg) { - if (BI.isFunction(arg)) { - arg.apply(self, [data]); - } - }) - } - }, - - //处理model的通用方法 - cat: function () { - return this.model.cat.apply(this.model, arguments); - }, - - get: function () { - return this.model.get.apply(this.model, arguments); - }, - - set: function () { - return this.model.set.apply(this.model, arguments); - }, - - has: function () { - return this.model.has.apply(this.model, arguments); - }, - - getEditing: function () { - return this.model.getEditing(); - }, - - reading: function (options) { - var self = this; - var name = BI.UUID(); - this.model.read(BI.extend({}, options, { - beforeSend: function () { - var loading = BI.createWidget({ - type: 'bi.vertical', - items: [{ - type: "bi.layout", - height: 30, - cls: "loading-background" - }], - element: BI.Maskers.make(name, self) - }); - loading.setVisible(true); - }, - complete: function (data) { - options.complete && options.complete(data); - BI.Maskers.remove(name); - } - })); - }, - - updating: function (options) { - var self = this; - var name = BI.UUID(); - this.model.update(BI.extend({}, options, { - noset: true, - beforeSend: function () { - var loading = BI.createWidget({ - type: 'bi.vertical', - items: [{ - type: "bi.layout", - height: 30, - cls: "loading-background" - }], - element: BI.Maskers.make(name, self) - }); - loading.setVisible(true); - }, - complete: function (data) { - options.complete && options.complete(data); - BI.Maskers.remove(name); - } - })); - }, - - patching: function (options) { - var self = this; - var name = BI.UUID(); - this.model.patch(BI.extend({}, options, { - noset: true, - beforeSend: function () { - var loading = BI.createWidget({ - type: 'bi.vertical', - items: [{ - type: "bi.layout", - height: 30, - cls: "loading-background" - }], - element: BI.Maskers.make(name, self) - }); - loading.setVisible(true); - }, - complete: function (data) { - options.complete && options.complete(data); - BI.Maskers.remove(name); - } - })); - }, - - populate: function (modelData, options) { - var self = this; - options || (options = {}); - if (options.force === true) { - this.notify(); - } - if (this._cardLayouts && this._cardLayouts[this.getName()]) { - this._cardLayouts[this.getName()].showCardByName(this.getName()); - } - //BI.each(this._cardLayouts, function (key, layout) { - // layout.showCardByName(layout.getDefaultShowName() || self.getName()); - //}); - //BI.each(this._cards, function (i, card) { - // card.notify && card.notify(); - //}); - if (this._F.length > 0) { - throw new Error("流程错误"); - } - if (options.force === true) { - this.model.set(modelData, options).set({current: this.model.get("default")}); - return; - } - if (options.force === false) { - this.model.set(modelData); - return; - } - var filter = BI.clone(modelData || {}); - delete filter.id; - var contains = BI.has(this.model.toJSON(), _.keys(filter)); - var match = BI.isEmpty(filter) || (contains && this.model.matches(modelData)); - if (match === true) { - this.model.set({current: this.model.get("default")}); - } else if (contains === false) { - this.model.set(modelData); - } else { - this.model.set(modelData, options).set({current: this.model.get("default")}); - } - }, - - //删除子节点触发 - splice: function (old, key1, key2, key3) { - - }, - - //复制子节点触发 - duplicate: function (copy, key1, key2, key3) { - - }, - - _unMount: function () { - this.beforeDestroyed && this.beforeDestroyed(); - BI.each(this._cardLayouts, function (name, card) { - card && card._unMount(); - }); - delete this._cardLayouts; - delete this._cards; - this.destroyed && this.destroyed(); - this.trigger(BI.Events.UNMOUNT); - this.off(); - }, - - _destroy: function () { - var self = this; - BI.each(this._cardLayouts, function (name, card) { - card && card._unMount(); - BI.Layers.remove(name + self.cid); - }); - delete this._cardLayouts; - delete this._cards; - this.destroyed && this.destroyed(); - this.remove(); - this.trigger(BI.Events.DESTROY); - this.off(); - } -});(function () { - - var kv = {}; // alex:键(编辑器简称,如text)值(也是一个字符串,如FR.TextEditor)对 - BI.shortcut = function (xtype, cls) { - if (kv[xtype] != null) { - throw ("shortcut:[" + xtype + "] has been registed"); - } - kv[xtype] = cls; - _.extend(cls.prototype, { - xtype: xtype - }) - }; - - // 根据配置属性生成widget - var createWidget = function (config) { - if (config['classType']) { - return new (new Function('return ' + config['classType'] + ';')())(config); - } - - if (!config.type) { - - } - var xtype = config.type.toLowerCase(); - var cls = kv[xtype]; - return new cls(config); - }; - - BI.createWidget = function (item, options) { - var el; - options || (options = {}); - if (BI.isEmpty(item) && BI.isEmpty(options)) { - return BI.createWidget({ - type: "bi.layout" - }); - } - if (BI.isWidget(item)) { - return item; - } - if (item && (item.type || options.type)) { - el = BI.extend({}, options, item); - return BI.Plugin.getObject(el.type, createWidget(BI.Plugin.getWidget(el.type, el))); - } - if (item && item.el && (item.el.type || options.type)) { - el = BI.extend({}, options, item.el); - return BI.Plugin.getObject(el.type, createWidget(BI.Plugin.getWidget(el.type, el))); - } - if (item && BI.isWidget(item.el)) { - return item.el; - } - throw new Error('无法根据item创建组件'); - } - -})();(function (window, undefined) { - function aspect(type) { - return function (target, methodName, advice) { - var exist = target[methodName], - dispatcher; - - if (!exist || exist.target != target) { - dispatcher = target[methodName] = function () { - // before methods - var beforeArr = dispatcher.before; - var args = arguments, next; - for (var l = beforeArr.length; l--;) { - next = beforeArr[l].advice.apply(this, args); - if (next === false) { - return false; - } - args = next || args; - } - // target method - var rs = dispatcher.method.apply(this, args); - // after methods - var afterArr = dispatcher.after; - for (var i = 0, ii = afterArr.length; i < ii; i++) { - next = afterArr[i].advice.call(this, rs, args); - if (rs === false) { - return false; - } - args = next || args; - } - return rs; - }; - - dispatcher.before = []; - dispatcher.after = []; - - if (exist) { - dispatcher.method = exist; - } - dispatcher.target = target; - } - - var aspectArr = (dispatcher || exist)[type]; - var obj = { - advice: advice, - _index: aspectArr.length, - remove: function () { - aspectArr.splice(this._index, 1); - } - }; - aspectArr.push(obj); - - return obj; - }; - } - - BI.aspect = { - before: aspect("before"), - after: aspect("after") - }; - - return BI.aspect; - -})(window);; -!(function () { - - var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - - - // private method for UTF-8 encoding - var _utf8_encode = function (string) { - string = string.replace(/\r\n/g, "\n"); - var utftext = ""; - - for (var n = 0; n < string.length; n++) { - - var c = string.charCodeAt(n); - - if (c < 128) { - utftext += String.fromCharCode(c); - } else if ((c > 127) && (c < 2048)) { - utftext += String.fromCharCode((c >> 6) | 192); - utftext += String.fromCharCode((c & 63) | 128); - } else { - utftext += String.fromCharCode((c >> 12) | 224); - utftext += String.fromCharCode(((c >> 6) & 63) | 128); - utftext += String.fromCharCode((c & 63) | 128); - } - - } - - return utftext; - }; - - // private method for UTF-8 decoding - var _utf8_decode = function (utftext) { - var string = ""; - var i = 0; - var c = 0, c3 = 0, c2 = 0; - - while (i < utftext.length) { - - c = utftext.charCodeAt(i); - - if (c < 128) { - string += String.fromCharCode(c); - i++; - } else if ((c > 191) && (c < 224)) { - c2 = utftext.charCodeAt(i + 1); - string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = utftext.charCodeAt(i + 1); - c3 = utftext.charCodeAt(i + 2); - string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - - } - return string; - }; - - _.extend(BI, { - - encode: function (input) { - var output = ""; - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; - var i = 0; - - input = _utf8_encode(input); - - while (i < input.length) { - - chr1 = input.charCodeAt(i++); - chr2 = input.charCodeAt(i++); - chr3 = input.charCodeAt(i++); - - enc1 = chr1 >> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); - enc4 = chr3 & 63; - - if (isNaN(chr2)) { - enc3 = enc4 = 64; - } else if (isNaN(chr3)) { - enc4 = 64; - } - - output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4); - - } - - return output; - }, - - // public method for decoding - decode: function (input) { - var output = ""; - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0; - - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - - while (i < input.length) { - - enc1 = _keyStr.indexOf(input.charAt(i++)); - enc2 = _keyStr.indexOf(input.charAt(i++)); - enc3 = _keyStr.indexOf(input.charAt(i++)); - enc4 = _keyStr.indexOf(input.charAt(i++)); - - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - - output = output + String.fromCharCode(chr1); - - if (enc3 != 64) { - output = output + String.fromCharCode(chr2); - } - if (enc4 != 64) { - output = output + String.fromCharCode(chr3); - } - - } - - output = _utf8_decode(output); - - return output; - - } - }) -})();BI.CellSizeAndPositionManager = function (cellCount, cellSizeGetter, estimatedCellSize) { - this._cellSizeGetter = cellSizeGetter; - this._cellCount = cellCount; - this._estimatedCellSize = estimatedCellSize; - this._cellSizeAndPositionData = {}; - this._lastMeasuredIndex = -1; -}; - -BI.CellSizeAndPositionManager.prototype = { - constructor: BI.CellSizeAndPositionManager, - configure: function (cellCount, estimatedCellSize) { - this._cellCount = cellCount; - this._estimatedCellSize = estimatedCellSize; - }, - - getCellCount: function () { - return this._cellCount; - }, - - getEstimatedCellSize: function () { - return this._estimatedCellSize; - }, - - getLastMeasuredIndex: function () { - return this._lastMeasuredIndex; - }, - - getSizeAndPositionOfCell: function (index) { - if (index < 0 || index >= this._cellCount) { - return; - } - if (index > this._lastMeasuredIndex) { - var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(); - var offset = lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size; - - for (var i = this._lastMeasuredIndex + 1; i <= index; i++) { - var size = this._cellSizeGetter(i); - - if (size == null || isNaN(size)) { - continue; - } - - this._cellSizeAndPositionData[i] = { - offset: offset, - size: size - }; - - offset += size; - } - - this._lastMeasuredIndex = index; - } - return this._cellSizeAndPositionData[index]; - }, - - getSizeAndPositionOfLastMeasuredCell: function () { - return this._lastMeasuredIndex >= 0 - ? this._cellSizeAndPositionData[this._lastMeasuredIndex] - : { - offset: 0, - size: 0 - } - }, - - getTotalSize: function () { - var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(); - return lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size + (this._cellCount - this._lastMeasuredIndex - 1) * this._estimatedCellSize - }, - - getUpdatedOffsetForIndex: function (align, containerSize, currentOffset, targetIndex) { - var datum = this.getSizeAndPositionOfCell(targetIndex); - var maxOffset = datum.offset; - var minOffset = maxOffset - containerSize + datum.size; - - var idealOffset; - - switch (align) { - case 'start': - idealOffset = maxOffset; - break; - case 'end': - idealOffset = minOffset; - break; - case 'center': - idealOffset = maxOffset - ((containerSize - datum.size) / 2); - break; - default: - idealOffset = Math.max(minOffset, Math.min(maxOffset, currentOffset)); - break; - } - - var totalSize = this.getTotalSize(); - - return Math.max(0, Math.min(totalSize - containerSize, idealOffset)); - }, - - getVisibleCellRange: function (containerSize, offset) { - var totalSize = this.getTotalSize(); - - if (totalSize === 0) { - return {} - } - - var maxOffset = offset + containerSize; - var start = this._findNearestCell(offset); - - var datum = this.getSizeAndPositionOfCell(start); - offset = datum.offset + datum.size; - - var stop = start; - - while (offset < maxOffset && stop < this._cellCount - 1) { - stop++; - offset += this.getSizeAndPositionOfCell(stop).size; - } - - return { - start: start, - stop: stop - } - }, - - resetCell: function (index) { - this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, index - 1) - }, - - _binarySearch: function (high, low, offset) { - var middle; - var currentOffset; - - while (low <= high) { - middle = low + Math.floor((high - low) / 2); - currentOffset = this.getSizeAndPositionOfCell(middle).offset; - - if (currentOffset === offset) { - return middle; - } else if (currentOffset < offset) { - low = middle + 1; - } else if (currentOffset > offset) { - high = middle - 1; - } - } - - if (low > 0) { - return low - 1; - } - }, - - _exponentialSearch: function (index, offset) { - var interval = 1; - - while (index < this._cellCount && this.getSizeAndPositionOfCell(index).offset < offset) { - index += interval; - interval *= 2; - } - - return this._binarySearch(Math.min(index, this._cellCount - 1), Math.floor(index / 2), offset); - }, - - _findNearestCell: function (offset) { - if (isNaN(offset)) { - return; - } - - offset = Math.max(0, offset); - - var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(); - var lastMeasuredIndex = Math.max(0, this._lastMeasuredIndex); - - if (lastMeasuredCellSizeAndPosition.offset >= offset) { - return this._binarySearch(lastMeasuredIndex, 0, offset); - } else { - return this._exponentialSearch(lastMeasuredIndex, offset); - } - } -}; - -BI.ScalingCellSizeAndPositionManager = function (cellCount, cellSizeGetter, estimatedCellSize, maxScrollSize) { - this._cellSizeAndPositionManager = new BI.CellSizeAndPositionManager(cellCount, cellSizeGetter, estimatedCellSize); - this._maxScrollSize = maxScrollSize || 10000000 -}; - -BI.ScalingCellSizeAndPositionManager.prototype = { - constructor: BI.ScalingCellSizeAndPositionManager, - - configure: function () { - this._cellSizeAndPositionManager.configure.apply(this._cellSizeAndPositionManager, arguments); - }, - - getCellCount: function () { - return this._cellSizeAndPositionManager.getCellCount() - }, - - getEstimatedCellSize: function () { - return this._cellSizeAndPositionManager.getEstimatedCellSize() - }, - - getLastMeasuredIndex: function () { - return this._cellSizeAndPositionManager.getLastMeasuredIndex() - }, - - getOffsetAdjustment: function (containerSize, offset) { - var totalSize = this._cellSizeAndPositionManager.getTotalSize(); - var safeTotalSize = this.getTotalSize(); - var offsetPercentage = this._getOffsetPercentage(containerSize, offset, safeTotalSize); - - return Math.round(offsetPercentage * (safeTotalSize - totalSize)); - }, - - getSizeAndPositionOfCell: function (index) { - return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(index); - }, - - getSizeAndPositionOfLastMeasuredCell: function () { - return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell(); - }, - - getTotalSize: function () { - return Math.min(this._maxScrollSize, this._cellSizeAndPositionManager.getTotalSize()); - }, - - getUpdatedOffsetForIndex: function (align, containerSize, currentOffset, targetIndex) { - currentOffset = this._safeOffsetToOffset(containerSize, currentOffset); - - var offset = this._cellSizeAndPositionManager.getUpdatedOffsetForIndex(align, containerSize, currentOffset, targetIndex); - - return this._offsetToSafeOffset(containerSize, offset); - }, - - getVisibleCellRange: function (containerSize, offset) { - offset = this._safeOffsetToOffset(containerSize, offset); - - return this._cellSizeAndPositionManager.getVisibleCellRange(containerSize, offset); - }, - - resetCell: function (index) { - this._cellSizeAndPositionManager.resetCell(index) - }, - - _getOffsetPercentage: function (containerSize, offset, totalSize) { - return totalSize <= containerSize - ? 0 - : offset / (totalSize - containerSize) - }, - - _offsetToSafeOffset: function (containerSize, offset) { - var totalSize = this._cellSizeAndPositionManager.getTotalSize(); - var safeTotalSize = this.getTotalSize(); - - if (totalSize === safeTotalSize) { - return offset; - } else { - var offsetPercentage = this._getOffsetPercentage(containerSize, offset, totalSize); - - return Math.round(offsetPercentage * (safeTotalSize - containerSize)); - } - }, - - _safeOffsetToOffset: function (containerSize, offset) { - var totalSize = this._cellSizeAndPositionManager.getTotalSize(); - var safeTotalSize = this.getTotalSize(); - - if (totalSize === safeTotalSize) { - return offset; - } else { - var offsetPercentage = this._getOffsetPercentage(containerSize, offset, safeTotalSize); - - return Math.round(offsetPercentage * (totalSize - containerSize)); - } - } -};/** - * 汉字拼音索引 - */ -; -!(function () { - var _ChineseFirstPY = "YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSCDQLDYLYBSSJGYZZJJFKCCLZDHWDWZJLJPFYYNWJJTMYHZWZHFLZPPQHGSCYYYNJQYXXGJHHSDSJNKKTMOMLCRXYPSNQSECCQZGGLLYJLMYZZSECYKYYHQWJSSGGYXYZYJWWKDJHYCHMYXJTLXJYQBYXZLDWRDJRWYSRLDZJPCBZJJBR" - + "CFTLECZSTZFXXZHTRQHYBDLYCZSSYMMRFMYQZPWWJJYFCRWFDFZQPYDDWYXKYJAWJFFXYPSFTZYHHYZYSWCJYXSCLCXXWZZXNBGNNXBXLZSZSBSGPYSYZDHMDZBQBZCWDZZYYTZHBTSYYBZGNTNXQYWQSKBPHHLXGYBFMJEBJHHGQTJCYSXSTKZHLYCKGLYSMZXYALMELDCCXGZ" - + "YRJXSDLTYZCQKCNNJWHJTZZCQLJSTSTBNXBTYXCEQXGKWJYFLZQLYHYXSPSFXLMPBYSXXXYDJCZYLLLSJXFHJXPJBTFFYABYXBHZZBJYZLWLCZGGBTSSMDTJZXPTHYQTGLJSCQFZKJZJQNLZWLSLHDZBWJNCJZYZSQQYCQYRZCJJWYBRTWPYFTWEXCSKDZCTBZHYZZYYJXZCFFZ" - + "ZMJYXXSDZZOTTBZLQWFCKSZSXFYRLNYJMBDTHJXSQQCCSBXYYTSYFBXDZTGBCNSLCYZZPSAZYZZSCJCSHZQYDXLBPJLLMQXTYDZXSQJTZPXLCGLQTZWJBHCTSYJSFXYEJJTLBGXSXJMYJQQPFZASYJNTYDJXKJCDJSZCBARTDCLYJQMWNQNCLLLKBYBZZSYHQQLTWLCCXTXLLZN" - + "TYLNEWYZYXCZXXGRKRMTCNDNJTSYYSSDQDGHSDBJGHRWRQLYBGLXHLGTGXBQJDZPYJSJYJCTMRNYMGRZJCZGJMZMGXMPRYXKJNYMSGMZJYMKMFXMLDTGFBHCJHKYLPFMDXLQJJSMTQGZSJLQDLDGJYCALCMZCSDJLLNXDJFFFFJCZFMZFFPFKHKGDPSXKTACJDHHZDDCRRCFQYJ" - + "KQCCWJDXHWJLYLLZGCFCQDSMLZPBJJPLSBCJGGDCKKDEZSQCCKJGCGKDJTJDLZYCXKLQSCGJCLTFPCQCZGWPJDQYZJJBYJHSJDZWGFSJGZKQCCZLLPSPKJGQJHZZLJPLGJGJJTHJJYJZCZMLZLYQBGJWMLJKXZDZNJQSYZMLJLLJKYWXMKJLHSKJGBMCLYYMKXJQLBMLLKMDXXK" - + "WYXYSLMLPSJQQJQXYXFJTJDXMXXLLCXQBSYJBGWYMBGGBCYXPJYGPEPFGDJGBHBNSQJYZJKJKHXQFGQZKFHYGKHDKLLSDJQXPQYKYBNQSXQNSZSWHBSXWHXWBZZXDMNSJBSBKBBZKLYLXGWXDRWYQZMYWSJQLCJXXJXKJEQXSCYETLZHLYYYSDZPAQYZCMTLSHTZCFYZYXYLJSD" - + "CJQAGYSLCQLYYYSHMRQQKLDXZSCSSSYDYCJYSFSJBFRSSZQSBXXPXJYSDRCKGJLGDKZJZBDKTCSYQPYHSTCLDJDHMXMCGXYZHJDDTMHLTXZXYLYMOHYJCLTYFBQQXPFBDFHHTKSQHZYYWCNXXCRWHOWGYJLEGWDQCWGFJYCSNTMYTOLBYGWQWESJPWNMLRYDZSZTXYQPZGCWXHN" - + "GPYXSHMYQJXZTDPPBFYHZHTJYFDZWKGKZBLDNTSXHQEEGZZYLZMMZYJZGXZXKHKSTXNXXWYLYAPSTHXDWHZYMPXAGKYDXBHNHXKDPJNMYHYLPMGOCSLNZHKXXLPZZLBMLSFBHHGYGYYGGBHSCYAQTYWLXTZQCEZYDQDQMMHTKLLSZHLSJZWFYHQSWSCWLQAZYNYTLSXTHAZNKZZ" - + "SZZLAXXZWWCTGQQTDDYZTCCHYQZFLXPSLZYGPZSZNGLNDQTBDLXGTCTAJDKYWNSYZLJHHZZCWNYYZYWMHYCHHYXHJKZWSXHZYXLYSKQYSPSLYZWMYPPKBYGLKZHTYXAXQSYSHXASMCHKDSCRSWJPWXSGZJLWWSCHSJHSQNHCSEGNDAQTBAALZZMSSTDQJCJKTSCJAXPLGGXHHGX" - + "XZCXPDMMHLDGTYBYSJMXHMRCPXXJZCKZXSHMLQXXTTHXWZFKHCCZDYTCJYXQHLXDHYPJQXYLSYYDZOZJNYXQEZYSQYAYXWYPDGXDDXSPPYZNDLTWRHXYDXZZJHTCXMCZLHPYYYYMHZLLHNXMYLLLMDCPPXHMXDKYCYRDLTXJCHHZZXZLCCLYLNZSHZJZZLNNRLWHYQSNJHXYNTT" - + "TKYJPYCHHYEGKCTTWLGQRLGGTGTYGYHPYHYLQYQGCWYQKPYYYTTTTLHYHLLTYTTSPLKYZXGZWGPYDSSZZDQXSKCQNMJJZZBXYQMJRTFFBTKHZKBXLJJKDXJTLBWFZPPTKQTZTGPDGNTPJYFALQMKGXBDCLZFHZCLLLLADPMXDJHLCCLGYHDZFGYDDGCYYFGYDXKSSEBDHYKDKDK" - + "HNAXXYBPBYYHXZQGAFFQYJXDMLJCSQZLLPCHBSXGJYNDYBYQSPZWJLZKSDDTACTBXZDYZYPJZQSJNKKTKNJDJGYYPGTLFYQKASDNTCYHBLWDZHBBYDWJRYGKZYHEYYFJMSDTYFZJJHGCXPLXHLDWXXJKYTCYKSSSMTWCTTQZLPBSZDZWZXGZAGYKTYWXLHLSPBCLLOQMMZSSLCM" - + "BJCSZZKYDCZJGQQDSMCYTZQQLWZQZXSSFPTTFQMDDZDSHDTDWFHTDYZJYQJQKYPBDJYYXTLJHDRQXXXHAYDHRJLKLYTWHLLRLLRCXYLBWSRSZZSYMKZZHHKYHXKSMDSYDYCJPBZBSQLFCXXXNXKXWYWSDZYQOGGQMMYHCDZTTFJYYBGSTTTYBYKJDHKYXBELHTYPJQNFXFDYKZH" - + "QKZBYJTZBXHFDXKDASWTAWAJLDYJSFHBLDNNTNQJTJNCHXFJSRFWHZFMDRYJYJWZPDJKZYJYMPCYZNYNXFBYTFYFWYGDBNZZZDNYTXZEMMQBSQEHXFZMBMFLZZSRXYMJGSXWZJSPRYDJSJGXHJJGLJJYNZZJXHGXKYMLPYYYCXYTWQZSWHWLYRJLPXSLSXMFSWWKLCTNXNYNPSJ" - + "SZHDZEPTXMYYWXYYSYWLXJQZQXZDCLEEELMCPJPCLWBXSQHFWWTFFJTNQJHJQDXHWLBYZNFJLALKYYJLDXHHYCSTYYWNRJYXYWTRMDRQHWQCMFJDYZMHMYYXJWMYZQZXTLMRSPWWCHAQBXYGZYPXYYRRCLMPYMGKSJSZYSRMYJSNXTPLNBAPPYPYLXYYZKYNLDZYJZCZNNLMZHH" - + "ARQMPGWQTZMXXMLLHGDZXYHXKYXYCJMFFYYHJFSBSSQLXXNDYCANNMTCJCYPRRNYTYQNYYMBMSXNDLYLYSLJRLXYSXQMLLYZLZJJJKYZZCSFBZXXMSTBJGNXYZHLXNMCWSCYZYFZLXBRNNNYLBNRTGZQYSATSWRYHYJZMZDHZGZDWYBSSCSKXSYHYTXXGCQGXZZSHYXJSCRHMKK" - + "BXCZJYJYMKQHZJFNBHMQHYSNJNZYBKNQMCLGQHWLZNZSWXKHLJHYYBQLBFCDSXDLDSPFZPSKJYZWZXZDDXJSMMEGJSCSSMGCLXXKYYYLNYPWWWGYDKZJGGGZGGSYCKNJWNJPCXBJJTQTJWDSSPJXZXNZXUMELPXFSXTLLXCLJXJJLJZXCTPSWXLYDHLYQRWHSYCSQYYBYAYWJJJ" - + "QFWQCQQCJQGXALDBZZYJGKGXPLTZYFXJLTPADKYQHPMATLCPDCKBMTXYBHKLENXDLEEGQDYMSAWHZMLJTWYGXLYQZLJEEYYBQQFFNLYXRDSCTGJGXYYNKLLYQKCCTLHJLQMKKZGCYYGLLLJDZGYDHZWXPYSJBZKDZGYZZHYWYFQYTYZSZYEZZLYMHJJHTSMQWYZLKYYWZCSRKQY" - + "TLTDXWCTYJKLWSQZWBDCQYNCJSRSZJLKCDCDTLZZZACQQZZDDXYPLXZBQJYLZLLLQDDZQJYJYJZYXNYYYNYJXKXDAZWYRDLJYYYRJLXLLDYXJCYWYWNQCCLDDNYYYNYCKCZHXXCCLGZQJGKWPPCQQJYSBZZXYJSQPXJPZBSBDSFNSFPZXHDWZTDWPPTFLZZBZDMYYPQJRSDZSQZ" - + "SQXBDGCPZSWDWCSQZGMDHZXMWWFYBPDGPHTMJTHZSMMBGZMBZJCFZWFZBBZMQCFMBDMCJXLGPNJBBXGYHYYJGPTZGZMQBQTCGYXJXLWZKYDPDYMGCFTPFXYZTZXDZXTGKMTYBBCLBJASKYTSSQYYMSZXFJEWLXLLSZBQJJJAKLYLXLYCCTSXMCWFKKKBSXLLLLJYXTYLTJYYTDP" - + "JHNHNNKBYQNFQYYZBYYESSESSGDYHFHWTCJBSDZZTFDMXHCNJZYMQWSRYJDZJQPDQBBSTJGGFBKJBXTGQHNGWJXJGDLLTHZHHYYYYYYSXWTYYYCCBDBPYPZYCCZYJPZYWCBDLFWZCWJDXXHYHLHWZZXJTCZLCDPXUJCZZZLYXJJTXPHFXWPYWXZPTDZZBDZCYHJHMLXBQXSBYLR" - + "DTGJRRCTTTHYTCZWMXFYTWWZCWJWXJYWCSKYBZSCCTZQNHXNWXXKHKFHTSWOCCJYBCMPZZYKBNNZPBZHHZDLSYDDYTYFJPXYNGFXBYQXCBHXCPSXTYZDMKYSNXSXLHKMZXLYHDHKWHXXSSKQYHHCJYXGLHZXCSNHEKDTGZXQYPKDHEXTYKCNYMYYYPKQYYYKXZLTHJQTBYQHXBM" - + "YHSQCKWWYLLHCYYLNNEQXQWMCFBDCCMLJGGXDQKTLXKGNQCDGZJWYJJLYHHQTTTNWCHMXCXWHWSZJYDJCCDBQCDGDNYXZTHCQRXCBHZTQCBXWGQWYYBXHMBYMYQTYEXMQKYAQYRGYZSLFYKKQHYSSQYSHJGJCNXKZYCXSBXYXHYYLSTYCXQTHYSMGSCPMMGCCCCCMTZTASMGQZJ" - + "HKLOSQYLSWTMXSYQKDZLJQQYPLSYCZTCQQPBBQJZCLPKHQZYYXXDTDDTSJCXFFLLCHQXMJLWCJCXTSPYCXNDTJSHJWXDQQJSKXYAMYLSJHMLALYKXCYYDMNMDQMXMCZNNCYBZKKYFLMCHCMLHXRCJJHSYLNMTJZGZGYWJXSRXCWJGJQHQZDQJDCJJZKJKGDZQGJJYJYLXZXXCDQ" - + "HHHEYTMHLFSBDJSYYSHFYSTCZQLPBDRFRZTZYKYWHSZYQKWDQZRKMSYNBCRXQBJYFAZPZZEDZCJYWBCJWHYJBQSZYWRYSZPTDKZPFPBNZTKLQYHBBZPNPPTYZZYBQNYDCPJMMCYCQMCYFZZDCMNLFPBPLNGQJTBTTNJZPZBBZNJKLJQYLNBZQHKSJZNGGQSZZKYXSHPZSNBCGZK" - + "DDZQANZHJKDRTLZLSWJLJZLYWTJNDJZJHXYAYNCBGTZCSSQMNJPJYTYSWXZFKWJQTKHTZPLBHSNJZSYZBWZZZZLSYLSBJHDWWQPSLMMFBJDWAQYZTCJTBNNWZXQXCDSLQGDSDPDZHJTQQPSWLYYJZLGYXYZLCTCBJTKTYCZJTQKBSJLGMGZDMCSGPYNJZYQYYKNXRPWSZXMTNCS" - + "ZZYXYBYHYZAXYWQCJTLLCKJJTJHGDXDXYQYZZBYWDLWQCGLZGJGQRQZCZSSBCRPCSKYDZNXJSQGXSSJMYDNSTZTPBDLTKZWXQWQTZEXNQCZGWEZKSSBYBRTSSSLCCGBPSZQSZLCCGLLLZXHZQTHCZMQGYZQZNMCOCSZJMMZSQPJYGQLJYJPPLDXRGZYXCCSXHSHGTZNLZWZKJCX" - + "TCFCJXLBMQBCZZWPQDNHXLJCTHYZLGYLNLSZZPCXDSCQQHJQKSXZPBAJYEMSMJTZDXLCJYRYYNWJBNGZZTMJXLTBSLYRZPYLSSCNXPHLLHYLLQQZQLXYMRSYCXZLMMCZLTZSDWTJJLLNZGGQXPFSKYGYGHBFZPDKMWGHCXMSGDXJMCJZDYCABXJDLNBCDQYGSKYDQTXDJJYXMSZ" - + "QAZDZFSLQXYJSJZYLBTXXWXQQZBJZUFBBLYLWDSLJHXJYZJWTDJCZFQZQZZDZSXZZQLZCDZFJHYSPYMPQZMLPPLFFXJJNZZYLSJEYQZFPFZKSYWJJJHRDJZZXTXXGLGHYDXCSKYSWMMZCWYBAZBJKSHFHJCXMHFQHYXXYZFTSJYZFXYXPZLCHMZMBXHZZSXYFYMNCWDABAZLXKT" - + "CSHHXKXJJZJSTHYGXSXYYHHHJWXKZXSSBZZWHHHCWTZZZPJXSNXQQJGZYZYWLLCWXZFXXYXYHXMKYYSWSQMNLNAYCYSPMJKHWCQHYLAJJMZXHMMCNZHBHXCLXTJPLTXYJHDYYLTTXFSZHYXXSJBJYAYRSMXYPLCKDUYHLXRLNLLSTYZYYQYGYHHSCCSMZCTZQXKYQFPYYRPFFLK" - + "QUNTSZLLZMWWTCQQYZWTLLMLMPWMBZSSTZRBPDDTLQJJBXZCSRZQQYGWCSXFWZLXCCRSZDZMCYGGDZQSGTJSWLJMYMMZYHFBJDGYXCCPSHXNZCSBSJYJGJMPPWAFFYFNXHYZXZYLREMZGZCYZSSZDLLJCSQFNXZKPTXZGXJJGFMYYYSNBTYLBNLHPFZDCYFBMGQRRSSSZXYSGTZ" - + "RNYDZZCDGPJAFJFZKNZBLCZSZPSGCYCJSZLMLRSZBZZLDLSLLYSXSQZQLYXZLSKKBRXBRBZCYCXZZZEEYFGKLZLYYHGZSGZLFJHGTGWKRAAJYZKZQTSSHJJXDCYZUYJLZYRZDQQHGJZXSSZBYKJPBFRTJXLLFQWJHYLQTYMBLPZDXTZYGBDHZZRBGXHWNJTJXLKSCFSMWLSDQYS" - + "JTXKZSCFWJLBXFTZLLJZLLQBLSQMQQCGCZFPBPHZCZJLPYYGGDTGWDCFCZQYYYQYSSCLXZSKLZZZGFFCQNWGLHQYZJJCZLQZZYJPJZZBPDCCMHJGXDQDGDLZQMFGPSYTSDYFWWDJZJYSXYYCZCYHZWPBYKXRYLYBHKJKSFXTZJMMCKHLLTNYYMSYXYZPYJQYCSYCWMTJJKQYRHL" - + "LQXPSGTLYYCLJSCPXJYZFNMLRGJJTYZBXYZMSJYJHHFZQMSYXRSZCWTLRTQZSSTKXGQKGSPTGCZNJSJCQCXHMXGGZTQYDJKZDLBZSXJLHYQGGGTHQSZPYHJHHGYYGKGGCWJZZYLCZLXQSFTGZSLLLMLJSKCTBLLZZSZMMNYTPZSXQHJCJYQXYZXZQZCPSHKZZYSXCDFGMWQRLLQ" - + "XRFZTLYSTCTMJCXJJXHJNXTNRZTZFQYHQGLLGCXSZSJDJLJCYDSJTLNYXHSZXCGJZYQPYLFHDJSBPCCZHJJJQZJQDYBSSLLCMYTTMQTBHJQNNYGKYRQYQMZGCJKPDCGMYZHQLLSLLCLMHOLZGDYYFZSLJCQZLYLZQJESHNYLLJXGJXLYSYYYXNBZLJSSZCQQCJYLLZLTJYLLZLL" - + "BNYLGQCHXYYXOXCXQKYJXXXYKLXSXXYQXCYKQXQCSGYXXYQXYGYTQOHXHXPYXXXULCYEYCHZZCBWQBBWJQZSCSZSSLZYLKDESJZWMYMCYTSDSXXSCJPQQSQYLYYZYCMDJDZYWCBTJSYDJKCYDDJLBDJJSODZYSYXQQYXDHHGQQYQHDYXWGMMMAJDYBBBPPBCMUUPLJZSMTXERXJ" - + "MHQNUTPJDCBSSMSSSTKJTSSMMTRCPLZSZMLQDSDMJMQPNQDXCFYNBFSDQXYXHYAYKQYDDLQYYYSSZBYDSLNTFQTZQPZMCHDHCZCWFDXTMYQSPHQYYXSRGJCWTJTZZQMGWJJTJHTQJBBHWZPXXHYQFXXQYWYYHYSCDYDHHQMNMTMWCPBSZPPZZGLMZFOLLCFWHMMSJZTTDHZZYFF" - + "YTZZGZYSKYJXQYJZQBHMBZZLYGHGFMSHPZFZSNCLPBQSNJXZSLXXFPMTYJYGBXLLDLXPZJYZJYHHZCYWHJYLSJEXFSZZYWXKZJLUYDTMLYMQJPWXYHXSKTQJEZRPXXZHHMHWQPWQLYJJQJJZSZCPHJLCHHNXJLQWZJHBMZYXBDHHYPZLHLHLGFWLCHYYTLHJXCJMSCPXSTKPNHQ" - + "XSRTYXXTESYJCTLSSLSTDLLLWWYHDHRJZSFGXTSYCZYNYHTDHWJSLHTZDQDJZXXQHGYLTZPHCSQFCLNJTCLZPFSTPDYNYLGMJLLYCQHYSSHCHYLHQYQTMZYPBYWRFQYKQSYSLZDQJMPXYYSSRHZJNYWTQDFZBWWTWWRXCWHGYHXMKMYYYQMSMZHNGCEPMLQQMTCWCTMMPXJPJJH" - + "FXYYZSXZHTYBMSTSYJTTQQQYYLHYNPYQZLCYZHZWSMYLKFJXLWGXYPJYTYSYXYMZCKTTWLKSMZSYLMPWLZWXWQZSSAQSYXYRHSSNTSRAPXCPWCMGDXHXZDZYFJHGZTTSBJHGYZSZYSMYCLLLXBTYXHBBZJKSSDMALXHYCFYGMQYPJYCQXJLLLJGSLZGQLYCJCCZOTYXMTMTTLLW" - + "TGPXYMZMKLPSZZZXHKQYSXCTYJZYHXSHYXZKXLZWPSQPYHJWPJPWXQQYLXSDHMRSLZZYZWTTCYXYSZZSHBSCCSTPLWSSCJCHNLCGCHSSPHYLHFHHXJSXYLLNYLSZDHZXYLSXLWZYKCLDYAXZCMDDYSPJTQJZLNWQPSSSWCTSTSZLBLNXSMNYYMJQBQHRZWTYYDCHQLXKPZWBGQY" - + "BKFCMZWPZLLYYLSZYDWHXPSBCMLJBSCGBHXLQHYRLJXYSWXWXZSLDFHLSLYNJLZYFLYJYCDRJLFSYZFSLLCQYQFGJYHYXZLYLMSTDJCYHBZLLNWLXXYGYYHSMGDHXXHHLZZJZXCZZZCYQZFNGWPYLCPKPYYPMCLQKDGXZGGWQBDXZZKZFBXXLZXJTPJPTTBYTSZZDWSLCHZHSLT" - + "YXHQLHYXXXYYZYSWTXZKHLXZXZPYHGCHKCFSYHUTJRLXFJXPTZTWHPLYXFCRHXSHXKYXXYHZQDXQWULHYHMJTBFLKHTXCWHJFWJCFPQRYQXCYYYQYGRPYWSGSUNGWCHKZDXYFLXXHJJBYZWTSXXNCYJJYMSWZJQRMHXZWFQSYLZJZGBHYNSLBGTTCSYBYXXWXYHXYYXNSQYXMQY" - + "WRGYQLXBBZLJSYLPSYTJZYHYZAWLRORJMKSCZJXXXYXCHDYXRYXXJDTSQFXLYLTSFFYXLMTYJMJUYYYXLTZCSXQZQHZXLYYXZHDNBRXXXJCTYHLBRLMBRLLAXKYLLLJLYXXLYCRYLCJTGJCMTLZLLCYZZPZPCYAWHJJFYBDYYZSMPCKZDQYQPBPCJPDCYZMDPBCYYDYCNNPLMTM" - + "LRMFMMGWYZBSJGYGSMZQQQZTXMKQWGXLLPJGZBQCDJJJFPKJKCXBLJMSWMDTQJXLDLPPBXCWRCQFBFQJCZAHZGMYKPHYYHZYKNDKZMBPJYXPXYHLFPNYYGXJDBKXNXHJMZJXSTRSTLDXSKZYSYBZXJLXYSLBZYSLHXJPFXPQNBYLLJQKYGZMCYZZYMCCSLCLHZFWFWYXZMWSXTY" - + "NXJHPYYMCYSPMHYSMYDYSHQYZCHMJJMZCAAGCFJBBHPLYZYLXXSDJGXDHKXXTXXNBHRMLYJSLTXMRHNLXQJXYZLLYSWQGDLBJHDCGJYQYCMHWFMJYBMBYJYJWYMDPWHXQLDYGPDFXXBCGJSPCKRSSYZJMSLBZZJFLJJJLGXZGYXYXLSZQYXBEXYXHGCXBPLDYHWETTWWCJMBTXC" - + "HXYQXLLXFLYXLLJLSSFWDPZSMYJCLMWYTCZPCHQEKCQBWLCQYDPLQPPQZQFJQDJHYMMCXTXDRMJWRHXCJZYLQXDYYNHYYHRSLSRSYWWZJYMTLTLLGTQCJZYABTCKZCJYCCQLJZQXALMZYHYWLWDXZXQDLLQSHGPJFJLJHJABCQZDJGTKHSSTCYJLPSWZLXZXRWGLDLZRLZXTGSL" - + "LLLZLYXXWGDZYGBDPHZPBRLWSXQBPFDWOFMWHLYPCBJCCLDMBZPBZZLCYQXLDOMZBLZWPDWYYGDSTTHCSQSCCRSSSYSLFYBFNTYJSZDFNDPDHDZZMBBLSLCMYFFGTJJQWFTMTPJWFNLBZCMMJTGBDZLQLPYFHYYMJYLSDCHDZJWJCCTLJCLDTLJJCPDDSQDSSZYBNDBJLGGJZXS" - + "XNLYCYBJXQYCBYLZCFZPPGKCXZDZFZTJJFJSJXZBNZYJQTTYJYHTYCZHYMDJXTTMPXSPLZCDWSLSHXYPZGTFMLCJTYCBPMGDKWYCYZCDSZZYHFLYCTYGWHKJYYLSJCXGYWJCBLLCSNDDBTZBSCLYZCZZSSQDLLMQYYHFSLQLLXFTYHABXGWNYWYYPLLSDLDLLBJCYXJZMLHLJDX" - + "YYQYTDLLLBUGBFDFBBQJZZMDPJHGCLGMJJPGAEHHBWCQXAXHHHZCHXYPHJAXHLPHJPGPZJQCQZGJJZZUZDMQYYBZZPHYHYBWHAZYJHYKFGDPFQSDLZMLJXKXGALXZDAGLMDGXMWZQYXXDXXPFDMMSSYMPFMDMMKXKSYZYSHDZKXSYSMMZZZMSYDNZZCZXFPLSTMZDNMXCKJMZTY" - + "YMZMZZMSXHHDCZJEMXXKLJSTLWLSQLYJZLLZJSSDPPMHNLZJCZYHMXXHGZCJMDHXTKGRMXFWMCGMWKDTKSXQMMMFZZYDKMSCLCMPCGMHSPXQPZDSSLCXKYXTWLWJYAHZJGZQMCSNXYYMMPMLKJXMHLMLQMXCTKZMJQYSZJSYSZHSYJZJCDAJZYBSDQJZGWZQQXFKDMSDJLFWEHK" - + "ZQKJPEYPZYSZCDWYJFFMZZYLTTDZZEFMZLBNPPLPLPEPSZALLTYLKCKQZKGENQLWAGYXYDPXLHSXQQWQCQXQCLHYXXMLYCCWLYMQYSKGCHLCJNSZKPYZKCQZQLJPDMDZHLASXLBYDWQLWDNBQCRYDDZTJYBKBWSZDXDTNPJDTCTQDFXQQMGNXECLTTBKPWSLCTYQLPWYZZKLPYG" - + "ZCQQPLLKCCYLPQMZCZQCLJSLQZDJXLDDHPZQDLJJXZQDXYZQKZLJCYQDYJPPYPQYKJYRMPCBYMCXKLLZLLFQPYLLLMBSGLCYSSLRSYSQTMXYXZQZFDZUYSYZTFFMZZSMZQHZSSCCMLYXWTPZGXZJGZGSJSGKDDHTQGGZLLBJDZLCBCHYXYZHZFYWXYZYMSDBZZYJGTSMTFXQYXQ" - + "STDGSLNXDLRYZZLRYYLXQHTXSRTZNGZXBNQQZFMYKMZJBZYMKBPNLYZPBLMCNQYZZZSJZHJCTZKHYZZJRDYZHNPXGLFZTLKGJTCTSSYLLGZRZBBQZZKLPKLCZYSSUYXBJFPNJZZXCDWXZYJXZZDJJKGGRSRJKMSMZJLSJYWQSKYHQJSXPJZZZLSNSHRNYPZTWCHKLPSRZLZXYJQ" - + "XQKYSJYCZTLQZYBBYBWZPQDWWYZCYTJCJXCKCWDKKZXSGKDZXWWYYJQYYTCYTDLLXWKCZKKLCCLZCQQDZLQLCSFQCHQHSFSMQZZLNBJJZBSJHTSZDYSJQJPDLZCDCWJKJZZLPYCGMZWDJJBSJQZSYZYHHXJPBJYDSSXDZNCGLQMBTSFSBPDZDLZNFGFJGFSMPXJQLMBLGQCYYXB" - + "QKDJJQYRFKZTJDHCZKLBSDZCFJTPLLJGXHYXZCSSZZXSTJYGKGCKGYOQXJPLZPBPGTGYJZGHZQZZLBJLSQFZGKQQJZGYCZBZQTLDXRJXBSXXPZXHYZYCLWDXJJHXMFDZPFZHQHQMQGKSLYHTYCGFRZGNQXCLPDLBZCSCZQLLJBLHBZCYPZZPPDYMZZSGYHCKCPZJGSLJLNSCDSL" - + "DLXBMSTLDDFJMKDJDHZLZXLSZQPQPGJLLYBDSZGQLBZLSLKYYHZTTNTJYQTZZPSZQZTLLJTYYLLQLLQYZQLBDZLSLYYZYMDFSZSNHLXZNCZQZPBWSKRFBSYZMTHBLGJPMCZZLSTLXSHTCSYZLZBLFEQHLXFLCJLYLJQCBZLZJHHSSTBRMHXZHJZCLXFNBGXGTQJCZTMSFZKJMSS" - + "NXLJKBHSJXNTNLZDNTLMSJXGZJYJCZXYJYJWRWWQNZTNFJSZPZSHZJFYRDJSFSZJZBJFZQZZHZLXFYSBZQLZSGYFTZDCSZXZJBQMSZKJRHYJZCKMJKHCHGTXKXQGLXPXFXTRTYLXJXHDTSJXHJZJXZWZLCQSBTXWXGXTXXHXFTSDKFJHZYJFJXRZSDLLLTQSQQZQWZXSYQTWGWB" - + "ZCGZLLYZBCLMQQTZHZXZXLJFRMYZFLXYSQXXJKXRMQDZDMMYYBSQBHGZMWFWXGMXLZPYYTGZYCCDXYZXYWGSYJYZNBHPZJSQSYXSXRTFYZGRHZTXSZZTHCBFCLSYXZLZQMZLMPLMXZJXSFLBYZMYQHXJSXRXSQZZZSSLYFRCZJRCRXHHZXQYDYHXSJJHZCXZBTYNSYSXJBQLPXZ" - + "QPYMLXZKYXLXCJLCYSXXZZLXDLLLJJYHZXGYJWKJRWYHCPSGNRZLFZWFZZNSXGXFLZSXZZZBFCSYJDBRJKRDHHGXJLJJTGXJXXSTJTJXLYXQFCSGSWMSBCTLQZZWLZZKXJMLTMJYHSDDBXGZHDLBMYJFRZFSGCLYJBPMLYSMSXLSZJQQHJZFXGFQFQBPXZGYYQXGZTCQWYLTLGW" - + "SGWHRLFSFGZJMGMGBGTJFSYZZGZYZAFLSSPMLPFLCWBJZCLJJMZLPJJLYMQDMYYYFBGYGYZMLYZDXQYXRQQQHSYYYQXYLJTYXFSFSLLGNQCYHYCWFHCCCFXPYLYPLLZYXXXXXKQHHXSHJZCFZSCZJXCPZWHHHHHAPYLQALPQAFYHXDYLUKMZQGGGDDESRNNZLTZGCHYPPYSQJJH" - + "CLLJTOLNJPZLJLHYMHEYDYDSQYCDDHGZUNDZCLZYZLLZNTNYZGSLHSLPJJBDGWXPCDUTJCKLKCLWKLLCASSTKZZDNQNTTLYYZSSYSSZZRYLJQKCQDHHCRXRZYDGRGCWCGZQFFFPPJFZYNAKRGYWYQPQXXFKJTSZZXSWZDDFBBXTBGTZKZNPZZPZXZPJSZBMQHKCYXYLDKLJNYPK" - + "YGHGDZJXXEAHPNZKZTZCMXCXMMJXNKSZQNMNLWBWWXJKYHCPSTMCSQTZJYXTPCTPDTNNPGLLLZSJLSPBLPLQHDTNJNLYYRSZFFJFQWDPHZDWMRZCCLODAXNSSNYZRESTYJWJYJDBCFXNMWTTBYLWSTSZGYBLJPXGLBOCLHPCBJLTMXZLJYLZXCLTPNCLCKXTPZJSWCYXSFYSZDK" - + "NTLBYJCYJLLSTGQCBXRYZXBXKLYLHZLQZLNZCXWJZLJZJNCJHXMNZZGJZZXTZJXYCYYCXXJYYXJJXSSSJSTSSTTPPGQTCSXWZDCSYFPTFBFHFBBLZJCLZZDBXGCXLQPXKFZFLSYLTUWBMQJHSZBMDDBCYSCCLDXYCDDQLYJJWMQLLCSGLJJSYFPYYCCYLTJANTJJPWYCMMGQYYS" - + "XDXQMZHSZXPFTWWZQSWQRFKJLZJQQYFBRXJHHFWJJZYQAZMYFRHCYYBYQWLPEXCCZSTYRLTTDMQLYKMBBGMYYJPRKZNPBSXYXBHYZDJDNGHPMFSGMWFZMFQMMBCMZZCJJLCNUXYQLMLRYGQZCYXZLWJGCJCGGMCJNFYZZJHYCPRRCMTZQZXHFQGTJXCCJEAQCRJYHPLQLSZDJRB" - + "CQHQDYRHYLYXJSYMHZYDWLDFRYHBPYDTSSCNWBXGLPZMLZZTQSSCPJMXXYCSJYTYCGHYCJWYRXXLFEMWJNMKLLSWTXHYYYNCMMCWJDQDJZGLLJWJRKHPZGGFLCCSCZMCBLTBHBQJXQDSPDJZZGKGLFQYWBZYZJLTSTDHQHCTCBCHFLQMPWDSHYYTQWCNZZJTLBYMBPDYYYXSQKX" - + "WYYFLXXNCWCXYPMAELYKKJMZZZBRXYYQJFLJPFHHHYTZZXSGQQMHSPGDZQWBWPJHZJDYSCQWZKTXXSQLZYYMYSDZGRXCKKUJLWPYSYSCSYZLRMLQSYLJXBCXTLWDQZPCYCYKPPPNSXFYZJJRCEMHSZMSXLXGLRWGCSTLRSXBZGBZGZTCPLUJLSLYLYMTXMTZPALZXPXJTJWTCYY" - + "ZLBLXBZLQMYLXPGHDSLSSDMXMBDZZSXWHAMLCZCPJMCNHJYSNSYGCHSKQMZZQDLLKABLWJXSFMOCDXJRRLYQZKJMYBYQLYHETFJZFRFKSRYXFJTWDSXXSYSQJYSLYXWJHSNLXYYXHBHAWHHJZXWMYLJCSSLKYDZTXBZSYFDXGXZJKHSXXYBSSXDPYNZWRPTQZCZENYGCXQFJYKJ" - + "BZMLJCMQQXUOXSLYXXLYLLJDZBTYMHPFSTTQQWLHOKYBLZZALZXQLHZWRRQHLSTMYPYXJJXMQSJFNBXYXYJXXYQYLTHYLQYFMLKLJTMLLHSZWKZHLJMLHLJKLJSTLQXYLMBHHLNLZXQJHXCFXXLHYHJJGBYZZKBXSCQDJQDSUJZYYHZHHMGSXCSYMXFEBCQWWRBPYYJQTYZCYQY" - + "QQZYHMWFFHGZFRJFCDPXNTQYZPDYKHJLFRZXPPXZDBBGZQSTLGDGYLCQMLCHHMFYWLZYXKJLYPQHSYWMQQGQZMLZJNSQXJQSYJYCBEHSXFSZPXZWFLLBCYYJDYTDTHWZSFJMQQYJLMQXXLLDTTKHHYBFPWTYYSQQWNQWLGWDEBZWCMYGCULKJXTMXMYJSXHYBRWFYMWFRXYQMXY" - + "SZTZZTFYKMLDHQDXWYYNLCRYJBLPSXCXYWLSPRRJWXHQYPHTYDNXHHMMYWYTZCSQMTSSCCDALWZTCPQPYJLLQZYJSWXMZZMMYLMXCLMXCZMXMZSQTZPPQQBLPGXQZHFLJJHYTJSRXWZXSCCDLXTYJDCQJXSLQYCLZXLZZXMXQRJMHRHZJBHMFLJLMLCLQNLDXZLLLPYPSYJYSXC" - + "QQDCMQJZZXHNPNXZMEKMXHYKYQLXSXTXJYYHWDCWDZHQYYBGYBCYSCFGPSJNZDYZZJZXRZRQJJYMCANYRJTLDPPYZBSTJKXXZYPFDWFGZZRPYMTNGXZQBYXNBUFNQKRJQZMJEGRZGYCLKXZDSKKNSXKCLJSPJYYZLQQJYBZSSQLLLKJXTBKTYLCCDDBLSPPFYLGYDTZJYQGGKQT" - + "TFZXBDKTYYHYBBFYTYYBCLPDYTGDHRYRNJSPTCSNYJQHKLLLZSLYDXXWBCJQSPXBPJZJCJDZFFXXBRMLAZHCSNDLBJDSZBLPRZTSWSBXBCLLXXLZDJZSJPYLYXXYFTFFFBHJJXGBYXJPMMMPSSJZJMTLYZJXSWXTYLEDQPJMYGQZJGDJLQJWJQLLSJGJGYGMSCLJJXDTYGJQJQJ" - + "CJZCJGDZZSXQGSJGGCXHQXSNQLZZBXHSGZXCXYLJXYXYYDFQQJHJFXDHCTXJYRXYSQTJXYEFYYSSYYJXNCYZXFXMSYSZXYYSCHSHXZZZGZZZGFJDLTYLNPZGYJYZYYQZPBXQBDZTZCZYXXYHHSQXSHDHGQHJHGYWSZTMZMLHYXGEBTYLZKQWYTJZRCLEKYSTDBCYKQQSAYXCJXW" - + "WGSBHJYZYDHCSJKQCXSWXFLTYNYZPZCCZJQTZWJQDZZZQZLJJXLSBHPYXXPSXSHHEZTXFPTLQYZZXHYTXNCFZYYHXGNXMYWXTZSJPTHHGYMXMXQZXTSBCZYJYXXTYYZYPCQLMMSZMJZZLLZXGXZAAJZYXJMZXWDXZSXZDZXLEYJJZQBHZWZZZQTZPSXZTDSXJJJZNYAZPHXYYSR" - + "NQDTHZHYYKYJHDZXZLSWCLYBZYECWCYCRYLCXNHZYDZYDYJDFRJJHTRSQTXYXJRJHOJYNXELXSFSFJZGHPZSXZSZDZCQZBYYKLSGSJHCZSHDGQGXYZGXCHXZJWYQWGYHKSSEQZZNDZFKWYSSTCLZSTSYMCDHJXXYWEYXCZAYDMPXMDSXYBSQMJMZJMTZQLPJYQZCGQHXJHHLXXH" - + "LHDLDJQCLDWBSXFZZYYSCHTYTYYBHECXHYKGJPXHHYZJFXHWHBDZFYZBCAPNPGNYDMSXHMMMMAMYNBYJTMPXYYMCTHJBZYFCGTYHWPHFTWZZEZSBZEGPFMTSKFTYCMHFLLHGPZJXZJGZJYXZSBBQSCZZLZCCSTPGXMJSFTCCZJZDJXCYBZLFCJSYZFGSZLYBCWZZBYZDZYPSWYJ" - + "ZXZBDSYUXLZZBZFYGCZXBZHZFTPBGZGEJBSTGKDMFHYZZJHZLLZZGJQZLSFDJSSCBZGPDLFZFZSZYZYZSYGCXSNXXCHCZXTZZLJFZGQSQYXZJQDCCZTQCDXZJYQJQCHXZTDLGSCXZSYQJQTZWLQDQZTQCHQQJZYEZZZPBWKDJFCJPZTYPQYQTTYNLMBDKTJZPQZQZZFPZSBNJLG" - + "YJDXJDZZKZGQKXDLPZJTCJDQBXDJQJSTCKNXBXZMSLYJCQMTJQWWCJQNJNLLLHJCWQTBZQYDZCZPZZDZYDDCYZZZCCJTTJFZDPRRTZTJDCQTQZDTJNPLZBCLLCTZSXKJZQZPZLBZRBTJDCXFCZDBCCJJLTQQPLDCGZDBBZJCQDCJWYNLLZYZCCDWLLXWZLXRXNTQQCZXKQLSGDF" - + "QTDDGLRLAJJTKUYMKQLLTZYTDYYCZGJWYXDXFRSKSTQTENQMRKQZHHQKDLDAZFKYPBGGPZREBZZYKZZSPEGJXGYKQZZZSLYSYYYZWFQZYLZZLZHWCHKYPQGNPGBLPLRRJYXCCSYYHSFZFYBZYYTGZXYLXCZWXXZJZBLFFLGSKHYJZEYJHLPLLLLCZGXDRZELRHGKLZZYHZLYQSZ" - + "ZJZQLJZFLNBHGWLCZCFJYSPYXZLZLXGCCPZBLLCYBBBBUBBCBPCRNNZCZYRBFSRLDCGQYYQXYGMQZWTZYTYJXYFWTEHZZJYWLCCNTZYJJZDEDPZDZTSYQJHDYMBJNYJZLXTSSTPHNDJXXBYXQTZQDDTJTDYYTGWSCSZQFLSHLGLBCZPHDLYZJYCKWTYTYLBNYTSDSYCCTYSZYYE" - + "BHEXHQDTWNYGYCLXTSZYSTQMYGZAZCCSZZDSLZCLZRQXYYELJSBYMXSXZTEMBBLLYYLLYTDQYSHYMRQWKFKBFXNXSBYCHXBWJYHTQBPBSBWDZYLKGZSKYHXQZJXHXJXGNLJKZLYYCDXLFYFGHLJGJYBXQLYBXQPQGZTZPLNCYPXDJYQYDYMRBESJYYHKXXSTMXRCZZYWXYQYBMC" - + "LLYZHQYZWQXDBXBZWZMSLPDMYSKFMZKLZCYQYCZLQXFZZYDQZPZYGYJYZMZXDZFYFYTTQTZHGSPCZMLCCYTZXJCYTJMKSLPZHYSNZLLYTPZCTZZCKTXDHXXTQCYFKSMQCCYYAZHTJPCYLZLYJBJXTPNYLJYYNRXSYLMMNXJSMYBCSYSYLZYLXJJQYLDZLPQBFZZBLFNDXQKCZFY" - + "WHGQMRDSXYCYTXNQQJZYYPFZXDYZFPRXEJDGYQBXRCNFYYQPGHYJDYZXGRHTKYLNWDZNTSMPKLBTHBPYSZBZTJZSZZJTYYXZPHSSZZBZCZPTQFZMYFLYPYBBJQXZMXXDJMTSYSKKBJZXHJCKLPSMKYJZCXTMLJYXRZZQSLXXQPYZXMKYXXXJCLJPRMYYGADYSKQLSNDHYZKQXZY" - + "ZTCGHZTLMLWZYBWSYCTBHJHJFCWZTXWYTKZLXQSHLYJZJXTMPLPYCGLTBZZTLZJCYJGDTCLKLPLLQPJMZPAPXYZLKKTKDZCZZBNZDYDYQZJYJGMCTXLTGXSZLMLHBGLKFWNWZHDXUHLFMKYSLGXDTWWFRJEJZTZHYDXYKSHWFZCQSHKTMQQHTZHYMJDJSKHXZJZBZZXYMPAGQMS" - + "TPXLSKLZYNWRTSQLSZBPSPSGZWYHTLKSSSWHZZLYYTNXJGMJSZSUFWNLSOZTXGXLSAMMLBWLDSZYLAKQCQCTMYCFJBSLXCLZZCLXXKSBZQCLHJPSQPLSXXCKSLNHPSFQQYTXYJZLQLDXZQJZDYYDJNZPTUZDSKJFSLJHYLZSQZLBTXYDGTQFDBYAZXDZHZJNHHQBYKNXJJQCZML" - + "LJZKSPLDYCLBBLXKLELXJLBQYCXJXGCNLCQPLZLZYJTZLJGYZDZPLTQCSXFDMNYCXGBTJDCZNBGBQYQJWGKFHTNPYQZQGBKPBBYZMTJDYTBLSQMPSXTBNPDXKLEMYYCJYNZCTLDYKZZXDDXHQSHDGMZSJYCCTAYRZLPYLTLKXSLZCGGEXCLFXLKJRTLQJAQZNCMBYDKKCXGLCZJ" - + "ZXJHPTDJJMZQYKQSECQZDSHHADMLZFMMZBGNTJNNLGBYJBRBTMLBYJDZXLCJLPLDLPCQDHLXZLYCBLCXZZJADJLNZMMSSSMYBHBSQKBHRSXXJMXSDZNZPXLGBRHWGGFCXGMSKLLTSJYYCQLTSKYWYYHYWXBXQYWPYWYKQLSQPTNTKHQCWDQKTWPXXHCPTHTWUMSSYHBWCRWXHJM" - + "KMZNGWTMLKFGHKJYLSYYCXWHYECLQHKQHTTQKHFZLDXQWYZYYDESBPKYRZPJFYYZJCEQDZZDLATZBBFJLLCXDLMJSSXEGYGSJQXCWBXSSZPDYZCXDNYXPPZYDLYJCZPLTXLSXYZYRXCYYYDYLWWNZSAHJSYQYHGYWWAXTJZDAXYSRLTDPSSYYFNEJDXYZHLXLLLZQZSJNYQYQQX" - + "YJGHZGZCYJCHZLYCDSHWSHJZYJXCLLNXZJJYYXNFXMWFPYLCYLLABWDDHWDXJMCXZTZPMLQZHSFHZYNZTLLDYWLSLXHYMMYLMBWWKYXYADTXYLLDJPYBPWUXJMWMLLSAFDLLYFLBHHHBQQLTZJCQJLDJTFFKMMMBYTHYGDCQRDDWRQJXNBYSNWZDBYYTBJHPYBYTTJXAAHGQDQT" - + "MYSTQXKBTZPKJLZRBEQQSSMJJBDJOTGTBXPGBKTLHQXJJJCTHXQDWJLWRFWQGWSHCKRYSWGFTGYGBXSDWDWRFHWYTJJXXXJYZYSLPYYYPAYXHYDQKXSHXYXGSKQHYWFDDDPPLCJLQQEEWXKSYYKDYPLTJTHKJLTCYYHHJTTPLTZZCDLTHQKZXQYSTEEYWYYZYXXYYSTTJKLLPZM" - + "CYHQGXYHSRMBXPLLNQYDQHXSXXWGDQBSHYLLPJJJTHYJKYPPTHYYKTYEZYENMDSHLCRPQFDGFXZPSFTLJXXJBSWYYSKSFLXLPPLBBBLBSFXFYZBSJSSYLPBBFFFFSSCJDSTZSXZRYYSYFFSYZYZBJTBCTSBSDHRTJJBYTCXYJEYLXCBNEBJDSYXYKGSJZBXBYTFZWGENYHHTHZH" - + "HXFWGCSTBGXKLSXYWMTMBYXJSTZSCDYQRCYTWXZFHMYMCXLZNSDJTTTXRYCFYJSBSDYERXJLJXBBDEYNJGHXGCKGSCYMBLXJMSZNSKGXFBNBPTHFJAAFXYXFPXMYPQDTZCXZZPXRSYWZDLYBBKTYQPQJPZYPZJZNJPZJLZZFYSBTTSLMPTZRTDXQSJEHBZYLZDHLJSQMLHTXTJE" - + "CXSLZZSPKTLZKQQYFSYGYWPCPQFHQHYTQXZKRSGTTSQCZLPTXCDYYZXSQZSLXLZMYCPCQBZYXHBSXLZDLTCDXTYLZJYYZPZYZLTXJSJXHLPMYTXCQRBLZSSFJZZTNJYTXMYJHLHPPLCYXQJQQKZZSCPZKSWALQSBLCCZJSXGWWWYGYKTJBBZTDKHXHKGTGPBKQYSLPXPJCKBMLL" - + "XDZSTBKLGGQKQLSBKKTFXRMDKBFTPZFRTBBRFERQGXYJPZSSTLBZTPSZQZSJDHLJQLZBPMSMMSXLQQNHKNBLRDDNXXDHDDJCYYGYLXGZLXSYGMQQGKHBPMXYXLYTQWLWGCPBMQXCYZYDRJBHTDJYHQSHTMJSBYPLWHLZFFNYPMHXXHPLTBQPFBJWQDBYGPNZTPFZJGSDDTQSHZE" - + "AWZZYLLTYYBWJKXXGHLFKXDJTMSZSQYNZGGSWQSPHTLSSKMCLZXYSZQZXNCJDQGZDLFNYKLJCJLLZLMZZNHYDSSHTHZZLZZBBHQZWWYCRZHLYQQJBEYFXXXWHSRXWQHWPSLMSSKZTTYGYQQWRSLALHMJTQJSMXQBJJZJXZYZKXBYQXBJXSHZTSFJLXMXZXFGHKZSZGGYLCLSARJ" - + "YHSLLLMZXELGLXYDJYTLFBHBPNLYZFBBHPTGJKWETZHKJJXZXXGLLJLSTGSHJJYQLQZFKCGNNDJSSZFDBCTWWSEQFHQJBSAQTGYPQLBXBMMYWXGSLZHGLZGQYFLZBYFZJFRYSFMBYZHQGFWZSYFYJJPHZBYYZFFWODGRLMFTWLBZGYCQXCDJYGZYYYYTYTYDWEGAZYHXJLZYYHL" - + "RMGRXXZCLHNELJJTJTPWJYBJJBXJJTJTEEKHWSLJPLPSFYZPQQBDLQJJTYYQLYZKDKSQJYYQZLDQTGJQYZJSUCMRYQTHTEJMFCTYHYPKMHYZWJDQFHYYXWSHCTXRLJHQXHCCYYYJLTKTTYTMXGTCJTZAYYOCZLYLBSZYWJYTSJYHBYSHFJLYGJXXTMZYYLTXXYPZLXYJZYZYYPN" - + "HMYMDYYLBLHLSYYQQLLNJJYMSOYQBZGDLYXYLCQYXTSZEGXHZGLHWBLJHEYXTWQMAKBPQCGYSHHEGQCMWYYWLJYJHYYZLLJJYLHZYHMGSLJLJXCJJYCLYCJPCPZJZJMMYLCQLNQLJQJSXYJMLSZLJQLYCMMHCFMMFPQQMFYLQMCFFQMMMMHMZNFHHJGTTHHKHSLNCHHYQDXTMMQ" - + "DCYZYXYQMYQYLTDCYYYZAZZCYMZYDLZFFFMMYCQZWZZMABTBYZTDMNZZGGDFTYPCGQYTTSSFFWFDTZQSSYSTWXJHXYTSXXYLBYQHWWKXHZXWZNNZZJZJJQJCCCHYYXBZXZCYZTLLCQXYNJYCYYCYNZZQYYYEWYCZDCJYCCHYJLBTZYYCQWMPWPYMLGKDLDLGKQQBGYCHJXY"; - - //此处收录了375个多音字,数据来自于http://www.51window.net/page/pinyin - var oMultiDiff = { - "19969": "DZ", - "19975": "WM", - "19988": "QJ", - "20048": "YL", - "20056": "SC", - "20060": "NM", - "20094": "QG", - "20127": "QJ", - "20167": "QC", - "20193": "YG", - "20250": "KH", - "20256": "ZC", - "20282": "SC", - "20285": "QJG", - "20291": "TD", - "20314": "YD", - "20340": "NE", - "20375": "TD", - "20389": "YJ", - "20391": "CZ", - "20415": "PB", - "20446": "YS", - "20447": "SQ", - "20504": "TC", - "20608": "KG", - "20854": "QJ", - "20857": "ZC", - "20911": "PF", - "20504": "TC", - "20608": "KG", - "20854": "QJ", - "20857": "ZC", - "20911": "PF", - "20985": "AW", - "21032": "PB", - "21048": "XQ", - "21049": "SC", - "21089": "YS", - "21119": "JC", - "21242": "SB", - "21273": "SC", - "21305": "YP", - "21306": "QO", - "21330": "ZC", - "21333": "SDC", - "21345": "QK", - "21378": "CA", - "21397": "SC", - "21414": "XS", - "21442": "SC", - "21477": "JG", - "21480": "TD", - "21484": "ZS", - "21494": "YX", - "21505": "YX", - "21512": "HG", - "21523": "XH", - "21537": "PB", - "21542": "PF", - "21549": "KH", - "21571": "E", - "21574": "DA", - "21588": "TD", - "21589": "O", - "21618": "ZC", - "21621": "KHA", - "21632": "ZJ", - "21654": "KG", - "21679": "LKG", - "21683": "KH", - "21710": "A", - "21719": "YH", - "21734": "WOE", - "21769": "A", - "21780": "WN", - "21804": "XH", - "21834": "A", - "21899": "ZD", - "21903": "RN", - "21908": "WO", - "21939": "ZC", - "21956": "SA", - "21964": "YA", - "21970": "TD", - "22003": "A", - "22031": "JG", - "22040": "XS", - "22060": "ZC", - "22066": "ZC", - "22079": "MH", - "22129": "XJ", - "22179": "XA", - "22237": "NJ", - "22244": "TD", - "22280": "JQ", - "22300": "YH", - "22313": "XW", - "22331": "YQ", - "22343": "YJ", - "22351": "PH", - "22395": "DC", - "22412": "TD", - "22484": "PB", - "22500": "PB", - "22534": "ZD", - "22549": "DH", - "22561": "PB", - "22612": "TD", - "22771": "KQ", - "22831": "HB", - "22841": "JG", - "22855": "QJ", - "22865": "XQ", - "23013": "ML", - "23081": "WM", - "23487": "SX", - "23558": "QJ", - "23561": "YW", - "23586": "YW", - "23614": "YW", - "23615": "SN", - "23631": "PB", - "23646": "ZS", - "23663": "ZT", - "23673": "YG", - "23762": "TD", - "23769": "ZS", - "23780": "QJ", - "23884": "QK", - "24055": "XH", - "24113": "DC", - "24162": "ZC", - "24191": "GA", - "24273": "QJ", - "24324": "NL", - "24377": "TD", - "24378": "QJ", - "24439": "PF", - "24554": "ZS", - "24683": "TD", - "24694": "WE", - "24733": "LK", - "24925": "TN", - "25094": "ZG", - "25100": "XQ", - "25103": "XH", - "25153": "PB", - "25170": "PB", - "25179": "KG", - "25203": "PB", - "25240": "ZS", - "25282": "FB", - "25303": "NA", - "25324": "KG", - "25341": "ZY", - "25373": "WZ", - "25375": "XJ", - "25384": "A", - "25457": "A", - "25528": "SD", - "25530": "SC", - "25552": "TD", - "25774": "ZC", - "25874": "ZC", - "26044": "YW", - "26080": "WM", - "26292": "PB", - "26333": "PB", - "26355": "ZY", - "26366": "CZ", - "26397": "ZC", - "26399": "QJ", - "26415": "ZS", - "26451": "SB", - "26526": "ZC", - "26552": "JG", - "26561": "TD", - "26588": "JG", - "26597": "CZ", - "26629": "ZS", - "26638": "YL", - "26646": "XQ", - "26653": "KG", - "26657": "XJ", - "26727": "HG", - "26894": "ZC", - "26937": "ZS", - "26946": "ZC", - "26999": "KJ", - "27099": "KJ", - "27449": "YQ", - "27481": "XS", - "27542": "ZS", - "27663": "ZS", - "27748": "TS", - "27784": "SC", - "27788": "ZD", - "27795": "TD", - "27812": "O", - "27850": "PB", - "27852": "MB", - "27895": "SL", - "27898": "PL", - "27973": "QJ", - "27981": "KH", - "27986": "HX", - "27994": "XJ", - "28044": "YC", - "28065": "WG", - "28177": "SM", - "28267": "QJ", - "28291": "KH", - "28337": "ZQ", - "28463": "TL", - "28548": "DC", - "28601": "TD", - "28689": "PB", - "28805": "JG", - "28820": "QG", - "28846": "PB", - "28952": "TD", - "28975": "ZC", - "29100": "A", - "29325": "QJ", - "29575": "SL", - "29602": "FB", - "30010": "TD", - "30044": "CX", - "30058": "PF", - "30091": "YSP", - "30111": "YN", - "30229": "XJ", - "30427": "SC", - "30465": "SX", - "30631": "YQ", - "30655": "QJ", - "30684": "QJG", - "30707": "SD", - "30729": "XH", - "30796": "LG", - "30917": "PB", - "31074": "NM", - "31085": "JZ", - "31109": "SC", - "31181": "ZC", - "31192": "MLB", - "31293": "JQ", - "31400": "YX", - "31584": "YJ", - "31896": "ZN", - "31909": "ZY", - "31995": "XJ", - "32321": "PF", - "32327": "ZY", - "32418": "HG", - "32420": "XQ", - "32421": "HG", - "32438": "LG", - "32473": "GJ", - "32488": "TD", - "32521": "QJ", - "32527": "PB", - "32562": "ZSQ", - "32564": "JZ", - "32735": "ZD", - "32793": "PB", - "33071": "PF", - "33098": "XL", - "33100": "YA", - "33152": "PB", - "33261": "CX", - "33324": "BP", - "33333": "TD", - "33406": "YA", - "33426": "WM", - "33432": "PB", - "33445": "JG", - "33486": "ZN", - "33493": "TS", - "33507": "QJ", - "33540": "QJ", - "33544": "ZC", - "33564": "XQ", - "33617": "YT", - "33632": "QJ", - "33636": "XH", - "33637": "YX", - "33694": "WG", - "33705": "PF", - "33728": "YW", - "33882": "SR", - "34067": "WM", - "34074": "YW", - "34121": "QJ", - "34255": "ZC", - "34259": "XL", - "34425": "JH", - "34430": "XH", - "34485": "KH", - "34503": "YS", - "34532": "HG", - "34552": "XS", - "34558": "YE", - "34593": "ZL", - "34660": "YQ", - "34892": "XH", - "34928": "SC", - "34999": "QJ", - "35048": "PB", - "35059": "SC", - "35098": "ZC", - "35203": "TQ", - "35265": "JX", - "35299": "JX", - "35782": "SZ", - "35828": "YS", - "35830": "E", - "35843": "TD", - "35895": "YG", - "35977": "MH", - "36158": "JG", - "36228": "QJ", - "36426": "XQ", - "36466": "DC", - "36710": "JC", - "36711": "ZYG", - "36767": "PB", - "36866": "SK", - "36951": "YW", - "37034": "YX", - "37063": "XH", - "37218": "ZC", - "37325": "ZC", - "38063": "PB", - "38079": "TD", - "38085": "QY", - "38107": "DC", - "38116": "TD", - "38123": "YD", - "38224": "HG", - "38241": "XTC", - "38271": "ZC", - "38415": "YE", - "38426": "KH", - "38461": "YD", - "38463": "AE", - "38466": "PB", - "38477": "XJ", - "38518": "YT", - "38551": "WK", - "38585": "ZC", - "38704": "XS", - "38739": "LJ", - "38761": "GJ", - "38808": "SQ", - "39048": "JG", - "39049": "XJ", - "39052": "HG", - "39076": "CZ", - "39271": "XT", - "39534": "TD", - "39552": "TD", - "39584": "PB", - "39647": "SB", - "39730": "LG", - "39748": "TPB", - "40109": "ZQ", - "40479": "ND", - "40516": "HG", - "40536": "HG", - "40583": "QJ", - "40765": "YQ", - "40784": "QJ", - "40840": "YK", - "40863": "QJG" - }; - - var _checkPYCh = function (ch) { - var uni = ch.charCodeAt(0); - // 如果不在汉字处理范围之内,返回原字符,也可以调用自己的处理函数 - if (uni > 40869 || uni < 19968) - return ch; // dealWithOthers(ch); - return (oMultiDiff[uni] ? oMultiDiff[uni] : (_ChineseFirstPY.charAt(uni - 19968))); - }; - - var _mkPYRslt = function (arr) { - var arrRslt = [""], k; - for (var i = 0, len = arr.length; i < len; i++) { - var str = arr[i]; - var strlen = str.length; - if (strlen == 1) { - for (k = 0; k < arrRslt.length; k++) { - arrRslt[k] += str; - } - } else { - var tmpArr = arrRslt.slice(0); - arrRslt = []; - for (k = 0; k < strlen; k++) { - // 复制一个相同的arrRslt - var tmp = tmpArr.slice(0); - // 把当前字符str[k]添加到每个元素末尾 - for (var j = 0; j < tmp.length; j++) { - tmp[j] += str.charAt(k); - } - // 把复制并修改后的数组连接到arrRslt上 - arrRslt = arrRslt.concat(tmp); - } - } - } - return arrRslt.join("").toLowerCase(); - }; - - _.extend(BI, { - makeFirstPY: function (str) { - if (typeof (str) != "string") - return '' + str; - var arrResult = []; // 保存中间结果的数组 - for (var i = 0, len = str.length; i < len; i++) { - // 获得unicode码 - var ch = str.charAt(i); - // 检查该unicode码是否在处理范围之内,在则返回该码对映汉字的拼音首字母,不在则调用其它函数处理 - arrResult.push(_checkPYCh(ch)); - } - // 处理arrResult,返回所有可能的拼音首字母串数组 - return _mkPYRslt(arrResult); - } - }); -})();/** - * Detect Element Resize. - * Forked in order to guard against unsafe 'window' and 'document' references. - * - * https://github.com/sdecima/javascript-detect-element-resize - * Sebastian Decima - * - * version: 0.5.3 - **/ -!(function () { - // Check `document` and `window` in case of server-side rendering - var _window - if (typeof window !== 'undefined') { - _window = window - } else if (typeof self !== 'undefined') { - _window = self - } else { - _window = this - } - - var addEventListener = typeof document !== 'undefined' && document.addEventListener; - var stylesCreated = false; - - if (addEventListener) { - var requestFrame = (function () { - var raf = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || - function (fn) { - return _window.setTimeout(fn, 20); - }; - return function (fn) { - return raf(fn); - }; - })(); - - var cancelFrame = (function () { - var cancel = _window.cancelAnimationFrame || _window.mozCancelAnimationFrame || _window.webkitCancelAnimationFrame || - _window.clearTimeout; - return function (id) { - return cancel(id); - }; - })(); - - var resetTriggers = function (element) { - var triggers = element.__resizeTriggers__, - expand = triggers.firstElementChild, - contract = triggers.lastElementChild, - expandChild = expand.firstElementChild; - contract.scrollLeft = contract.scrollWidth; - contract.scrollTop = contract.scrollHeight; - expandChild.style.width = expand.offsetWidth + 1 + 'px'; - expandChild.style.height = expand.offsetHeight + 1 + 'px'; - expand.scrollLeft = expand.scrollWidth; - expand.scrollTop = expand.scrollHeight; - }; - - var checkTriggers = function (element) { - return element.offsetWidth !== element.__resizeLast__.width || - element.offsetHeight !== element.__resizeLast__.height; - } - - var scrollListener = function (e) { - var element = this; - resetTriggers(this); - if (this.__resizeRAF__) cancelFrame(this.__resizeRAF__); - this.__resizeRAF__ = requestFrame(function () { - if (checkTriggers(element)) { - element.__resizeLast__.width = element.offsetWidth; - element.__resizeLast__.height = element.offsetHeight; - element.__resizeListeners__.forEach(function (fn) { - fn.call(element, e); - }); - } - }); - }; - - /* Detect CSS Animations support to detect element display/re-attach */ - var animation = false, - animationstring = 'animation', - keyframeprefix = '', - animationstartevent = 'animationstart', - domPrefixes = 'Webkit Moz O ms'.split(' '), - startEvents = 'webkitAnimationStart animationstart oAnimationStart MSAnimationStart'.split(' '), - pfx = ''; - { - var elm = document.createElement('fakeelement'); - if (elm.style.animationName !== undefined) { - animation = true; - } - - if (animation === false) { - for (var i = 0; i < domPrefixes.length; i++) { - if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) { - pfx = domPrefixes[i]; - animationstring = pfx + 'Animation'; - keyframeprefix = '-' + pfx.toLowerCase() + '-'; - animationstartevent = startEvents[i]; - animation = true; - break; - } - } - } - } - - var animationName = 'resizeanim'; - var animationKeyframes = '@' + keyframeprefix + 'keyframes ' + animationName + ' { from { opacity: 0; } to { opacity: 0; } } '; - var animationStyle = keyframeprefix + 'animation: 1ms ' + animationName + '; '; - } - - var createStyles = function () { - if (!stylesCreated) { - //opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 - var css = (animationKeyframes ? animationKeyframes : '') + - '.resize-triggers { ' + (animationStyle ? animationStyle : '') + 'visibility: hidden; opacity: 0; } ' + - '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', - head = document.head || document.getElementsByTagName('head')[0], - style = document.createElement('style'); - - style.type = 'text/css'; - if (style.styleSheet) { - style.styleSheet.cssText = css; - } else { - style.appendChild(document.createTextNode(css)); - } - - head.appendChild(style); - stylesCreated = true; - } - } - - var addResizeListener = function (element, fn) { - if (addEventListener){ - if (!element.__resizeTriggers__) { - if (getComputedStyle(element).position === 'static') element.style.position = 'relative'; - createStyles(); - element.__resizeLast__ = {}; - element.__resizeListeners__ = []; - (element.__resizeTriggers__ = document.createElement('div')).className = 'resize-triggers'; - element.__resizeTriggers__.innerHTML = '<div class="expand-trigger"><div></div></div>' + - '<div class="contract-trigger"></div>'; - element.appendChild(element.__resizeTriggers__); - resetTriggers(element); - element.addEventListener('scroll', scrollListener, true); - - /* Listen for a css animation to detect element display/re-attach */ - animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { - if (e.animationName === animationName) - resetTriggers(element); - }); - } - element.__resizeListeners__.push(fn); - - } else { - element.attachEvent('onresize', fn); - } - }; - - var removeResizeListener = function (element, fn) { - if (addEventListener) { - element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); - if (!element.__resizeListeners__.length) { - element.removeEventListener('scroll', scrollListener, true); - element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__); - } - } else { - element.detachEvent('onresize', fn); - } - }; - - BI.ResizeDetector = { - addResizeListener: function (widget, fn) { - addResizeListener(widget.element[0], fn); - return function () { - removeResizeListener(widget.element[0], fn); - } - }, - removeResizeListener: function (widget, fn) { - removeResizeListener(widget.element[0], fn); - } - }; -}()); -; -(function () { - function defaultComparator(a, b) { - return a < b; - } - - BI.Heap = function (items, comparator) { - this._items = items || []; - this._size = this._items.length; - this._comparator = comparator || defaultComparator; - this._heapify(); - }; - - BI.Heap.prototype = { - constructor: BI.Heap, - empty: function () { - return this._size === 0; - }, - - pop: function () { - if (this._size === 0) { - return; - } - - var elt = this._items[0]; - - var lastElt = this._items.pop(); - this._size--; - - if (this._size > 0) { - this._items[0] = lastElt; - this._sinkDown(0); - } - - return elt; - }, - - push: function (item) { - this._items[this._size++] = item; - this._bubbleUp(this._size - 1); - }, - - size: function () { - return this._size; - }, - - peek: function () { - if (this._size === 0) { - return; - } - - return this._items[0]; - }, - - _heapify: function () { - for (var index = Math.floor((this._size + 1) / 2); index >= 0; index--) { - this._sinkDown(index); - } - }, - - _bubbleUp: function (index) { - var elt = this._items[index]; - while (index > 0) { - var parentIndex = Math.floor((index + 1) / 2) - 1; - var parentElt = this._items[parentIndex]; - - // if parentElt < elt, stop - if (this._comparator(parentElt, elt)) { - return; - } - - // swap - this._items[parentIndex] = elt; - this._items[index] = parentElt; - index = parentIndex; - } - }, - - _sinkDown: function (index) { - var elt = this._items[index]; - - while (true) { - var leftChildIndex = 2 * (index + 1) - 1; - var rightChildIndex = 2 * (index + 1); - var swapIndex = -1; - - if (leftChildIndex < this._size) { - var leftChild = this._items[leftChildIndex]; - if (this._comparator(leftChild, elt)) { - swapIndex = leftChildIndex; - } - } - - if (rightChildIndex < this._size) { - var rightChild = this._items[rightChildIndex]; - if (this._comparator(rightChild, elt)) { - if (swapIndex === -1 || - this._comparator(rightChild, this._items[swapIndex])) { - swapIndex = rightChildIndex; - } - } - } - - // if we don't have a swap, stop - if (swapIndex === -1) { - return; - } - - this._items[index] = this._items[swapIndex]; - this._items[swapIndex] = elt; - index = swapIndex; - } - } - } -})(); -;(function () { - var clamp = function (min, value, max) { - if (value < min) { - return min; - } - if (value > max) { - return max; - } - return value; - }; - - var BUFFER_ROWS = 5; - var NO_ROWS_SCROLL_RESULT = { - index: 0, - offset: 0, - position: 0, - contentHeight: 0 - }; - - BI.TableScrollHelper = function (rowCount, - defaultRowHeight, - viewportHeight, - rowHeightGetter) { - this._rowOffsets = BI.PrefixIntervalTree.uniform(rowCount, defaultRowHeight); - this._storedHeights = new Array(rowCount); - for (var i = 0; i < rowCount; ++i) { - this._storedHeights[i] = defaultRowHeight; - } - this._rowCount = rowCount; - this._position = 0; - this._contentHeight = rowCount * defaultRowHeight; - this._defaultRowHeight = defaultRowHeight; - this._rowHeightGetter = rowHeightGetter ? - rowHeightGetter : function () { - return defaultRowHeight - }; - this._viewportHeight = viewportHeight; - - this._updateHeightsInViewport(0, 0); - }; - - BI.TableScrollHelper.prototype = { - constructor: BI.TableScrollHelper, - setRowHeightGetter: function (rowHeightGetter) { - this._rowHeightGetter = rowHeightGetter; - }, - - setViewportHeight: function (viewportHeight) { - this._viewportHeight = viewportHeight; - }, - - getContentHeight: function () { - return this._contentHeight; - }, - - _updateHeightsInViewport: function (firstRowIndex, - firstRowOffset) { - var top = firstRowOffset; - var index = firstRowIndex; - while (top <= this._viewportHeight && index < this._rowCount) { - this._updateRowHeight(index); - top += this._storedHeights[index]; - index++; - } - }, - - _updateHeightsAboveViewport: function (firstRowIndex) { - var index = firstRowIndex - 1; - while (index >= 0 && index >= firstRowIndex - BUFFER_ROWS) { - var delta = this._updateRowHeight(index); - this._position += delta; - index--; - } - }, - - _updateRowHeight: function (rowIndex) { - if (rowIndex < 0 || rowIndex >= this._rowCount) { - return 0; - } - var newHeight = this._rowHeightGetter(rowIndex); - if (newHeight !== this._storedHeights[rowIndex]) { - var change = newHeight - this._storedHeights[rowIndex]; - this._rowOffsets.set(rowIndex, newHeight); - this._storedHeights[rowIndex] = newHeight; - this._contentHeight += change; - return change; - } - return 0; - }, - - getRowPosition: function (rowIndex) { - this._updateRowHeight(rowIndex); - return this._rowOffsets.sumUntil(rowIndex); - }, - - scrollBy: function (delta) { - if (this._rowCount === 0) { - return NO_ROWS_SCROLL_RESULT; - } - var firstRow = this._rowOffsets.greatestLowerBound(this._position); - firstRow = clamp(firstRow, 0, Math.max(this._rowCount - 1, 0)); - var firstRowPosition = this._rowOffsets.sumUntil(firstRow); - var rowIndex = firstRow; - var position = this._position; - - var rowHeightChange = this._updateRowHeight(rowIndex); - if (firstRowPosition !== 0) { - position += rowHeightChange; - } - var visibleRowHeight = this._storedHeights[rowIndex] - - (position - firstRowPosition); - - if (delta >= 0) { - - while (delta > 0 && rowIndex < this._rowCount) { - if (delta < visibleRowHeight) { - position += delta; - delta = 0; - } else { - delta -= visibleRowHeight; - position += visibleRowHeight; - rowIndex++; - } - if (rowIndex < this._rowCount) { - this._updateRowHeight(rowIndex); - visibleRowHeight = this._storedHeights[rowIndex]; - } - } - } else if (delta < 0) { - delta = -delta; - var invisibleRowHeight = this._storedHeights[rowIndex] - visibleRowHeight; - - while (delta > 0 && rowIndex >= 0) { - if (delta < invisibleRowHeight) { - position -= delta; - delta = 0; - } else { - position -= invisibleRowHeight; - delta -= invisibleRowHeight; - rowIndex--; - } - if (rowIndex >= 0) { - var change = this._updateRowHeight(rowIndex); - invisibleRowHeight = this._storedHeights[rowIndex]; - position += change; - } - } - } - - var maxPosition = this._contentHeight - this._viewportHeight; - position = clamp(position, 0, maxPosition); - this._position = position; - var firstRowIndex = this._rowOffsets.greatestLowerBound(position); - firstRowIndex = clamp(firstRowIndex, 0, Math.max(this._rowCount - 1, 0)); - firstRowPosition = this._rowOffsets.sumUntil(firstRowIndex); - var firstRowOffset = firstRowPosition - position; - - this._updateHeightsInViewport(firstRowIndex, firstRowOffset); - this._updateHeightsAboveViewport(firstRowIndex); - - return { - index: firstRowIndex, - offset: firstRowOffset, - position: this._position, - contentHeight: this._contentHeight - }; - }, - - _getRowAtEndPosition: function (rowIndex) { - // We need to update enough rows above the selected one to be sure that when - // we scroll to selected position all rows between first shown and selected - // one have most recent heights computed and will not resize - this._updateRowHeight(rowIndex); - var currentRowIndex = rowIndex; - var top = this._storedHeights[currentRowIndex]; - while (top < this._viewportHeight && currentRowIndex >= 0) { - currentRowIndex--; - if (currentRowIndex >= 0) { - this._updateRowHeight(currentRowIndex); - top += this._storedHeights[currentRowIndex]; - } - } - var position = this._rowOffsets.sumTo(rowIndex) - this._viewportHeight; - if (position < 0) { - position = 0; - } - return position; - }, - - scrollTo: function (position) { - if (this._rowCount === 0) { - return NO_ROWS_SCROLL_RESULT; - } - if (position <= 0) { - // If position less than or equal to 0 first row should be fully visible - // on top - this._position = 0; - this._updateHeightsInViewport(0, 0); - - return { - index: 0, - offset: 0, - position: this._position, - contentHeight: this._contentHeight - }; - } else if (position >= this._contentHeight - this._viewportHeight) { - // If position is equal to or greater than max scroll value, we need - // to make sure to have bottom border of last row visible. - var rowIndex = this._rowCount - 1; - position = this._getRowAtEndPosition(rowIndex); - } - this._position = position; - - var firstRowIndex = this._rowOffsets.greatestLowerBound(position); - firstRowIndex = clamp(firstRowIndex, 0, Math.max(this._rowCount - 1, 0)); - var firstRowPosition = this._rowOffsets.sumUntil(firstRowIndex); - var firstRowOffset = firstRowPosition - position; - - this._updateHeightsInViewport(firstRowIndex, firstRowOffset); - this._updateHeightsAboveViewport(firstRowIndex); - - return { - index: firstRowIndex, - offset: firstRowOffset, - position: this._position, - contentHeight: this._contentHeight - }; - }, - - /** - * Allows to scroll to selected row with specified offset. It always - * brings that row to top of viewport with that offset - */ - scrollToRow: function (rowIndex, offset) { - rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0)); - offset = clamp(offset, -this._storedHeights[rowIndex], 0); - var firstRow = this._rowOffsets.sumUntil(rowIndex); - return this.scrollTo(firstRow - offset); - }, - - /** - * Allows to scroll to selected row by bringing it to viewport with minimal - * scrolling. This that if row is fully visible, scroll will not be changed. - * If top border of row is above top of viewport it will be scrolled to be - * fully visible on the top of viewport. If the bottom border of row is - * below end of viewport, it will be scrolled up to be fully visible on the - * bottom of viewport. - */ - scrollRowIntoView: function (rowIndex) { - rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0)); - var rowBegin = this._rowOffsets.sumUntil(rowIndex); - var rowEnd = rowBegin + this._storedHeights[rowIndex]; - if (rowBegin < this._position) { - return this.scrollTo(rowBegin); - } else if (this._position + this._viewportHeight < rowEnd) { - var position = this._getRowAtEndPosition(rowIndex); - return this.scrollTo(position); - } - return this.scrollTo(this._position); - } - }; - -})(); -// Data structure that allows to store values and assign positions to them -// in a way to minimize changing positions of stored values when new ones are -// added or when some values are replaced. Stored elements are alwasy assigned -// a consecutive set of positoins startin from 0 up to count of elements less 1 -// Following actions can be executed -// * get position assigned to given value (null if value is not stored) -// * create new entry for new value and get assigned position back -// * replace value that is furthest from specified value range with new value -// and get it's position back -// All operations take amortized log(n) time where n is number of elements in -// the set. -BI.IntegerBufferSet = function () { - this._valueToPositionMap = {}; - this._size = 0; - this._smallValues = new BI.Heap( - [], // Initial data in the heap - this._smallerComparator - ); - this._largeValues = new BI.Heap( - [], // Initial data in the heap - this._greaterComparator - ); - -}; - -BI.IntegerBufferSet.prototype = { - constructor: BI.IntegerBufferSet, - getSize: function () /*number*/ { - return this._size; - }, - - getValuePosition: function (/*number*/ value) /*?number*/ { - if (this._valueToPositionMap[value] === undefined) { - return null; - } - return this._valueToPositionMap[value]; - }, - - getNewPositionForValue: function (/*number*/ value) /*number*/ { - var newPosition = this._size; - this._size++; - this._pushToHeaps(newPosition, value); - this._valueToPositionMap[value] = newPosition; - return newPosition; - }, - - replaceFurthestValuePosition: function (/*number*/ lowValue, - /*number*/ highValue, - /*number*/ newValue) /*?number*/ { - this._cleanHeaps(); - if (this._smallValues.empty() || this._largeValues.empty()) { - // Threre are currently no values stored. We will have to create new - // position for this value. - return null; - } - - var minValue = this._smallValues.peek().value; - var maxValue = this._largeValues.peek().value; - if (minValue >= lowValue && maxValue <= highValue) { - // All values currently stored are necessary, we can't reuse any of them. - return null; - } - - var valueToReplace; - if (lowValue - minValue > maxValue - highValue) { - // minValue is further from provided range. We will reuse it's position. - valueToReplace = minValue; - this._smallValues.pop(); - } else { - valueToReplace = maxValue; - this._largeValues.pop(); - } - var position = this._valueToPositionMap[valueToReplace]; - delete this._valueToPositionMap[valueToReplace]; - this._valueToPositionMap[newValue] = position; - this._pushToHeaps(position, newValue); - - return position; - }, - - _pushToHeaps: function (/*number*/ position, /*number*/ value) { - var element = { - position: position, - value:value - }; - // We can reuse the same object in both heaps, because we don't mutate them - this._smallValues.push(element); - this._largeValues.push(element); - }, - - _cleanHeaps: function () { - // We not usually only remove object from one heap while moving value. - // Here we make sure that there is no stale data on top of heaps. - this._cleanHeap(this._smallValues); - this._cleanHeap(this._largeValues); - var minHeapSize = - Math.min(this._smallValues.size(), this._largeValues.size()); - var maxHeapSize = - Math.max(this._smallValues.size(), this._largeValues.size()); - if (maxHeapSize > 10 * minHeapSize) { - // There are many old values in one of heaps. We nned to get rid of them - // to not use too avoid memory leaks - this._recreateHeaps(); - } - }, - - _recreateHeaps: function () { - var sourceHeap = this._smallValues.size() < this._largeValues.size() ? - this._smallValues : - this._largeValues; - var newSmallValues = new Heap( - [], // Initial data in the heap - this._smallerComparator - ); - var newLargeValues = new Heap( - [], // Initial datat in the heap - this._greaterComparator - ); - while (!sourceHeap.empty()) { - var element = sourceHeap.pop(); - // Push all stil valid elements to new heaps - if (this._valueToPositionMap[element.value] !== undefined) { - newSmallValues.push(element); - newLargeValues.push(element); - } - } - this._smallValues = newSmallValues; - this._largeValues = newLargeValues; - }, - - _cleanHeap: function (/*object*/ heap) { - while (!heap.empty() && - this._valueToPositionMap[heap.peek().value] === undefined) { - heap.pop(); - } - }, - - _smallerComparator: function (/*object*/ lhs, /*object*/ rhs) /*boolean*/ { - return lhs.value < rhs.value; - }, - - _greaterComparator: function (/*object*/ lhs, /*object*/ rhs) /*boolean*/ { - return lhs.value > rhs.value; - } -}; -; -!(function () { - BI.LinkHashMap = function () { - this.array = []; - this.map = {}; - }; - BI.LinkHashMap.prototype = { - constructor: BI.LinkHashMap, - has: function (key) { - if (key in this.map) { - return true; - } - return false; - }, - - add: function (key, value) { - if (typeof key == 'undefined') { - return; - } - if (key in this.map) { - this.map[key] = value; - } else { - this.array.push(key); - this.map[key] = value; - } - }, - - remove: function (key) { - if (key in this.map) { - delete this.map[key]; - for (var i = 0; i < this.array.length; i++) { - if (this.array[i] == key) { - this.array.splice(i, 1); - break; - } - } - } - }, - - size: function () { - return this.array.length; - }, - - each: function (fn, scope) { - var scope = scope || window; - var fn = fn || null; - if (fn == null || typeof (fn) != "function") { - return; - } - for (var i = 0; i < this.array.length; i++) { - var key = this.array[i]; - var value = this.map[key]; - var re = fn.call(scope, key, value, i, this.array, this.map); - if (re == false) { - break; - } - } - }, - - get: function (key) { - return this.map[key]; - }, - - toArray: function () { - var array = []; - this.each(function (key, value) { - array.push(value); - }) - return array; - } - } -})();window.BI = window.BI || {}; - -$.extend(BI, { - $defaultImport: function (options) { - var config = $.extend({ - op: 'resource', - path: null, - type: null, - must: false - }, options); - config.url = BI.servletURL + '?op=' + config.op + '&resource=' + config.path; - this.$import(config.url, config.type,config.must); - }, - $import: function () { - var _LOADED = {}; // alex:保存加载过的 - function loadReady(src, must) { - var $scripts = $("head script"); - $.each($scripts, function (i, item) { - if (item.src.indexOf(src) != -1) { - _LOADED[src] = true; - } - }); - var $links = $("head link"); - $.each($links, function (i, item) { - if (item.href.indexOf(src) != -1 && must) { - _LOADED[src] = false; - $(item).remove(); - } - }); - } - - // must=true 强行加载 - return function (src, ext, must) { - loadReady(src, must); - // alex:如果已经加载过了的,直接return - if (_LOADED[src] === true) { - return; - } - if (ext === 'css') { - var link = document.createElement('link'); - link.rel = 'stylesheet'; - link.type = 'text/css'; - link.href = src; - var head = document.getElementsByTagName('head')[0]; - head.appendChild(link); - _LOADED[src] = true; - } else { - // alex:这里用同步调用的方式,必须等待ajax完成 - $.ajax({ - url: src, - dataType: "script", // alex:指定dataType为script,jquery会帮忙做globalEval的事情 - async: false, - cache: true, - complete: function (res, status) { - /* - * alex:发现jquery会很智能地判断一下返回的数据类型是不是script,然后做一个globalEval - * 所以当status为success时就不需要再把其中的内容加到script里面去了 - */ - if (status == 'success') { - _LOADED[src] = true; - } - } - }) - } - } - }() -});; -!(function () { - BI.LRU = function (limit) { - this.size = 0; - this.limit = limit; - this.head = this.tail = undefined; - this._keymap = {}; - }; - - var p = BI.LRU.prototype; - - p.put = function (key, value) { - var removed; - if (this.size === this.limit) { - removed = this.shift(); - } - - var entry = this.get(key, true); - if (!entry) { - entry = { - key: key - }; - this._keymap[key] = entry; - if (this.tail) { - this.tail.newer = entry; - entry.older = this.tail - } else { - this.head = entry - } - this.tail = entry; - this.size++; - } - entry.value = value; - - return removed; - }; - - p.shift = function () { - var entry = this.head; - if (entry) { - this.head = this.head.newer; - this.head.older = undefined; - entry.newer = entry.older = undefined; - this._keymap[entry.key] = undefined; - this.size--; - } - return entry; - }; - - - p.get = function (key, returnEntry) { - var entry = this._keymap[key]; - if (entry === undefined) return; - if (entry === this.tail) { - return returnEntry - ? entry - : entry.value - } - // HEAD--------------TAIL - // <.older .newer> - // <--- add direction -- - // A B C <D> E - if (entry.newer) { - if (entry === this.head) { - this.head = entry.newer - } - entry.newer.older = entry.older; // C <-- E. - } - if (entry.older) { - entry.older.newer = entry.newer; // C. --> E - } - entry.newer = undefined; // D --x - entry.older = this.tail; // D. --> E - if (this.tail) { - this.tail.newer = entry; // E. <-- D - } - this.tail = entry; - return returnEntry - ? entry - : entry.value - }; -})();; -!(function () { - var MD5 = function (hexcase) { - this.hexcase = !hexcase ? 0 : 1; - /* hex output format. 0 - lowercase; 1 - uppercase */ - this.b64pad = ""; - /* base-64 pad character. "=" for strict RFC compliance */ - this.chrsz = 8; - /* bits per input character. 8 - ASCII; 16 - Unicode */ - }; - - /* - * These are the functions you'll usually want to call - * They take string arguments and return either hex or base-64 encoded strings - */ - MD5.prototype.hex_md5 = function (s) { - return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz)); - }; - - MD5.prototype.hex_md5_salt = function (s) { - var md5ed = this.hex_md5(s); - - var items1 = []; - var items2 = []; - for (var i = 0; i < md5ed.length; i++) { - if (i % 2 === 0) { - items1.push(md5ed.charAt(i)); - } else { - items2.push(md5ed.charAt(i)); - } - } - var result = ":" + items1.join("") + items2.join(""); - return result; - }; - - MD5.prototype.b64_md5 = function (s) { - return this.binl2b64(this.core_md5(this.str2binl(s), s.length * this.chrsz)); - }; - - MD5.prototype.hex_hmac_md5 = function (key, data) { - return this.binl2hex(this.core_hmac_md5(key, data)); - }; - - MD5.prototype.b64_hmac_md5 = function (key, data) { - return this.binl2b64(this.core_hmac_md5(key, data)); - }; - - /* Backwards compatibility - same as hex_md5() */ - MD5.prototype.calcMD5 = function (s) { - return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz)); - }; - - MD5.prototype.core_md5 = function (x, len) { - /* append padding */ - x[len >> 5] |= 0x80 << ((len) % 32); - x[(((len + 64) >>> 9) << 4) + 14] = len; - - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; - - for (var i = 0; i < x.length; i += 16) { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; - - a = this.md5_ff(a, b, c, d, x[i + 0], 7, -680876936); - d = this.md5_ff(d, a, b, c, x[i + 1], 12, -389564586); - c = this.md5_ff(c, d, a, b, x[i + 2], 17, 606105819); - b = this.md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); - a = this.md5_ff(a, b, c, d, x[i + 4], 7, -176418897); - d = this.md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); - c = this.md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); - b = this.md5_ff(b, c, d, a, x[i + 7], 22, -45705983); - a = this.md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); - d = this.md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); - c = this.md5_ff(c, d, a, b, x[i + 10], 17, -42063); - b = this.md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); - a = this.md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); - d = this.md5_ff(d, a, b, c, x[i + 13], 12, -40341101); - c = this.md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); - b = this.md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); - - a = this.md5_gg(a, b, c, d, x[i + 1], 5, -165796510); - d = this.md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); - c = this.md5_gg(c, d, a, b, x[i + 11], 14, 643717713); - b = this.md5_gg(b, c, d, a, x[i + 0], 20, -373897302); - a = this.md5_gg(a, b, c, d, x[i + 5], 5, -701558691); - d = this.md5_gg(d, a, b, c, x[i + 10], 9, 38016083); - c = this.md5_gg(c, d, a, b, x[i + 15], 14, -660478335); - b = this.md5_gg(b, c, d, a, x[i + 4], 20, -405537848); - a = this.md5_gg(a, b, c, d, x[i + 9], 5, 568446438); - d = this.md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); - c = this.md5_gg(c, d, a, b, x[i + 3], 14, -187363961); - b = this.md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); - a = this.md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); - d = this.md5_gg(d, a, b, c, x[i + 2], 9, -51403784); - c = this.md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); - b = this.md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); - - a = this.md5_hh(a, b, c, d, x[i + 5], 4, -378558); - d = this.md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); - c = this.md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); - b = this.md5_hh(b, c, d, a, x[i + 14], 23, -35309556); - a = this.md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); - d = this.md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); - c = this.md5_hh(c, d, a, b, x[i + 7], 16, -155497632); - b = this.md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); - a = this.md5_hh(a, b, c, d, x[i + 13], 4, 681279174); - d = this.md5_hh(d, a, b, c, x[i + 0], 11, -358537222); - c = this.md5_hh(c, d, a, b, x[i + 3], 16, -722521979); - b = this.md5_hh(b, c, d, a, x[i + 6], 23, 76029189); - a = this.md5_hh(a, b, c, d, x[i + 9], 4, -640364487); - d = this.md5_hh(d, a, b, c, x[i + 12], 11, -421815835); - c = this.md5_hh(c, d, a, b, x[i + 15], 16, 530742520); - b = this.md5_hh(b, c, d, a, x[i + 2], 23, -995338651); - - a = this.md5_ii(a, b, c, d, x[i + 0], 6, -198630844); - d = this.md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); - c = this.md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); - b = this.md5_ii(b, c, d, a, x[i + 5], 21, -57434055); - a = this.md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); - d = this.md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); - c = this.md5_ii(c, d, a, b, x[i + 10], 15, -1051523); - b = this.md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); - a = this.md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); - d = this.md5_ii(d, a, b, c, x[i + 15], 10, -30611744); - c = this.md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); - b = this.md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); - a = this.md5_ii(a, b, c, d, x[i + 4], 6, -145523070); - d = this.md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); - c = this.md5_ii(c, d, a, b, x[i + 2], 15, 718787259); - b = this.md5_ii(b, c, d, a, x[i + 9], 21, -343485551); - - a = this.safe_add(a, olda); - b = this.safe_add(b, oldb); - c = this.safe_add(c, oldc); - d = this.safe_add(d, oldd); - } - return Array(a, b, c, d); - - }; - - /* - * These functions implement the four basic operations the algorithm uses. - */ - MD5.prototype.md5_cmn = function (q, a, b, x, s, t) { - return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s), b); - }; - MD5.prototype.md5_ff = function (a, b, c, d, x, s, t) { - return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); - }; - MD5.prototype.md5_gg = function (a, b, c, d, x, s, t) { - return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); - }; - MD5.prototype.md5_hh = function (a, b, c, d, x, s, t) { - return this.md5_cmn(b ^ c ^ d, a, b, x, s, t); - }; - MD5.prototype.md5_ii = function (a, b, c, d, x, s, t) { - return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t); - }; - - /* - * Calculate the HMAC-MD5, of a key and some data - */ - MD5.prototype.core_hmac_md5 = function (key, data) { - var bkey = this.str2binl(key); - if (bkey.length > 16) - bkey = this.core_md5(bkey, key.length * this.chrsz); - - var ipad = Array(16), opad = Array(16); - for (var i = 0; i < 16; i++) { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - - var hash = this.core_md5(ipad.concat(this.str2binl(data)), 512 + data.length * this.chrsz); - return this.core_md5(opad.concat(hash), 512 + 128); - }; - - /* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ - MD5.prototype.safe_add = function (x, y) { - var lsw = (x & 0xFFFF) + (y & 0xFFFF); - var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return (msw << 16) | (lsw & 0xFFFF); - }; - - /* - * Bitwise rotate a 32-bit number to the left. - */ - MD5.prototype.bit_rol = function (num, cnt) { - return (num << cnt) | (num >>> (32 - cnt)); - }; - - /* - * Convert a string to an array of little-endian words - * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. - */ - MD5.prototype.str2binl = function (str) { - var bin = Array(); - var mask = (1 << this.chrsz) - 1; - for (var i = 0; i < str.length * this.chrsz; i += this.chrsz) - bin[i >> 5] |= (str.charCodeAt(i / this.chrsz) & mask) << (i % 32); - return bin; - }; - - /* - * Convert an array of little-endian words to a hex string. - */ - MD5.prototype.binl2hex = function (binarray) { - var hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; - var str = ""; - for (var i = 0; i < binarray.length * 4; i++) { - str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) - + hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF); - } - return str; - }; - - /* - * Convert an array of little-endian words to a base-64 string - */ - MD5.prototype.binl2b64 = function (binarray) { - var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var str = ""; - for (var i = 0; i < binarray.length * 4; i += 3) { - var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16) - | (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8) - | ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF); - for (var j = 0; j < 4; j++) { - if (i * 8 + j * 6 > binarray.length * 32) - str += this.b64pad; - else - str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F); - } - } - return str; - }; - BI.MD5 = new MD5(); -})();//线段树 -;(function () { - var parent = function (node) { - return Math.floor(node / 2); - }; - - var Int32Array = window.Int32Array || function (size) { - var xs = []; - for (var i = size - 1; i >= 0; --i) { - xs[i] = 0; - } - return xs; - }; - - var ceilLog2 = function (x) { - var y = 1; - while (y < x) { - y *= 2; - } - return y; - }; - - BI.PrefixIntervalTree = function (xs) { - this._size = xs.length; - this._half = ceilLog2(this._size); - this._heap = new Int32Array(2 * this._half); - - var i; - for (i = 0; i < this._size; ++i) { - this._heap[this._half + i] = xs[i]; - } - - for (i = this._half - 1; i > 0; --i) { - this._heap[i] = this._heap[2 * i] + this._heap[2 * i + 1]; - } - }; - - BI.PrefixIntervalTree.prototype = { - constructor: BI.PrefixIntervalTree, - set: function (index, value) { - var node = this._half + index; - this._heap[node] = value; - - node = parent(node); - for (; node !== 0; node = parent(node)) { - this._heap[node] = - this._heap[2 * node] + this._heap[2 * node + 1]; - } - }, - - get: function (index) { - var node = this._half + index; - return this._heap[node]; - }, - - getSize: function () { - return this._size; - }, - - /** - * get(0) + get(1) + ... + get(end - 1). - */ - sumUntil: function (end) { - if (end === 0) { - return 0; - } - - var node = this._half + end - 1; - var sum = this._heap[node]; - for (; node !== 1; node = parent(node)) { - if (node % 2 === 1) { - sum += this._heap[node - 1]; - } - } - - return sum; - }, - - /** - * get(0) + get(1) + ... + get(inclusiveEnd). - */ - sumTo: function (inclusiveEnd) { - return this.sumUntil(inclusiveEnd + 1); - }, - - /** - * sum get(begin) + get(begin + 1) + ... + get(end - 1). - */ - sum: function (begin, end) { - return this.sumUntil(end) - this.sumUntil(begin); - }, - - /** - * Returns the smallest i such that 0 <= i <= size and sumUntil(i) <= t, or - * -1 if no such i exists. - */ - greatestLowerBound: function (t) { - if (t < 0) { - return -1; - } - - var node = 1; - if (this._heap[node] <= t) { - return this._size; - } - - while (node < this._half) { - var leftSum = this._heap[2 * node]; - if (t < leftSum) { - node = 2 * node; - } else { - node = 2 * node + 1; - t -= leftSum; - } - } - - return node - this._half; - }, - - /** - * Returns the smallest i such that 0 <= i <= size and sumUntil(i) < t, or - * -1 if no such i exists. - */ - greatestStrictLowerBound: function (t) { - if (t <= 0) { - return -1; - } - - var node = 1; - if (this._heap[node] < t) { - return this._size; - } - - while (node < this._half) { - var leftSum = this._heap[2 * node]; - if (t <= leftSum) { - node = 2 * node; - } else { - node = 2 * node + 1; - t -= leftSum; - } - } - - return node - this._half; - }, - - /** - * Returns the smallest i such that 0 <= i <= size and t <= sumUntil(i), or - * size + 1 if no such i exists. - */ - leastUpperBound: function (t) { - return this.greatestStrictLowerBound(t) + 1; - }, - - /** - * Returns the smallest i such that 0 <= i <= size and t < sumUntil(i), or - * size + 1 if no such i exists. - */ - leastStrictUpperBound: function (t) { - return this.greatestLowerBound(t) + 1; - } - }; - - BI.PrefixIntervalTree.uniform = function (size, initialValue) { - var xs = []; - for (var i = size - 1; i >= 0; --i) { - xs[i] = initialValue; - } - - return new BI.PrefixIntervalTree(xs); - }; - - BI.PrefixIntervalTree.empty = function (size) { - return BI.PrefixIntervalTree.uniform(size, 0); - }; - -})(); -; -!(function () { - BI.Queue = function (capacity) { - this.capacity = capacity; - this.array = []; - }; - BI.Queue.prototype = { - constructor: BI.Queue, - - contains: function (v) { - return this.array.contains(v); - }, - - indexOf: function (v) { - return this.array.contains(v); - }, - - getElementByIndex: function(index) { - return this.array[index]; - }, - - push: function (v) { - this.array.push(v); - if (this.capacity && this.array.length > this.capacity) { - this.array.shift(); - } - }, - - pop: function () { - this.array.pop(); - }, - - shift: function () { - this.array.shift(); - }, - - unshift: function (v) { - this.array.unshift(v); - if (this.capacity && this.array.length > this.capacity) { - this.array.pop(); - } - }, - - remove: function (v) { - this.array.remove(v); - }, - - splice: function() { - this.array.splice.apply(this.array, arguments); - }, - - slice: function() { - this.array.slice.apply(this.array, arguments); - }, - - size: function () { - return this.array.length; - }, - - each: function (fn, scope) { - var scope = scope || window; - var fn = fn || null; - if (fn == null || typeof (fn) != "function") { - return; - } - for (var i = 0; i < this.array.length; i++) { - var re = fn.call(scope, i, this.array[i], this.array); - if (re == false) { - break; - } - } - }, - - toArray: function () { - return this.array; - }, - - fromArray: function (array) { - var self = this; - BI.each(array, function (i, v) { - self.push(v); - }) - }, - - clear: function () { - this.array.clear(); - } - } -})();!(function () { - var Section = function (height, width, x, y) { - this.height = height; - this.width = width; - this.x = x; - this.y = y; - - this._indexMap = {}; - this._indices = []; - }; - - Section.prototype = { - constructor: Section, - addCellIndex: function (index) { - if (!this._indexMap[index]) { - this._indexMap[index] = true; - this._indices.push(index); - } - }, - - getCellIndices: function () { - return this._indices - } - }; - - var SECTION_SIZE = 100; - BI.SectionManager = function (sectionSize) { - this._sectionSize = sectionSize || SECTION_SIZE; - this._cellMetadata = []; - this._sections = {}; - }; - - BI.SectionManager.prototype = { - constructor: BI.SectionManager, - getCellIndices: function (height, width, x, y) { - var indices = {}; - - BI.each(this.getSections(height, width, x, y), function (i, section) { - BI.each(section.getCellIndices(), function (j, index) { - indices[index] = index - }) - }); - - return BI.map(BI.keys(indices), function (i, index) { - return indices[index] - }); - }, - - getCellMetadata: function (index) { - return this._cellMetadata[index]; - }, - - getSections: function (height, width, x, y) { - var sectionXStart = Math.floor(x / this._sectionSize); - var sectionXStop = Math.floor((x + width - 1) / this._sectionSize); - var sectionYStart = Math.floor(y / this._sectionSize); - var sectionYStop = Math.floor((y + height - 1) / this._sectionSize); - - var sections = []; - - for (var sectionX = sectionXStart; sectionX <= sectionXStop; sectionX++) { - for (var sectionY = sectionYStart; sectionY <= sectionYStop; sectionY++) { - var key = sectionX + "." + sectionY; - - if (!this._sections[key]) { - this._sections[key] = new Section(this._sectionSize, this._sectionSize, sectionX * this._sectionSize, sectionY * this._sectionSize) - } - - sections.push(this._sections[key]) - } - } - - return sections - }, - - getTotalSectionCount: function () { - return BI.size(this._sections); - }, - - registerCell: function (cellMetadatum, index) { - this._cellMetadata[index] = cellMetadatum; - - BI.each(this.getSections(cellMetadatum.height, cellMetadatum.width, cellMetadatum.x, cellMetadatum.y), function (i, section) { - section.addCellIndex(index); - }); - } - } -})();if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { - -} else { - Set = function () { - this.set = {} - }; - Set.prototype.has = function (key) { - return this.set[key] !== undefined; - }; - Set.prototype.add = function (key) { - this.set[key] = 1 - }; - Set.prototype.clear = function () { - this.set = {} - }; -}; -(function () { - var clamp = function (value, min, max) { - if (value < min) { - return min; - } - if (value > max) { - return max; - } - return value; - }; - var MIN_BUFFER_ROWS = 6; - var MAX_BUFFER_ROWS = 10; - - BI.TableRowBuffer = function (rowsCount, - defaultRowHeight, - viewportHeight, - rowHeightGetter) { - this._bufferSet = new BI.IntegerBufferSet(); - this._defaultRowHeight = defaultRowHeight; - this._viewportRowsBegin = 0; - this._viewportRowsEnd = 0; - this._maxVisibleRowCount = Math.ceil(viewportHeight / defaultRowHeight) + 1; - // this._bufferRowsCount = Math.floor(this._maxVisibleRowCount / 2); - this._bufferRowsCount = clamp( - Math.floor(this._maxVisibleRowCount / 2), - MIN_BUFFER_ROWS, - MAX_BUFFER_ROWS - ); - this._rowsCount = rowsCount; - this._rowHeightGetter = rowHeightGetter; - this._rows = []; - this._viewportHeight = viewportHeight; - - }; - BI.TableRowBuffer.prototype = { - constructor: BI.TableRowBuffer, - - getRowsWithUpdatedBuffer: function () { - var remainingBufferRows = 2 * this._bufferRowsCount; - var bufferRowIndex = - Math.max(this._viewportRowsBegin - this._bufferRowsCount, 0); - while (bufferRowIndex < this._viewportRowsBegin) { - this._addRowToBuffer( - bufferRowIndex, - this._viewportRowsBegin, - this._viewportRowsEnd - 1 - ); - bufferRowIndex++; - remainingBufferRows--; - } - bufferRowIndex = this._viewportRowsEnd; - while (bufferRowIndex < this._rowsCount && remainingBufferRows > 0) { - this._addRowToBuffer( - bufferRowIndex, - this._viewportRowsBegin, - this._viewportRowsEnd - 1 - ); - bufferRowIndex++; - remainingBufferRows--; - } - return this._rows; - }, - - getRows: function (firstRowIndex, - firstRowOffset) { - var top = firstRowOffset; - var totalHeight = top; - var rowIndex = firstRowIndex; - var endIndex = - Math.min(firstRowIndex + this._maxVisibleRowCount, this._rowsCount); - - this._viewportRowsBegin = firstRowIndex; - while (rowIndex < endIndex || - (totalHeight < this._viewportHeight && rowIndex < this._rowsCount)) { - this._addRowToBuffer( - rowIndex, - firstRowIndex, - endIndex - 1 - ); - totalHeight += this._rowHeightGetter(rowIndex); - ++rowIndex; - // Store index after the last viewport row as end, to be able to - // distinguish when there are no rows rendered in viewport - this._viewportRowsEnd = rowIndex; - } - - return this._rows; - }, - - _addRowToBuffer: function (rowIndex, - firstViewportRowIndex, - lastViewportRowIndex) { - var rowPosition = this._bufferSet.getValuePosition(rowIndex); - var viewportRowsCount = lastViewportRowIndex - firstViewportRowIndex + 1; - var allowedRowsCount = viewportRowsCount + this._bufferRowsCount * 2; - if (rowPosition === null && - this._bufferSet.getSize() >= allowedRowsCount) { - rowPosition = - this._bufferSet.replaceFurthestValuePosition( - firstViewportRowIndex, - lastViewportRowIndex, - rowIndex - ); - } - if (rowPosition === null) { - // We can't reuse any of existing positions for this row. We have to - // create new position - rowPosition = this._bufferSet.getNewPositionForValue(rowIndex); - this._rows[rowPosition] = rowIndex; - } else { - // This row already is in the table with rowPosition position or it - // can replace row that is in that position - this._rows[rowPosition] = rowIndex; - } - } - } - -})(); -; -(function () { - BI.Tree = function () { - this.root = new BI.Node(BI.UUID()); - }; - - BI.Tree.prototype = { - constructor: BI.Tree, - addNode: function (node, newNode, index) { - if (BI.isNull(newNode)) { - this.root.addChild(node, index); - } else if (BI.isNull(node)) { - this.root.addChild(newNode, index); - } else { - node.addChild(newNode, index); - } - }, - - isRoot: function (node) { - return node === this.root; - }, - - getRoot: function () { - return this.root; - }, - - clear: function () { - this.root.clear(); - }, - - initTree: function (nodes) { - var self = this; - this.clear(); - var queue = []; - BI.each(nodes, function (i, node) { - var n = new BI.Node(node); - n.set("data", node); - self.addNode(n); - queue.push(n); - }); - while (!BI.isEmpty(queue)) { - var parent = queue.shift(); - var node = parent.get("data"); - BI.each(node.children, function (i, child) { - var n = new BI.Node(child); - n.set("data", child); - queue.push(n); - self.addNode(parent, n); - }) - } - }, - - _toJSON: function (node) { - var self = this; - var children = []; - BI.each(node.getChildren(), function (i, child) { - children.push(self._toJSON(child)); - }); - return BI.extend({ - id: node.id - }, BI.deepClone(node.get("data")), (children.length > 0 ? { - children: children - } : {})); - }, - - toJSON: function (node) { - var self = this, result = []; - BI.each((node || this.root).getChildren(), function (i, child) { - result.push(self._toJSON(child)); - }); - return result; - }, - - _toJSONWithNode: function (node) { - var self = this; - var children = []; - BI.each(node.getChildren(), function (i, child) { - children.push(self._toJSONWithNode(child)); - }); - return BI.extend({ - id: node.id - }, BI.deepClone(node.get("data")), { - node: node - }, (children.length > 0 ? { - children: children - } : {})); - }, - - toJSONWithNode: function (node) { - var self = this, result = []; - BI.each((node || this.root).getChildren(), function (i, child) { - result.push(self._toJSONWithNode(child)); - }); - return result; - }, - - search: function (root, target, param) { - if (!(root instanceof BI.Node)) { - return arguments.callee.apply(this, [this.root, root, target]); - } - var self = this, next = null; - - if (BI.isNull(target)) { - return null; - } - if (BI.isEqual(root[param || "id"], target)) { - return root; - } - BI.any(root.getChildren(), function (i, child) { - next = self.search(child, target, param); - if (null !== next) { - return true; - } - }); - return next; - }, - - _traverse: function (node, callback) { - var queue = []; - queue.push(node); - while (!BI.isEmpty(queue)) { - var temp = queue.shift(); - var b = callback && callback(temp); - if (b === false) { - break; - } - if (b === true) { - continue; - } - if (temp != null) { - queue = queue.concat(temp.getChildren()); - } - } - }, - - traverse: function (callback) { - this._traverse(this.root, callback); - }, - - _recursion: function (node, route, callback) { - var self = this; - return BI.every(node.getChildren(), function (i, child) { - var next = BI.clone(route); - next.push(child.id); - var b = callback && callback(child, next); - if (b === false) { - return false; - } - if (b === true) { - return true; - } - return self._recursion(child, next, callback); - }); - }, - - recursion: function (callback) { - this._recursion(this.root, [], callback); - }, - - inOrderTraverse: function (callback) { - this._inOrderTraverse(this.root, callback); - }, - - //中序遍历(递归) - _inOrderTraverse: function (node, callback) { - if (node != null) { - this._inOrderTraverse(node.getLeft()); - callback && callback(node); - this._inOrderTraverse(node.getRight()); - } - }, - - //中序遍历(非递归) - nrInOrderTraverse: function (callback) { - - var stack = []; - var node = this.root; - while (node != null || !BI.isEmpty(stack)) { - while (node != null) { - stack.push(node); - node = node.getLeft(); - } - node = stack.pop(); - callback && callback(node); - node = node.getRight(); - } - }, - - preOrderTraverse: function (callback) { - this._preOrderTraverse(this.root, callback); - }, - - //先序遍历(递归) - _preOrderTraverse: function (node, callback) { - if (node != null) { - callback && callback(node); - this._preOrderTraverse(node.getLeft()); - this._preOrderTraverse(node.getRight()); - } - }, - - //先序遍历(非递归) - nrPreOrderTraverse: function (callback) { - - var stack = []; - var node = this.root; - - while (node != null || !BI.isEmpty(stack)) { - - while (node != null) { - callback && callback(node); - stack.push(node); - node = node.getLeft(); - } - node = stack.pop(); - node = node.getRight(); - } - }, - - postOrderTraverse: function (callback) { - this._postOrderTraverse(this.root, callback); - }, - - //后序遍历(递归) - _postOrderTraverse: function (node, callback) { - if (node != null) { - this._postOrderTraverse(node.getLeft()); - this._postOrderTraverse(node.getRight()); - callback && callback(node); - } - }, - - //后续遍历(非递归) - nrPostOrderTraverse: function (callback) { - - var stack = []; - var node = this.root; - var preNode = null;//表示最近一次访问的节点 - - while (node != null || !BI.isEmpty(stack)) { - - while (node != null) { - stack.push(node); - node = node.getLeft(); - } - - node = BI.last(stack); - - if (node.getRight() == null || node.getRight() == preNode) { - callback && callback(node); - node = stack.pop(); - preNode = node; - node = null; - } else { - node = node.getRight(); - } - } - } - }; - - BI.Node = function (id) { - if (BI.isObject(id)) { - BI.extend(this, id); - } else { - this.id = id; - } - this.clear.apply(this, arguments); - }; - - BI.Node.prototype = { - constructor: BI.Node, - - set: function (key, value) { - if (BI.isObject(key)) { - BI.extend(this, key); - return; - } - this[key] = value; - }, - - get: function (key) { - return this[key]; - }, - - isLeaf: function () { - return BI.isEmpty(this.children); - }, - - getChildren: function () { - return this.children; - }, - - getChildrenLength: function () { - return this.children.length; - }, - - getFirstChild: function () { - return BI.first(this.children); - }, - - getLastChild: function () { - return BI.last(this.children); - }, - - setLeft: function (left) { - this.left = left; - }, - - getLeft: function () { - return this.left; - }, - - setRight: function (right) { - this.right = right; - }, - - getRight: function () { - return this.right; - }, - - setParent: function (parent) { - this.parent = parent; - }, - - getParent: function () { - return this.parent; - }, - - getChild: function (index) { - return this.children[index]; - }, - - getChildIndex: function (id) { - return BI.findIndex(this.children, function (i, ch) { - return ch.get("id") === id; - }); - }, - - removeChild: function (id) { - this.removeChildByIndex(this.getChildIndex(id)); - }, - - removeChildByIndex: function (index) { - var before = this.getChild(index - 1); - var behind = this.getChild(index + 1); - if (before != null) { - before.setRight(behind || null); - } - if (behind != null) { - behind.setLeft(before || null); - } - this.children.splice(index, 1); - }, - - removeAllChilds: function () { - this.children = []; - }, - - addChild: function (child, index) { - var cur = null; - if (BI.isUndefined(index)) { - cur = this.children.length - 1; - } else { - cur = index - 1; - } - child.setParent(this); - if (cur >= 0) { - this.getChild(cur).setRight(child); - child.setLeft(this.getChild(cur)); - } - if (BI.isUndefined(index)) { - this.children.push(child); - } else { - this.children.splice(index, 0, child); - } - }, - - equals: function (obj) { - return this === obj || this.id === obj.id; - }, - - clear: function () { - this.parent = null; - this.left = null; - this.right = null; - this.children = []; - } - }; - - BI.extend(BI.Tree, { - transformToArrayFormat: function (nodes, pId) { - if (!nodes) return []; - var r = []; - if (BI.isArray(nodes)) { - for (var i = 0, l = nodes.length; i < l; i++) { - var node = BI.clone(nodes[i]); - node.pId = node.pId == null ? pId : node.pId; - delete node.children; - r.push(node); - if (nodes[i]["children"]) { - r = r.concat(BI.Tree.transformToArrayFormat(nodes[i]["children"], node.id)); - } - } - } else { - var newNodes = BI.clone(nodes); - newNodes.pId = newNodes.pId == null ? pId : newNodes.pId; - delete newNodes.children; - r.push(newNodes); - if (nodes["children"]) { - r = r.concat(BI.Tree.transformToArrayFormat(nodes["children"], newNodes.id)); - } - } - return r; - }, - - arrayFormat: function (nodes, pId) { - if (!nodes) { - return []; - } - var r = []; - if (BI.isArray(nodes)) { - for (var i = 0, l = nodes.length; i < l; i++) { - var node = nodes[i]; - node.pId = node.pId == null ? pId : node.pId; - r.push(node); - if (nodes[i]["children"]) { - r = r.concat(BI.Tree.arrayFormat(nodes[i]["children"], node.id)); - } - } - } else { - var newNodes = nodes; - newNodes.pId = newNodes.pId == null ? pId : newNodes.pId; - r.push(newNodes); - if (nodes["children"]) { - r = r.concat(BI.Tree.arrayFormat(nodes["children"], newNodes.id)); - } - } - return r; - }, - - transformToTreeFormat: function (sNodes) { - var i, l; - if (!sNodes) { - return []; - } - - if (BI.isArray(sNodes)) { - var r = []; - var tmpMap = []; - for (i = 0, l = sNodes.length; i < l; i++) { - if (BI.isNull(sNodes[i].id)) { - return sNodes; - } - tmpMap[sNodes[i].id] = BI.clone(sNodes[i]); - } - for (i = 0, l = sNodes.length; i < l; i++) { - if (tmpMap[sNodes[i].pId] && sNodes[i].id !== sNodes[i].pId) { - if (!tmpMap[sNodes[i].pId].children) { - tmpMap[sNodes[i].pId].children = []; - } - tmpMap[sNodes[i].pId].children.push(tmpMap[sNodes[i].id]); - } else { - r.push(tmpMap[sNodes[i].id]); - } - delete tmpMap[sNodes[i].id].pId; - } - return r; - } else { - return [sNodes]; - } - }, - - treeFormat: function (sNodes) { - var i, l; - if (!sNodes) { - return []; - } - - if (BI.isArray(sNodes)) { - var r = []; - var tmpMap = []; - for (i = 0, l = sNodes.length; i < l; i++) { - if (BI.isNull(sNodes[i].id)) { - return sNodes; - } - tmpMap[sNodes[i].id] = sNodes[i]; - } - for (i = 0, l = sNodes.length; i < l; i++) { - if (tmpMap[sNodes[i].pId] && sNodes[i].id !== sNodes[i].pId) { - if (!tmpMap[sNodes[i].pId].children) { - tmpMap[sNodes[i].pId].children = []; - } - tmpMap[sNodes[i].pId].children.push(tmpMap[sNodes[i].id]); - } else { - r.push(tmpMap[sNodes[i].id]); - } - } - return r; - } else { - return [sNodes]; - } - }, - - traversal: function (array, callback) { - if (BI.isNull(array)) { - return; - } - var self = this; - BI.any(array, function (i, item) { - if (callback(i, item) === false) { - return true; - } - self.traversal(item.children, callback); - }) - } - }) -})();//向量操作 -BI.Vector = function (x, y) { - this.x = x; - this.y = y; -}; -BI.Vector.prototype = { - constructor: BI.Vector, - cross: function (v) { - return (this.x * v.y - this.y * v.x); - }, - length: function (v) { - return (Math.sqrt(this.x * v.x + this.y * v.y)); - } -}; -BI.Region = function (x, y, w, h) { - this.x = x; - this.y = y; - this.w = w; - this.h = h; -}; -BI.Region.prototype = { - constructor: BI.Region, - //判断两个区域是否相交,若相交,则要么顶点互相包含,要么矩形边界(或对角线)相交 - isIntersects: function (obj) { - if (this.isPointInside(obj.x, obj.y) || - this.isPointInside(obj.x + obj.w, obj.y) || - this.isPointInside(obj.x, obj.y + obj.h) || - this.isPointInside(obj.x + obj.w, obj.y + obj.h)) { - return true; - } else if (obj.isPointInside(this.x, this.y) || - obj.isPointInside(this.x + this.w, this.y) || - obj.isPointInside(this.x, this.y + this.h) || - obj.isPointInside(this.x + this.w, this.y + this.h)) { - return true; - } else if (obj.x != null && obj.y != null)//判断矩形对角线相交 |v1 X v2||v1 X v3| < 0 - { - var vector1 = new BI.Vector(this.w, this.h);//矩形对角线向量 - var vector2 = new BI.Vector(obj.x - this.x, obj.y - this.y); - var vector3 = new BI.Vector(vector2.x + obj.w, vector2.y + obj.h); - if ((vector1.cross(vector2) * vector1.cross(vector3)) < 0) { - return true; - } - } - return false; - }, - //判断一个点是否在这个区域内部 - isPointInside: function (x, y) { - if (this.x == null || this.y == null) { - return false; - } - if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h) { - return true; - } - return false; - }, - //返回区域的重心,因为是矩形所以返回中点 - getPosition: function () { - var pos = []; - pos.push(this.x + this.w / 2); - pos.push(this.y + this.h / 2); - return pos; - } -};; -!(function (BI) { - - if (BI.isIE()) { - XMLSerializer = null; - DOMParser = null; - } - - - var XML = { - Document: { - NodeType: { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 - } - } - }; - - XML.ResultType = { - single: 'single', - array: 'array' - }; - - XML.fromString = function (xmlStr) { - try { - var parser = new DOMParser(); - return parser.parseFromString(xmlStr, "text/xml"); - } catch (e) { - var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; - for (var i = 0; i < arrMSXML.length; i++) { - try { - var xmlDoc = new ActiveXObject(arrMSXML[i]); - xmlDoc.setProperty("SelectionLanguage", "XPath"); - xmlDoc.async = false; - xmlDoc.loadXML(xmlStr); - return xmlDoc; - } catch (xmlError) { - } - } - } - }; - - XML.toString = function (xmlNode) { - if (!BI.isIE()) { - var xmlSerializer = new XMLSerializer(); - return xmlSerializer.serializeToString(xmlNode); - } else - return xmlNode.xml; - }; - - XML.getNSResolver = function (str) { - if (!str) { - return null; - } - var list = str.split(' '); - var namespaces = {}; - for (var i = 0; i < list.length; i++) { - var pair = list[i].split('='); - var fix = BI.trim(pair[0]).replace("xmlns:", ""); - namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); - } - return function (prefix) { - return namespaces[prefix]; - }; - }; - - XML.eval = function (context, xpathExp, resultType, namespaces) { - if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { - return XML.eval2(context, xpathExp, resultType, namespaces); - } else { - if (BI.isIE()) { - namespaces = namespaces ? namespaces : ""; - var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; - doc.setProperty("SelectionNamespaces", namespaces); - var result; - if (resultType == this.ResultType.single) { - result = context.selectSingleNode(xpathExp); - } else { - result = context.selectNodes(xpathExp) || []; - } - doc.setProperty("SelectionNamespaces", ""); - return result; - } else { - var node = context; - var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; - var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; - var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); - - if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { - return col.singleNodeValue; - } else { - var thisColMemb = col.iterateNext(); - var rowsCol = []; - while (thisColMemb) { - rowsCol[rowsCol.length] = thisColMemb; - thisColMemb = col.iterateNext(); - } - return rowsCol; - } - } - } - }; - - XML.eval2 = function (context, xpathExp, resultType, namespaces) { - if (resultType !== "single" && resultType !== undefined && resultType !== null) { - throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); - } - - if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { - return context; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs, i; - if (xpathExp.indexOf("/") != -1) { - var items = xpathExp.split("/"); - var isAbs = xpathExp.substring(0, 1) == "/"; - for (i = 0; i < items.length; i++) { - var item = items[i]; - if (item === "") { - continue; - } else { - var next = null; - var ii = i + 1; - for (; ii < items.length; ii++) { - if (next === null) { - next = items[ii]; - } else { - next = next + "/" + items[ii]; - } - } - - if (item == ".") { - return this.eval(context, next, resultType); - - } else if (item == "..") { - return this.eval2(context.parentNode, next, resultType); - - } else if (item == "*") { - if (isAbs) { - return this.eval2(context, next, resultType); - - } else { - childs = context.childNodes; - for (var j = 0; j < childs.length; j++) { - var tmp = this.eval2(childs[j], next, resultType); - if (tmp !== null) { - return tmp; - } - } - return null; - } - - } else { - if (isAbs) { - if (context.nodeName == item) { - return this.eval2(context, next, resultType); - } else { - return null; - } - } else { - var child = this.getChildByName(context, item); - if (child !== null) { - return this.eval2(child, next, resultType); - } else { - return null; - } - - } - } - - } - } - - return null; - - } else { - if ("text()" == xpathExp) { - childs = context.childNodes; - for (i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.TEXT) { - return childs[i]; - } - } - return null; - } else { - return this.getChildByName(context, xpathExp); - } - } - }; - - XML.getChildByName = function (context, name) { - if (context === null || context === undefined || name === null || name === undefined) { - return null; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs = context.childNodes; - for (var i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { - return childs[i]; - } - } - - return null; - }; - - XML.appendChildren = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - if (isBefore && finded[i].firstNode) { - this._insertBefore(finded[i], nodes, finded[i].firstNode); - } else { - for (var j = 0; j < nodes.length; j++) { - finded[i].appendChild(nodes[j]); - } - } - } - return count; - }; - - XML.removeNodes = function (context, xpathExp) { - var nodes = this.eval(context, xpathExp); - for (var i = 0; i < nodes.length; i++) { - nodes[i].parentNode.removeChild(nodes[i]); - } - }; - - XML._insertBefore = function (parent, newchildren, refchild) { - for (var i = 0; i < newchildren.length; i++) { - parent.insertBefore(newchildren[i], refchild); - } - }; - - XML.insertNodes = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; - this._insertBefore(finded[i].parentNode, nodes, refnode); - } - return count; - }; - - XML.replaceNodes = function (context, xpathExp, nodes) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = finded[i]; - var parent = refnode.parentNode; - this._insertBefore(parent, nodes, refnode); - parent.removeChild(refnode); - } - return count; - }; - - XML.setNodeText = function (context, xpathExp, text) { - var finded = this.eval(context, xpathExp, this.ResultType.single); - if (finded === null) { - return; - } - if (finded.nodeType == XML.Document.NodeType.ELEMENT) { - var textNode = this.eval(finded, "./text()", this.ResultType.single); - if (!textNode) { - textNode = finded.ownerDocument.createTextNode(""); - finded.appendChild(textNode); - } - textNode.nodeValue = text; - } else { - finded.nodeValue = text; - } - return; - }; - - XML.getNodeText = function (context, xpathExp, defaultValue) { - var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; - if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { - finded = this.eval(finded, "./text()", this.ResultType.single); - } - return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; - }; - - XML.Namespaces = { - XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", - XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", - XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", - XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', - XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', - XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', - XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', - XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', - XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', - XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', - XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', - XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', - JUSTEPSCHEMA: "http://www.justep.com/xbiz#", - RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - JUSTEP: "http://www.justep.com/x5#", - 'get': function (type) { - type = type ? type.toLowerCase() : "string"; - if ("string" == type) { - return XML.Namespaces.XMLSCHEMA_STRING; - } - else if ("integer" == type) { - return XML.Namespaces.XMLSCHEMA_INTEGER; - } - else if ("long" == type) { - return XML.Namespaces.XMLSCHEMA_LONG; - } - else if ("float" == type) { - return XML.Namespaces.XMLSCHEMA_FLOAT; - } - else if ("double" == type) { - return XML.Namespaces.XMLSCHEMA_DOUBLE; - } - else if ("decimal" == type) { - return XML.Namespaces.XMLSCHEMA_DECIMAL; - } - else if ("date" == type) { - return XML.Namespaces.XMLSCHEMA_DATE; - } - else if ("time" == type) { - return XML.Namespaces.XMLSCHEMA_TIME; - } - else if ("datetime" == type) { - return XML.Namespaces.XMLSCHEMA_DATETIME; - } - else if ("boolean" == type) { - return XML.Namespaces.XMLSCHEMA_BOOLEAN; - } - } - }; -})(BI);BI.BehaviorFactory = { - createBehavior: function(key, options){ - var behavior; - switch (key){ - case "highlight": - behavior = BI.HighlightBehavior; - break; - case "redmark": - behavior = BI.RedMarkBehavior; - break; - } - return new behavior(options); - } -} - -/** - * guy - * 行为控件 - * @class BI.Behavior - * @extends BI.OB - */ -BI.Behavior = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.Behavior.superclass._defaultConfig.apply(this, arguments), { - rule: function(){return true;} - }); - }, - - _init : function() { - BI.Behavior.superclass._init.apply(this, arguments); - - }, - - doBehavior: function(){ - - } -});/** - * 布局容器类 - * @class BI.Layout - * @extends BI.Widget - * - * @cfg {JSON} options 配置属性 - * @cfg {Boolean} [options.scrollable=false] 子组件超出容器边界之后是否会出现滚动条 - * @cfg {Boolean} [options.scrollx=false] 子组件超出容器边界之后是否会出现横向滚动条 - * @cfg {Boolean} [options.scrolly=false] 子组件超出容器边界之后是否会出现纵向滚动条 - */ -BI.Layout = BI.inherit(BI.Widget, { - props: function () { - return { - scrollable: null, //true, false, null - scrollx: false, //true, false - scrolly: false, //true, false - items: [] - }; - }, - - render: function () { - this._init4Margin(); - this._init4Scroll(); - }, - - _init4Margin: function () { - if (this.options.top) { - this.element.css('top', this.options.top); - } - if (this.options.left) { - this.element.css('left', this.options.left); - } - if (this.options.bottom) { - this.element.css('bottom', this.options.bottom); - } - if (this.options.right) { - this.element.css('right', this.options.right); - } - }, - - _init4Scroll: function () { - switch (this.options.scrollable) { - case true: - this.element.css("overflow", "auto"); - break; - case false: - this.element.css("overflow", "hidden"); - break; - default : - break; - } - if (this.options.scrollx) { - this.element.css({ - "overflow-x": "auto", - "overflow-y": "hidden" - }); - } - if (this.options.scrolly) { - this.element.css({ - "overflow-x": "hidden", - "overflow-y": "auto" - }); - } - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.element.append(frag); - } - }, - - _getChildName: function (index) { - return index + ""; - }, - - _addElement: function (i, item) { - var self = this, w; - if (!this.hasWidget(this._getChildName(i))) { - w = BI.createWidget(item); - w.on(BI.Events.DESTROY, function () { - BI.each(self._children, function (name, child) { - if (child === w) { - BI.remove(self._children, child); - self.removeItemAt(name | 0); - } - }); - }); - this.addWidget(this._getChildName(i), w); - } else { - w = this.getWidgetByName(this._getChildName(i)); - } - return w; - }, - - _getOptions: function (item) { - if (item instanceof BI.Widget) { - item = item.options; - } - item = BI.stripEL(item); - if (item instanceof BI.Widget) { - item = item.options; - } - return item; - }, - - _compare: function (item1, item2) { - var self = this; - return eq(item1, item2); - - //不比较函数 - function eq(a, b, aStack, bStack) { - if (a === b) { - return a !== 0 || 1 / a === 1 / b; - } - if (a == null || b == null) { - return a === b; - } - var className = Object.prototype.toString.call(a); - switch (className) { - case '[object RegExp]': - case '[object String]': - return '' + a === '' + b; - case '[object Number]': - if (+a !== +a) { - return +b !== +b; - } - return +a === 0 ? 1 / +a === 1 / b : +a === +b; - case '[object Date]': - case '[object Boolean]': - return +a === +b; - } - - var areArrays = className === '[object Array]'; - if (!areArrays) { - if (BI.isFunction(a) && BI.isFunction(b)) { - return true; - } - a = self._getOptions(a); - b = self._getOptions(b); - } - - aStack = aStack || []; - bStack = bStack || []; - var length = aStack.length; - while (length--) { - if (aStack[length] === a) { - return bStack[length] === b; - } - } - - aStack.push(a); - bStack.push(b); - - if (areArrays) { - length = a.length; - if (length !== b.length) { - return false; - } - while (length--) { - if (!eq(a[length], b[length], aStack, bStack)) { - return false; - } - } - } else { - var keys = _.keys(a), key; - length = keys.length; - if (_.keys(b).length !== length) { - return false; - } - while (length--) { - key = keys[length]; - if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) { - return false; - } - } - } - aStack.pop(); - bStack.pop(); - return true; - } - }, - - _getWrapper: function () { - return this.element; - }, - - _addItemAt: function (index, item) { - for (var i = this.options.items.length; i > index; i--) { - this._children[this._getChildName(i)] = this._children[this._getChildName(i - 1)]; - } - delete this._children[this._getChildName(index)]; - this.options.items.splice(index, 0, item); - }, - - _removeItemAt: function (index) { - for (var i = index; i < this.options.items.length - 1; i++) { - this._children[this._getChildName(i)] = this._children[this._getChildName(i + 1)]; - } - delete this._children[this._getChildName(this.options.items.length - 1)]; - this.options.items.splice(index, 1); - }, - - /** - * 添加一个子组件到容器中 - * @param {JSON/BI.Widget} item 子组件 - */ - addItem: function (item) { - return this.addItemAt(this.options.items.length, item); - }, - - prependItem: function (item) { - return this.addItemAt(0, item); - }, - - addItemAt: function (index, item) { - if (index < 0 || index > this.options.items.length) { - return; - } - this._addItemAt(index, item); - var w = this._addElement(index, item); - if (index > 0) { - this._children[this._getChildName(index - 1)].element.after(w.element); - } else { - w.element.prependTo(this._getWrapper()); - } - w._mount(); - return w; - }, - - removeItemAt: function (indexes) { - indexes = BI.isArray(indexes) ? indexes : [indexes]; - var deleted = []; - var newItems = [], newChildren = {}; - for (var i = 0, len = this.options.items.length; i < len; i++) { - var child = this._children[this._getChildName(i)]; - if (indexes.contains(i)) { - child && deleted.push(child); - } else { - newChildren[this._getChildName(newItems.length)] = child; - newItems.push(this.options.items[i]); - } - } - this.options.items = newItems; - this._children = newChildren; - BI.each(deleted, function (i, c) { - c._destroy(); - }); - }, - - updateItemAt: function (index, item) { - if (index < 0 || index > this.options.items.length - 1) { - return; - } - - var child = this._children[this._getChildName(index)]; - var updated; - if (updated = child.update(this._getOptions(item))) { - return updated; - } - var del = this._children[this._getChildName(index)]; - delete this._children[this._getChildName(index)]; - this.options.items.splice(index, 1); - var w = this._addElement(index, item); - this.options.items.splice(index, 0, item); - this._children[this._getChildName(index)] = w; - if (index > 0) { - this._children[this._getChildName(index - 1)].element.after(w.element); - } else { - w.element.prependTo(this._getWrapper()); - } - del._destroy(); - w._mount(); - }, - - addItems: function (items) { - var self = this, o = this.options; - var fragment = document.createDocumentFragment(); - var added = []; - BI.each(items, function (i, item) { - var w = self._addElement(o.items.length, item); - self._children[self._getChildName(o.items.length)] = w; - o.items.push(item); - added.push(w); - fragment.appendChild(w.element[0]); - }); - this._getWrapper().append(fragment); - BI.each(added, function (i, w) { - w._mount(); - }) - }, - - prependItems: function (items) { - var self = this; - items = items || []; - var fragment = document.createDocumentFragment(); - var added = []; - for (var i = items.length - 1; i >= 0; i--) { - this._addItemAt(0, items[i]); - var w = this._addElement(0, items[i]); - self._children[self._getChildName(0)] = w; - this.options.items.unshift(items[i]); - added.push(w); - fragment.appendChild(w.element[0]); - } - this._getWrapper().prepend(fragment); - BI.each(added, function (i, w) { - w._mount(); - }) - }, - - getValue: function () { - var self = this, value = [], child; - BI.each(this.options.items, function (i) { - if (child = self._children[self._getChildName(i)]) { - var v = child.getValue(); - v = BI.isArray(v) ? v : [v]; - value = value.concat(v); - } - }); - return value; - }, - - setValue: function (v) { - var self = this, child; - BI.each(this.options.items, function (i) { - if (child = self._children[self._getChildName(i)]) { - child.setValue(v); - } - }) - }, - - setText: function (v) { - var self = this, child; - BI.each(this.options.items, function (i) { - if (child = self._children[self._getChildName(i)]) { - child.setText(v); - } - }) - }, - - update: function (item) { - var o = this.options; - var items = item.items || []; - var updated, i, len; - for (i = 0, len = Math.min(o.items.length, items.length); i < len; i++) { - if (!this._compare(o.items[i], items[i])) { - updated = this.updateItemAt(i, items[i]) || updated; - } - } - if (o.items.length > items.length) { - var deleted = []; - for (i = items.length; i < o.items.length; i++) { - deleted.push(this._children[this._getChildName(i)]); - delete this._children[this._getChildName(i)]; - } - o.items.splice(items.length); - BI.each(deleted, function (i, w) { - w._destroy(); - }) - } else if (items.length > o.items.length) { - for (i = o.items.length; i < items.length; i++) { - this.addItemAt(i, items[i]); - } - } - return updated; - }, - - stroke: function (items) { - var self = this; - BI.each(items, function (i, item) { - if (!!item) { - self._addElement(i, item); - } - }); - }, - - removeWidget: function (nameOrWidget) { - var removeIndex; - if (BI.isWidget(nameOrWidget)) { - BI.each(this._children, function (name, child) { - if (child === nameOrWidget) { - removeIndex = name; - } - }) - } else { - removeIndex = nameOrWidget; - } - if (removeIndex) { - this._removeItemAt(removeIndex | 0); - } - }, - - empty: function () { - BI.Layout.superclass.empty.apply(this, arguments); - this.options.items = []; - }, - - destroy: function () { - BI.Layout.superclass.destroy.apply(this, arguments); - this.options.items = []; - }, - - populate: function (items) { - var self = this, o = this.options; - items = items || []; - if (this._isMounted) { - this.update({items: items}); - return; - } - this.options.items = items; - this.stroke(items); - }, - - resize: function () { - - } -}); -BI.shortcut('bi.layout', BI.Layout);/** - * guy - * 由一个元素切换到另一个元素的行为 - * @class BI.Action - * @extends BI.OB - * @abstract - */ -BI.Action = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.Action.superclass._defaultConfig.apply(this, arguments), { - src: null, - tar: null - }); - }, - - _init : function() { - BI.Action.superclass._init.apply(this, arguments); - }, - - actionPerformed: function(src, tar, callback){ - - }, - - actionBack: function(tar, src, callback){ - - } -}); - -BI.ActionFactory = { - createAction: function(key, options){ - var action; - switch (key){ - case "show": - action = BI.ShowAction; - break; - } - return new action(options); - } -}/** - * guy - * 由一个元素切换到另一个元素的行为 - * @class BI.ShowAction - * @extends BI.Action - */ -BI.ShowAction = BI.inherit(BI.Action, { - _defaultConfig: function () { - return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.ShowAction.superclass._init.apply(this, arguments); - }, - - actionPerformed: function (src, tar, callback) { - tar = tar || this.options.tar; - tar.setVisible(true); - callback && callback(); - }, - - actionBack: function (tar, src, callback) { - tar = tar || this.options.tar; - tar.setVisible(false); - callback && callback(); - } -});/** - * @class BI.FloatSection - * @extends BI.View - * @abstract - */ -BI.FloatSection = BI.inherit(BI.View, { - _init : function() { - BI.FloatSection.superclass._init.apply(this, arguments); - var self = this; - var flatten = ["_init", "_defaultConfig", "_vessel", "_render", "getName", "listenEnd", "local", "refresh", "load", "change"]; - flatten = BI.makeObject(flatten, true); - BI.each(this.constructor.caller.caller.caller.prototype, function (key) { - if (flatten[key]) { - return; - } - var f = self[key]; - if (BI.isFunction(f)) { - self[key] = BI.bind(function () { - if (this.model._start === true) { - this._F.push({f: f, arg: arguments}); - return; - } - return f.apply(this, arguments); - }, self); - } - }) - }, - - rebuildNorth : function(north) { - return true; - }, - rebuildCenter : function(center) {}, - rebuildSouth : function(south) { - return false; - }, - close: function(){ - this.notifyParentEnd(); - this.trigger(BI.PopoverSection.EVENT_CLOSE); - }, - end: function(){ - - } -}); - -/** - * 弹出层 - * @class BI.PopoverSection - * @extends BI.Widget - * @abstract - */ -BI.PopoverSection = BI.inherit(BI.Widget, { - _init : function() { - BI.PopoverSection.superclass._init.apply(this, arguments); - }, - - rebuildNorth : function(north) { - return true; - }, - rebuildCenter : function(center) {}, - rebuildSouth : function(south) { - return false; - }, - close: function(){ - this.fireEvent(BI.PopoverSection.EVENT_CLOSE); - }, - end: function(){ - - } -}); -BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { - if (!window.BI) { - window.BI = {}; - } - function isEmpty(value) { - // 判断是否为空值 - var result = value === "" || value === null || value === undefined; - return result; - } - - // 判断是否是无效的日期 - function isInvalidDate(date) { - return date == "Invalid Date" || date == "NaN"; - } - - /** - * 科学计数格式 - */ - function _eFormat(text, fmt) { - var e = fmt.indexOf("E"); - var eleft = fmt.substr(0, e), eright = fmt.substr(e + 1); - if (/^[0\.-]+$/.test(text)) { - text = BI._numberFormat(0.0, eleft) + 'E' + BI._numberFormat(0, eright) - } else { - var isNegative = text < 0; - if (isNegative) { - text = text.substr(1); - } - var elvl = (eleft.split('.')[0] || '').length; - var point = text.indexOf("."); - if (point < 0) { - point = text.length; - } - var i = 0; //第一个不为0的数的位置 - text = text.replace('.', ''); - for (var len = text.length; i < len; i++) { - var ech = text.charAt(i); - if (ech <= '9' && ech >= '1') { - break; - } - } - var right = point - i - elvl; - var left = text.substr(i, elvl); - var dis = i + elvl - text.length; - if (dis > 0) { - //末位补全0 - for (var k = 0; k < dis; k++) { - left += '0'; - } - } else { - left += '.' + text.substr(i + elvl); - } - left = left.replace(/^[0]+/, ''); - if (right < 0 && eright.indexOf('-') < 0) { - eright += ';-' + eright; - } - text = BI._numberFormat(left, eleft) + 'E' + BI._numberFormat(right, eright); - if (isNegative) { - text = '-' + text; - } - } - return text; - } - - /** - * 数字格式 - */ - function _numberFormat(text, format) { - var text = text + ''; - //数字格式,区分正负数 - var numMod = format.indexOf(';'); - if (numMod > -1) { - if (text >= 0) { - return _numberFormat(text + "", format.substring(0, numMod)); - } else { - return _numberFormat((-text) + "", format.substr(numMod + 1)); - } - } - var tp = text.split('.'), fp = format.split('.'), - tleft = tp[0] || '', fleft = fp[0] || '', - tright = tp[1] || '', fright = fp[1] || ''; - //百分比,千分比的小数点移位处理 - if (/[%‰]$/.test(format)) { - var paddingZero = /[%]$/.test(format) ? '00' : '000'; - tright += paddingZero; - tleft += tright.substr(0, paddingZero.length); - tleft = tleft.replace(/^0+/gi, ''); - tright = tright.substr(paddingZero.length).replace(/0+$/gi, ''); - } - var right = _dealWithRight(tright, fright); - if (right.leftPlus) { - //小数点后有进位 - tleft = parseInt(tleft) + 1 + ''; - - tleft = isNaN(tleft) ? '1' : tleft; - } - right = right.num; - var left = _dealWithLeft(tleft, fleft); - if (!(/[0-9]/.test(left))) { - left = left + '0'; - } - if (!(/[0-9]/.test(right))) { - return left + right; - } else { - return left + '.' + right; - } - } - - /** - * 处理小数点右边小数部分 - * @param tright 右边内容 - * @param fright 右边格式 - * @returns {JSON} 返回处理结果和整数部分是否需要进位 - * @private - */ - function _dealWithRight(tright, fright) { - var right = '', j = 0, i = 0; - for (var len = fright.length; i < len; i++) { - var ch = fright.charAt(i); - var c = tright.charAt(j); - switch (ch) { - case '0': - if (isEmpty(c)) { - c = '0'; - } - right += c; - j++; - break; - case '#': - right += c; - j++; - break; - default : - right += ch; - break; - } - } - var rll = tright.substr(j); - var result = {}; - if (!isEmpty(rll) && rll.charAt(0) > 4) { - //有多余字符,需要四舍五入 - result.leftPlus = true; - var numReg = right.match(/^[0-9]+/); - if (numReg) { - var num = numReg[0]; - var orilen = num.length; - var newnum = parseInt(num) + 1 + ''; - //进位到整数部分 - if (newnum.length > orilen) { - newnum = newnum.substr(1); - } else { - newnum = String.leftPad(newnum, orilen, '0'); - result.leftPlus = false; - } - right = right.replace(/^[0-9]+/, newnum); - } - } - result.num = right; - return result; - } - - /** - * 处理小数点左边整数部分 - * @param tleft 左边内容 - * @param fleft 左边格式 - * @returns {string} 返回处理结果 - * @private - */ - function _dealWithLeft(tleft, fleft) { - var left = ''; - var j = tleft.length - 1; - var combo = -1, last = -1; - var i = fleft.length - 1; - for (; i >= 0; i--) { - var ch = fleft.charAt(i); - var c = tleft.charAt(j); - switch (ch) { - case '0': - if (isEmpty(c)) { - c = '0'; - } - last = -1; - left = c + left; - j--; - break; - case '#': - last = i; - left = c + left; - j--; - break; - case ',': - if (!isEmpty(c)) { - //计算一个,分隔区间的长度 - var com = fleft.match(/,[#0]+/); - if (com) { - combo = com[0].length - 1; - } - left = ',' + left; - } - break; - default : - left = ch + left; - break; - } - } - if (last > -1) { - //处理剩余字符 - var tll = tleft.substr(0, j + 1); - left = left.substr(0, last) + tll + left.substr(last); - } - if (combo > 0) { - //处理,分隔区间 - var res = left.match(/[0-9]+,/); - if (res) { - res = res[0]; - var newstr = '', n = res.length - 1 - combo; - for (; n >= 0; n = n - combo) { - newstr = res.substr(n, combo) + ',' + newstr; - } - var lres = res.substr(0, n + combo); - if (!isEmpty(lres)) { - newstr = lres + ',' + newstr; - } - } - left = left.replace(/[0-9]+,/, newstr); - } - return left; - } - - BI.cjkEncode = function (text) { - // alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的) - if (typeof text !== 'string') { - return text; - } - - var newText = ""; - for (var i = 0; i < text.length; i++) { - var code = text.charCodeAt(i); - if (code >= 128 || code === 91 || code === 93) {//91 is "[", 93 is "]". - newText += "[" + code.toString(16) + "]"; - } else { - newText += text.charAt(i); - } - } - - return newText - }; - - BI.cjkEncodeDO = function (o) { - if (BI.isPlainObject(o)) { - var result = {}; - $.each(o, function (k, v) { - if (!(typeof v == "string")) { - v = BI.jsonEncode(v); - } - //wei:bug 43338,如果key是中文,cjkencode后o的长度就加了1,ie9以下版本死循环,所以新建对象result。 - k = BI.cjkEncode(k); - result[k] = BI.cjkEncode(v); - }); - return result; - } - return o; - }; - - BI.jsonEncode = function (o) { - //james:这个Encode是抄的EXT的 - var useHasOwn = {}.hasOwnProperty ? true : false; - - // crashes Safari in some instances - //var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/; - - var m = { - "\b": '\\b', - "\t": '\\t', - "\n": '\\n', - "\f": '\\f', - "\r": '\\r', - '"': '\\"', - "\\": '\\\\' - }; - - var encodeString = function (s) { - if (/["\\\x00-\x1f]/.test(s)) { - return '"' + s.replace(/([\x00-\x1f\\"])/g, function (a, b) { - var c = m[b]; - if (c) { - return c; - } - c = b.charCodeAt(); - return "\\u00" + - Math.floor(c / 16).toString(16) + - (c % 16).toString(16); - }) + '"'; - } - return '"' + s + '"'; - }; - - var encodeArray = function (o) { - var a = ["["], b, i, l = o.length, v; - for (i = 0; i < l; i += 1) { - v = o[i]; - switch (typeof v) { - case "undefined": - case "function": - case "unknown": - break; - default: - if (b) { - a.push(','); - } - a.push(v === null ? "null" : BI.jsonEncode(v)); - b = true; - } - } - a.push("]"); - return a.join(""); - }; - - if (typeof o == "undefined" || o === null) { - return "null"; - } else if (BI.isArray(o)) { - return encodeArray(o); - } else if (o instanceof Date) { - /* - * alex:原来只是把年月日时分秒简单地拼成一个String,无法decode - * 现在这么处理就可以decode了,但是JS.jsonDecode和Java.JSONObject也要跟着改一下 - */ - return BI.jsonEncode({ - __time__: o.getTime() - }) - } else if (typeof o == "string") { - return encodeString(o); - } else if (typeof o == "number") { - return isFinite(o) ? String(o) : "null"; - } else if (typeof o == "boolean") { - return String(o); - } else if (BI.isFunction(o)) { - return String(o); - } else { - var a = ["{"], b, i, v; - for (i in o) { - if (!useHasOwn || o.hasOwnProperty(i)) { - v = o[i]; - switch (typeof v) { - case "undefined": - case "unknown": - break; - default: - if (b) { - a.push(','); - } - a.push(BI.jsonEncode(i), ":", - v === null ? "null" : BI.jsonEncode(v)); - b = true; - } - } - } - a.push("}"); - return a.join(""); - } - }; - - BI.jsonDecode = function (text) { - - try { - // 注意0啊 - //var jo = $.parseJSON(text) || {}; - var jo = $.parseJSON(text); - if (jo == null) { - jo = {}; - } - } catch (e) { - /* - * richie:浏览器只支持标准的JSON字符串转换,而jQuery会默认调用浏览器的window.JSON.parse()函数进行解析 - * 比如:var str = "{'a':'b'}",这种形式的字符串转换为JSON就会抛异常 - */ - try { - jo = new Function("return " + text)() || {}; - } catch (e) { - //do nothing - } - if (jo == null) { - jo = []; - } - } - if (!_hasDateInJson(text)) { - return jo; - } - - function _hasDateInJson(json) { - if (!json || typeof json !== "string") { - return false; - } - return json.indexOf("__time__") != -1; - } - - return (function (o) { - if (typeof o === "string") { - return o; - } - if (o && o.__time__ != null) { - return new Date(o.__time__); - } - for (var a in o) { - if (o[a] == o || typeof o[a] == 'object' || $.isFunction(o[a])) { - break; - } - o[a] = arguments.callee(o[a]); - } - - return o; - })(jo); - }; - - BI.contentFormat = function (cv, fmt) { - if (isEmpty(cv)) { - //原值为空,返回空字符 - return ''; - } - var text = cv.toString(); - if (isEmpty(fmt)) { - //格式为空,返回原字符 - return text; - } - if (fmt.match(/^T/)) { - //T - 文本格式 - return text; - } else if (fmt.match(/^D/)) { - //D - 日期(时间)格式 - if (!(cv instanceof Date)) { - if (typeof cv === 'number') { - //毫秒数类型 - cv = new Date(cv); - } else { - //字符串类型,如yyyyMMdd、MMddyyyy等这样无分隔符的结构 - cv = Date.parseDate(cv + "", Date.patterns.ISO8601Long); - } - } - if (!BI.isNull(cv)) { - var needTrim = fmt.match(/^DT/); - text = BI.date2Str(cv, fmt.substring(needTrim ? 2 : 1)); - } - } else if (fmt.match(/E/)) { - //科学计数格式 - text = _eFormat(text, fmt); - } else { - //数字格式 - text = _numberFormat(text, fmt); - } - //¤ - 货币格式 - text = text.replace(/¤/g, '¥'); - return text; - }; - - /** - * 把日期对象按照指定格式转化成字符串 - * - * @example - * var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); - * var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12 - * - * @class BI.date2Str - * @param date 日期 - * @param format 日期格式 - * @returns {String} - */ - BI.date2Str = function (date, format) { - if (!date) { - return ''; - } - // O(len(format)) - var len = format.length, result = ''; - if (len > 0) { - var flagch = format.charAt(0), start = 0, str = flagch; - for (var i = 1; i < len; i++) { - var ch = format.charAt(i); - if (flagch !== ch) { - result += compileJFmt({ - 'char': flagch, - 'str': str, - 'len': i - start - }, date); - flagch = ch; - start = i; - str = flagch; - } else { - str += ch; - } - } - result += compileJFmt({ - 'char': flagch, - 'str': str, - 'len': len - start - }, date); - } - return result; - - function compileJFmt(jfmt, date) { - var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; - switch (ch) { - case 'E': //星期 - str = Date._DN[date.getDay()]; - break; - case 'y': //年 - if (len <= 3) { - str = (date.getFullYear() + '').slice(2, 4); - } else { - str = date.getFullYear(); - } - break; - case 'M': //月 - if (len > 2) { - str = Date._MN[date.getMonth()]; - } else if (len < 2) { - str = date.getMonth() + 1; - } else { - str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); - } - break; - case 'd': //日 - if (len > 1) { - str = String.leftPad(date.getDate() + '', 2, '0'); - } else { - str = date.getDate(); - } - break; - case 'h': //时(12) - var hour = date.getHours() % 12; - if (hour === 0) { - hour = 12; - } - if (len > 1) { - str = String.leftPad(hour + '', 2, '0'); - } else { - str = hour; - } - break; - case 'H': //时(24) - if (len > 1) { - str = String.leftPad(date.getHours() + '', 2, '0'); - } else { - str = date.getHours(); - } - break; - case 'm': - if (len > 1) { - str = String.leftPad(date.getMinutes() + '', 2, '0'); - } else { - str = date.getMinutes(); - } - break; - case 's': - if (len > 1) { - str = String.leftPad(date.getSeconds() + '', 2, '0'); - } else { - str = date.getSeconds(); - } - break; - case 'a': - str = date.getHours() < 12 ? 'am' : 'pm'; - break; - case 'z': - str = date.getTimezone(); - break; - default: - str = jfmt.str; - break; - } - return str; - } - }; - - BI.object2Number = function (value) { - if (value == null) { - return 0; - } - if (typeof value == 'number') { - return value; - } else { - var str = value + ""; - if (str.indexOf(".") === -1) { - return parseInt(str); - } else { - return parseFloat(str); - } - } - }; - - BI.object2Date = function (obj) { - if (obj == null) { - return new Date(); - } - if (obj instanceof Date) { - return obj; - } else if (typeof obj == 'number') { - return new Date(obj); - } else { - var str = obj + ""; - str = str.replace(/-/g, '/'); - var dt = new Date(str); - if (!isInvalidDate(dt)) { - return dt; - } - - return new Date(); - } - }; - - BI.object2Time = function (obj) { - if (obj == null) { - return new Date(); - } - if (obj instanceof Date) { - return obj; - } else { - var str = obj + ""; - str = str.replace(/-/g, '/'); - var dt = new Date(str); - if (!isInvalidDate(dt)) { - return dt; - } - if (str.indexOf('/') === -1 && str.indexOf(':') !== -1) { - dt = new Date("1970/01/01 " + str); - if (!isInvalidDate(dt)) { - return dt; - } - } - dt = BI.str2Date(str, "HH:mm:ss"); - if (!isInvalidDate(dt)) { - return dt; - } - return new Date(); - } - }; -})(); -/** - * guy - * - * @class BI.HighlightBehavior - * @extends BI.Behavior - */ -BI.HighlightBehavior = BI.inherit(BI.Behavior, { - _defaultConfig: function () { - return BI.extend(BI.HighlightBehavior.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.HighlightBehavior.superclass._init.apply(this, arguments); - - }, - - doBehavior: function (items) { - var args = Array.prototype.slice.call(arguments, 1), - o = this.options; - BI.each(items, function (i, item) { - if (item instanceof BI.Single) { - var rule = o.rule(item.getValue(), item); - - function doBe(run) { - if (run === true) { - item.doHighLight.apply(item, args); - } else { - item.unHighLight.apply(item, args); - } - } - - if (BI.isFunction(rule)) { - rule(doBe); - } else { - doBe(rule); - } - } else { - item.doBehavior.apply(item, args); - } - }) - } -});/** - * guy - * 标红行为 - * @class BI.RedMarkBehavior - * @extends BI.Behavior - */ -BI.RedMarkBehavior = BI.inherit(BI.Behavior, { - _defaultConfig: function() { - return BI.extend(BI.RedMarkBehavior.superclass._defaultConfig.apply(this, arguments), { - - }); - }, - - _init : function() { - BI.RedMarkBehavior.superclass._init.apply(this, arguments); - - }, - - doBehavior: function(items){ - var args = Array.prototype.slice.call(arguments, 1), - o = this.options; - BI.each(items, function(i, item){ - if(item instanceof BI.Single) { - if (o.rule(item.getValue(), item)) { - item.doRedMark.apply(item, args); - } else { - item.unRedMark.apply(item, args); - } - } else { - item.doBehavior.apply(item, args); - } - }) - } -});/** - * guy - * 控制器 - * Controller层超类 - * @class BI.Controller - * @extends BI.OB - * @abstract - */ -BI.Controller = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.Controller.superclass._defaultConfig.apply(this, arguments), { - - }) - }, - _init : function() { - BI.Controller.superclass._init.apply(this, arguments); - }, - - destroy: function(){ - - } -}); -BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__";/** - * 广播 - * - * Created by GUY on 2015/12/23. - * @class - */ -BI.BroadcastController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.BroadcastController.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.BroadcastController.superclass._init.apply(this, arguments); - this._broadcasts = {}; - }, - - on: function (name, fn) { - var self = this; - if (!this._broadcasts[name]) { - this._broadcasts[name] = []; - } - this._broadcasts[name].push(fn); - return function () { - self.remove(name, fn); - } - }, - - send: function (name) { - var args = [].slice.call(arguments, 1); - BI.each(this._broadcasts[name], function (i, fn) { - fn.apply(null, args); - }); - }, - - remove: function (name, fn) { - if (fn) { - this._broadcasts[name].remove(fn); - if (this._broadcasts[name].length === 0) { - delete this._broadcasts[name]; - } - } else { - delete this._broadcasts[name]; - } - return this; - } -});/** - * 气泡图控制器 - * 控制气泡图的显示方向 - * - * Created by GUY on 2015/8/21. - * @class - */ -BI.BubblesController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.BubblesController.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _const: { - bubbleHeight: 35 - }, - - _init: function () { - BI.BubblesController.superclass._init.apply(this, arguments); - this.bubblesManager = {}; - this.storeBubbles = {}; - }, - - _createBubble: function (direct, text, height) { - return BI.createWidget({ - type: "bi.bubble", - text: text, - height: height || 35, - direction: direct - }); - }, - - _getOffsetLeft: function (name, context, offsetStyle) { - var left = 0; - if ("center" === offsetStyle) { - left = context.element.offset().left + (context.element.bounds().width - this.get(name).element.bounds().width) / 2; - if (left < 0) { - left = 0; - } - return left; - } - if ("right" === offsetStyle) { - left = context.element.offset().left + context.element.bounds().width - this.get(name).element.bounds().width; - if (left < 0) { - left = 0; - } - return left; - } - return context.element.offset().left; - }, - - _getOffsetTop: function (name, context, offsetStyle) { - var top = 0; - if ("center" === offsetStyle) { - top = context.element.offset().top + (context.element.bounds().height - this.get(name).element.bounds().height) / 2; - if (top < 0) { - top = 0; - } - return top; - } else if ("right" === offsetStyle) { - top = context.element.offset().top + context.element.bounds().height - this.get(name).element.bounds().height; - if (top < 0) { - top = 0; - } - return top; - } - return context.element.offset().top; - }, - - _getLeftPosition: function (name, context, offsetStyle) { - var position = $.getLeftPosition(context, this.get(name)); - position.top = this._getOffsetTop(name, context, offsetStyle); - return position; - }, - - _getBottomPosition: function (name, context, offsetStyle) { - var position = $.getBottomPosition(context, this.get(name)); - position.left = this._getOffsetLeft(name, context, offsetStyle); - return position; - }, - - _getTopPosition: function (name, context, offsetStyle) { - var position = $.getTopPosition(context, this.get(name)); - position.left = this._getOffsetLeft(name, context, offsetStyle); - return position; - }, - - _getRightPosition: function (name, context, offsetStyle) { - var position = $.getRightPosition(context, this.get(name)); - position.top = this._getOffsetTop(name, context, offsetStyle); - return position; - }, - - /** - * - * @param name - * @param text - * @param context - * @param offsetStyle center, left, right三种类型, 默认left - * @returns {BI.BubblesController} - */ - show: function (name, text, context, opt) { - opt || (opt = {}); - var container = opt.container || context; - var offsetStyle = opt.offsetStyle || {}; - if (!this.storeBubbles[name]) { - this.storeBubbles[name] = {}; - } - if (!this.storeBubbles[name]["top"]) { - this.storeBubbles[name]["top"] = this._createBubble("top", text); - } - BI.createWidget({ - type: "bi.absolute", - element: container, - items: [{ - el: this.storeBubbles[name]["top"] - }] - }); - this.set(name, this.storeBubbles[name]["top"]); - var position = this._getTopPosition(name, context, offsetStyle); - this.get(name).element.css({left: position.left, top: position.top}); - this.get(name).invisible(); - if (!$.isTopSpaceEnough(context, this.get(name))) { - if (!this.storeBubbles[name]["left"]) { - this.storeBubbles[name]["left"] = this._createBubble("left", text, 30); - } - BI.createWidget({ - type: "bi.absolute", - element: container, - items: [{ - el: this.storeBubbles[name]["left"] - }] - }); - this.set(name, this.storeBubbles[name]["left"]); - var position = this._getLeftPosition(name, context, offsetStyle); - this.get(name).element.css({left: position.left, top: position.top}); - this.get(name).invisible(); - if (!$.isLeftSpaceEnough(context, this.get(name))) { - if (!this.storeBubbles[name]["right"]) { - this.storeBubbles[name]["right"] = this._createBubble("right", text, 30); - } - BI.createWidget({ - type: "bi.absolute", - element: container, - items: [{ - el: this.storeBubbles[name]["right"] - }] - }); - this.set(name, this.storeBubbles[name]["right"]); - var position = this._getRightPosition(name, context, offsetStyle); - this.get(name).element.css({left: position.left, top: position.top}); - this.get(name).invisible(); - if (!$.isRightSpaceEnough(context, this.get(name))) { - if (!this.storeBubbles[name]["bottom"]) { - this.storeBubbles[name]["bottom"] = this._createBubble("bottom", text); - } - BI.createWidget({ - type: "bi.absolute", - element: container, - items: [{ - el: this.storeBubbles[name]["bottom"] - }] - }); - this.set(name, this.storeBubbles[name]["bottom"]); - var position = this._getBottomPosition(name, context, offsetStyle); - this.get(name).element.css({left: position.left, top: position.top}); - this.get(name).invisible(); - } - } - } - this.get(name).setText(text); - this.get(name).visible(); - return this; - }, - - hide: function (name) { - if (!this.has(name)) { - return this; - } - this.get(name).invisible(); - return this; - }, - - add: function (name, bubble) { - if (this.has(name)) { - return this; - } - this.set(name, bubble); - return this; - }, - - get: function (name) { - return this.bubblesManager[name]; - }, - - set: function (name, bubble) { - this.bubblesManager[name] = bubble; - }, - - has: function (name) { - return this.bubblesManager[name] != null; - }, - - remove: function (name) { - if (!this.has(name)) { - return this; - } - BI.each(this.storeBubbles[name], function (dir, bubble) { - bubble.destroy(); - }); - delete this.storeBubbles[name]; - delete this.bubblesManager[name]; - return this; - } -});/** - * guy - * FloatBox弹出层控制器, z-index在100w层级 - * @class BI.FloatBoxController - * @extends BI.Controller - */ -BI.FloatBoxController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.FloatBoxController.superclass._defaultConfig.apply(this, arguments), { - modal: true, // 模态窗口 - render: "body" - }); - }, - - _init: function () { - BI.FloatBoxController.superclass._init.apply(this, arguments); - this.modal = this.options.modal; - this.floatManager = {}; - this.floatLayer = {}; - this.floatContainer = {}; - this.floatOpened = {}; - this.zindex = BI.zIndex_floatbox; - this.zindexMap = {}; - }, - - _check: function (name) { - return BI.isNotNull(this.floatManager[name]); - }, - - create: function (name, section, options) { - if (this._check(name)) { - return this; - } - var floatbox = BI.createWidget({ - type: "bi.float_box" - }, options); - floatbox.populate(section); - this.add(name, floatbox, options); - return this; - }, - - add: function (name, floatbox, options) { - var self = this; - options || (options = {}); - if (this._check(name)) { - return this; - } - this.floatContainer[name] = BI.createWidget({ - type: "bi.absolute", - cls: "bi-popup-view", - items: [{ - el: (this.floatLayer[name] = BI.createWidget({ - type: 'bi.absolute', - items: [floatbox] - })), - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); - this.floatManager[name] = floatbox; - (function (key) { - floatbox.on(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED, function () { - self.close(key); - }) - })(name); - BI.createWidget({ - type: "bi.absolute", - element: options.container || this.options.render, - items: [{ - el: this.floatContainer[name], - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); - return this; - }, - - open: function (name) { - if (!this._check(name)) { - return this; - } - if (!this.floatOpened[name]) { - this.floatOpened[name] = true; - var container = this.floatContainer[name]; - container.element.css("zIndex", this.zindex++); - this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]); - this.zindexMap[name] = this.zindex; - this.modal && container.element.__buildZIndexMask__(this.zindex++); - this.get(name).setZindex(this.zindex++); - this.floatContainer[name].visible(); - var floatbox = this.get(name); - floatbox.show(); - var W = $(this.options.render).width(), H = $(this.options.render).height(); - var w = floatbox.element.width(), h = floatbox.element.height(); - var left = (W - w) / 2, top = (H - h) / 2; - if (left < 0) { - left = 0; - } - if (top < 0) { - top = 0; - } - floatbox.element.css({ - left: left + "px", - top: top + "px" - }); - } - return this; - }, - - close: function (name) { - if (!this._check(name)) { - return this; - } - if (this.floatOpened[name]) { - delete this.floatOpened[name]; - this.floatContainer[name].invisible(); - this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); - } - return this; - }, - - get: function (name) { - return this.floatManager[name]; - }, - - remove: function (name) { - if (!this._check(name)) { - return this; - } - this.floatContainer[name].destroy(); - this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); - delete this.floatManager[name]; - delete this.floatLayer[name]; - delete this.zindexMap[name]; - delete this.floatContainer[name]; - delete this.floatOpened[name]; - return this; - } -});/** - * 弹出层面板控制器, z-index在10w层级 - * - * Created by GUY on 2015/6/24. - * @class - */ -BI.LayerController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.LayerController.superclass._defaultConfig.apply(this, arguments), { - render: "body" - }); - }, - - _init: function () { - BI.LayerController.superclass._init.apply(this, arguments); - this.layerManager = {}; - this.layouts = {}; - this.zindex = BI.zIndex_layer; - BI.Resizers.add("layerController" + BI.uniqueId(), BI.bind(this._resize, this)); - }, - - _resize: function () { - BI.each(this.layouts, function (i, layer) { - if (layer.element.is(":visible")) { - layer.element.trigger("__resize__"); - } - }) - }, - - make: function (name, container, op) { - if (this.has(name)) { - return this.get(name); - } - op || (op = {}); - var widget = BI.createWidget((op.render || {}), { - type: "bi.layout" - }); - BI.createWidget({ - type: "bi.absolute", - element: container || this.options.render, - items: [BI.extend({ - el: widget - }, { - top: 0, - left: 0, - right: 0, - bottom: 0 - }, op.offset)] - }); - this.add(name, widget, widget); - return widget; - }, - - create: function (name, from, op) { - if (this.has(name)) { - return this.get(name); - } - op || (op = {}); - var offset = op.offset || {}; - var w = from; - if (BI.isWidget(from)) { - w = from.element; - } - if (BI.isNotEmptyString(w)) { - w = $(w); - } - if (this.has(name)) { - return this.get(name); - } - var widget = BI.createWidget((op.render || {}), { - type: "bi.layout", - cls: op.cls - }); - var layout = BI.createWidget({ - type: "bi.absolute", - items: [{ - el: widget, - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); - BI.createWidget({ - type: "bi.absolute", - element: op.container || this.options.render, - items: [{ - el: layout, - left: offset.left || 0, - right: offset.right || 0, - top: offset.top || 0, - bottom: offset.bottom || 0 - }] - }); - if (w) { - layout.element.addClass("bi-popup-view"); - layout.element.css({ - left: w.offset().left + (offset.left || 0), - top: w.offset().top + (offset.top || 0), - width: offset.width || (w.outerWidth() - (offset.right || 0)) || "", - height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || "" - }); - layout.element.on("__resize__", function () { - w.is(":visible") && - layout.element.css({ - left: w.offset().left + (offset.left || 0), - top: w.offset().top + (offset.top || 0), - width: offset.width || (w.outerWidth() - (offset.right || 0)) || "", - height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || "" - }); - }); - } - this.add(name, widget, layout); - return widget; - }, - - hide: function (name, callback) { - if (!this.has(name)) { - return this; - } - this._getLayout(name).invisible(); - this._getLayout(name).element.hide(0, callback); - return this; - }, - - show: function (name, callback) { - if (!this.has(name)) { - return this; - } - this._getLayout(name).visible(); - this._getLayout(name).element.css("z-index", this.zindex++).show(0, callback).trigger("__resize__"); - return this; - }, - - isVisible: function (name) { - return this.has(name) && this._getLayout(name).isVisible(); - }, - - add: function (name, layer, layout) { - if (this.has(name)) { - throw new Error("name is already exist"); - } - layout.setVisible(false); - this.layerManager[name] = layer; - this.layouts[name] = layout; - layout.element.css("z-index", this.zindex++); - return this; - }, - - _getLayout: function (name) { - return this.layouts[name]; - }, - - get: function (name) { - return this.layerManager[name]; - }, - - has: function (name) { - return this.layerManager[name] != null; - }, - - remove: function (name) { - if (!this.has(name)) { - return this; - } - this.layerManager[name].destroy(); - this.layouts[name].destroy(); - delete this.layerManager[name]; - delete this.layouts[name]; - return this; - } -});/** - * 遮罩面板, z-index在1亿层级 - * - * Created by GUY on 2015/6/24. - * @class - */ -BI.MaskersController = BI.inherit(BI.LayerController, { - _defaultConfig: function () { - return BI.extend(BI.MaskersController.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.MaskersController.superclass._init.apply(this, arguments); - this.zindex = BI.zIndex_masker; - } -});/** - * window.resize 控制器 - * - * Created by GUY on 2015/6/24. - * @class - */ -BI.ResizeController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.ResizeController.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.ResizeController.superclass._init.apply(this, arguments); - var self = this; - this.resizerManger = {}; - var fn = BI.debounce(function (ev) { - //if (BI.isWindow(ev.target)) { - self._resize(ev); - //} - }, 30); - $(window).resize(fn); - }, - - _resize: function (ev) { - BI.each(this.resizerManger, function (key, resizer) { - if (resizer instanceof $) { - if (resizer.is(":visible")) { - resizer.trigger("__resize__"); - } - return; - } - if (resizer instanceof BI.Layout) { - resizer.resize(); - return; - } - if (BI.isFunction(resizer)) { - resizer(ev); - return; - } - }) - }, - - add: function (name, resizer) { - var self = this; - if (this.has(name)) { - return this; - } - this.resizerManger[name] = resizer; - return function () { - self.remove(name); - }; - }, - - get: function (name) { - return this.resizerManger[name]; - }, - - has: function (name) { - return this.resizerManger[name] != null; - }, - - remove: function (name) { - if (!this.has(name)) { - return this; - } - delete this.resizerManger[name]; - return this; - } -});/** - * tooltip控制器 - * 控制tooltip的显示, 且页面中只有一个tooltip显示 - * - * Created by GUY on 2015/9/8. - * @class BI.TooltipsController - * @extends BI.Controller - */ -BI.TooltipsController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.TooltipsController.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _const: { - height: 20 - }, - - _init: function () { - BI.TooltipsController.superclass._init.apply(this, arguments); - this.tooltipsManager = {}; - this.showingTips = {};//存储正在显示的tooltip - }, - - _createTooltip: function (text, level) { - return BI.createWidget({ - type: "bi.tooltip", - text: text, - level: level, - stopEvent: true, - height: this._const.height - }); - }, - - hide: function (name, callback) { - if (!this.has(name)) { - return this; - } - delete this.showingTips[name]; - this.get(name).element.hide(0, callback); - this.get(name).invisible(); - return this; - }, - - create: function (name, text, level, context) { - if (!this.has(name)) { - var tooltip = this._createTooltip(text, level); - this.add(name, tooltip); - BI.createWidget({ - type: "bi.absolute", - element: context || "body", - items: [{ - el: tooltip - }] - }); - tooltip.invisible(); - } - return this.get(name); - }, - - //opt: {container: '', belowMouse: false} - show: function (e, name, text, level, context, opt) { - opt || (opt = {}); - var self = this; - BI.each(this.showingTips, function (i, tip) { - self.hide(i); - }); - this.showingTips = {}; - if (!this.has(name)) { - this.create(name, text, level, opt.container || context); - } - - var offset = context.element.offset(); - var bounds = context.element.bounds(); - - var top = offset.top + bounds.height + 5; - var tooltip = this.get(name); - tooltip.setText(text); - tooltip.element.css({ - left: "0px", - top: "0px" - }); - tooltip.visible(); - tooltip.element.height(tooltip.element[0].scrollHeight); - this.showingTips[name] = true; - var x = e.pageX || e.clientX, y = (e.pageY || e.clientY) + 15; - if (x + tooltip.element.outerWidth() > $("body").outerWidth()) { - x -= tooltip.element.outerWidth(); - } - if (y + tooltip.element.outerHeight() > $("body").outerHeight()) { - y -= tooltip.element.outerHeight() + 15; - top = offset.top - tooltip.element.outerHeight() - 5; - !opt.belowMouse && (y = Math.min(y, top)); - } else { - !opt.belowMouse && (y = Math.max(y, top)); - } - tooltip.element.css({ - left: x < 0 ? 0 : x + "px", - top: y < 0 ? 0 : y + "px" - }); - tooltip.element.hover(function () { - self.remove(name); - context.element.trigger("mouseleave.title" + context.getName()); - }); - return this; - }, - - add: function (name, bubble) { - if (this.has(name)) { - return this; - } - this.set(name, bubble); - return this; - }, - - get: function (name) { - return this.tooltipsManager[name]; - }, - - set: function (name, bubble) { - this.tooltipsManager[name] = bubble; - }, - - has: function (name) { - return this.tooltipsManager[name] != null; - }, - - remove: function (name) { - if (!this.has(name)) { - return this; - } - this.tooltipsManager[name].destroy(); - delete this.tooltipsManager[name]; - return this; - } -});/** - * - * @class BI.FloatBoxRouter - * @extends BI.WRouter - */ -BI.FloatBoxRouter = BI.inherit(BI.WRouter, { - routes: {}, - - _init: function () { - this.store = {}; - this.views = {}; - }, - - createView: function (url, modelData, viewData, context) { - return BI.Factory.createView(url, this.get(url), modelData || {}, viewData || {}, context) - }, - - open: function (url, modelData, viewData, context, options) { - var self = this, isValid = BI.isKey(modelData); - options || (options = {}); - url = context.rootURL + "/" + url; - var data = void 0; - if (isValid) { - modelData = modelData + "";//避免modelData是数字 - var keys = modelData.split('.'); - BI.each(keys, function (i, k) { - if (i === 0) { - data = context.model.get(k) || {}; - } else { - data = data[k] || {}; - } - }); - data.id = options.id || keys[keys.length - 1]; - } else { - data = modelData; - } - BI.extend(data, options.data); - if (!this.controller) { - this.controller = new BI.FloatBoxController(); - } - if (!this.store[url]) { - this.store[url] = BI.createWidget({ - type: "bi.float_box" - }, options); - var view = this.createView(url, data, viewData, context); - isValid && context.model.addChild(modelData, view.model); - view.listenTo(view.model, "destroy", function () { - self.remove(url, context); - }); - context.on(BI.Events.UNMOUNT, function () { - self.remove(url, context); - }); - this.store[url].populate(view); - this.views[url] = view; - this.controller.add(url, this.store[url]); - context && context.on("end:" + view.cid, function () { - BI.nextTick(function () { - self.close(url); -// view.end(); - (context.listenEnd.apply(context, isValid ? modelData.split('.') : [modelData]) !== false) && context.populate(); - }, 30) - }).on("change:" + view.cid, _.bind(context.notifyParent, context)) - } - this.controller.open(url); - this.views[url].populate(data, options.force || true); - return this; - }, - - close: function (url) { - if (this.controller) { - this.controller.close(url); - } - return this; - }, - - remove: function (url, context) { - url = context.rootURL + "/" + url; - if (this.controller) { - this.controller.remove(url); - delete this.store[url]; - this.views[url] && this.views[url].model.destroy(); - delete this.views[url]; - } - return this; - } -});/** - * 统一绑定事件 - * @type {*|void|Object} - */ -BI.EventList = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.EventList.superclass._defaultConfig.apply(this, arguments), { - event: "click", - callback: BI.emptyFn, - handle: "", - items:[] - }); - }, - - _init : function() { - BI.EventList.superclass._init.apply(this, arguments); - this.populate(this.options.items); - }, - - _getHandle: function(item){ - var handle = this.options.handle ? _.result(item, this.options.handle) : item; - return handle.element || handle; - }, - - populate: function(items){ - var self = this, - event = this.options.event, - callback = this.options.callback; - BI.nextTick(function(){ - BI.each(items, function(i, item){ - var fn = callback(item); - BI.isFunction(fn) && (fn = BI.debounce(fn, BI.EVENT_RESPONSE_TIME, true)); - self._getHandle(item)[event](fn); - }) - }) - - } -});/** - * 统一监听jquery事件 - * @type {*|void|Object} - */ -BI.ListenerList = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.ListenerList.superclass._defaultConfig.apply(this, arguments), { - event: "click", - callback: BI.emptyFn, - items:[] - }); - }, - - _init : function() { - BI.ListenerList.superclass._init.apply(this, arguments); - this.populate(this.options.items); - }, - - _getHandle: function(item){ - var handle = this.options.handle ? _.result(item, this.options.handle) : item; - return handle.element || handle; - }, - - populate: function(items){ - var self = this, - event = this.options.event, - callback = this.options.callback; - BI.nextTick(function(){ - BI.each(items, function(i, item){ - var fn = callback(item); - BI.isFunction(fn) && (fn = BI.debounce(fn, BI.EVENT_RESPONSE_TIME, true)); - self._getHandle(item).on(event, fn); - }) - }) - } -});/** - * Created by GUY on 2015/6/25. - */ -/** - * 统一监听jquery事件 - * @type {*|void|Object} - */ -BI.OffList = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.OffList.superclass._defaultConfig.apply(this, arguments), { - event: "click", - items:[] - }); - }, - - _init : function() { - BI.OffList.superclass._init.apply(this, arguments); - this.populate(this.options.items); - }, - - _getHandle: function(item){ - var handle = this.options.handle ? _.result(item, this.options.handle) : item; - return handle.element || handle; - }, - - populate: function(items){ - var self = this, - event = this.options.event; - BI.each(items, function(i, item){ - self._getHandle(item).off(event); - }) - } -});/** - * 事件集合 - * @class BI.Events - */ -_.extend(BI, { - Events: { - - /** - * @static - * @property keydown事件 - */ - KEYDOWN: "_KEYDOWN", - - /** - * @static - * @property 回撤事件 - */ - BACKSPACE: "_BACKSPACE", - - /** - * @static - * @property 空格事件 - */ - SPACE: "_SPACE", - - /** - * @static - * @property 回车事件 - */ - ENTER: "_ENTER", - - /** - * @static - * @property 确定事件 - */ - CONFIRM: '_CONFIRM', - - /** - * @static - * @property 错误事件 - */ - ERROR: '_ERROR', - - /** - * @static - * @property 暂停事件 - */ - PAUSE: '_PAUSE', - - /** - * @static - * @property destroy事件 - */ - DESTROY: '_DESTROY', - - /** - * @static - * @property 取消挂载事件 - */ - UNMOUNT: '_UNMOUNT', - - /** - * @static - * @property 清除选择 - */ - CLEAR: '_CLEAR', - - /** - * @static - * @property 添加数据 - */ - ADD: '_ADD', - - /** - * @static - * @property 正在编辑状态事件 - */ - EDITING: '_EDITING', - - /** - * @static - * @property 空状态事件 - */ - EMPTY: '_EMPTY', - - /** - * @static - * @property 显示隐藏事件 - */ - VIEW: '_VIEW', - - /** - * @static - * @property 窗体改变大小 - */ - RESIZE: "_RESIZE", - - /** - * @static - * @property 编辑前事件 - */ - BEFOREEDIT: '_BEFOREEDIT', - - /** - * @static - * @property 编辑后事件 - */ - AFTEREDIT: '_AFTEREDIT', - - /** - * @static - * @property 开始编辑事件 - */ - STARTEDIT: '_STARTEDIT', - - /** - * @static - * @property 停止编辑事件 - */ - STOPEDIT: '_STOPEDIT', - - /** - * @static - * @property 值改变事件 - */ - CHANGE: '_CHANGE', - - /** - * @static - * @property 下拉弹出菜单事件 - */ - EXPAND: '_EXPAND', - - /** - * @static - * @property 关闭下拉菜单事件 - */ - COLLAPSE: '_COLLAPSE', - - /** - * @static - * @property 回调事件 - */ - CALLBACK: '_CALLBACK', - - /** - * @static - * @property 点击事件 - */ - CLICK: '_CLICK', - - /** - * @static - * @property 状态改变事件,一般是用在复选按钮和单选按钮 - */ - STATECHANGE: '_STATECHANGE', - - /** - * @static - * @property 状态改变前事件 - */ - BEFORESTATECHANGE: '_BEFORESTATECHANGE', - - - /** - * @static - * @property 初始化事件 - */ - INIT: '_INIT', - - /** - * @static - * @property 初始化后事件 - */ - AFTERINIT: '_AFTERINIT', - - /** - * @static - * @property 滚动条滚动事件 - */ - SCROLL: '_SCROLL', - - - /** - * @static - * @property 开始加载事件 - */ - STARTLOAD: '_STARTLOAD', - - /** - * @static - * @property 加载后事件 - */ - AFTERLOAD: '_AFTERLOAD', - - - /** - * @static - * @property 提交前事件 - */ - BS: 'beforesubmit', - - /** - * @static - * @property 提交后事件 - */ - AS: 'aftersubmit', - - /** - * @static - * @property 提交完成事件 - */ - SC: 'submitcomplete', - - /** - * @static - * @property 提交失败事件 - */ - SF: 'submitfailure', - - /** - * @static - * @property 提交成功事件 - */ - SS: 'submitsuccess', - - /** - * @static - * @property 校验提交前事件 - */ - BVW: 'beforeverifywrite', - - /** - * @static - * @property 校验提交后事件 - */ - AVW: 'afterverifywrite', - - /** - * @static - * @property 校验后事件 - */ - AV: 'afterverify', - - /** - * @static - * @property 填报前事件 - */ - BW: 'beforewrite', - - /** - * @static - * @property 填报后事件 - */ - AW: 'afterwrite', - - /** - * @static - * @property 填报成功事件 - */ - WS: 'writesuccess', - - /** - * @static - * @property 填报失败事件 - */ - WF: 'writefailure', - - /** - * @static - * @property 添加行前事件 - */ - BA: 'beforeappend', - - /** - * @static - * @property 添加行后事件 - */ - AA: 'afterappend', - - /** - * @static - * @property 删除行前事件 - */ - BD: 'beforedelete', - - /** - * @static - * @property 删除行后事件 - */ - AD: 'beforedelete', - - /** - * @static - * @property 未提交离开事件 - */ - UC: 'unloadcheck', - - - /** - * @static - * @property PDF导出前事件 - */ - BTOPDF: 'beforetopdf', - - /** - * @static - * @property PDF导出后事件 - */ - ATOPDF: 'aftertopdf', - - /** - * @static - * @property Excel导出前事件 - */ - BTOEXCEL: 'beforetoexcel', - - /** - * @static - * @property Excel导出后事件 - */ - ATOEXCEL: 'aftertoexcel', - - /** - * @static - * @property Word导出前事件 - */ - BTOWORD: 'beforetoword', - - /** - * @static - * @property Word导出后事件 - */ - ATOWORD: 'aftertoword', - - /** - * @static - * @property 图片导出前事件 - */ - BTOIMAGE: 'beforetoimage', - - /** - * @static - * @property 图片导出后事件 - */ - ATOIMAGE: 'aftertoimage', - - /** - * @static - * @property HTML导出前事件 - */ - BTOHTML: 'beforetohtml', - - /** - * @static - * @property HTML导出后事件 - */ - ATOHTML: 'aftertohtml', - - /** - * @static - * @property Excel导入前事件 - */ - BIMEXCEL: 'beforeimportexcel', - - /** - * @static - * @property Excel导出后事件 - */ - AIMEXCEL: 'afterimportexcel', - - /** - * @static - * @property PDF打印前事件 - */ - BPDFPRINT: 'beforepdfprint', - - /** - * @static - * @property PDF打印后事件 - */ - APDFPRINT: 'afterpdfprint', - - /** - * @static - * @property Flash打印前事件 - */ - BFLASHPRINT: 'beforeflashprint', - - /** - * @static - * @property Flash打印后事件 - */ - AFLASHPRINT: 'afterflashprint', - - /** - * @static - * @property Applet打印前事件 - */ - BAPPLETPRINT: 'beforeappletprint', - - /** - * @static - * @property Applet打印后事件 - */ - AAPPLETPRINT: 'afterappletprint', - - /** - * @static - * @property 服务器打印前事件 - */ - BSEVERPRINT: 'beforeserverprint', - - /** - * @static - * @property 服务器打印后事件 - */ - ASERVERPRINT: 'afterserverprint', - - /** - * @static - * @property 邮件发送前事件 - */ - BEMAIL: 'beforeemail', - - /** - * @static - * @property 邮件发送后事件 - */ - AEMAIL: 'afteremail' - } -});/** - * guy - * 最基础的dom操作 - */ -BI.extend(jQuery.fn, { - - destroy: function () { - this.remove(); - if (BI.isIE() === true) { - this[0].outerHTML = ''; - } - }, - /** - * 高亮显示 - * @param text 必需 - * @param keyword - * @param py 必需 - * @returns {*} - * @private - */ - __textKeywordMarked__: function (text, keyword, py) { - if (!BI.isKey(keyword)) { - return this.text((text + "").replaceAll(" ", " ")); - } - keyword = keyword + ""; - keyword = BI.toUpperCase(keyword); - var textLeft = (text || "") + ""; - py = (py || BI.makeFirstPY(text)) + ""; - if (py != null) { - py = BI.toUpperCase(py); - } - this.empty(); - while (true) { - var tidx = BI.toUpperCase(textLeft).indexOf(keyword); - var pidx = null; - if (py != null) { - pidx = py.indexOf(keyword); - if (pidx >= 0) { - pidx = pidx % text.length; - } - } - - if (tidx >= 0) { - this.append(textLeft.substr(0, tidx)); - this.append($("<span>").addClass("bi-keyword-red-mark") - .text(textLeft.substr(tidx, keyword.length).replaceAll(" ", " "))); - - textLeft = textLeft.substr(tidx + keyword.length); - if (py != null) { - py = py.substr(tidx + keyword.length); - } - } else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) { - this.append(textLeft.substr(0, pidx)); - this.append($("<span>").addClass("bi-keyword-red-mark") - .text(textLeft.substr(pidx, keyword.length).replaceAll(" ", " "))); - if (py != null) { - py = py.substr(pidx + keyword.length); - } - textLeft = textLeft.substr(pidx + keyword.length); - } else { - this.append(textLeft); - break; - } - } - - return this; - }, - - getDomHeight: function (parent) { - var clone = $(this).clone(); - clone.appendTo($(parent || "body")); - var height = clone.height(); - clone.remove(); - return height; - }, - - //是否有竖直滚动条 - hasVerticalScroll: function () { - return this.height() > 0 && this[0].clientWidth < this[0].offsetWidth; - }, - - //是否有水平滚动条 - hasHorizonScroll: function () { - return this.width() > 0 && this[0].clientHeight < this[0].offsetHeight; - }, - - //获取计算后的样式 - getStyle: function (name) { - var node = this[0]; - var computedStyle = void 0; - - // W3C Standard - if (window.getComputedStyle) { - // In certain cases such as within an iframe in FF3, this returns null. - computedStyle = window.getComputedStyle(node, null); - if (computedStyle) { - return computedStyle.getPropertyValue(BI.hyphenate(name)); - } - } - // Safari - if (document.defaultView && document.defaultView.getComputedStyle) { - computedStyle = document.defaultView.getComputedStyle(node, null); - // A Safari bug causes this to return null for `display: none` elements. - if (computedStyle) { - return computedStyle.getPropertyValue(BI.hyphenate(name)); - } - if (name === 'display') { - return 'none'; - } - } - // Internet Explorer - if (node.currentStyle) { - if (name === 'float') { - return node.currentStyle.cssFloat || node.currentStyle.styleFloat; - } - return node.currentStyle[BI.camelize(name)]; - } - return node.style && node.style[BI.camelize(name)]; - }, - - __isMouseInBounds__: function (e) { - var offset2Body = this.offset(); - return !(e.pageX < offset2Body.left || e.pageX > offset2Body.left + this.outerWidth() - || e.pageY < offset2Body.top || e.pageY > offset2Body.top + this.outerHeight()) - }, - - __hasZIndexMask__: function (zindex) { - return zindex && this.zIndexMask[zindex] != null; - }, - - __buildZIndexMask__: function (zindex, domArray) { - this.zIndexMask = this.zIndexMask || {};//存储z-index的mask - this.indexMask = this.indexMask || [];//存储mask - var mask = BI.createWidget({ - type: "bi.center_adapt", - cls: "bi-z-index-mask", - items: domArray - }); - - mask.element.css({"z-index": zindex}); - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: mask, - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); - this.indexMask.push(mask); - zindex && (this.zIndexMask[zindex] = mask); - return mask.element; - }, - - __releaseZIndexMask__: function (zindex) { - if (zindex && this.zIndexMask[zindex]) { - this.indexMask.remove(this.zIndexMask[zindex]); - this.zIndexMask[zindex].destroy(); - return; - } - this.indexMask = this.indexMask || []; - var indexMask = this.indexMask.pop(); - indexMask && indexMask.destroy(); - } -}); - -BI.extend(jQuery, { - - getLeftPosition: function (combo, popup, extraWidth) { - return { - left: combo.element.offset().left - popup.element.outerWidth() - (extraWidth || 0) - }; - }, - - getRightPosition: function (combo, popup, extraWidth) { - var el = combo.element; - return { - left: el.offset().left + el.outerWidth() + (extraWidth || 0) - } - }, - - getTopPosition: function (combo, popup, extraHeight) { - return { - top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0) - }; - }, - - getBottomPosition: function (combo, popup, extraHeight) { - var el = combo.element; - return { - top: el.offset().top + el.outerHeight() + (extraHeight || 0) - }; - }, - - isLeftSpaceEnough: function (combo, popup, extraWidth) { - return $.getLeftPosition(combo, popup, extraWidth).left >= 0; - }, - - isRightSpaceEnough: function (combo, popup, extraWidth) { - var viewBounds = popup.element.bounds(), windowBounds = $("body").bounds(); - return $.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width; - }, - - isTopSpaceEnough: function (combo, popup, extraHeight) { - return $.getTopPosition(combo, popup, extraHeight).top >= 0; - }, - - isBottomSpaceEnough: function (combo, popup, extraHeight) { - var viewBounds = popup.element.bounds(), windowBounds = $("body").bounds(); - return $.getBottomPosition(combo, popup, extraHeight).top + viewBounds.height <= windowBounds.height; - }, - - isRightSpaceLarger: function (combo) { - var windowBounds = $("body").bounds(); - return windowBounds.width - combo.element.offset().left - combo.element.bounds().width >= combo.element.offset().left; - }, - - isBottomSpaceLarger: function (combo) { - var windowBounds = $("body").bounds(); - return windowBounds.height - combo.element.offset().top - combo.element.bounds().height >= combo.element.offset().top; - }, - - getLeftAlignPosition: function (combo, popup, extraWidth) { - var viewBounds = popup.element.bounds(), windowBounds = $("body").bounds(); - var left = combo.element.offset().left + extraWidth; - if (left + viewBounds.width > windowBounds.width) { - left = windowBounds.width - viewBounds.width; - } - if (left < 0) { - left = 0; - } - return { - left: left - } - }, - - getLeftAdaptPosition: function (combo, popup, extraWidth) { - if ($.isLeftSpaceEnough(combo, popup, extraWidth)) { - return $.getLeftPosition(combo, popup, extraWidth); - } - return { - left: 0 - } - }, - - getRightAlignPosition: function (combo, popup, extraWidth) { - var comboBounds = combo.element.bounds(), viewBounds = popup.element.bounds(); - var left = combo.element.offset().left + comboBounds.width - viewBounds.width - extraWidth; - if (left < 0) { - left = 0; - } - return { - left: left - } - }, - - getRightAdaptPosition: function (combo, popup, extraWidth) { - if ($.isRightSpaceEnough(combo, popup, extraWidth)) { - return $.getRightPosition(combo, popup, extraWidth); - } - return { - left: $("body").bounds().width - popup.element.bounds().width - } - }, - - getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { - var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = $("body").bounds(); - var top, adaptHeight; - if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { - top = comboOffset.top + extraHeight; - } else if (needAdaptHeight) { - top = comboOffset.top + extraHeight; - adaptHeight = windowBounds.height - top; - } else { - top = windowBounds.height - popupBounds.height; - if (top < extraHeight) { - adaptHeight = windowBounds.height - extraHeight; - } - } - if (top < extraHeight) { - top = extraHeight; - } - return adaptHeight ? { - top: top, - adaptHeight: adaptHeight - } : { - top: top - } - }, - - getTopAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { - var popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); - if ($.isTopSpaceEnough(combo, popup, extraHeight)) { - return $.getTopPosition(combo, popup, extraHeight); - } - if (needAdaptHeight) { - return { - top: 0, - adaptHeight: combo.element.offset().top - extraHeight - } - } - if (popupBounds.height + extraHeight > windowBounds.height) { - return { - top: 0, - adaptHeight: windowBounds.height - extraHeight - } - } - return { - top: 0 - } - }, - - getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { - var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = $("body").bounds(); - var top, adaptHeight; - if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { - top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; - } else if (needAdaptHeight) { - top = 0; - adaptHeight = comboOffset.top + comboBounds.height - extraHeight; - } else { - top = 0; - if (popupBounds.height + extraHeight > windowBounds.height) { - adaptHeight = windowBounds.height - extraHeight; - } - } - if (top < 0) { - top = 0; - } - return adaptHeight ? { - top: top, - adaptHeight: adaptHeight - } : { - top: top - } - }, - - getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { - var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = $("body").bounds(); - if ($.isBottomSpaceEnough(combo, popup, extraHeight)) { - return $.getBottomPosition(combo, popup, extraHeight); - } - if (needAdaptHeight) { - return { - top: comboOffset.top + comboBounds.height + extraHeight, - adaptHeight: windowBounds.height - comboOffset.top - comboBounds.height - extraHeight - } - } - if (popupBounds.height + extraHeight > windowBounds.height) { - return { - top: extraHeight, - adaptHeight: windowBounds.height - extraHeight - } - } - return { - top: windowBounds.height - popupBounds.height - extraHeight - } - }, - - getCenterAdaptPosition: function (combo, popup) { - var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = $("body").bounds(); - var left; - if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) { - left = windowBounds.width - popupBounds.width; - } else { - left = comboOffset.left + comboBounds.width / 2 - popupBounds.width / 2; - } - if (left < 0) { - left = 0; - } - return { - left: left - } - }, - - getMiddleAdaptPosition: function (combo, popup) { - var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = $("body").bounds(); - var top; - if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) { - top = windowBounds.height - popupBounds.height; - } else { - top = comboOffset.top + comboBounds.height / 2 - popupBounds.height / 2; - } - if (top < 0) { - top = 0; - } - return { - top: top - } - }, - - getComboPositionByDirections: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions) { - extraWidth || (extraWidth = 0); - extraHeight || (extraHeight = 0); - var i, direct; - var leftRight = [], topBottom = []; - var isNeedAdaptHeight = false, tbFirst = false, lrFirst = false; - var left, top, pos; - for (i = 0; i < directions.length; i++) { - direct = directions[i]; - switch (direct) { - case "left": - leftRight.push(direct); - break; - case "right": - leftRight.push(direct); - break; - case "top": - topBottom.push(direct); - break; - case "bottom": - topBottom.push(direct); - break; - } - } - for (i = 0; i < directions.length; i++) { - direct = directions[i]; - switch (direct) { - case "left": - if (!isNeedAdaptHeight) { - var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight; - if ($.isLeftSpaceEnough(combo, popup, tW)) { - left = $.getLeftPosition(combo, popup, tW).left; - if (topBottom[0] === "bottom") { - pos = $.getTopAlignPosition(combo, popup, tH, needAdaptHeight); - pos.dir = "left,bottom"; - } else { - pos = $.getBottomAlignPosition(combo, popup, tH, needAdaptHeight); - pos.dir = "left,top"; - } - if (tbFirst) { - pos.change = "left"; - } - pos.left = left; - return pos; - } - } - lrFirst = true; - break; - case "right": - if (!isNeedAdaptHeight) { - var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight; - if ($.isRightSpaceEnough(combo, popup, tW)) { - left = $.getRightPosition(combo, popup, tW).left; - if (topBottom[0] === "bottom") { - pos = $.getTopAlignPosition(combo, popup, tH, needAdaptHeight); - pos.dir = "right,bottom"; - } else { - pos = $.getBottomAlignPosition(combo, popup, tH, needAdaptHeight); - pos.dir = "right,top"; - } - if (tbFirst) { - pos.change = "right"; - } - pos.left = left; - return pos; - } - } - lrFirst = true; - break; - case "top": - var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight; - if ($.isTopSpaceEnough(combo, popup, tH)) { - top = $.getTopPosition(combo, popup, tH).top; - if (leftRight[0] === "right") { - pos = $.getLeftAlignPosition(combo, popup, tW, needAdaptHeight); - pos.dir = "top,right"; - } else { - pos = $.getRightAlignPosition(combo, popup, tW); - pos.dir = "top,left"; - } - if (lrFirst) { - pos.change = "top"; - } - pos.top = top; - return pos; - } - if (needAdaptHeight) { - isNeedAdaptHeight = true; - } - tbFirst = true; - break; - case "bottom": - var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight; - if ($.isBottomSpaceEnough(combo, popup, tH)) { - top = $.getBottomPosition(combo, popup, tH).top; - if (leftRight[0] === "right") { - pos = $.getLeftAlignPosition(combo, popup, tW, needAdaptHeight); - pos.dir = "bottom,right"; - } else { - pos = $.getRightAlignPosition(combo, popup, tW); - pos.dir = "bottom,left"; - } - if (lrFirst) { - pos.change = "bottom"; - } - pos.top = top; - return pos; - } - if (needAdaptHeight) { - isNeedAdaptHeight = true; - } - tbFirst = true; - break; - } - } - - switch (directions[0]) { - case "left": - case "right": - if ($.isRightSpaceLarger(combo)) { - left = $.getRightAdaptPosition(combo, popup, extraWidth).left; - } else { - left = $.getLeftAdaptPosition(combo, popup, extraWidth).left; - } - if (topBottom[0] === "bottom") { - pos = $.getTopAlignPosition(combo, popup, extraHeight, needAdaptHeight); - pos.left = left; - pos.dir = directions[0] + ",bottom"; - return pos; - } - pos = $.getBottomAlignPosition(combo, popup, extraHeight, needAdaptHeight); - pos.left = left; - pos.dir = directions[0] + ",top"; - return pos; - default : - if ($.isBottomSpaceLarger(combo)) { - pos = $.getBottomAdaptPosition(combo, popup, extraHeight, needAdaptHeight); - } else { - pos = $.getTopAdaptPosition(combo, popup, extraHeight, needAdaptHeight); - } - if (leftRight[0] === "right") { - left = $.getLeftAlignPosition(combo, popup, extraWidth, needAdaptHeight).left; - pos.left = left; - pos.dir = directions[0] + ",right"; - return pos; - } - left = $.getRightAlignPosition(combo, popup, extraWidth).left; - pos.left = left; - pos.dir = directions[0] + ",left"; - return pos; - } - }, - - - getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle) { - extraWidth || (extraWidth = 0); - extraHeight || (extraHeight = 0); - var bodyHeight = $("body").bounds().height - extraHeight; - var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight); - popup.resetHeight && popup.resetHeight(maxHeight); - var position = $.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ['bottom', 'top', 'right', 'left']); - switch (offsetStyle) { - case "center": - if (position.change) { - var p = $.getMiddleAdaptPosition(combo, popup); - position.top = p.top; - } else { - var p = $.getCenterAdaptPosition(combo, popup); - position.left = p.left; - } - break; - case "middle": - if (position.change) { - var p = $.getCenterAdaptPosition(combo, popup); - position.left = p.left; - } else { - var p = $.getMiddleAdaptPosition(combo, popup); - position.top = p.top; - } - break; - } - if (needAdaptHeight === true) { - popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); - } - return position; - } -});/** - * 基本的函数 - * Created by GUY on 2015/6/24. - */ -BI.Func = {}; -BI.extend(BI.Func, { - - /** - * 获取搜索结果 - * @param items - * @param keyword - * @param param 搜索哪个属性 - */ - getSearchResult: function (items, keyword, param) { - var isArray = BI.isArray(items); - items = isArray ? BI.flatten(items) : items; - param || (param = "text"); - if (!BI.isKey(keyword)) { - return { - finded: BI.deepClone(items), - matched: isArray ? [] : {} - }; - } - var t, text, py; - keyword = BI.toUpperCase(keyword); - var matched = isArray ? [] : {}, finded = isArray ? [] : {}; - BI.each(items, function (i, item) { - item = BI.deepClone(item); - t = BI.stripEL(item); - text = t[param] || t.text || t.value || t.name || t; - py = BI.makeFirstPY(text); - text = BI.toUpperCase(text); - py = BI.toUpperCase(py); - var pidx; - if (text.indexOf(keyword) > -1) { - if (text === keyword) { - isArray ? matched.push(item) : (matched[i] = item); - } else { - isArray ? finded.push(item) : (finded[i] = item); - } - } else if (pidx = py.indexOf(keyword), (pidx > -1 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length))) { - if (text === keyword || keyword.length === text.length) { - isArray ? matched.push(item) : (matched[i] = item); - } else { - isArray ? finded.push(item) : (finded[i] = item); - } - } - }); - return { - matched: matched, - finded: finded - } - }, -}); - -/** - * 对DOM操作的通用函数 - * @type {{}} - */ -BI.DOM = {}; -BI.extend(BI.DOM, { - - /** - * 把dom数组或元素悬挂起来,使其不对html产生影响 - * @param dom - */ - hang: function (doms) { - if (BI.isEmpty(doms)) { - return; - } - var frag = document.createDocumentFragment(); - BI.each(doms, function (i, dom) { - dom instanceof BI.Widget && (dom = dom.element); - dom instanceof $ && dom[0] && frag.appendChild(dom[0]); - }); - return frag; - }, - - isExist: function (obj) { - return $("body").find(obj.element).length > 0; - }, - - //预加载图片 - preloadImages: function (srcArray, onload) { - var count = 0, images = []; - - function complete() { - count++; - if (count >= srcArray.length) { - onload(); - } - } - - BI.each(srcArray, function (i, src) { - images[i] = new Image(); - images[i].src = src; - images[i].onload = function () { - complete() - }; - images[i].onerror = function () { - complete() - }; - }); - }, - - isColor: function (color) { - return color && (this.isRGBColor(color) || this.isHexColor(color)); - }, - - isRGBColor: function (color) { - if (!color) { - return false; - } - return color.substr(0, 3) === "rgb"; - }, - - isHexColor: function (color) { - if (!color) { - return false; - } - return color[0] === "#" && color.length === 7; - }, - - isDarkColor: function (hex) { - if (!hex || !this.isHexColor(hex)) { - return false; - } - var rgb = this.rgb2json(this.hex2rgb(hex)); - var grayLevel = Math.round(rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114); - if (grayLevel < 192/**网上给的是140**/) { - return true; - } - return false; - }, - - //获取对比颜色 - getContrastColor: function (color) { - if (!color || !this.isColor(color)) { - return ""; - } - if (this.isDarkColor(color)) { - return "#ffffff"; - } - return "#1a1a1a"; - }, - - rgb2hex: function (rgbColour) { - if (!rgbColour || rgbColour.substr(0, 3) != "rgb") { - return ""; - } - var rgbValues = rgbColour.match(/\d+(\.\d+)?/g); - var red = BI.parseInt(rgbValues[0]); - var green = BI.parseInt(rgbValues[1]); - var blue = BI.parseInt(rgbValues[2]); - - var hexColour = "#" + this.int2hex(red) + this.int2hex(green) + this.int2hex(blue); - - return hexColour; - }, - - rgb2json: function (rgbColour) { - if (!rgbColour) { - return {}; - } - if (!this.isRGBColor(rgbColour)) { - return {}; - } - var rgbValues = rgbColour.match(/\d+(\.\d+)?/g); - return { - r: BI.parseInt(rgbValues[0]), - g: BI.parseInt(rgbValues[1]), - b: BI.parseInt(rgbValues[2]) - }; - }, - - rgba2json: function (rgbColour) { - if (!rgbColour) { - return {}; - } - var rgbValues = rgbColour.match(/\d+(\.\d+)?/g); - return { - r: BI.parseInt(rgbValues[0]), - g: BI.parseInt(rgbValues[1]), - b: BI.parseInt(rgbValues[2]), - a: BI.parseFloat(rgbValues[3]) - }; - }, - - json2rgb: function (rgb) { - if (!BI.isKey(rgb.r) || !BI.isKey(rgb.g) || !BI.isKey(rgb.b)) { - return ""; - } - return "rgb(" + rgb.r + "," + rgb.g + "," + rgb.b + ")"; - }, - - json2rgba: function (rgba) { - if (!BI.isKey(rgba.r) || !BI.isKey(rgba.g) || !BI.isKey(rgba.b)) { - return ""; - } - return "rgba(" + rgba.r + "," + rgba.g + "," + rgba.b + "," + rgba.a + ")"; - }, - - int2hex: function (strNum) { - var hexdig = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; - - return hexdig[strNum >>> 4] + '' + hexdig[strNum & 15]; - }, - - hex2rgb: function (color) { - if (!color) { - return ""; - } - if (!this.isHexColor(color)) { - return color; - } - var tempValue = "rgb(", colorArray; - - if (color.length === 7) { - colorArray = [BI.parseInt('0x' + color.substring(1, 3)), - BI.parseInt('0x' + color.substring(3, 5)), - BI.parseInt('0x' + color.substring(5, 7))]; - } - else if (color.length === 4) { - colorArray = [BI.parseInt('0x' + color.substring(1, 2)), - BI.parseInt('0x' + color.substring(2, 3)), - BI.parseInt('0x' + color.substring(3, 4))]; - } - tempValue += colorArray[0] + ","; - tempValue += colorArray[1] + ","; - tempValue += colorArray[2] + ")"; - - return tempValue; - }, - - rgba2rgb: function (rgbColour, BGcolor) { - if (BI.isNull(BGcolor)) { - BGcolor = 1; - } - if (rgbColour.substr(0, 4) != "rgba") { - return ""; - } - var rgbValues = rgbColour.match(/\d+(\.\d+)?/g); - if (rgbValues.length < 4) { - return ""; - } - var R = BI.parseFloat(rgbValues[0]); - var G = BI.parseFloat(rgbValues[1]); - var B = BI.parseFloat(rgbValues[2]); - var A = BI.parseFloat(rgbValues[3]); - - return "rgb(" + Math.floor(255 * (BGcolor * (1 - A )) + R * A) + "," + - Math.floor(255 * (BGcolor * (1 - A )) + G * A) + "," + - Math.floor(255 * (BGcolor * (1 - A )) + B * A) + ")"; - }, - - getTextSizeWidth: function (text, fontSize) { - var span = $("<span></span>").addClass("text-width-span").appendTo($("body")); - - if (fontSize == null) { - fontSize = 12; - } - fontSize = fontSize + "px"; - - span.css("font-size", fontSize).text(text); - - var width = span.width(); - span.remove(); - - return width; - }, - - //获取滚动条的宽度 - getScrollWidth: function () { - if (this._scrollWidth == null) { - var ul = $("<div>").width(50).height(50).css({ - position: "absolute", - top: "-9999px", - overflow: "scroll" - }).appendTo($("body")); - this._scrollWidth = ul[0].offsetWidth - ul[0].clientWidth; - ul.destroy(); - } - return this._scrollWidth; - } -});/** - * guy - * 检测某个Widget的EventChange事件然后去show某个card - * @type {*|void|Object} - * @class BI.ShowListener - * @extends BI.OB - */ -BI.ShowListener = BI.inherit(BI.OB, { - _defaultConfig: function () { - return BI.extend(BI.ShowListener.superclass._defaultConfig.apply(this, arguments), { - eventObj: BI.createWidget(), - cardLayout: null, - cardNameCreator: function (v) { - return v; - }, - cardCreator: BI.emptyFn, - afterCardCreated: BI.emptyFn, - afterCardShow: BI.emptyFn - }); - }, - - _init: function () { - BI.ShowListener.superclass._init.apply(this, arguments); - var self = this, o = this.options; - o.eventObj.on(BI.Controller.EVENT_CHANGE, function (type, v, ob) { - if (type === BI.Events.CLICK) { - v = v || o.eventObj.getValue(); - v = BI.isArray(v) ? (v.length > 1 ? v.toString() : v[0]) : v; - if (BI.isNull(v)) { - throw new Error("value cannot be null"); - } - var cardName = o.cardNameCreator(v); - if (!o.cardLayout.isCardExisted(cardName)) { - var card = o.cardCreator(cardName); - o.cardLayout.addCardByName(cardName, card); - o.afterCardCreated(cardName); - } - o.cardLayout.showCardByName(cardName); - BI.nextTick(function () { - o.afterCardShow(cardName); - self.fireEvent(BI.ShowListener.EVENT_CHANGE, cardName); - }); - } - }) - } -}); -BI.ShowListener.EVENT_CHANGE = "ShowListener.EVENT_CHANGE";/** - * style加载管理器 - * - * Created by GUY on 2015/9/7. - * @class - */ -BI.StyleLoaderManager = BI.inherit(BI.OB, { - _defaultConfig: function () { - return BI.extend(BI.StyleLoaderManager.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.StyleLoaderManager.superclass._init.apply(this, arguments); - this.stylesManager = {}; - }, - - loadStyle: function (name, styleString) { - var d = document, styles = d.createElement('style'); - d.getElementsByTagName('head')[0].appendChild(styles); - styles.setAttribute('type', 'text/css'); - if (styles.styleSheet) { - styles.styleSheet.cssText = styleString; - } else { - styles.appendChild(document.createTextNode(styleString)); - } - this.stylesManager[name] = styles; - - return this; - }, - - get: function (name) { - return this.stylesManager[name]; - }, - - has: function (name) { - return this.stylesManager[name] != null; - }, - - removeStyle: function (name) { - if (!this.has(name)) { - return this; - } - this.stylesManager[name].parentNode.removeChild(this.stylesManager[name]); - delete this.stylesManager[name]; - return this; - } -});/** - * @class BI.Logic - * @extends BI.OB - */ -BI.Logic = BI.inherit(BI.OB, { - createLogic: function () { - return this.options || {}; - } -}); - -BI.LogicFactory = { - Type: { - Vertical: "vertical", - Horizontal: "horizontal", - Table: "table", - HorizontalFill: "horizontal_fill" - }, - createLogic: function (key, options) { - var logic; - switch (key) { - case BI.LogicFactory.Type.Vertical: - logic = BI.VerticalLayoutLogic; - break; - case BI.LogicFactory.Type.Horizontal: - logic = BI.HorizontalLayoutLogic; - break; - case BI.LogicFactory.Type.Table: - logic = BI.TableLayoutLogic; - break; - case BI.LogicFactory.Type.HorizontalFill: - logic = BI.HorizontalFillLayoutLogic; - break; - default : - logic = BI.Logic; - break; - } - return new logic(options).createLogic(); - }, - - createLogicTypeByDirection: function (direction) { - switch (direction) { - case BI.Direction.Top: - case BI.Direction.Bottom: - case BI.Direction.Custom: - return BI.LogicFactory.Type.Vertical; - break; - case BI.Direction.Left: - case BI.Direction.Right: - return BI.LogicFactory.Type.Horizontal; - } - }, - - createLogicItemsByDirection: function (direction) { - var layout; - var items = Array.prototype.slice.call(arguments, 1); - items = BI.map(items, function (i, item) { - if (BI.isWidget(item)) { - return { - el: item, - width: item.options.width, - height: item.options.height - } - } - return item; - }); - switch (direction) { - case BI.Direction.Bottom: - layout = BI.LogicFactory.Type.Vertical; - items.reverse(); - break; - case BI.Direction.Right: - layout = BI.LogicFactory.Type.Horizontal; - items.reverse(); - break; - case BI.Direction.Custom: - items = items.slice(1); - break; - } - return items; - } -};/** - * guy - * 上下布局逻辑 - * 上下布局的时候要考虑到是动态布局还是静态布局 - * - * @class BI.VerticalLayoutLogic - * @extends BI.Logic - */ -BI.VerticalLayoutLogic = BI.inherit(BI.Logic, { - _defaultConfig: function () { - return BI.extend(BI.VerticalLayoutLogic.superclass._defaultConfig.apply(this, arguments), { - dynamic: false, - scrollable: null, - scrolly: false, - scrollx: false, - items: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - createLogic: function () { - var layout, o = this.options; - if (o.dynamic) { - layout = "bi.vertical"; - } else { - layout = "bi.vtape"; - } - return { - type: layout, - scrollable: o.scrollable, - scrolly: o.scrolly, - scrollx: o.scrollx, - hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, - items: o.items - } - }, - - _init: function () { - BI.VerticalLayoutLogic.superclass._init.apply(this, arguments); - } -}); - - -/** - * guy - * 左右布局逻辑 - * 左右布局的时候要考虑到是动态布局还是静态布局 - * - * @class BI.HorizontalLayoutLogic - * @extends BI.Logic - */ -BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, { - _defaultConfig: function () { - return BI.extend(BI.HorizontalLayoutLogic.superclass._defaultConfig.apply(this, arguments), { - dynamic: false, - scrollable: null, - scrolly: false, - scrollx: false, - items: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - createLogic: function () { - var layout, o = this.options; - if (o.dynamic) { - layout = "bi.horizontal"; - } else { - layout = "bi.htape"; - } - return { - type: layout, - scrollable: o.scrollable, - scrolly: o.scrolly, - scrollx: o.scrollx, - hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, - items: o.items - } - }, - - _init: function () { - BI.HorizontalLayoutLogic.superclass._init.apply(this, arguments); - } -}); - -/** - * guy - * 表格布局逻辑 - * 表格布局的时候要考虑到是动态布局还是静态布局 - * - * @class BI.TableLayoutLogic - * @extends BI.OB - */ -BI.TableLayoutLogic = BI.inherit(BI.Logic, { - _defaultConfig: function () { - return BI.extend(BI.TableLayoutLogic.superclass._defaultConfig.apply(this, arguments), { - dynamic: false, - scrollable: null, - scrolly: false, - scrollx: false, - columns: 0, - rows: 0, - columnSize: [], - rowSize: [], - hgap: 0, - vgap: 0, - items: [] - }); - }, - - createLogic: function () { - var layout, o = this.options; - if (o.dynamic) { - layout = "bi.table"; - } else { - layout = "bi.window"; - } - return { - type: layout, - scrollable: o.scrollable, - scrolly: o.scrolly, - scrollx: o.scrollx, - columns: o.columns, - rows: o.rows, - columnSize: o.columnSize, - rowSize: o.rowSize, - hgap: o.hgap, - vgap: o.vgap, - items: o.items - } - }, - - _init: function () { - BI.TableLayoutLogic.superclass._init.apply(this, arguments); - } -}); - -/** - * guy - * 左右充满布局逻辑 - * - * @class BI.HorizontalFillLayoutLogic - * @extends BI.Logic - */ -BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, { - _defaultConfig: function () { - return BI.extend(BI.HorizontalFillLayoutLogic.superclass._defaultConfig.apply(this, arguments), { - dynamic: false, - scrollable: null, - scrolly: false, - scrollx: false, - items: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - createLogic: function () { - var layout, o = this.options; - var columnSize = []; - BI.each(o.items, function (i, item) { - columnSize.push(item.width || 0); - }); - if (o.dynamic) { - layout = "bi.horizontal_adapt"; - } else { - layout = "bi.htape"; - } - return { - type: layout, - columnSize: columnSize, - scrollable: o.scrollable, - scrolly: o.scrolly, - scrollx: o.scrollx, - hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, - items: o.items - } - }, - - _init: function () { - BI.HorizontalFillLayoutLogic.superclass._init.apply(this, arguments); - } -});BI.Plugin = BI.Plugin || {}; -; -(function () { - var _WidgetsPlugin = {}; - var _ObjectPlugin = {}; - BI.extend(BI.Plugin, { - - getWidget: function (type, options) { - if (_WidgetsPlugin[type]) { - var res; - for (var i = _WidgetsPlugin[type].length-1; i >=0; i--) { - if (res = _WidgetsPlugin[type][i](options)) { - return res; - } - } - } - return options; - }, - - registerWidget: function (type, fn) { - if (!_WidgetsPlugin[type]) { - _WidgetsPlugin[type] = []; - } - if (_WidgetsPlugin[type].length > 0) { - console.log("组件已经注册过了!"); - } - _WidgetsPlugin[type].push(fn); - }, - - relieveWidget: function (type) { - delete _WidgetsPlugin[type]; - }, - - getObject: function (type, object) { - if (_ObjectPlugin[type]) { - var res; - for (var i = 0, len = _ObjectPlugin[type].length; i < len; i++) { - res = _ObjectPlugin[type][i](object); - } - } - return res || object; - }, - - registerObject: function (type, fn) { - if (!_ObjectPlugin[type]) { - _ObjectPlugin[type] = []; - } - if (_ObjectPlugin[type].length > 0) { - console.log("对象已经注册过了!"); - } - _ObjectPlugin[type].push(fn); - }, - - relieveObject: function (type) { - delete _ObjectPlugin[type]; - } - }); -})();/** - * 对数组对象的扩展 - * @class Array - */ -$.extend(Array.prototype, { - contains: function (o) { - return this.indexOf(o) > -1; - }, - - /** - * 从数组中移除指定的值,如果值不在数组中,则不产生任何效果 - * @param {Object} o 要移除的值 - * @return {Array} 移除制定值后的数组 - */ - remove: function (o) { - var index = this.indexOf(o); - if (index !== -1) { - this.splice(index, 1); - } - return this; - }, - - pushArray: function (array) { - for (var i = 0; i < array.length; i++) { - this.push(array[i]); - } - }, - pushDistinct: function (obj) { - if (!this.contains(obj)) { - this.push(obj); - } - }, - pushDistinctArray: function (array) { - for (var i = 0, len = array.length; i < len; i++) { - this.pushDistinct(array[i]); - } - } -}); - -BI.Cache = { - _prefix: "bi", - setUsername: function (username) { - localStorage.setItem(BI.Cache._prefix + ".username", (username + "" || "").toUpperCase()); - }, - getUsername: function () { - return localStorage.getItem(BI.Cache._prefix + ".username") || ""; - }, - _getKeyPrefix: function () { - return BI.Cache.getUsername() + "." + BI.Cache._prefix + "."; - }, - _generateKey: function (key) { - return BI.Cache._getKeyPrefix() + (key || ""); - }, - getItem: function (key) { - return localStorage.getItem(BI.Cache._generateKey(key)); - }, - setItem: function (key, value) { - localStorage.setItem(BI.Cache._generateKey(key), value); - }, - removeItem: function (key) { - localStorage.removeItem(BI.Cache._generateKey(key)); - }, - clear: function () { - for (var i = localStorage.length; i >= 0; i--) { - var key = localStorage.key(i); - if (key) { - if (key.indexOf(BI.Cache._getKeyPrefix()) === 0) { - localStorage.removeItem(key); - } - } - } - }, - keys: function () { - var result = []; - for (var i = localStorage.length; i >= 0; i--) { - var key = localStorage.key(i); - if (key) { - var prefix = BI.Cache._getKeyPrefix(); - if (key.indexOf(prefix) === 0) { - result[result.length] = key.substring(prefix.length); - } - } - } - return result; - }, - - addCookie: function (name, value, path, expiresHours) { - var cookieString = name + "=" + escape(value); - // 判断是否设置过期时间 - if (expiresHours && expiresHours > 0) { - var date = new Date(); - date.setTime(date.getTime() + expiresHours * 3600 * 1000); - cookieString = cookieString + "; expires=" + date.toGMTString(); - } - if (path) { - cookieString = cookieString + "; path=" + path; - } - document.cookie = cookieString; - }, - getCookie: function (name) { - var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); - if (arr = document.cookie.match(reg)) - return unescape(arr[2]); - else - return null; - }, - deleteCookie: function (name, path) { - var date = new Date(); - date.setTime(date.getTime() - 10000); - var cookieString = name + "=v; expires=" + date.toGMTString(); - if (path) { - cookieString = cookieString + "; path=" + path; - } - document.cookie = cookieString; - } -};// full day names -Date._DN = [BI.i18nText("BI-Basic_Sunday"), - BI.i18nText("BI-Basic_Monday"), - BI.i18nText("BI-Basic_Tuesday"), - BI.i18nText("BI-Basic_Wednesday"), - BI.i18nText("BI-Basic_Thursday"), - BI.i18nText("BI-Basic_Friday"), - BI.i18nText("BI-Basic_Saturday"), - BI.i18nText("BI-Basic_Sunday")]; - -// short day names -Date._SDN = [BI.i18nText("BI-Basic_Simple_Sunday"), - BI.i18nText("BI-Basic_Simple_Monday"), - BI.i18nText("BI-Basic_Simple_Tuesday"), - BI.i18nText("BI-Basic_Simple_Wednesday"), - BI.i18nText("BI-Basic_Simple_Thursday"), - BI.i18nText("BI-Basic_Simple_Friday"), - BI.i18nText("BI-Basic_Simple_Saturday"), - BI.i18nText("BI-Basic_Simple_Sunday")]; - -// Monday first, etc. -Date._FD = 1; - -// full month namesdat -Date._MN = [ - BI.i18nText("BI-Basic_January"), - BI.i18nText("BI-Basic_February"), - BI.i18nText("BI-Basic_March"), - BI.i18nText("BI-Basic_April"), - BI.i18nText("BI-Basic_May"), - BI.i18nText("BI-Basic_June"), - BI.i18nText("BI-Basic_July"), - BI.i18nText("BI-Basic_August"), - BI.i18nText("BI-Basic_September"), - BI.i18nText("BI-Basic_October"), - BI.i18nText("BI-Basic_November"), - BI.i18nText("BI-Basic_December")]; - -// short month names -Date._SMN = [0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11]; - -Date._QN = ["", BI.i18nText("BI-Quarter_1"), - BI.i18nText("BI-Quarter_2"), - BI.i18nText("BI-Quarter_3"), - BI.i18nText("BI-Quarter_4")]; - -/** Adds the number of days array to the Date object. */ -Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - -/** Constants used for time computations */ -Date.SECOND = 1000 /* milliseconds */; -Date.MINUTE = 60 * Date.SECOND; -Date.HOUR = 60 * Date.MINUTE; -Date.DAY = 24 * Date.HOUR; -Date.WEEK = 7 * Date.DAY; - -/** - * 获取时区 - * @returns {String} - */ -Date.prototype.getTimezone = function () { - return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, ""); -}; - -/** Returns the number of days in the current month */ -Date.prototype.getMonthDays = function (month) { - var year = this.getFullYear(); - if (typeof month == "undefined") { - month = this.getMonth(); - } - if (((0 == (year % 4)) && ( (0 != (year % 100)) || (0 == (year % 400)))) && month == 1) { - return 29; - } else { - return Date._MD[month]; - } -}; - -/** Returns the number of day in the year. */ -Date.prototype.getDayOfYear = function () { - var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); - var time = now - then; - return Math.floor(time / Date.DAY); -}; - -/** Returns the number of the week in year, as defined in ISO 8601. */ -Date.prototype.getWeekNumber = function () { - var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var week = d.getDay(); - if (this.getMonth() === 0 && this.getDate() <= week) { - return 1; - } - d.setDate(this.getDate() - week); - var ms = d.valueOf(); // GMT - d.setMonth(0); - d.setDate(1); - var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; - if (d.getDay() > 0) { - offset++; - } - return offset; -}; - -//离当前时间多少天的时间 -Date.prototype.getOffsetDate = function (offset) { - return new Date(this.getTime() + offset * 864e5); -}; - -Date.prototype.getAfterMulQuarter = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() + n * 3); - return dt; -}; -//获得n个季度前的日期 -Date.prototype.getBeforeMulQuarter = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() - n * 3); - return dt; -}; -//得到本季度的起始月份 -Date.prototype.getQuarterStartMonth = function () { - var quarterStartMonth = 0; - var nowMonth = this.getMonth(); - if (nowMonth < 3) { - quarterStartMonth = 0; - } - if (2 < nowMonth && nowMonth < 6) { - quarterStartMonth = 3; - } - if (5 < nowMonth && nowMonth < 9) { - quarterStartMonth = 6; - } - if (nowMonth > 8) { - quarterStartMonth = 9; - } - return quarterStartMonth; -}; -//获得本季度的起始日期 -Date.prototype.getQuarterStartDate = function () { - return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); -}; -//得到本季度的结束日期 -Date.prototype.getQuarterEndDate = function () { - var quarterEndMonth = this.getQuarterStartMonth() + 2; - return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); -}; -Date.prototype.getAfterMultiMonth = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() + n | 0); - return dt; -}; -Date.prototype.getBeforeMultiMonth = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() - n | 0); - return dt; -}; - -Date.prototype.getAfterMulQuarter = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() + n * 3); - return dt; -}; -//获得n个季度前的日期 -Date.prototype.getBeforeMulQuarter = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() - n * 3); - return dt; -}; -//得到本季度的起始月份 -Date.prototype.getQuarterStartMonth = function () { - var quarterStartMonth = 0; - var nowMonth = this.getMonth(); - if (nowMonth < 3) { - quarterStartMonth = 0; - } - if (2 < nowMonth && nowMonth < 6) { - quarterStartMonth = 3; - } - if (5 < nowMonth && nowMonth < 9) { - quarterStartMonth = 6; - } - if (nowMonth > 8) { - quarterStartMonth = 9; - } - return quarterStartMonth; -}; - -//指定日期n个月之前或之后的日期 -Date.prototype.getOffsetMonth = function (n) { - var dt = new Date(this.getTime()); - var day = dt.getDate(); - var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); - if (day > monthDay) { - day = monthDay; - } - dt.setDate(day); - dt.setMonth(dt.getMonth() + parseInt(n)); - return dt; -}; - -//获得本周的起始日期 -Date.prototype.getWeekStartDate = function () { - var w = this.getDay(); - return this.getOffsetDate(-w); -}; -//得到本周的结束日期 -Date.prototype.getWeekEndDate = function () { - var w = this.getDay(); - var offset = (w === 0 ? 6 : 6 - w); - return this.getOffsetDate(offset); -}; - -//获得本季度的起始日期 -Date.prototype.getQuarterStartDate = function () { - return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); -}; -//得到本季度的结束日期 -Date.prototype.getQuarterEndDate = function () { - var quarterEndMonth = this.getQuarterStartMonth() + 2; - return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); -}; -Date.prototype.getAfterMultiMonth = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() + n | 0); - return dt; -}; -Date.prototype.getBeforeMultiMonth = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() - n | 0); - return dt; -}; - -/** Checks date and time equality */ -Date.prototype.equalsTo = function (date) { - return ((this.getFullYear() == date.getFullYear()) && - (this.getMonth() == date.getMonth()) && - (this.getDate() == date.getDate()) && - (this.getHours() == date.getHours()) && - (this.getMinutes() == date.getMinutes()) && - (this.getSeconds() == date.getSeconds())); -}; - -/** Set only the year, month, date parts (keep existing time) */ -Date.prototype.setDateOnly = function (date) { - var tmp = new Date(date); - this.setDate(1); - this.setFullYear(tmp.getFullYear()); - this.setMonth(tmp.getMonth()); - this.setDate(tmp.getDate()); -}; -/** Prints the date in a string according to the given format. */ -Date.prototype.print = function (str) { - var m = this.getMonth(); - var d = this.getDate(); - var y = this.getFullYear(); - var wn = this.getWeekNumber(); - var w = this.getDay(); - var s = {}; - var hr = this.getHours(); - var pm = (hr >= 12); - var ir = (pm) ? (hr - 12) : hr; - var dy = this.getDayOfYear(); - if (ir == 0) { - ir = 12; - } - var min = this.getMinutes(); - var sec = this.getSeconds(); - s["%a"] = Date._SDN[w]; // abbreviated weekday name [FIXME: I18N] - s["%A"] = Date._DN[w]; // full weekday name - s["%b"] = Date._SMN[m]; // abbreviated month name [FIXME: I18N] - s["%B"] = Date._MN[m]; // full month name - // FIXME: %c : preferred date and time representation for the current locale - s["%C"] = 1 + Math.floor(y / 100); // the century number - s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) - s["%e"] = d; // the day of the month (range 1 to 31) - // FIXME: %D : american date style: %m/%d/%y - // FIXME: %E, %F, %G, %g, %h (man strftime) - s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) - s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) - s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) - s["%k"] = hr; // hour, range 0 to 23 (24h format) - s["%l"] = ir; // hour, range 1 to 12 (12h format) - s["%X"] = (m < 9) ? ("0" + (1 + m)) : (1 + m); // month, range 01 to 12 - s["%x"] = m + 1 // month, range 1 to 12 - s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 - s["%n"] = "\n"; // a newline character - s["%p"] = pm ? "PM" : "AM"; - s["%P"] = pm ? "pm" : "am"; - // FIXME: %r : the time in am/pm notation %I:%M:%S %p - // FIXME: %R : the time in 24-hour notation %H:%M - s["%s"] = Math.floor(this.getTime() / 1000); - s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 - s["%t"] = "\t"; // a tab character - // FIXME: %T : the time in 24-hour notation (%H:%M:%S) - s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; - s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) - s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) - // FIXME: %x : preferred date representation for the current locale without the time - // FIXME: %X : preferred time representation for the current locale without the date - s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) - s["%Y"] = y; // year with the century - s["%%"] = "%"; // a literal '%' character - - var re = /%./g; - if (!BI.isKhtml()) { - return str.replace(re, function (par) { - return s[par] || par; - }); - } - - var a = str.match(re); - for (var i = 0; i < a.length; i++) { - var tmp = s[a[i]]; - if (tmp) { - re = new RegExp(a[i], 'g'); - str = str.replace(re, tmp); - } - } - - return str; -}; - -/** - * 是否是闰年 - * @param year - * @returns {boolean} - */ -Date.isLeap = function (year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; -}; - -/** - * 检测是否在有效期 - * - * @param YY 年 - * @param MM 月 - * @param DD 日 - * @param minDate '1900-01-01' - * @param maxDate '2099-12-31' - * @returns {Array} 若无效返回无效状态 - */ -Date.checkVoid = function (YY, MM, DD, minDate, maxDate) { - var back = []; - YY = YY | 0; - MM = MM | 0; - DD = DD | 0; - minDate = BI.isString(minDate) ? minDate.match(/\d+/g) : minDate; - maxDate = BI.isString(maxDate) ? maxDate.match(/\d+/g) : maxDate; - if (YY < minDate[0]) { - back = ['y']; - } else if (YY > maxDate[0]) { - back = ['y', 1]; - } else if (YY >= minDate[0] && YY <= maxDate[0]) { - if (YY == minDate[0]) { - if (MM < minDate[1]) { - back = ['m']; - } else if (MM == minDate[1]) { - if (DD < minDate[2]) { - back = ['d']; - } - } - } - if (YY == maxDate[0]) { - if (MM > maxDate[1]) { - back = ['m', 1]; - } else if (MM == maxDate[1]) { - if (DD > maxDate[2]) { - back = ['d', 1]; - } - } - } - } - return back; -}; - -Date.checkLegal = function (str) { - var ar = str.match(/\d+/g); - var YY = ar[0] | 0, MM = ar[1] | 0, DD = ar[2] | 0; - if (ar.length <= 1) { - return true; - } - if (ar.length <= 2) { - return MM >= 1 && MM <= 12; - } - var MD = Date._MD.slice(0); - MD[1] = Date.isLeap(YY) ? 29 : 28; - return MM >= 1 && MM <= 12 && DD <= MD[MM - 1]; -}; - -Date.parseDateTime = function (str, fmt) { - var today = new Date(); - var y = 0; - var m = 0; - var d = 1; - //wei : 对于fmt为‘YYYYMM’或者‘YYYYMMdd’的格式,str的值为类似'201111'的形式,因为年月之间没有分隔符,所以正则表达式分割无效,导致bug7376。 - var a = str.split(/\W+/); - if (fmt.toLowerCase() == '%y%x' || fmt.toLowerCase() == '%y%x%d') { - var yearlength = 4; - var otherlength = 2; - a[0] = str.substring(0, yearlength); - a[1] = str.substring(yearlength, yearlength + otherlength); - a[2] = str.substring(yearlength + otherlength, yearlength + otherlength * 2); - } - var b = fmt.match(/%./g); - var i = 0, j = 0; - var hr = 0; - var min = 0; - var sec = 0; - for (i = 0; i < a.length; ++i) { - switch (b[i]) { - case "%d": - case "%e": - d = parseInt(a[i], 10); - break; - - case "%X": - m = parseInt(a[i], 10) - 1; - break; - case "%x": - m = parseInt(a[i], 10) - 1; - break; - - case "%Y": - case "%y": - y = parseInt(a[i], 10); - (y < 100) && (y += (y > 29) ? 1900 : 2000); - break; - - case "%b": - case "%B": - for (j = 0; j < 12; ++j) { - if (Date._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { - m = j; - break; - } - } - break; - - case "%H": - case "%I": - case "%k": - case "%l": - hr = parseInt(a[i], 10); - break; - - case "%P": - case "%p": - if (/pm/i.test(a[i]) && hr < 12) { - hr += 12; - } else if (/am/i.test(a[i]) && hr >= 12) { - hr -= 12; - } - break; - - case "%M": - min = parseInt(a[i], 10); - case "%S": - sec = parseInt(a[i], 10); - break; - } - } -// if (!a[i]) { -// continue; -// } - if (isNaN(y)) { - y = today.getFullYear(); - } - if (isNaN(m)) { - m = today.getMonth(); - } - if (isNaN(d)) { - d = today.getDate(); - } - if (isNaN(hr)) { - hr = today.getHours(); - } - if (isNaN(min)) { - min = today.getMinutes(); - } - if (isNaN(sec)) { - sec = today.getSeconds(); - } - if (y != 0) { - return new Date(y, m, d, hr, min, sec); - } - y = 0; - m = -1; - d = 0; - for (i = 0; i < a.length; ++i) { - if (a[i].search(/[a-zA-Z]+/) != -1) { - var t = -1; - for (j = 0; j < 12; ++j) { - if (Date._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { - t = j; - break; - } - } - if (t != -1) { - if (m != -1) { - d = m + 1; - } - m = t; - } - } else if (parseInt(a[i], 10) <= 12 && m == -1) { - m = a[i] - 1; - } else if (parseInt(a[i], 10) > 31 && y == 0) { - y = parseInt(a[i], 10); - (y < 100) && (y += (y > 29) ? 1900 : 2000); - } else if (d == 0) { - d = a[i]; - } - } - if (y == 0) { - y = today.getFullYear(); - } - if (m != -1 && d != 0) { - return new Date(y, m, d, hr, min, sec); - } - return today; -}; -/* - * 给jQuery.Event对象添加的工具方法 - */ -$.extend($.Event.prototype, { - // event.stopEvent - stopEvent: function () { - this.stopPropagation(); - this.preventDefault(); - } -});Function.prototype.before = function (func) { - var __self = this; - return function () { - if (func.apply(this, arguments) === false) { - return false; - } - return __self.apply(this, arguments); - } -}; - -Function.prototype.after = function (func) { - var __self = this; - return function () { - var ret = __self.apply(this, arguments); - if (ret === false) { - return false; - } - func.apply(this, arguments); - return ret; - } -};/*! - * jLayout JQuery Plugin v0.11 - * - * Licensed under the revised BSD License. - * Copyright 2008, Bram Stein - * All rights reserved. - */ -if (jQuery) { - (function ($) { - // richer:容器在其各个边缘留出的空间 - if (!$.fn.insets) { - $.fn.insets = function () { - var p = this.padding(), - b = this.border(); - return { - 'top': p.top, - 'bottom': p.bottom + b.bottom + b.top, - 'left': p.left, - 'right': p.right + b.right + b.left - }; - }; - } - - // richer:获取 && 设置jQuery元素的边界 - if (!$.fn.bounds) { - $.fn.bounds = function (value) { - var tmp = {hasIgnoredBounds: true}; - - if (value) { - if (!isNaN(value.x)) { - tmp.left = value.x; - } - if (!isNaN(value.y)) { - tmp.top = value.y; - } - if (value.width != null) { - tmp.width = (value.width - (this.outerWidth(true) - this.width())); - tmp.width = (tmp.width >= 0) ? tmp.width : value.width; - // fix chrome - //tmp.width = (tmp.width >= 0) ? tmp.width : 0; - } - if (value.height != null) { - tmp.height = value.height - (this.outerHeight(true) - this.height()); - tmp.height = (tmp.height >= 0) ? tmp.height : value.height; - // fix chrome - //tmp.height = (tmp.height >= 0) ? tmp.height : value.0; - } - this.css(tmp); - return this; - } - else { - // richer:注意此方法只对可见元素有效 - tmp = this.position(); - return { - 'x': tmp.left, - 'y': tmp.top, - // richer:这里计算外部宽度和高度的时候,都不包括边框 - 'width': this.outerWidth(), - 'height': this.outerHeight() - }; - } - }; - } - })(jQuery); -} -;if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || - (0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || - (1000000000000000128).toFixed(0) !== "1000000000000000128") { - (function () { - var base, size, data, i; - base = 1e7; - size = 6; - data = [0, 0, 0, 0, 0, 0]; - function multiply(n, c) { - var i = -1; - while (++i < size) { - c += n * data[i]; - data[i] = c % base; - c = Math.floor(c / base); - } - } - - function divide(n) { - var i = size, c = 0; - while (--i >= 0) { - c += data[i]; - data[i] = Math.floor(c / n); - c = (c % n) * base; - } - } - - function toString() { - var i = size; - var s = ''; - while (--i >= 0) { - if (s !== '' || i === 0 || data[i] !== 0) { - var t = String(data[i]); - if (s === '') { - s = t; - } else { - s += '0000000'.slice(0, 7 - t.length) + t; - } - } - } - return s; - } - - function pow(x, n, acc) { - return (n === 0 ? acc : (n % 2 === 1 ? pow(x, n - 1, acc * x) - : pow(x * x, n / 2, acc))); - } - - function log(x) { - var n = 0; - while (x >= 4096) { - n += 12; - x /= 4096; - } - while (x >= 2) { - n += 1; - x /= 2; - } - return n; - } - - Number.prototype.toFixed = function (fractionDigits) { - var f, x, s, m, e, z, j, k; - f = Number(fractionDigits); - f = f !== f ? 0 : Math.floor(f); - - if (f < 0 || f > 20) { - throw new RangeError('Number.toFixed called with invalid number of decimals'); - } - - x = Number(this); - - if (x !== x) { - return "NaN"; - } - - if (x <= -1e21 || x > 1e21) { - return String(x); - } - - s = ""; - - if (x < 0) { - s = "-"; - x = -x; - } - - m = "0"; - - if (x > 1e-21) { - //1e-21<x<1e21 - //-70<log2(x)<70 - e = log(x * pow(2, 69, 1)) - 69; - z = (e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1)); - z *= 0x10000000000000;//Math.pow(2,52); - e = 52 - e; - - //-18<e<122 - //x=z/2^e - if (e > 0) { - multiply(0, z); - j = f; - - while (j >= 7) { - multiply(1e7, 0); - j -= 7; - } - - multiply(pow(10, j, 1), 0); - j = e - 1; - - while (j >= 23) { - divide(1 << 23); - j -= 23; - } - divide(1 << j); - multiply(1, 1); - divide(2); - m = toString(); - } else { - multiply(0, z); - multiply(1 << (-e), 0); - m = toString() + '0.00000000000000000000'.slice(2, 2 + f); - } - } - - if (f > 0) { - k = m.length; - - if (k <= f) { - m = s + '0.0000000000000000000'.slice(0, f - k + 2) + m; - } else { - m = s + m.slice(0, k - f) + '.' + m.slice(k - f); - } - } else { - m = s + m; - } - - return m; - } - - })(); -} - - -/** - ** 加法函数,用来得到精确的加法结果 - ** 说明:javascript的加法结果会有误差,在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。 - ** 调用:accAdd(arg1,arg2) - ** 返回值:arg1加上arg2的精确结果 - **/ -function accAdd(arg1, arg2) { - var r1, r2, m, c; - try { - r1 = arg1.toString().split(".")[1].length; - } - catch (e) { - r1 = 0; - } - try { - r2 = arg2.toString().split(".")[1].length; - } - catch (e) { - r2 = 0; - } - c = Math.abs(r1 - r2); - m = Math.pow(10, Math.max(r1, r2)); - if (c > 0) { - var cm = Math.pow(10, c); - if (r1 > r2) { - arg1 = Number(arg1.toString().replace(".", "")); - arg2 = Number(arg2.toString().replace(".", "")) * cm; - } else { - arg1 = Number(arg1.toString().replace(".", "")) * cm; - arg2 = Number(arg2.toString().replace(".", "")); - } - } else { - arg1 = Number(arg1.toString().replace(".", "")); - arg2 = Number(arg2.toString().replace(".", "")); - } - return (arg1 + arg2) / m; -} - -//给Number类型增加一个add方法,调用起来更加方便。 -Number.prototype.add = function (arg) { - return accAdd(arg, this); -}; -/** - ** 减法函数,用来得到精确的减法结果 - ** 说明:javascript的减法结果会有误差,在两个浮点数相减的时候会比较明显。这个函数返回较为精确的减法结果。 - ** 调用:accSub(arg1,arg2) - ** 返回值:arg1加上arg2的精确结果 - **/ -function accSub(arg1, arg2) { - var r1, r2, m, n; - try { - r1 = arg1.toString().split(".")[1].length; - } - catch (e) { - r1 = 0; - } - try { - r2 = arg2.toString().split(".")[1].length; - } - catch (e) { - r2 = 0; - } - m = Math.pow(10, Math.max(r1, r2)); //last modify by deeka //动态控制精度长度 - n = (r1 >= r2) ? r1 : r2; - return ((arg1 * m - arg2 * m) / m).toFixed(n); -} - -// 给Number类型增加一个mul方法,调用起来更加方便。 -Number.prototype.sub = function (arg) { - return accSub(this, arg); -}; -/** - ** 乘法函数,用来得到精确的乘法结果 - ** 说明:javascript的乘法结果会有误差,在两个浮点数相乘的时候会比较明显。这个函数返回较为精确的乘法结果。 - ** 调用:accMul(arg1,arg2) - ** 返回值:arg1乘以 arg2的精确结果 - **/ -function accMul(arg1, arg2) { - var m = 0, s1 = arg1.toString(), s2 = arg2.toString(); - try { - m += s1.split(".")[1].length; - } - catch (e) { - } - try { - m += s2.split(".")[1].length; - } - catch (e) { - } - return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m); -} - -// 给Number类型增加一个mul方法,调用起来更加方便。 -Number.prototype.mul = function (arg) { - return accMul(arg, this); -}; -/** - ** 除法函数,用来得到精确的除法结果 - ** 说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显。这个函数返回较为精确的除法结果。 - ** 调用:accDiv(arg1,arg2) - ** 返回值:arg1除以arg2的精确结果 - **/ -function accDiv(arg1, arg2) { - var t1 = 0, t2 = 0, r1, r2; - try { - t1 = arg1.toString().split(".")[1].length; - } - catch (e) { - } - try { - t2 = arg2.toString().split(".")[1].length; - } - catch (e) { - } - with (Math) { - r1 = Number(arg1.toString().replace(".", "")); - r2 = Number(arg2.toString().replace(".", "")); - return (t2 > t1) ? (r1 / r2) * pow(10, t2 - t1) : (r1 / r2) / pow(10, t1 - t2); - } -} - -//给Number类型增加一个div方法,调用起来更加方便。 -Number.prototype.div = function (arg) { - return accDiv(this, arg); -};/** - * 对字符串对象的扩展 - * @class String - */ -$.extend(String.prototype, { - - /** - * 判断字符串是否已指定的字符串开始 - * @param {String} startTag 指定的开始字符串 - * @return {Boolean} 如果字符串以指定字符串开始则返回true,否则返回false - */ - startWith: function (startTag) { - if (startTag == null || startTag == "" || this.length === 0 || startTag.length > this.length) { - return false; - } - return this.substr(0, startTag.length) == startTag; - }, - /** - * 判断字符串是否以指定的字符串结束 - * @param {String} endTag 指定的字符串 - * @return {Boolean} 如果字符串以指定字符串结束则返回true,否则返回false - */ - endWith: function (endTag) { - if (endTag == null || endTag == "" || this.length === 0 || endTag.length > this.length) { - return false; - } - return this.substring(this.length - endTag.length) == endTag; - }, - - /** - * 获取url中指定名字的参数 - * @param {String} name 参数的名字 - * @return {String} 参数的值 - */ - getQuery: function (name) { - var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); - var r = this.substr(this.indexOf("?") + 1).match(reg); - if (r) { - return unescape(r[2]); - } - return null; - }, - - /** - * 给url加上给定的参数 - * @param {Object} paras 参数对象,是一个键值对对象 - * @return {String} 添加了给定参数的url - */ - appendQuery: function (paras) { - if (!paras) { - return this; - } - var src = this; - // 没有问号说明还没有参数 - if (src.indexOf("?") === -1) { - src += "?"; - } - // 如果以问号结尾,说明没有其他参数 - if (src.endWith("?") !== false) { - } else { - src += "&"; - } - $.each(paras, function (name, value) { - if (typeof(name) === 'string') { - src += name + "=" + value + "&"; - } - }); - src = src.substr(0, src.length - 1); - return src; - }, - /** - * 将所有符合第一个字符串所表示的字符串替换成为第二个字符串 - * @param {String} s1 要替换的字符串的正则表达式 - * @param {String} s2 替换的结果字符串 - * @returns {String} 替换后的字符串 - */ - replaceAll: function (s1, s2) { - return this.replace(new RegExp(s1, "gm"), s2); - }, - /** - * 总是让字符串以指定的字符开头 - * @param {String} start 指定的字符 - * @returns {String} 以指定字符开头的字符串 - */ - perfectStart: function (start) { - if (this.startWith(start)) { - return this; - } else { - return start + this; - } - }, - - /** - * 获取字符串中某字符串的所有项位置数组 - * @param {String} sub 子字符串 - * @return {Number[]} 子字符串在父字符串中出现的所有位置组成的数组 - */ - allIndexOf: function (sub) { - if (typeof sub != 'string') { - return []; - } - var str = this; - var location = []; - var offset = 0; - while (str.length > 0) { - var loc = str.indexOf(sub); - if (loc === -1) { - break; - } - location.push(offset + loc); - str = str.substring(loc + sub.length, str.length); - offset += loc + sub.length; - } - return location; - } -}); - -/** - * 对字符串对象的扩展 - * @class String - */ -$.extend(String, { - - /** - * 对字符串中的'和\做编码处理 - * @static - * @param {String} string 要做编码处理的字符串 - * @return {String} 编码后的字符串 - */ - escape: function (string) { - return string.replace(/('|\\)/g, "\\$1"); - }, - - /** - * 让字符串通过指定字符做补齐的函数 - * - * var s = String.leftPad('123', 5, '0');//s的值为:'00123' - * - * @static - * @param {String} val 原始值 - * @param {Number} size 总共需要的位数 - * @param {String} ch 用于补齐的字符 - * @return {String} 补齐后的字符串 - */ - leftPad: function (val, size, ch) { - var result = String(val); - if (!ch) { - ch = " "; - } - while (result.length < size) { - result = ch + result; - } - return result.toString(); - }, - - /** - * 对字符串做替换的函数 - * - * var cls = 'my-class', text = 'Some text'; - * var res = String.format('<div class="{0}>{1}</div>"', cls, text); - * //res的值为:'<div class="my-class">Some text</div>'; - * - * @static - * @param {String} format 要做替换的字符串,替换字符串1,替换字符串2... - * @return {String} 做了替换后的字符串 - */ - format: function (format) { - var args = Array.prototype.slice.call(arguments, 1); - return format.replace(/\{(\d+)\}/g, function (m, i) { - return args[i]; - }); - } -});BI.EventListener = { - listen: function listen(target, eventType, callback) { - if (target.addEventListener) { - target.addEventListener(eventType, callback, false); - return { - remove: function remove() { - target.removeEventListener(eventType, callback, false); - } - }; - } else if (target.attachEvent) { - target.attachEvent('on' + eventType, callback); - return { - remove: function remove() { - target.detachEvent('on' + eventType, callback); - } - }; - } - }, - - capture: function capture(target, eventType, callback) { - if (target.addEventListener) { - target.addEventListener(eventType, callback, true); - return { - remove: function remove() { - target.removeEventListener(eventType, callback, true); - } - }; - } else { - return { - remove: BI.emptyFn - }; - } - }, - - registerDefault: function registerDefault() { - } -};!(function () { - var cancelAnimationFrame = - window.cancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.mozCancelAnimationFrame || - window.oCancelAnimationFrame || - window.msCancelAnimationFrame || - window.clearTimeout; - - var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout; - - - BI.MouseMoveTracker = function (onMove, onMoveEnd, domNode) { - this._isDragging = false; - this._animationFrameID = null; - this._domNode = domNode; - this._onMove = onMove; - this._onMoveEnd = onMoveEnd; - - this._onMouseMove = BI.bind(this._onMouseMove, this); - this._onMouseUp = BI.bind(this._onMouseUp, this); - this._didMouseMove = BI.bind(this._didMouseMove, this); - }; - BI.MouseMoveTracker.prototype = { - constructor: BI.MouseMoveTracker, - captureMouseMoves: function (/*object*/ event) { - if (!this._eventMoveToken && !this._eventUpToken) { - this._eventMoveToken = BI.EventListener.listen( - this._domNode, - 'mousemove', - this._onMouseMove - ); - this._eventUpToken = BI.EventListener.listen( - this._domNode, - 'mouseup', - this._onMouseUp - ); - } - - if (!this._isDragging) { - this._deltaX = 0; - this._deltaY = 0; - this._isDragging = true; - this._x = event.clientX; - this._y = event.clientY; - } - event.preventDefault ? event.preventDefault() : (event.returnValue = false); - }, - - releaseMouseMoves: function () { - if (this._eventMoveToken && this._eventUpToken) { - this._eventMoveToken.remove(); - this._eventMoveToken = null; - this._eventUpToken.remove(); - this._eventUpToken = null; - } - - if (this._animationFrameID !== null) { - cancelAnimationFrame(this._animationFrameID); - this._animationFrameID = null; - } - - if (this._isDragging) { - this._isDragging = false; - this._x = null; - this._y = null; - } - }, - - isDragging: function () /*boolean*/ { - return this._isDragging; - }, - - _onMouseMove: function (/*object*/ event) { - var x = event.clientX; - var y = event.clientY; - - this._deltaX += (x - this._x); - this._deltaY += (y - this._y); - - if (this._animationFrameID === null) { - // The mouse may move faster then the animation frame does. - // Use `requestAnimationFrame` to avoid over-updating. - this._animationFrameID = - requestAnimationFrame(this._didMouseMove); - } - - this._x = x; - this._y = y; - event.preventDefault ? event.preventDefault() : (event.returnValue = false); - }, - - _didMouseMove: function () { - this._animationFrameID = null; - this._onMove(this._deltaX, this._deltaY); - this._deltaX = 0; - this._deltaY = 0; - }, - - _onMouseUp: function () { - if (this._animationFrameID) { - this._didMouseMove(); - } - this._onMoveEnd(); - } - }; -})();!(function () { - var PIXEL_STEP = 10; - var LINE_HEIGHT = 40; - var PAGE_HEIGHT = 800; - var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout; - - function normalizeWheel(/*object*/event) /*object*/ { - var sX = 0, - sY = 0, - // spinX, spinY - pX = 0, - pY = 0; // pixelX, pixelY - - // Legacy - if ('detail' in event) { - sY = event.detail; - } - if ('wheelDelta' in event) { - sY = -event.wheelDelta / 120; - } - if ('wheelDeltaY' in event) { - sY = -event.wheelDeltaY / 120; - } - if ('wheelDeltaX' in event) { - sX = -event.wheelDeltaX / 120; - } - - // side scrolling on FF with DOMMouseScroll - if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) { - sX = sY; - sY = 0; - } - - pX = sX * PIXEL_STEP; - pY = sY * PIXEL_STEP; - - if ('deltaY' in event) { - pY = event.deltaY; - } - if ('deltaX' in event) { - pX = event.deltaX; - } - - if ((pX || pY) && event.deltaMode) { - if (event.deltaMode === 1) { - // delta in LINE units - pX *= LINE_HEIGHT; - pY *= LINE_HEIGHT; - } else { - // delta in PAGE units - pX *= PAGE_HEIGHT; - pY *= PAGE_HEIGHT; - } - } - - // Fall-back if spin cannot be determined - if (pX && !sX) { - sX = pX < 1 ? -1 : 1; - } - if (pY && !sY) { - sY = pY < 1 ? -1 : 1; - } - - return { - spinX: sX, - spinY: sY, - pixelX: pX, - pixelY: pY - }; - } - - BI.WheelHandler = function (onWheel, handleScrollX, handleScrollY, stopPropagation) { - this._animationFrameID = null; - this._deltaX = 0; - this._deltaY = 0; - this._didWheel = BI.bind(this._didWheel, this); - if (typeof handleScrollX !== 'function') { - handleScrollX = handleScrollX ? - function () { - return true - } : - function () { - return false - }; - } - - if (typeof handleScrollY !== 'function') { - handleScrollY = handleScrollY ? - function () { - return true - } : - function () { - return false - }; - } - - if (typeof stopPropagation !== 'function') { - stopPropagation = stopPropagation ? - function () { - return true - } : - function () { - return false - }; - } - - this._handleScrollX = handleScrollX; - this._handleScrollY = handleScrollY; - this._stopPropagation = stopPropagation; - this._onWheelCallback = onWheel; - this.onWheel = BI.bind(this.onWheel, this); - }; - BI.WheelHandler.prototype = { - constructor: BI.WheelHandler, - onWheel: function (/*object*/ event) { - var normalizedEvent = normalizeWheel(event); - var deltaX = this._deltaX + normalizedEvent.pixelX; - var deltaY = this._deltaY + normalizedEvent.pixelY; - var handleScrollX = this._handleScrollX(deltaX, deltaY); - var handleScrollY = this._handleScrollY(deltaY, deltaX); - if (!handleScrollX && !handleScrollY) { - return; - } - - this._deltaX += handleScrollX ? normalizedEvent.pixelX : 0; - this._deltaY += handleScrollY ? normalizedEvent.pixelY : 0; - event.preventDefault ? event.preventDefault() : (event.returnValue = false); - - var changed; - if (this._deltaX !== 0 || this._deltaY !== 0) { - if (this._stopPropagation()) { - event.stopPropagation ? event.stopPropagation() : (event.cancelBubble = true); - } - changed = true; - } - - if (changed === true && this._animationFrameID === null) { - this._animationFrameID = requestAnimationFrame(this._didWheel); - } - }, - - _didWheel: function () { - this._animationFrameID = null; - this._onWheelCallback(this._deltaX, this._deltaY); - this._deltaX = 0; - this._deltaY = 0; - } - }; -})();/** - * 常量 - */ - -_.extend(BI, { - MAX: 0xfffffffffffffff, - MIN: -0xfffffffffffffff, - EVENT_RESPONSE_TIME: 200, - zIndex_layer: 1e5, - zIndex_floatbox: 1e6, - zIndex_popup: 1e7, - zIndex_masker: 1e8, - zIndex_tip: 1e9, - emptyStr: "", - emptyFn: function () { - }, - empty: null, - KeyCode: { - BACKSPACE: 8, - COMMA: 188, - DELETE: 46, - DOWN: 40, - END: 35, - ENTER: 13, - ESCAPE: 27, - HOME: 36, - LEFT: 37, - NUMPAD_ADD: 107, - NUMPAD_DECIMAL: 110, - NUMPAD_DIVIDE: 111, - NUMPAD_ENTER: 108, - NUMPAD_MULTIPLY: 106, - NUMPAD_SUBTRACT: 109, - PAGE_DOWN: 34, - PAGE_UP: 33, - PERIOD: 190, - RIGHT: 39, - SPACE: 32, - TAB: 9, - UP: 38 - }, - Status: { - SUCCESS: 1, - WRONG: 2, - START: 3, - END: 4, - WAITING: 5, - READY: 6, - RUNNING: 7, - OUTOFBOUNDS: 8, - NULL: -1 - }, - Direction: { - Top: "top", - Bottom: "bottom", - Left: "left", - Right: "right", - Custom: "custom" - }, - Axis: { - Vertical: "vertical", - Horizontal: "horizontal" - }, - Selection: { - Default: -2, - None: -1, - Single: 0, - Multi: 1, - All: 2 - }, - HorizontalAlign: { - Left: "left", - Right: "right", - Center: "center" - }, - VerticalAlign: { - Middle: "middle", - Top: "top", - Bottom: "bottom" - } -});BI.version = "2.0";/** - * absolute实现的居中布局 - * @class BI.AbsoluteCenterLayout - * @extends BI.Layout - */ -BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.AbsoluteCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-absolute-center-layout", - hgap: 0, - lgap: 0, - rgap: 0, - vgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - render: function () { - BI.AbsoluteCenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.AbsoluteCenterLayout.superclass._addElement.apply(this, arguments); - w.element.css({ - "position": "absolute", - "left": o.hgap + o.lgap + (item.lgap || 0), - "right": o.hgap + o.rgap + (item.rgap || 0), - "top": o.vgap + o.tgap + (item.tgap || 0), - "bottom": o.vgap + o.bgap + (item.bgap || 0), - "margin": "auto" - }); - return w; - }, - - resize: function () { - // console.log("absolute_center_adapt布局不需要resize"); - }, - - populate: function (items) { - BI.AbsoluteCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.absolute_center_adapt', BI.AbsoluteCenterLayout);/** - * absolute实现的居中布局 - * @class BI.AbsoluteHorizontalLayout - * @extends BI.Layout - */ -BI.AbsoluteHorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.AbsoluteHorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-absolute-horizontal-layout", - hgap: 0, - lgap: 0, - rgap: 0, - vgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - render: function () { - BI.AbsoluteHorizontalLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.AbsoluteHorizontalLayout.superclass._addElement.apply(this, arguments); - w.element.css({ - "position": "absolute", - "left": o.hgap + o.lgap + (item.lgap || 0), - "right": o.hgap + o.rgap + (item.rgap || 0), - "margin": "auto" - }); - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css("top", o.vgap + o.tgap + (item.tgap || 0)); - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css("bottom", o.vgap + o.bgap + (item.bgap || 0)); - } - return w; - }, - - resize: function () { - // console.log("absolute_horizontal_adapt布局不需要resize"); - }, - - populate: function (items) { - BI.AbsoluteHorizontalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.absolute_horizontal_adapt', BI.AbsoluteHorizontalLayout);/** - * absolute实现的居中布局 - * @class BI.AbsoluteVerticalLayout - * @extends BI.Layout - */ -BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.AbsoluteVerticalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-absolute-vertical-layout", - hgap: 0, - lgap: 0, - rgap: 0, - vgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - render: function () { - BI.AbsoluteVerticalLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.AbsoluteVerticalLayout.superclass._addElement.apply(this, arguments); - w.element.css({ - "position": "absolute", - "left": item.lgap, - "right": item.rgap, - "top": o.vgap + o.tgap + (item.tgap || 0), - "bottom": o.vgap + o.bgap + (item.bgap || 0), - "margin": "auto" - }); - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css("left", o.hgap + o.lgap + (item.lgap || 0)); - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css("right", o.hgap + o.rgap + (item.rgap || 0)); - } - return w; - }, - - resize: function () { - // console.log("absolute_vertical_adapt布局不需要resize"); - }, - - populate: function (items) { - BI.AbsoluteVerticalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.absolute_vertical_adapt', BI.AbsoluteVerticalLayout);/** - * 自适应水平和垂直方向都居中容器 - * @class BI.CenterAdaptLayout - * @extends BI.Layout - */ -BI.CenterAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-center-adapt-layout", - columnSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.CenterAdaptLayout.superclass.render.apply(this, arguments); - this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ - "position": "relative", - "width": "100%", - "height": "100%", - "white-space": "nowrap", - "border-spacing": "0px", - "border": "none", - "border-collapse": "separate" - }); - this.$tr = $("<tr>"); - this.$tr.appendTo(this.$table); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var td; - var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; - if (!this.hasWidget(this._getChildName(i))) { - var w = BI.createWidget(item); - w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); - td = BI.createWidget({ - type: "bi.default", - tagName: "td", - attributes: { - width: width - }, - items: [w] - }); - this.addWidget(this._getChildName(i), td); - } else { - td = this.getWidgetByName(this._getChildName(i)); - td.element.attr("width", width); - } - td.element.css({"max-width": o.columnSize[i]}); - if (i === 0) { - td.element.addClass("first-element"); - } - td.element.css({ - "position": "relative", - "height": "100%", - "vertical-align": "middle", - "margin": "0", - "padding": "0", - "border": "none" - }); - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return td; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$tr.append(frag); - this.element.append(this.$table); - } - }, - - resize: function () { - // console.log("center_adapt布局不需要resize"); - }, - - _getWrapper: function(){ - return this.$tr; - }, - - populate: function (items) { - BI.CenterAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.center_adapt', BI.CenterAdaptLayout);/** - * 水平方向居中容器 - * @class BI.HorizontalAdaptLayout - * @extends BI.Layout - */ -BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HorizontalAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-horizontal-adapt-layout", - verticalAlign: BI.VerticalAlign.Middle, - columnSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.HorizontalAdaptLayout.superclass.render.apply(this, arguments); - this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ - "position": "relative", - "width": "100%", - "white-space": "nowrap", - "border-spacing": "0px", - "border": "none", - "border-collapse": "separate" - }); - this.$tr = $("<tr>"); - this.$tr.appendTo(this.$table); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var td; - var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; - if (!this.hasWidget(this._getChildName(i))) { - var w = BI.createWidget(item); - w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); - td = BI.createWidget({ - type: "bi.default", - tagName: "td", - attributes: { - width: width - }, - items: [w] - }); - this.addWidget(this._getChildName(i), td); - } else { - td = this.getWidgetByName(this._getChildName(i)); - td.element.attr("width", width); - } - td.element.css({"max-width": o.columnSize[i] + "px"}); - if (i === 0) { - td.element.addClass("first-element"); - } - td.element.css({ - "position": "relative", - "vertical-align": o.verticalAlign, - "margin": "0", - "padding": "0", - "border": "none" - }); - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return td; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$tr.append(frag); - this.element.append(this.$table); - } - }, - - resize: function () { - // console.log("horizontal_adapt布局不需要resize"); - }, - - _getWrapper: function () { - return this.$tr; - }, - - populate: function (items) { - BI.HorizontalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal_adapt', BI.HorizontalAdaptLayout);/** - * 左右分离,垂直方向居中容器 - * items:{ - left: [{el:{type:"bi.button"}}], - right:[{el:{type:"bi.button"}}] - } - * @class BI.LeftRightVerticalAdaptLayout - * @extends BI.Layout - */ -BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.LeftRightVerticalAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-left-right-vertical-adapt-layout", - items: {}, - llgap: 0, - lrgap: 0, - lhgap: 0, - rlgap: 0, - rrgap: 0, - rhgap: 0 - }); - }, - render: function () { - BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("left_right_vertical_adapt布局不需要resize"); - }, - - addItem: function () { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - if ("left" in items) { - var left = BI.createWidget({ - type: "bi.vertical_adapt", - items: items.left, - hgap: o.lhgap, - lgap: o.llgap, - rgap: o.lrgap - }); - left.element.css("height", "100%"); - BI.createWidget({ - type: "bi.left", - element: this, - items: [left] - }); - } - if ("right" in items) { - var right = BI.createWidget({ - type: "bi.vertical_adapt", - items: items.right, - hgap: o.rhgap, - lgap: o.rlgap, - rgap: o.rrgap - }); - right.element.css("height", "100%"); - BI.createWidget({ - type: "bi.right", - element: this, - items: [right] - }); - } - }, - - populate: function (items) { - BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.left_right_vertical_adapt', BI.LeftRightVerticalAdaptLayout); - - -BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.LeftRightVerticalAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-left-vertical-adapt-layout", - items: [], - lgap: 0, - rgap: 0, - hgap: 0 - }); - }, - render: function () { - BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("left_vertical_adapt布局不需要resize"); - }, - - addItem: function () { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - var left = BI.createWidget({ - type: "bi.vertical_adapt", - items: items, - lgap: o.lgap, - hgap: o.hgap, - rgap: o.rgap - }); - left.element.css("height", "100%"); - BI.createWidget({ - type: "bi.left", - element: this, - items: [left] - }); - }, - - populate: function (items) { - BI.LeftVerticalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.left_vertical_adapt', BI.LeftVerticalAdaptLayout); - -BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.RightVerticalAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-right-vertical-adapt-layout", - items: [], - lgap: 0, - rgap: 0, - hgap: 0 - }); - }, - render: function () { - BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - - }, - - addItem: function () { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - var right = BI.createWidget({ - type: "bi.vertical_adapt", - items: items, - lgap: o.lgap, - hgap: o.hgap, - rgap: o.rgap - }); - right.element.css("height", "100%"); - BI.createWidget({ - type: "bi.right", - element: this, - items: [right] - }); - }, - - populate: function (items) { - BI.RightVerticalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.right_vertical_adapt', BI.RightVerticalAdaptLayout);/** - * 垂直方向居中容器 - * @class BI.VerticalAdaptLayout - * @extends BI.Layout - */ -BI.VerticalAdaptLayout = BI.inherit(BI.Layout, { - props: { - baseCls: "bi-vertical-adapt-layout", - columnSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }, - render: function () { - BI.VerticalAdaptLayout.superclass.render.apply(this, arguments); - this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ - "position": "relative", - "height": "100%", - "white-space": "nowrap", - "border-spacing": "0px", - "border": "none", - "border-collapse": "separate" - }); - this.$tr = $("<tr>"); - this.$tr.appendTo(this.$table); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var td; - var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; - if (!this.hasWidget(this._getChildName(i))) { - var w = BI.createWidget(item); - w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); - td = BI.createWidget({ - type: "bi.default", - tagName: "td", - attributes: { - width: width - }, - items: [w] - }); - this.addWidget(this._getChildName(i), td); - } else { - td = this.getWidgetByName(this._getChildName(i)); - td.element.attr("width", width); - } - - if (i === 0) { - td.element.addClass("first-element"); - } - td.element.css({ - "position": "relative", - "height": "100%", - "vertical-align": "middle", - "margin": "0", - "padding": "0", - "border": "none" - }); - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return td; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$tr.append(frag); - this.element.append(this.$table); - } - }, - - _getWrapper: function(){ - return this.$tr; - }, - - resize: function () { - // console.log("vertical_adapt布局不需要resize"); - }, - - populate: function (items) { - BI.VerticalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.vertical_adapt', BI.VerticalAdaptLayout);/** - * 水平方向居中自适应容器 - * @class BI.HorizontalAutoLayout - * @extends BI.Layout - */ -BI.HorizontalAutoLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HorizontalAutoLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-horizon-auto-layout", - hgap: 0, - lgap: 0, - rgap: 0, - vgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - render: function () { - BI.HorizontalAutoLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.HorizontalAutoLayout.superclass._addElement.apply(this, arguments); - w.element.css({ - "position": "relative", - "margin": "0px auto" - }); - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - resize: function () { - // console.log("horizontal_adapt布局不需要resize"); - }, - - populate: function (items) { - BI.HorizontalAutoLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal_auto', BI.HorizontalAutoLayout);/** - * 浮动的居中布局 - */ -BI.FloatCenterAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatCenterAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-center-adapt-layout", - items: [], - hgap: 0, - vgap: 0, - tgap: 0, - bgap: 0, - lgap: 0, - rgap: 0 - }); - }, - render: function () { - BI.FloatCenterAdaptLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("float_center_adapt布局不需要resize"); - }, - - addItem: function () { - //do nothing - throw new Error("cannot be added") - }, - - mounted: function () { - var width = this.left.element.outerWidth(), - height = this.left.element.outerHeight(); - this.left.element.width(width).height(height).css("float", "none"); - BI.createWidget({ - type: "bi.center_adapt", - element: this, - items: [this.left] - }); - this.removeWidget(this.container); - }, - - stroke: function (items) { - var self = this, o = this.options; - this.left = BI.createWidget({ - type: "bi.vertical", - items: items, - hgap: o.hgap, - vgap: o.vgap, - tgap: o.tgap, - bgap: o.bgap, - lgap: o.lgap, - rgap: o.rgap - }); - - this.container = BI.createWidget({ - type: "bi.left", - element: this, - items: [this.left] - }); - - }, - - populate: function (items) { - BI.FloatCenterAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.float_center_adapt', BI.FloatCenterAdaptLayout);/** - * 浮动的水平居中布局 - */ -BI.FloatHorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatHorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-horizontal-adapt-layout", - items: [], - hgap: 0, - vgap: 0, - tgap: 0, - bgap: 0, - lgap: 0, - rgap: 0 - }); - }, - render: function () { - BI.FloatHorizontalLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("float_horizontal_adapt布局不需要resize"); - }, - - mounted: function () { - var width = this.left.element.width(), - height = this.left.element.height(); - this.left.element.width(width).height(height).css("float", "none"); - BI.createWidget({ - type: "bi.horizontal_auto", - element: this, - items: [this.left] - }); - this.removeWidget(this.container); - }, - - _addElement: function (i, item) { - var self = this, o = this.options; - this.left = BI.createWidget({ - type: "bi.vertical", - items: [item], - hgap: o.hgap, - vgap: o.vgap, - tgap: o.tgap, - bgap: o.bgap, - lgap: o.lgap, - rgap: o.rgap - }); - - this.container = BI.createWidget({ - type: "bi.left", - element: this, - items: [this.left] - }); - - return this.left; - }, - - populate: function (items) { - BI.HorizontalAutoLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal_float', BI.FloatHorizontalLayout);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexCenterLayout - * @extends BI.Layout - */ -BI.FlexCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-center-layout" - }); - }, - render: function () { - BI.FlexCenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexCenterLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "flex-shrink": "0"}); - return w; - }, - - resize: function () { - // console.log("flex_center布局不需要resize"); - }, - - populate: function (items) { - BI.FlexCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_center', BI.FlexCenterLayout);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexHorizontalLayout - * @extends BI.Layout - */ -BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexHorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-horizontal-layout", - verticalAlign: "middle", - columnSize: [], - scrollx: true, - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FlexHorizontalLayout.superclass.render.apply(this, arguments); - var o = this.options; - this.element.addClass(o.verticalAlign); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "flex-shrink": "0"}); - if (o.hgap + o.lgap + (item.lgap || 0) > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - resize: function () { - // console.log("flex_horizontal布局不需要resize"); - }, - - populate: function (items) { - BI.FlexHorizontalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_horizontal', BI.FlexHorizontalLayout);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexVerticalCenter - * @extends BI.Layout - */ -BI.FlexVerticalCenter = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexVerticalCenter.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-vertical-center", - columnSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FlexVerticalCenter.superclass.render.apply(this, arguments); - var o = this.options; - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexVerticalCenter.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "flex-shrink": "0"}); - if (o.hgap + o.lgap + (item.lgap || 0) > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - resize: function () { - // console.log("flex_vertical_center布局不需要resize"); - }, - - populate: function (items) { - BI.FlexVerticalCenter.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_vertical_center', BI.FlexVerticalCenter);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexCenterLayout - * @extends BI.Layout - */ -BI.FlexCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-wrapper-center-layout clearfix" - }); - }, - render: function () { - BI.FlexCenterLayout.superclass.render.apply(this, arguments); - this.$wrapper = $("<div>").addClass("flex-wrapper-center-layout-wrapper"); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexCenterLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative"}); - return w; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$wrapper.append(frag); - this.element.append(this.$wrapper); - } - }, - - _getWrapper: function(){ - return this.$wrapper; - }, - - resize: function () { - // console.log("flex_center布局不需要resize"); - }, - - populate: function (items) { - BI.FlexCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_wrapper_center', BI.FlexCenterLayout);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexHorizontalLayout - * @extends BI.Layout - */ -BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexHorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-wrapper-horizontal-layout clearfix", - verticalAlign: "middle", - columnSize: [], - scrollx: true, - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FlexHorizontalLayout.superclass.render.apply(this, arguments); - var o = this.options; - this.$wrapper = $("<div>").addClass("flex-wrapper-horizontal-layout-wrapper " + o.verticalAlign); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative"}); - if (o.hgap + o.lgap + (item.lgap || 0) > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$wrapper.append(frag); - this.element.append(this.$wrapper); - } - }, - - _getWrapper: function(){ - return this.$wrapper; - }, - - resize: function () { - // console.log("flex_horizontal布局不需要resize"); - }, - - populate: function (items) { - BI.FlexHorizontalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_wrapper_horizontal', BI.FlexHorizontalLayout);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexVerticalCenter - * @extends BI.Layout - */ -BI.FlexVerticalCenter = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexVerticalCenter.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-wrapper-vertical-center clearfix", - columnSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FlexVerticalCenter.superclass.render.apply(this, arguments); - var o = this.options; - this.$wrapper = $("<div>").addClass("flex-wrapper-vertical-center-wrapper"); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexVerticalCenter.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative"}); - if (o.hgap + o.lgap + (item.lgap || 0) > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$wrapper.append(frag); - this.element.append(this.$wrapper); - } - }, - - _getWrapper: function(){ - return this.$wrapper; - }, - - resize: function () { - // console.log("flex_vertical_center布局不需要resize"); - }, - - populate: function (items) { - BI.FlexVerticalCenter.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_wrapper_vertical_center', BI.FlexVerticalCenter);/** - * 固定子组件上下左右的布局容器 - * @class BI.AbsoluteLayout - * @extends BI.Layout - */ -BI.AbsoluteLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.AbsoluteLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-absolute-layout", - hgap: null, - vgap: null, - lgap: null, - rgap: null, - tgap: null, - bgap: null - }); - }, - render: function () { - BI.AbsoluteLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.AbsoluteLayout.superclass._addElement.apply(this, arguments); - var left = 0, right = 0, top = 0, bottom = 0; - if (BI.isNotNull(item.left)) { - w.element.css({"left": item.left}); - left += item.left; - } - if (BI.isNotNull(item.right)) { - w.element.css({"right": item.right}); - right += item.right; - } - if (BI.isNotNull(item.top)) { - w.element.css({"top": item.top}); - top += item.top; - } - if (BI.isNotNull(item.bottom)) { - w.element.css({"bottom": item.bottom}); - bottom += item.bottom; - } - - if (BI.isNotNull(o.hgap)) { - left += o.hgap; - w.element.css({"left": left}); - right += o.hgap; - w.element.css({"right": right}); - } - if (BI.isNotNull(o.vgap)) { - top += o.vgap; - w.element.css({"top": top}); - bottom += o.vgap; - w.element.css({"bottom": bottom}); - } - - if (BI.isNotNull(o.lgap)) { - left += o.lgap; - w.element.css({"left": left}); - } - if (BI.isNotNull(o.rgap)) { - right += o.rgap; - w.element.css({"right": right}); - } - if (BI.isNotNull(o.tgap)) { - top += o.tgap; - w.element.css({"top": top}); - } - if (BI.isNotNull(o.bgap)) { - bottom += o.bgap; - w.element.css({"bottom": bottom}); - } - - - if (BI.isNotNull(item.width)) { - w.element.css({"width": item.width}); - } - if (BI.isNotNull(item.height)) { - w.element.css({"height": item.height}); - } - w.element.css({"position": "absolute"}); - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - stroke: function (items) { - this.options.items = items || []; - var self = this; - BI.each(items, function (i, item) { - if (!!item) { - if (!BI.isWidget(item) && !item.el) { - throw new Error("el must be exist"); - } - self._addElement(i, item); - } - }); - }, - - populate: function (items) { - BI.AbsoluteLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.absolute', BI.AbsoluteLayout);BI.AdaptiveLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.AdaptiveLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-adaptive-layout", - hgap: null, - vgap: null, - lgap: null, - rgap: null, - tgap: null, - bgap: null - }); - }, - render: function () { - BI.AdaptiveLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.AdaptiveLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative"}); - var left = 0, right = 0, top = 0, bottom = 0; - if (BI.isNotNull(item.left)) { - w.element.css({ - "margin-left": item.left - }) - } - if (BI.isNotNull(item.right)) { - w.element.css({ - "margin-right": item.right - }) - } - if (BI.isNotNull(item.top)) { - w.element.css({ - "margin-top": item.top - }) - } - if (BI.isNotNull(item.bottom)) { - w.element.css({ - "margin-bottom": item.bottom - }) - } - - if (BI.isNotNull(o.hgap)) { - left += o.hgap; - w.element.css({"left": left}); - right += o.hgap; - w.element.css({"right": right}); - } - if (BI.isNotNull(o.vgap)) { - top += o.vgap; - w.element.css({"top": top}); - bottom += o.vgap; - w.element.css({"bottom": bottom}); - } - - if (BI.isNotNull(o.lgap)) { - left += o.lgap; - w.element.css({"left": left}); - } - if (BI.isNotNull(o.rgap)) { - right += o.rgap; - w.element.css({"right": right}); - } - if (BI.isNotNull(o.tgap)) { - top += o.tgap; - w.element.css({"top": top}); - } - if (BI.isNotNull(o.bgap)) { - bottom += o.bgap; - w.element.css({"bottom": bottom}); - } - - if (BI.isNotNull(item.width)) { - w.element.css({"width": item.width}); - } - if (BI.isNotNull(item.height)) { - w.element.css({"height": item.height}); - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - populate: function (items) { - BI.AbsoluteLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.adaptive', BI.AdaptiveLayout);/** - * 上下的高度固定/左右的宽度固定,中间的高度/宽度自适应 - * - * @class BI.BorderLayout - * @extends BI.Layout - */ -BI.BorderLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.BorderLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-border-layout", - items: {} - }); - }, - render: function () { - BI.BorderLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - this.stroke(this.options.items); - }, - - addItem: function (item) { - // do nothing - throw new Error("cannot be added") - }, - - stroke: function(regions){ - var item; - var top = 0; - var bottom = 0; - var left = 0; - var right = 0; - if ("north" in regions) { - item = regions["north"]; - if (item != null) { - if (item.el) { - if (!this.hasWidget(this.getName() + "north")) { - var w = BI.createWidget(item); - this.addWidget(this.getName() + "north", w); - } - this.getWidgetByName(this.getName() + "north").element.height(item.height) - .css({ - "position": "absolute", - "top": (item.top || 0), - "left": (item.left || 0), - "right": (item.right || 0), - "bottom": "initial" - }); - } - top = (item.height || 0) + (item.top || 0) + (item.bottom || 0); - } - } - if ("south" in regions) { - item = regions["south"]; - if (item != null) { - if (item.el) { - if (!this.hasWidget(this.getName() + "south")) { - var w = BI.createWidget(item); - this.addWidget(this.getName() + "south", w); - } - this.getWidgetByName(this.getName() + "south").element.height(item.height) - .css({ - "position": "absolute", - "bottom": (item.bottom || 0), - "left": (item.left || 0), - "right": (item.right || 0), - "top": "initial" - }); - } - bottom = (item.height || 0) + (item.top || 0) + (item.bottom || 0); - } - } - if ("west" in regions) { - item = regions["west"]; - if (item != null) { - if (item.el) { - if (!this.hasWidget(this.getName() + "west")) { - var w = BI.createWidget(item); - this.addWidget(this.getName() + "west", w); - } - this.getWidgetByName(this.getName() + "west").element.width(item.width) - .css({ - "position": "absolute", - "left": (item.left || 0), - top: top, - bottom: bottom, - "right": "initial" - }); - } - left = (item.width || 0) + (item.left || 0) + (item.right || 0); - } - } - if ("east" in regions) { - item = regions["east"]; - if (item != null) { - if (item.el) { - if (!this.hasWidget(this.getName() + "east")) { - var w = BI.createWidget(item); - this.addWidget(this.getName() + "east", w); - } - this.getWidgetByName(this.getName() + "east").element.width(item.width) - .css({ - "position": "absolute", - "right": (item.right || 0), - top: top, - bottom: bottom, - "left": "initial" - }); - } - right = (item.width || 0) + (item.left || 0) + (item.right || 0); - } - } - if ("center" in regions) { - item = regions["center"]; - if (item != null) { - if (!this.hasWidget(this.getName() + "center")) { - var w = BI.createWidget(item); - this.addWidget(this.getName() + "center", w); - } - this.getWidgetByName(this.getName() + "center").element - .css({"position": "absolute", "top": top, "bottom": bottom, "left": left, "right": right}); - } - } - }, - - populate: function (items) { - BI.BorderLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.border', BI.BorderLayout);/** - * 卡片布局,可以做到当前只显示一个组件,其他的都隐藏 - * @class BI.CardLayout - * @extends BI.Layout - * - * @cfg {JSON} options 配置属性 - * @cfg {String} options.defaultShowName 默认展示的子组件名 - */ -BI.CardLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.CardLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-card-layout", - items: [] - }); - }, - render: function () { - BI.CardLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("default布局不需要resize"); - }, - - stroke: function (items) { - var self = this, o = this.options; - this.showIndex = void 0; - BI.each(items, function (i, item) { - if (!!item) { - if (!self.hasWidget(item.cardName)) { - var w = BI.createWidget(item); - w.on(BI.Events.DESTROY, function () { - var index = BI.findIndex(o.items, function (i, tItem) { - return tItem.cardName == item.cardName; - }); - if (index > -1) { - o.items.splice(index, 1); - } - }); - self.addWidget(item.cardName, w); - } else { - var w = self.getWidgetByName(item.cardName); - } - w.element.css({"position": "absolute", "top": "0", "right": "0", "bottom": "0", "left": "0"}); - w.setVisible(false); - } - }); - }, - - update: function () { - }, - - empty: function () { - BI.CardLayout.superclass.empty.apply(this, arguments); - this.options.items = []; - }, - - populate: function (items) { - BI.CardLayout.superclass.populate.apply(this, arguments); - this._mount(); - this.options.defaultShowName && this.showCardByName(this.options.defaultShowName); - }, - - isCardExisted: function (cardName) { - return BI.some(this.options.items, function (i, item) { - return item.cardName == cardName && item.el; - }); - }, - - getCardByName: function (cardName) { - if (!this.isCardExisted(cardName)) { - throw new Error("cardName is not exist"); - } - return this._children[cardName]; - }, - - _deleteCardByName: function (cardName) { - delete this._children[cardName]; - var index = BI.findIndex(this.options.items, function (i, item) { - return item.cardName == cardName; - }); - if (index > -1) { - this.options.items.splice(index, 1); - } - }, - - deleteCardByName: function (cardName) { - if (!this.isCardExisted(cardName)) { - throw new Error("cardName is not exist"); - } - - var child = this._children[cardName]; - this._deleteCardByName(cardName); - child && child._destroy(); - }, - - addCardByName: function (cardName, cardItem) { - if (this.isCardExisted(cardName)) { - throw new Error("cardName is already exist"); - } - var widget = BI.createWidget(cardItem); - widget.element.css({ - "position": "relative", - "top": "0", - "left": "0", - "width": "100%", - "height": "100%" - }).appendTo(this.element); - widget.invisible(); - this.addWidget(cardName, widget); - this.options.items.push({el: cardItem, cardName: cardName}); - return widget; - }, - - showCardByName: function (name, action, callback) { - var self = this; - //name不存在的时候全部隐藏 - var exist = this.isCardExisted(name); - if (this.showIndex != null) { - this.lastShowIndex = this.showIndex; - } - this.showIndex = name; - var flag = false; - BI.each(this.options.items, function (i, item) { - var el = self._children[item.cardName]; - if (el) { - if (name != item.cardName) { - //动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了 - !flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible(); - } else { - (BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : (el.visible(), callback && callback()) - } - } - }); - }, - - showLastCard: function () { - var self = this; - this.showIndex = this.lastShowIndex; - BI.each(this.options.items, function (i, item) { - self._children[item.cardName].setVisible(self.showIndex == i); - }) - }, - - setDefaultShowName: function (name) { - this.options.defaultShowName = name; - return this; - }, - - getDefaultShowName: function () { - return this.options.defaultShowName; - }, - - getAllCardNames: function () { - return BI.map(this.options.items, function (i, item) { - return item.cardName; - }) - }, - - getShowingCard: function () { - if (!BI.isKey(this.showIndex)) { - return void 0; - } - return this.getWidgetByName(this.showIndex); - }, - - deleteAllCard: function () { - var self = this; - BI.each(this.getAllCardNames(), function (i, name) { - self.deleteCardByName(name); - }) - }, - - hideAllCard: function () { - var self = this; - BI.each(this.options.items, function (i, item) { - self._children[item.cardName].invisible(); - }); - }, - - isAllCardHide: function () { - var self = this; - var flag = true; - BI.some(this.options.items, function (i, item) { - if (self._children[item.cardName].isVisible()) { - flag = false; - return false; - } - }); - return flag; - }, - - removeWidget: function (nameOrWidget) { - var removeName; - if (BI.isWidget(nameOrWidget)) { - BI.each(this._children, function (name, child) { - if (child === nameOrWidget) { - removeName = name; - } - }) - } else { - removeName = nameOrWidget; - } - if (removeName) { - this._deleteCardByName(removeName); - } - } -}); -BI.shortcut('bi.card', BI.CardLayout);/** - * 默认的布局方式 - * - * @class BI.DefaultLayout - * @extends BI.Layout - */ -BI.DefaultLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.DefaultLayout.superclass.props.apply(this, arguments), { - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - items: [] - }); - }, - render: function () { - BI.DefaultLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.DefaultLayout.superclass._addElement.apply(this, arguments); - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - resize: function () { - // console.log("default布局不需要resize") - }, - - populate: function (items) { - BI.DefaultLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.default', BI.DefaultLayout);/** - * 分隔容器的控件,按照宽度和高度所占比平分整个容器 - * - * @class BI.DivisionLayout - * @extends BI.Layout - */ -BI.DivisionLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.DivisionLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-division-layout", - columns: null, - rows: null, - items: [] - // [ - // { - // column: 0, - // row: 0, - // width: 0.25, - // height: 0.33, - // el: {type: 'bi.button', text: 'button1'} - // }, - // { - // column: 1, - // row: 1, - // width: 0.25, - // height: 0.33, - // el: {type: 'bi.button', text: 'button2'} - // }, - // { - // column: 3, - // row: 2, - // width: 0.25, - // height: 0.33, - // el: {type: 'bi.button', text: 'button3'} - // } - //] - }); - }, - render: function () { - BI.DivisionLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - this.stroke(this.opitons.items); - }, - - addItem: function (item) { - // do nothing - throw new Error("cannot be added") - }, - - stroke: function(items){ - var o = this.options; - var rows = o.rows || o.items.length, columns = o.columns || ((o.items[0] && o.items[0].length) | 0); - var map = BI.makeArray(rows), widths = {}, heights = {}; - function firstElement(item, row, col) { - if (row === 0) { - item.addClass("first-row") - } - if (col === 0) { - item.addClass("first-col"); - } - item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row"); - item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col"); - item.addClass("center-element"); - } - - function firstObject(item, row, col) { - var cls = ""; - if (row === 0) { - cls += " first-row"; - } - if (col === 0) { - cls += " first-col"; - } - BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row"); - BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col"); - item.cls = (item.cls || "") + cls + " center-element"; - } - - function first(item, row, col) { - if (item instanceof BI.Widget) { - firstElement(item.element, row, col); - } else if (item.el instanceof BI.Widget) { - firstElement(item.el.element, row, col); - } else if (item.el) { - firstObject(item.el, row, col) - } else { - firstObject(item, row, col); - } - } - BI.each(map, function (i) { - map[i] = BI.makeArray(columns); - }); - BI.each(items, function (i, item) { - if (BI.isArray(item)) { - BI.each(item, function (j, el) { - widths[i] = (widths[i] || 0) + item.width; - heights[j] = (heights[j] || 0) + item.height; - map[i][j] = el; - }); - return; - } - widths[item.row] = (widths[item.row] || 0) + item.width; - heights[item.column] = (heights[item.column] || 0) + item.height; - map[item.row][item.column] = item; - }); - for (var i = 0; i < rows; i++) { - var totalW = 0; - for (var j = 0; j < columns; j++) { - if (!map[i][j]) { - throw new Error("item be required"); - } - if(!this.hasWidget(this.getName() + i + "_" + j)) { - var w = BI.createWidget(map[i][j]); - this.addWidget(this.getName() + i + "_" + j, w); - } else { - w = this.getWidgetByName(this.getName() + i + "_" + j); - } - var left = totalW * 100 / widths[i]; - w.element.css({"position": "absolute", "left": left + "%"}); - if (j > 0) { - var lastW = this.getWidgetByName(this.getName() + i + "_" + (j - 1)); - lastW.element.css({"right": (100 - left) + "%"}); - } - if (j == o.columns - 1) { - w.element.css({"right": "0%"}); - } - first(w, i, j); - totalW += map[i][j].width; - } - } - for (var j = 0; j < o.columns; j++) { - var totalH = 0; - for (var i = 0; i < o.rows; i++) { - var w = this.getWidgetByName(this.getName() + i + "_" + j); - var top = totalH * 100 / heights[j]; - w.element.css({"top": top + "%"}); - if (i > 0) { - var lastW = this.getWidgetByName(this.getName() + (i - 1) + "_" + j); - lastW.element.css({"bottom": (100 - top) + "%"}); - } - if (i == o.rows - 1) { - w.element.css({"bottom": "0%"}); - } - totalH += map[i][j].height; - } - } - }, - - populate: function (items) { - BI.DivisionLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.division', BI.DivisionLayout);/** - * 靠左对齐的自由浮动布局 - * @class BI.FloatLeftLayout - * @extends BI.Layout - * - * @cfg {JSON} options 配置属性 - * @cfg {Number} [hgap=0] 水平间隙 - * @cfg {Number} [vgap=0] 垂直间隙 - */ -BI.FloatLeftLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatLeftLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-left-layout clearfix", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FloatLeftLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FloatLeftLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "float": "left"}); - if (BI.isNotNull(item.left)) { - w.element.css({"left": item.left}); - } - if (BI.isNotNull(item.right)) { - w.element.css({"right": item.right}); - } - if (BI.isNotNull(item.top)) { - w.element.css({"top": item.top}); - } - if ((item.lgap || 0) + o.hgap + o.lgap !== 0) { - w.element.css("margin-left", (item.lgap || 0) + o.hgap + o.lgap); - } - if ((item.rgap || 0) + o.hgap + o.rgap !== 0) { - w.element.css("margin-right", (item.rgap || 0) + o.hgap + o.rgap); - } - if ((item.tgap || 0) + o.vgap + o.tgap !== 0) { - w.element.css("margin-top", (item.tgap || 0) + o.vgap + o.tgap); - } - if ((item.bgap || 0) + o.vgap + o.bgap !== 0) { - w.element.css("margin-bottom", (item.bgap || 0) + o.vgap + o.bgap); - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - populate: function (items) { - BI.FloatLeftLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.left', BI.FloatLeftLayout); - -/** - * 靠右对齐的自由浮动布局 - * @class BI.FloatRightLayout - * @extends BI.Layout - * - * @cfg {JSON} options 配置属性 - * @cfg {Number} [hgap=0] 水平间隙 - * @cfg {Number} [vgap=0] 垂直间隙 - */ -BI.FloatRightLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatRightLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-right-layout clearfix", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FloatRightLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FloatRightLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "float": "right"}); - if (BI.isNotNull(item.left)) { - w.element.css({"left": item.left}); - } - if (BI.isNotNull(item.right)) { - w.element.css({"right": item.right}); - } - if (BI.isNotNull(item.top)) { - w.element.css({"top": item.top}); - } - if ((item.lgap || 0) + o.hgap + o.lgap !== 0) { - w.element.css("margin-left", (item.lgap || 0) + o.hgap + o.lgap); - } - if ((item.rgap || 0) + o.hgap + o.rgap !== 0) { - w.element.css("margin-right", (item.rgap || 0) + o.hgap + o.rgap); - } - if ((item.tgap || 0) + o.vgap + o.tgap !== 0) { - w.element.css("margin-top", (item.tgap || 0) + o.vgap + o.tgap); - } - if ((item.bgap || 0) + o.vgap + o.bgap !== 0) { - w.element.css("margin-bottom", (item.bgap || 0) + o.vgap + o.bgap); - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - populate: function (items) { - BI.FloatRightLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.right', BI.FloatRightLayout);/** - * 上下的高度固定/左右的宽度固定,中间的高度/宽度自适应 - * - * @class BI.BorderLayout - * @extends BI.Layout - */ -BI.GridLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.GridLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-grid-layout", - columns: null, - rows: null, - items: [] - /*[ - { - column: 0, - row: 0, - el: {type: 'bi.button', text: 'button1'} - }, - { - column: 1, - row: 1, - el: {type: 'bi.button', text: 'button2'} - }, - { - column: 3, - row: 2, - el: {type: 'bi.button', text: 'button3'} - } - ]*/ - }); - }, - render: function () { - BI.GridLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("grid布局不需要resize") - }, - - addItem: function () { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - var rows = o.rows || o.items.length, columns = o.columns || ((o.items[0] && o.items[0].length) | 0); - var width = 100 / columns, height = 100 / rows; - var els = []; - for (var i = 0; i < rows; i++) { - els[i] = []; - } - function firstElement(item, row, col) { - if (row === 0) { - item.addClass("first-row") - } - if (col === 0) { - item.addClass("first-col"); - } - item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row"); - item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col"); - item.addClass("center-element"); - } - - function firstObject(item, row, col) { - var cls = ""; - if (row === 0) { - cls += " first-row"; - } - if (col === 0) { - cls += " first-col"; - } - BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row"); - BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col"); - item.cls = (item.cls || "") + cls + " center-element"; - } - - function first(item, row, col) { - if (item instanceof BI.Widget) { - firstElement(item.element, row, col); - } else if (item.el instanceof BI.Widget) { - firstElement(item.el.element, row, col); - } else if (item.el) { - firstObject(item.el, row, col) - } else { - firstObject(item, row, col); - } - } - - BI.each(items, function (i, item) { - if (BI.isArray(item)) { - BI.each(item, function (j, el) { - els[i][j] = BI.createWidget(el); - }); - return; - } - els[item.row][item.column] = BI.createWidget(item); - }); - for (var i = 0; i < rows; i++) { - for (var j = 0; j < columns; j++) { - if (!els[i][j]) { - els[i][j] = BI.createWidget({ - type: "bi.layout" - }); - } - first(els[i][j], i, j); - els[i][j].element.css({ - "position": "absolute", - "top": height * i + "%", - "left": width * j + "%", - "right": (100 - (width * (j + 1))) + "%", - "bottom": (100 - (height * (i + 1))) + "%" - }); - this.addWidget(els[i][j]); - } - } - }, - - populate: function (items) { - BI.GridLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.grid', BI.GridLayout);/** - * 水平布局 - * @class BI.HorizontalLayout - * @extends BI.Layout - */ -BI.HorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-horizontal-layout", - verticalAlign: "middle", - columnSize: [], - scrollx: true, - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.HorizontalLayout.superclass.render.apply(this, arguments); - this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ - "position": "relative", - "white-space": "nowrap", - "border-spacing": "0px", - "border": "none", - "border-collapse": "separate" - }); - this.$tr = $("<tr>"); - this.$tr.appendTo(this.$table); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var td; - var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; - if (!this.hasWidget(this._getChildName(i))) { - var w = BI.createWidget(item); - w.element.css({"position": "relative", "margin": "0px auto"}); - td = BI.createWidget({ - type: "bi.default", - tagName: "td", - attributes: { - width: width - }, - items: [w] - }); - this.addWidget(this._getChildName(i), td); - } else { - td = this.getWidgetByName(this._getChildName(i)); - td.element.attr("width", width); - } - - if (i === 0) { - td.element.addClass("first-element"); - } - td.element.css({ - "position": "relative", - "vertical-align": o.verticalAlign, - "margin": "0", - "padding": "0", - "border": "none" - }); - if (o.hgap + o.lgap + (item.lgap || 0) > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return td; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$tr.append(frag); - this.element.append(this.$table); - } - }, - - - resize: function () { - // console.log("horizontal layout do not need to resize"); - }, - - _getWrapper: function(){ - return this.$tr; - }, - - populate: function (items) { - BI.HorizontalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal', BI.HorizontalLayout); - -/** - * 水平布局 - * @class BI.HorizontalCellLayout - * @extends BI.Layout - */ -BI.HorizontalCellLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HorizontalCellLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-horizontal-cell-layout", - scrollable: true, - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.HorizontalCellLayout.superclass.render.apply(this, arguments); - this.element.css({"display": "table", "vertical-align": "top"}); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.HorizontalCellLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "display": "table-cell", "vertical-align": "middle"}); - if (o.hgap + o.lgap > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + "px" - }) - } - if (o.hgap + o.rgap > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + "px" - }) - } - if (o.vgap + o.tgap > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + "px" - }) - } - if (o.vgap + o.bgap > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + "px" - }) - } - return w; - }, - - resize: function () { - // console.log("horizontal do not need to resize"); - }, - - populate: function (items) { - BI.HorizontalCellLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal_cell', BI.HorizontalCellLayout);/** - * 靠左对齐的自由浮动布局 - * @class BI.LatticeLayout - * @extends BI.Layout - * - * @cfg {JSON} options 配置属性 - * @cfg {Number} [hgap=0] 水平间隙 - * @cfg {Number} [vgap=0] 垂直间隙 - */ -BI.LatticeLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.LatticeLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-lattice-layout clearfix" - //columnSize: [0.2, 0.2, 0.6], - }); - }, - render: function () { - BI.LatticeLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.LatticeLayout.superclass._addElement.apply(this, arguments); - if (o.columnSize && o.columnSize[i]) { - var width = o.columnSize[i] / BI.sum(o.columnSize) * 100 + "%"; - } else { - var width = 1 / this.options.items.length * 100 + "%" - } - w.element.css({"position": "relative", "float": "left", "width": width}); - return w; - }, - - addItem: function (item) { - var w = BI.LatticeLayout.superclass.addItem.apply(this, arguments); - this.resize(); - return w; - }, - - addItemAt: function (item) { - var w = BI.LatticeLayout.superclass.addItemAt.apply(this, arguments); - this.resize(); - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - populate: function (items) { - BI.LatticeLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.lattice', BI.LatticeLayout);/** - * 上下的高度固定/左右的宽度固定,中间的高度/宽度自适应 - * - * @class BI.TableLayout - * @extends BI.Layout - */ -BI.TableLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.TableLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-table-layout", - scrolly: true, - columnSize: [200, 200, 'fill'], - rowSize: 30, //or [30,30,30] - hgap: 0, - vgap: 0, - items: [[ - { - el: {text: 'label1'} - }, - { - el: {text: 'label2'} - }, - { - el: {text: 'label3'} - } - ]] - }); - }, - render: function () { - BI.TableLayout.superclass.render.apply(this, arguments); - this.rows = 0; - this.populate(this.options.items); - }, - - _addElement: function (idx, arr) { - var o = this.options; - var abs = [], left = 0, right = 0, i, j; - - function firstElement(item, row, col) { - if (row === 0) { - item.addClass("first-row") - } - if (col === 0) { - item.addClass("first-col"); - } - item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row"); - item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col"); - item.addClass("center-element"); - } - - function firstObject(item, row, col) { - var cls = ""; - if (row === 0) { - cls += " first-row"; - } - if (col === 0) { - cls += " first-col"; - } - BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row"); - BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col"); - item.cls = (item.cls || "") + cls + " center-element"; - } - - function first(item, row, col) { - if (item instanceof BI.Widget) { - firstElement(item.element, row, col); - } else if (item.el instanceof BI.Widget) { - firstElement(item.el.element, row, col); - } else if (item.el) { - firstObject(item.el, row, col) - } else { - firstObject(item, row, col); - } - } - - for (i = 0; i < arr.length; i++) { - if (BI.isNumber(o.columnSize[i])) { - first(arr[i], this.rows, i); - abs.push(BI.extend({ - top: 0, - bottom: 0, - left: o.columnSize[i] <= 1 ? left * 100 + "%" : left, - width: o.columnSize[i] <= 1 ? o.columnSize[i] * 100 + "%" : o.columnSize[i] - }, arr[i])); - left += o.columnSize[i] + (o.columnSize[i] < 1 ? 0 : o.hgap); - } else { - break; - } - } - for (j = arr.length - 1; j > i; j--) { - if (BI.isNumber(o.columnSize[j])) { - first(arr[j], this.rows, j); - abs.push(BI.extend({ - top: 0, - bottom: 0, - right: o.columnSize[j] <= 1 ? right * 100 + "%" : right, - width: o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] - }, arr[j])) - right += o.columnSize[j] + (o.columnSize[j] < 1 ? 0 : o.hgap); - } else { - throw new Error("item with fill can only be one"); - } - } - if (i >= 0 && i < arr.length) { - first(arr[i], this.rows, i); - abs.push(BI.extend({ - top: 0, - bottom: 0, - left: left <= 1 ? left * 100 + "%" : left, - right: right <= 1 ? right * 100 + "%" : right - }, arr[i])) - } - var w = BI.createWidget({ - type: "bi.absolute", - height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize, - items: abs - }); - if (this.rows > 0) { - this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({ - "margin-bottom": o.vgap - }) - } - w.element.css({ - "position": "relative" - }); - this.addWidget(this.getName() + (this.rows++), w); - return w; - }, - - resize: function () { - // console.log("table布局不需要resize"); - }, - - addItem: function (arr) { - if (!BI.isArray(arr)) { - throw new Error("item must be array"); - } - return BI.TableLayout.superclass.addItem.apply(this, arguments); - }, - - populate: function (items) { - BI.TableLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.table', BI.TableLayout);/** - * 水平tape布局 - * @class BI.HTapeLayout - * @extends BI.Layout - */ -BI.HTapeLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HTapeLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-h-tape-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - items: [ - { - width: 100, - el: {type: 'bi.button', text: 'button1'} - }, - { - width: 'fill', - el: {type: 'bi.button', text: 'button2'} - }, - { - width: 200, - el: {type: 'bi.button', text: 'button3'} - } - ] - }); - }, - render: function () { - BI.HTapeLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - this.stroke(this.options.items); - }, - addItem: function (item) { - // do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var self = this, o = this.options; - items = BI.compact(items); - BI.each(items, function (i, item) { - if (!self.hasWidget(self.getName() + i + "")) { - var w = BI.createWidget(item); - self.addWidget(self.getName() + i + "", w); - } else { - w = self.getWidgetByName(self.getName() + i + ""); - } - w.element.css({"position": "absolute", top: o.vgap + o.tgap + "px", bottom: o.vgap + o.bgap + "px"}); - }); - - var left = {}, right = {}; - left[0] = 0; - right[items.length - 1] = 0; - - BI.any(items, function (i, item) { - var w = self.getWidgetByName(self.getName() + i + ""); - if (BI.isNull(left[i])) { - left[i] = left[i - 1] + items[i - 1].width + 2 * o.hgap + o.lgap + o.rgap; - } - if (item.width < 1 && item.width >= 0) { - w.element.css({"left": left[i] * 100 + "%", width: item.width * 100 + "%"}) - } else { - w.element.css({ - "left": left[i] + o.hgap + o.lgap + "px", - width: BI.isNumber(item.width) ? item.width : "" - }); - } - if (!BI.isNumber(item.width)) { - return true; - } - }); - BI.backAny(items, function (i, item) { - var w = self.getWidgetByName(self.getName() + i + ""); - if (BI.isNull(right[i])) { - right[i] = right[i + 1] + items[i + 1].width + 2 * o.hgap + o.lgap + o.rgap; - } - if (item.width < 1 && item.width >= 0) { - w.element.css({"right": right[i] * 100 + "%", width: item.width * 100 + "%"}) - } else { - w.element.css({ - "right": right[i] + o.hgap + o.rgap + "px", - width: BI.isNumber(item.width) ? item.width : "" - }); - } - if (!BI.isNumber(item.width)) { - return true; - } - }) - }, - - populate: function (items) { - BI.HTapeLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.htape', BI.HTapeLayout); - -/** - * 垂直tape布局 - * @class BI.VTapeLayout - * @extends BI.Layout - */ -BI.VTapeLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.VTapeLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-v-tape-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - items: [ - { - height: 100, - el: {type: 'bi.button', text: 'button1'} - }, - { - height: 'fill', - el: {type: 'bi.button', text: 'button2'} - }, - { - height: 200, - el: {type: 'bi.button', text: 'button3'} - } - ] - }); - }, - render: function () { - BI.VTapeLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - this.stroke(this.options.items); - }, - - addItem: function (item) { - // do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var self = this, o = this.options; - items = BI.compact(items); - BI.each(items, function (i, item) { - if (!self.hasWidget(self.getName() + i + "")) { - var w = BI.createWidget(item); - self.addWidget(self.getName() + i + "", w); - } else { - w = self.getWidgetByName(self.getName() + i + ""); - } - w.element.css({"position": "absolute", left: o.hgap + o.lgap + "px", right: o.hgap + o.rgap + "px"}); - }); - - var top = {}, bottom = {}; - top[0] = 0; - bottom[items.length - 1] = 0; - - BI.any(items, function (i, item) { - var w = self.getWidgetByName(self.getName() + i + ""); - if (BI.isNull(top[i])) { - top[i] = top[i - 1] + items[i - 1].height + 2 * o.vgap + o.tgap + o.bgap; - } - if (item.height < 1 && item.height >= 0) { - w.element.css({"top": top[i] * 100 + "%", height: item.height * 100 + "%"}) - } else { - w.element.css({ - "top": top[i] + o.vgap + o.tgap + "px", - height: BI.isNumber(item.height) ? item.height : "" - }); - } - if (!BI.isNumber(item.height)) { - return true; - } - }); - BI.backAny(items, function (i, item) { - var w = self.getWidgetByName(self.getName() + i + ""); - if (BI.isNull(bottom[i])) { - bottom[i] = bottom[i + 1] + items[i + 1].height + 2 * o.vgap + o.tgap + o.bgap; - } - if (item.height < 1 && item.height >= 0) { - w.element.css({"bottom": bottom[i] * 100 + "%", height: item.height * 100 + "%"}) - } else { - w.element.css({ - "bottom": bottom[i] + o.vgap + o.bgap + "px", - height: BI.isNumber(item.height) ? item.height : "" - }); - } - if (!BI.isNumber(item.height)) { - return true; - } - }) - }, - - populate: function (items) { - BI.VTapeLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.vtape', BI.VTapeLayout);/** - * td布局 - * @class BI.TdLayout - * @extends BI.Layout - */ -BI.TdLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.TdLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-td-layout", - columnSize: [200, 200, 200], - hgap: 0, - vgap: 0, - items: [[ - { - el: {text: 'label1'} - }, - { - el: {text: 'label2'} - }, - { - el: {text: 'label3'} - } - ]] - }); - }, - render: function () { - BI.TdLayout.superclass.render.apply(this, arguments); - this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ - "position": "relative", - "width": "100%", - "height": "100%", - "border-spacing": "0px", - "border": "none", - "border-collapse": "separate" - }); - this.rows = 0; - this.populate(this.options.items); - }, - - _addElement: function (idx, arr) { - var o = this.options; - - function firstElement(item, row, col) { - if (row === 0) { - item.addClass("first-row") - } - if (col === 0) { - item.addClass("first-col"); - } - item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row"); - item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col"); - item.addClass("center-element"); - } - - function firstObject(item, row, col) { - var cls = ""; - if (row === 0) { - cls += " first-row"; - } - if (col === 0) { - cls += " first-col"; - } - BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row"); - BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col"); - item.cls = (item.cls || "") + cls + " center-element"; - } - - function first(item, row, col) { - if (item instanceof BI.Widget) { - firstElement(item.element, row, col); - } else if (item.el instanceof BI.Widget) { - firstElement(item.el.element, row, col); - } else if (item.el) { - firstObject(item.el, row, col) - } else { - firstObject(item, row, col); - } - } - - var tr = BI.createWidget({ - type: "bi.default", - tagName: "tr" - }); - - for (var i = 0; i < arr.length; i++) { - var w = BI.createWidget(arr[i]); - w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); - first(w, this.rows++, i); - var td = BI.createWidget({ - type: 'bi.default', - attributes: { - width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i] - }, - tagName: 'td', - items: [w] - }); - td.element.css({ - "position": "relative", - "vertical-align": "middle", - "margin": "0", - "padding": "0", - "border": "none" - }); - tr.addItem(td); - } - this.addWidget(this.getName() + idx, tr); - return tr; - }, - - _mountChildren: function(){ - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$table.append(frag); - this.element.append(this.$table); - } - }, - - resize: function () { - // console.log("td布局不需要resize"); - }, - - addItem: function (arr) { - if (!BI.isArray(arr)) { - throw new Error("item must be array"); - } - return BI.TdLayout.superclass.addItem.apply(this, arguments); - }, - - populate: function (items) { - BI.TdLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.td', BI.TdLayout);/** - * 垂直布局 - * @class BI.VerticalLayout - * @extends BI.Layout - */ -BI.VerticalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.VerticalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-vertical-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - scrolly: true - }); - }, - render: function () { - BI.VerticalLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.VerticalLayout.superclass._addElement.apply(this, arguments); - w.element.css({ - "position": "relative" - }); - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - populate: function (items) { - BI.VerticalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.vertical', BI.VerticalLayout);/** - * - * @class BI.WindowLayout - * @extends BI.Layout - */ -BI.WindowLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.WindowLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-window-layout", - columns: 3, - rows: 2, - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - columnSize: [100, "fill", 200], - rowSize: [100, "fill"], - items: [[ - { - el: {type: 'bi.button', text: 'button1'} - }, - { - el: {type: 'bi.button', text: 'button2'} - }, - { - el: {type: 'bi.button', text: 'button3'} - } - ]] - }); - }, - render: function () { - BI.WindowLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - this.stroke(this.options.items); - }, - - addItem: function (item) { - // do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - if (BI.isNumber(o.rowSize)) { - o.rowSize = BI.makeArray(o.items.length, 1 / o.items.length); - } - if (BI.isNumber(o.columnSize)) { - o.columnSize = BI.makeArray(o.items[0].length, 1 / o.items[0].length); - } - function firstElement(item, row, col) { - if (row === 0) { - item.addClass("first-row") - } - if (col === 0) { - item.addClass("first-col"); - } - item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row"); - item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col"); - item.addClass("center-element"); - } - - function firstObject(item, row, col) { - var cls = ""; - if (row === 0) { - cls += " first-row"; - } - if (col === 0) { - cls += " first-col"; - } - BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row"); - BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col"); - item.cls = (item.cls || "") + cls + " center-element"; - } - - function first(item, row, col) { - if (item instanceof BI.Widget) { - firstElement(item.element, row, col); - } else if (item.el instanceof BI.Widget) { - firstElement(item.el.element, row, col); - } else if (item.el) { - firstObject(item.el, row, col) - } else { - firstObject(item, row, col); - } - } - - for (var i = 0; i < o.rows; i++) { - for (var j = 0; j < o.columns; j++) { - if (!o.items[i][j]) { - throw new Error("item be required"); - } - if (!this.hasWidget(this.getName() + i + "_" + j)) { - var w = BI.createWidget(o.items[i][j]); - w.element.css({"position": "absolute"}); - this.addWidget(this.getName() + i + "_" + j, w); - } - } - } - var left = {}, right = {}, top = {}, bottom = {}; - left[0] = 0; - top[0] = 0; - right[o.columns - 1] = 0; - bottom[o.rows - 1] = 0; - //从上到下 - for (var i = 0; i < o.rows; i++) { - for (var j = 0; j < o.columns; j++) { - var wi = this.getWidgetByName(this.getName() + i + "_" + j); - if (BI.isNull(top[i])) { - top[i] = top[i - 1] + (o.rowSize[i - 1] < 1 ? o.rowSize[i - 1] : o.rowSize[i - 1] + o.vgap + o.bgap); - } - var t = top[i] <= 1 ? top[i] * 100 + "%" : top[i] + o.vgap + o.tgap + "px", h = ""; - if (BI.isNumber(o.rowSize[i])) { - h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] + "px"; - } - wi.element.css({"top": t, height: h}); - first(wi, i, j); - } - if (!BI.isNumber(o.rowSize[i])) { - break; - } - } - //从下到上 - for (var i = o.rows - 1; i >= 0; i--) { - for (var j = 0; j < o.columns; j++) { - var wi = this.getWidgetByName(this.getName() + i + "_" + j); - if (BI.isNull(bottom[i])) { - bottom[i] = bottom[i + 1] + (o.rowSize[i + 1] < 1 ? o.rowSize[i + 1] : o.rowSize[i + 1] + o.vgap + o.tgap); - } - var b = bottom[i] <= 1 ? bottom[i] * 100 + "%" : bottom[i] + o.vgap + o.bgap + "px", h = ""; - if (BI.isNumber(o.rowSize[i])) { - h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] + "px"; - } - wi.element.css({"bottom": b, height: h}); - first(wi, i, j); - } - if (!BI.isNumber(o.rowSize[i])) { - break; - } - } - //从左到右 - for (var j = 0; j < o.columns; j++) { - for (var i = 0; i < o.rows; i++) { - var wi = this.getWidgetByName(this.getName() + i + "_" + j); - if (BI.isNull(left[j])) { - left[j] = left[j - 1] + (o.columnSize[j - 1] < 1 ? o.columnSize[j - 1] : o.columnSize[j - 1] + o.hgap + o.rgap); - } - var l = left[j] <= 1 ? left[j] * 100 + "%" : left[j] + o.hgap + o.lgap + "px", w = ""; - if (BI.isNumber(o.columnSize[j])) { - w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] + "px"; - } - wi.element.css({"left": l, width: w}); - first(wi, i, j); - } - if (!BI.isNumber(o.columnSize[j])) { - break; - } - } - //从右到左 - for (var j = o.columns - 1; j >= 0; j--) { - for (var i = 0; i < o.rows; i++) { - var wi = this.getWidgetByName(this.getName() + i + "_" + j); - if (BI.isNull(right[j])) { - right[j] = right[j + 1] + (o.columnSize[j + 1] < 1 ? o.columnSize[j + 1] : o.columnSize[j + 1] + o.hgap + o.lgap) - } - var r = right[j] <= 1 ? right[j] * 100 + "%" : right[j] + o.hgap + o.rgap + "px", w = ""; - if (BI.isNumber(o.columnSize[j])) { - w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] + "px"; - } - wi.element.css({"right": r, width: w}); - first(wi, i, j); - } - if (!BI.isNumber(o.columnSize[j])) { - break; - } - } - }, - - populate: function (items) { - BI.WindowLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.window', BI.WindowLayout);/** - * 水平和垂直方向都居中容器, 非自适应,用于宽度高度固定的面板 - * @class BI.CenterLayout - * @extends BI.Layout - */ -BI.CenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.CenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-center-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - render: function () { - BI.CenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("center布局不需要resize"); - }, - - addItem: function (item) { - //do nothing - throw new Error("cannot be added"); - }, - - stroke: function (items) { - var self = this, o = this.options; - var list = []; - BI.each(items, function (i) { - list.push({ - column: i, - row: 0, - el: BI.createWidget({ - type: "bi.default", - cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") - }) - }); - }); - BI.each(items, function (i, item) { - if (!!item) { - var w = BI.createWidget(item); - w.element.css({ - position: "absolute", - left: o.hgap + o.lgap, - right: o.hgap + o.rgap, - top: o.vgap + o.tgap, - bottom: o.vgap + o.bgap, - width: "auto", - height: "auto" - }); - list[i].el.addItem(w); - } - }); - BI.createWidget({ - type: "bi.grid", - element: this, - columns: list.length, - rows: 1, - items: list - }); - }, - - populate: function (items) { - BI.CenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.center', BI.CenterLayout);/** - * 浮动布局实现的居中容器 - * @class BI.FloatCenterLayout - * @extends BI.Layout - */ -BI.FloatCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-center-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FloatCenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("floatcenter布局不需要resize"); - }, - - addItem: function (item) { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var self = this, o = this.options; - var list = [], width = 100 / items.length; - BI.each(items, function (i) { - var widget = BI.createWidget({ - type: "bi.default" - }); - widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({ - width: width + "%", - height: "100%" - }); - list.push({ - el: widget - }); - }); - BI.each(items, function (i, item) { - if (!!item) { - var w = BI.createWidget(item); - w.element.css({ - position: "absolute", - left: o.hgap + o.lgap, - right: o.hgap + o.rgap, - top: o.vgap + o.tgap, - bottom: o.vgap + o.bgap, - width: "auto", - height: "auto" - }); - list[i].el.addItem(w); - } - }); - BI.createWidget({ - type: "bi.left", - element: this, - items: list - }); - }, - - populate: function (items) { - BI.FloatCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.float_center', BI.FloatCenterLayout);/** - * 水平和垂直方向都居中容器, 非自适应,用于宽度高度固定的面板 - * @class BI.HorizontalCenterLayout - * @extends BI.Layout - */ -BI.HorizontalCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HorizontalCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-horizontal-center-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.HorizontalCenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("horizontal_center布局不需要resize"); - }, - - addItem: function (item) { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - var list = []; - BI.each(items, function (i) { - list.push({ - column: i, - row: 0, - el: BI.createWidget({ - type: "bi.default", - cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") - }) - }); - }); - BI.each(items, function (i, item) { - if (!!item) { - var w = BI.createWidget(item); - w.element.css({ - position: "absolute", - left: o.hgap + o.lgap, - right: o.hgap + o.rgap, - top: o.vgap + o.tgap, - bottom: o.vgap + o.bgap, - width: "auto" - }); - list[i].el.addItem(w); - } - }); - BI.createWidget({ - type: "bi.grid", - element: this, - columns: list.length, - rows: 1, - items: list - }); - }, - - populate: function (items) { - BI.HorizontalCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal_center', BI.HorizontalCenterLayout);/** - * 垂直方向都居中容器, 非自适应,用于高度不固定的面板 - * @class BI.VerticalCenterLayout - * @extends BI.Layout - */ -BI.VerticalCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.VerticalCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-vertical-center-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.VerticalCenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("vertical_center布局不需要resize"); - }, - - addItem: function (item) { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var self = this, o = this.options; - var list = []; - BI.each(items, function (i) { - list.push({ - column: 0, - row: i, - el: BI.createWidget({ - type: "bi.default", - cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") - }) - }); - }); - BI.each(items, function (i, item) { - if (!!item) { - var w = BI.createWidget(item); - w.element.css({ - position: "absolute", - left: o.hgap + o.lgap, - right: o.hgap + o.rgap, - top: o.vgap + o.tgap, - bottom: o.vgap + o.bgap, - height: "auto" - }); - list[i].el.addItem(w); - } - }); - BI.createWidget({ - type: "bi.grid", - element: this, - columns: 1, - rows: list.length, - items: list - }); - }, - - populate: function (items) { - BI.VerticalCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.vertical_center', BI.VerticalCenterLayout);/** - * 保存数据,将js里面用到的常量数据都分离 - * - */ -BI.Data = Data = {}; - -/** - * 存放bi里面通用的一些常量 - * @type {{}} - */ -Data.Constant = BI.Constant = BICst = {}; -/** - * 缓冲池 - * @type {{Buffer: {}}} - */ -; -(function () { - var Buffer = {}; - var MODE = false;//设置缓存模式为关闭 - - Data.BufferPool = { - put: function (name, cache) { - if (BI.isNotNull(Buffer[name])) { - throw new Error("Buffer Pool has the key already!"); - } - Buffer[name] = cache; - }, - - get: function (name) { - return Buffer[name]; - }, - }; -})();/** - * 共享池 - * @type {{Shared: {}}} - */ -; -(function () { - var _Shared = {}; - Data.SharingPool = { - _Shared: _Shared, - put: function (name, shared) { - _Shared[name] = shared; - }, - - cat: function () { - var args = Array.prototype.slice.call(arguments, 0), - copy = _Shared; - for (var i = 0; i < args.length; i++) { - copy = copy[args[i]]; - } - return copy; - }, - - get: function () { - return BI.deepClone(this.cat.apply(this, arguments)); - }, - - remove: function (key) { - delete _Shared[key]; - } - }; -})();Data.Req = { - -}; -Data.Source = BISource = { - -};//工程配置 -$(function () { - //注册布局 - var isSupportFlex = BI.isSupportCss3("flex"); - BI.Plugin.registerWidget("bi.horizontal", function (ob) { - if (isSupportFlex) { - return BI.extend(ob, {type: "bi.flex_horizontal"}); - } else { - return ob; - } - }); - BI.Plugin.registerWidget("bi.center_adapt", function (ob) { - if (isSupportFlex && ob.items && ob.items.length <= 1) { - //有滚动条的情况下需要用到flex_wrapper_center布局 - if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { - //不是IE用flex_wrapper_center布局 - if (!BI.isIE()) { - return BI.extend(ob, {type: "bi.flex_wrapper_center"}); - } - return ob; - } - return BI.extend(ob, {type: "bi.flex_center"}); - } else { - return ob; - } - }); - BI.Plugin.registerWidget("bi.vertical_adapt", function (ob) { - if (isSupportFlex) { - //有滚动条的情况下需要用到flex_wrapper_center布局 - if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { - //不是IE用flex_wrapper_center布局 - if (!BI.isIE()) { - return BI.extend({}, ob, {type: "bi.flex_wrapper_vertical_center"}); - } - return ob; - } - return BI.extend(ob, {type: "bi.flex_vertical_center"}); - } else { - return ob; - } - }); - BI.Plugin.registerWidget("bi.float_center_adapt", function (ob) { - if (isSupportFlex) { - //有滚动条的情况下需要用到flex_wrapper_center布局 - if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { - //不是IE用flex_wrapper_center布局 - if (!BI.isIE()) { - return BI.extend({}, ob, {type: "bi.flex_wrapper_center"}); - } - return ob; - } - return BI.extend(ob, {type: "bi.flex_center"}); - } else { - return ob; - } - }); - //注册滚动条 - BI.Plugin.registerWidget("bi.grid_table_scrollbar", function (ob) { - if (BI.isIE9Below()) { - return BI.extend(ob, {type: "bi.native_table_scrollbar"}); - } else { - return ob; - } - }); - BI.Plugin.registerWidget("bi.grid_table_horizontal_scrollbar", function (ob) { - if (BI.isIE9Below()) { - return BI.extend(ob, {type: "bi.native_table_horizontal_scrollbar"}); - } else { - return ob; - } - }); - - //注册控件 - BI.Plugin.registerWidget("bi.grid_table", function (ob) { - //非chrome下滚动条滑动效果不好,禁止掉 - if (!(BI.isChrome() && BI.isWindows() && !BI.isEdge())) { - return BI.extend(ob, {type: "bi.quick_grid_table"}); - } else { - return ob; - } - }); - BI.Plugin.registerWidget("bi.collection_table", function (ob) { - //非chrome下滚动条滑动效果不好,禁止掉 - if (!(BI.isChrome() && BI.isWindows() && !BI.isEdge())) { - return BI.extend(ob, {type: "bi.quick_collection_table"}); - } else { - return ob; - } - }); - //IE8下滚动条用原生的 - if (BI.isIE9Below()) { - BI.GridTableScrollbar.SIZE = 18; - } -======= -/*! - * jQuery JavaScript Library v1.9.1 - * http://jquery.com/ - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * - * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors - * Released under the MIT license - * http://jquery.org/license - * - * Date: 2013-2-4 - */ -(function( window, undefined ) { - -// Can't do this because several apps including ASP.NET trace -// the stack via arguments.caller.callee and Firefox dies if -// you try to trace through "use strict" call chains. (#13335) -// Support: Firefox 18+ -//"use strict"; -var - // The deferred used on DOM ready - readyList, - - // A central reference to the root jQuery(document) - rootjQuery, - - // Support: IE<9 - // For `typeof node.method` instead of `node.method !== undefined` - core_strundefined = typeof undefined, - - // Use the correct document accordingly with window argument (sandbox) - document = window.document, - location = window.location, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // [[Class]] -> type pairs - class2type = {}, - - // List of deleted data cache ids, so we can reuse them - core_deletedIds = [], - - core_version = "1.9.1", - - // Save a reference to some core methods - core_concat = core_deletedIds.concat, - core_push = core_deletedIds.push, - core_slice = core_deletedIds.slice, - core_indexOf = core_deletedIds.indexOf, - core_toString = class2type.toString, - core_hasOwn = class2type.hasOwnProperty, - core_trim = core_version.trim, - - // Define a local copy of jQuery - jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Used for matching numbers - core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, - - // Used for splitting on whitespace - core_rnotwhite = /\S+/g, - - // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) - rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, - - // A simple way to check for HTML strings - // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) - // Strict HTML recognition (#11290: must start with <) - rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, - rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, - - // Matches dashed string for camelizing - rmsPrefix = /^-ms-/, - rdashAlpha = /-([\da-z])/gi, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return letter.toUpperCase(); - }, - - // The ready event handler - completed = function( event ) { - - // readyState === "complete" is good enough for us to call the dom ready in oldIE - if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { - detach(); - jQuery.ready(); - } - }, - // Clean-up method for dom ready events - detach = function() { - if ( document.addEventListener ) { - document.removeEventListener( "DOMContentLoaded", completed, false ); - window.removeEventListener( "load", completed, false ); - - } else { - document.detachEvent( "onreadystatechange", completed ); - window.detachEvent( "onload", completed ); - } - }; - -jQuery.fn = jQuery.prototype = { - // The current version of jQuery being used - jquery: core_version, - - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem; - - // HANDLE: $(""), $(null), $(undefined), $(false) - if ( !selector ) { - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = rquickExpr.exec( selector ); - } - - // Match html or make sure no context is specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - - // scripts is true for back-compat - jQuery.merge( this, jQuery.parseHTML( - match[1], - context && context.nodeType ? context.ownerDocument || context : document, - true - ) ); - - // HANDLE: $(html, props) - if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { - for ( match in context ) { - // Properties of context are called as methods if possible - if ( jQuery.isFunction( this[ match ] ) ) { - this[ match ]( context[ match ] ); - - // ...and otherwise set as attributes - } else { - this.attr( match, context[ match ] ); - } - } - } - - return this; - - // HANDLE: $(#id) - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(DOMElement) - } else if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return core_slice.call( this ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems ) { - - // Build a new jQuery matched element set - var ret = jQuery.merge( this.constructor(), elems ); - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - ret.context = this.context; - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Add the callback - jQuery.ready.promise().done( fn ); - - return this; - }, - - slice: function() { - return this.pushStack( core_slice.apply( this, arguments ) ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - eq: function( i ) { - var len = this.length, - j = +i + ( i < 0 ? len : 0 ); - return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: core_push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var src, copyIsArray, copy, name, options, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - - // Abort if there are pending holds or we're already ready - if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { - return; - } - - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.resolveWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger("ready").off("ready"); - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - isWindow: function( obj ) { - return obj != null && obj == obj.window; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - if ( obj == null ) { - return String( obj ); - } - return typeof obj === "object" || typeof obj === "function" ? - class2type[ core_toString.call(obj) ] || "object" : - typeof obj; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !core_hasOwn.call(obj, "constructor") && - !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || core_hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - var name; - for ( name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - // data: string of html - // context (optional): If specified, the fragment will be created in this context, defaults to document - // keepScripts (optional): If true, will include scripts passed in the html string - parseHTML: function( data, context, keepScripts ) { - if ( !data || typeof data !== "string" ) { - return null; - } - if ( typeof context === "boolean" ) { - keepScripts = context; - context = false; - } - context = context || document; - - var parsed = rsingleTag.exec( data ), - scripts = !keepScripts && []; - - // Single tag - if ( parsed ) { - return [ context.createElement( parsed[1] ) ]; - } - - parsed = jQuery.buildFragment( [ data ], context, scripts ); - if ( scripts ) { - jQuery( scripts ).remove(); - } - return jQuery.merge( [], parsed.childNodes ); - }, - - parseJSON: function( data ) { - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - if ( data === null ) { - return data; - } - - if ( typeof data === "string" ) { - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - if ( data ) { - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - } - } - } - - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - if ( !data || typeof data !== "string" ) { - return null; - } - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && jQuery.trim( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); - }, - - // args is for internal usage only - each: function( obj, callback, args ) { - var value, - i = 0, - length = obj.length, - isArray = isArraylike( obj ); - - if ( args ) { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.apply( obj[ i ], args ); - - if ( value === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } else { - for ( i in obj ) { - value = callback.call( obj[ i ], i, obj[ i ] ); - - if ( value === false ) { - break; - } - } - } - } - - return obj; - }, - - // Use native String.trim function wherever possible - trim: core_trim && !core_trim.call("\uFEFF\xA0") ? - function( text ) { - return text == null ? - "" : - core_trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - ( text + "" ).replace( rtrim, "" ); - }, - - // results is for internal usage only - makeArray: function( arr, results ) { - var ret = results || []; - - if ( arr != null ) { - if ( isArraylike( Object(arr) ) ) { - jQuery.merge( ret, - typeof arr === "string" ? - [ arr ] : arr - ); - } else { - core_push.call( ret, arr ); - } - } - - return ret; - }, - - inArray: function( elem, arr, i ) { - var len; - - if ( arr ) { - if ( core_indexOf ) { - return core_indexOf.call( arr, elem, i ); - } - - len = arr.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in arr && arr[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var l = second.length, - i = first.length, - j = 0; - - if ( typeof l === "number" ) { - for ( ; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var retVal, - ret = [], - i = 0, - length = elems.length; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( ; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, - i = 0, - length = elems.length, - isArray = isArraylike( elems ), - ret = []; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( i in elems ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return core_concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - var args, proxy, tmp; - - if ( typeof context === "string" ) { - tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - args = core_slice.call( arguments, 2 ); - proxy = function() { - return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || jQuery.guid++; - - return proxy; - }, - - // Multifunctional method to get and set values of a collection - // The value/s can optionally be executed if it's a function - access: function( elems, fn, key, value, chainable, emptyGet, raw ) { - var i = 0, - length = elems.length, - bulk = key == null; - - // Sets many values - if ( jQuery.type( key ) === "object" ) { - chainable = true; - for ( i in key ) { - jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); - } - - // Sets one value - } else if ( value !== undefined ) { - chainable = true; - - if ( !jQuery.isFunction( value ) ) { - raw = true; - } - - if ( bulk ) { - // Bulk operations run against the entire set - if ( raw ) { - fn.call( elems, value ); - fn = null; - - // ...except when executing function values - } else { - bulk = fn; - fn = function( elem, key, value ) { - return bulk.call( jQuery( elem ), value ); - }; - } - } - - if ( fn ) { - for ( ; i < length; i++ ) { - fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); - } - } - } - - return chainable ? - elems : - - // Gets - bulk ? - fn.call( elems ) : - length ? fn( elems[0], key ) : emptyGet; - }, - - now: function() { - return ( new Date() ).getTime(); - } -}); - -jQuery.ready.promise = function( obj ) { - if ( !readyList ) { - - readyList = jQuery.Deferred(); - - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // we once tried to use readyState "interactive" here, but it caused issues like the one - // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - setTimeout( jQuery.ready ); - - // Standards-based browsers support DOMContentLoaded - } else if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", completed, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", completed, false ); - - // If IE event model is used - } else { - // Ensure firing before onload, maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", completed ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", completed ); - - // If IE and not a frame - // continually check to see if the document is ready - var top = false; - - try { - top = window.frameElement == null && document.documentElement; - } catch(e) {} - - if ( top && top.doScroll ) { - (function doScrollCheck() { - if ( !jQuery.isReady ) { - - try { - // Use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - top.doScroll("left"); - } catch(e) { - return setTimeout( doScrollCheck, 50 ); - } - - // detach all dom ready events - detach(); - - // and execute any waiting functions - jQuery.ready(); - } - })(); - } - } - } - return readyList.promise( obj ); -}; - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -function isArraylike( obj ) { - var length = obj.length, - type = jQuery.type( obj ); - - if ( jQuery.isWindow( obj ) ) { - return false; - } - - if ( obj.nodeType === 1 && length ) { - return true; - } - - return type === "array" || type !== "function" && - ( length === 0 || - typeof length === "number" && length > 0 && ( length - 1 ) in obj ); -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); -// String to Object options format cache -var optionsCache = {}; - -// Convert String-formatted options into Object-formatted ones and store in cache -function createOptions( options ) { - var object = optionsCache[ options ] = {}; - jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { - object[ flag ] = true; - }); - return object; -} - -/* - * Create a callback list using the following parameters: - * - * options: an optional list of space-separated options that will change how - * the callback list behaves or a more traditional option object - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible options: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( options ) { - - // Convert options from String-formatted to Object-formatted if needed - // (we check in cache first) - options = typeof options === "string" ? - ( optionsCache[ options ] || createOptions( options ) ) : - jQuery.extend( {}, options ); - - var // Flag to know if list is currently firing - firing, - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list was already fired - fired, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // First callback to fire (used internally by add and fireWith) - firingStart, - // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = !options.once && [], - // Fire callbacks - fire = function( data ) { - memory = options.memory && data; - fired = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - firing = true; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { - memory = false; // To prevent further calls using add - break; - } - } - firing = false; - if ( list ) { - if ( stack ) { - if ( stack.length ) { - fire( stack.shift() ); - } - } else if ( memory ) { - list = []; - } else { - self.disable(); - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - // First, we save the current length - var start = list.length; - (function add( args ) { - jQuery.each( args, function( _, arg ) { - var type = jQuery.type( arg ); - if ( type === "function" ) { - if ( !options.unique || !self.has( arg ) ) { - list.push( arg ); - } - } else if ( arg && arg.length && type !== "string" ) { - // Inspect recursively - add( arg ); - } - }); - })( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away - } else if ( memory ) { - firingStart = start; - fire( memory ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - jQuery.each( arguments, function( _, arg ) { - var index; - while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { - list.splice( index, 1 ); - // Handle firing indexes - if ( firing ) { - if ( index <= firingLength ) { - firingLength--; - } - if ( index <= firingIndex ) { - firingIndex--; - } - } - } - }); - } - return this; - }, - // Check if a given callback is in the list. - // If no argument is given, return whether or not list has callbacks attached. - has: function( fn ) { - return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length ); - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - args = args || []; - args = [ context, args.slice ? args.slice() : args ]; - if ( list && ( !fired || stack ) ) { - if ( firing ) { - stack.push( args ); - } else { - fire( args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!fired; - } - }; - - return self; -}; -jQuery.extend({ - - Deferred: function( func ) { - var tuples = [ - // action, add listener, listener list, final state - [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], - [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], - [ "notify", "progress", jQuery.Callbacks("memory") ] - ], - state = "pending", - promise = { - state: function() { - return state; - }, - always: function() { - deferred.done( arguments ).fail( arguments ); - return this; - }, - then: function( /* fnDone, fnFail, fnProgress */ ) { - var fns = arguments; - return jQuery.Deferred(function( newDefer ) { - jQuery.each( tuples, function( i, tuple ) { - var action = tuple[ 0 ], - fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; - // deferred[ done | fail | progress ] for forwarding actions to newDefer - deferred[ tuple[1] ](function() { - var returned = fn && fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise() - .done( newDefer.resolve ) - .fail( newDefer.reject ) - .progress( newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); - } - }); - }); - fns = null; - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - return obj != null ? jQuery.extend( obj, promise ) : promise; - } - }, - deferred = {}; - - // Keep pipe for back-compat - promise.pipe = promise.then; - - // Add list-specific methods - jQuery.each( tuples, function( i, tuple ) { - var list = tuple[ 2 ], - stateString = tuple[ 3 ]; - - // promise[ done | fail | progress ] = list.add - promise[ tuple[1] ] = list.add; - - // Handle state - if ( stateString ) { - list.add(function() { - // state = [ resolved | rejected ] - state = stateString; - - // [ reject_list | resolve_list ].disable; progress_list.lock - }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); - } - - // deferred[ resolve | reject | notify ] - deferred[ tuple[0] ] = function() { - deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments ); - return this; - }; - deferred[ tuple[0] + "With" ] = list.fireWith; - }); - - // Make the deferred a promise - promise.promise( deferred ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( subordinate /* , ..., subordinateN */ ) { - var i = 0, - resolveValues = core_slice.call( arguments ), - length = resolveValues.length, - - // the count of uncompleted subordinates - remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, - - // the master Deferred. If resolveValues consist of only a single Deferred, just use that. - deferred = remaining === 1 ? subordinate : jQuery.Deferred(), - - // Update function for both resolve and progress values - updateFunc = function( i, contexts, values ) { - return function( value ) { - contexts[ i ] = this; - values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; - if( values === progressValues ) { - deferred.notifyWith( contexts, values ); - } else if ( !( --remaining ) ) { - deferred.resolveWith( contexts, values ); - } - }; - }, - - progressValues, progressContexts, resolveContexts; - - // add listeners to Deferred subordinates; treat others as resolved - if ( length > 1 ) { - progressValues = new Array( length ); - progressContexts = new Array( length ); - resolveContexts = new Array( length ); - for ( ; i < length; i++ ) { - if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { - resolveValues[ i ].promise() - .done( updateFunc( i, resolveContexts, resolveValues ) ) - .fail( deferred.reject ) - .progress( updateFunc( i, progressContexts, progressValues ) ); - } else { - --remaining; - } - } - } - - // if we're not waiting on anything, resolve the master - if ( !remaining ) { - deferred.resolveWith( resolveContexts, resolveValues ); - } - - return deferred.promise(); - } -}); -jQuery.support = (function() { - - var support, all, a, - input, select, fragment, - opt, eventName, isSupported, i, - div = document.createElement("div"); - - // Setup - div.setAttribute( "className", "t" ); - div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; - - // Support tests won't run in some limited or non-browser environments - all = div.getElementsByTagName("*"); - a = div.getElementsByTagName("a")[ 0 ]; - if ( !all || !a || !all.length ) { - return {}; - } - - // First batch of tests - select = document.createElement("select"); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName("input")[ 0 ]; - - a.style.cssText = "top:1px;float:left;opacity:.5"; - support = { - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: div.firstChild.nodeType === 3, - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: a.getAttribute("href") === "/a", - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.5/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) - checkOn: !!input.value, - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Tests for enctype support on a form (#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", - - // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode - boxModel: document.compatMode === "CSS1Compat", - - // Will be defined later - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true, - boxSizingReliable: true, - pixelPosition: false - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Support: IE<9 - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - // Check if we can trust getAttribute("value") - input = document.createElement("input"); - input.setAttribute( "value", "" ); - support.input = input.getAttribute( "value" ) === ""; - - // Check if an input maintains its value after becoming a radio - input.value = "t"; - input.setAttribute( "type", "radio" ); - support.radioValue = input.value === "t"; - - // #11217 - WebKit loses check when the name is after the checked attribute - input.setAttribute( "checked", "t" ); - input.setAttribute( "name", "t" ); - - fragment = document.createDocumentFragment(); - fragment.appendChild( input ); - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Support: IE<9 - // Opera does not clone events (and typeof div.attachEvent === undefined). - // IE9-10 clones events bound via attachEvent, but they don't trigger with .click() - if ( div.attachEvent ) { - div.attachEvent( "onclick", function() { - support.noCloneEvent = false; - }); - - div.cloneNode( true ).click(); - } - - // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event) - // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php - for ( i in { submit: true, change: true, focusin: true }) { - div.setAttribute( eventName = "on" + i, "t" ); - - support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false; - } - - div.style.backgroundClip = "content-box"; - div.cloneNode( true ).style.backgroundClip = ""; - support.clearCloneStyle = div.style.backgroundClip === "content-box"; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, marginDiv, tds, - divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - container = document.createElement("div"); - container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px"; - - body.appendChild( container ).appendChild( div ); - - // Support: IE8 - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; - tds = div.getElementsByTagName("td"); - tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Support: IE8 - // Check if empty table cells still have offsetWidth/Height - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Check box-sizing and margin behavior - div.innerHTML = ""; - div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; - support.boxSizing = ( div.offsetWidth === 4 ); - support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); - - // Use window.getComputedStyle because jsdom on node.js will break without it. - if ( window.getComputedStyle ) { - support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; - support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. (#3333) - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - marginDiv = div.appendChild( document.createElement("div") ); - marginDiv.style.cssText = div.style.cssText = divReset; - marginDiv.style.marginRight = marginDiv.style.width = "0"; - div.style.width = "1px"; - - support.reliableMarginRight = - !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); - } - - if ( typeof div.style.zoom !== core_strundefined ) { - // Support: IE<8 - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - div.innerHTML = ""; - div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); - - // Support: IE6 - // Check if elements with layout shrink-wrap their children - div.style.display = "block"; - div.innerHTML = "<div></div>"; - div.firstChild.style.width = "5px"; - support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); - - if ( support.inlineBlockNeedsLayout ) { - // Prevent IE 6 from affecting layout for positioned elements #11048 - // Prevent IE from shrinking the body in IE 7 mode #12869 - // Support: IE<8 - body.style.zoom = 1; - } - } - - body.removeChild( container ); - - // Null elements to avoid leaks in IE - container = div = tds = marginDiv = null; - }); - - // Null elements to avoid leaks in IE - all = select = fragment = opt = a = input = null; - - return support; -})(); - -var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, - rmultiDash = /([A-Z])/g; - -function internalData( elem, name, data, pvt /* Internal Use Only */ ){ - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; -} - -function internalRemoveData( elem, name, pvt ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var i, l, thisCache, - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - id = isNode ? elem[ jQuery.expando ] : jQuery.expando; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split(" "); - } - } - } else { - // If "name" is an array of keys... - // When data is initially created, via ("key", "val") signature, - // keys will be converted to camelCase. - // Since there is no way to tell _how_ a key was added, remove - // both plain key and camelCase key. #12786 - // This will only penalize the array argument path. - name = name.concat( jQuery.map( name, jQuery.camelCase ) ); - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject( cache[ id ] ) ) { - return; - } - } - - // Destroy the cache - if ( isNode ) { - jQuery.cleanData( [ elem ], true ); - - // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) - } else if ( jQuery.support.deleteExpando || cache != cache.window ) { - delete cache[ id ]; - - // When all else fails, null - } else { - cache[ id ] = null; - } -} - -jQuery.extend({ - cache: {}, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data ) { - return internalData( elem, name, data ); - }, - - removeData: function( elem, name ) { - return internalRemoveData( elem, name ); - }, - - // For internal use only. - _data: function( elem, name, data ) { - return internalData( elem, name, data, true ); - }, - - _removeData: function( elem, name ) { - return internalRemoveData( elem, name, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - // Do not set data on non-element because it will not be cleared (#8335). - if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) { - return false; - } - - var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; - - // nodes accept data unless otherwise specified; rejection can be conditional - return !noData || noData !== true && elem.getAttribute("classid") === noData; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var attrs, name, - elem = this[0], - i = 0, - data = null; - - // Gets all values - if ( key === undefined ) { - if ( this.length ) { - data = jQuery.data( elem ); - - if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { - attrs = elem.attributes; - for ( ; i < attrs.length; i++ ) { - name = attrs[i].name; - - if ( !name.indexOf( "data-" ) ) { - name = jQuery.camelCase( name.slice(5) ); - - dataAttr( elem, name, data[ name ] ); - } - } - jQuery._data( elem, "parsedAttrs", true ); - } - } - - return data; - } - - // Sets multiple values - if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - return jQuery.access( this, function( value ) { - - if ( value === undefined ) { - // Try to fetch any internally stored data first - return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; - } - - this.each(function() { - jQuery.data( this, key, value ); - }); - }, null, value, arguments.length > 1, null, true ); - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - // Only convert to a number if it doesn't change the string - +data + "" === data ? +data : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - var name; - for ( name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} -jQuery.extend({ - queue: function( elem, type, data ) { - var queue; - - if ( elem ) { - type = ( type || "fx" ) + "queue"; - queue = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !queue || jQuery.isArray(data) ) { - queue = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - queue.push( data ); - } - } - return queue || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - startLength = queue.length, - fn = queue.shift(), - hooks = jQuery._queueHooks( elem, type ), - next = function() { - jQuery.dequeue( elem, type ); - }; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - startLength--; - } - - hooks.cur = fn; - if ( fn ) { - - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - // clear up the last queue stop function - delete hooks.stop; - fn.call( elem, next, hooks ); - } - - if ( !startLength && hooks ) { - hooks.empty.fire(); - } - }, - - // not intended for public consumption - generates a queueHooks object, or returns the current one - _queueHooks: function( elem, type ) { - var key = type + "queueHooks"; - return jQuery._data( elem, key ) || jQuery._data( elem, key, { - empty: jQuery.Callbacks("once memory").add(function() { - jQuery._removeData( elem, type + "queue" ); - jQuery._removeData( elem, key ); - }) - }); - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - var setter = 2; - - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - setter--; - } - - if ( arguments.length < setter ) { - return jQuery.queue( this[0], type ); - } - - return data === undefined ? - this : - this.each(function() { - var queue = jQuery.queue( this, type, data ); - - // ensure a hooks for this queue - jQuery._queueHooks( this, type ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, obj ) { - var tmp, - count = 1, - defer = jQuery.Deferred(), - elements = this, - i = this.length, - resolve = function() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - }; - - if ( typeof type !== "string" ) { - obj = type; - type = undefined; - } - type = type || "fx"; - - while( i-- ) { - tmp = jQuery._data( elements[ i ], type + "queueHooks" ); - if ( tmp && tmp.empty ) { - count++; - tmp.empty.add( resolve ); - } - } - resolve(); - return defer.promise( obj ); - } -}); -var nodeHook, boolHook, - rclass = /[\t\r\n]/g, - rreturn = /\r/g, - rfocusable = /^(?:input|select|textarea|button|object)$/i, - rclickable = /^(?:a|area)$/i, - rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, - ruseDefault = /^(?:checked|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - getSetInput = jQuery.support.input; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call( this, j, this.className ) ); - }); - } - - if ( proceed ) { - // The disjunction here is for better compressibility (see removeClass) - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - " " - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - if ( cur.indexOf( " " + clazz + " " ) < 0 ) { - cur += clazz + " "; - } - } - elem.className = jQuery.trim( cur ); - - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classes, elem, cur, clazz, j, - i = 0, - len = this.length, - proceed = arguments.length === 0 || typeof value === "string" && value; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call( this, j, this.className ) ); - }); - } - if ( proceed ) { - classes = ( value || "" ).match( core_rnotwhite ) || []; - - for ( ; i < len; i++ ) { - elem = this[ i ]; - // This expression is here for better compressibility (see addClass) - cur = elem.nodeType === 1 && ( elem.className ? - ( " " + elem.className + " " ).replace( rclass, " " ) : - "" - ); - - if ( cur ) { - j = 0; - while ( (clazz = classes[j++]) ) { - // Remove *all* instances - while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { - cur = cur.replace( " " + clazz + " ", " " ); - } - } - elem.className = value ? jQuery.trim( cur ) : ""; - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.match( core_rnotwhite ) || []; - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space separated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - // Toggle whole class name - } else if ( type === core_strundefined || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // If the element has a class name or if we're passed "false", - // then remove the whole classname (if there was one, the above saved it). - // Otherwise bring back whatever was previously saved (if anything), - // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var ret, hooks, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var val, - self = jQuery(this); - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, option, - options = elem.options, - index = elem.selectedIndex, - one = elem.type === "select-one" || index < 0, - values = one ? null : [], - max = one ? index + 1 : options.length, - i = index < 0 ? - max : - one ? index : 0; - - // Loop through all the selected options - for ( ; i < max; i++ ) { - option = options[ i ]; - - // oldIE doesn't update selected after form reset (#2551) - if ( ( option.selected || i === index ) && - // Don't return options that are disabled or in a disabled optgroup - ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attr: function( elem, name, value ) { - var hooks, notxml, ret, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === core_strundefined ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - - } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, value + "" ); - return value; - } - - } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - // In IE9+, Flash objects don't have .getAttribute (#12945) - // Support: IE9+ - if ( typeof elem.getAttribute !== core_strundefined ) { - ret = elem.getAttribute( name ); - } - - // Non-existent attributes return null, we normalize to undefined - return ret == null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var name, propName, - i = 0, - attrNames = value && value.match( core_rnotwhite ); - - if ( attrNames && elem.nodeType === 1 ) { - while ( (name = attrNames[i++]) ) { - propName = jQuery.propFix[ name ] || name; - - // Boolean attributes get special treatment (#10870) - if ( rboolean.test( name ) ) { - // Set corresponding property to false for boolean attributes - // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 - if ( !getSetAttribute && ruseDefault.test( name ) ) { - elem[ jQuery.camelCase( "default-" + name ) ] = - elem[ propName ] = false; - } else { - elem[ propName ] = false; - } - - // See #9699 for explanation of this approach (setting first, then removal) - } else { - jQuery.attr( elem, name, "" ); - } - - elem.removeAttribute( getSetAttribute ? name : propName ); - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to default in case type is set after value during creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - var - // Use .prop to determine if this attribute is understood as boolean - prop = jQuery.prop( elem, name ), - - // Fetch it accordingly - attr = typeof prop === "boolean" && elem.getAttribute( name ), - detail = typeof prop === "boolean" ? - - getSetInput && getSetAttribute ? - attr != null : - // oldIE fabricates an empty string for missing boolean attributes - // and conflates checked/selected into attroperties - ruseDefault.test( name ) ? - elem[ jQuery.camelCase( "default-" + name ) ] : - !!attr : - - // fetch an attribute node for properties not recognized as boolean - elem.getAttributeNode( name ); - - return detail && detail.value !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { - // IE<8 needs the *property* name - elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); - - // Use defaultChecked and defaultSelected for oldIE - } else { - elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; - } - - return name; - } -}; - -// fix oldIE value attroperty -if ( !getSetInput || !getSetAttribute ) { - jQuery.attrHooks.value = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return jQuery.nodeName( elem, "input" ) ? - - // Ignore the value *property* by using defaultValue - elem.defaultValue : - - ret && ret.specified ? ret.value : undefined; - }, - set: function( elem, value, name ) { - if ( jQuery.nodeName( elem, "input" ) ) { - // Does not return so that setAttribute is also used - elem.defaultValue = value; - } else { - // Use nodeHook if defined (#1954); otherwise setAttribute is fine - return nodeHook && nodeHook.set( elem, value, name ); - } - } - }; -} - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret = elem.getAttributeNode( name ); - return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? - ret.value : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - elem.setAttributeNode( - (ret = elem.ownerDocument.createAttribute( name )) - ); - } - - ret.value = value += ""; - - // Break association with cloned elements by also using setAttribute (#9646) - return name === "value" || value === elem.getAttribute( name ) ? - value : - undefined; - } - }; - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - nodeHook.set( elem, value === "" ? false : value, name ); - } - }; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); -} - - -// Some attributes require a special call on IE -// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret == null ? undefined : ret; - } - }); - }); - - // href/src property should get the full normalized URL (#10299/#12915) - jQuery.each([ "href", "src" ], function( i, name ) { - jQuery.propHooks[ name ] = { - get: function( elem ) { - return elem.getAttribute( name, 4 ); - } - }; - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Note: IE uppercases css property names, but if we were to .toLowerCase() - // .cssText, that would destroy case senstitivity in URL's, like in "background" - return elem.style.cssText || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = value + "" ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); -var rformElems = /^(?:input|select|textarea)$/i, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; - -function returnTrue() { - return true; -} - -function returnFalse() { - return false; -} - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - global: {}, - - add: function( elem, types, handler, data, selector ) { - var tmp, events, t, handleObjIn, - special, eventHandle, handleObj, - handlers, type, namespaces, origType, - elemData = jQuery._data( elem ); - - // Don't attach events to noData or text/comment nodes (but allow plain objects) - if ( !elemData ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - selector = handleObjIn.selector; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - if ( !(events = elemData.events) ) { - events = elemData.events = {}; - } - if ( !(eventHandle = elemData.handle) ) { - eventHandle = elemData.handle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== core_strundefined && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: origType, - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - needsContext: selector && jQuery.expr.match.needsContext.test( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - if ( !(handlers = events[ type ]) ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - var j, handleObj, tmp, - origCount, t, events, - special, handlers, type, - namespaces, origType, - elemData = jQuery.hasData( elem ) && jQuery._data( elem ); - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = ( types || "" ).match( core_rnotwhite ) || [""]; - t = types.length; - while ( t-- ) { - tmp = rtypenamespace.exec( types[t] ) || []; - type = origType = tmp[1]; - namespaces = ( tmp[2] || "" ).split( "." ).sort(); - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector ? special.delegateType : special.bindType ) || type; - handlers = events[ type ] || []; - tmp = tmp[2] && new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ); - - // Remove matching events - origCount = j = handlers.length; - while ( j-- ) { - handleObj = handlers[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !tmp || tmp.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - handlers.splice( j, 1 ); - - if ( handleObj.selector ) { - handlers.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( origCount && !handlers.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - delete elemData.handle; - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery._removeData( elem, "events" ); - } - }, - - trigger: function( event, data, elem, onlyHandlers ) { - var handle, ontype, cur, - bubbleType, special, tmp, i, - eventPath = [ elem || document ], - type = core_hasOwn.call( event, "type" ) ? event.type : event, - namespaces = core_hasOwn.call( event, "namespace" ) ? event.namespace.split(".") : []; - - cur = tmp = elem = elem || document; - - // Don't do events on text and comment nodes - if ( elem.nodeType === 3 || elem.nodeType === 8 ) { - return; - } - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf(".") >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - ontype = type.indexOf(":") < 0 && "on" + type; - - // Caller can pass in a jQuery.Event object, Object, or just an event type string - event = event[ jQuery.expando ] ? - event : - new jQuery.Event( type, typeof event === "object" && event ); - - event.isTrigger = true; - event.namespace = namespaces.join("."); - event.namespace_re = event.namespace ? - new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : - null; - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data == null ? - [ event ] : - jQuery.makeArray( data, [ event ] ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - if ( !rfocusMorph.test( bubbleType + type ) ) { - cur = cur.parentNode; - } - for ( ; cur; cur = cur.parentNode ) { - eventPath.push( cur ); - tmp = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( tmp === (elem.ownerDocument || document) ) { - eventPath.push( tmp.defaultView || tmp.parentWindow || window ); - } - } - - // Fire handlers on the event path - i = 0; - while ( (cur = eventPath[i++]) && !event.isPropagationStopped() ) { - - event.type = i > 1 ? - bubbleType : - special.bindType || type; - - // jQuery handler - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - - // Native handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - tmp = elem[ ontype ]; - - if ( tmp ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - try { - elem[ type ](); - } catch ( e ) { - // IE<9 dies on focus/blur to hidden element (#1486,#12518) - // only reproducible on winXP IE8 native, not IE9 in IE8 mode - } - jQuery.event.triggered = undefined; - - if ( tmp ) { - elem[ ontype ] = tmp; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event ); - - var i, ret, handleObj, matched, j, - handlerQueue = [], - args = core_slice.call( arguments ), - handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], - special = jQuery.event.special[ event.type ] || {}; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Call the preDispatch hook for the mapped type, and let it bail if desired - if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { - return; - } - - // Determine handlers - handlerQueue = jQuery.event.handlers.call( this, event, handlers ); - - // Run delegates first; they may want to stop propagation beneath us - i = 0; - while ( (matched = handlerQueue[ i++ ]) && !event.isPropagationStopped() ) { - event.currentTarget = matched.elem; - - j = 0; - while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { - - // Triggered event must either 1) have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { - - event.handleObj = handleObj; - event.data = handleObj.data; - - var obj = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ); - if(obj.apply){ - ret = obj.apply( matched.elem, args ); - } - - if ( ret !== undefined ) { - if ( (event.result = ret) === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - // Call the postDispatch hook for the mapped type - if ( special.postDispatch ) { - special.postDispatch.call( this, event ); - } - - return event.result; - }, - - handlers: function( event, handlers ) { - var sel, handleObj, matches, i, - handlerQueue = [], - delegateCount = handlers.delegateCount, - cur = event.target; - - // Find delegate handlers - // Black-hole SVG <use> instance trees (#13180) - // Avoid non-left-click bubbling in Firefox (#3861) - if ( delegateCount && cur.nodeType && (!event.button || event.type !== "click") ) { - - for ( ; cur != this; cur = cur.parentNode || this ) { - - // Don't check non-elements (#13208) - // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) - if ( cur.nodeType === 1 && (cur.disabled !== true || event.type !== "click") ) { - matches = []; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - - // Don't conflict with Object.prototype properties (#13203) - sel = handleObj.selector + " "; - - if ( matches[ sel ] === undefined ) { - matches[ sel ] = handleObj.needsContext ? - jQuery( sel, this ).index( cur ) >= 0 : - jQuery.find( sel, this, null, [ cur ] ).length; - } - if ( matches[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, handlers: matches }); - } - } - } - } - - // Add the remaining (directly-bound) handlers - if ( delegateCount < handlers.length ) { - handlerQueue.push({ elem: this, handlers: handlers.slice( delegateCount ) }); - } - - return handlerQueue; - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, copy, - type = event.type, - originalEvent = event, - fixHook = this.fixHooks[ type ]; - - if ( !fixHook ) { - this.fixHooks[ type ] = fixHook = - rmouseEvent.test( type ) ? this.mouseHooks : - rkeyEvent.test( type ) ? this.keyHooks : - {}; - } - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = new jQuery.Event( originalEvent ); - - i = copy.length; - while ( i-- ) { - prop = copy[ i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Support: IE<9 - // Fix target property (#1925) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Support: Chrome 23+, Safari? - // Target should not be a text node (#504, #13143) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // Support: IE<9 - // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) - event.metaKey = !!event.metaKey; - - return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var body, eventDoc, doc, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - special: { - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - click: { - // For checkbox, fire native event so checked state will be right - trigger: function() { - if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { - this.click(); - return false; - } - } - }, - focus: { - // Fire native event if possible so blur/focus sequence is correct - trigger: function() { - if ( this !== document.activeElement && this.focus ) { - try { - this.focus(); - return false; - } catch ( e ) { - // Support: IE<9 - // If we error on focus to hidden element (#1486, #12518), - // let .trigger() run the handlers - } - } - }, - delegateType: "focusin" - }, - blur: { - trigger: function() { - if ( this === document.activeElement && this.blur ) { - this.blur(); - return false; - } - }, - delegateType: "focusout" - }, - - beforeunload: { - postDispatch: function( event ) { - - // Even when returnValue equals to undefined Firefox will still show alert - if ( event.result !== undefined ) { - event.originalEvent.returnValue = event.result; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - var name = "on" + type; - - if ( elem.detachEvent ) { - - // #8545, #7054, preventing memory leaks for custom events in IE6-8 - // detachEvent needed property on element, by name of that event, to properly expose it to GC - if ( typeof elem[ name ] === core_strundefined ) { - elem[ name ] = null; - } - - elem.detachEvent( name, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse, - - preventDefault: function() { - var e = this.originalEvent; - - this.isDefaultPrevented = returnTrue; - if ( !e ) { - return; - } - - // If preventDefault exists, run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // Support: IE - // Otherwise set the returnValue property of the original event to false - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - var e = this.originalEvent; - - this.isPropagationStopped = returnTrue; - if ( !e ) { - return; - } - // If stopPropagation exists, run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - - // Support: IE - // Set the cancelBubble property of the original event to true - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - } -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var ret, - target = this, - related = event.relatedTarget, - handleObj = event.handleObj; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !jQuery._data( form, "submitBubbles" ) ) { - jQuery.event.add( form, "submit._submit", function( event ) { - event._submit_bubble = true; - }); - jQuery._data( form, "submitBubbles", true ); - } - }); - // return undefined since we don't need an event listener - }, - - postDispatch: function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( event._submit_bubble ) { - delete event._submit_bubble; - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - } - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - } - // Allow triggered, simulated change events (#11500) - jQuery.event.simulate( "change", this, event, true ); - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "changeBubbles" ) ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - jQuery._data( elem, "changeBubbles", true ); - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return !rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var type, origFn; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = data || selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on( types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - var handleObj, type; - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - var elem = this[0]; - if ( elem ) { - return jQuery.event.trigger( type, data, elem, true ); - } - } -}); -/*! - * Sizzle CSS Selector Engine - * Copyright 2012 jQuery Foundation and other contributors - * Released under the MIT license - * http://sizzlejs.com/ - */ -(function( window, undefined ) { - -var i, - cachedruns, - Expr, - getText, - isXML, - compile, - hasDuplicate, - outermostContext, - - // Local document vars - setDocument, - document, - docElem, - documentIsXML, - rbuggyQSA, - rbuggyMatches, - matches, - contains, - sortOrder, - - // Instance-specific data - expando = "sizzle" + -(new Date()), - preferredDoc = window.document, - support = {}, - dirruns = 0, - done = 0, - classCache = createCache(), - tokenCache = createCache(), - compilerCache = createCache(), - - // General-purpose constants - strundefined = typeof undefined, - MAX_NEGATIVE = 1 << 31, - - // Array methods - arr = [], - pop = arr.pop, - push = arr.push, - slice = arr.slice, - // Use a stripped-down indexOf if we can't use a native one - indexOf = arr.indexOf || function( elem ) { - var i = 0, - len = this.length; - for ( ; i < len; i++ ) { - if ( this[i] === elem ) { - return i; - } - } - return -1; - }, - - - // Regular expressions - - // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace - whitespace = "[\\x20\\t\\r\\n\\f]", - // http://www.w3.org/TR/css3-syntax/#characters - characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", - - // Loosely modeled on CSS identifier characters - // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors - // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier - identifier = characterEncoding.replace( "w", "w#" ), - - // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors - operators = "([*^$|!~]?=)", - attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + - "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", - - // Prefer arguments quoted, - // then not containing pseudos/brackets, - // then attribute selectors/non-parenthetical expressions, - // then anything else - // These preferences are here to reduce the number of selectors - // needing tokenize in the PSEUDO preFilter - pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", - - // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter - rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), - - rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), - rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), - rpseudo = new RegExp( pseudos ), - ridentifier = new RegExp( "^" + identifier + "$" ), - - matchExpr = { - "ID": new RegExp( "^#(" + characterEncoding + ")" ), - "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), - "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), - "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), - "ATTR": new RegExp( "^" + attributes ), - "PSEUDO": new RegExp( "^" + pseudos ), - "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + - "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + - "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), - // For use in libraries implementing .is() - // We use this for POS matching in `select` - "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + - whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) - }, - - rsibling = /[\x20\t\r\n\f]*[+~]/, - - rnative = /^[^{]+\{\s*\[native code/, - - // Easily-parseable/retrievable ID or TAG or CLASS selectors - rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, - - rinputs = /^(?:input|select|textarea|button)$/i, - rheader = /^h\d$/i, - - rescape = /'|\\/g, - rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, - - // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters - runescape = /\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g, - funescape = function( _, escaped ) { - var high = "0x" + escaped - 0x10000; - // NaN means non-codepoint - return high !== high ? - escaped : - // BMP codepoint - high < 0 ? - String.fromCharCode( high + 0x10000 ) : - // Supplemental Plane codepoint (surrogate pair) - String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); - }; - -// Use a stripped-down slice if we can't use a native one -try { - slice.call( preferredDoc.documentElement.childNodes, 0 )[0].nodeType; -} catch ( e ) { - slice = function( i ) { - var elem, - results = []; - while ( (elem = this[i++]) ) { - results.push( elem ); - } - return results; - }; -} - -/** - * For feature detection - * @param {Function} fn The function to test for native support - */ -function isNative( fn ) { - return rnative.test( fn + "" ); -} - -/** - * Create key-value caches of limited size - * @returns {Function(string, Object)} Returns the Object data after storing it on itself with - * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) - * deleting the oldest entry - */ -function createCache() { - var cache, - keys = []; - - return (cache = function( key, value ) { - // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) - if ( keys.push( key += " " ) > Expr.cacheLength ) { - // Only keep the most recent entries - delete cache[ keys.shift() ]; - } - return (cache[ key ] = value); - }); -} - -/** - * Mark a function for special use by Sizzle - * @param {Function} fn The function to mark - */ -function markFunction( fn ) { - fn[ expando ] = true; - return fn; -} - -/** - * Support testing using an element - * @param {Function} fn Passed the created div and expects a boolean result - */ -function assert( fn ) { - var div = document.createElement("div"); - - try { - return fn( div ); - } catch (e) { - return false; - } finally { - // release memory in IE - div = null; - } -} - -function Sizzle( selector, context, results, seed ) { - var match, elem, m, nodeType, - // QSA vars - i, groups, old, nid, newContext, newSelector; - - if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { - setDocument( context ); - } - - context = context || document; - results = results || []; - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { - return []; - } - - if ( !documentIsXML && !seed ) { - - // Shortcuts - if ( (match = rquickExpr.exec( selector )) ) { - // Speed-up: Sizzle("#ID") - if ( (m = match[1]) ) { - if ( nodeType === 9 ) { - elem = context.getElementById( m ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE, Opera, and Webkit return items - // by name instead of ID - if ( elem.id === m ) { - results.push( elem ); - return results; - } - } else { - return results; - } - } else { - // Context is not a document - if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && - contains( context, elem ) && elem.id === m ) { - results.push( elem ); - return results; - } - } - - // Speed-up: Sizzle("TAG") - } else if ( match[2] ) { - push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); - return results; - - // Speed-up: Sizzle(".CLASS") - } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { - push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); - return results; - } - } - - // QSA path - if ( support.qsa && !rbuggyQSA.test(selector) ) { - old = true; - nid = expando; - newContext = context; - newSelector = nodeType === 9 && selector; - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - groups = tokenize( selector ); - - if ( (old = context.getAttribute("id")) ) { - nid = old.replace( rescape, "\\$&" ); - } else { - context.setAttribute( "id", nid ); - } - nid = "[id='" + nid + "'] "; - - i = groups.length; - while ( i-- ) { - groups[i] = nid + toSelector( groups[i] ); - } - newContext = rsibling.test( selector ) && context.parentNode || context; - newSelector = groups.join(","); - } - - if ( newSelector ) { - try { - push.apply( results, slice.call( newContext.querySelectorAll( - newSelector - ), 0 ) ); - return results; - } catch(qsaError) { - } finally { - if ( !old ) { - context.removeAttribute("id"); - } - } - } - } - } - - // All others - return select( selector.replace( rtrim, "$1" ), context, results, seed ); -} - -/** - * Detect xml - * @param {Element|Object} elem An element or a document - */ -isXML = Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = elem && (elem.ownerDocument || elem).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -/** - * Sets document-related variables once based on the current document - * @param {Element|Object} [doc] An element or document object to use to set the document - * @returns {Object} Returns the current document - */ -setDocument = Sizzle.setDocument = function( node ) { - var doc = node ? node.ownerDocument || node : preferredDoc; - - // If no document and documentElement is available, return - if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { - return document; - } - - // Set our document - document = doc; - docElem = doc.documentElement; - - // Support tests - documentIsXML = isXML( doc ); - - // Check if getElementsByTagName("*") returns only elements - support.tagNameNoComments = assert(function( div ) { - div.appendChild( doc.createComment("") ); - return !div.getElementsByTagName("*").length; - }); - - // Check if attributes should be retrieved by attribute nodes - support.attributes = assert(function( div ) { - div.innerHTML = "<select></select>"; - var type = typeof div.lastChild.getAttribute("multiple"); - // IE8 returns a string for some attributes even when not present - return type !== "boolean" && type !== "string"; - }); - - // Check if getElementsByClassName can be trusted - support.getByClassName = assert(function( div ) { - // Opera can't find a second classname (in 9.6) - div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; - if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { - return false; - } - - // Safari 3.2 caches class attributes and doesn't catch changes - div.lastChild.className = "e"; - return div.getElementsByClassName("e").length === 2; - }); - - // Check if getElementById returns elements by name - // Check if getElementsByName privileges form controls or returns elements by ID - support.getByName = assert(function( div ) { - // Inject content - div.id = expando + 0; - div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; - docElem.insertBefore( div, docElem.firstChild ); - - // Test - var pass = doc.getElementsByName && - // buggy browsers will return fewer than the correct 2 - doc.getElementsByName( expando ).length === 2 + - // buggy browsers will return more than the correct 0 - doc.getElementsByName( expando + 0 ).length; - support.getIdNotName = !doc.getElementById( expando ); - - // Cleanup - docElem.removeChild( div ); - - return pass; - }); - - // IE6/7 return modified attributes - Expr.attrHandle = assert(function( div ) { - div.innerHTML = "<a href='#'></a>"; - return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && - div.firstChild.getAttribute("href") === "#"; - }) ? - {} : - { - "href": function( elem ) { - return elem.getAttribute( "href", 2 ); - }, - "type": function( elem ) { - return elem.getAttribute("type"); - } - }; - - // ID find and filter - if ( support.getIdNotName ) { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && !documentIsXML ) { - var m = context.getElementById( id ); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - return elem.getAttribute("id") === attrId; - }; - }; - } else { - Expr.find["ID"] = function( id, context ) { - if ( typeof context.getElementById !== strundefined && !documentIsXML ) { - var m = context.getElementById( id ); - - return m ? - m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? - [m] : - undefined : - []; - } - }; - Expr.filter["ID"] = function( id ) { - var attrId = id.replace( runescape, funescape ); - return function( elem ) { - var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); - return node && node.value === attrId; - }; - }; - } - - // Tag - Expr.find["TAG"] = support.tagNameNoComments ? - function( tag, context ) { - if ( typeof context.getElementsByTagName !== strundefined ) { - return context.getElementsByTagName( tag ); - } - } : - function( tag, context ) { - var elem, - tmp = [], - i = 0, - results = context.getElementsByTagName( tag ); - - // Filter out possible comments - if ( tag === "*" ) { - while ( (elem = results[i++]) ) { - if ( elem.nodeType === 1 ) { - tmp.push( elem ); - } - } - - return tmp; - } - return results; - }; - - // Name - Expr.find["NAME"] = support.getByName && function( tag, context ) { - if ( typeof context.getElementsByName !== strundefined ) { - return context.getElementsByName( name ); - } - }; - - // Class - Expr.find["CLASS"] = support.getByClassName && function( className, context ) { - if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { - return context.getElementsByClassName( className ); - } - }; - - // QSA and matchesSelector support - - // matchesSelector(:active) reports false when true (IE9/Opera 11.5) - rbuggyMatches = []; - - // qSa(:focus) reports false when true (Chrome 21), - // no need to also add to buggyMatches since matches checks buggyQSA - // A support test would require too much code (would include document ready) - rbuggyQSA = [ ":focus" ]; - - if ( (support.qsa = isNative(doc.querySelectorAll)) ) { - // Build QSA regex - // Regex strategy adopted from Diego Perini - assert(function( div ) { - // Select is set to empty string on purpose - // This is to test IE's treatment of not explictly - // setting a boolean content attribute, - // since its presence should be enough - // http://bugs.jquery.com/ticket/12359 - div.innerHTML = "<select><option selected=''></option></select>"; - - // IE8 - Some boolean attributes are not treated correctly - if ( !div.querySelectorAll("[selected]").length ) { - rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); - } - - // Webkit/Opera - :checked should return selected option elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":checked").length ) { - rbuggyQSA.push(":checked"); - } - }); - - assert(function( div ) { - - // Opera 10-12/IE8 - ^= $= *= and empty values - // Should not select anything - div.innerHTML = "<input type='hidden' i=''/>"; - if ( div.querySelectorAll("[i^='']").length ) { - rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); - } - - // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) - // IE8 throws error here and will not see later tests - if ( !div.querySelectorAll(":enabled").length ) { - rbuggyQSA.push( ":enabled", ":disabled" ); - } - - // Opera 10-11 does not throw on post-comma invalid pseudos - div.querySelectorAll("*,:x"); - rbuggyQSA.push(",.*:"); - }); - } - - if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || - docElem.mozMatchesSelector || - docElem.webkitMatchesSelector || - docElem.oMatchesSelector || - docElem.msMatchesSelector) )) ) { - - assert(function( div ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9) - support.disconnectedMatch = matches.call( div, "div" ); - - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( div, "[s!='']:x" ); - rbuggyMatches.push( "!=", pseudos ); - }); - } - - rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); - rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); - - // Element contains another - // Purposefully does not implement inclusive descendent - // As in, an element does not contain itself - contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? - function( a, b ) { - var adown = a.nodeType === 9 ? a.documentElement : a, - bup = b && b.parentNode; - return a === bup || !!( bup && bup.nodeType === 1 && ( - adown.contains ? - adown.contains( bup ) : - a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 - )); - } : - function( a, b ) { - if ( b ) { - while ( (b = b.parentNode) ) { - if ( b === a ) { - return true; - } - } - } - return false; - }; - - // Document order sorting - sortOrder = docElem.compareDocumentPosition ? - function( a, b ) { - var compare; - - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { - if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { - if ( a === doc || contains( preferredDoc, a ) ) { - return -1; - } - if ( b === doc || contains( preferredDoc, b ) ) { - return 1; - } - return 0; - } - return compare & 4 ? -1 : 1; - } - - return a.compareDocumentPosition ? -1 : 1; - } : - function( a, b ) { - var cur, - i = 0, - aup = a.parentNode, - bup = b.parentNode, - ap = [ a ], - bp = [ b ]; - - // Exit early if the nodes are identical - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Parentless nodes are either documents or disconnected - } else if ( !aup || !bup ) { - return a === doc ? -1 : - b === doc ? 1 : - aup ? -1 : - bup ? 1 : - 0; - - // If the nodes are siblings, we can do a quick check - } else if ( aup === bup ) { - return siblingCheck( a, b ); - } - - // Otherwise we need full lists of their ancestors for comparison - cur = a; - while ( (cur = cur.parentNode) ) { - ap.unshift( cur ); - } - cur = b; - while ( (cur = cur.parentNode) ) { - bp.unshift( cur ); - } - - // Walk down the tree looking for a discrepancy - while ( ap[i] === bp[i] ) { - i++; - } - - return i ? - // Do a sibling check if the nodes have a common ancestor - siblingCheck( ap[i], bp[i] ) : - - // Otherwise nodes in our document sort first - ap[i] === preferredDoc ? -1 : - bp[i] === preferredDoc ? 1 : - 0; - }; - - // Always assume the presence of duplicates if sort doesn't - // pass them to our comparison function (as in Google Chrome). - hasDuplicate = false; - [0, 0].sort( sortOrder ); - support.detectDuplicates = hasDuplicate; - - return document; -}; - -Sizzle.matches = function( expr, elements ) { - return Sizzle( expr, null, null, elements ); -}; - -Sizzle.matchesSelector = function( elem, expr ) { - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - // Make sure that attribute selectors are quoted - expr = expr.replace( rattributeQuotes, "='$1']" ); - - // rbuggyQSA always contains :focus, so no need for an existence check - if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { - try { - var ret = matches.call( elem, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || support.disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9 - elem.document && elem.document.nodeType !== 11 ) { - return ret; - } - } catch(e) {} - } - - return Sizzle( expr, document, null, [elem] ).length > 0; -}; - -Sizzle.contains = function( context, elem ) { - // Set document vars if needed - if ( ( context.ownerDocument || context ) !== document ) { - setDocument( context ); - } - return contains( context, elem ); -}; - -Sizzle.attr = function( elem, name ) { - var val; - - // Set document vars if needed - if ( ( elem.ownerDocument || elem ) !== document ) { - setDocument( elem ); - } - - if ( !documentIsXML ) { - name = name.toLowerCase(); - } - if ( (val = Expr.attrHandle[ name ]) ) { - return val( elem ); - } - if ( documentIsXML || support.attributes ) { - return elem.getAttribute( name ); - } - return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? - name : - val && val.specified ? val.value : null; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -// Document sorting and removing duplicates -Sizzle.uniqueSort = function( results ) { - var elem, - duplicates = [], - i = 1, - j = 0; - - // Unless we *know* we can detect duplicates, assume their presence - hasDuplicate = !support.detectDuplicates; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( ; (elem = results[i]); i++ ) { - if ( elem === results[ i - 1 ] ) { - j = duplicates.push( i ); - } - } - while ( j-- ) { - results.splice( duplicates[ j ], 1 ); - } - } - - return results; -}; - -function siblingCheck( a, b ) { - var cur = b && a, - diff = cur && ( ~b.sourceIndex || MAX_NEGATIVE ) - ( ~a.sourceIndex || MAX_NEGATIVE ); - - // Use IE sourceIndex if available on both nodes - if ( diff ) { - return diff; - } - - // Check if b follows a - if ( cur ) { - while ( (cur = cur.nextSibling) ) { - if ( cur === b ) { - return -1; - } - } - } - - return a ? 1 : -1; -} - -// Returns a function to use in pseudos for input types -function createInputPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === type; - }; -} - -// Returns a function to use in pseudos for buttons -function createButtonPseudo( type ) { - return function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && elem.type === type; - }; -} - -// Returns a function to use in pseudos for positionals -function createPositionalPseudo( fn ) { - return markFunction(function( argument ) { - argument = +argument; - return markFunction(function( seed, matches ) { - var j, - matchIndexes = fn( [], seed.length, argument ), - i = matchIndexes.length; - - // Match elements found at the specified indexes - while ( i-- ) { - if ( seed[ (j = matchIndexes[i]) ] ) { - seed[j] = !(matches[j] = seed[j]); - } - } - }); - }); -} - -/** - * Utility function for retrieving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -getText = Sizzle.getText = function( elem ) { - var node, - ret = "", - i = 0, - nodeType = elem.nodeType; - - if ( !nodeType ) { - // If no nodeType, this is expected to be an array - for ( ; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - ret += getText( node ); - } - } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { - // Use textContent for elements - // innerText usage removed for consistency of new lines (see #11153) - if ( typeof elem.textContent === "string" ) { - return elem.textContent; - } else { - // Traverse its children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - // Do not include comment or processing instruction nodes - - return ret; -}; - -Expr = Sizzle.selectors = { - - // Can be adjusted by the user - cacheLength: 50, - - createPseudo: markFunction, - - match: matchExpr, - - find: {}, - - relative: { - ">": { dir: "parentNode", first: true }, - " ": { dir: "parentNode" }, - "+": { dir: "previousSibling", first: true }, - "~": { dir: "previousSibling" } - }, - - preFilter: { - "ATTR": function( match ) { - match[1] = match[1].replace( runescape, funescape ); - - // Move the given value to match[3] whether quoted or unquoted - match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape ); - - if ( match[2] === "~=" ) { - match[3] = " " + match[3] + " "; - } - - return match.slice( 0, 4 ); - }, - - "CHILD": function( match ) { - /* matches from matchExpr["CHILD"] - 1 type (only|nth|...) - 2 what (child|of-type) - 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) - 4 xn-component of xn+y argument ([+-]?\d*n|) - 5 sign of xn-component - 6 x of xn-component - 7 sign of y-component - 8 y of y-component - */ - match[1] = match[1].toLowerCase(); - - if ( match[1].slice( 0, 3 ) === "nth" ) { - // nth-* requires argument - if ( !match[3] ) { - Sizzle.error( match[0] ); - } - - // numeric x and y parameters for Expr.filter.CHILD - // remember that false/true cast respectively to 0/1 - match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); - match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); - - // other types prohibit arguments - } else if ( match[3] ) { - Sizzle.error( match[0] ); - } - - return match; - }, - - "PSEUDO": function( match ) { - var excess, - unquoted = !match[5] && match[2]; - - if ( matchExpr["CHILD"].test( match[0] ) ) { - return null; - } - - // Accept quoted arguments as-is - if ( match[4] ) { - match[2] = match[4]; - - // Strip excess characters from unquoted arguments - } else if ( unquoted && rpseudo.test( unquoted ) && - // Get excess from tokenize (recursively) - (excess = tokenize( unquoted, true )) && - // advance to the next closing parenthesis - (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { - - // excess is a negative index - match[0] = match[0].slice( 0, excess ); - match[2] = unquoted.slice( 0, excess ); - } - - // Return only captures needed by the pseudo filter method (type and argument) - return match.slice( 0, 3 ); - } - }, - - filter: { - - "TAG": function( nodeName ) { - if ( nodeName === "*" ) { - return function() { return true; }; - } - - nodeName = nodeName.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; - }; - }, - - "CLASS": function( className ) { - var pattern = classCache[ className + " " ]; - - return pattern || - (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && - classCache( className, function( elem ) { - return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); - }); - }, - - "ATTR": function( name, operator, check ) { - return function( elem ) { - var result = Sizzle.attr( elem, name ); - - if ( result == null ) { - return operator === "!="; - } - if ( !operator ) { - return true; - } - - result += ""; - - return operator === "=" ? result === check : - operator === "!=" ? result !== check : - operator === "^=" ? check && result.indexOf( check ) === 0 : - operator === "*=" ? check && result.indexOf( check ) > -1 : - operator === "$=" ? check && result.slice( -check.length ) === check : - operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : - operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : - false; - }; - }, - - "CHILD": function( type, what, argument, first, last ) { - var simple = type.slice( 0, 3 ) !== "nth", - forward = type.slice( -4 ) !== "last", - ofType = what === "of-type"; - - return first === 1 && last === 0 ? - - // Shortcut for :nth-*(n) - function( elem ) { - return !!elem.parentNode; - } : - - function( elem, context, xml ) { - var cache, outerCache, node, diff, nodeIndex, start, - dir = simple !== forward ? "nextSibling" : "previousSibling", - parent = elem.parentNode, - name = ofType && elem.nodeName.toLowerCase(), - useCache = !xml && !ofType; - - if ( parent ) { - - // :(first|last|only)-(child|of-type) - if ( simple ) { - while ( dir ) { - node = elem; - while ( (node = node[ dir ]) ) { - if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { - return false; - } - } - // Reverse direction for :only-* (if we haven't yet done so) - start = dir = type === "only" && !start && "nextSibling"; - } - return true; - } - - start = [ forward ? parent.firstChild : parent.lastChild ]; - - // non-xml :nth-child(...) stores cache data on `parent` - if ( forward && useCache ) { - // Seek `elem` from a previously-cached index - outerCache = parent[ expando ] || (parent[ expando ] = {}); - cache = outerCache[ type ] || []; - nodeIndex = cache[0] === dirruns && cache[1]; - diff = cache[0] === dirruns && cache[2]; - node = nodeIndex && parent.childNodes[ nodeIndex ]; - - while ( (node = ++nodeIndex && node && node[ dir ] || - - // Fallback to seeking `elem` from the start - (diff = nodeIndex = 0) || start.pop()) ) { - - // When found, cache indexes on `parent` and break - if ( node.nodeType === 1 && ++diff && node === elem ) { - outerCache[ type ] = [ dirruns, nodeIndex, diff ]; - break; - } - } - - // Use previously-cached element index if available - } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { - diff = cache[1]; - - // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) - } else { - // Use the same loop as above to seek `elem` from the start - while ( (node = ++nodeIndex && node && node[ dir ] || - (diff = nodeIndex = 0) || start.pop()) ) { - - if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { - // Cache the index of each encountered element - if ( useCache ) { - (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; - } - - if ( node === elem ) { - break; - } - } - } - } - - // Incorporate the offset, then check against cycle size - diff -= last; - return diff === first || ( diff % first === 0 && diff / first >= 0 ); - } - }; - }, - - "PSEUDO": function( pseudo, argument ) { - // pseudo-class names are case-insensitive - // http://www.w3.org/TR/selectors/#pseudo-classes - // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters - // Remember that setFilters inherits from pseudos - var args, - fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || - Sizzle.error( "unsupported pseudo: " + pseudo ); - - // The user may use createPseudo to indicate that - // arguments are needed to create the filter function - // just as Sizzle does - if ( fn[ expando ] ) { - return fn( argument ); - } - - // But maintain support for old signatures - if ( fn.length > 1 ) { - args = [ pseudo, pseudo, "", argument ]; - return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? - markFunction(function( seed, matches ) { - var idx, - matched = fn( seed, argument ), - i = matched.length; - while ( i-- ) { - idx = indexOf.call( seed, matched[i] ); - seed[ idx ] = !( matches[ idx ] = matched[i] ); - } - }) : - function( elem ) { - return fn( elem, 0, args ); - }; - } - - return fn; - } - }, - - pseudos: { - // Potentially complex pseudos - "not": markFunction(function( selector ) { - // Trim the selector passed to compile - // to avoid treating leading and trailing - // spaces as combinators - var input = [], - results = [], - matcher = compile( selector.replace( rtrim, "$1" ) ); - - return matcher[ expando ] ? - markFunction(function( seed, matches, context, xml ) { - var elem, - unmatched = matcher( seed, null, xml, [] ), - i = seed.length; - - // Match elements unmatched by `matcher` - while ( i-- ) { - if ( (elem = unmatched[i]) ) { - seed[i] = !(matches[i] = elem); - } - } - }) : - function( elem, context, xml ) { - input[0] = elem; - matcher( input, null, xml, results ); - return !results.pop(); - }; - }), - - "has": markFunction(function( selector ) { - return function( elem ) { - return Sizzle( selector, elem ).length > 0; - }; - }), - - "contains": markFunction(function( text ) { - return function( elem ) { - return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; - }; - }), - - // "Whether an element is represented by a :lang() selector - // is based solely on the element's language value - // being equal to the identifier C, - // or beginning with the identifier C immediately followed by "-". - // The matching of C against the element's language value is performed case-insensitively. - // The identifier C does not have to be a valid language name." - // http://www.w3.org/TR/selectors/#lang-pseudo - "lang": markFunction( function( lang ) { - // lang value must be a valid identifider - if ( !ridentifier.test(lang || "") ) { - Sizzle.error( "unsupported lang: " + lang ); - } - lang = lang.replace( runescape, funescape ).toLowerCase(); - return function( elem ) { - var elemLang; - do { - if ( (elemLang = documentIsXML ? - elem.getAttribute("xml:lang") || elem.getAttribute("lang") : - elem.lang) ) { - - elemLang = elemLang.toLowerCase(); - return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; - } - } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); - return false; - }; - }), - - // Miscellaneous - "target": function( elem ) { - var hash = window.location && window.location.hash; - return hash && hash.slice( 1 ) === elem.id; - }, - - "root": function( elem ) { - return elem === docElem; - }, - - "focus": function( elem ) { - return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); - }, - - // Boolean properties - "enabled": function( elem ) { - return elem.disabled === false; - }, - - "disabled": function( elem ) { - return elem.disabled === true; - }, - - "checked": function( elem ) { - // In CSS3, :checked should return both checked and selected elements - // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked - var nodeName = elem.nodeName.toLowerCase(); - return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); - }, - - "selected": function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - // Contents - "empty": function( elem ) { - // http://www.w3.org/TR/selectors/#empty-pseudo - // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), - // not comment, processing instructions, or others - // Thanks to Diego Perini for the nodeName shortcut - // Greater than "@" means alpha characters (specifically not starting with "#" or "?") - for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { - if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { - return false; - } - } - return true; - }, - - "parent": function( elem ) { - return !Expr.pseudos["empty"]( elem ); - }, - - // Element/input types - "header": function( elem ) { - return rheader.test( elem.nodeName ); - }, - - "input": function( elem ) { - return rinputs.test( elem.nodeName ); - }, - - "button": function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && elem.type === "button" || name === "button"; - }, - - "text": function( elem ) { - var attr; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && - elem.type === "text" && - ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); - }, - - // Position-in-collection - "first": createPositionalPseudo(function() { - return [ 0 ]; - }), - - "last": createPositionalPseudo(function( matchIndexes, length ) { - return [ length - 1 ]; - }), - - "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { - return [ argument < 0 ? argument + length : argument ]; - }), - - "even": createPositionalPseudo(function( matchIndexes, length ) { - var i = 0; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "odd": createPositionalPseudo(function( matchIndexes, length ) { - var i = 1; - for ( ; i < length; i += 2 ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; --i >= 0; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }), - - "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { - var i = argument < 0 ? argument + length : argument; - for ( ; ++i < length; ) { - matchIndexes.push( i ); - } - return matchIndexes; - }) - } -}; - -// Add button/input type pseudos -for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { - Expr.pseudos[ i ] = createInputPseudo( i ); -} -for ( i in { submit: true, reset: true } ) { - Expr.pseudos[ i ] = createButtonPseudo( i ); -} - -function tokenize( selector, parseOnly ) { - var matched, match, tokens, type, - soFar, groups, preFilters, - cached = tokenCache[ selector + " " ]; - - if ( cached ) { - return parseOnly ? 0 : cached.slice( 0 ); - } - - soFar = selector; - groups = []; - preFilters = Expr.preFilter; - - while ( soFar ) { - - // Comma and first run - if ( !matched || (match = rcomma.exec( soFar )) ) { - if ( match ) { - // Don't consume trailing commas as valid - soFar = soFar.slice( match[0].length ) || soFar; - } - groups.push( tokens = [] ); - } - - matched = false; - - // Combinators - if ( (match = rcombinators.exec( soFar )) ) { - matched = match.shift(); - tokens.push( { - value: matched, - // Cast descendant combinators to space - type: match[0].replace( rtrim, " " ) - } ); - soFar = soFar.slice( matched.length ); - } - - // Filters - for ( type in Expr.filter ) { - if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || - (match = preFilters[ type ]( match ))) ) { - matched = match.shift(); - tokens.push( { - value: matched, - type: type, - matches: match - } ); - soFar = soFar.slice( matched.length ); - } - } - - if ( !matched ) { - break; - } - } - - // Return the length of the invalid excess - // if we're just parsing - // Otherwise, throw an error or return tokens - return parseOnly ? - soFar.length : - soFar ? - Sizzle.error( selector ) : - // Cache the tokens - tokenCache( selector, groups ).slice( 0 ); -} - -function toSelector( tokens ) { - var i = 0, - len = tokens.length, - selector = ""; - for ( ; i < len; i++ ) { - selector += tokens[i].value; - } - return selector; -} - -function addCombinator( matcher, combinator, base ) { - var dir = combinator.dir, - checkNonElements = base && dir === "parentNode", - doneName = done++; - - return combinator.first ? - // Check against closest ancestor/preceding element - function( elem, context, xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - return matcher( elem, context, xml ); - } - } - } : - - // Check against all ancestor/preceding elements - function( elem, context, xml ) { - var data, cache, outerCache, - dirkey = dirruns + " " + doneName; - - // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching - if ( xml ) { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - if ( matcher( elem, context, xml ) ) { - return true; - } - } - } - } else { - while ( (elem = elem[ dir ]) ) { - if ( elem.nodeType === 1 || checkNonElements ) { - outerCache = elem[ expando ] || (elem[ expando ] = {}); - if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { - if ( (data = cache[1]) === true || data === cachedruns ) { - return data === true; - } - } else { - cache = outerCache[ dir ] = [ dirkey ]; - cache[1] = matcher( elem, context, xml ) || cachedruns; - if ( cache[1] === true ) { - return true; - } - } - } - } - } - }; -} - -function elementMatcher( matchers ) { - return matchers.length > 1 ? - function( elem, context, xml ) { - var i = matchers.length; - while ( i-- ) { - if ( !matchers[i]( elem, context, xml ) ) { - return false; - } - } - return true; - } : - matchers[0]; -} - -function condense( unmatched, map, filter, context, xml ) { - var elem, - newUnmatched = [], - i = 0, - len = unmatched.length, - mapped = map != null; - - for ( ; i < len; i++ ) { - if ( (elem = unmatched[i]) ) { - if ( !filter || filter( elem, context, xml ) ) { - newUnmatched.push( elem ); - if ( mapped ) { - map.push( i ); - } - } - } - } - - return newUnmatched; -} - -function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { - if ( postFilter && !postFilter[ expando ] ) { - postFilter = setMatcher( postFilter ); - } - if ( postFinder && !postFinder[ expando ] ) { - postFinder = setMatcher( postFinder, postSelector ); - } - return markFunction(function( seed, results, context, xml ) { - var temp, i, elem, - preMap = [], - postMap = [], - preexisting = results.length, - - // Get initial elements from seed or context - elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), - - // Prefilter to get matcher input, preserving a map for seed-results synchronization - matcherIn = preFilter && ( seed || !selector ) ? - condense( elems, preMap, preFilter, context, xml ) : - elems, - - matcherOut = matcher ? - // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, - postFinder || ( seed ? preFilter : preexisting || postFilter ) ? - - // ...intermediate processing is necessary - [] : - - // ...otherwise use results directly - results : - matcherIn; - - // Find primary matches - if ( matcher ) { - matcher( matcherIn, matcherOut, context, xml ); - } - - // Apply postFilter - if ( postFilter ) { - temp = condense( matcherOut, postMap ); - postFilter( temp, [], context, xml ); - - // Un-match failing elements by moving them back to matcherIn - i = temp.length; - while ( i-- ) { - if ( (elem = temp[i]) ) { - matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); - } - } - } - - if ( seed ) { - if ( postFinder || preFilter ) { - if ( postFinder ) { - // Get the final matcherOut by condensing this intermediate into postFinder contexts - temp = []; - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) ) { - // Restore matcherIn since elem is not yet a final match - temp.push( (matcherIn[i] = elem) ); - } - } - postFinder( null, (matcherOut = []), temp, xml ); - } - - // Move matched elements from seed to results to keep them synchronized - i = matcherOut.length; - while ( i-- ) { - if ( (elem = matcherOut[i]) && - (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { - - seed[temp] = !(results[temp] = elem); - } - } - } - - // Add elements to results, through postFinder if defined - } else { - matcherOut = condense( - matcherOut === results ? - matcherOut.splice( preexisting, matcherOut.length ) : - matcherOut - ); - if ( postFinder ) { - postFinder( null, results, matcherOut, xml ); - } else { - push.apply( results, matcherOut ); - } - } - }); -} - -function matcherFromTokens( tokens ) { - var checkContext, matcher, j, - len = tokens.length, - leadingRelative = Expr.relative[ tokens[0].type ], - implicitRelative = leadingRelative || Expr.relative[" "], - i = leadingRelative ? 1 : 0, - - // The foundational matcher ensures that elements are reachable from top-level context(s) - matchContext = addCombinator( function( elem ) { - return elem === checkContext; - }, implicitRelative, true ), - matchAnyContext = addCombinator( function( elem ) { - return indexOf.call( checkContext, elem ) > -1; - }, implicitRelative, true ), - matchers = [ function( elem, context, xml ) { - return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( - (checkContext = context).nodeType ? - matchContext( elem, context, xml ) : - matchAnyContext( elem, context, xml ) ); - } ]; - - for ( ; i < len; i++ ) { - if ( (matcher = Expr.relative[ tokens[i].type ]) ) { - matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; - } else { - matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); - - // Return special upon seeing a positional matcher - if ( matcher[ expando ] ) { - // Find the next relative operator (if any) for proper handling - j = ++i; - for ( ; j < len; j++ ) { - if ( Expr.relative[ tokens[j].type ] ) { - break; - } - } - return setMatcher( - i > 1 && elementMatcher( matchers ), - i > 1 && toSelector( tokens.slice( 0, i - 1 ) ).replace( rtrim, "$1" ), - matcher, - i < j && matcherFromTokens( tokens.slice( i, j ) ), - j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), - j < len && toSelector( tokens ) - ); - } - matchers.push( matcher ); - } - } - - return elementMatcher( matchers ); -} - -function matcherFromGroupMatchers( elementMatchers, setMatchers ) { - // A counter to specify which element is currently being matched - var matcherCachedRuns = 0, - bySet = setMatchers.length > 0, - byElement = elementMatchers.length > 0, - superMatcher = function( seed, context, xml, results, expandContext ) { - var elem, j, matcher, - setMatched = [], - matchedCount = 0, - i = "0", - unmatched = seed && [], - outermost = expandContext != null, - contextBackup = outermostContext, - // We must always have either seed elements or context - elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), - // Use integer dirruns iff this is the outermost matcher - dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1); - - if ( outermost ) { - outermostContext = context !== document && context; - cachedruns = matcherCachedRuns; - } - - // Add elements passing elementMatchers directly to results - // Keep `i` a string if there are no elements so `matchedCount` will be "00" below - for ( ; (elem = elems[i]) != null; i++ ) { - if ( byElement && elem ) { - j = 0; - while ( (matcher = elementMatchers[j++]) ) { - if ( matcher( elem, context, xml ) ) { - results.push( elem ); - break; - } - } - if ( outermost ) { - dirruns = dirrunsUnique; - cachedruns = ++matcherCachedRuns; - } - } - - // Track unmatched elements for set filters - if ( bySet ) { - // They will have gone through all possible matchers - if ( (elem = !matcher && elem) ) { - matchedCount--; - } - - // Lengthen the array for every element, matched or not - if ( seed ) { - unmatched.push( elem ); - } - } - } - - // Apply set filters to unmatched elements - matchedCount += i; - if ( bySet && i !== matchedCount ) { - j = 0; - while ( (matcher = setMatchers[j++]) ) { - matcher( unmatched, setMatched, context, xml ); - } - - if ( seed ) { - // Reintegrate element matches to eliminate the need for sorting - if ( matchedCount > 0 ) { - while ( i-- ) { - if ( !(unmatched[i] || setMatched[i]) ) { - setMatched[i] = pop.call( results ); - } - } - } - - // Discard index placeholder values to get only actual matches - setMatched = condense( setMatched ); - } - - // Add matches to results - push.apply( results, setMatched ); - - // Seedless set matches succeeding multiple successful matchers stipulate sorting - if ( outermost && !seed && setMatched.length > 0 && - ( matchedCount + setMatchers.length ) > 1 ) { - - Sizzle.uniqueSort( results ); - } - } - - // Override manipulation of globals by nested matchers - if ( outermost ) { - dirruns = dirrunsUnique; - outermostContext = contextBackup; - } - - return unmatched; - }; - - return bySet ? - markFunction( superMatcher ) : - superMatcher; -} - -compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { - var i, - setMatchers = [], - elementMatchers = [], - cached = compilerCache[ selector + " " ]; - - if ( !cached ) { - // Generate a function of recursive functions that can be used to check each element - if ( !group ) { - group = tokenize( selector ); - } - i = group.length; - while ( i-- ) { - cached = matcherFromTokens( group[i] ); - if ( cached[ expando ] ) { - setMatchers.push( cached ); - } else { - elementMatchers.push( cached ); - } - } - - // Cache the compiled function - cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); - } - return cached; -}; - -function multipleContexts( selector, contexts, results ) { - var i = 0, - len = contexts.length; - for ( ; i < len; i++ ) { - Sizzle( selector, contexts[i], results ); - } - return results; -} - -function select( selector, context, results, seed ) { - var i, tokens, token, type, find, - match = tokenize( selector ); - - if ( !seed ) { - // Try to minimize operations if there is only one group - if ( match.length === 1 ) { - - // Take a shortcut and set the context if the root selector is an ID - tokens = match[0] = match[0].slice( 0 ); - if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && - context.nodeType === 9 && !documentIsXML && - Expr.relative[ tokens[1].type ] ) { - - context = Expr.find["ID"]( token.matches[0].replace( runescape, funescape ), context )[0]; - if ( !context ) { - return results; - } - - selector = selector.slice( tokens.shift().value.length ); - } - - // Fetch a seed set for right-to-left matching - i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; - while ( i-- ) { - token = tokens[i]; - - // Abort if we hit a combinator - if ( Expr.relative[ (type = token.type) ] ) { - break; - } - if ( (find = Expr.find[ type ]) ) { - // Search, expanding context for leading sibling combinators - if ( (seed = find( - token.matches[0].replace( runescape, funescape ), - rsibling.test( tokens[0].type ) && context.parentNode || context - )) ) { - - // If seed is empty or no tokens remain, we can return early - tokens.splice( i, 1 ); - selector = seed.length && toSelector( tokens ); - if ( !selector ) { - push.apply( results, slice.call( seed, 0 ) ); - return results; - } - - break; - } - } - } - } - } - - // Compile and execute a filtering function - // Provide `match` to avoid retokenization if we modified the selector above - compile( selector, match )( - seed, - context, - documentIsXML, - results, - rsibling.test( selector ) - ); - return results; -} - -// Deprecated -Expr.pseudos["nth"] = Expr.pseudos["eq"]; - -// Easy API for creating new setFilters -function setFilters() {} -Expr.filters = setFilters.prototype = Expr.pseudos; -Expr.setFilters = new setFilters(); - -// Initialize with the default document -setDocument(); - -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.pseudos; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})( window ); -var runtil = /Until$/, - rparentsprev = /^(?:parents|prev(?:Until|All))/, - isSimple = /^.[^:#\[\.,]*$/, - rneedsContext = jQuery.expr.match.needsContext, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var i, ret, self, - len = this.length; - - if ( typeof selector !== "string" ) { - self = this; - return this.pushStack( jQuery( selector ).filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }) ); - } - - ret = []; - for ( i = 0; i < len; i++ ) { - jQuery.find( selector, this[ i ], ret ); - } - - // Needed because $( selector, context ) becomes $( context ).find( selector ) - ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); - ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; - return ret; - }, - - has: function( target ) { - var i, - targets = jQuery( target, this ), - len = targets.length; - - return this.filter(function() { - for ( i = 0; i < len; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false) ); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true) ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional/relative selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - rneedsContext.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var cur, - i = 0, - l = this.length, - ret = [], - pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( ; i < l; i++ ) { - cur = this[i]; - - while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - } - cur = cur.parentNode; - } - } - - return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( jQuery.unique(all) ); - }, - - addBack: function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter(selector) - ); - } -}); - -jQuery.fn.andSelf = jQuery.fn.addBack; - -function sibling( cur, dir ) { - do { - cur = cur[ dir ]; - } while ( cur && cur.nodeType !== 1 ); - - return cur; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return sibling( elem, "nextSibling" ); - }, - prev: function( elem ) { - return sibling( elem, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.merge( [], elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( this.length > 1 && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, - rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, - rtagName = /<([\w:]+)/, - rtbody = /<tbody/i, - rhtml = /<|&#?\w+;/, - rnoInnerhtml = /<(?:script|style|link)/i, - manipulation_rcheckableType = /^(?:checkbox|radio)$/i, - // checked="checked" or checked - rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, - rscriptType = /^$|\/(?:java|ecma)script/i, - rscriptTypeMasked = /^true\/(.*)/, - rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, - - // We have to close these tags to support XHTML (#13200) - wrapMap = { - option: [ 1, "<select multiple='multiple'>", "</select>" ], - legend: [ 1, "<fieldset>", "</fieldset>" ], - area: [ 1, "<map>", "</map>" ], - param: [ 1, "<object>", "</object>" ], - thead: [ 1, "<table>", "</table>" ], - tr: [ 2, "<table><tbody>", "</tbody></table>" ], - col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], - td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], - - // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, - // unless wrapped in a div with non-breaking characters in front of it. - _default: jQuery.support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] - }, - safeFragment = createSafeFragment( document ), - fragmentDiv = safeFragment.appendChild( document.createElement("div") ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -jQuery.fn.extend({ - text: function( value ) { - return jQuery.access( this, function( value ) { - return value === undefined ? - jQuery.text( this ) : - this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); - }, null, value, arguments.length ); - }, - - wrapAll: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapAll( html.call(this, i) ); - }); - } - - if ( this[0] ) { - // The elements to wrap the target around - var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); - - if ( this[0].parentNode ) { - wrap.insertBefore( this[0] ); - } - - wrap.map(function() { - var elem = this; - - while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { - elem = elem.firstChild; - } - - return elem; - }).append( this ); - } - - return this; - }, - - wrapInner: function( html ) { - if ( jQuery.isFunction( html ) ) { - return this.each(function(i) { - jQuery(this).wrapInner( html.call(this, i) ); - }); - } - - return this.each(function() { - var self = jQuery( this ), - contents = self.contents(); - - if ( contents.length ) { - contents.wrapAll( html ); - - } else { - self.append( html ); - } - }); - }, - - wrap: function( html ) { - var isFunction = jQuery.isFunction( html ); - - return this.each(function(i) { - jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); - }); - }, - - unwrap: function() { - return this.parent().each(function() { - if ( !jQuery.nodeName( this, "body" ) ) { - jQuery( this ).replaceWith( this.childNodes ); - } - }).end(); - }, - - append: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.appendChild( elem ); - } - }); - }, - - prepend: function() { - return this.domManip(arguments, true, function( elem ) { - if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { - this.insertBefore( elem, this.firstChild ); - } - }); - }, - - before: function() { - return this.domManip( arguments, false, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this ); - } - }); - }, - - after: function() { - return this.domManip( arguments, false, function( elem ) { - if ( this.parentNode ) { - this.parentNode.insertBefore( elem, this.nextSibling ); - } - }); - }, - - // keepData is for internal use only--do not document - remove: function( selector, keepData ) { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { - if ( !keepData && elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem ) ); - } - - if ( elem.parentNode ) { - if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { - setGlobalEval( getAll( elem, "script" ) ); - } - elem.parentNode.removeChild( elem ); - } - } - } - - return this; - }, - - empty: function() { - var elem, - i = 0; - - for ( ; (elem = this[i]) != null; i++ ) { - // Remove element nodes and prevent memory leaks - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - } - - // Remove any remaining nodes - while ( elem.firstChild ) { - elem.removeChild( elem.firstChild ); - } - - // If this is a select, ensure that it displays empty (#12336) - // Support: IE<9 - if ( elem.options && jQuery.nodeName( elem, "select" ) ) { - elem.options.length = 0; - } - } - - return this; - }, - - clone: function( dataAndEvents, deepDataAndEvents ) { - dataAndEvents = dataAndEvents == null ? false : dataAndEvents; - deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; - - return this.map( function () { - return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); - }); - }, - - html: function( value ) { - return jQuery.access( this, function( value ) { - var elem = this[0] || {}, - i = 0, - l = this.length; - - if ( value === undefined ) { - return elem.nodeType === 1 ? - elem.innerHTML.replace( rinlinejQuery, "" ) : - undefined; - } - - // See if we can take a shortcut and just use innerHTML - if ( typeof value === "string" && !rnoInnerhtml.test( value ) && - ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && - ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && - !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { - - value = value.replace( rxhtmlTag, "<$1></$2>" ); - - try { - for (; i < l; i++ ) { - // Remove element nodes and prevent memory leaks - elem = this[i] || {}; - if ( elem.nodeType === 1 ) { - jQuery.cleanData( getAll( elem, false ) ); - elem.innerHTML = value; - } - } - - elem = 0; - - // If using innerHTML throws an exception, use the fallback method - } catch(e) {} - } - - if ( elem ) { - this.empty().append( value ); - } - }, null, value, arguments.length ); - }, - - replaceWith: function( value ) { - var isFunc = jQuery.isFunction( value ); - - // Make sure that the elements are removed from the DOM before they are inserted - // this can help fix replacing a parent with child elements - if ( !isFunc && typeof value !== "string" ) { - value = jQuery( value ).not( this ).detach(); - } - - return this.domManip( [ value ], true, function( elem ) { - var next = this.nextSibling, - parent = this.parentNode; - - if ( parent ) { - jQuery( this ).remove(); - parent.insertBefore( elem, next ); - } - }); - }, - - detach: function( selector ) { - return this.remove( selector, true ); - }, - - domManip: function( args, table, callback ) { - - // Flatten any nested arrays - args = core_concat.apply( [], args ); - - var first, node, hasScripts, - scripts, doc, fragment, - i = 0, - l = this.length, - set = this, - iNoClone = l - 1, - value = args[0], - isFunction = jQuery.isFunction( value ); - - // We can't cloneNode fragments that contain checked, in WebKit - if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { - return this.each(function( index ) { - var self = set.eq( index ); - if ( isFunction ) { - args[0] = value.call( this, index, table ? self.html() : undefined ); - } - self.domManip( args, table, callback ); - }); - } - - if ( l ) { - fragment = jQuery.buildFragment( args, this[ 0 ].ownerDocument, false, this ); - first = fragment.firstChild; - - if ( fragment.childNodes.length === 1 ) { - fragment = first; - } - - if ( first ) { - table = table && jQuery.nodeName( first, "tr" ); - scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); - hasScripts = scripts.length; - - // Use the original fragment for the last item instead of the first because it can end up - // being emptied incorrectly in certain situations (#8070). - for ( ; i < l; i++ ) { - node = fragment; - - if ( i !== iNoClone ) { - node = jQuery.clone( node, true, true ); - - // Keep references to cloned scripts for later restoration - if ( hasScripts ) { - jQuery.merge( scripts, getAll( node, "script" ) ); - } - } - - callback.call( - table && jQuery.nodeName( this[i], "table" ) ? - findOrAppend( this[i], "tbody" ) : - this[i], - node, - i - ); - } - - if ( hasScripts ) { - doc = scripts[ scripts.length - 1 ].ownerDocument; - - // Reenable scripts - jQuery.map( scripts, restoreScript ); - - // Evaluate executable scripts on first document insertion - for ( i = 0; i < hasScripts; i++ ) { - node = scripts[ i ]; - if ( rscriptType.test( node.type || "" ) && - !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { - - if ( node.src ) { - // Hope ajax is available... - jQuery.ajax({ - url: node.src, - type: "GET", - dataType: "script", - async: false, - global: false, - "throws": true - }); - } else { - jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); - } - } - } - } - - // Fix #11809: Avoid leaking memory - fragment = first = null; - } - } - - return this; - } -}); - -function findOrAppend( elem, tag ) { - return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); -} - -// Replace/restore the type attribute of script elements for safe DOM manipulation -function disableScript( elem ) { - var attr = elem.getAttributeNode("type"); - elem.type = ( attr && attr.specified ) + "/" + elem.type; - return elem; -} -function restoreScript( elem ) { - var match = rscriptTypeMasked.exec( elem.type ); - if ( match ) { - elem.type = match[1]; - } else { - elem.removeAttribute("type"); - } - return elem; -} - -// Mark scripts as having already been evaluated -function setGlobalEval( elems, refElements ) { - var elem, - i = 0; - for ( ; (elem = elems[i]) != null; i++ ) { - jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); - } -} - -function cloneCopyEvent( src, dest ) { - - if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { - return; - } - - var type, i, l, - oldData = jQuery._data( src ), - curData = jQuery._data( dest, oldData ), - events = oldData.events; - - if ( events ) { - delete curData.handle; - curData.events = {}; - - for ( type in events ) { - for ( i = 0, l = events[ type ].length; i < l; i++ ) { - jQuery.event.add( dest, type, events[ type ][ i ] ); - } - } - } - - // make the cloned public data object a copy from the original - if ( curData.data ) { - curData.data = jQuery.extend( {}, curData.data ); - } -} - -function fixCloneNodeIssues( src, dest ) { - var nodeName, e, data; - - // We do not need to do anything for non-Elements - if ( dest.nodeType !== 1 ) { - return; - } - - nodeName = dest.nodeName.toLowerCase(); - - // IE6-8 copies events bound via attachEvent when using cloneNode. - if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { - data = jQuery._data( dest ); - - for ( e in data.events ) { - jQuery.removeEvent( dest, e, data.handle ); - } - - // Event data gets referenced instead of copied if the expando gets copied too - dest.removeAttribute( jQuery.expando ); - } - - // IE blanks contents when cloning scripts, and tries to evaluate newly-set text - if ( nodeName === "script" && dest.text !== src.text ) { - disableScript( dest ).text = src.text; - restoreScript( dest ); - - // IE6-10 improperly clones children of object elements using classid. - // IE10 throws NoModificationAllowedError if parent is null, #12132. - } else if ( nodeName === "object" ) { - if ( dest.parentNode ) { - dest.outerHTML = src.outerHTML; - } - - // This path appears unavoidable for IE9. When cloning an object - // element in IE9, the outerHTML strategy above is not sufficient. - // If the src has innerHTML and the destination does not, - // copy the src.innerHTML into the dest.innerHTML. #10324 - if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { - dest.innerHTML = src.innerHTML; - } - - } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { - // IE6-8 fails to persist the checked state of a cloned checkbox - // or radio button. Worse, IE6-7 fail to give the cloned element - // a checked appearance if the defaultChecked value isn't also set - - dest.defaultChecked = dest.checked = src.checked; - - // IE6-7 get confused and end up setting the value of a cloned - // checkbox/radio button to an empty string instead of "on" - if ( dest.value !== src.value ) { - dest.value = src.value; - } - - // IE6-8 fails to return the selected option to the default selected - // state when cloning options - } else if ( nodeName === "option" ) { - dest.defaultSelected = dest.selected = src.defaultSelected; - - // IE6-8 fails to set the defaultValue to the correct value when - // cloning other types of input fields - } else if ( nodeName === "input" || nodeName === "textarea" ) { - dest.defaultValue = src.defaultValue; - } -} - -jQuery.each({ - appendTo: "append", - prependTo: "prepend", - insertBefore: "before", - insertAfter: "after", - replaceAll: "replaceWith" -}, function( name, original ) { - jQuery.fn[ name ] = function( selector ) { - var elems, - i = 0, - ret = [], - insert = jQuery( selector ), - last = insert.length - 1; - - for ( ; i <= last; i++ ) { - elems = i === last ? this : this.clone(true); - jQuery( insert[i] )[ original ]( elems ); - - // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() - core_push.apply( ret, elems.get() ); - } - - return this.pushStack( ret ); - }; -}); - -function getAll( context, tag ) { - var elems, elem, - i = 0, - found = typeof context.getElementsByTagName !== core_strundefined ? context.getElementsByTagName( tag || "*" ) : - typeof context.querySelectorAll !== core_strundefined ? context.querySelectorAll( tag || "*" ) : - undefined; - - if ( !found ) { - for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { - if ( !tag || jQuery.nodeName( elem, tag ) ) { - found.push( elem ); - } else { - jQuery.merge( found, getAll( elem, tag ) ); - } - } - } - - return tag === undefined || tag && jQuery.nodeName( context, tag ) ? - jQuery.merge( [ context ], found ) : - found; -} - -// Used in buildFragment, fixes the defaultChecked property -function fixDefaultChecked( elem ) { - if ( manipulation_rcheckableType.test( elem.type ) ) { - elem.defaultChecked = elem.checked; - } -} - -jQuery.extend({ - clone: function( elem, dataAndEvents, deepDataAndEvents ) { - var destElements, node, clone, i, srcElements, - inPage = jQuery.contains( elem.ownerDocument, elem ); - - if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { - clone = elem.cloneNode( true ); - - // IE<=8 does not properly clone detached, unknown element nodes - } else { - fragmentDiv.innerHTML = elem.outerHTML; - fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); - } - - if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && - (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { - - // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 - destElements = getAll( clone ); - srcElements = getAll( elem ); - - // Fix all IE cloning issues - for ( i = 0; (node = srcElements[i]) != null; ++i ) { - // Ensure that the destination node is not null; Fixes #9587 - if ( destElements[i] ) { - fixCloneNodeIssues( node, destElements[i] ); - } - } - } - - // Copy the events from the original to the clone - if ( dataAndEvents ) { - if ( deepDataAndEvents ) { - srcElements = srcElements || getAll( elem ); - destElements = destElements || getAll( clone ); - - for ( i = 0; (node = srcElements[i]) != null; i++ ) { - cloneCopyEvent( node, destElements[i] ); - } - } else { - cloneCopyEvent( elem, clone ); - } - } - - // Preserve script evaluation history - destElements = getAll( clone, "script" ); - if ( destElements.length > 0 ) { - setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); - } - - destElements = srcElements = node = null; - - // Return the cloned set - return clone; - }, - - buildFragment: function( elems, context, scripts, selection ) { - var j, elem, contains, - tmp, tag, tbody, wrap, - l = elems.length, - - // Ensure a safe fragment - safe = createSafeFragment( context ), - - nodes = [], - i = 0; - - for ( ; i < l; i++ ) { - elem = elems[ i ]; - - if ( elem || elem === 0 ) { - - // Add nodes directly - if ( jQuery.type( elem ) === "object" ) { - jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); - - // Convert non-html into a text node - } else if ( !rhtml.test( elem ) ) { - nodes.push( context.createTextNode( elem ) ); - - // Convert html into DOM nodes - } else { - tmp = tmp || safe.appendChild( context.createElement("div") ); - - // Deserialize a standard representation - tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); - wrap = wrapMap[ tag ] || wrapMap._default; - - tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[2]; - - // Descend through wrappers to the right content - j = wrap[0]; - while ( j-- ) { - tmp = tmp.lastChild; - } - - // Manually add leading whitespace removed by IE - if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { - nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); - } - - // Remove IE's autoinserted <tbody> from table fragments - if ( !jQuery.support.tbody ) { - - // String was a <table>, *may* have spurious <tbody> - elem = tag === "table" && !rtbody.test( elem ) ? - tmp.firstChild : - - // String was a bare <thead> or <tfoot> - wrap[1] === "<table>" && !rtbody.test( elem ) ? - tmp : - 0; - - j = elem && elem.childNodes.length; - while ( j-- ) { - if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { - elem.removeChild( tbody ); - } - } - } - - jQuery.merge( nodes, tmp.childNodes ); - - // Fix #12392 for WebKit and IE > 9 - tmp.textContent = ""; - - // Fix #12392 for oldIE - while ( tmp.firstChild ) { - tmp.removeChild( tmp.firstChild ); - } - - // Remember the top-level container for proper cleanup - tmp = safe.lastChild; - } - } - } - - // Fix #11356: Clear elements from fragment - if ( tmp ) { - safe.removeChild( tmp ); - } - - // Reset defaultChecked for any radios and checkboxes - // about to be appended to the DOM in IE 6/7 (#8060) - if ( !jQuery.support.appendChecked ) { - jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); - } - - i = 0; - while ( (elem = nodes[ i++ ]) ) { - - // #4087 - If origin and destination elements are the same, and this is - // that element, do not do anything - if ( selection && jQuery.inArray( elem, selection ) !== -1 ) { - continue; - } - - contains = jQuery.contains( elem.ownerDocument, elem ); - - // Append to fragment - tmp = getAll( safe.appendChild( elem ), "script" ); - - // Preserve script evaluation history - if ( contains ) { - setGlobalEval( tmp ); - } - - // Capture executables - if ( scripts ) { - j = 0; - while ( (elem = tmp[ j++ ]) ) { - if ( rscriptType.test( elem.type || "" ) ) { - scripts.push( elem ); - } - } - } - } - - tmp = null; - - return safe; - }, - - cleanData: function( elems, /* internal */ acceptData ) { - var elem, type, id, data, - i = 0, - internalKey = jQuery.expando, - cache = jQuery.cache, - deleteExpando = jQuery.support.deleteExpando, - special = jQuery.event.special; - - for ( ; (elem = elems[i]) != null; i++ ) { - - if ( acceptData || jQuery.acceptData( elem ) ) { - - id = elem[ internalKey ]; - data = id && cache[ id ]; - - if ( data ) { - if ( data.events ) { - for ( type in data.events ) { - if ( special[ type ] ) { - jQuery.event.remove( elem, type ); - - // This is a shortcut to avoid jQuery.event.remove's overhead - } else { - jQuery.removeEvent( elem, type, data.handle ); - } - } - } - - // Remove cache only if it was not already removed by jQuery.event.remove - if ( cache[ id ] ) { - - delete cache[ id ]; - - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( deleteExpando ) { - delete elem[ internalKey ]; - - } else if ( typeof elem.removeAttribute !== core_strundefined ) { - elem.removeAttribute( internalKey ); - - } else { - elem[ internalKey ] = null; - } - - core_deletedIds.push( id ); - } - } - } - } - } -}); -var iframe, getStyles, curCSS, - ralpha = /alpha\([^)]*\)/i, - ropacity = /opacity\s*=\s*([^)]*)/, - rposition = /^(top|right|bottom|left)$/, - // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" - // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display - rdisplayswap = /^(none|table(?!-c[ea]).+)/, - rmargin = /^margin/, - rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), - rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), - rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), - elemdisplay = { BODY: "block" }, - - cssShow = { position: "absolute", visibility: "hidden", display: "block" }, - cssNormalTransform = { - letterSpacing: 0, - fontWeight: 400 - }, - - cssExpand = [ "Top", "Right", "Bottom", "Left" ], - cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; - -// return a css property mapped to a potentially vendor prefixed property -function vendorPropName( style, name ) { - - // shortcut for names that are not vendor prefixed - if ( name in style ) { - return name; - } - - // check for vendor prefixed names - var capName = name.charAt(0).toUpperCase() + name.slice(1), - origName = name, - i = cssPrefixes.length; - - while ( i-- ) { - name = cssPrefixes[ i ] + capName; - if ( name in style ) { - return name; - } - } - - return origName; -} - -function isHidden( elem, el ) { - // isHidden might be called from jQuery#filter function; - // in that case, element will be second argument - elem = el || elem; - return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); -} - -function showHide( elements, show ) { - var display, elem, hidden, - values = [], - index = 0, - length = elements.length; - - for ( ; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - - values[ index ] = jQuery._data( elem, "olddisplay" ); - display = elem.style.display; - if ( show ) { - // Reset the inline display of this element to learn if it is - // being hidden by cascaded rules or not - if ( !values[ index ] && display === "none" ) { - elem.style.display = ""; - } - - // Set elements which have been overridden with display: none - // in a stylesheet to whatever the default browser style is - // for such an element - if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); - } - } else { - - if ( !values[ index ] ) { - hidden = isHidden( elem ); - - if ( display && display !== "none" || !hidden ) { - jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); - } - } - } - } - - // Set the display of most of the elements in a second loop - // to avoid the constant reflow - for ( index = 0; index < length; index++ ) { - elem = elements[ index ]; - if ( !elem.style ) { - continue; - } - if ( !show || elem.style.display === "none" || elem.style.display === "" ) { - elem.style.display = show ? values[ index ] || "" : "none"; - } - } - - return elements; -} - -jQuery.fn.extend({ - css: function( name, value ) { - return jQuery.access( this, function( elem, name, value ) { - var len, styles, - map = {}, - i = 0; - - if ( jQuery.isArray( name ) ) { - styles = getStyles( elem ); - len = name.length; - - for ( ; i < len; i++ ) { - map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); - } - - return map; - } - - return value !== undefined ? - jQuery.style( elem, name, value ) : - jQuery.css( elem, name ); - }, name, value, arguments.length > 1 ); - }, - show: function() { - return showHide( this, true ); - }, - hide: function() { - return showHide( this ); - }, - toggle: function( state ) { - var bool = typeof state === "boolean"; - - return this.each(function() { - if ( bool ? state : isHidden( this ) ) { - jQuery( this ).show(); - } else { - jQuery( this ).hide(); - } - }); - } -}); - -jQuery.extend({ - // Add in style property hooks for overriding the default - // behavior of getting and setting a style property - cssHooks: { - opacity: { - get: function( elem, computed ) { - if ( computed ) { - // We should always get a number back from opacity - var ret = curCSS( elem, "opacity" ); - return ret === "" ? "1" : ret; - } - } - } - }, - - // Exclude the following css properties to add px - cssNumber: { - "columnCount": true, - "fillOpacity": true, - "fontWeight": true, - "lineHeight": true, - "opacity": true, - "orphans": true, - "widows": true, - "zIndex": true, - "zoom": true - }, - - // Add in properties whose names you wish to fix before - // setting or getting the value - cssProps: { - // normalize float css property - "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" - }, - - // Get and set the style property on a DOM Node - style: function( elem, name, value, extra ) { - // Don't set styles on text and comment nodes - if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { - return; - } - - // Make sure that we're working with the right name - var ret, type, hooks, - origName = jQuery.camelCase( name ), - style = elem.style; - - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // Check if we're setting a value - if ( value !== undefined ) { - type = typeof value; - - // convert relative number strings (+= or -=) to relative numbers. #7345 - if ( type === "string" && (ret = rrelNum.exec( value )) ) { - value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); - // Fixes bug #9237 - type = "number"; - } - - // Make sure that NaN and null values aren't set. See: #7116 - if ( value == null || type === "number" && isNaN( value ) ) { - return; - } - - // If a number was passed in, add 'px' to the (except for certain CSS properties) - if ( type === "number" && !jQuery.cssNumber[ origName ] ) { - value += "px"; - } - - // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, - // but it would mean to define eight (for every problematic property) identical functions - if ( !jQuery.support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { - style[ name ] = "inherit"; - } - - // If a hook was provided, use that value, otherwise just set the specified value - if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { - - // Wrapped to prevent IE from throwing errors when 'invalid' values are provided - // Fixes bug #5509 - try { - style[ name ] = value; - } catch(e) {} - } - - } else { - // If a hook was provided get the non-computed value from there - if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { - return ret; - } - - // Otherwise just get the value from the style object - return style[ name ]; - } - }, - - css: function( elem, name, extra, styles ) { - var num, val, hooks, - origName = jQuery.camelCase( name ); - - // Make sure that we're working with the right name - name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); - - // gets hook for the prefixed version - // followed by the unprefixed version - hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; - - // If a hook was provided get the computed value from there - if ( hooks && "get" in hooks ) { - val = hooks.get( elem, true, extra ); - } - - // Otherwise, if a way to get the computed value exists, use that - if ( val === undefined ) { - val = curCSS( elem, name, styles ); - } - - //convert "normal" to computed value - if ( val === "normal" && name in cssNormalTransform ) { - val = cssNormalTransform[ name ]; - } - - // Return, converting to number if forced or a qualifier was provided and val looks numeric - if ( extra === "" || extra ) { - num = parseFloat( val ); - return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; - } - return val; - }, - - // A method for quickly swapping in/out CSS properties to get correct calculations - swap: function( elem, options, callback, args ) { - var ret, name, - old = {}; - - // Remember the old values, and insert the new ones - for ( name in options ) { - old[ name ] = elem.style[ name ]; - elem.style[ name ] = options[ name ]; - } - - ret = callback.apply( elem, args || [] ); - - // Revert the old values - for ( name in options ) { - elem.style[ name ] = old[ name ]; - } - - return ret; - } -}); - -// NOTE: we've included the "window" in window.getComputedStyle -// because jsdom on node.js will break without it. -if ( window.getComputedStyle ) { - getStyles = function( elem ) { - return window.getComputedStyle( elem, null ); - }; - - curCSS = function( elem, name, _computed ) { - var width, minWidth, maxWidth, - computed = _computed || getStyles( elem ), - - // getPropertyValue is only needed for .css('filter') in IE9, see #12537 - ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, - style = elem.style; - - if ( computed ) { - - if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { - ret = jQuery.style( elem, name ); - } - - // A tribute to the "awesome hack by Dean Edwards" - // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right - // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels - // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values - if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { - - // Remember the original values - width = style.width; - minWidth = style.minWidth; - maxWidth = style.maxWidth; - - // Put in the new values to get a computed value out - style.minWidth = style.maxWidth = style.width = ret; - ret = computed.width; - - // Revert the changed values - style.width = width; - style.minWidth = minWidth; - style.maxWidth = maxWidth; - } - } - - return ret; - }; -} else if ( document.documentElement.currentStyle ) { - getStyles = function( elem ) { - return elem.currentStyle; - }; - - curCSS = function( elem, name, _computed ) { - var left, rs, rsLeft, - computed = _computed || getStyles( elem ), - ret = computed ? computed[ name ] : undefined, - style = elem.style; - - // Avoid setting ret to empty string here - // so we don't default to auto - if ( ret == null && style && style[ name ] ) { - ret = style[ name ]; - } - - // From the awesome hack by Dean Edwards - // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 - - // If we're not dealing with a regular pixel number - // but a number that has a weird ending, we need to convert it to pixels - // but not position css attributes, as those are proportional to the parent element instead - // and we can't measure the parent instead because it might trigger a "stacking dolls" problem - if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { - - // Remember the original values - left = style.left; - rs = elem.runtimeStyle; - rsLeft = rs && rs.left; - - // Put in the new values to get a computed value out - if ( rsLeft ) { - rs.left = elem.currentStyle.left; - } - style.left = name === "fontSize" ? "1em" : ret; - ret = style.pixelLeft + "px"; - - // Revert the changed values - style.left = left; - if ( rsLeft ) { - rs.left = rsLeft; - } - } - - return ret === "" ? "auto" : ret; - }; -} - -function setPositiveNumber( elem, value, subtract ) { - var matches = rnumsplit.exec( value ); - return matches ? - // Guard against undefined "subtract", e.g., when used as in cssHooks - Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : - value; -} - -function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { - var i = extra === ( isBorderBox ? "border" : "content" ) ? - // If we already have the right measurement, avoid augmentation - 4 : - // Otherwise initialize for horizontal or vertical properties - name === "width" ? 1 : 0, - - val = 0; - - for ( ; i < 4; i += 2 ) { - // both box models exclude margin, so add it if we want it - if ( extra === "margin" ) { - val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); - } - - if ( isBorderBox ) { - // border-box includes padding, so remove it if we want content - if ( extra === "content" ) { - val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - } - - // at this point, extra isn't border nor margin, so remove border - if ( extra !== "margin" ) { - val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } else { - // at this point, extra isn't content, so add padding - val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); - - // at this point, extra isn't content nor padding, so add border - if ( extra !== "padding" ) { - val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); - } - } - } - - return val; -} - -function getWidthOrHeight( elem, name, extra ) { - - // Start with offset property, which is equivalent to the border-box value - var valueIsBorderBox = true, - val = name === "width" ? elem.offsetWidth : elem.offsetHeight, - styles = getStyles( elem ), - isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; - - // some non-html elements return undefined for offsetWidth, so check for null/undefined - // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 - // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 - if ( val <= 0 || val == null ) { - // Fall back to computed then uncomputed css if necessary - val = curCSS( elem, name, styles ); - if ( val < 0 || val == null ) { - val = elem.style[ name ]; - } - - // Computed unit is not pixels. Stop here and return. - if ( rnumnonpx.test(val) ) { - return val; - } - - // we need the check for style in case a browser which returns unreliable values - // for getComputedStyle silently falls back to the reliable elem.style - valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); - - // Normalize "", auto, and prepare for extra - val = parseFloat( val ) || 0; - } - - // use the active box-sizing model to add/subtract irrelevant styles - return ( val + - augmentWidthOrHeight( - elem, - name, - extra || ( isBorderBox ? "border" : "content" ), - valueIsBorderBox, - styles - ) - ) + "px"; -} - -// Try to determine the default display value of an element -function css_defaultDisplay( nodeName ) { - var doc = document, - display = elemdisplay[ nodeName ]; - - if ( !display ) { - display = actualDisplay( nodeName, doc ); - - // If the simple way fails, read from inside an iframe - if ( display === "none" || !display ) { - // Use the already-created iframe if possible - iframe = ( iframe || - jQuery("<iframe frameborder='0' width='0' height='0'/>") - .css( "cssText", "display:block !important" ) - ).appendTo( doc.documentElement ); - - // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse - doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document; - doc.write("<!doctype html><html><body>"); - doc.close(); - - display = actualDisplay( nodeName, doc ); - iframe.detach(); - } - - // Store the correct default display - elemdisplay[ nodeName ] = display; - } - - return display; -} - -// Called ONLY from within css_defaultDisplay -function actualDisplay( name, doc ) { - var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), - display = jQuery.css( elem[0], "display" ); - elem.remove(); - return display; -} - -jQuery.each([ "height", "width" ], function( i, name ) { - jQuery.cssHooks[ name ] = { - get: function( elem, computed, extra ) { - if ( computed ) { - // certain elements can have dimension info if we invisibly show them - // however, it must have a current display style that would benefit from this - return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ? - jQuery.swap( elem, cssShow, function() { - return getWidthOrHeight( elem, name, extra ); - }) : - getWidthOrHeight( elem, name, extra ); - } - }, - - set: function( elem, value, extra ) { - var styles = extra && getStyles( elem ); - return setPositiveNumber( elem, value, extra ? - augmentWidthOrHeight( - elem, - name, - extra, - jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", - styles - ) : 0 - ); - } - }; -}); - -if ( !jQuery.support.opacity ) { - jQuery.cssHooks.opacity = { - get: function( elem, computed ) { - // IE uses filters for opacity - return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? - ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : - computed ? "1" : ""; - }, - - set: function( elem, value ) { - var style = elem.style, - currentStyle = elem.currentStyle, - opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", - filter = currentStyle && currentStyle.filter || style.filter || ""; - - // IE has trouble with opacity if it does not have layout - // Force it by setting the zoom level - style.zoom = 1; - - // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 - // if value === "", then remove inline opacity #12685 - if ( ( value >= 1 || value === "" ) && - jQuery.trim( filter.replace( ralpha, "" ) ) === "" && - style.removeAttribute ) { - - // Setting style.filter to null, "" & " " still leave "filter:" in the cssText - // if "filter:" is present at all, clearType is disabled, we want to avoid this - // style.removeAttribute is IE Only, but so apparently is this code path... - style.removeAttribute( "filter" ); - - // if there is no filter style applied in a css rule or unset inline opacity, we are done - if ( value === "" || currentStyle && !currentStyle.filter ) { - return; - } - } - - // otherwise, set new filter values - style.filter = ralpha.test( filter ) ? - filter.replace( ralpha, opacity ) : - filter + " " + opacity; - } - }; -} - -// These hooks cannot be added until DOM ready because the support test -// for it is not run until after DOM ready -jQuery(function() { - if ( !jQuery.support.reliableMarginRight ) { - jQuery.cssHooks.marginRight = { - get: function( elem, computed ) { - if ( computed ) { - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - // Work around by temporarily setting element display to inline-block - return jQuery.swap( elem, { "display": "inline-block" }, - curCSS, [ elem, "marginRight" ] ); - } - } - }; - } - - // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 - // getComputedStyle returns percent when specified for top/left/bottom/right - // rather than make the css module depend on the offset module, we just check for it here - if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { - jQuery.each( [ "top", "left" ], function( i, prop ) { - jQuery.cssHooks[ prop ] = { - get: function( elem, computed ) { - if ( computed ) { - computed = curCSS( elem, prop ); - // if curCSS returns percentage, fallback to offset - return rnumnonpx.test( computed ) ? - jQuery( elem ).position()[ prop ] + "px" : - computed; - } - } - }; - }); - } - -}); - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.hidden = function( elem ) { - // Support: Opera <= 12.12 - // Opera reports offsetWidths and offsetHeights less than zero on some elements - return elem.offsetWidth <= 0 && elem.offsetHeight <= 0 || - (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); - }; - - jQuery.expr.filters.visible = function( elem ) { - return !jQuery.expr.filters.hidden( elem ); - }; -} - -// These hooks are used by animate to expand properties -jQuery.each({ - margin: "", - padding: "", - border: "Width" -}, function( prefix, suffix ) { - jQuery.cssHooks[ prefix + suffix ] = { - expand: function( value ) { - var i = 0, - expanded = {}, - - // assumes a single number if not a string - parts = typeof value === "string" ? value.split(" ") : [ value ]; - - for ( ; i < 4; i++ ) { - expanded[ prefix + cssExpand[ i ] + suffix ] = - parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; - } - - return expanded; - } - }; - - if ( !rmargin.test( prefix ) ) { - jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; - } -}); -var r20 = /%20/g, - rbracket = /\[\]$/, - rCRLF = /\r?\n/g, - rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, - rsubmittable = /^(?:input|select|textarea|keygen)/i; - -jQuery.fn.extend({ - serialize: function() { - return jQuery.param( this.serializeArray() ); - }, - serializeArray: function() { - return this.map(function(){ - // Can add propHook for "elements" to filter or add form elements - var elements = jQuery.prop( this, "elements" ); - return elements ? jQuery.makeArray( elements ) : this; - }) - .filter(function(){ - var type = this.type; - // Use .is(":disabled") so that fieldset[disabled] works - return this.name && !jQuery( this ).is( ":disabled" ) && - rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && - ( this.checked || !manipulation_rcheckableType.test( type ) ); - }) - .map(function( i, elem ){ - var val = jQuery( this ).val(); - - return val == null ? - null : - jQuery.isArray( val ) ? - jQuery.map( val, function( val ){ - return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }) : - { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; - }).get(); - } -}); - -//Serialize an array of form elements or a set of -//key/values into a query string -jQuery.param = function( a, traditional ) { - var prefix, - s = [], - add = function( key, value ) { - // If value is a function, invoke it and return its value - value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); - s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); - }; - - // Set traditional to true for jQuery <= 1.3.2 behavior. - if ( traditional === undefined ) { - traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; - } - - // If an array was passed in, assume that it is an array of form elements. - if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { - // Serialize the form elements - jQuery.each( a, function() { - add( this.name, this.value ); - }); - - } else { - // If traditional, encode the "old" way (the way 1.3.2 or older - // did it), otherwise encode params recursively. - for ( prefix in a ) { - buildParams( prefix, a[ prefix ], traditional, add ); - } - } - - // Return the resulting serialization - return s.join( "&" ).replace( r20, "+" ); -}; - -function buildParams( prefix, obj, traditional, add ) { - var name; - - if ( jQuery.isArray( obj ) ) { - // Serialize array item. - jQuery.each( obj, function( i, v ) { - if ( traditional || rbracket.test( prefix ) ) { - // Treat each array item as a scalar. - add( prefix, v ); - - } else { - // Item is non-scalar (array or object), encode its numeric index. - buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); - } - }); - - } else if ( !traditional && jQuery.type( obj ) === "object" ) { - // Serialize object item. - for ( name in obj ) { - buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); - } - - } else { - // Serialize scalar item. - add( prefix, obj ); - } -} -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; -}); - -jQuery.fn.hover = function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); -}; -var - // Document location - ajaxLocParts, - ajaxLocation, - ajax_nonce = jQuery.now(), - - ajax_rquery = /\?/, - rhash = /#.*$/, - rts = /([?&])_=[^&]*/, - rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL - // #7653, #8125, #8152: local protocol detection - rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, - rnoContent = /^(?:GET|HEAD)$/, - rprotocol = /^\/\//, - rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, - - // Keep a copy of the old load method - _load = jQuery.fn.load, - - /* Prefilters - * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) - * 2) These are called: - * - BEFORE asking for a transport - * - AFTER param serialization (s.data is a string if s.processData is true) - * 3) key is the dataType - * 4) the catchall symbol "*" can be used - * 5) execution will start with transport dataType and THEN continue down to "*" if needed - */ - prefilters = {}, - - /* Transports bindings - * 1) key is the dataType - * 2) the catchall symbol "*" can be used - * 3) selection will start with transport dataType and THEN go to "*" if needed - */ - transports = {}, - - // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression - allTypes = "*/".concat("*"); - -// #8138, IE may throw an exception when accessing -// a field from window.location if document.domain has been set -try { - ajaxLocation = location.href; -} catch( e ) { - // Use the href attribute of an A element - // since IE will modify it given document.location - ajaxLocation = document.createElement( "a" ); - ajaxLocation.href = ""; - ajaxLocation = ajaxLocation.href; -} - -// Segment location into parts -ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; - -// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport -function addToPrefiltersOrTransports( structure ) { - - // dataTypeExpression is optional and defaults to "*" - return function( dataTypeExpression, func ) { - - if ( typeof dataTypeExpression !== "string" ) { - func = dataTypeExpression; - dataTypeExpression = "*"; - } - - var dataType, - i = 0, - dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || []; - - if ( jQuery.isFunction( func ) ) { - // For each dataType in the dataTypeExpression - while ( (dataType = dataTypes[i++]) ) { - // Prepend if requested - if ( dataType[0] === "+" ) { - dataType = dataType.slice( 1 ) || "*"; - (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); - - // Otherwise append - } else { - (structure[ dataType ] = structure[ dataType ] || []).push( func ); - } - } - } - }; -} - -// Base inspection function for prefilters and transports -function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { - - var inspected = {}, - seekingTransport = ( structure === transports ); - - function inspect( dataType ) { - var selected; - inspected[ dataType ] = true; - jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { - var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { - options.dataTypes.unshift( dataTypeOrTransport ); - inspect( dataTypeOrTransport ); - return false; - } else if ( seekingTransport ) { - return !( selected = dataTypeOrTransport ); - } - }); - return selected; - } - - return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); -} - -// A special extend for ajax options -// that takes "flat" options (not to be deep extended) -// Fixes #9887 -function ajaxExtend( target, src ) { - var deep, key, - flatOptions = jQuery.ajaxSettings.flatOptions || {}; - - for ( key in src ) { - if ( src[ key ] !== undefined ) { - ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; - } - } - if ( deep ) { - jQuery.extend( true, target, deep ); - } - - return target; -} - -jQuery.fn.load = function( url, params, callback ) { - if ( typeof url !== "string" && _load ) { - return _load.apply( this, arguments ); - } - - var selector, response, type, - self = this, - off = url.indexOf(" "); - - if ( off >= 0 ) { - selector = url.slice( off, url.length ); - url = url.slice( 0, off ); - } - - // If it's a function - if ( jQuery.isFunction( params ) ) { - - // We assume that it's the callback - callback = params; - params = undefined; - - // Otherwise, build a param string - } else if ( params && typeof params === "object" ) { - type = "POST"; - } - - // If we have elements to modify, make the request - if ( self.length > 0 ) { - jQuery.ajax({ - url: url, - - // if "type" variable is undefined, then "GET" method will be used - type: type, - dataType: "html", - data: params - }).done(function( responseText ) { - - // Save response for use in complete callback - response = arguments; - - self.html( selector ? - - // If a selector was specified, locate the right elements in a dummy div - // Exclude scripts to avoid IE 'Permission Denied' errors - jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : - - // Otherwise use the full result - responseText ); - - }).complete( callback && function( jqXHR, status ) { - self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); - }); - } - - return this; -}; - -// Attach a bunch of functions for handling common AJAX events -jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){ - jQuery.fn[ type ] = function( fn ){ - return this.on( type, fn ); - }; -}); - -jQuery.each( [ "get", "post" ], function( i, method ) { - jQuery[ method ] = function( url, data, callback, type ) { - // shift arguments if data argument was omitted - if ( jQuery.isFunction( data ) ) { - type = type || callback; - callback = data; - data = undefined; - } - - return jQuery.ajax({ - url: url, - type: method, - dataType: type, - data: data, - success: callback - }); - }; -}); - -jQuery.extend({ - - // Counter for holding the number of active queries - active: 0, - - // Last-Modified header cache for next request - lastModified: {}, - etag: {}, - - ajaxSettings: { - url: ajaxLocation, - type: "GET", - isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), - global: true, - processData: true, - async: true, - contentType: "application/x-www-form-urlencoded; charset=UTF-8", - /* - timeout: 0, - data: null, - dataType: null, - username: null, - password: null, - cache: null, - throws: false, - traditional: false, - headers: {}, - */ - - accepts: { - "*": allTypes, - text: "text/plain", - html: "text/html", - xml: "application/xml, text/xml", - json: "application/json, text/javascript" - }, - - contents: { - xml: /xml/, - html: /html/, - json: /json/ - }, - - responseFields: { - xml: "responseXML", - text: "responseText" - }, - - // Data converters - // Keys separate source (or catchall "*") and destination types with a single space - converters: { - - // Convert anything to text - "* text": window.String, - - // Text to html (true = no transformation) - "text html": true, - - // Evaluate text as a json expression - "text json": jQuery.parseJSON, - - // Parse text as xml - "text xml": jQuery.parseXML - }, - - // For options that shouldn't be deep extended: - // you can add your own custom options here if - // and when you create one that shouldn't be - // deep extended (see ajaxExtend) - flatOptions: { - url: true, - context: true - } - }, - - // Creates a full fledged settings object into target - // with both ajaxSettings and settings fields. - // If target is omitted, writes into ajaxSettings. - ajaxSetup: function( target, settings ) { - return settings ? - - // Building a settings object - ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : - - // Extending ajaxSettings - ajaxExtend( jQuery.ajaxSettings, target ); - }, - - ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), - ajaxTransport: addToPrefiltersOrTransports( transports ), - - // Main method - ajax: function( url, options ) { - - // If url is an object, simulate pre-1.5 signature - if ( typeof url === "object" ) { - options = url; - url = undefined; - } - - // Force options to be an object - options = options || {}; - - var // Cross-domain detection vars - parts, - // Loop variable - i, - // URL without anti-cache param - cacheURL, - // Response headers as string - responseHeadersString, - // timeout handle - timeoutTimer, - - // To know if global events are to be dispatched - fireGlobals, - - transport, - // Response headers - responseHeaders, - // Create the final options object - s = jQuery.ajaxSetup( {}, options ), - // Callbacks context - callbackContext = s.context || s, - // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, - // Deferreds - deferred = jQuery.Deferred(), - completeDeferred = jQuery.Callbacks("once memory"), - // Status-dependent callbacks - statusCode = s.statusCode || {}, - // Headers (they are sent all at once) - requestHeaders = {}, - requestHeadersNames = {}, - // The jqXHR state - state = 0, - // Default abort message - strAbort = "canceled", - // Fake xhr - jqXHR = { - readyState: 0, - - // Builds headers hashtable if needed - getResponseHeader: function( key ) { - var match; - if ( state === 2 ) { - if ( !responseHeaders ) { - responseHeaders = {}; - while ( (match = rheaders.exec( responseHeadersString )) ) { - responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; - } - } - match = responseHeaders[ key.toLowerCase() ]; - } - return match == null ? null : match; - }, - - // Raw string - getAllResponseHeaders: function() { - return state === 2 ? responseHeadersString : null; - }, - - // Caches the header - setRequestHeader: function( name, value ) { - var lname = name.toLowerCase(); - if ( !state ) { - name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; - requestHeaders[ name ] = value; - } - return this; - }, - - // Overrides response content-type header - overrideMimeType: function( type ) { - if ( !state ) { - s.mimeType = type; - } - return this; - }, - - // Status-dependent callbacks - statusCode: function( map ) { - var code; - if ( map ) { - if ( state < 2 ) { - for ( code in map ) { - // Lazy-add the new callback in a way that preserves old ones - statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; - } - } else { - // Execute the appropriate callbacks - jqXHR.always( map[ jqXHR.status ] ); - } - } - return this; - }, - - // Cancel the request - abort: function( statusText ) { - var finalText = statusText || strAbort; - if ( transport ) { - transport.abort( finalText ); - } - done( 0, finalText ); - return this; - } - }; - - // Attach deferreds - deferred.promise( jqXHR ).complete = completeDeferred.add; - jqXHR.success = jqXHR.done; - jqXHR.error = jqXHR.fail; - - // Remove hash character (#7531: and string promotion) - // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) - // Handle falsy url in the settings object (#10093: consistency with old signature) - // We also use the url parameter if available - s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); - - // Alias method option to type as per ticket #12004 - s.type = options.method || options.type || s.method || s.type; - - // Extract dataTypes list - s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""]; - - // A cross-domain request is in order when we have a protocol:host:port mismatch - if ( s.crossDomain == null ) { - parts = rurl.exec( s.url.toLowerCase() ); - s.crossDomain = !!( parts && - ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || - ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != - ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) - ); - } - - // Convert data if not already a string - if ( s.data && s.processData && typeof s.data !== "string" ) { - s.data = jQuery.param( s.data, s.traditional ); - } - - // Apply prefilters - inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); - - // If request was aborted inside a prefilter, stop there - if ( state === 2 ) { - return jqXHR; - } - - // We can fire global events as of now if asked to - fireGlobals = s.global; - - // Watch for a new set of requests - if ( fireGlobals && jQuery.active++ === 0 ) { - jQuery.event.trigger("ajaxStart"); - } - - // Uppercase the type - s.type = s.type.toUpperCase(); - - // Determine if request has content - s.hasContent = !rnoContent.test( s.type ); - - // Save the URL in case we're toying with the If-Modified-Since - // and/or If-None-Match header later on - cacheURL = s.url; - - // More options handling for requests with no content - if ( !s.hasContent ) { - - // If data is available, append data to url - if ( s.data ) { - cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); - // #9682: remove data so that it's not used in an eventual retry - delete s.data; - } - - // Add anti-cache in url if needed - if ( s.cache === false ) { - s.url = rts.test( cacheURL ) ? - - // If there is already a '_' parameter, set its value - cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) : - - // Otherwise add one to the end - cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++; - } - } - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - if ( jQuery.lastModified[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); - } - if ( jQuery.etag[ cacheURL ] ) { - jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); - } - } - - // Set the correct header, if data is being sent - if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { - jqXHR.setRequestHeader( "Content-Type", s.contentType ); - } - - // Set the Accepts header for the server, depending on the dataType - jqXHR.setRequestHeader( - "Accept", - s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? - s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : - s.accepts[ "*" ] - ); - - // Check for headers option - for ( i in s.headers ) { - jqXHR.setRequestHeader( i, s.headers[ i ] ); - } - - // Allow custom headers/mimetypes and early abort - if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { - // Abort if not done already and return - return jqXHR.abort(); - } - - // aborting is no longer a cancellation - strAbort = "abort"; - - // Install callbacks on deferreds - for ( i in { success: 1, error: 1, complete: 1 } ) { - jqXHR[ i ]( s[ i ] ); - } - - // Get transport - transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); - - // If no transport, we auto-abort - if ( !transport ) { - done( -1, "No Transport" ); - } else { - jqXHR.readyState = 1; - - // Send global event - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); - } - // Timeout - if ( s.async && s.timeout > 0 ) { - timeoutTimer = setTimeout(function() { - jqXHR.abort("timeout"); - }, s.timeout ); - } - - try { - state = 1; - transport.send( requestHeaders, done ); - } catch ( e ) { - // Propagate exception as error if not done - if ( state < 2 ) { - done( -1, e ); - // Simply rethrow otherwise - } else { - throw e; - } - } - } - - // Callback for when everything is done - function done( status, nativeStatusText, responses, headers ) { - var isSuccess, success, error, response, modified, - statusText = nativeStatusText; - - // Called once - if ( state === 2 ) { - return; - } - - // State is "done" now - state = 2; - - // Clear timeout if it exists - if ( timeoutTimer ) { - clearTimeout( timeoutTimer ); - } - - // Dereference transport for early garbage collection - // (no matter how long the jqXHR object will be used) - transport = undefined; - - // Cache response headers - responseHeadersString = headers || ""; - - // Set readyState - jqXHR.readyState = status > 0 ? 4 : 0; - - // Get response data - if ( responses ) { - response = ajaxHandleResponses( s, jqXHR, responses ); - } - - // If successful, handle type chaining - if ( status >= 200 && status < 300 || status === 304 ) { - - // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. - if ( s.ifModified ) { - modified = jqXHR.getResponseHeader("Last-Modified"); - if ( modified ) { - jQuery.lastModified[ cacheURL ] = modified; - } - modified = jqXHR.getResponseHeader("etag"); - if ( modified ) { - jQuery.etag[ cacheURL ] = modified; - } - } - - // if no content - if ( status === 204 ) { - isSuccess = true; - statusText = "nocontent"; - - // if not modified - } else if ( status === 304 ) { - isSuccess = true; - statusText = "notmodified"; - - // If we have data, let's convert it - } else { - isSuccess = ajaxConvert( s, response ); - statusText = isSuccess.state; - success = isSuccess.data; - error = isSuccess.error; - isSuccess = !error; - } - } else { - // We extract error from statusText - // then normalize statusText and status for non-aborts - error = statusText; - if ( status || !statusText ) { - statusText = "error"; - if ( status < 0 ) { - status = 0; - } - } - } - - // Set data for the fake xhr object - jqXHR.status = status; - jqXHR.statusText = ( nativeStatusText || statusText ) + ""; - - // Success/Error - if ( isSuccess ) { - deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); - } else { - deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); - } - - // Status-dependent callbacks - jqXHR.statusCode( statusCode ); - statusCode = undefined; - - if ( fireGlobals ) { - globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", - [ jqXHR, s, isSuccess ? success : error ] ); - } - - // Complete - completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); - - if ( fireGlobals ) { - globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); - // Handle the global AJAX counter - if ( !( --jQuery.active ) ) { - jQuery.event.trigger("ajaxStop"); - } - } - } - - return jqXHR; - }, - - getScript: function( url, callback ) { - return jQuery.get( url, undefined, callback, "script" ); - }, - - getJSON: function( url, data, callback ) { - return jQuery.get( url, data, callback, "json" ); - } -}); - -/* Handles responses to an ajax request: - * - sets all responseXXX fields accordingly - * - finds the right dataType (mediates between content-type and expected dataType) - * - returns the corresponding response - */ -function ajaxHandleResponses( s, jqXHR, responses ) { - var firstDataType, ct, finalDataType, type, - contents = s.contents, - dataTypes = s.dataTypes, - responseFields = s.responseFields; - - // Fill responseXXX fields - for ( type in responseFields ) { - if ( type in responses ) { - jqXHR[ responseFields[type] ] = responses[ type ]; - } - } - - // Remove auto dataType and get content-type in the process - while( dataTypes[ 0 ] === "*" ) { - dataTypes.shift(); - if ( ct === undefined ) { - ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); - } - } - - // Check if we're dealing with a known content-type - if ( ct ) { - for ( type in contents ) { - if ( contents[ type ] && contents[ type ].test( ct ) ) { - dataTypes.unshift( type ); - break; - } - } - } - - // Check to see if we have a response for the expected dataType - if ( dataTypes[ 0 ] in responses ) { - finalDataType = dataTypes[ 0 ]; - } else { - // Try convertible dataTypes - for ( type in responses ) { - if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { - finalDataType = type; - break; - } - if ( !firstDataType ) { - firstDataType = type; - } - } - // Or just use first one - finalDataType = finalDataType || firstDataType; - } - - // If we found a dataType - // We add the dataType to the list if needed - // and return the corresponding response - if ( finalDataType ) { - if ( finalDataType !== dataTypes[ 0 ] ) { - dataTypes.unshift( finalDataType ); - } - return responses[ finalDataType ]; - } -} - -// Chain conversions given the request and the original response -function ajaxConvert( s, response ) { - var conv2, current, conv, tmp, - converters = {}, - i = 0, - // Work with a copy of dataTypes in case we need to modify it for conversion - dataTypes = s.dataTypes.slice(), - prev = dataTypes[ 0 ]; - - // Apply the dataFilter if provided - if ( s.dataFilter ) { - response = s.dataFilter( response, s.dataType ); - } - - // Create converters map with lowercased keys - if ( dataTypes[ 1 ] ) { - for ( conv in s.converters ) { - converters[ conv.toLowerCase() ] = s.converters[ conv ]; - } - } - - // Convert to each sequential dataType, tolerating list modification - for ( ; (current = dataTypes[++i]); ) { - - // There's only work to do if current dataType is non-auto - if ( current !== "*" ) { - - // Convert response if prev dataType is non-auto and differs from current - if ( prev !== "*" && prev !== current ) { - - // Seek a direct converter - conv = converters[ prev + " " + current ] || converters[ "* " + current ]; - - // If none found, seek a pair - if ( !conv ) { - for ( conv2 in converters ) { - - // If conv2 outputs current - tmp = conv2.split(" "); - if ( tmp[ 1 ] === current ) { - - // If prev can be converted to accepted input - conv = converters[ prev + " " + tmp[ 0 ] ] || - converters[ "* " + tmp[ 0 ] ]; - if ( conv ) { - // Condense equivalence converters - if ( conv === true ) { - conv = converters[ conv2 ]; - - // Otherwise, insert the intermediate dataType - } else if ( converters[ conv2 ] !== true ) { - current = tmp[ 0 ]; - dataTypes.splice( i--, 0, current ); - } - - break; - } - } - } - } - - // Apply converter (if not an equivalence) - if ( conv !== true ) { - - // Unless errors are allowed to bubble, catch and return them - if ( conv && s["throws"] ) { - response = conv( response ); - } else { - try { - response = conv( response ); - } catch ( e ) { - return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; - } - } - } - } - - // Update prev for next iteration - prev = current; - } - } - - return { state: "success", data: response }; -} -// Install script dataType -jQuery.ajaxSetup({ - accepts: { - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" - }, - contents: { - script: /(?:java|ecma)script/ - }, - converters: { - "text script": function( text ) { - jQuery.globalEval( text ); - return text; - } - } -}); - -// Handle cache's special case and global -jQuery.ajaxPrefilter( "script", function( s ) { - if ( s.cache === undefined ) { - s.cache = false; - } - if ( s.crossDomain ) { - s.type = "GET"; - s.global = false; - } -}); - -// Bind script tag hack transport -jQuery.ajaxTransport( "script", function(s) { - - // This transport only deals with cross domain requests - if ( s.crossDomain ) { - - var script, - head = document.head || jQuery("head")[0] || document.documentElement; - - return { - - send: function( _, callback ) { - - script = document.createElement("script"); - - script.async = true; - - if ( s.scriptCharset ) { - script.charset = s.scriptCharset; - } - - script.src = s.url; - - // Attach handlers for all browsers - script.onload = script.onreadystatechange = function( _, isAbort ) { - - if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { - - // Handle memory leak in IE - script.onload = script.onreadystatechange = null; - - // Remove the script - if ( script.parentNode ) { - script.parentNode.removeChild( script ); - } - - // Dereference the script - script = null; - - // Callback if not abort - if ( !isAbort ) { - callback( 200, "success" ); - } - } - }; - - // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending - // Use native DOM manipulation to avoid our domManip AJAX trickery - head.insertBefore( script, head.firstChild ); - }, - - abort: function() { - if ( script ) { - script.onload( undefined, true ); - } - } - }; - } -}); -var oldCallbacks = [], - rjsonp = /(=)\?(?=&|$)|\?\?/; - -// Default jsonp settings -jQuery.ajaxSetup({ - jsonp: "callback", - jsonpCallback: function() { - var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) ); - this[ callback ] = true; - return callback; - } -}); - -// Detect, normalize options and install callbacks for jsonp requests -jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { - - var callbackName, overwritten, responseContainer, - jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? - "url" : - typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" - ); - - // Handle iff the expected data type is "jsonp" or we have a parameter to set - if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { - - // Get callback name, remembering preexisting value associated with it - callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? - s.jsonpCallback() : - s.jsonpCallback; - - // Insert callback into url or form data - if ( jsonProp ) { - s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); - } else if ( s.jsonp !== false ) { - s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; - } - - // Use data converter to retrieve json after script execution - s.converters["script json"] = function() { - if ( !responseContainer ) { - jQuery.error( callbackName + " was not called" ); - } - return responseContainer[ 0 ]; - }; - - // force json dataType - s.dataTypes[ 0 ] = "json"; - - // Install callback - overwritten = window[ callbackName ]; - window[ callbackName ] = function() { - responseContainer = arguments; - }; - - // Clean-up function (fires after converters) - jqXHR.always(function() { - // Restore preexisting value - window[ callbackName ] = overwritten; - - // Save back as free - if ( s[ callbackName ] ) { - // make sure that re-using the options doesn't screw things around - s.jsonpCallback = originalSettings.jsonpCallback; - - // save the callback name for future use - oldCallbacks.push( callbackName ); - } - - // Call if it was a function and we have a response - if ( responseContainer && jQuery.isFunction( overwritten ) ) { - overwritten( responseContainer[ 0 ] ); - } - - responseContainer = overwritten = undefined; - }); - - // Delegate to script - return "script"; - } -}); -var xhrCallbacks, xhrSupported, - xhrId = 0, - // #5280: Internet Explorer will keep connections alive if we don't abort on unload - xhrOnUnloadAbort = window.ActiveXObject && function() { - // Abort all pending requests - var key; - for ( key in xhrCallbacks ) { - xhrCallbacks[ key ]( undefined, true ); - } - }; - -// Functions to create xhrs -function createStandardXHR() { - try { - return new window.XMLHttpRequest(); - } catch( e ) {} -} - -function createActiveXHR() { - try { - return new window.ActiveXObject("Microsoft.XMLHTTP"); - } catch( e ) {} -} - -// Create the request object -// (This is still attached to ajaxSettings for backward compatibility) -jQuery.ajaxSettings.xhr = window.ActiveXObject ? - /* Microsoft failed to properly - * implement the XMLHttpRequest in IE7 (can't request local files), - * so we use the ActiveXObject when it is available - * Additionally XMLHttpRequest can be disabled in IE7/IE8 so - * we need a fallback. - */ - function() { - return !this.isLocal && createStandardXHR() || createActiveXHR(); - } : - // For all other browsers, use the standard XMLHttpRequest object - createStandardXHR; - -// Determine support properties -xhrSupported = jQuery.ajaxSettings.xhr(); -jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); -xhrSupported = jQuery.support.ajax = !!xhrSupported; - -// Create transport if the browser can provide an xhr -if ( xhrSupported ) { - - jQuery.ajaxTransport(function( s ) { - // Cross domain only allowed if supported through XMLHttpRequest - if ( !s.crossDomain || jQuery.support.cors ) { - - var callback; - - return { - send: function( headers, complete ) { - - // Get a new xhr - var handle, i, - xhr = s.xhr(); - - // Open the socket - // Passing null username, generates a login popup on Opera (#2865) - if ( s.username ) { - xhr.open( s.type, s.url, s.async, s.username, s.password ); - } else { - xhr.open( s.type, s.url, s.async ); - } - - // Apply custom fields if provided - if ( s.xhrFields ) { - for ( i in s.xhrFields ) { - xhr[ i ] = s.xhrFields[ i ]; - } - } - - // Override mime type if needed - if ( s.mimeType && xhr.overrideMimeType ) { - xhr.overrideMimeType( s.mimeType ); - } - - // X-Requested-With header - // For cross-domain requests, seeing as conditions for a preflight are - // akin to a jigsaw puzzle, we simply never set it to be sure. - // (it can always be set on a per-request basis or even using ajaxSetup) - // For same-domain requests, won't change header if already provided. - if ( !s.crossDomain && !headers["X-Requested-With"] ) { - headers["X-Requested-With"] = "XMLHttpRequest"; - } - - // Need an extra try/catch for cross domain requests in Firefox 3 - try { - for ( i in headers ) { - xhr.setRequestHeader( i, headers[ i ] ); - } - } catch( err ) {} - - // Do send the request - // This may raise an exception which is actually - // handled in jQuery.ajax (so no try/catch here) - xhr.send( ( s.hasContent && s.data ) || null ); - - // Listener - callback = function( _, isAbort ) { - var status, responseHeaders, statusText, responses; - - // Firefox throws exceptions when accessing properties - // of an xhr when a network error occurred - // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) - try { - - // Was never called and is aborted or complete - if ( callback && ( isAbort || xhr.readyState === 4 ) ) { - - // Only called once - callback = undefined; - - // Do not keep as active anymore - if ( handle ) { - xhr.onreadystatechange = jQuery.noop; - if ( xhrOnUnloadAbort ) { - delete xhrCallbacks[ handle ]; - } - } - - // If it's an abort - if ( isAbort ) { - // Abort it manually if needed - if ( xhr.readyState !== 4 ) { - xhr.abort(); - } - } else { - responses = {}; - status = xhr.status; - responseHeaders = xhr.getAllResponseHeaders(); - - // When requesting binary data, IE6-9 will throw an exception - // on any attempt to access responseText (#11426) - if ( typeof xhr.responseText === "string" ) { - responses.text = xhr.responseText; - } - - // Firefox throws an exception when accessing - // statusText for faulty cross-domain requests - try { - statusText = xhr.statusText; - } catch( e ) { - // We normalize with Webkit giving an empty statusText - statusText = ""; - } - - // Filter status for non standard behaviors - - // If the request is local and we have data: assume a success - // (success with no data won't get notified, that's the best we - // can do given current implementations) - if ( !status && s.isLocal && !s.crossDomain ) { - status = responses.text ? 200 : 404; - // IE - #1450: sometimes returns 1223 when it should be 204 - } else if ( status === 1223 ) { - status = 204; - } - } - } - } catch( firefoxAccessException ) { - if ( !isAbort ) { - complete( -1, firefoxAccessException ); - } - } - - // Call complete if needed - if ( responses ) { - complete( status, statusText, responses, responseHeaders ); - } - }; - - if ( !s.async ) { - // if we're in sync mode we fire the callback - callback(); - } else if ( xhr.readyState === 4 ) { - // (IE6 & IE7) if it's in cache and has been - // retrieved directly we need to fire the callback - setTimeout( callback ); - } else { - handle = ++xhrId; - if ( xhrOnUnloadAbort ) { - // Create the active xhrs callbacks list if needed - // and attach the unload handler - if ( !xhrCallbacks ) { - xhrCallbacks = {}; - jQuery( window ).unload( xhrOnUnloadAbort ); - } - // Add to list of active xhrs callbacks - xhrCallbacks[ handle ] = callback; - } - xhr.onreadystatechange = callback; - } - }, - - abort: function() { - if ( callback ) { - callback( undefined, true ); - } - } - }; - } - }); -} -var fxNow, timerId, - rfxtypes = /^(?:toggle|show|hide)$/, - rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), - rrun = /queueHooks$/, - animationPrefilters = [ defaultPrefilter ], - tweeners = { - "*": [function( prop, value ) { - var end, unit, - tween = this.createTween( prop, value ), - parts = rfxnum.exec( value ), - target = tween.cur(), - start = +target || 0, - scale = 1, - maxIterations = 20; - - if ( parts ) { - end = +parts[2]; - unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - - // We need to compute starting value - if ( unit !== "px" && start ) { - // Iteratively approximate from a nonzero starting point - // Prefer the current property, because this process will be trivial if it uses the same units - // Fallback to end or a simple constant - start = jQuery.css( tween.elem, prop, true ) || end || 1; - - do { - // If previous iteration zeroed out, double until we get *something* - // Use a string for doubling factor so we don't accidentally see scale as unchanged below - scale = scale || ".5"; - - // Adjust and apply - start = start / scale; - jQuery.style( tween.elem, prop, start + unit ); - - // Update scale, tolerating zero or NaN from tween.cur() - // And breaking the loop if scale is unchanged or perfect, or if we've just had enough - } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); - } - - tween.unit = unit; - tween.start = start; - // If a +=/-= token was provided, we're doing a relative animation - tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; - } - return tween; - }] - }; - -// Animations created synchronously will run synchronously -function createFxNow() { - setTimeout(function() { - fxNow = undefined; - }); - return ( fxNow = jQuery.now() ); -} - -function createTweens( animation, props ) { - jQuery.each( props, function( prop, value ) { - var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), - index = 0, - length = collection.length; - for ( ; index < length; index++ ) { - if ( collection[ index ].call( animation, prop, value ) ) { - - // we're done with this property - return; - } - } - }); -} - -function Animation( elem, properties, options ) { - var result, - stopped, - index = 0, - length = animationPrefilters.length, - deferred = jQuery.Deferred().always( function() { - // don't match elem in the :animated selector - delete tick.elem; - }), - tick = function() { - if ( stopped ) { - return false; - } - var currentTime = fxNow || createFxNow(), - remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), - // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) - temp = remaining / animation.duration || 0, - percent = 1 - temp, - index = 0, - length = animation.tweens.length; - - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( percent ); - } - - deferred.notifyWith( elem, [ animation, percent, remaining ]); - - if ( percent < 1 && length ) { - return remaining; - } else { - deferred.resolveWith( elem, [ animation ] ); - return false; - } - }, - animation = deferred.promise({ - elem: elem, - props: jQuery.extend( {}, properties ), - opts: jQuery.extend( true, { specialEasing: {} }, options ), - originalProperties: properties, - originalOptions: options, - startTime: fxNow || createFxNow(), - duration: options.duration, - tweens: [], - createTween: function( prop, end ) { - var tween = jQuery.Tween( elem, animation.opts, prop, end, - animation.opts.specialEasing[ prop ] || animation.opts.easing ); - animation.tweens.push( tween ); - return tween; - }, - stop: function( gotoEnd ) { - var index = 0, - // if we are going to the end, we want to run all the tweens - // otherwise we skip this part - length = gotoEnd ? animation.tweens.length : 0; - if ( stopped ) { - return this; - } - stopped = true; - for ( ; index < length ; index++ ) { - animation.tweens[ index ].run( 1 ); - } - - // resolve when we played the last frame - // otherwise, reject - if ( gotoEnd ) { - deferred.resolveWith( elem, [ animation, gotoEnd ] ); - } else { - deferred.rejectWith( elem, [ animation, gotoEnd ] ); - } - return this; - } - }), - props = animation.props; - - propFilter( props, animation.opts.specialEasing ); - - for ( ; index < length ; index++ ) { - result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); - if ( result ) { - return result; - } - } - - createTweens( animation, props ); - - if ( jQuery.isFunction( animation.opts.start ) ) { - animation.opts.start.call( elem, animation ); - } - - jQuery.fx.timer( - jQuery.extend( tick, { - elem: elem, - anim: animation, - queue: animation.opts.queue - }) - ); - - // attach callbacks from options - return animation.progress( animation.opts.progress ) - .done( animation.opts.done, animation.opts.complete ) - .fail( animation.opts.fail ) - .always( animation.opts.always ); -} - -function propFilter( props, specialEasing ) { - var value, name, index, easing, hooks; - - // camelCase, specialEasing and expand cssHook pass - for ( index in props ) { - name = jQuery.camelCase( index ); - easing = specialEasing[ name ]; - value = props[ index ]; - if ( jQuery.isArray( value ) ) { - easing = value[ 1 ]; - value = props[ index ] = value[ 0 ]; - } - - if ( index !== name ) { - props[ name ] = value; - delete props[ index ]; - } - - hooks = jQuery.cssHooks[ name ]; - if ( hooks && "expand" in hooks ) { - value = hooks.expand( value ); - delete props[ name ]; - - // not quite $.extend, this wont overwrite keys already present. - // also - reusing 'index' from above because we have the correct "name" - for ( index in value ) { - if ( !( index in props ) ) { - props[ index ] = value[ index ]; - specialEasing[ index ] = easing; - } - } - } else { - specialEasing[ name ] = easing; - } - } -} - -jQuery.Animation = jQuery.extend( Animation, { - - tweener: function( props, callback ) { - if ( jQuery.isFunction( props ) ) { - callback = props; - props = [ "*" ]; - } else { - props = props.split(" "); - } - - var prop, - index = 0, - length = props.length; - - for ( ; index < length ; index++ ) { - prop = props[ index ]; - tweeners[ prop ] = tweeners[ prop ] || []; - tweeners[ prop ].unshift( callback ); - } - }, - - prefilter: function( callback, prepend ) { - if ( prepend ) { - animationPrefilters.unshift( callback ); - } else { - animationPrefilters.push( callback ); - } - } -}); - -function defaultPrefilter( elem, props, opts ) { - /*jshint validthis:true */ - var prop, index, length, - value, dataShow, toggle, - tween, hooks, oldfire, - anim = this, - style = elem.style, - orig = {}, - handled = [], - hidden = elem.nodeType && isHidden( elem ); - - // handle queue: false promises - if ( !opts.queue ) { - hooks = jQuery._queueHooks( elem, "fx" ); - if ( hooks.unqueued == null ) { - hooks.unqueued = 0; - oldfire = hooks.empty.fire; - hooks.empty.fire = function() { - if ( !hooks.unqueued ) { - oldfire(); - } - }; - } - hooks.unqueued++; - - anim.always(function() { - // doing this makes sure that the complete handler will be called - // before this completes - anim.always(function() { - hooks.unqueued--; - if ( !jQuery.queue( elem, "fx" ).length ) { - hooks.empty.fire(); - } - }); - }); - } - - // height/width overflow pass - if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { - // Make sure that nothing sneaks out - // Record all 3 overflow attributes because IE does not - // change the overflow attribute when overflowX and - // overflowY are set to the same value - opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; - - // Set display property to inline-block for height/width - // animations on inline elements that are having width/height animated - if ( jQuery.css( elem, "display" ) === "inline" && - jQuery.css( elem, "float" ) === "none" ) { - - // inline-level elements accept inline-block; - // block-level elements need to be inline with layout - if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { - style.display = "inline-block"; - - } else { - style.zoom = 1; - } - } - } - - if ( opts.overflow ) { - style.overflow = "hidden"; - if ( !jQuery.support.shrinkWrapBlocks ) { - anim.always(function() { - style.overflow = opts.overflow[ 0 ]; - style.overflowX = opts.overflow[ 1 ]; - style.overflowY = opts.overflow[ 2 ]; - }); - } - } - - - // show/hide pass - for ( index in props ) { - value = props[ index ]; - if ( rfxtypes.exec( value ) ) { - delete props[ index ]; - toggle = toggle || value === "toggle"; - if ( value === ( hidden ? "hide" : "show" ) ) { - continue; - } - handled.push( index ); - } - } - - length = handled.length; - if ( length ) { - dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); - if ( "hidden" in dataShow ) { - hidden = dataShow.hidden; - } - - // store state if its toggle - enables .stop().toggle() to "reverse" - if ( toggle ) { - dataShow.hidden = !hidden; - } - if ( hidden ) { - jQuery( elem ).show(); - } else { - anim.done(function() { - jQuery( elem ).hide(); - }); - } - anim.done(function() { - var prop; - jQuery._removeData( elem, "fxshow" ); - for ( prop in orig ) { - jQuery.style( elem, prop, orig[ prop ] ); - } - }); - for ( index = 0 ; index < length ; index++ ) { - prop = handled[ index ]; - tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); - orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); - - if ( !( prop in dataShow ) ) { - dataShow[ prop ] = tween.start; - if ( hidden ) { - tween.end = tween.start; - tween.start = prop === "width" || prop === "height" ? 1 : 0; - } - } - } - } -} - -function Tween( elem, options, prop, end, easing ) { - return new Tween.prototype.init( elem, options, prop, end, easing ); -} -jQuery.Tween = Tween; - -Tween.prototype = { - constructor: Tween, - init: function( elem, options, prop, end, easing, unit ) { - this.elem = elem; - this.prop = prop; - this.easing = easing || "swing"; - this.options = options; - this.start = this.now = this.cur(); - this.end = end; - this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); - }, - cur: function() { - var hooks = Tween.propHooks[ this.prop ]; - - return hooks && hooks.get ? - hooks.get( this ) : - Tween.propHooks._default.get( this ); - }, - run: function( percent ) { - var eased, - hooks = Tween.propHooks[ this.prop ]; - - if ( this.options.duration ) { - this.pos = eased = jQuery.easing[ this.easing ]( - percent, this.options.duration * percent, 0, 1, this.options.duration - ); - } else { - this.pos = eased = percent; - } - this.now = ( this.end - this.start ) * eased + this.start; - - if ( this.options.step ) { - this.options.step.call( this.elem, this.now, this ); - } - - if ( hooks && hooks.set ) { - hooks.set( this ); - } else { - Tween.propHooks._default.set( this ); - } - return this; - } -}; - -Tween.prototype.init.prototype = Tween.prototype; - -Tween.propHooks = { - _default: { - get: function( tween ) { - var result; - - if ( tween.elem[ tween.prop ] != null && - (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { - return tween.elem[ tween.prop ]; - } - - // passing an empty string as a 3rd parameter to .css will automatically - // attempt a parseFloat and fallback to a string if the parse fails - // so, simple values such as "10px" are parsed to Float. - // complex values such as "rotate(1rad)" are returned as is. - result = jQuery.css( tween.elem, tween.prop, "" ); - // Empty strings, null, undefined and "auto" are converted to 0. - return !result || result === "auto" ? 0 : result; - }, - set: function( tween ) { - // use step hook for back compat - use cssHook if its there - use .style if its - // available and use plain properties where available - if ( jQuery.fx.step[ tween.prop ] ) { - jQuery.fx.step[ tween.prop ]( tween ); - } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { - jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); - } else { - tween.elem[ tween.prop ] = tween.now; - } - } - } -}; - -// Remove in 2.0 - this supports IE8's panic based approach -// to setting things on disconnected nodes - -Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { - set: function( tween ) { - if ( tween.elem.nodeType && tween.elem.parentNode ) { - tween.elem[ tween.prop ] = tween.now; - } - } -}; - -jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { - var cssFn = jQuery.fn[ name ]; - jQuery.fn[ name ] = function( speed, easing, callback ) { - return speed == null || typeof speed === "boolean" ? - cssFn.apply( this, arguments ) : - this.animate( genFx( name, true ), speed, easing, callback ); - }; -}); - -jQuery.fn.extend({ - fadeTo: function( speed, to, easing, callback ) { - - // show any hidden elements after setting opacity to 0 - return this.filter( isHidden ).css( "opacity", 0 ).show() - - // animate to the value specified - .end().animate({ opacity: to }, speed, easing, callback ); - }, - animate: function( prop, speed, easing, callback ) { - var empty = jQuery.isEmptyObject( prop ), - optall = jQuery.speed( speed, easing, callback ), - doAnimation = function() { - // Operate on a copy of prop so per-property easing won't be lost - var anim = Animation( this, jQuery.extend( {}, prop ), optall ); - doAnimation.finish = function() { - anim.stop( true ); - }; - // Empty animations, or finishing resolves immediately - if ( empty || jQuery._data( this, "finish" ) ) { - anim.stop( true ); - } - }; - doAnimation.finish = doAnimation; - - return empty || optall.queue === false ? - this.each( doAnimation ) : - this.queue( optall.queue, doAnimation ); - }, - stop: function( type, clearQueue, gotoEnd ) { - var stopQueue = function( hooks ) { - var stop = hooks.stop; - delete hooks.stop; - stop( gotoEnd ); - }; - - if ( typeof type !== "string" ) { - gotoEnd = clearQueue; - clearQueue = type; - type = undefined; - } - if ( clearQueue && type !== false ) { - this.queue( type || "fx", [] ); - } - - return this.each(function() { - var dequeue = true, - index = type != null && type + "queueHooks", - timers = jQuery.timers, - data = jQuery._data( this ); - - if ( index ) { - if ( data[ index ] && data[ index ].stop ) { - stopQueue( data[ index ] ); - } - } else { - for ( index in data ) { - if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { - stopQueue( data[ index ] ); - } - } - } - - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { - timers[ index ].anim.stop( gotoEnd ); - dequeue = false; - timers.splice( index, 1 ); - } - } - - // start the next in the queue if the last step wasn't forced - // timers currently will call their complete callbacks, which will dequeue - // but only if they were gotoEnd - if ( dequeue || !gotoEnd ) { - jQuery.dequeue( this, type ); - } - }); - }, - finish: function( type ) { - if ( type !== false ) { - type = type || "fx"; - } - return this.each(function() { - var index, - data = jQuery._data( this ), - queue = data[ type + "queue" ], - hooks = data[ type + "queueHooks" ], - timers = jQuery.timers, - length = queue ? queue.length : 0; - - // enable finishing flag on private data - data.finish = true; - - // empty the queue first - jQuery.queue( this, type, [] ); - - if ( hooks && hooks.cur && hooks.cur.finish ) { - hooks.cur.finish.call( this ); - } - - // look for any active animations, and finish them - for ( index = timers.length; index--; ) { - if ( timers[ index ].elem === this && timers[ index ].queue === type ) { - timers[ index ].anim.stop( true ); - timers.splice( index, 1 ); - } - } - - // look for any animations in the old queue and finish them - for ( index = 0; index < length; index++ ) { - if ( queue[ index ] && queue[ index ].finish ) { - queue[ index ].finish.call( this ); - } - } - - // turn off finishing flag - delete data.finish; - }); - } -}); - -// Generate parameters to create a standard animation -function genFx( type, includeWidth ) { - var which, - attrs = { height: type }, - i = 0; - - // if we include width, step value is 1 to do all cssExpand values, - // if we don't include width, step value is 2 to skip over Left and Right - includeWidth = includeWidth? 1 : 0; - for( ; i < 4 ; i += 2 - includeWidth ) { - which = cssExpand[ i ]; - attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; - } - - if ( includeWidth ) { - attrs.opacity = attrs.width = type; - } - - return attrs; -} - -// Generate shortcuts for custom animations -jQuery.each({ - slideDown: genFx("show"), - slideUp: genFx("hide"), - slideToggle: genFx("toggle"), - fadeIn: { opacity: "show" }, - fadeOut: { opacity: "hide" }, - fadeToggle: { opacity: "toggle" } -}, function( name, props ) { - jQuery.fn[ name ] = function( speed, easing, callback ) { - return this.animate( props, speed, easing, callback ); - }; -}); - -jQuery.speed = function( speed, easing, fn ) { - var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { - complete: fn || !fn && easing || - jQuery.isFunction( speed ) && speed, - duration: speed, - easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing - }; - - opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : - opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; - - // normalize opt.queue - true/undefined/null -> "fx" - if ( opt.queue == null || opt.queue === true ) { - opt.queue = "fx"; - } - - // Queueing - opt.old = opt.complete; - - opt.complete = function() { - if ( jQuery.isFunction( opt.old ) ) { - opt.old.call( this ); - } - - if ( opt.queue ) { - jQuery.dequeue( this, opt.queue ); - } - }; - - return opt; -}; - -jQuery.easing = { - linear: function( p ) { - return p; - }, - swing: function( p ) { - return 0.5 - Math.cos( p*Math.PI ) / 2; - } -}; - -jQuery.timers = []; -jQuery.fx = Tween.prototype.init; -jQuery.fx.tick = function() { - var timer, - timers = jQuery.timers, - i = 0; - - fxNow = jQuery.now(); - - for ( ; i < timers.length; i++ ) { - timer = timers[ i ]; - // Checks the timer has not already been removed - if ( !timer() && timers[ i ] === timer ) { - timers.splice( i--, 1 ); - } - } - - if ( !timers.length ) { - jQuery.fx.stop(); - } - fxNow = undefined; -}; - -jQuery.fx.timer = function( timer ) { - if ( timer() && jQuery.timers.push( timer ) ) { - jQuery.fx.start(); - } -}; - -jQuery.fx.interval = 13; - -jQuery.fx.start = function() { - if ( !timerId ) { - timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); - } -}; - -jQuery.fx.stop = function() { - clearInterval( timerId ); - timerId = null; -}; - -jQuery.fx.speeds = { - slow: 600, - fast: 200, - // Default speed - _default: 400 -}; - -// Back Compat <1.8 extension point -jQuery.fx.step = {}; - -if ( jQuery.expr && jQuery.expr.filters ) { - jQuery.expr.filters.animated = function( elem ) { - return jQuery.grep(jQuery.timers, function( fn ) { - return elem === fn.elem; - }).length; - }; -} -jQuery.fn.offset = function( options ) { - if ( arguments.length ) { - return options === undefined ? - this : - this.each(function( i ) { - jQuery.offset.setOffset( this, options, i ); - }); - } - - var docElem, win, - box = { top: 0, left: 0 }, - elem = this[ 0 ], - doc = elem && elem.ownerDocument; - - if ( !doc ) { - return; - } - - docElem = doc.documentElement; - - // Make sure it's not a disconnected DOM node - if ( !jQuery.contains( docElem, elem ) ) { - return box; - } - - // If we don't have gBCR, just use 0,0 rather than error - // BlackBerry 5, iOS 3 (original iPhone) - if ( typeof elem.getBoundingClientRect !== core_strundefined ) { - box = elem.getBoundingClientRect(); - } - win = getWindow( doc ); - return { - top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), - left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) - }; -}; - -jQuery.offset = { - - setOffset: function( elem, options, i ) { - var position = jQuery.css( elem, "position" ); - - // set position first, in-case top/left are set even on static elem - if ( position === "static" ) { - elem.style.position = "relative"; - } - - var curElem = jQuery( elem ), - curOffset = curElem.offset(), - curCSSTop = jQuery.css( elem, "top" ), - curCSSLeft = jQuery.css( elem, "left" ), - calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, - props = {}, curPosition = {}, curTop, curLeft; - - // need to be able to calculate position if either top or left is auto and position is either absolute or fixed - if ( calculatePosition ) { - curPosition = curElem.position(); - curTop = curPosition.top; - curLeft = curPosition.left; - } else { - curTop = parseFloat( curCSSTop ) || 0; - curLeft = parseFloat( curCSSLeft ) || 0; - } - - if ( jQuery.isFunction( options ) ) { - options = options.call( elem, i, curOffset ); - } - - if ( options.top != null ) { - props.top = ( options.top - curOffset.top ) + curTop; - } - if ( options.left != null ) { - props.left = ( options.left - curOffset.left ) + curLeft; - } - - if ( "using" in options ) { - options.using.call( elem, props ); - } else { - curElem.css( props ); - } - } -}; - - -jQuery.fn.extend({ - - position: function() { - if ( !this[ 0 ] ) { - return; - } - - var offsetParent, offset, - parentOffset = { top: 0, left: 0 }, - elem = this[ 0 ]; - - // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent - if ( jQuery.css( elem, "position" ) === "fixed" ) { - // we assume that getBoundingClientRect is available when computed position is fixed - offset = elem.getBoundingClientRect(); - } else { - // Get *real* offsetParent - offsetParent = this.offsetParent(); - - // Get correct offsets - offset = this.offset(); - if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { - parentOffset = offsetParent.offset(); - } - - // Add offsetParent borders - parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); - parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); - } - - // Subtract parent offsets and element margins - // note: when an element has margin: auto the offsetLeft and marginLeft - // are the same in Safari causing offset.left to incorrectly be 0 - return { - top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), - left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) - }; - }, - - offsetParent: function() { - return this.map(function() { - var offsetParent = this.offsetParent || document.documentElement; - while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) { - offsetParent = offsetParent.offsetParent; - } - return offsetParent || document.documentElement; - }); - } -}); - - -// Create scrollLeft and scrollTop methods -jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { - var top = /Y/.test( prop ); - - jQuery.fn[ method ] = function( val ) { - return jQuery.access( this, function( elem, method, val ) { - var win = getWindow( elem ); - - if ( val === undefined ) { - return win ? (prop in win) ? win[ prop ] : - win.document.documentElement[ method ] : - elem[ method ]; - } - - if ( win ) { - win.scrollTo( - !top ? val : jQuery( win ).scrollLeft(), - top ? val : jQuery( win ).scrollTop() - ); - - } else { - elem[ method ] = val; - } - }, method, val, arguments.length, null ); - }; -}); - -function getWindow( elem ) { - return jQuery.isWindow( elem ) ? - elem : - elem.nodeType === 9 ? - elem.defaultView || elem.parentWindow : - false; -} -// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods -jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { - jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { - // margin is only for outerHeight, outerWidth - jQuery.fn[ funcName ] = function( margin, value ) { - var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), - extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); - - return jQuery.access( this, function( elem, type, value ) { - var doc; - - if ( jQuery.isWindow( elem ) ) { - // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there - // isn't a whole lot we can do. See pull request at this URL for discussion: - // https://github.com/jquery/jquery/pull/764 - return elem.document.documentElement[ "client" + name ]; - } - - // Get document width or height - if ( elem.nodeType === 9 ) { - doc = elem.documentElement; - - // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest - // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. - return Math.max( - elem.body[ "scroll" + name ], doc[ "scroll" + name ], - elem.body[ "offset" + name ], doc[ "offset" + name ], - doc[ "client" + name ] - ); - } - - return value === undefined ? - // Get width or height on the element, requesting but not forcing parseFloat - jQuery.css( elem, type, extra ) : - - // Set width or height on the element - jQuery.style( elem, type, value, extra ); - }, type, chainable ? margin : undefined, chainable, null ); - }; - }); -}); -// Limit scope pollution from any deprecated API -// (function() { - -// })(); -// Expose jQuery to the global object -window.jQuery = window.$ = jQuery; - -// Expose jQuery as an AMD module, but only for AMD loaders that -// understand the issues with loading multiple versions of jQuery -// in a page that all might call define(). The loader will indicate -// they have special allowances for multiple jQuery versions by -// specifying define.amd.jQuery = true. Register as a named module, -// since jQuery can be concatenated with other files that may use define, -// but not use a proper concatenation script that understands anonymous -// AMD modules. A named AMD is safest and most robust way to register. -// Lowercase jquery is used because AMD module names are derived from -// file names, and jQuery is normally delivered in a lowercase file name. -// Do this after creating the global so that if an AMD module wants to call -// noConflict to hide this version of jQuery, it will work. -if ( typeof define === "function" && define.amd && define.amd.jQuery ) { - define( "jquery", [], function () { return jQuery; } ); -} - -})( window );// Underscore.js 1.8.2 -// http://underscorejs.org -// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -// Underscore may be freely distributed under the MIT license. - -(function() { - - // Baseline setup - // -------------- - - // Establish the root object, `window` in the browser, or `exports` on the server. - var root = this; - - // Save the previous value of the `_` variable. - var previousUnderscore = root._; - - // Save bytes in the minified (but not gzipped) version: - var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; - - // Create quick reference variables for speed access to core prototypes. - var - push = ArrayProto.push, - slice = ArrayProto.slice, - toString = ObjProto.toString, - hasOwnProperty = ObjProto.hasOwnProperty; - - // All **ECMAScript 5** native function implementations that we hope to use - // are declared here. - var - nativeIsArray = Array.isArray, - nativeKeys = Object.keys, - nativeBind = FuncProto.bind, - nativeCreate = Object.create; - - // Naked function reference for surrogate-prototype-swapping. - var Ctor = function(){}; - - // Create a safe reference to the Underscore object for use below. - var _ = function(obj) { - if (obj instanceof _) return obj; - if (!(this instanceof _)) return new _(obj); - this._wrapped = obj; - }; - - // Export the Underscore object for **Node.js**, with - // backwards-compatibility for the old `require()` API. If we're in - // the browser, add `_` as a global object. - if (typeof exports !== 'undefined') { - if (typeof module !== 'undefined' && module.exports) { - exports = module.exports = _; - } - exports._ = _; - } else { - root._ = _; - } - - // Current version. - _.VERSION = '1.8.2'; - - // Internal function that returns an efficient (for current engines) version - // of the passed-in callback, to be repeatedly applied in other Underscore - // functions. - var optimizeCb = function(func, context, argCount) { - if (context === void 0) return func; - switch (argCount == null ? 3 : argCount) { - case 1: return function(value) { - return func.call(context, value); - }; - case 2: return function(value, other) { - return func.call(context, value, other); - }; - case 3: return function(value, index, collection) { - return func.call(context, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(context, accumulator, value, index, collection); - }; - } - return function() { - return func.apply(context, arguments); - }; - }; - - // A mostly-internal function to generate callbacks that can be applied - // to each element in a collection, returning the desired result 鈥? either - // identity, an arbitrary callback, a property matcher, or a property accessor. - var cb = function(value, context, argCount) { - if (value == null) return _.identity; - if (_.isFunction(value)) return optimizeCb(value, context, argCount); - if (_.isObject(value)) return _.matcher(value); - return _.property(value); - }; - _.iteratee = function(value, context) { - return cb(value, context, Infinity); - }; - - // An internal function for creating assigner functions. - var createAssigner = function(keysFunc, undefinedOnly) { - return function(obj) { - var length = arguments.length; - if (length < 2 || obj == null) return obj; - for (var index = 1; index < length; index++) { - var source = arguments[index], - keys = keysFunc(source), - l = keys.length; - for (var i = 0; i < l; i++) { - var key = keys[i]; - if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key]; - } - } - return obj; - }; - }; - - // An internal function for creating a new object that inherits from another. - var baseCreate = function(prototype) { - if (!_.isObject(prototype)) return {}; - if (nativeCreate) return nativeCreate(prototype); - Ctor.prototype = prototype; - var result = new Ctor; - Ctor.prototype = null; - return result; - }; - - // Helper for collection methods to determine whether a collection - // should be iterated as an array or as an object - // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength - var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; - var isArrayLike = function(collection) { - var length = collection != null && collection.length; - return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; - }; - - // Collection Functions - // -------------------- - - // The cornerstone, an `each` implementation, aka `forEach`. - // Handles raw objects in addition to array-likes. Treats all - // sparse array-likes as if they were dense. - _.each = _.forEach = function(obj, iteratee, context) { - iteratee = optimizeCb(iteratee, context); - var i, length; - if (isArrayLike(obj)) { - for (i = 0, length = obj.length; i < length; i++) { - iteratee(obj[i], i, obj); - } - } else { - var keys = _.keys(obj); - for (i = 0, length = keys.length; i < length; i++) { - iteratee(obj[keys[i]], keys[i], obj); - } - } - return obj; - }; - - // Return the results of applying the iteratee to each element. - _.map = _.collect = function(obj, iteratee, context) { - iteratee = cb(iteratee, context); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length, - results = Array(length); - for (var index = 0; index < length; index++) { - var currentKey = keys ? keys[index] : index; - results[index] = iteratee(obj[currentKey], currentKey, obj); - } - return results; - }; - - // Create a reducing function iterating left or right. - function createReduce(dir) { - // Optimized iterator function as using arguments.length - // in the main function will deoptimize the, see #1991. - function iterator(obj, iteratee, memo, keys, index, length) { - for (; index >= 0 && index < length; index += dir) { - var currentKey = keys ? keys[index] : index; - memo = iteratee(memo, obj[currentKey], currentKey, obj); - } - return memo; - } - - return function(obj, iteratee, memo, context) { - iteratee = optimizeCb(iteratee, context, 4); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length, - index = dir > 0 ? 0 : length - 1; - // Determine the initial value if none is provided. - if (arguments.length < 3) { - memo = obj[keys ? keys[index] : index]; - index += dir; - } - return iterator(obj, iteratee, memo, keys, index, length); - }; - } - - // **Reduce** builds up a single result from a list of values, aka `inject`, - // or `foldl`. - _.reduce = _.foldl = _.inject = createReduce(1); - - // The right-associative version of reduce, also known as `foldr`. - _.reduceRight = _.foldr = createReduce(-1); - - // Return the first value which passes a truth test. Aliased as `detect`. - _.find = _.detect = function(obj, predicate, context) { - var key; - if (isArrayLike(obj)) { - key = _.findIndex(obj, predicate, context); - } else { - key = _.findKey(obj, predicate, context); - } - if (key !== void 0 && key !== -1) return obj[key]; - }; - - // Return all the elements that pass a truth test. - // Aliased as `select`. - _.filter = _.select = function(obj, predicate, context) { - var results = []; - predicate = cb(predicate, context); - _.each(obj, function(value, index, list) { - if (predicate(value, index, list)) results.push(value); - }); - return results; - }; - - // Return all the elements for which a truth test fails. - _.reject = function(obj, predicate, context) { - return _.filter(obj, _.negate(cb(predicate)), context); - }; - - // Determine whether all of the elements match a truth test. - // Aliased as `all`. - _.every = _.all = function(obj, predicate, context) { - predicate = cb(predicate, context); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length; - for (var index = 0; index < length; index++) { - var currentKey = keys ? keys[index] : index; - if (!predicate(obj[currentKey], currentKey, obj)) return false; - } - return true; - }; - - // Determine if at least one element in the object matches a truth test. - // Aliased as `any`. - _.some = _.any = function(obj, predicate, context) { - predicate = cb(predicate, context); - var keys = !isArrayLike(obj) && _.keys(obj), - length = (keys || obj).length; - for (var index = 0; index < length; index++) { - var currentKey = keys ? keys[index] : index; - if (predicate(obj[currentKey], currentKey, obj)) return true; - } - return false; - }; - - // Determine if the array or object contains a given value (using `===`). - // Aliased as `includes` and `include`. - _.contains = _.includes = _.include = function(obj, target, fromIndex) { - if (!isArrayLike(obj)) obj = _.values(obj); - return _.indexOf(obj, target, typeof fromIndex == 'number' && fromIndex) >= 0; - }; - - // Invoke a method (with arguments) on every item in a collection. - _.invoke = function(obj, method) { - var args = slice.call(arguments, 2); - var isFunc = _.isFunction(method); - return _.map(obj, function(value) { - var func = isFunc ? method : value[method]; - return func == null ? func : func.apply(value, args); - }); - }; - - // Convenience version of a common use case of `map`: fetching a property. - _.pluck = function(obj, key) { - return _.map(obj, _.property(key)); - }; - - // Convenience version of a common use case of `filter`: selecting only objects - // containing specific `key:value` pairs. - _.where = function(obj, attrs) { - return _.filter(obj, _.matcher(attrs)); - }; - - // Convenience version of a common use case of `find`: getting the first object - // containing specific `key:value` pairs. - _.findWhere = function(obj, attrs) { - return _.find(obj, _.matcher(attrs)); - }; - - // Return the maximum element (or element-based computation). - _.max = function(obj, iteratee, context) { - var result = -Infinity, lastComputed = -Infinity, - value, computed; - if (iteratee == null && obj != null) { - obj = isArrayLike(obj) ? obj : _.values(obj); - for (var i = 0, length = obj.length; i < length; i++) { - value = obj[i]; - if (value > result) { - result = value; - } - } - } else { - iteratee = cb(iteratee, context); - _.each(obj, function(value, index, list) { - computed = iteratee(value, index, list); - if (computed > lastComputed || computed === -Infinity && result === -Infinity) { - result = value; - lastComputed = computed; - } - }); - } - return result; - }; - - // Return the minimum element (or element-based computation). - _.min = function(obj, iteratee, context) { - var result = Infinity, lastComputed = Infinity, - value, computed; - if (iteratee == null && obj != null) { - obj = isArrayLike(obj) ? obj : _.values(obj); - for (var i = 0, length = obj.length; i < length; i++) { - value = obj[i]; - if (value < result) { - result = value; - } - } - } else { - iteratee = cb(iteratee, context); - _.each(obj, function(value, index, list) { - computed = iteratee(value, index, list); - if (computed < lastComputed || computed === Infinity && result === Infinity) { - result = value; - lastComputed = computed; - } - }); - } - return result; - }; - - // Shuffle a collection, using the modern version of the - // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher鈥揧ates_shuffle). - _.shuffle = function(obj) { - var set = isArrayLike(obj) ? obj : _.values(obj); - var length = set.length; - var shuffled = Array(length); - for (var index = 0, rand; index < length; index++) { - rand = _.random(0, index); - if (rand !== index) shuffled[index] = shuffled[rand]; - shuffled[rand] = set[index]; - } - return shuffled; - }; - - // Sample **n** random values from a collection. - // If **n** is not specified, returns a single random element. - // The internal `guard` argument allows it to work with `map`. - _.sample = function(obj, n, guard) { - if (n == null || guard) { - if (!isArrayLike(obj)) obj = _.values(obj); - return obj[_.random(obj.length - 1)]; - } - return _.shuffle(obj).slice(0, Math.max(0, n)); - }; - - // Sort the object's values by a criterion produced by an iteratee. - _.sortBy = function(obj, iteratee, context) { - iteratee = cb(iteratee, context); - return _.pluck(_.map(obj, function(value, index, list) { - return { - value: value, - index: index, - criteria: iteratee(value, index, list) - }; - }).sort(function(left, right) { - var a = left.criteria; - var b = right.criteria; - if (a !== b) { - if (a > b || a === void 0) return 1; - if (a < b || b === void 0) return -1; - } - return left.index - right.index; - }), 'value'); - }; - - // An internal function used for aggregate "group by" operations. - var group = function(behavior) { - return function(obj, iteratee, context) { - var result = {}; - iteratee = cb(iteratee, context); - _.each(obj, function(value, index) { - var key = iteratee(value, index, obj); - behavior(result, value, key); - }); - return result; - }; - }; - - // Groups the object's values by a criterion. Pass either a string attribute - // to group by, or a function that returns the criterion. - _.groupBy = group(function(result, value, key) { - if (_.has(result, key)) result[key].push(value); else result[key] = [value]; - }); - - // Indexes the object's values by a criterion, similar to `groupBy`, but for - // when you know that your index values will be unique. - _.indexBy = group(function(result, value, key) { - result[key] = value; - }); - - // Counts instances of an object that group by a certain criterion. Pass - // either a string attribute to count by, or a function that returns the - // criterion. - _.countBy = group(function(result, value, key) { - if (_.has(result, key)) result[key]++; else result[key] = 1; - }); - - // Safely create a real, live array from anything iterable. - _.toArray = function(obj) { - if (!obj) return []; - if (_.isArray(obj)) return slice.call(obj); - if (isArrayLike(obj)) return _.map(obj, _.identity); - return _.values(obj); - }; - - // Return the number of elements in an object. - _.size = function(obj) { - if (obj == null) return 0; - return isArrayLike(obj) ? obj.length : _.keys(obj).length; - }; - - // Split a collection into two arrays: one whose elements all satisfy the given - // predicate, and one whose elements all do not satisfy the predicate. - _.partition = function(obj, predicate, context) { - predicate = cb(predicate, context); - var pass = [], fail = []; - _.each(obj, function(value, key, obj) { - (predicate(value, key, obj) ? pass : fail).push(value); - }); - return [pass, fail]; - }; - - // Array Functions - // --------------- - - // Get the first element of an array. Passing **n** will return the first N - // values in the array. Aliased as `head` and `take`. The **guard** check - // allows it to work with `_.map`. - _.first = _.head = _.take = function(array, n, guard) { - if (array == null) return void 0; - if (n == null || guard) return array[0]; - return _.initial(array, array.length - n); - }; - - // Returns everything but the last entry of the array. Especially useful on - // the arguments object. Passing **n** will return all the values in - // the array, excluding the last N. - _.initial = function(array, n, guard) { - return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); - }; - - // Get the last element of an array. Passing **n** will return the last N - // values in the array. - _.last = function(array, n, guard) { - if (array == null) return void 0; - if (n == null || guard) return array[array.length - 1]; - return _.rest(array, Math.max(0, array.length - n)); - }; - - // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. - // Especially useful on the arguments object. Passing an **n** will return - // the rest N values in the array. - _.rest = _.tail = _.drop = function(array, n, guard) { - return slice.call(array, n == null || guard ? 1 : n); - }; - - // Trim out all falsy values from an array. - _.compact = function(array) { - return _.filter(array, _.identity); - }; - - // Internal implementation of a recursive `flatten` function. - var flatten = function(input, shallow, strict, startIndex) { - var output = [], idx = 0; - for (var i = startIndex || 0, length = input && input.length; i < length; i++) { - var value = input[i]; - if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) { - //flatten current level of array or arguments object - if (!shallow) value = flatten(value, shallow, strict); - var j = 0, len = value.length; - output.length += len; - while (j < len) { - output[idx++] = value[j++]; - } - } else if (!strict) { - output[idx++] = value; - } - } - return output; - }; - - // Flatten out an array, either recursively (by default), or just one level. - _.flatten = function(array, shallow) { - return flatten(array, shallow, false); - }; - - // Return a version of the array that does not contain the specified value(s). - _.without = function(array) { - return _.difference(array, slice.call(arguments, 1)); - }; - - // Produce a duplicate-free version of the array. If the array has already - // been sorted, you have the option of using a faster algorithm. - // Aliased as `unique`. - _.uniq = _.unique = function(array, isSorted, iteratee, context) { - if (array == null) return []; - if (!_.isBoolean(isSorted)) { - context = iteratee; - iteratee = isSorted; - isSorted = false; - } - if (iteratee != null) iteratee = cb(iteratee, context); - var result = []; - var seen = []; - for (var i = 0, length = array.length; i < length; i++) { - var value = array[i], - computed = iteratee ? iteratee(value, i, array) : value; - if (isSorted) { - if (!i || seen !== computed) result.push(value); - seen = computed; - } else if (iteratee) { - if (!_.contains(seen, computed)) { - seen.push(computed); - result.push(value); - } - } else if (!_.contains(result, value)) { - result.push(value); - } - } - return result; - }; - - // Produce an array that contains the union: each distinct element from all of - // the passed-in arrays. - _.union = function() { - return _.uniq(flatten(arguments, true, true)); - }; - - // Produce an array that contains every item shared between all the - // passed-in arrays. - _.intersection = function(array) { - if (array == null) return []; - var result = []; - var argsLength = arguments.length; - for (var i = 0, length = array.length; i < length; i++) { - var item = array[i]; - if (_.contains(result, item)) continue; - for (var j = 1; j < argsLength; j++) { - if (!_.contains(arguments[j], item)) break; - } - if (j === argsLength) result.push(item); - } - return result; - }; - - // Take the difference between one array and a number of other arrays. - // Only the elements present in just the first array will remain. - _.difference = function(array) { - var rest = flatten(arguments, true, true, 1); - return _.filter(array, function(value){ - return !_.contains(rest, value); - }); - }; - - // Zip together multiple lists into a single array -- elements that share - // an index go together. - _.zip = function() { - return _.unzip(arguments); - }; - - // Complement of _.zip. Unzip accepts an array of arrays and groups - // each array's elements on shared indices - _.unzip = function(array) { - var length = array && _.max(array, 'length').length || 0; - var result = Array(length); - - for (var index = 0; index < length; index++) { - result[index] = _.pluck(array, index); - } - return result; - }; - - // Converts lists into objects. Pass either a single array of `[key, value]` - // pairs, or two parallel arrays of the same length -- one of keys, and one of - // the corresponding values. - _.object = function(list, values) { - var result = {}; - for (var i = 0, length = list && list.length; i < length; i++) { - if (values) { - result[list[i]] = values[i]; - } else { - result[list[i][0]] = list[i][1]; - } - } - return result; - }; - - // Return the position of the first occurrence of an item in an array, - // or -1 if the item is not included in the array. - // If the array is large and already in sort order, pass `true` - // for **isSorted** to use binary search. - _.indexOf = function(array, item, isSorted) { - var i = 0, length = array && array.length; - if (typeof isSorted == 'number') { - i = isSorted < 0 ? Math.max(0, length + isSorted) : isSorted; - } else if (isSorted && length) { - i = _.sortedIndex(array, item); - return array[i] === item ? i : -1; - } - if (item !== item) { - return _.findIndex(slice.call(array, i), _.isNaN); - } - for (; i < length; i++) if (array[i] === item) return i; - return -1; - }; - - _.lastIndexOf = function(array, item, from) { - var idx = array ? array.length : 0; - if (typeof from == 'number') { - idx = from < 0 ? idx + from + 1 : Math.min(idx, from + 1); - } - if (item !== item) { - return _.findLastIndex(slice.call(array, 0, idx), _.isNaN); - } - while (--idx >= 0) if (array[idx] === item) return idx; - return -1; - }; - - // Generator function to create the findIndex and findLastIndex functions - function createIndexFinder(dir) { - return function(array, predicate, context) { - predicate = cb(predicate, context); - var length = array != null && array.length; - var index = dir > 0 ? 0 : length - 1; - for (; index >= 0 && index < length; index += dir) { - if (predicate(array[index], index, array)) return index; - } - return -1; - }; - } - - // Returns the first index on an array-like that passes a predicate test - _.findIndex = createIndexFinder(1); - - _.findLastIndex = createIndexFinder(-1); - - // Use a comparator function to figure out the smallest index at which - // an object should be inserted so as to maintain order. Uses binary search. - _.sortedIndex = function(array, obj, iteratee, context) { - iteratee = cb(iteratee, context, 1); - var value = iteratee(obj); - var low = 0, high = array.length; - while (low < high) { - var mid = Math.floor((low + high) / 2); - if (iteratee(array[mid]) < value) low = mid + 1; else high = mid; - } - return low; - }; - - // Generate an integer Array containing an arithmetic progression. A port of - // the native Python `range()` function. See - // [the Python documentation](http://docs.python.org/library/functions.html#range). - _.range = function(start, stop, step) { - if (arguments.length <= 1) { - stop = start || 0; - start = 0; - } - step = step || 1; - - var length = Math.max(Math.ceil((stop - start) / step), 0); - var range = Array(length); - - for (var idx = 0; idx < length; idx++, start += step) { - range[idx] = start; - } - - return range; - }; - - // Function (ahem) Functions - // ------------------ - - // Determines whether to execute a function as a constructor - // or a normal function with the provided arguments - var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) { - if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); - var self = baseCreate(sourceFunc.prototype); - var result = sourceFunc.apply(self, args); - if (_.isObject(result)) return result; - return self; - }; - - // Create a function bound to a given object (assigning `this`, and arguments, - // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if - // available. - _.bind = function(func, context) { - if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); - if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function'); - var args = slice.call(arguments, 2); - var bound = function() { - return executeBound(func, bound, context, this, args.concat(slice.call(arguments))); - }; - return bound; - }; - - // Partially apply a function by creating a version that has had some of its - // arguments pre-filled, without changing its dynamic `this` context. _ acts - // as a placeholder, allowing any combination of arguments to be pre-filled. - _.partial = function(func) { - var boundArgs = slice.call(arguments, 1); - var bound = function() { - var position = 0, length = boundArgs.length; - var args = Array(length); - for (var i = 0; i < length; i++) { - args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i]; - } - while (position < arguments.length) args.push(arguments[position++]); - return executeBound(func, bound, this, this, args); - }; - return bound; - }; - - // Bind a number of an object's methods to that object. Remaining arguments - // are the method names to be bound. Useful for ensuring that all callbacks - // defined on an object belong to it. - _.bindAll = function(obj) { - var i, length = arguments.length, key; - if (length <= 1) throw new Error('bindAll must be passed function names'); - for (i = 1; i < length; i++) { - key = arguments[i]; - obj[key] = _.bind(obj[key], obj); - } - return obj; - }; - - // Memoize an expensive function by storing its results. - _.memoize = function(func, hasher) { - var memoize = function(key) { - var cache = memoize.cache; - var address = '' + (hasher ? hasher.apply(this, arguments) : key); - if (!_.has(cache, address)) cache[address] = func.apply(this, arguments); - return cache[address]; - }; - memoize.cache = {}; - return memoize; - }; - - // Delays a function for the given number of milliseconds, and then calls - // it with the arguments supplied. - _.delay = function(func, wait) { - var args = slice.call(arguments, 2); - return setTimeout(function(){ - return func.apply(null, args); - }, wait); - }; - - // Defers a function, scheduling it to run after the current call stack has - // cleared. - _.defer = _.partial(_.delay, _, 1); - - // Returns a function, that, when invoked, will only be triggered at most once - // during a given window of time. Normally, the throttled function will run - // as much as it can, without ever going more than once per `wait` duration; - // but if you'd like to disable the execution on the leading edge, pass - // `{leading: false}`. To disable execution on the trailing edge, ditto. - _.throttle = function(func, wait, options) { - var context, args, result; - var timeout = null; - var previous = 0; - if (!options) options = {}; - var later = function() { - previous = options.leading === false ? 0 : _.now(); - timeout = null; - result = func.apply(context, args); - if (!timeout) context = args = null; - }; - return function() { - var now = _.now(); - if (!previous && options.leading === false) previous = now; - var remaining = wait - (now - previous); - context = this; - args = arguments; - if (remaining <= 0 || remaining > wait) { - if (timeout) { - clearTimeout(timeout); - timeout = null; - } - previous = now; - result = func.apply(context, args); - if (!timeout) context = args = null; - } else if (!timeout && options.trailing !== false) { - timeout = setTimeout(later, remaining); - } - return result; - }; - }; - - // Returns a function, that, as long as it continues to be invoked, will not - // be triggered. The function will be called after it stops being called for - // N milliseconds. If `immediate` is passed, trigger the function on the - // leading edge, instead of the trailing. - _.debounce = function(func, wait, immediate) { - var timeout, args, context, timestamp, result; - - var later = function() { - var last = _.now() - timestamp; - - if (last < wait && last >= 0) { - timeout = setTimeout(later, wait - last); - } else { - timeout = null; - if (!immediate) { - result = func.apply(context, args); - if (!timeout) context = args = null; - } - } - }; - - return function() { - context = this; - args = arguments; - timestamp = _.now(); - var callNow = immediate && !timeout; - if (!timeout) timeout = setTimeout(later, wait); - if (callNow) { - result = func.apply(context, args); - context = args = null; - } - - return result; - }; - }; - - // Returns the first function passed as an argument to the second, - // allowing you to adjust arguments, run code before and after, and - // conditionally execute the original function. - _.wrap = function(func, wrapper) { - return _.partial(wrapper, func); - }; - - // Returns a negated version of the passed-in predicate. - _.negate = function(predicate) { - return function() { - return !predicate.apply(this, arguments); - }; - }; - - // Returns a function that is the composition of a list of functions, each - // consuming the return value of the function that follows. - _.compose = function() { - var args = arguments; - var start = args.length - 1; - return function() { - var i = start; - var result = args[start].apply(this, arguments); - while (i--) result = args[i].call(this, result); - return result; - }; - }; - - // Returns a function that will only be executed on and after the Nth call. - _.after = function(times, func) { - return function() { - if (--times < 1) { - return func.apply(this, arguments); - } - }; - }; - - // Returns a function that will only be executed up to (but not including) the Nth call. - _.before = function(times, func) { - var memo; - return function() { - if (--times > 0) { - memo = func.apply(this, arguments); - } - if (times <= 1) func = null; - return memo; - }; - }; - - // Returns a function that will be executed at most one time, no matter how - // often you call it. Useful for lazy initialization. - _.once = _.partial(_.before, 2); - - // Object Functions - // ---------------- - - // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. - var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString'); - var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString', - 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; - - function collectNonEnumProps(obj, keys) { - var nonEnumIdx = nonEnumerableProps.length; - var constructor = obj.constructor; - var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto; - - // Constructor is a special case. - var prop = 'constructor'; - if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop); - - while (nonEnumIdx--) { - prop = nonEnumerableProps[nonEnumIdx]; - if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) { - keys.push(prop); - } - } - } - - // Retrieve the names of an object's own properties. - // Delegates to **ECMAScript 5**'s native `Object.keys` - _.keys = function(obj) { - if (!_.isObject(obj)) return []; - if (nativeKeys) return nativeKeys(obj); - var keys = []; - for (var key in obj) if (_.has(obj, key)) keys.push(key); - // Ahem, IE < 9. - if (hasEnumBug) collectNonEnumProps(obj, keys); - return keys; - }; - - // Retrieve all the property names of an object. - _.allKeys = function(obj) { - if (!_.isObject(obj)) return []; - var keys = []; - for (var key in obj) keys.push(key); - // Ahem, IE < 9. - if (hasEnumBug) collectNonEnumProps(obj, keys); - return keys; - }; - - // Retrieve the values of an object's properties. - _.values = function(obj) { - var keys = _.keys(obj); - var length = keys.length; - var values = Array(length); - for (var i = 0; i < length; i++) { - values[i] = obj[keys[i]]; - } - return values; - }; - - // Returns the results of applying the iteratee to each element of the object - // In contrast to _.map it returns an object - _.mapObject = function(obj, iteratee, context) { - iteratee = cb(iteratee, context); - var keys = _.keys(obj), - length = keys.length, - results = {}, - currentKey; - for (var index = 0; index < length; index++) { - currentKey = keys[index]; - results[currentKey] = iteratee(obj[currentKey], currentKey, obj); - } - return results; - }; - - // Convert an object into a list of `[key, value]` pairs. - _.pairs = function(obj) { - var keys = _.keys(obj); - var length = keys.length; - var pairs = Array(length); - for (var i = 0; i < length; i++) { - pairs[i] = [keys[i], obj[keys[i]]]; - } - return pairs; - }; - - // Invert the keys and values of an object. The values must be serializable. - _.invert = function(obj) { - var result = {}; - var keys = _.keys(obj); - for (var i = 0, length = keys.length; i < length; i++) { - result[obj[keys[i]]] = keys[i]; - } - return result; - }; - - // Return a sorted list of the function names available on the object. - // Aliased as `methods` - _.functions = _.methods = function(obj) { - var names = []; - for (var key in obj) { - if (_.isFunction(obj[key])) names.push(key); - } - return names.sort(); - }; - - // Extend a given object with all the properties in passed-in object(s). - _.extend = createAssigner(_.allKeys); - - // Assigns a given object with all the own properties in the passed-in object(s) - // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) - _.extendOwn = _.assign = createAssigner(_.keys); - - // Returns the first key on an object that passes a predicate test - _.findKey = function(obj, predicate, context) { - predicate = cb(predicate, context); - var keys = _.keys(obj), key; - for (var i = 0, length = keys.length; i < length; i++) { - key = keys[i]; - if (predicate(obj[key], key, obj)) return key; - } - }; - - // Return a copy of the object only containing the whitelisted properties. - _.pick = function(object, oiteratee, context) { - var result = {}, obj = object, iteratee, keys; - if (obj == null) return result; - if (_.isFunction(oiteratee)) { - keys = _.allKeys(obj); - iteratee = optimizeCb(oiteratee, context); - } else { - keys = flatten(arguments, false, false, 1); - iteratee = function(value, key, obj) { return key in obj; }; - obj = Object(obj); - } - for (var i = 0, length = keys.length; i < length; i++) { - var key = keys[i]; - var value = obj[key]; - if (iteratee(value, key, obj)) result[key] = value; - } - return result; - }; - - // Return a copy of the object without the blacklisted properties. - _.omit = function(obj, iteratee, context) { - if (_.isFunction(iteratee)) { - iteratee = _.negate(iteratee); - } else { - var keys = _.map(flatten(arguments, false, false, 1), String); - iteratee = function(value, key) { - return !_.contains(keys, key); - }; - } - return _.pick(obj, iteratee, context); - }; - - // Fill in a given object with default properties. - _.defaults = createAssigner(_.allKeys, true); - - // Creates an object that inherits from the given prototype object. - // If additional properties are provided then they will be added to the - // created object. - _.create = function(prototype, props) { - var result = baseCreate(prototype); - if (props) _.extendOwn(result, props); - return result; - }; - - // Create a (shallow-cloned) duplicate of an object. - _.clone = function(obj) { - if (!_.isObject(obj)) return obj; - return _.isArray(obj) ? obj.slice() : _.extend({}, obj); - }; - - // Invokes interceptor with the obj, and then returns obj. - // The primary purpose of this method is to "tap into" a method chain, in - // order to perform operations on intermediate results within the chain. - _.tap = function(obj, interceptor) { - interceptor(obj); - return obj; - }; - - // Returns whether an object has a given set of `key:value` pairs. - _.isMatch = function(object, attrs) { - var keys = _.keys(attrs), length = keys.length; - if (object == null) return !length; - var obj = Object(object); - for (var i = 0; i < length; i++) { - var key = keys[i]; - if (attrs[key] !== obj[key] || !(key in obj)) return false; - } - return true; - }; - - - // Internal recursive comparison function for `isEqual`. - var eq = function(a, b, aStack, bStack) { - // Identical objects are equal. `0 === -0`, but they aren't identical. - // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). - if (a === b) return a !== 0 || 1 / a === 1 / b; - // A strict comparison is necessary because `null == undefined`. - if (a == null || b == null) return a === b; - // Unwrap any wrapped objects. - if (a instanceof _) a = a._wrapped; - if (b instanceof _) b = b._wrapped; - // Compare `[[Class]]` names. - var className = toString.call(a); - if (className !== toString.call(b)) return false; - switch (className) { - // Strings, numbers, regular expressions, dates, and booleans are compared by value. - case '[object RegExp]': - // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') - case '[object String]': - // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is - // equivalent to `new String("5")`. - return '' + a === '' + b; - case '[object Number]': - // `NaN`s are equivalent, but non-reflexive. - // Object(NaN) is equivalent to NaN - if (+a !== +a) return +b !== +b; - // An `egal` comparison is performed for other numeric values. - return +a === 0 ? 1 / +a === 1 / b : +a === +b; - case '[object Date]': - case '[object Boolean]': - // Coerce dates and booleans to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are not equivalent. - return +a === +b; - } - - var areArrays = className === '[object Array]'; - if (!areArrays) { - if (typeof a != 'object' || typeof b != 'object') return false; - - // Objects with different constructors are not equivalent, but `Object`s or `Array`s - // from different frames are. - var aCtor = a.constructor, bCtor = b.constructor; - if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && - _.isFunction(bCtor) && bCtor instanceof bCtor) - && ('constructor' in a && 'constructor' in b)) { - return false; - } - } - // Assume equality for cyclic structures. The algorithm for detecting cyclic - // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. - - // Initializing stack of traversed objects. - // It's done here since we only need them for objects and arrays comparison. - aStack = aStack || []; - bStack = bStack || []; - var length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - if (aStack[length] === a) return bStack[length] === b; - } - - // Add the first object to the stack of traversed objects. - aStack.push(a); - bStack.push(b); - - // Recursively compare objects and arrays. - if (areArrays) { - // Compare array lengths to determine if a deep comparison is necessary. - length = a.length; - if (length !== b.length) return false; - // Deep compare the contents, ignoring non-numeric properties. - while (length--) { - if (!eq(a[length], b[length], aStack, bStack)) return false; - } - } else { - // Deep compare objects. - var keys = _.keys(a), key; - length = keys.length; - // Ensure that both objects contain the same number of properties before comparing deep equality. - if (_.keys(b).length !== length) return false; - while (length--) { - // Deep compare each member - key = keys[length]; - if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false; - } - } - // Remove the first object from the stack of traversed objects. - aStack.pop(); - bStack.pop(); - return true; - }; - - // Perform a deep comparison to check if two objects are equal. - _.isEqual = function(a, b) { - return eq(a, b); - }; - - // Is a given array, string, or object empty? - // An "empty" object has no enumerable own-properties. - _.isEmpty = function(obj) { - if (obj == null) return true; - if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0; - return _.keys(obj).length === 0; - }; - - // Is a given value a DOM element? - _.isElement = function(obj) { - return !!(obj && obj.nodeType === 1); - }; - - // Is a given value an array? - // Delegates to ECMA5's native Array.isArray - _.isArray = nativeIsArray || function(obj) { - return toString.call(obj) === '[object Array]'; - }; - - // Is a given variable an object? - _.isObject = function(obj) { - var type = typeof obj; - return type === 'function' || type === 'object' && !!obj; - }; - - // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError. - _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) { - _['is' + name] = function(obj) { - return toString.call(obj) === '[object ' + name + ']'; - }; - }); - - // Define a fallback version of the method in browsers (ahem, IE < 9), where - // there isn't any inspectable "Arguments" type. - if (!_.isArguments(arguments)) { - _.isArguments = function(obj) { - return _.has(obj, 'callee'); - }; - } - - // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8, - // IE 11 (#1621), and in Safari 8 (#1929). - if (typeof /./ != 'function' && typeof Int8Array != 'object') { - _.isFunction = function(obj) { - return typeof obj == 'function' || false; - }; - } - - // Is a given object a finite number? - _.isFinite = function(obj) { - return isFinite(obj) && !isNaN(parseFloat(obj)); - }; - - // Is the given value `NaN`? (NaN is the only number which does not equal itself). - _.isNaN = function(obj) { - return _.isNumber(obj) && obj !== +obj; - }; - - // Is a given value a boolean? - _.isBoolean = function(obj) { - return obj === true || obj === false || toString.call(obj) === '[object Boolean]'; - }; - - // Is a given value equal to null? - _.isNull = function(obj) { - return obj === null; - }; - - // Is a given variable undefined? - _.isUndefined = function(obj) { - return obj === void 0; - }; - - // Shortcut function for checking if an object has a given property directly - // on itself (in other words, not on a prototype). - _.has = function(obj, key) { - return obj != null && hasOwnProperty.call(obj, key); - }; - - // Utility Functions - // ----------------- - - // Run Underscore.js in *noConflict* mode, returning the `_` variable to its - // previous owner. Returns a reference to the Underscore object. - _.noConflict = function() { - root._ = previousUnderscore; - return this; - }; - - // Keep the identity function around for default iteratees. - _.identity = function(value) { - return value; - }; - - // Predicate-generating functions. Often useful outside of Underscore. - _.constant = function(value) { - return function() { - return value; - }; - }; - - _.noop = function(){}; - - _.property = function(key) { - return function(obj) { - return obj == null ? void 0 : obj[key]; - }; - }; - - // Generates a function for a given object that returns a given property. - _.propertyOf = function(obj) { - return obj == null ? function(){} : function(key) { - return obj[key]; - }; - }; - - // Returns a predicate for checking whether an object has a given set of - // `key:value` pairs. - _.matcher = _.matches = function(attrs) { - attrs = _.extendOwn({}, attrs); - return function(obj) { - return _.isMatch(obj, attrs); - }; - }; - - // Run a function **n** times. - _.times = function(n, iteratee, context) { - var accum = Array(Math.max(0, n)); - iteratee = optimizeCb(iteratee, context, 1); - for (var i = 0; i < n; i++) accum[i] = iteratee(i); - return accum; - }; - - // Return a random integer between min and max (inclusive). - _.random = function(min, max) { - if (max == null) { - max = min; - min = 0; - } - return min + Math.floor(Math.random() * (max - min + 1)); - }; - - // A (possibly faster) way to get the current timestamp as an integer. - _.now = Date.now || function() { - return new Date().getTime(); - }; - - // List of HTML entities for escaping. - var escapeMap = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''', - '`': '`' - }; - var unescapeMap = _.invert(escapeMap); - - // Functions for escaping and unescaping strings to/from HTML interpolation. - var createEscaper = function(map) { - var escaper = function(match) { - return map[match]; - }; - // Regexes for identifying a key that needs to be escaped - var source = '(?:' + _.keys(map).join('|') + ')'; - var testRegexp = RegExp(source); - var replaceRegexp = RegExp(source, 'g'); - return function(string) { - string = string == null ? '' : '' + string; - return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; - }; - }; - _.escape = createEscaper(escapeMap); - _.unescape = createEscaper(unescapeMap); - - // If the value of the named `property` is a function then invoke it with the - // `object` as context; otherwise, return it. - _.result = function(object, property, fallback) { - var value = object == null ? void 0 : object[property]; - if (value === void 0) { - value = fallback; - } - return _.isFunction(value) ? value.call(object) : value; - }; - - // Generate a unique integer id (unique within the entire client session). - // Useful for temporary DOM ids. - var idCounter = 0; - _.uniqueId = function(prefix) { - var id = ++idCounter + ''; - return prefix ? prefix + id : id; - }; - - // By default, Underscore uses ERB-style template delimiters, change the - // following template settings to use alternative delimiters. - _.templateSettings = { - evaluate : /<%([\s\S]+?)%>/g, - interpolate : /<%=([\s\S]+?)%>/g, - escape : /<%-([\s\S]+?)%>/g - }; - - // When customizing `templateSettings`, if you don't want to define an - // interpolation, evaluation or escaping regex, we need one that is - // guaranteed not to match. - var noMatch = /(.)^/; - - // Certain characters need to be escaped so that they can be put into a - // string literal. - var escapes = { - "'": "'", - '\\': '\\', - '\r': 'r', - '\n': 'n', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - var escaper = /\\|'|\r|\n|\u2028|\u2029/g; - - var escapeChar = function(match) { - return '\\' + escapes[match]; - }; - - // JavaScript micro-templating, similar to John Resig's implementation. - // Underscore templating handles arbitrary delimiters, preserves whitespace, - // and correctly escapes quotes within interpolated code. - // NB: `oldSettings` only exists for backwards compatibility. - _.template = function(text, settings, oldSettings) { - if (!settings && oldSettings) settings = oldSettings; - settings = _.defaults({}, settings, _.templateSettings); - - // Combine delimiters into one regular expression via alternation. - var matcher = RegExp([ - (settings.escape || noMatch).source, - (settings.interpolate || noMatch).source, - (settings.evaluate || noMatch).source - ].join('|') + '|$', 'g'); - - // Compile the template source, escaping string literals appropriately. - var index = 0; - var source = "__p+='"; - text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { - source += text.slice(index, offset).replace(escaper, escapeChar); - index = offset + match.length; - - if (escape) { - source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; - } else if (interpolate) { - source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; - } else if (evaluate) { - source += "';\n" + evaluate + "\n__p+='"; - } - - // Adobe VMs need the match returned to produce the correct offest. - return match; - }); - source += "';\n"; - - // If a variable is not specified, place data values in local scope. - if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; - - source = "var __t,__p='',__j=Array.prototype.join," + - "print=function(){__p+=__j.call(arguments,'');};\n" + - source + 'return __p;\n'; - - try { - var render = new Function(settings.variable || 'obj', '_', source); - } catch (e) { - e.source = source; - throw e; - } - - var template = function(data) { - return render.call(this, data, _); - }; - - // Provide the compiled source as a convenience for precompilation. - var argument = settings.variable || 'obj'; - template.source = 'function(' + argument + '){\n' + source + '}'; - - return template; - }; - - // Add a "chain" function. Start chaining a wrapped Underscore object. - _.chain = function(obj) { - var instance = _(obj); - instance._chain = true; - return instance; - }; - - // OOP - // --------------- - // If Underscore is called as a function, it returns a wrapped object that - // can be used OO-style. This wrapper holds altered versions of all the - // underscore functions. Wrapped objects may be chained. - - // Helper function to continue chaining intermediate results. - var result = function(instance, obj) { - return instance._chain ? _(obj).chain() : obj; - }; - - // Add your own custom functions to the Underscore object. - _.mixin = function(obj) { - _.each(_.functions(obj), function(name) { - var func = _[name] = obj[name]; - _.prototype[name] = function() { - var args = [this._wrapped]; - push.apply(args, arguments); - return result(this, func.apply(_, args)); - }; - }); - }; - - // Add all of the Underscore functions to the wrapper object. - _.mixin(_); - - // Add all mutator Array functions to the wrapper. - _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { - var method = ArrayProto[name]; - _.prototype[name] = function() { - var obj = this._wrapped; - method.apply(obj, arguments); - if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0]; - return result(this, obj); - }; - }); - - // Add all accessor Array functions to the wrapper. - _.each(['concat', 'join', 'slice'], function(name) { - var method = ArrayProto[name]; - _.prototype[name] = function() { - return result(this, method.apply(this._wrapped, arguments)); - }; - }); - - // Extracts the result from a wrapped and chained object. - _.prototype.value = function() { - return this._wrapped; - }; - - // Provide unwrapping proxy for some methods used in engine operations - // such as arithmetic and JSON stringification. - _.prototype.valueOf = _.prototype.toJSON = _.prototype.value; - - _.prototype.toString = function() { - return '' + this._wrapped; - }; - - // AMD registration happens at the end for compatibility with AMD loaders - // that may not enforce next-turn semantics on modules. Even though general - // practice for AMD registration is to be anonymous, underscore registers - // as a named module because, like jQuery, it is a base library that is - // popular enough to be bundled in a third party lib, but not be part of - // an AMD load request. Those cases could generate an error when an - // anonymous define() is called outside of a loader request. - if (typeof define === 'function' && define.amd) { - define('underscore', [], function() { - return _; - }); - } -}.call(this));/** - * Created by richie on 15/7/8. - */ -/** - * 初始化BI对象 - */ -if (window.BI == null) { - window.BI = {}; -}/** - * MVC工厂 - * guy - * @class BI.Factory - */ -BI.Factory = { - parsePath: function parsePath (path) { - var segments = path.split('.'); - return function (obj) { - for (var i = 0; i < segments.length; i++) { - if (!obj) { - return; - } - obj = obj[segments[i]]; - } - return obj; - } - }, - createView : function(url, viewFunc, mData, vData, context){ - var modelFunc = viewFunc.replace(/View/, "Model"); - modelFunc = this.parsePath(modelFunc)(window); - if(!_.isFunction(modelFunc)){ - modelFunc = BI.Model; - } -// try { - var model = new (modelFunc)(_.extend({}, mData, { - parent: context && context.model, - rootURL: url - }), {silent: true}); -// } catch (e) { -// -// } -// try { - var view = new (eval(viewFunc))(_.extend({}, vData, { - model: model, - parent: context, - rootURL: url - })); -// } catch (e) { -// -// } - return view; - } -};(function (root, factory) { - root.BI = factory(root, root.BI || {}, root._, (root.jQuery || root.$)); -}(this, function (root, BI, _, $) { - - var previousBI = root.BI; - - // Create local references to array methods we'll want to use later. - var array = []; - var slice = array.slice; - - // Current version of the library. Keep in sync with `package.json`. - BI.VERSION = '1.0.0'; - - // For BI's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns - // the `$` variable. - BI.$ = $; - - // Runs BI.js in *noConflict* mode, returning the `BI` variable - // to its previous owner. Returns a reference to this BI object. - BI.noConflict = function () { - root.BI = previousBI; - return this; - }; - - // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option - // will fake `"PATCH"`, `"PUT"` and `"DELETE"` requests via the `_method` parameter and - // set a `X-Http-Method-Override` header. - BI.emulateHTTP = true; - - // Turn on `emulateJSON` to support legacy servers that can't deal with direct - // `application/json` requests ... this will encode the body as - // `application/x-www-form-urlencoded` instead and will send the model in a - // form param named `model`. - BI.emulateJSON = true; - - // BI.Events - // --------------- - - // A module that can be mixed in to *any object* in order to provide it with - // custom events. You may bind with `on` or remove with `off` callback - // functions to an event; `trigger`-ing an event fires all callbacks in - // succession. - // - // var object = {}; - // _.extend(object, BI.Events); - // object.on('expand', function(){ alert('expanded'); }); - // object.trigger('expand'); - // - var Events = BI.Events = { - - // Bind an event to a `callback` function. Passing `"all"` will bind - // the callback to all events fired. - on: function (name, callback, context) { - if (!eventsApi(this, 'on', name, [callback, context]) || !callback) return this; - this._events || (this._events = {}); - var events = this._events[name] || (this._events[name] = []); - events.push({callback: callback, context: context, ctx: context || this}); - return this; - }, - - // Bind an event to only be triggered a single time. After the first time - // the callback is invoked, it will be removed. - once: function (name, callback, context) { - if (!eventsApi(this, 'once', name, [callback, context]) || !callback) return this; - var self = this; - var once = _.once(function () { - self.off(name, once); - callback.apply(this, arguments); - }); - once._callback = callback; - return this.on(name, once, context); - }, - - // Remove one or many callbacks. If `context` is null, removes all - // callbacks with that function. If `callback` is null, removes all - // callbacks for the event. If `name` is null, removes all bound - // callbacks for all events. - off: function (name, callback, context) { - if (!this._events || !eventsApi(this, 'off', name, [callback, context])) return this; - - // Remove all callbacks for all events. - if (!name && !callback && !context) { - this._events = void 0; - return this; - } - - var names = name ? [name] : _.keys(this._events); - for (var i = 0, length = names.length; i < length; i++) { - name = names[i]; - - // Bail out if there are no events stored. - var events = this._events[name]; - if (!events) continue; - - // Remove all callbacks for this event. - if (!callback && !context) { - delete this._events[name]; - continue; - } - - // Find any remaining events. - var remaining = []; - for (var j = 0, k = events.length; j < k; j++) { - var event = events[j]; - if ( - callback && callback !== event.callback && - callback !== event.callback._callback || - context && context !== event.context - ) { - remaining.push(event); - } - } - - // Replace events if there are any remaining. Otherwise, clean up. - if (remaining.length) { - this._events[name] = remaining; - } else { - delete this._events[name]; - } - } - - return this; - }, - - un: function () { - this.off.apply(this, arguments); - }, - - // Trigger one or many events, firing all bound callbacks. Callbacks are - // passed the same arguments as `trigger` is, apart from the event name - // (unless you're listening on `"all"`, which will cause your callback to - // receive the true name of the event as the first argument). - trigger: function (name) { - if (!this._events) return this; - var args = slice.call(arguments, 1); - if (!eventsApi(this, 'trigger', name, args)) return this; - var events = this._events[name]; - var allEvents = this._events.all; - if (events) triggerEvents(events, args); - if (allEvents) triggerEvents(allEvents, arguments); - return this; - }, - - fireEvent: function () { - this.trigger.apply(this, arguments); - }, - - // Inversion-of-control versions of `on` and `once`. Tell *this* object to - // listen to an event in another object ... keeping track of what it's - // listening to. - listenTo: function (obj, name, callback) { - var listeningTo = this._listeningTo || (this._listeningTo = {}); - var id = obj._listenId || (obj._listenId = _.uniqueId('l')); - listeningTo[id] = obj; - if (!callback && typeof name === 'object') callback = this; - obj.on(name, callback, this); - return this; - }, - - listenToOnce: function (obj, name, callback) { - if (typeof name === 'object') { - for (var event in name) this.listenToOnce(obj, event, name[event]); - return this; - } - if (eventSplitter.test(name)) { - var names = name.split(eventSplitter); - for (var i = 0, length = names.length; i < length; i++) { - this.listenToOnce(obj, names[i], callback); - } - return this; - } - if (!callback) return this; - var once = _.once(function () { - this.stopListening(obj, name, once); - callback.apply(this, arguments); - }); - once._callback = callback; - return this.listenTo(obj, name, once); - }, - - // Tell this object to stop listening to either specific events ... or - // to every object it's currently listening to. - stopListening: function (obj, name, callback) { - var listeningTo = this._listeningTo; - if (!listeningTo) return this; - var remove = !name && !callback; - if (!callback && typeof name === 'object') callback = this; - if (obj) (listeningTo = {})[obj._listenId] = obj; - for (var id in listeningTo) { - obj = listeningTo[id]; - obj.off(name, callback, this); - if (remove || _.isEmpty(obj._events)) delete this._listeningTo[id]; - } - return this; - } - - }; - - // Regular expression used to split event strings. - var eventSplitter = /\s+/; - - // Implement fancy features of the Events API such as multiple event - // names `"change blur"` and jQuery-style event maps `{change: action}` - // in terms of the existing API. - var eventsApi = function (obj, action, name, rest) { - if (!name) return true; - - // Handle event maps. - if (typeof name === 'object') { - for (var key in name) { - obj[action].apply(obj, [key, name[key]].concat(rest)); - } - return false; - } - - // Handle space separated event names. - if (eventSplitter.test(name)) { - var names = name.split(eventSplitter); - for (var i = 0, length = names.length; i < length; i++) { - obj[action].apply(obj, [names[i]].concat(rest)); - } - return false; - } - - return true; - }; - - // A difficult-to-believe, but optimized internal dispatch function for - // triggering events. Tries to keep the usual cases speedy (most internal - // BI events have 3 arguments). - var triggerEvents = function (events, args) { - var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2]; - switch (args.length) { - case 0: - while (++i < l) (ev = events[i]).callback.call(ev.ctx); - return; - case 1: - while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); - return; - case 2: - while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); - return; - case 3: - while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); - return; - default: - while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); - return; - } - }; - - // Aliases for backwards compatibility. - Events.bind = Events.on; - Events.unbind = Events.off; - - // Allow the `BI` object to serve as a global event bus, for folks who - // want global "pubsub" in a convenient place. - _.extend(BI, Events); - - // BI.M - // -------------- - - // BI **Models** are the basic data object in the framework -- - // frequently representing a row in a table in a database on your server. - // A discrete chunk of data and a bunch of useful, related methods for - // performing computations and transformations on that data. - - // Create a new model with the specified attributes. A client id (`cid`) - // is automatically generated and assigned for you. - var M = BI.M = function (attributes, options) { - var attrs = attributes || {}; - options = options || {}; - this.cid = _.uniqueId('c'); - this.attributes = {}; - if (options.collection) this.collection = options.collection; - if (options.parse) attrs = this.parse(attrs, options) || {}; - this.options = attrs = _.defaults({}, attrs, _.result(this, '_defaultConfig')); - _.extend(this, _.pick(this.options, modelOptions)); - this.set(attrs, options); - this.changed = {}; - this._init.apply(this, arguments); - }; - - var modelOptions = ['rootURL', 'parent', 'data', 'id']; - - // Attach all inheritable methods to the M prototype. - _.extend(M.prototype, Events, { - - // A hash of attributes whose current and previous value differ. - changed: null, - - // The value returned during the last failed validation. - validationError: null, - - // The default name for the JSON `id` attribute is `"id"`. MongoDB and - // CouchDB users may want to set this to `"_id"`. - idAttribute: 'ID', - - _defaultConfig: function () { - return {} - }, - - // _init is an empty function by default. Override it with your own - // initialization logic. - _init: function () { - }, - - // Return a copy of the model's `attributes` object. - toJSON: function (options) { - return _.clone(this.attributes); - }, - - // Proxy `BI.sync` by default -- but override this if you need - // custom syncing semantics for *this* particular model. - sync: function () { - return BI.sync.apply(this, arguments); - }, - - // Get the value of an attribute. - get: function (attr) { - return this.attributes[attr]; - }, - - // Get the HTML-escaped value of an attribute. - escape: function (attr) { - return _.escape(this.get(attr)); - }, - - // Returns `true` if the attribute contains a value that is not null - // or undefined. - has: function (attr) { - return _.has(this.attributes, attr); - }, - - // Special-cased proxy to underscore's `_.matches` method. - matches: function (attrs) { - var keys = _.keys(attrs), length = keys.length; - var obj = Object(this.attributes); - for (var i = 0; i < length; i++) { - var key = keys[i]; - if (!_.isEqual(attrs[key], obj[key]) || !(key in obj)) return false; - } - return true; - }, - - // Set a hash of model attributes on the object, firing `"change"`. This is - // the core primitive operation of a model, updating the data and notifying - // anyone who needs to know about the change in state. The heart of the beast. - set: function (key, val, options) { - var attr, attrs, unset, changes, silent, changing, changed, prev, current; - if (key == null) return this; - - // Handle both `"key", value` and `{key: value}` -style arguments. - if (typeof key === 'object') { - attrs = key; - options = val; - } else { - (attrs = {})[key] = val; - } - - options || (options = {}); - - // Run validation. - if (!this._validate(attrs, options)) return false; - - // Extract attributes and options. - unset = options.unset; - silent = options.silent; - changes = []; - changing = this._changing; - this._changing = true; - - if (!changing) { - this._previousAttributes = _.clone(this.attributes); - this.changed = {}; - } - current = this.attributes, prev = this._previousAttributes; - - // Check for changes of `id`. - if (this.idAttribute in attrs) this.id = attrs[this.idAttribute]; - - // For each `set` attribute, update or delete the current value. - for (attr in attrs) { - val = attrs[attr]; - if (!_.isEqual(current[attr], val)) changes.push(attr); - if (!_.isEqual(prev[attr], val)) { - this.changed[attr] = val; - } else { - delete this.changed[attr]; - } - unset ? delete current[attr] : current[attr] = val; - } - - // Trigger all relevant attribute changes. - if (!silent) { - if (changes.length) this._pending = options; - for (var i = 0, length = changes.length; i < length; i++) { - this.trigger('change:' + changes[i], this, current[changes[i]], options); - } - } - - // You might be wondering why there's a `while` loop here. Changes can - // be recursively nested within `"change"` events. - if (changing) return this; - changed = BI.clone(this.changed); - if (!silent) { - while (this._pending) { - options = this._pending; - this._pending = false; - this.trigger('change', changed, prev, this, options); - } - } - this._pending = false; - this._changing = false; - if (!silent && changes.length) this.trigger("changed", changed, prev, this, options); - return this; - }, - - // Remove an attribute from the model, firing `"change"`. `unset` is a noop - // if the attribute doesn't exist. - unset: function (attr, options) { - return this.set(attr, void 0, _.extend({}, options, {unset: true})); - }, - - // Clear all attributes on the model, firing `"change"`. - clear: function (options) { - var attrs = {}; - for (var key in this.attributes) attrs[key] = void 0; - return this.set(attrs, _.extend({}, options, {unset: true})); - }, - - // Determine if the model has changed since the last `"change"` event. - // If you specify an attribute name, determine if that attribute has changed. - hasChanged: function (attr) { - if (attr == null) return !_.isEmpty(this.changed); - return _.has(this.changed, attr); - }, - - // Return an object containing all the attributes that have changed, or - // false if there are no changed attributes. Useful for determining what - // parts of a view need to be updated and/or what attributes need to be - // persisted to the server. Unset attributes will be set to undefined. - // You can also pass an attributes object to diff against the model, - // determining if there *would be* a change. - changedAttributes: function (diff) { - if (!diff) return this.hasChanged() ? _.clone(this.changed) : false; - var val, changed = false; - var old = this._changing ? this._previousAttributes : this.attributes; - for (var attr in diff) { - if (_.isEqual(old[attr], (val = diff[attr]))) continue; - (changed || (changed = {}))[attr] = val; - } - return changed; - }, - - // Get the previous value of an attribute, recorded at the time the last - // `"change"` event was fired. - previous: function (attr) { - if (attr == null || !this._previousAttributes) return null; - return this._previousAttributes[attr]; - }, - - // Get all of the attributes of the model at the time of the previous - // `"change"` event. - previousAttributes: function () { - return _.clone(this._previousAttributes); - }, - - // Fetch the model from the server. If the server's representation of the - // model differs from its current attributes, they will be overridden, - // triggering a `"change"` event. - fetch: function (options) { - options = options ? _.clone(options) : {}; - if (options.parse === void 0) options.parse = true; - var model = this; - var success = options.success; - options.success = function (resp) { - if (!options.noset) { - if (!model.set(model.parse(resp, options), options)) return false; - } - if (success) success(resp, model, options); - model.trigger('sync', resp, model, options).trigger('read', resp, model, options); - }; - wrapError(this, options); - return this.sync('read', this, options); - }, - - // Set a hash of model attributes, and sync the model to the server. - // If the server returns an attributes hash that differs, the model's - // state will be `set` again. - save: function (key, val, options) { - var attrs, method, xhr, attributes = this.attributes; - - // Handle both `"key", value` and `{key: value}` -style arguments. - if (key == null || typeof key === 'object') { - attrs = key; - options = val; - } else { - (attrs = {})[key] = val; - } - - options = _.extend({validate: true}, options); - - // If we're not waiting and attributes exist, save acts as - // `set(attr).save(null, opts)` with validation. Otherwise, check if - // the model will be valid when the attributes, if any, are set. - if (attrs && !options.wait) { - if (!this.set(attrs, options)) return false; - } else { - if (!this._validate(attrs, options)) return false; - } - - // Set temporary attributes if `{wait: true}`. - if (attrs && options.wait) { - this.attributes = _.extend({}, attributes, attrs); - } - - // After a successful server-side save, the client is (optionally) - // updated with the server-side state. - if (options.parse === void 0) options.parse = true; - var model = this; - var success = options.success; - options.success = function (resp) { - // Ensure attributes are restored during synchronous saves. - model.attributes = attributes; - var serverAttrs = model.parse(resp, options); - if (options.wait) serverAttrs = _.extend(attrs || {}, serverAttrs); - if (_.isObject(serverAttrs) && !options.noset && !model.set(serverAttrs, options)) { - return false; - } - if (success) success(resp, model, options); - model.trigger('sync', resp, model, options) - .trigger((options.patch ? 'patch' : 'update'), resp, model, options); - }; - wrapError(this, options); - - method = /**this.isNew() ? 'create' :**/ (options.patch ? 'patch' : 'update'); - if (method === 'patch' && !options.attrs) options.attrs = attrs; - xhr = this.sync(method, this, options); - - // Restore attributes. - if (attrs && options.wait) this.attributes = attributes; - - return xhr; - }, - - // Destroy this model on the server if it was already persisted. - // Optimistically removes the model from its collection, if it has one. - // If `wait: true` is passed, waits for the server to respond before removal. - destroy: function (options) { - options = options ? _.clone(options) : {}; - var model = this; - var success = options.success; - - var destroy = function () { - model.stopListening(); - model.trigger('destroy', model.collection, model, options); - }; - - options.success = function (resp) { - if (options.wait || model.isNew()) destroy(); - if (success) success(resp, model, options); - if (!model.isNew()) model.trigger('sync', resp, model, options).trigger('delete', resp, model, options); - }; - - if (this.isNew()) { - options.success(); - return false; - } - wrapError(this, options); - - var xhr = this.sync('delete', this, options); - if (!options.wait) destroy(); - return xhr; - }, - - // Default URL for the model's representation on the server -- if you're - // using BI's restful methods, override this to change the endpoint - // that will be called. - url: function () { - var base = - _.result(this.collection, 'url'); - if (this.isNew()) return base; - return base.replace(/([^\/])$/, '$1/') + encodeURIComponent(this.id); - }, - - // **parse** converts a response into the hash of attributes to be `set` on - // the model. The default implementation is just to pass the response along. - parse: function (resp, options) { - return resp; - }, - - // Create a new model with identical attributes to this one. - clone: function () { - return new this.constructor(this.attributes); - }, - - // A model is new if it has never been saved to the server, and lacks an id. - isNew: function () { - return !this.has(this.idAttribute); - }, - - // Check if the model is currently in a valid state. - isValid: function (options) { - return this._validate({}, _.extend(options || {}, {validate: true})); - }, - - // Run validation against the next complete set of model attributes, - // returning `true` if all is well. Otherwise, fire an `"invalid"` event. - _validate: function (attrs, options) { - if (!options.validate || !this.validate) return true; - attrs = _.extend({}, this.attributes, attrs); - var error = this.validationError = this.validate(attrs, options) || null; - if (!error) return true; - this.trigger('invalid', error, this, _.extend(options, {validationError: error})); - return false; - } - - }); - - // Underscore methods that we want to implement on the M. - var modelMethods = ['keys', 'values', 'pairs', 'invert', 'pick', 'omit', 'chain', 'isEmpty']; - - // Mix in each Underscore method as a proxy to `M#attributes`. - _.each(modelMethods, function (method) { - if (!_[method]) return; - M.prototype[method] = function () { - var args = slice.call(arguments); - args.unshift(this.attributes); - return _[method].apply(_, args); - }; - }); - - // BI.Collection - // ------------------- - - // If models tend to represent a single row of data, a BI Collection is - // more analogous to a table full of data ... or a small slice or page of that - // table, or a collection of rows that belong together for a particular reason - // -- all of the messages in this particular folder, all of the documents - // belonging to this particular author, and so on. Collections maintain - // indexes of their models, both in order, and for lookup by `id`. - - // Create a new **Collection**, perhaps to contain a specific type of `model`. - // If a `comparator` is specified, the Collection will maintain - // its models in sort order, as they're added and removed. - var Collection = BI.Collection = function (models, options) { - this.options = options = options || {}; - if (options.model) this.model = options.model; - if (options.comparator !== void 0) this.comparator = options.comparator; - this._reset(); - this._init.apply(this, arguments); - if (models) this.reset(models, _.extend({silent: true}, options)); - }; - - // Default options for `Collection#set`. - var setOptions = {add: true, remove: true, merge: true}; - var addOptions = {add: true, remove: false}; - - // Define the Collection's inheritable methods. - _.extend(Collection.prototype, Events, { - - // The default model for a collection is just a **BI.M**. - // This should be overridden in most cases. - model: M, - - // _init is an empty function by default. Override it with your own - // initialization logic. - _init: function () { - }, - - // The JSON representation of a Collection is an array of the - // models' attributes. - toJSON: function (options) { - return this.map(function (model) { - return model.toJSON(options); - }); - }, - - // Proxy `BI.sync` by default. - sync: function () { - return BI.sync.apply(this, arguments); - }, - - // Add a model, or list of models to the set. - add: function (models, options) { - return this.set(models, _.extend({merge: false}, options, addOptions)); - }, - - // Remove a model, or a list of models from the set. - remove: function (models, options) { - var singular = !_.isArray(models); - models = singular ? [models] : _.clone(models); - options || (options = {}); - for (var i = 0, length = models.length; i < length; i++) { - var model = models[i] = this.get(models[i]); - if (!model) continue; - var id = this.modelId(model.attributes); - if (id != null) delete this._byId[id]; - delete this._byId[model.cid]; - var index = this.indexOf(model); - this.models.splice(index, 1); - this.length--; - if (!options.silent) { - options.index = index; - model.trigger('remove', model, this, options); - } - this._removeReference(model, options); - } - return singular ? models[0] : models; - }, - - // Update a collection by `set`-ing a new list of models, adding new ones, - // removing models that are no longer present, and merging models that - // already exist in the collection, as necessary. Similar to **M#set**, - // the core operation for updating the data contained by the collection. - set: function (models, options) { - options = _.defaults({}, options, setOptions); - if (options.parse) models = this.parse(models, options); - var singular = !_.isArray(models); - models = singular ? (models ? [models] : []) : models.slice(); - var id, model, attrs, existing, sort; - var at = options.at; - if (at != null) at = +at; - if (at < 0) at += this.length + 1; - var sortable = this.comparator && (at == null) && options.sort !== false; - var sortAttr = _.isString(this.comparator) ? this.comparator : null; - var toAdd = [], toRemove = [], modelMap = {}; - var add = options.add, merge = options.merge, remove = options.remove; - var order = !sortable && add && remove ? [] : false; - var orderChanged = false; - - // Turn bare objects into model references, and prevent invalid models - // from being added. - for (var i = 0, length = models.length; i < length; i++) { - attrs = models[i]; - - // If a duplicate is found, prevent it from being added and - // optionally merge it into the existing model. - if (existing = this.get(attrs)) { - if (remove) modelMap[existing.cid] = true; - if (merge && attrs !== existing) { - attrs = this._isModel(attrs) ? attrs.attributes : attrs; - if (options.parse) attrs = existing.parse(attrs, options); - existing.set(attrs, options); - if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true; - } - models[i] = existing; - - // If this is a new, valid model, push it to the `toAdd` list. - } else if (add) { - model = models[i] = this._prepareModel(attrs, options); - if (!model) continue; - toAdd.push(model); - this._addReference(model, options); - } - - // Do not add multiple models with the same `id`. - model = existing || model; - if (!model) continue; - id = this.modelId(model.attributes); - if (order && (model.isNew() || !modelMap[id])) { - order.push(model); - - // Check to see if this is actually a new model at this index. - orderChanged = orderChanged || !this.models[i] || model.cid !== this.models[i].cid; - } - - modelMap[id] = true; - } - - // Remove nonexistent models if appropriate. - if (remove) { - for (var i = 0, length = this.length; i < length; i++) { - if (!modelMap[(model = this.models[i]).cid]) toRemove.push(model); - } - if (toRemove.length) this.remove(toRemove, options); - } - - // See if sorting is needed, update `length` and splice in new models. - if (toAdd.length || orderChanged) { - if (sortable) sort = true; - this.length += toAdd.length; - if (at != null) { - for (var i = 0, length = toAdd.length; i < length; i++) { - this.models.splice(at + i, 0, toAdd[i]); - } - } else { - if (order) this.models.length = 0; - var orderedModels = order || toAdd; - for (var i = 0, length = orderedModels.length; i < length; i++) { - this.models.push(orderedModels[i]); - } - } - } - - // Silently sort the collection if appropriate. - if (sort) this.sort({silent: true}); - - // Unless silenced, it's time to fire all appropriate add/sort events. - if (!options.silent) { - var addOpts = at != null ? _.clone(options) : options; - for (var i = 0, length = toAdd.length; i < length; i++) { - if (at != null) addOpts.index = at + i; - (model = toAdd[i]).trigger('add', model, this, addOpts); - } - if (sort || orderChanged) this.trigger('sort', this, options); - } - - // Return the added (or merged) model (or models). - return singular ? models[0] : models; - }, - - // When you have more items than you want to add or remove individually, - // you can reset the entire set with a new list of models, without firing - // any granular `add` or `remove` events. Fires `reset` when finished. - // Useful for bulk operations and optimizations. - reset: function (models, options) { - options = options ? _.clone(options) : {}; - for (var i = 0, length = this.models.length; i < length; i++) { - this._removeReference(this.models[i], options); - } - options.previousModels = this.models; - this._reset(); - models = this.add(models, _.extend({silent: true}, options)); - if (!options.silent) this.trigger('reset', this, options); - return models; - }, - - // Add a model to the end of the collection. - push: function (model, options) { - return this.add(model, _.extend({at: this.length}, options)); - }, - - // Remove a model from the end of the collection. - pop: function (options) { - var model = this.at(this.length - 1); - this.remove(model, options); - return model; - }, - - // Add a model to the beginning of the collection. - unshift: function (model, options) { - return this.add(model, _.extend({at: 0}, options)); - }, - - // Remove a model from the beginning of the collection. - shift: function (options) { - var model = this.at(0); - this.remove(model, options); - return model; - }, - - // Slice out a sub-array of models from the collection. - slice: function () { - return slice.apply(this.models, arguments); - }, - - // Get a model from the set by id. - get: function (obj) { - if (obj == null) return void 0; - var id = this.modelId(this._isModel(obj) ? obj.attributes : obj); - return this._byId[obj] || this._byId[id] || this._byId[obj.cid]; - }, - - // Get the model at the given index. - at: function (index) { - if (index < 0) index += this.length; - return this.models[index]; - }, - - // Return models with matching attributes. Useful for simple cases of - // `filter`. - where: function (attrs, first) { - var matches = _.matches(attrs); - return this[first ? 'find' : 'filter'](function (model) { - return matches(model.attributes); - }); - }, - - // Return the first model with matching attributes. Useful for simple cases - // of `find`. - findWhere: function (attrs) { - return this.where(attrs, true); - }, - - // Force the collection to re-sort itself. You don't need to call this under - // normal circumstances, as the set will maintain sort order as each item - // is added. - sort: function (options) { - if (!this.comparator) throw new Error('Cannot sort a set without a comparator'); - options || (options = {}); - - // Run sort based on type of `comparator`. - if (_.isString(this.comparator) || this.comparator.length === 1) { - this.models = this.sortBy(this.comparator, this); - } else { - this.models.sort(_.bind(this.comparator, this)); - } - - if (!options.silent) this.trigger('sort', this, options); - return this; - }, - - // Pluck an attribute from each model in the collection. - pluck: function (attr) { - return _.invoke(this.models, 'get', attr); - }, - - // Fetch the default set of models for this collection, resetting the - // collection when they arrive. If `reset: true` is passed, the response - // data will be passed through the `reset` method instead of `set`. - fetch: function (options) { - options = options ? _.clone(options) : {}; - if (options.parse === void 0) options.parse = true; - var success = options.success; - var collection = this; - options.success = function (resp) { - var method = options.reset ? 'reset' : 'set'; - collection[method](resp, options); - if (success) success(collection, resp, options); - collection.trigger('sync', collection, resp, options); - }; - wrapError(this, options); - return this.sync('read', this, options); - }, - - // Create a new instance of a model in this collection. Add the model to the - // collection immediately, unless `wait: true` is passed, in which case we - // wait for the server to agree. - create: function (model, options) { - options = options ? _.clone(options) : {}; - if (!(model = this._prepareModel(model, options))) return false; - if (!options.wait) this.add(model, options); - var collection = this; - var success = options.success; - options.success = function (model, resp) { - if (options.wait) collection.add(model, options); - if (success) success(model, resp, options); - }; - model.save(null, options); - return model; - }, - - // **parse** converts a response into a list of models to be added to the - // collection. The default implementation is just to pass it through. - parse: function (resp, options) { - return resp; - }, - - // Create a new collection with an identical list of models as this one. - clone: function () { - return new this.constructor(this.models, { - model: this.model, - comparator: this.comparator - }); - }, - - // Define how to uniquely identify models in the collection. - modelId: function (attrs) { - return attrs[this.model.prototype.idAttribute || 'id']; - }, - - // Private method to reset all internal state. Called when the collection - // is first _initd or reset. - _reset: function () { - this.length = 0; - this.models = []; - this._byId = {}; - }, - - // Prepare a hash of attributes (or other model) to be added to this - // collection. - _prepareModel: function (attrs, options) { - if (this._isModel(attrs)) { - if (!attrs.collection) attrs.collection = this; - return attrs; - } - options = options ? _.clone(options) : {}; - options.collection = this; - var model = new this.model(attrs, options); - if (!model.validationError) return model; - this.trigger('invalid', this, model.validationError, options); - return false; - }, - - // Method for checking whether an object should be considered a model for - // the purposes of adding to the collection. - _isModel: function (model) { - return model instanceof M; - }, - - // Internal method to create a model's ties to a collection. - _addReference: function (model, options) { - this._byId[model.cid] = model; - var id = this.modelId(model.attributes); - if (id != null) this._byId[id] = model; - model.on('all', this._onModelEvent, this); - }, - - // Internal method to sever a model's ties to a collection. - _removeReference: function (model, options) { - if (this === model.collection) delete model.collection; - model.off('all', this._onModelEvent, this); - }, - - // Internal method called every time a model in the set fires an event. - // Sets need to update their indexes when models change ids. All other - // events simply proxy through. "add" and "remove" events that originate - // in other collections are ignored. - _onModelEvent: function (event, model, collection, options) { - if ((event === 'add' || event === 'remove') && collection !== this) return; - if (event === 'destroy') this.remove(model, options); - if (event === 'change') { - var prevId = this.modelId(model.previousAttributes()); - var id = this.modelId(model.attributes); - if (prevId !== id) { - if (prevId != null) delete this._byId[prevId]; - if (id != null) this._byId[id] = model; - } - } - this.trigger.apply(this, arguments); - } - - }); - - // Underscore methods that we want to implement on the Collection. - // 90% of the core usefulness of BI Collections is actually implemented - // right here: - var methods = ['forEach', 'each', 'map', 'collect', 'reduce', 'foldl', - 'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select', - 'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke', - 'max', 'min', 'toArray', 'size', 'first', 'head', 'take', 'initial', 'rest', - 'tail', 'drop', 'last', 'without', 'difference', 'indexOf', 'shuffle', - 'lastIndexOf', 'isEmpty', 'chain', 'sample', 'partition']; - - // Mix in each Underscore method as a proxy to `Collection#models`. - _.each(methods, function (method) { - if (!_[method]) return; - Collection.prototype[method] = function () { - var args = slice.call(arguments); - args.unshift(this.models); - return _[method].apply(_, args); - }; - }); - - // Underscore methods that take a property name as an argument. - var attributeMethods = ['groupBy', 'countBy', 'sortBy', 'indexBy']; - - // Use attributes instead of properties. - _.each(attributeMethods, function (method) { - if (!_[method]) return; - Collection.prototype[method] = function (value, context) { - var iterator = _.isFunction(value) ? value : function (model) { - return model.get(value); - }; - return _[method](this.models, iterator, context); - }; - }); - - // BI.V - // ------------- - - // BI Views are almost more convention than they are actual code. A V - // is simply a JavaScript object that represents a logical chunk of UI in the - // DOM. This might be a single item, an entire list, a sidebar or panel, or - // even the surrounding frame which wraps your whole app. Defining a chunk of - // UI as a **V** allows you to define your DOM events declaratively, without - // having to worry about render order ... and makes it easy for the view to - // react to specific changes in the state of your models. - - // Creating a BI.V creates its initial element outside of the DOM, - // if an existing element is not provided... - var V = BI.V = function (options) { - this.cid = _.uniqueId('view'); - options = options || {}; - this.options = _.defaults(options, _.result(this, '_defaultConfig')); - _.extend(this, _.pick(this.options, viewOptions)); - this._ensureElement(); - this._init.apply(this, arguments); - }; - - // Cached regex to split keys for `delegate`. - var delegateEventSplitter = /^(\S+)\s*(.*)$/; - - // List of view options to be merged as properties. - var viewOptions = ['rootURL', 'model', 'parent', 'collection', 'element', 'id', 'attributes', 'baseCls', 'tagName', 'events']; - - // Set up all inheritable **BI.V** properties and methods. - _.extend(V.prototype, Events, { - - // The default `tagName` of a V's element is `"div"`. - tagName: 'div', - - // jQuery delegate for element lookup, scoped to DOM elements within the - // current view. This should be preferred to global lookups where possible. - $: function (selector) { - return this.$el.find(selector); - }, - - _defaultConfig: function () { - return {} - }, - - // _init is an empty function by default. Override it with your own - // initialization logic. - _init: function () { - }, - - //容器,默认放在this.element上 - _vessel: function () { - return this - }, - // **render** is the core function that your view should override, in order - // to populate its element (`this.el`), with the appropriate HTML. The - // convention is for **render** to always return `this`. - render: function (vessel) { - return this; - }, - - // Remove this view by taking the element out of the DOM, and removing any - // applicable BI.Events listeners. - remove: function () { - this._removeElement(); - this.stopListening(); - return this; - }, - - // Remove this view's element from the document and all event listeners - // attached to it. Exposed for subclasses using an alternative DOM - // manipulation API. - _removeElement: function () { - this.$el.remove(); - if ($.browser.msie === true) { - this.el.outerHTML = ''; - } - }, - - // Change the view's element (`this.el` property) and re-delegate the - // view's events on the new element. - setElement: function (element) { - this.undelegateEvents(); - this._setElement(element); - this.vessel = this._vessel(); - this.render(this.vessel); - this.delegateEvents(); - return this; - }, - - setVisible: function (visible) { - this.options.invisible = !visible; - if (visible) { - this.element.css("display", ""); - } else { - this.element.css("display", "none"); - } - }, - - isVisible: function () { - return !this.options.invisible; - }, - - visible: function () { - this.setVisible(true); - }, - - invisible: function () { - this.setVisible(false); - }, - - // Creates the `this.el` and `this.$el` references for this view using the - // given `el`. `el` can be a CSS selector or an HTML string, a jQuery - // context or an element. Subclasses can override this to utilize an - // alternative DOM manipulation API and are only required to set the - // `this.el` property. - _setElement: function (el) { - this.$el = el instanceof BI.$ ? el : BI.$(el); - this.element = this.$el; - this.el = this.$el[0]; - }, - - // Set callbacks, where `this.events` is a hash of - // - // *{"event selector": "callback"}* - // - // { - // 'mousedown .title': 'edit', - // 'click .button': 'save', - // 'click .open': function(e) { ... } - // } - // - // pairs. Callbacks will be bound to the view, with `this` set properly. - // Uses event delegation for efficiency. - // Omitting the selector binds the event to `this.el`. - delegateEvents: function (events) { - if (!(events || (events = _.result(this, 'events')))) return this; - this.undelegateEvents(); - for (var key in events) { - var method = events[key]; - if (!_.isFunction(method)) method = this[events[key]]; - if (!method) continue; - var match = key.match(delegateEventSplitter); - this.delegate(match[1], match[2], _.bind(method, this)); - } - return this; - }, - - // Add a single event listener to the view's element (or a child element - // using `selector`). This only works for delegate-able events: not `focus`, - // `blur`, and not `change`, `submit`, and `reset` in Internet Explorer. - delegate: function (eventName, selector, listener) { - this.vessel.element.on(eventName + '.delegateEvents' + this.cid, selector, listener); - }, - - // Clears all callbacks previously bound to the view by `delegateEvents`. - // You usually don't need to use this, but may wish to if you have multiple - // BI views attached to the same DOM element. - undelegateEvents: function () { - if (this.vessel) this.vessel.element.off('.delegateEvents' + this.cid); - return this; - }, - - // A finer-grained `undelegateEvents` for removing a single delegated event. - // `selector` and `listener` are both optional. - undelegate: function (eventName, selector, listener) { - this.vessel.element.off(eventName + '.delegateEvents' + this.cid, selector, listener); - }, - - // Produces a DOM element to be assigned to your view. Exposed for - // subclasses using an alternative DOM manipulation API. - _createElement: function (tagName) { - return document.createElement(tagName); - }, - - // Ensure that the V has a DOM element to render into. - // If `this.el` is a string, pass it through `$()`, take the first - // matching element, and re-assign it to `el`. Otherwise, create - // an element from the `id`, `className` and `tagName` properties. - _ensureElement: function () { - var attrs = _.extend({}, _.result(this, 'attributes')); - if (this.baseCls) attrs['class'] = _.result(this, 'baseCls'); - if (!this.element) { - this.setElement(this._createElement(_.result(this, 'tagName'))); - } else { - this.setElement(_.result(this, 'element')); - } - this._setAttributes(attrs); - }, - - // Set attributes from a hash on this view's element. Exposed for - // subclasses using an alternative DOM manipulation API. - _setAttributes: function (attributes) { - this.$el.attr(attributes); - } - - }); - - // BI.sync - // ------------- - - // Override this function to change the manner in which BI persists - // models to the server. You will be passed the type of request, and the - // model in question. By default, makes a RESTful Ajax request - // to the model's `url()`. Some possible customizations could be: - // - // * Use `setTimeout` to batch rapid-fire updates into a single request. - // * Send up the models as XML instead of JSON. - // * Persist models via WebSockets instead of Ajax. - // - // Turn on `BI.emulateHTTP` in order to send `PUT` and `DELETE` requests - // as `POST`, with a `_method` parameter containing the true HTTP method, - // as well as all requests with the body as `application/x-www-form-urlencoded` - // instead of `application/json` with the model in a param named `model`. - // Useful when interfacing with server-side languages like **PHP** that make - // it difficult to read the body of `PUT` requests. - BI.sync = function (method, model, options) { - var type = methodMap[method]; - - // Default options, unless specified. - _.defaults(options || (options = {}), { - emulateHTTP: BI.emulateHTTP, - emulateJSON: BI.emulateJSON - }); - - // Default JSON-request options. - var params = {type: type, dataType: 'json'}; - - // Ensure that we have a URL. - if (!options.url) { - params.url = _.result(model, method + "URL") || _.result(model, 'url'); - if (!params.url) { - return; - } - } - - // Ensure that we have the appropriate request data. - if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) { - params.contentType = 'application/json'; - params.data = _.extend({id: model.id}, model.toJSON(options), options.attrs); - } - - // For older servers, emulate JSON by encoding the request into an HTML-form. - if (options.emulateJSON) { - params.contentType = 'application/x-www-form-urlencoded'; - params.data = options.data ? options.data : params.data; - } - - // For older servers, emulate HTTP by mimicking the HTTP method with `_method` - // And an `X-HTTP-Method-Override` header. - if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) { - params.type = 'POST'; - if (options.emulateJSON) params.data._method = type; - var beforeSend = options.beforeSend; - options.beforeSend = function (xhr) { - xhr.setRequestHeader('X-HTTP-Method-Override', type); - if (beforeSend) return beforeSend.apply(this, arguments); - }; - } - - // Don't process data on a non-GET request. - if (params.type !== 'GET' && !options.emulateJSON) { - params.processData = false; - } - - // Pass along `textStatus` and `errorThrown` from jQuery. - var error = options.error; - options.error = function (xhr, textStatus, errorThrown) { - options.textStatus = textStatus; - options.errorThrown = errorThrown; - if (error) error.apply(this, arguments); - }; - - // Make the request, allowing the user to override any Ajax options. - var xhr = options.xhr = BI.ajax(_.extend(params, options)); - model.trigger('request', xhr, model, options); - return xhr; - }; - - // Map from CRUD to HTTP for our default `BI.sync` implementation. - var methodMap = { - 'create': 'POST', - 'update': 'PUT', - 'patch': 'PATCH', - 'delete': 'DELETE', - 'read': 'GET' - }; - - // Set the default implementation of `BI.ajax` to proxy through to `$`. - // Override this if you'd like to use a different library. - BI.ajax = $.ajax; - - // BI.Router - // --------------- - - // Routers map faux-URLs to actions, and fire events when routes are - // matched. Creating a new one sets its `routes` hash, if not set statically. - var Router = BI.Router = function (options) { - options || (options = {}); - if (options.routes) this.routes = options.routes; - this._bindRoutes(); - this._init.apply(this, arguments); - }; - - // Cached regular expressions for matching named param parts and splatted - // parts of route strings. - var optionalParam = /\((.*?)\)/g; - var namedParam = /(\(\?)?:\w+/g; - var splatParam = /\*\w+/g; - var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g; - - // Set up all inheritable **BI.Router** properties and methods. - _.extend(Router.prototype, Events, { - - // _init is an empty function by default. Override it with your own - // initialization logic. - _init: function () { - }, - - // Manually bind a single named route to a callback. For example: - // - // this.route('search/:query/p:num', 'search', function(query, num) { - // ... - // }); - // - route: function (route, name, callback) { - if (!_.isRegExp(route)) route = this._routeToRegExp(route); - if (_.isFunction(name)) { - callback = name; - name = ''; - } - if (!callback) callback = this[name]; - var router = this; - BI.history.route(route, function (fragment) { - var args = router._extractParameters(route, fragment); - if (router.execute(callback, args, name) !== false) { - router.trigger.apply(router, ['route:' + name].concat(args)); - router.trigger('route', name, args); - BI.history.trigger('route', router, name, args); - } - }); - return this; - }, - - // Execute a route handler with the provided parameters. This is an - // excellent place to do pre-route setup or post-route cleanup. - execute: function (callback, args, name) { - if (callback) callback.apply(this, args); - }, - - // Simple proxy to `BI.history` to save a fragment into the history. - navigate: function (fragment, options) { - BI.history.navigate(fragment, options); - return this; - }, - - // Bind all defined routes to `BI.history`. We have to reverse the - // order of the routes here to support behavior where the most general - // routes can be defined at the bottom of the route map. - _bindRoutes: function () { - if (!this.routes) return; - this.routes = _.result(this, 'routes'); - var route, routes = _.keys(this.routes); - while ((route = routes.pop()) != null) { - this.route(route, this.routes[route]); - } - }, - - // Convert a route string into a regular expression, suitable for matching - // against the current location hash. - _routeToRegExp: function (route) { - route = route.replace(escapeRegExp, '\\$&') - .replace(optionalParam, '(?:$1)?') - .replace(namedParam, function (match, optional) { - return optional ? match : '([^/?]+)'; - }) - .replace(splatParam, '([^?]*?)'); - return new RegExp('^' + route + '(?:\\?([\\s\\S]*))?$'); - }, - - // Given a route, and a URL fragment that it matches, return the array of - // extracted decoded parameters. Empty or unmatched parameters will be - // treated as `null` to normalize cross-browser behavior. - _extractParameters: function (route, fragment) { - var params = route.exec(fragment).slice(1); - return _.map(params, function (param, i) { - // Don't decode the search params. - if (i === params.length - 1) return param || null; - return param ? decodeURIComponent(param) : null; - }); - } - - }); - - // BI.History - // ---------------- - - // Handles cross-browser history management, based on either - // [pushState](http://diveintohtml5.info/history.html) and real URLs, or - // [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange) - // and URL fragments. If the browser supports neither (old IE, natch), - // falls back to polling. - var History = BI.History = function () { - this.handlers = []; - _.bindAll(this, 'checkUrl'); - - // Ensure that `History` can be used outside of the browser. - if (typeof window !== 'undefined') { - this.location = window.location; - this.history = window.history; - } - }; - - // Cached regex for stripping a leading hash/slash and trailing space. - var routeStripper = /^[#\/]|\s+$/g; - - // Cached regex for stripping leading and trailing slashes. - var rootStripper = /^\/+|\/+$/g; - - // Cached regex for stripping urls of hash. - var pathStripper = /#.*$/; - - // Has the history handling already been started? - History.started = false; - - // Set up all inheritable **BI.History** properties and methods. - _.extend(History.prototype, Events, { - - // The default interval to poll for hash changes, if necessary, is - // twenty times a second. - interval: 50, - - // Are we at the app root? - atRoot: function () { - var path = this.location.pathname.replace(/[^\/]$/, '$&/'); - return path === this.root && !this.getSearch(); - }, - - // In IE6, the hash fragment and search params are incorrect if the - // fragment contains `?`. - getSearch: function () { - var match = this.location.href.replace(/#.*/, '').match(/\?.+/); - return match ? match[0] : ''; - }, - - // Gets the true hash value. Cannot use location.hash directly due to bug - // in Firefox where location.hash will always be decoded. - getHash: function (window) { - var match = (window || this).location.href.match(/#(.*)$/); - return match ? match[1] : ''; - }, - - // Get the pathname and search params, without the root. - getPath: function () { - var path = decodeURI(this.location.pathname + this.getSearch()); - var root = this.root.slice(0, -1); - if (!path.indexOf(root)) path = path.slice(root.length); - return path.charAt(0) === '/' ? path.slice(1) : path; - }, - - // Get the cross-browser normalized URL fragment from the path or hash. - getFragment: function (fragment) { - if (fragment == null) { - if (this._hasPushState || !this._wantsHashChange) { - fragment = this.getPath(); - } else { - fragment = this.getHash(); - } - } - return fragment.replace(routeStripper, ''); - }, - - // Start the hash change handling, returning `true` if the current URL matches - // an existing route, and `false` otherwise. - start: function (options) { - if (History.started) throw new Error('BI.history has already been started'); - History.started = true; - - // Figure out the initial configuration. Do we need an iframe? - // Is pushState desired ... is it available? - this.options = _.extend({root: '/'}, this.options, options); - this.root = this.options.root; - this._wantsHashChange = this.options.hashChange !== false; - this._hasHashChange = 'onhashchange' in window; - this._wantsPushState = !!this.options.pushState; - this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState); - this.fragment = this.getFragment(); - - // Normalize root to always include a leading and trailing slash. - this.root = ('/' + this.root + '/').replace(rootStripper, '/'); - - // Transition from hashChange to pushState or vice versa if both are - // requested. - if (this._wantsHashChange && this._wantsPushState) { - - // If we've started off with a route from a `pushState`-enabled - // browser, but we're currently in a browser that doesn't support it... - if (!this._hasPushState && !this.atRoot()) { - var root = this.root.slice(0, -1) || '/'; - this.location.replace(root + '#' + this.getPath()); - // Return immediately as browser will do redirect to new url - return true; - - // Or if we've started out with a hash-based route, but we're currently - // in a browser where it could be `pushState`-based instead... - } else if (this._hasPushState && this.atRoot()) { - this.navigate(this.getHash(), {replace: true}); - } - - } - - // Proxy an iframe to handle location events if the browser doesn't - // support the `hashchange` event, HTML5 history, or the user wants - // `hashChange` but not `pushState`. - if (!this._hasHashChange && this._wantsHashChange && (!this._wantsPushState || !this._hasPushState)) { - var iframe = document.createElement('iframe'); - iframe.src = 'javascript:0'; - iframe.style.display = 'none'; - iframe.tabIndex = -1; - var body = document.body; - // Using `appendChild` will throw on IE < 9 if the document is not ready. - this.iframe = body.insertBefore(iframe, body.firstChild).contentWindow; - this.iframe.document.open().close(); - this.iframe.location.hash = '#' + this.fragment; - } - - // Add a cross-platform `addEventListener` shim for older browsers. - var addEventListener = window.addEventListener || function (eventName, listener) { - return attachEvent('on' + eventName, listener); - }; - - // Depending on whether we're using pushState or hashes, and whether - // 'onhashchange' is supported, determine how we check the URL state. - if (this._hasPushState) { - addEventListener('popstate', this.checkUrl, false); - } else if (this._wantsHashChange && this._hasHashChange && !this.iframe) { - addEventListener('hashchange', this.checkUrl, false); - } else if (this._wantsHashChange) { - this._checkUrlInterval = setInterval(this.checkUrl, this.interval); - } - - if (!this.options.silent) return this.loadUrl(); - }, - - // Disable BI.history, perhaps temporarily. Not useful in a real app, - // but possibly useful for unit testing Routers. - stop: function () { - // Add a cross-platform `removeEventListener` shim for older browsers. - var removeEventListener = window.removeEventListener || function (eventName, listener) { - return detachEvent('on' + eventName, listener); - }; - - // Remove window listeners. - if (this._hasPushState) { - removeEventListener('popstate', this.checkUrl, false); - } else if (this._wantsHashChange && this._hasHashChange && !this.iframe) { - removeEventListener('hashchange', this.checkUrl, false); - } - - // Clean up the iframe if necessary. - if (this.iframe) { - document.body.removeChild(this.iframe.frameElement); - this.iframe = null; - } - - // Some environments will throw when clearing an undefined interval. - if (this._checkUrlInterval) clearInterval(this._checkUrlInterval); - History.started = false; - }, - - // Add a route to be tested when the fragment changes. Routes added later - // may override previous routes. - route: function (route, callback) { - this.handlers.unshift({route: route, callback: callback}); - }, - - // Checks the current URL to see if it has changed, and if it has, - // calls `loadUrl`, normalizing across the hidden iframe. - checkUrl: function (e) { - var current = this.getFragment(); - - // If the user pressed the back button, the iframe's hash will have - // changed and we should use that for comparison. - if (current === this.fragment && this.iframe) { - current = this.getHash(this.iframe); - } - - if (current === this.fragment) return false; - if (this.iframe) this.navigate(current); - this.loadUrl(); - }, - - // Attempt to load the current URL fragment. If a route succeeds with a - // match, returns `true`. If no defined routes matches the fragment, - // returns `false`. - loadUrl: function (fragment) { - fragment = this.fragment = this.getFragment(fragment); - return _.any(this.handlers, function (handler) { - if (handler.route.test(fragment)) { - handler.callback(fragment); - return true; - } - }); - }, - - // Save a fragment into the hash history, or replace the URL state if the - // 'replace' option is passed. You are responsible for properly URL-encoding - // the fragment in advance. - // - // The options object can contain `trigger: true` if you wish to have the - // route callback be fired (not usually desirable), or `replace: true`, if - // you wish to modify the current URL without adding an entry to the history. - navigate: function (fragment, options) { - if (!History.started) return false; - if (!options || options === true) options = {trigger: !!options}; - - // Normalize the fragment. - fragment = this.getFragment(fragment || ''); - - // Don't include a trailing slash on the root. - var root = this.root; - if (fragment === '' || fragment.charAt(0) === '?') { - root = root.slice(0, -1) || '/'; - } - var url = root + fragment; - - // Strip the hash and decode for matching. - fragment = decodeURI(fragment.replace(pathStripper, '')); - - if (this.fragment === fragment) return; - this.fragment = fragment; - - // If pushState is available, we use it to set the fragment as a real URL. - if (this._hasPushState) { - this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url); - - // If hash changes haven't been explicitly disabled, update the hash - // fragment to store history. - } else if (this._wantsHashChange) { - this._updateHash(this.location, fragment, options.replace); - if (this.iframe && (fragment !== this.getHash(this.iframe))) { - // Opening and closing the iframe tricks IE7 and earlier to push a - // history entry on hash-tag change. When replace is true, we don't - // want this. - if (!options.replace) this.iframe.document.open().close(); - this._updateHash(this.iframe.location, fragment, options.replace); - } - - // If you've told us that you explicitly don't want fallback hashchange- - // based history, then `navigate` becomes a page refresh. - } else { - return this.location.assign(url); - } - if (options.trigger) return this.loadUrl(fragment); - }, - - // Update the hash location, either replacing the current entry, or adding - // a new one to the browser history. - _updateHash: function (location, fragment, replace) { - if (replace) { - var href = location.href.replace(/(javascript:|#).*$/, ''); - location.replace(href + '#' + fragment); - } else { - // Some browsers require that `hash` contains a leading #. - location.hash = '#' + fragment; - } - } - - }); - - // Create the default BI.history. - BI.history = new History; - - // Helpers - // ------- - - // Helper function to correctly set up the prototype chain, for subclasses. - // Similar to `goog.inherits`, but uses a hash of prototype properties and - // class properties to be extended. - var extend = function (protoProps, staticProps) { - var parent = this; - var child; - - // The constructor function for the new subclass is either defined by you - // (the "constructor" property in your `extend` definition), or defaulted - // by us to simply call the parent's constructor. - if (protoProps && _.has(protoProps, 'constructor')) { - child = protoProps.constructor; - } else { - child = function () { - return parent.apply(this, arguments); - }; - } - - // Add static properties to the constructor function, if supplied. - _.extend(child, parent, staticProps); - - // Set the prototype chain to inherit from `parent`, without calling - // `parent`'s constructor function. - var Surrogate = function () { - this.constructor = child; - }; - Surrogate.prototype = parent.prototype; - child.prototype = new Surrogate; - - // Add prototype properties (instance properties) to the subclass, - // if supplied. - if (protoProps) _.extend(child.prototype, protoProps); - - // Set a convenience property in case the parent's prototype is needed - // later. - child.__super__ = parent.prototype; - - return child; - }; - - // Set up inheritance for the model, collection, router, view and history. - M.extend = Collection.extend = Router.extend = V.extend = History.extend = extend; - - // Throw an error when a URL is needed, and none is supplied. - var urlError = function () { - throw new Error('A "url" property or function must be specified'); - }; - - // Wrap an optional error callback with a fallback error event. - var wrapError = function (model, options) { - var error = options.error; - options.error = function (resp) { - if (error) error(model, resp, options); - model.trigger('error', model, resp, options); - }; - }; - - return BI; - -}));/** - * MVC路由 - * @class BI.WRouter - * @extends BI.Router - * @type {*|void|Object} - */ -BI.WRouter = BI.Router.extend({ - add: function(route, callback){ - this.handlers || (this.handlers=[]); - this.handlers.unshift({route: route, callback: callback}) - }, - - route: function(route, name, callback) { - if (!_.isRegExp(route)) route = this._routeToRegExp(route); - if (_.isFunction(name)) { - callback = name; - name = ''; - } - if (!callback) callback = this[name]; - var self = this; - this.add(route, function(fragment) { - var args = self._extractParameters(route, fragment); - var result = self.execute(callback, args, name) - if (result !== false) { - self.trigger.apply(self, ['route:' + name].concat(args)); - self.trigger('route', name, args); - } - return result; - }); - return this; - }, - - execute: function(callback, args, name) { - if (callback) return callback.apply(this, args); - return name; - }, - - get: function(fragment){ - var result = null; - _.any(this.handlers, function(handler) { - if (handler.route.test(fragment)) { - result = handler.callback(fragment); - return true; - } - }); - return result; - } -});/** - * 基本函数 - * Create By GUY 2014\11\17 - * - */ - -if (!window.BI) { - window.BI = {}; -} -; -!(function ($, undefined) { - var traverse = function (func, context) { - return function (value, key, obj) { - return func.call(context, key, value, obj); - } - }; - var _apply = function (name) { - return function () { - return _[name].apply(_, arguments); - } - }; - var _applyFunc = function (name) { - return function () { - var args = Array.prototype.slice.call(arguments, 0); - args[1] = _.isFunction(args[1]) ? traverse(args[1], args[2]) : args[1]; - return _[name].apply(_, args); - } - }; - - //Utility - _.extend(BI, { - i18nText: function (key) { - var localeText = (BI.i18n && BI.i18n[key]) || ""; - if (!localeText) { - localeText = key; - } - var len = arguments.length; - if (len > 1) { - for (var i = 1; i < len; i++) { - var key = "{R" + i + "}"; - localeText = localeText.replaceAll(key, arguments[i] + ""); - } - } - return localeText; - }, - - assert: function (v, is) { - if (this.isFunction(is)) { - if (!is(v)) { - throw new Error(v + " error"); - } else { - return true; - } - } - if (!this.isArray(is)) { - is = [is]; - } - if (!this.deepContains(is, v)) { - throw new Error(v + " error"); - } - }, - - warn: function (message) { - console.warn(message) - }, - - UUID: function () { - var f = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; - var str = ""; - for (var i = 0; i < 16; i++) { - var r = parseInt(f.length * Math.random(), 10); - str += f[r]; - } - return str; - }, - - isWidget: function (widget) { - return widget instanceof BI.Widget || (BI.View && widget instanceof BI.View); - }, - - createWidgets: function (items, options) { - if (!BI.isArray(items)) { - throw new Error("cannot create Widgets") - } - return BI.map(BI.flatten(items), function (i, item) { - return BI.createWidget(item, BI.deepClone(options)); - }); - }, - - createItems: function (data, innerAttr, outerAttr) { - innerAttr = BI.isArray(innerAttr) ? innerAttr : BI.makeArray(BI.flatten(data).length, innerAttr); - outerAttr = BI.isArray(outerAttr) ? outerAttr : BI.makeArray(BI.flatten(data).length, outerAttr); - return BI.map(data, function (i, item) { - if (BI.isArray(item)) { - return BI.createItems(item, innerAttr, outerAttr); - } - if (item instanceof BI.Widget) { - return BI.extend({}, innerAttr.shift(), outerAttr.shift(), { - type: null, - el: item - }); - } - if (innerAttr[0] instanceof BI.Widget) { - outerAttr.shift(); - return BI.extend({}, item, { - el: innerAttr.shift() - }) - } - if (item.el instanceof BI.Widget || (BI.View && item.el instanceof BI.View)) { - innerAttr.shift(); - return BI.extend({}, outerAttr.shift(), {type: null}, item); - } - if (item.el) { - return BI.extend({}, outerAttr.shift(), item, { - el: BI.extend({}, innerAttr.shift(), item.el) - }) - } - return BI.extend({}, outerAttr.shift(), { - el: BI.extend({}, innerAttr.shift(), item) - }) - }) - }, - - //用容器包装items - packageItems: function (items, layouts) { - for (var i = layouts.length - 1; i >= 0; i--) { - items = BI.map(items, function (k, it) { - return BI.extend({}, layouts[i], { - items: [ - BI.extend({}, layouts[i].el, { - el: it - }) - ] - }) - }) - } - return items; - }, - - formatEL: function (obj) { - if (obj && !obj.type && obj.el) { - return obj; - } - return { - el: obj - }; - }, - - //剥开EL - stripEL: function (obj) { - return obj.type && obj || obj.el || obj; - }, - - trans2Element: function (widgets) { - return BI.map(widgets, function (i, wi) { - return wi.element; - }); - } - }); - - //集合相关方法 - _.each(["where", "findWhere", "contains", "invoke", "pluck", "shuffle", "sample", "toArray", "size"], function (name) { - BI[name] = _apply(name) - }); - _.each(["each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min", - "sortBy", "groupBy", "indexBy", "countBy", "partition"], function (name) { - BI[name] = _applyFunc(name) - }); - _.extend(BI, { - clamp: function (value, minValue, maxValue) { - if (value < minValue) { - value = minValue; - } - if (value > maxValue) { - value = maxValue; - } - return value; - }, - //数数 - count: function (from, to, predicate) { - var t; - if (predicate) { - for (t = from; t < to; t++) { - predicate(t); - } - } - return to - from; - }, - - //倒数 - inverse: function (from, to, predicate) { - return BI.count(to, from, predicate); - }, - - firstKey: function (obj) { - var res = undefined; - BI.any(obj, function (key, value) { - res = key; - return true; - }); - return res; - }, - - lastKey: function (obj) { - var res = undefined; - BI.each(obj, function (key, value) { - res = key; - return true; - }); - return res; - }, - - firstObject: function (obj) { - var res = undefined; - BI.any(obj, function (key, value) { - res = value; - return true; - }); - return res; - }, - - lastObject: function (obj) { - var res = undefined; - BI.each(obj, function (key, value) { - res = value; - return true; - }); - return res; - }, - - concat: function (obj1, obj2) { - if (BI.isKey(obj1)) { - return obj1 + "" + obj2; - } - if (BI.isArray(obj1)) { - return obj1.concat(obj2); - } - if (BI.isObject(obj1)) { - return _.extend({}, obj1, obj2); - } - }, - - backEach: function (obj, predicate, context) { - predicate = BI.iteratee(predicate, context); - for (var index = obj.length - 1; index >= 0; index--) { - predicate(index, obj[index], obj); - } - return false; - }, - - backAny: function (obj, predicate, context) { - predicate = BI.iteratee(predicate, context); - for (var index = obj.length - 1; index >= 0; index--) { - if (predicate(index, obj[index], obj)) { - return true; - } - } - return false; - }, - - backEvery: function (obj, predicate, context) { - predicate = BI.iteratee(predicate, context); - for (var index = obj.length - 1; index >= 0; index--) { - if (!predicate(index, obj[index], obj)) { - return false; - } - } - return true; - }, - - backFindKey: function (obj, predicate, context) { - predicate = BI.iteratee(predicate, context); - var keys = _.keys(obj), key; - for (var i = keys.length - 1; i >= 0; i--) { - key = keys[i]; - if (predicate(obj[key], key, obj)) { - return key; - } - } - }, - - backFind: function (obj, predicate, context) { - var key; - if (BI.isArray(obj)) { - key = BI.findLastIndex(obj, predicate, context); - } else { - key = BI.backFindKey(obj, predicate, context); - } - if (key !== void 0 && key !== -1) { - return obj[key]; - } - }, - - remove: function (obj, target, context) { - var isFunction = BI.isFunction(target); - target = isFunction || BI.isArray(target) ? target : [target]; - var i; - if (BI.isArray(obj)) { - for (i = 0; i < obj.length; i++) { - if ((isFunction && target.apply(context, [i, obj[i]]) === true) || (!isFunction && target.contains(obj[i]))) { - obj.splice(i--, 1); - } - } - } else { - BI.each(obj, function (i, v) { - if ((isFunction && target.apply(context, [i, obj[i]]) === true) || (!isFunction && target.contains(obj[i]))) { - delete obj[i]; - } - }); - } - }, - - removeAt: function (obj, index) { - index = BI.isArray(index) ? index : [index]; - var isArray = BI.isArray(obj), i; - for (i = 0; i < index.length; i++) { - if (isArray) { - obj[index[i]] = "$deleteIndex"; - } else { - delete obj[index[i]]; - } - } - if (isArray) { - BI.remove(obj, "$deleteIndex"); - } - }, - - string2Array: function (str) { - return str.split('&-&'); - }, - - array2String: function (array) { - return array.join("&-&"); - }, - - abc2Int: function (str) { - var idx = 0, start = 'A', str = str.toUpperCase(); - for (var i = 0, len = str.length; i < len; ++i) { - idx = str.charAt(i).charCodeAt(0) - start.charCodeAt(0) + 26 * idx + 1; - if (idx > (2147483646 - str.charAt(i).charCodeAt(0) + start.charCodeAt(0)) / 26) { - return 0; - } - } - return idx; - }, - - int2Abc: function (num) { - var DIGITS = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; - var idx = num, str = ""; - if (num === 0) { - return ""; - } - while (idx !== 0) { - var t = idx % 26; - if (t === 0) { - t = 26; - } - str = DIGITS[t - 1] + str; - idx = (idx - t) / 26; - } - return str; - } - }); - - //数组相关的方法 - _.each(["first", "initial", "last", "rest", "compact", "flatten", "without", "union", "intersection", - "difference", "zip", "unzip", "object", "indexOf", "lastIndexOf", "sortedIndex", "range"], function (name) { - BI[name] = _apply(name) - }); - _.each(["findIndex", "findLastIndex"], function (name) { - BI[name] = _applyFunc(name) - }); - _.extend(BI, { - //构建一个长度为length的数组 - makeArray: function (length, value) { - var res = []; - for (var i = 0; i < length; i++) { - if (BI.isNull(value)) { - res.push(i); - } else { - res.push(BI.deepClone(value)); - } - } - return res; - }, - - makeObject: function (array, value) { - var map = {}; - for (var i = 0; i < array.length; i++) { - if (BI.isNull(value)) { - map[array[i]] = array[i]; - } else { - map[array[i]] = BI.deepClone(value); - } - } - return map; - }, - - makeArrayByArray: function (array, value) { - var res = []; - if (!array) { - return res; - } - for (var i = 0, len = array.length; i < len; i++) { - if (BI.isArray(array[i])) { - res.push(arguments.callee(array[i], value)); - } else { - res.push(BI.deepClone(value)); - } - } - return res; - }, - - uniq: function (array, isSorted, iteratee, context) { - if (array == null) { - return []; - } - if (!_.isBoolean(isSorted)) { - context = iteratee; - iteratee = isSorted; - isSorted = false; - } - iteratee && (iteratee = traverse(iteratee, context)); - return _.uniq.call(_, array, isSorted, iteratee, context); - } - }); - - //对象相关方法 - _.each(["keys", "allKeys", "values", "pairs", "invert", "create", "functions", "extend", "extendOwn", - "defaults", "clone", "property", "propertyOf", "matcher", "isEqual", "isMatch", "isEmpty", - "isElement", "isNumber", "isString", "isArray", "isObject", "isArguments", "isFunction", "isFinite", - "isBoolean", "isDate", "isRegExp", "isError", "isNaN", "isUndefined"], function (name) { - BI[name] = _apply(name) - }); - _.each(["mapObject", "findKey", "pick", "omit", "tap"], function (name) { - BI[name] = _applyFunc(name) - }); - _.extend(BI, { - - inherit: function (sb, sp, overrides) { - if (typeof sp == 'object') { - overrides = sp; - sp = sb; - sb = function () { - sp.apply(this, arguments); - }; - } - var F = function () { - }, spp = sp.prototype; - F.prototype = spp; - sb.prototype = new F(); - sb.superclass = spp; - _.extend(sb.prototype, overrides, { - superclass: sp - }); - return sb; - }, - - has: function (obj, keys) { - if (BI.isArray(keys)) { - if (keys.length === 0) { - return false; - } - return BI.every(keys, function (i, key) { - return _.has(obj, key); - }); - } - return _.has.apply(_, arguments); - }, - - //数字和字符串可以作为key - isKey: function (key) { - return BI.isNumber(key) || (BI.isString(key) && key.length > 0); - }, - - //忽略大小写的等于 - isCapitalEqual: function (a, b) { - a = BI.isNull(a) ? a : ("" + a).toLowerCase(); - b = BI.isNull(b) ? b : ("" + b).toLowerCase(); - return BI.isEqual(a, b); - }, - - isWidthOrHeight: function (w) { - if (typeof w == 'number') { - return w >= 0; - } else if (typeof w == 'string') { - return /^\d{1,3}%$/.exec(w) || w == 'auto' || /^\d+px$/.exec(w); - } - }, - - isNotNull: function (obj) { - return !BI.isNull(obj); - }, - - isNull: function (obj) { - return typeof obj === "undefined" || obj === null; - }, - - isPlainObject: function () { - return $.isPlainObject.apply($, arguments); - }, - - isEmptyArray: function (arr) { - return BI.isArray(arr) && BI.isEmpty(arr); - }, - - isNotEmptyArray: function (arr) { - return BI.isArray(arr) && !BI.isEmpty(arr); - }, - - isEmptyObject: function (obj) { - return BI.isEqual(obj, {}); - }, - - isNotEmptyObject: function (obj) { - return BI.isPlainObject(obj) && !BI.isEmptyObject(obj); - }, - - isEmptyString: function (obj) { - return BI.isString(obj) && obj.length === 0; - }, - - isNotEmptyString: function (obj) { - return BI.isString(obj) && !BI.isEmptyString(obj); - }, - - isWindow: function () { - return $.isWindow.apply($, arguments); - } - }); - - //deep方法 - _.extend(BI, { - /** - *完全克隆�?个js对象 - * @param obj - * @returns {*} - */ - deepClone: function (obj) { - if (obj === null || obj === undefined) { - return obj; - } - - var type = Object.prototype.toString.call(obj); - - // Date - if (type === '[object Date]') { - return new Date(obj.getTime()); - } - - var i, clone, key; - - // Array - if (type === '[object Array]') { - i = obj.length; - - clone = []; - - while (i--) { - clone[i] = BI.deepClone(obj[i]); - } - } - // Object - else if (type === '[object Object]' && obj.constructor === Object) { - clone = {}; - - for (var i in obj) { - if (_.has(obj, i)) { - clone[i] = BI.deepClone(obj[i]); - } - } - } - - return clone || obj; - }, - - isDeepMatch: function (object, attrs) { - var keys = BI.keys(attrs), length = keys.length; - if (object == null) { - return !length; - } - var obj = Object(object); - for (var i = 0; i < length; i++) { - var key = keys[i]; - if (!BI.isEqual(attrs[key], obj[key]) || !(key in obj)) { - return false; - } - } - return true; - }, - - deepContains: function (obj, copy) { - if (BI.isObject(copy)) { - return BI.any(obj, function (i, v) { - if (BI.isEqual(v, copy)) { - return true; - } - }) - } - return BI.contains(obj, copy); - }, - - deepIndexOf: function (obj, target) { - for (var i = 0; i < obj.length; i++) { - if (BI.isEqual(target, obj[i])) { - return i; - } - } - return -1; - }, - - deepRemove: function (obj, target) { - var done = false; - var i; - if (BI.isArray(obj)) { - for (i = 0; i < obj.length; i++) { - if (BI.isEqual(target, obj[i])) { - obj.splice(i--, 1); - done = true; - } - } - } else { - BI.each(obj, function (i, v) { - if (BI.isEqual(target, obj[i])) { - delete obj[i]; - done = true; - } - }); - } - return done; - }, - - deepWithout: function (obj, target) { - if (BI.isArray(obj)) { - var result = []; - for (var i = 0; i < obj.length; i++) { - if (!BI.isEqual(target, obj[i])) { - result.push(obj[i]); - } - } - return result; - } else { - var result = {}; - BI.each(obj, function (i, v) { - if (!BI.isEqual(target, obj[i])) { - result[i] = v; - } - }); - return result; - } - }, - - deepUnique: function (array) { - var result = []; - BI.each(array, function (i, item) { - if (!BI.deepContains(result, item)) { - result.push(item); - } - }); - return result; - }, - - //比较两个对象得出不一样的key值 - deepDiff: function (object, other) { - object || (object = {}); - other || (other = {}); - var result = []; - var used = []; - for (var b in object) { - if (this.has(object, b)) { - if (!this.isEqual(object[b], other[b])) { - result.push(b); - } - used.push(b); - } - } - for (var b in other) { - if (this.has(other, b) && !used.contains(b)) { - result.push(b); - } - } - return result; - } - }); - - //通用方法 - _.each(["uniqueId", "result", "chain", "iteratee", "escape", "unescape"], function (name) { - BI[name] = function () { - return _[name].apply(_, arguments); - } - }); - - //事件相关方法 - _.each(["bind", "once", "partial", "debounce", "throttle", "delay", "defer", "wrap"], function (name) { - BI[name] = function () { - return _[name].apply(_, arguments); - } - }); - - _.extend(BI, { - nextTick: (function () { - var callbacks = []; - var pending = false; - var timerFunc; - - function nextTickHandler() { - pending = false; - var copies = callbacks.slice(0); - callbacks = []; - for (var i = 0; i < copies.length; i++) { - copies[i](); - } - } - - if (typeof Promise !== 'undefined') { - var p = Promise.resolve(); - timerFunc = function () { - p.then(nextTickHandler); - } - } else - - /* istanbul ignore if */ - if (typeof MutationObserver !== 'undefined') { - var counter = 1; - var observer = new MutationObserver(nextTickHandler); - var textNode = document.createTextNode(counter + ""); - observer.observe(textNode, { - characterData: true - }); - timerFunc = function () { - counter = (counter + 1) % 2; - textNode.data = counter + ""; - } - } else { - timerFunc = function () { - setTimeout(nextTickHandler, 0) - } - } - return function queueNextTick(cb) { - var _resolve; - var args = [].slice.call(arguments, 1); - callbacks.push(function () { - if (cb) { - cb.apply(null, args); - } - if (_resolve) { - _resolve.apply(null, args); - } - }); - if (!pending) { - pending = true; - timerFunc(); - } - if (!cb && typeof Promise !== 'undefined') { - return new Promise(function (resolve) { - _resolve = resolve - }) - } - } - })() - }); - - //数字相关方法 - _.each(["random"], function (name) { - BI[name] = _apply(name) - }); - _.extend(BI, { - getTime: function () { - if (window.performance && window.performance.now) { - return window.performance.now(); - } else { - if (window.performance && window.performance.webkitNow) { - return window.performance.webkitNow(); - } else { - if (Date.now) { - return Date.now(); - } else { - return new Date().getTime(); - } - } - } - }, - - parseInt: function (number) { - var radix = 10; - if (/^0x/g.test(number)) { - radix = 16; - } - try { - return parseInt(number, radix); - } catch (e) { - throw new Error(number + "parse int error"); - return NaN; - } - }, - - parseSafeInt: function (value) { - var MAX_SAFE_INTEGER = 9007199254740991; - return value - ? this.clamp(this.parseInt(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) - : (value === 0 ? value : 0); - }, - - parseFloat: function (number) { - try { - return parseFloat(number); - } catch (e) { - throw new Error(number + "parse float error"); - return NaN; - } - }, - - isNaturalNumber: function (number) { - if (/^\d+$/.test(number)) { - return true; - } - return false; - }, - - isPositiveInteger: function (number) { - if (/^\+?[1-9][0-9]*$/.test(number)) { - return true; - } - return false; - }, - - isNegativeInteger: function (number) { - if (/^\-[1-9][0-9]*$/.test(number)) { - return true; - } - return false; - }, - - isInteger: function (number) { - if (/^\-?\d+$/.test(number)) { - return true; - } - return false; - }, - - isNumeric: function (number) { - return $.isNumeric(number); - }, - - isFloat: function (number) { - if (/^([+-]?)\\d*\\.\\d+$/.test(number)) { - return true; - } - return false; - }, - - isOdd: function (number) { - if (!BI.isInteger(number)) { - return false; - } - return number & 1 === 1; - }, - - isEven: function (number) { - if (!BI.isInteger(number)) { - return false; - } - return number & 1 === 0; - }, - - sum: function (array, iteratee, context) { - var sum = 0; - BI.each(array, function (i, item) { - if (iteratee) { - sum += Number(iteratee.apply(context, [i, item])); - } else { - sum += Number(item); - } - }); - return sum; - }, - - average: function (array, iteratee, context) { - var sum = BI.sum(array, iteratee, context); - return sum / array.length; - } - }); - - //字符串相关方法 - _.extend(BI, { - trim: function () { - return $.trim.apply($, arguments); - }, - - toUpperCase: function (string) { - return (string + "").toLocaleUpperCase(); - }, - - toLowerCase: function (string) { - return (string + "").toLocaleLowerCase(); - }, - - isEndWithBlank: function (string) { - return /(\s|\u00A0)$/.test(string); - }, - - isLiteral: function (exp) { - var literalValueRE = /^\s?(true|false|-?[\d\.]+|'[^']*'|"[^"]*")\s?$/ - return literalValueRE.test(exp) - }, - - stripQuotes: function (str) { - var a = str.charCodeAt(0) - var b = str.charCodeAt(str.length - 1) - return a === b && (a === 0x22 || a === 0x27) - ? str.slice(1, -1) - : str - }, - - //background-color => backgroundColor - camelize: function (str) { - return str.replace(/-(.)/g, function (_, character) { - return character.toUpperCase(); - }); - }, - - //backgroundColor => background-color - hyphenate: function (str) { - return str.replace(/([A-Z])/g, '-$1').toLowerCase(); - }, - - isNotEmptyString: function (str) { - return BI.isString(str) && !BI.isEmpty(str); - }, - - isEmptyString: function (str) { - return BI.isString(str) && BI.isEmpty(str); - }, - - /** - * 对字符串进行加密 {@link #decrypt} - * @static - * @param str 原始字符�? - * @param keyt 密钥 - * @returns {String} 加密后的字符�? - */ - encrypt: function (str, keyt) { - if (str == "") { - return ""; - } - str = escape(str); - if (!keyt || keyt == "") { - keyt = "655"; - } - keyt = escape(keyt); - if (keyt == null || keyt.length <= 0) { - alert("Please enter a password with which to encrypt the message."); - return null; - } - var prand = ""; - for (var i = 0; i < keyt.length; i++) { - prand += keyt.charCodeAt(i).toString(); - } - var sPos = Math.floor(prand.length / 5); - var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos * 2) + prand.charAt(sPos * 3) + prand.charAt(sPos * 4) + prand.charAt(sPos * 5)); - - var incr = Math.ceil(keyt.length / 2); - var modu = Math.pow(2, 31) - 1; - if (mult < 2) { - alert("Algorithm cannot find a suitable hash. Please choose a different password. \nPossible considerations are to choose a more complex or longer password."); - return null; - } -// var salt = Math.round(Math.random() * 1000000000) % 100000000; - var salt = 101; - prand += salt; - while (prand.length > 10) { - prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length), 10)).toString(); - } - prand = (mult * prand + incr) % modu; - var enc_chr = ""; - var enc_str = ""; - for (var i = 0; i < str.length; i++) { - enc_chr = parseInt(str.charCodeAt(i) ^ Math.floor((prand / modu) * 255)); - if (enc_chr < 16) { - enc_str += "0" + enc_chr.toString(16); - } else { - enc_str += enc_chr.toString(16); - } - prand = (mult * prand + incr) % modu; - } - salt = salt.toString(16); - while (salt.length < 8) { - salt = "0" + salt; - } - enc_str += salt; - return enc_str; - }, - - /** - * 对加密后的字符串解密 {@link #encrypt} - * @static - * @param str 加密过的字符�? - * @param keyt 密钥 - * @returns {String} 解密后的字符�? - */ - decrypt: function (str, keyt) { - if (str == "") { - return ""; - } - if (!keyt || keyt == "") { - keyt = "655"; - } - keyt = escape(keyt); - if (str == null || str.length < 8) { - return; - } - if (keyt == null || keyt.length <= 0) { - return; - } - var prand = ""; - for (var i = 0; i < keyt.length; i++) { - prand += keyt.charCodeAt(i).toString(); - } - var sPos = Math.floor(prand.length / 5); - var tempmult = prand.charAt(sPos) + prand.charAt(sPos * 2) + prand.charAt(sPos * 3) + prand.charAt(sPos * 4); - if (sPos * 5 < prand.length) { - tempmult += prand.charAt(sPos * 5); - } - var mult = parseInt(tempmult); - var incr = Math.round(keyt.length / 2); - var modu = Math.pow(2, 31) - 1; - var salt = parseInt(str.substring(str.length - 8, str.length), 16); - str = str.substring(0, str.length - 8); - prand += salt; - while (prand.length > 10) { - prand = (parseInt(prand.substring(0, 10), 10) + parseInt(prand.substring(10, prand.length), 10)).toString(); - } - prand = (mult * prand + incr) % modu; - var enc_chr = ""; - var enc_str = ""; - for (var i = 0; i < str.length; i += 2) { - enc_chr = parseInt(parseInt(str.substring(i, i + 2), 16) ^ Math.floor((prand / modu) * 255)); - enc_str += String.fromCharCode(enc_chr); - prand = (mult * prand + incr) % modu; - } - return unescape(enc_str); - } - }); - - //浏览器相关方法 - _.extend(BI, { - isIE: function () { - return /(msie|trident)/i.test(navigator.userAgent.toLowerCase()); - }, - - isIE9Below: function () { - if (!BI.isIE()) { - return false; - } - var version = 0; - var agent = navigator.userAgent.toLowerCase(); - var v1 = agent.match(/(?:msie\s([\w.]+))/); - var v2 = agent.match(/(?:trident.*rv:([\w.]+))/); - if (v1 && v2 && v1[1] && v2[1]) { - version = Math.max(v1[1] * 1, v2[1] * 1); - } else if (v1 && v1[1]) { - version = v1[1] * 1; - } else if (v2 && v2[1]) { - version = v2[1] * 1; - } else { - version = 0; - } - return version < 9; - }, - - isEdge: function () { - return /edge/i.test(navigator.userAgent.toLowerCase()); - }, - - isChrome: function () { - return /chrome/i.test(navigator.userAgent.toLowerCase()); - }, - - isFireFox: function () { - return /firefox/i.test(navigator.userAgent.toLowerCase()); - }, - - isOpera: function () { - return /opera/i.test(navigator.userAgent.toLowerCase()); - }, - - isSafari: function () { - return /safari/i.test(navigator.userAgent.toLowerCase()); - }, - - isKhtml: function () { - return /Konqueror|Safari|KHTML/i.test(navigator.userAgent); - }, - - isMac: function () { - return /macintosh|mac os x/i.test(navigator.userAgent); - }, - - isWindows: function () { - return /windows|win32/i.test(navigator.userAgent); - }, - - isSupportCss3: function (style) { - var prefix = ['webkit', 'Moz', 'ms', 'o'], - i, len, - humpString = [], - htmlStyle = document.documentElement.style, - _toHumb = function (string) { - return string.replace(/-(\w)/g, function ($0, $1) { - return $1.toUpperCase(); - }); - }; - - for (i in prefix) { - humpString.push(_toHumb(prefix[i] + '-' + style)); - } - humpString.push(_toHumb(style)); - - for (i = 0, len = humpString.length; i < len; i++) { - if (humpString[i] in htmlStyle) { - return true; - } - } - return false; - } - }); - //BI请求 - _.extend(BI, { - - ajax: function (option) { - option || (option = {}); - var async = option.async; - option.data = BI.cjkEncodeDO(option.data || {}); - - $.ajax({ - url: option.url, - type: "POST", - data: option.data, - async: async, - error: option.error, - complete: function (res, status) { - if (BI.isFunction(option.complete)) { - option.complete(BI.jsonDecode(res.responseText), status); - } - } - }); - } - }); -})(jQuery);/** - * 客户端观察者,主要处理事件的添加、删除、执行等 - * @class BI.OB - * @abstract - */ -BI.OB = function (config) { - var props = this.props; - if (BI.isFunction(this.props)) { - props = this.props(config); - } - this.options = $.extend(this._defaultConfig(config), props, config); - this._init(); - this._initRef(); -}; -$.extend(BI.OB.prototype, { - props: {}, - init: null, - destroyed: null, - - _defaultConfig: function (config) { - return {}; - }, - - _init: function () { - this._initListeners(); - this.init && this.init(); - }, - - _initListeners: function () { - var self = this; - if (this.options.listeners != null) { - $.each(this.options.listeners, function (i, lis) { - (lis.target ? lis.target : self)[lis.once ? 'once' : 'on'] - (lis.eventName, _.bind(lis.action, self)) - }); - delete this.options.listeners; - } - }, - - //获得一个当前对象的引用 - _initRef: function () { - if (this.options.ref) { - this.options.ref.call(this, this); - } - }, - - _getEvents: function () { - if (!$.isArray(this.events)) { - this.events = [] - } - return this.events; - }, - - /** - * 给观察者绑定一个事件 - * @param {String} eventName 事件的名字 - * @param {Function} fn 事件对应的执行函数 - */ - on: function (eventName, fn) { - eventName = eventName.toLowerCase(); - var fns = this._getEvents()[eventName]; - if (!$.isArray(fns)) { - fns = []; - this._getEvents()[eventName] = fns; - } - fns.push(fn); - }, - - /** - * 给观察者绑定一个只执行一次的事件 - * @param {String} eventName 事件的名字 - * @param {Function} fn 事件对应的执行函数 - */ - once: function (eventName, fn) { - var proxy = function () { - fn.apply(this, arguments); - this.un(eventName, proxy); - }; - this.on(eventName, proxy); - }, - /** - * 解除观察者绑定的指定事件 - * @param {String} eventName 要解除绑定事件的名字 - * @param {Function} fn 事件对应的执行函数,该参数是可选的,没有该参数时,将解除绑定所有同名字的事件 - */ - un: function (eventName, fn) { - eventName = eventName.toLowerCase(); - - /*alex:如果fn是null,就是把eventName上面所有方法都un掉*/ - if (fn == null) { - delete this._getEvents()[eventName]; - } else { - var fns = this._getEvents()[eventName]; - if ($.isArray(fns)) { - var newFns = []; - $.each(fns, function (idx, ifn) { - if (ifn != fn) { - newFns.push(ifn); - } - }) - this._getEvents()[eventName] = newFns; - } - } - }, - /** - * 清除观察者的所有事件绑定 - */ - purgeListeners: function () { - /*alex:清空events*/ - this.events = []; - }, - /** - * 触发绑定过的事件 - * - * @param {String} eventName 要触发的事件的名字 - * @returns {Boolean} 如果事件函数返回false,则返回false并中断其他同名事件的执行,否则执行所有的同名事件并返回true - */ - fireEvent: function () { - var eventName = arguments[0].toLowerCase(); - var fns = this._getEvents()[eventName]; - if (BI.isArray(fns)) { - if (BI.isArguments(arguments[1])) { - for (var i = 0; i < fns.length; i++) { - if (fns[i].apply(this, arguments[1]) === false) { - return false; - } - } - } else { - var args = Array.prototype.slice.call(arguments, 1); - for (var i = 0; i < fns.length; i++) { - if (fns[i].apply(this, args) === false) { - return false; - } - } - } - } - return true; - }, - - destroy: function () { - this.destroyed && this.destroyed(); - this.purgeListeners(); - } -});/** - * Widget超类 - * @class BI.Widget - * @extends BI.OB - * - * @cfg {JSON} options 配置属性 - */ -BI.Widget = BI.inherit(BI.OB, { - _defaultConfig: function () { - return BI.extend(BI.Widget.superclass._defaultConfig.apply(this), { - root: false, - tagName: "div", - attributes: null, - data: null, - - tag: null, - disabled: false, - invisible: false, - invalid: false, - baseCls: "", - extraCls: "", - cls: "" - }) - }, - - //生命周期函数 - beforeCreate: null, - - created: null, - - render: null, - - beforeMounted: null, - - mounted: null, - - update: function () { - }, - - beforeDestroyed: null, - - destroyed: null, - - _init: function () { - BI.Widget.superclass._init.apply(this, arguments); - this.beforeCreate && this.beforeCreate(); - this._initRoot(); - this._initElementWidth(); - this._initElementHeight(); - this._initVisual(); - this._initState(); - this._initElement(); - this._initEffects(); - this.created && this.created(); - }, - - /** - * 初始化根节点 - * @private - */ - _initRoot: function () { - var o = this.options; - this.widgetName = o.widgetName || BI.uniqueId("widget"); - this._isRoot = o.root; - if (BI.isWidget(o.element)) { - if (o.element instanceof BI.Widget) { - this._parent = o.element; - this._parent.addWidget(this.widgetName, this); - } else { - this._isRoot = true; - } - this.element = this.options.element.element; - } else if (o.element) { - // if (o.root !== true) { - // throw new Error("root is a required property"); - // } - this.element = $(o.element); - this._isRoot = true; - } else { - this.element = $(document.createElement(o.tagName)); - } - if (o.baseCls || o.extraCls || o.cls) { - this.element.addClass((o.baseCls || "") + " " + (o.extraCls || "") + " " + (o.cls || "")); - } - if (o.attributes) { - this.element.attr(o.attributes); - } - if (o.data) { - this.element.data(o.data); - } - this._children = {}; - }, - - _initElementWidth: function () { - var o = this.options; - if (BI.isWidthOrHeight(o.width)) { - this.element.css("width", o.width); - } - }, - - _initElementHeight: function () { - var o = this.options; - if (BI.isWidthOrHeight(o.height)) { - this.element.css("height", o.height); - } - }, - - _initVisual: function () { - var o = this.options; - if (o.invisible) { - //用display属性做显示和隐藏,否则jquery会在显示时将display设为block会覆盖掉display:flex属性 - this.element.css("display", "none"); - } - }, - - _initEffects: function () { - var o = this.options; - if (o.disabled || o.invalid) { - if (this.options.disabled) { - this.setEnable(false); - } - if (this.options.invalid) { - this.setValid(false); - } - } - }, - - _initState: function () { - this._isMounted = false; - }, - - _initElement: function () { - var self = this; - var els = this.render && this.render(); - if (BI.isPlainObject(els)) { - els = [els]; - } - if (BI.isArray(els)) { - BI.each(els, function (i, el) { - BI.createWidget(el, { - element: self - }) - }) - } - // if (this._isRoot === true || !(this instanceof BI.Layout)) { - this._mount(); - // } - }, - - _setParent: function (parent) { - this._parent = parent; - }, - - _mount: function () { - var self = this; - var isMounted = this._isMounted; - if (isMounted || !this.isVisible()) { - return; - } - if (this._isRoot === true) { - isMounted = true; - } else if (this._parent && this._parent._isMounted === true) { - isMounted = true; - } - if (!isMounted) { - return; - } - this.beforeMounted && this.beforeMounted(); - this._isMounted = true; - this._mountChildren && this._mountChildren(); - BI.each(this._children, function (i, widget) { - !self.isEnabled() && widget._setEnable(false); - !self.isValid() && widget._setValid(false); - widget._mount && widget._mount(); - }); - this.mounted && this.mounted(); - }, - - _mountChildren: null, - - isMounted: function () { - return this._isMounted; - }, - - setWidth: function (w) { - this.options.width = w; - this._initElementWidth(); - }, - - setHeight: function (h) { - this.options.height = h; - this._initElementHeight(); - }, - - _setEnable: function (enable) { - if (enable === true) { - this.options.disabled = false; - } else if (enable === false) { - this.options.disabled = true; - } - //递归将所有子组件使能 - BI.each(this._children, function (i, child) { - !child._manualSetEnable && child._setEnable && child._setEnable(enable); - }); - }, - - _setValid: function (valid) { - if (valid === true) { - this.options.invalid = false; - } else if (valid === false) { - this.options.invalid = true; - } - //递归将所有子组件使有效 - BI.each(this._children, function (i, child) { - !child._manualSetValid && child._setValid && child._setValid(valid); - }); - }, - - _setVisible: function (visible) { - if (visible === true) { - this.options.invisible = false; - } else if (visible === false) { - this.options.invisible = true; - } - }, - - setEnable: function (enable) { - this._manualSetEnable = true; - this._setEnable(enable); - if (enable === true) { - this.element.removeClass("base-disabled disabled"); - } else if (enable === false) { - this.element.addClass("base-disabled disabled"); - } - }, - - setVisible: function (visible) { - this._setVisible(visible); - if (visible === true) { - //用this.element.show()会把display属性改成block - this.element.css("display", ""); - this._mount(); - } else if (visible === false) { - this.element.css("display", "none"); - } - this.fireEvent(BI.Events.VIEW, visible); - }, - - setValid: function (valid) { - this._manualSetValid = true; - this._setValid(valid); - if (valid === true) { - this.element.removeClass("base-invalid invalid"); - } else if (valid === false) { - this.element.addClass("base-invalid invalid"); - } - }, - - doBehavior: function () { - var args = arguments; - //递归将所有子组件使有效 - BI.each(this._children, function (i, child) { - child.doBehavior && child.doBehavior.apply(child, args); - }); - }, - - getWidth: function () { - return this.options.width; - }, - - getHeight: function () { - return this.options.height; - }, - - isValid: function () { - return !this.options.invalid; - }, - - addWidget: function (name, widget) { - var self = this; - if (name instanceof BI.Widget) { - widget = name; - name = widget.getName(); - } - if (BI.isKey(name)) { - name = name + ""; - } - name = name || widget.getName() || BI.uniqueId("widget"); - if (this._children[name]) { - throw new Error("name has already been existed"); - } - widget._setParent && widget._setParent(this); - widget.on(BI.Events.DESTROY, function () { - BI.remove(self._children, this); - }); - return (this._children[name] = widget); - }, - - getWidgetByName: function (name) { - if (!BI.isKey(name) || name === this.getName()) { - return this; - } - name = name + ""; - var widget = void 0, other = {}; - BI.any(this._children, function (i, wi) { - if (i === name) { - widget = wi; - return true; - } - other[i] = wi; - }); - if (!widget) { - BI.any(other, function (i, wi) { - return (widget = wi.getWidgetByName(i)); - }); - } - return widget; - }, - - removeWidget: function (nameOrWidget) { - var self = this; - if (BI.isWidget(nameOrWidget)) { - BI.remove(this._children, nameOrWidget); - } else { - delete this._children[nameOrWidget]; - } - }, - - hasWidget: function (name) { - return this._children[name] != null; - }, - - getName: function () { - return this.widgetName; - }, - - setTag: function (tag) { - this.options.tag = tag; - }, - - getTag: function () { - return this.options.tag; - }, - - attr: function (key, value) { - if (BI.isNotNull(value)) { - return this.options[key] = value; - } - return this.options[key]; - }, - - getText: function () { - - }, - - setText: function (text) { - - }, - - getValue: function () { - - }, - - setValue: function (value) { - - }, - - isEnabled: function () { - return !this.options.disabled; - }, - - isVisible: function () { - return !this.options.invisible; - }, - - disable: function () { - this.setEnable(false); - }, - - enable: function () { - this.setEnable(true); - }, - - valid: function () { - this.setValid(true); - }, - - invalid: function () { - this.setValid(false); - }, - - invisible: function () { - this.setVisible(false); - }, - - visible: function () { - this.setVisible(true); - }, - - __d: function () { - this.beforeDestroyed && this.beforeDestroyed(); - BI.each(this._children, function (i, widget) { - widget._unMount && widget._unMount(); - }); - this._children = {}; - this._parent = null; - this._isMounted = false; - this.destroyed && this.destroyed(); - }, - - _unMount: function () { - this.__d(); - this.fireEvent(BI.Events.UNMOUNT); - this.purgeListeners(); - }, - - isolate: function () { - if (this._parent) { - this._parent.removeWidget(this); - } - BI.DOM.hang([this]); - }, - - empty: function () { - BI.each(this._children, function (i, widget) { - widget._unMount && widget._unMount(); - }); - this._children = {}; - this.element.empty(); - }, - - _destroy: function () { - this.__d(); - this.element.destroy(); - this.purgeListeners(); - }, - - destroy: function () { - this.__d(); - this.element.destroy(); - this.fireEvent(BI.Events.DESTROY); - this.purgeListeners(); - } -});BI.Model = BI.inherit(BI.M, { - props: {}, - init: null, - destroyed: null, - - _defaultConfig: function () { - return BI.extend({ - "default": "just a default", - "current": void 0 - }, this.props) - }, - - _static: function () { - return {}; - }, - - _init: function () { - BI.Model.superclass._init.apply(this, arguments); - this.on("change:current", function (obj, val) { - BI.isNotNull(val) && this.refresh(val); - }).on("change", function (changed, prev, context, options) { - if (this._start === true || BI.has(changed, "current")) { - return; - } - this.actionStart(); - if (!this.local()) { - !BI.has(this._tmp, BI.keys(changed)) && this.parent && this.parent._change(this); - this._changing_ = true; - this.change(changed, prev, context, options); - this._changing_ = false; - } - }); - - this._tmp = {};//过渡属性 - - this._hass = {}; - this._gets = [];//记录交互行为 - this._start = false; - this._changing_ = false; - - this._read = BI.debounce(BI.bind(this.fetch, this), 30); - this._save = BI.debounce(BI.bind(this.save, this), 30); - this._F = []; - this.init && this.init(); - }, - - toJSON: function () { - var json = BI.Model.superclass.toJSON.apply(this, arguments); - delete json["baseCls"]; - delete json["current"]; - delete json["default"]; - delete json["parent"]; - delete json["rootURL"]; - delete json["id"]; - delete json["tag"]; - BI.each(this._gets, function (i, action) { - delete json[action]; - }); - return json; - }, - - copy: function () { - if (this._start === true || this._changing_ === true) { - this._F.push({f: this.copy, arg: arguments}); - return; - } - this.trigger("copy"); - }, - //子节点的一个类似副本 - similar: function (value, key1, key2, key3) { - return value; - }, - - _map: function (child) { - var self = this; - var map = {}, current = {}; - var mapping = function (key, ch) { - key = key + ""; - if (key === "") { - return; - } - var keys = key.split('.'); - if (!map[keys[0]]) { - map[keys[0]] = self.get(keys[0]); - } - var parent = map, last = void 0; - BI.each(keys, function (i, k) { - last && (parent = parent[last] || (parent[last] = {})); - last = k; - }); - parent[last] = ch.toJSON(); - }; - BI.each(this._childs, function (key, chs) { - if (!BI.isArray(chs)) { - chs = [chs]; - } - BI.each(chs, function (i, ch) { - if (ch === child) { - current[key] = child; - return; - } - //mapping(key, ch); - }) - }); - BI.each(current, function (key, ch) { - mapping(key, ch); - }); - var tmp = {}; - BI.each(this._tmp, function (k) { - if (map[k]) { - tmp[k] = map[k]; - delete map[k]; - } - }); - this.tmp(tmp); - return map; - }, - - _change: function (child) { - this.set(this._map(child)); - return this; - }, - - splice: function (old, key1, key2, key3) { - - }, - - duplicate: function (copy, key1, key2, key3) { - - }, - - change: function (changed, prev) { - - }, - - actionStart: function () { - this._start = true; - return this; - }, - - actionEnd: function () { - var self = this; - this._start = false; - var _gets = this._gets.slice(0), _F = this._F.slice(0); - this._gets = []; - this._hass = {}; - this._F = []; - BI.each(_gets, function (i, action) { - self.unset(action, {silent: true}); - }); - BI.each(_F, function (i, fn) { - fn.f.apply(self, fn.arg); - }); - return this; - }, - - addChild: function (name, child) { - name = name + ""; - var self = this; - this._childs || (this._childs = {}); - if (this._childs[name]) { - if (BI.isArray(this._childs[name])) { - this._childs[name].push(child); - } else { - this._childs[name] = [this._childs[name]].concat(child) - } - } else { - this._childs[name] = child; - } - child && child.on("destroy", function () { - var keys = name.split('.'); - var g = self.get(keys[0]), p, c; - var sset = !!self._tmp[keys[0]] ? "tmp" : "set", unset = "un" + sset; - - BI.each(keys, function (i, k) { - if (i === 0) { - c = g; - return; - } - p = c; - c = c[k]; - }); - self.removeChild(name, child); - var newKeys = BI.clone(keys); - keys.length > 1 ? newKeys.unshift(BI.deepClone(p[keys[keys.length - 1]])) : newKeys.unshift(BI.deepClone(g)); - keys.length > 1 ? (delete p[keys[keys.length - 1]], self[sset](keys[0], g, {silent: true})) : self[unset](name, {silent: true}); - !BI.has(self._tmp, keys[0]) && self.parent && self.parent._change(self); - self.splice.apply(self, newKeys); - self.trigger("splice", newKeys); - BI.remove(self._childs, child); - }).on("copy", function () { - var keys = name.split('.'); - var g = self.get(keys[0]), p, c; - var sset = !!self._tmp[keys[0]] ? "tmp" : "set"; - BI.each(keys, function (i, k) { - if (i === 0) { - c = g; - return; - } - p = c; - c = c[k]; - }); - var copy = BI.UUID(), newKeys = BI.clone(keys); - keys.length > 1 ? newKeys.unshift(BI.deepClone(p[keys[keys.length - 1]])) : newKeys.unshift(BI.deepClone(g)); - var backup = self.similar.apply(self, newKeys); - if (BI.isKey(backup.id)) { - copy = backup.id; - delete backup.id; - } - keys.length > 1 ? (p[copy] = backup, self[sset](keys[0], g, {silent: true})) : self[sset](copy, backup, {silent: true}); - keys.unshift(copy); - !BI.has(self._tmp, keys[0]) && self.parent && self.parent._change(self); - self.duplicate.apply(self, keys); - self.trigger("duplicate", keys); - }); - }, - - removeChild: function (name, child) { - if (BI.isArray(this._childs[name])) { - BI.remove(this._childs[name], child); - if (BI.isEmpty(this._childs[name])) { - delete this._childs[name]; - } - return; - } - delete this._childs[name]; - }, - - has: function (attr, istemp) { - if (istemp === true) { - return _.has(this.tmp, attr); - } - if (this._start === true && this._changing_ === false) { - this._hass[attr] = true; - } - return BI.Model.superclass.has.apply(this, arguments); - }, - - cat: function (attr) { - if (_.has(this._tmp, attr)) { - return this._tmp[attr]; - } - if (this._start === true && this._hass[attr]) { - delete this._hass[attr]; - switch (attr) { - case "default": - break; - case "current": - break; - default : - this._gets.push(attr); - break; - } - } - if (_.has(this.attributes, attr)) { - return this.attributes[attr]; - } - var sta = _.result(this, "_static"); - return BI.isFunction(sta[attr]) ? sta[attr].apply(this, BI.values(arguments).slice(1)) : sta[attr]; - }, - - get: function () { - return BI.deepClone(this.cat.apply(this, arguments)); - }, - - set: function (key, val, options) { - if (this._start === true || this._changing_ === true) { - this._F.push({f: this.set, arg: arguments}); - return this; - } - return BI.Model.superclass.set.apply(this, arguments); - }, - - unset: function (attr, options) { - var self = this; - BI.each(this._childs, function (key, model) { - key = key + ""; - var keys = key.split('.'); - if (_.isEqual(attr, keys[0])) { - delete self._childs[attr]; - if (!BI.isArray(model)) { - model = [model]; - } - BI.each(model, function (i, m) { - m.trigger("unset"); - }); - } - }); - return BI.Model.superclass.unset.apply(this, arguments); - }, - - tmp: function (key, val, options) { - if (this._start === true || this._changing_ === true) { - this._F.push({f: this.tmp, arg: arguments}); - return this; - } - var attr, attrs, unset, changes, silent, changing, changed, prev, current; - if (key == null) return this; - if (typeof key === 'object') { - attrs = key; - options = val; - } else { - (attrs = {})[key] = val; - } - options || (options = {}); - - unset = options.unset; - silent = options.silent; - changes = []; - changing = this._changingTmp; - this._changingTmp = true; - - if (!changing) { - this._previousTmp = _.clone(this._tmp); - this.changedTmp = {}; - } - if (!this._previousTmp) { - this._previousTmp = _.clone(this._tmp); - } - current = this._tmp, prev = this._previousTmp; - - for (attr in attrs) { - val = attrs[attr]; - if (!_.isEqual(current[attr], val)) changes.push(attr); - if (!_.isEqual(prev[attr], val)) { - this.changedTmp[attr] = val; - } else { - delete this.changedTmp[attr]; - } - unset ? delete current[attr] : current[attr] = val; - } - - if (!silent) { - if (changes.length) this._pendingTmp = options; - for (var i = 0, length = changes.length; i < length; i++) { - this.trigger('change:' + changes[i], this, current[changes[i]], options); - } - } - - if (changing) return this; - changed = BI.clone(this.changedTmp); - if (!silent) { - while (this._pendingTmp) { - options = this._pendingTmp; - this._pendingTmp = false; - this.trigger('change', changed, prev, this, options); - } - } - this._pendingTmp = false; - this._changingTmp = false; - if (!silent && changes.length) this.trigger("changed", changed, prev, this, options); - return this; - }, - - untmp: function (attr, options) { - var self = this; - BI.each(this._childs, function (key, model) { - key = key + ""; - var keys = key.split('.'); - if (_.isEqual(attr, keys[0])) { - delete self._childs[attr]; - if (!BI.isArray(model)) { - model = [model]; - } - BI.each(model, function (i, m) { - m.trigger("unset"); - }); - } - }); - return this.tmp(attr, void 0, _.extend({}, options, {unset: true})); - }, - - cancel: function (options) { - var self = this; - var tmp = BI.clone(this._tmp); - this._tmp = {}; - BI.each(tmp, function (k) { - self.untmp(k, options); - }); - }, - - submit: function () { - var tmp = BI.clone(this._tmp); - this._tmp = {}; - this.set(tmp); - return this; - }, - - urlRoot: function () { - return BI.servletURL; - }, - - parse: function (data) { - return data; - }, - - setEditing: function (edit) { - this._editing = edit; - }, - - getEditing: function () { - if (this._start !== true) { - throw new Error("getEditing函数只允许在local中调用"); - } - return this._editing; - }, - - local: function () { - - }, - - load: function (data) { - - }, - - refresh: function () { - - }, - - /** - * 更新整个model - */ - updateURL: function () { - - }, - /** - * 添加一个元素或删除一个元素或修改一个元素 - */ - patchURL: function () { - - }, - /** - * 删除整个model, destroy方法调用 - */ - deleteURL: function () { - - }, - /** - * 读取model - */ - readURL: function () { - - }, - - read: function (options) { - if (this._start == true || this._changing_ === true) { - this._F.push({f: this.read, arg: arguments}); - return; - } - this._read(options); - }, - - update: function (options) { - if (this._start == true || this._changing_ === true) { - this._F.push({f: this.update, arg: arguments}); - return; - } - this._save(null, options); - }, - - patch: function (options) { - if (this._start == true || this._changing_ === true) { - this._F.push({f: this.patch, arg: arguments}); - return; - } - this._save(null, BI.extend({}, options, { - patch: true - })); - }, - - _destroy: function () { - var children = BI.extend({}, this._childs); - this._childs = {}; - BI.each(children, function (i, child) { - child._destroy(); - }); - this.destroyed && this.destroyed(); - }, - - destroy: function () { - this._destroy(); - BI.Model.superclass.destroy.apply(this, arguments); - } -});/** - * @class BI.View - * @extends BI.V - * @type {*|void|Object} - */ -BI.View = BI.inherit(BI.V, { - - //生命周期函数 - beforeCreate: null, - - created: null, - - beforeDestroyed: null, - - destroyed: null, - - _init: function () { - BI.View.superclass._init.apply(this, arguments); - this.beforeCreate && this.beforeCreate(); - var self = this; - this.listenTo(this.model, "change:current", function (obj, val) { - if (BI.isNotNull(val) && val.length > 0) { - this.refresh(val); - } - }).listenTo(this.model, "change", function (changed) { - this.delegateEvents(); - }).listenTo(this.model, "changed", function (changed, prev, context, options) { - if (BI.has(changed, "current") && BI.size(changed) > 1) { - throw new Error("refresh操作不能调用set操作"); - } - var notLocal = !BI.has(changed, "current") && !this.local() && this.notifyParent().notify(); - this.model.actionEnd() && this.actionEnd(); - this.model._changing_ = true; - notLocal && !BI.isEmpty(changed) && this.change(changed, prev, context, options); - this.model._changing_ = false; - this.model.actionEnd() && this.actionEnd(); - }).listenTo(this.model, "destroy", function () { - this._destroy(); - }).listenTo(this.model, "unset", function () { - this._destroy(); - }).listenTo(this.model, "splice", function (arg) { - this.splice.apply(this, arg); - }).listenTo(this.model, "duplicate", function (arg) { - this.duplicate.apply(this, arg); - }); - this._F = []; - var flatten = ["_init", "_defaultConfig", "_vessel", "_render", "getName", "listenEnd", "local", "refresh", "load", "change"]; - flatten = BI.makeObject(flatten, true); - BI.each(this.constructor.caller.caller.prototype, function (key) { - if (flatten[key]) { - return; - } - var f = self[key]; - if (BI.isFunction(f)) { - self[key] = BI.bind(function () { - if (this.model._start === true) { - this._F.push({f: f, arg: arguments}); - return; - } - return f.apply(this, arguments); - }, self); - } - }); - this.created && this.created(); - }, - - change: function (changed, prev) { - - }, - - actionEnd: function () { - var self = this; - var _F = this._F.slice(0); - this._F = []; - BI.each(_F, function (i, f) { - f.f.apply(self, f.arg); - }); - return this; - }, - - delegateEvents: function (events) { - if (!(events || (events = BI.deepClone(_.result(this, 'events'))))) return this; - var delegateEventSplitter = /^(\S+)\s*(.*)$/; - for (var key in events) { - var method = events[key]; - if (!_.isFunction(method)) method = this[events[key]]; - if (!method) continue; - var match = key.match(delegateEventSplitter); - var ev = true; - switch (match[1]) { - case "draggable": - break; - case "droppable": - break; - case "sortable": - break; - case "resizable": - break; - case "hover": - break; - default : - ev = false; - break; - } - - var off = new BI.OffList({ - event: match[1] + '.delegateEvents' + this.cid - }); - - var keys = match[2].split('.'); - var handle = keys[1]; - var bind = ev ? new BI.EventList({ - event: match[1], - handle: handle, - callback: BI.bind(method, this) - }) : new BI.ListenerList({ - event: match[1] + '.delegateEvents' + this.cid, - handle: handle, - callback: BI.bind(method, this), - context: this - }); - - var list = []; - if (this[keys[0]] && (this[keys[0]] instanceof $ || this[keys[0]].element instanceof $)) { - list = [this[keys[0]]] - delete events[key]; - } else if (BI.isArray(this[keys[0]]) || BI.isPlainObject(this[keys[0]])) { - list = this[keys[0]] - delete events[key]; - } - off.populate(list); - bind.populate(list); - } - return BI.View.superclass.delegateEvents.apply(this, [events]); - }, - - _vessel: function () { - this._cardLayouts = {}; - this._cardLayouts[this.getName()] = new BI.CardLayout({ - element: this - }); - var vessel = BI.createWidget(); - this._cardLayouts[this.getName()].addCardByName(this.getName(), vessel); - return vessel; - }, - - render: function (vessel) { - return this; - }, - - /** - * 创建儿子所在容器 - * @param key - * @param vessel - * @param options isLayer:是否是弹出层, defaultShowName:默认显示项 - * @returns {BI.View} - */ - addSubVessel: function (key, vessel, options) { - options || (options = {}); - this._cardLayouts || (this._cardLayouts = {}); - var id = key + this.cid; - options.isLayer && (vessel = BI.Layers.has(id) ? BI.Layers.get(id) : BI.Layers.create(id, vessel)); - if (this._cardLayouts[key]) { - options.defaultShowName && this._cardLayouts[key].setDefaultShowName(options.defaultShowName); - return this; - } - this._cardLayouts[key] = BI.createWidget({ - type: "bi.card", - element: vessel, - defaultShowName: options.defaultShowName - }); - return this; - }, - - removeSubVessel: function (key) { - var self = this, id = key + this.cid; - BI.Layers.remove(id); - var cardNames = this._cardLayouts[key] && this._cardLayouts[key].getAllCardNames(); - BI.each(cardNames, function (i, name) { - delete self._cards[name]; - }); - this._cardLayouts[key] && this._cardLayouts[key]._destroy(); - return this; - }, - - createView: function (url, modelData, viewData) { - return BI.Factory.createView(url, this.get(url), modelData, viewData); - }, - - /** - * 跳转到指定的card - * @param cardName - */ - skipTo: function (cardName, layout, modelData, viewData, options) { - if (this.model._start === true || this._changing_ === true) { - this._F.push({f: this.skipTo, arg: arguments}); - return this; - } - var self = this, isValid = BI.isKey(modelData), data = void 0; - BI.isKey(layout) && (layout = layout + ""); - layout = layout || this.getName(); - options || (options = {}); - if (isValid) { - modelData = modelData + "";//避免modelData是数字 - var keys = modelData.split('.'); - BI.each(keys, function (i, k) { - if (i === 0) { - data = self.model.get(k) || {}; - } else { - data = data[k] || {}; - } - }); - data.id = options.id || keys[keys.length - 1]; - } else { - data = modelData; - } - BI.extend(data, options.data); - var action = options.action || new BI.ShowAction(); - var cardLayout = this._cardLayouts[layout]; - if (!cardLayout) { - return this; - } - cardLayout.setVisible(true); - if (BI.isKey(cardName) && !cardLayout.isCardExisted(cardName)) { - var view = this.createView(this.rootURL + "/" + cardName, data, viewData); - isValid && this.model.addChild(modelData, view.model); - view.listenTo(view.model, "destroy", function () { - delete self._cards[cardName]; - cardLayout.deleteCardByName(cardName); - if (cardLayout.isAllCardHide()) { - cardLayout.setVisible(false); - BI.Layers.hide(layout + self.cid); - } - }).listenTo(view.model, "unset", function () { - delete self._cards[cardName]; - cardLayout.deleteCardByName(cardName); - }); - cardLayout.addCardByName(cardName, view); - this._cards || (this._cards = {}); - this._cards[cardName] = view; - data = {}; - this.on("end:" + view.cid, function () { - var isNew = false, t, keys; - if (isValid) { - keys = modelData.split('.'); - BI.each(keys, function (i, k) { - if (i === 0) { - t = self.model.get(k) || (isNew = true); - } else { - t = t[k] || (isNew = true); - } - }); - } - if (isNew) { - delete self._cards[cardName]; - self.model.removeChild(modelData, view.model); - cardLayout.deleteCardByName(cardName); - view._destroy(); - cardLayout.setVisible(false); - } - action.actionBack(view, null, function () { - if (cardLayout.isAllCardHide()) { - cardLayout.setVisible(false); - BI.Layers.hide(layout + self.cid); - } - !isNew && (self.listenEnd.apply(self, isValid ? keys : [modelData]) !== false) && self.populate(); - }) - }).on("change:" + view.cid, _.bind(this.notifyParent, this)); - } - BI.isKey(cardName) && BI.Layers.show(layout + this.cid); - cardLayout.showCardByName(cardName, action, function () { - BI.isKey(cardName) && self._cards[cardName].populate(data, options); - }); - !BI.isKey(cardName) && BI.Layers.hide(layout + this.cid); - return this._cards[cardName]; - }, - - listenEnd: function (key1, key2, key3) { - return this; - }, - - /** - * 告诉父亲我的操作结束了,后面的事情任由父亲处置 - * @param force 强制下次再次进入该节点时不进行刷新操作, 默认执行刷新 - * @returns {BI.View} - */ - notifyParentEnd: function (force) { - this.parent && this.parent.trigger("end:" + this.cid); - this.trigger("end"); - !force && this.notify(); - return this; - }, - - /** - * 通知父亲我的数据发生了变化 - */ - notifyParent: function () { - this.parent && this.parent.notify().trigger("change:" + this.cid); - return this; - }, - - /** - * 告诉Model数据改变了 - */ - notify: function () { - this.model.unset("current", {silent: true}); - return this; - }, - - getName: function () { - return "VIEW" - }, - - /** - * 全局刷新 - * @param current - */ - refresh: function (current) { - }, - /** - * 局部刷新 - */ - local: function () { - return false; - }, - - load: function (data) { - - }, - - readData: function (force, options) { - options || (options = {}); - var self = this; - var args = [].slice.call(arguments, 2); - if (!force && this._readed === true) {//只从后台获取一次数据 - callback(this.model.toJSON()); - return; - } - //采用静默方式读数据,该数据变化不引起data的change事件触发 - var success = options.success; - this.model.read(BI.extend({ - silent: true - }, options, { - success: function (data, model) { - callback(data); - !force && (self._readed = true); - self.delegateEvents(); - success && success(data, model); - } - })); - function callback(data) { - self.model.load(data); - self.load(data); - BI.each(args, function (i, arg) { - if (BI.isFunction(arg)) { - arg.apply(self, [data]); - } - }) - } - }, - - //处理model的通用方法 - cat: function () { - return this.model.cat.apply(this.model, arguments); - }, - - get: function () { - return this.model.get.apply(this.model, arguments); - }, - - set: function () { - return this.model.set.apply(this.model, arguments); - }, - - has: function () { - return this.model.has.apply(this.model, arguments); - }, - - getEditing: function () { - return this.model.getEditing(); - }, - - reading: function (options) { - var self = this; - var name = BI.UUID(); - this.model.read(BI.extend({}, options, { - beforeSend: function () { - var loading = BI.createWidget({ - type: 'bi.vertical', - items: [{ - type: "bi.layout", - height: 30, - cls: "loading-background" - }], - element: BI.Maskers.make(name, self) - }); - loading.setVisible(true); - }, - complete: function (data) { - options.complete && options.complete(data); - BI.Maskers.remove(name); - } - })); - }, - - updating: function (options) { - var self = this; - var name = BI.UUID(); - this.model.update(BI.extend({}, options, { - noset: true, - beforeSend: function () { - var loading = BI.createWidget({ - type: 'bi.vertical', - items: [{ - type: "bi.layout", - height: 30, - cls: "loading-background" - }], - element: BI.Maskers.make(name, self) - }); - loading.setVisible(true); - }, - complete: function (data) { - options.complete && options.complete(data); - BI.Maskers.remove(name); - } - })); - }, - - patching: function (options) { - var self = this; - var name = BI.UUID(); - this.model.patch(BI.extend({}, options, { - noset: true, - beforeSend: function () { - var loading = BI.createWidget({ - type: 'bi.vertical', - items: [{ - type: "bi.layout", - height: 30, - cls: "loading-background" - }], - element: BI.Maskers.make(name, self) - }); - loading.setVisible(true); - }, - complete: function (data) { - options.complete && options.complete(data); - BI.Maskers.remove(name); - } - })); - }, - - populate: function (modelData, options) { - var self = this; - options || (options = {}); - if (options.force === true) { - this.notify(); - } - if (this._cardLayouts && this._cardLayouts[this.getName()]) { - this._cardLayouts[this.getName()].showCardByName(this.getName()); - } - //BI.each(this._cardLayouts, function (key, layout) { - // layout.showCardByName(layout.getDefaultShowName() || self.getName()); - //}); - //BI.each(this._cards, function (i, card) { - // card.notify && card.notify(); - //}); - if (this._F.length > 0) { - throw new Error("流程错误"); - } - if (options.force === true) { - this.model.set(modelData, options).set({current: this.model.get("default")}); - return; - } - if (options.force === false) { - this.model.set(modelData); - return; - } - var filter = BI.clone(modelData || {}); - delete filter.id; - var contains = BI.has(this.model.toJSON(), _.keys(filter)); - var match = BI.isEmpty(filter) || (contains && this.model.matches(modelData)); - if (match === true) { - this.model.set({current: this.model.get("default")}); - } else if (contains === false) { - this.model.set(modelData); - } else { - this.model.set(modelData, options).set({current: this.model.get("default")}); - } - }, - - //删除子节点触发 - splice: function (old, key1, key2, key3) { - - }, - - //复制子节点触发 - duplicate: function (copy, key1, key2, key3) { - - }, - - _unMount: function () { - this.beforeDestroyed && this.beforeDestroyed(); - BI.each(this._cardLayouts, function (name, card) { - card && card._unMount(); - }); - delete this._cardLayouts; - delete this._cards; - this.destroyed && this.destroyed(); - this.trigger(BI.Events.UNMOUNT); - this.off(); - }, - - _destroy: function () { - var self = this; - BI.each(this._cardLayouts, function (name, card) { - card && card._unMount(); - BI.Layers.remove(name + self.cid); - }); - delete this._cardLayouts; - delete this._cards; - this.destroyed && this.destroyed(); - this.remove(); - this.trigger(BI.Events.DESTROY); - this.off(); - } -});(function () { - - var kv = {}; // alex:键(编辑器简称,如text)值(也是一个字符串,如FR.TextEditor)对 - BI.shortcut = function (xtype, cls) { - if (kv[xtype] != null) { - throw ("shortcut:[" + xtype + "] has been registed"); - } - kv[xtype] = cls; - _.extend(cls.prototype, { - xtype: xtype - }) - }; - - // 根据配置属性生成widget - var createWidget = function (config) { - if (config['classType']) { - return new (new Function('return ' + config['classType'] + ';')())(config); - } - - if (!config.type) { - - } - var xtype = config.type.toLowerCase(); - var cls = kv[xtype]; - return new cls(config); - }; - - BI.createWidget = function (item, options) { - var el; - options || (options = {}); - if (BI.isEmpty(item) && BI.isEmpty(options)) { - return BI.createWidget({ - type: "bi.layout" - }); - } - if (BI.isWidget(item)) { - return item; - } - if (item && (item.type || options.type)) { - el = BI.extend({}, options, item); - return BI.Plugin.getObject(el.type, createWidget(BI.Plugin.getWidget(el.type, el))); - } - if (item && item.el && (item.el.type || options.type)) { - el = BI.extend({}, options, item.el); - return BI.Plugin.getObject(el.type, createWidget(BI.Plugin.getWidget(el.type, el))); - } - if (item && BI.isWidget(item.el)) { - return item.el; - } - throw new Error('无法根据item创建组件'); - } - -})();(function (window, undefined) { - function aspect(type) { - return function (target, methodName, advice) { - var exist = target[methodName], - dispatcher; - - if (!exist || exist.target != target) { - dispatcher = target[methodName] = function () { - // before methods - var beforeArr = dispatcher.before; - var args = arguments, next; - for (var l = beforeArr.length; l--;) { - next = beforeArr[l].advice.apply(this, args); - if (next === false) { - return false; - } - args = next || args; - } - // target method - var rs = dispatcher.method.apply(this, args); - // after methods - var afterArr = dispatcher.after; - for (var i = 0, ii = afterArr.length; i < ii; i++) { - next = afterArr[i].advice.call(this, rs, args); - if (rs === false) { - return false; - } - args = next || args; - } - return rs; - }; - - dispatcher.before = []; - dispatcher.after = []; - - if (exist) { - dispatcher.method = exist; - } - dispatcher.target = target; - } - - var aspectArr = (dispatcher || exist)[type]; - var obj = { - advice: advice, - _index: aspectArr.length, - remove: function () { - aspectArr.splice(this._index, 1); - } - }; - aspectArr.push(obj); - - return obj; - }; - } - - BI.aspect = { - before: aspect("before"), - after: aspect("after") - }; - - return BI.aspect; - -})(window);; -!(function () { - - var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - - - // private method for UTF-8 encoding - var _utf8_encode = function (string) { - string = string.replace(/\r\n/g, "\n"); - var utftext = ""; - - for (var n = 0; n < string.length; n++) { - - var c = string.charCodeAt(n); - - if (c < 128) { - utftext += String.fromCharCode(c); - } else if ((c > 127) && (c < 2048)) { - utftext += String.fromCharCode((c >> 6) | 192); - utftext += String.fromCharCode((c & 63) | 128); - } else { - utftext += String.fromCharCode((c >> 12) | 224); - utftext += String.fromCharCode(((c >> 6) & 63) | 128); - utftext += String.fromCharCode((c & 63) | 128); - } - - } - - return utftext; - }; - - // private method for UTF-8 decoding - var _utf8_decode = function (utftext) { - var string = ""; - var i = 0; - var c = 0, c3 = 0, c2 = 0; - - while (i < utftext.length) { - - c = utftext.charCodeAt(i); - - if (c < 128) { - string += String.fromCharCode(c); - i++; - } else if ((c > 191) && (c < 224)) { - c2 = utftext.charCodeAt(i + 1); - string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = utftext.charCodeAt(i + 1); - c3 = utftext.charCodeAt(i + 2); - string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - - } - return string; - }; - - _.extend(BI, { - - encode: function (input) { - var output = ""; - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; - var i = 0; - - input = _utf8_encode(input); - - while (i < input.length) { - - chr1 = input.charCodeAt(i++); - chr2 = input.charCodeAt(i++); - chr3 = input.charCodeAt(i++); - - enc1 = chr1 >> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); - enc4 = chr3 & 63; - - if (isNaN(chr2)) { - enc3 = enc4 = 64; - } else if (isNaN(chr3)) { - enc4 = 64; - } - - output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4); - - } - - return output; - }, - - // public method for decoding - decode: function (input) { - var output = ""; - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0; - - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - - while (i < input.length) { - - enc1 = _keyStr.indexOf(input.charAt(i++)); - enc2 = _keyStr.indexOf(input.charAt(i++)); - enc3 = _keyStr.indexOf(input.charAt(i++)); - enc4 = _keyStr.indexOf(input.charAt(i++)); - - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - - output = output + String.fromCharCode(chr1); - - if (enc3 != 64) { - output = output + String.fromCharCode(chr2); - } - if (enc4 != 64) { - output = output + String.fromCharCode(chr3); - } - - } - - output = _utf8_decode(output); - - return output; - - } - }) -})();BI.CellSizeAndPositionManager = function (cellCount, cellSizeGetter, estimatedCellSize) { - this._cellSizeGetter = cellSizeGetter; - this._cellCount = cellCount; - this._estimatedCellSize = estimatedCellSize; - this._cellSizeAndPositionData = {}; - this._lastMeasuredIndex = -1; -}; - -BI.CellSizeAndPositionManager.prototype = { - constructor: BI.CellSizeAndPositionManager, - configure: function (cellCount, estimatedCellSize) { - this._cellCount = cellCount; - this._estimatedCellSize = estimatedCellSize; - }, - - getCellCount: function () { - return this._cellCount; - }, - - getEstimatedCellSize: function () { - return this._estimatedCellSize; - }, - - getLastMeasuredIndex: function () { - return this._lastMeasuredIndex; - }, - - getSizeAndPositionOfCell: function (index) { - if (index < 0 || index >= this._cellCount) { - return; - } - if (index > this._lastMeasuredIndex) { - var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(); - var offset = lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size; - - for (var i = this._lastMeasuredIndex + 1; i <= index; i++) { - var size = this._cellSizeGetter(i); - - if (size == null || isNaN(size)) { - continue; - } - - this._cellSizeAndPositionData[i] = { - offset: offset, - size: size - }; - - offset += size; - } - - this._lastMeasuredIndex = index; - } - return this._cellSizeAndPositionData[index]; - }, - - getSizeAndPositionOfLastMeasuredCell: function () { - return this._lastMeasuredIndex >= 0 - ? this._cellSizeAndPositionData[this._lastMeasuredIndex] - : { - offset: 0, - size: 0 - } - }, - - getTotalSize: function () { - var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(); - return lastMeasuredCellSizeAndPosition.offset + lastMeasuredCellSizeAndPosition.size + (this._cellCount - this._lastMeasuredIndex - 1) * this._estimatedCellSize - }, - - getUpdatedOffsetForIndex: function (align, containerSize, currentOffset, targetIndex) { - var datum = this.getSizeAndPositionOfCell(targetIndex); - var maxOffset = datum.offset; - var minOffset = maxOffset - containerSize + datum.size; - - var idealOffset; - - switch (align) { - case 'start': - idealOffset = maxOffset; - break; - case 'end': - idealOffset = minOffset; - break; - case 'center': - idealOffset = maxOffset - ((containerSize - datum.size) / 2); - break; - default: - idealOffset = Math.max(minOffset, Math.min(maxOffset, currentOffset)); - break; - } - - var totalSize = this.getTotalSize(); - - return Math.max(0, Math.min(totalSize - containerSize, idealOffset)); - }, - - getVisibleCellRange: function (containerSize, offset) { - var totalSize = this.getTotalSize(); - - if (totalSize === 0) { - return {} - } - - var maxOffset = offset + containerSize; - var start = this._findNearestCell(offset); - - var datum = this.getSizeAndPositionOfCell(start); - offset = datum.offset + datum.size; - - var stop = start; - - while (offset < maxOffset && stop < this._cellCount - 1) { - stop++; - offset += this.getSizeAndPositionOfCell(stop).size; - } - - return { - start: start, - stop: stop - } - }, - - resetCell: function (index) { - this._lastMeasuredIndex = Math.min(this._lastMeasuredIndex, index - 1) - }, - - _binarySearch: function (high, low, offset) { - var middle; - var currentOffset; - - while (low <= high) { - middle = low + Math.floor((high - low) / 2); - currentOffset = this.getSizeAndPositionOfCell(middle).offset; - - if (currentOffset === offset) { - return middle; - } else if (currentOffset < offset) { - low = middle + 1; - } else if (currentOffset > offset) { - high = middle - 1; - } - } - - if (low > 0) { - return low - 1; - } - }, - - _exponentialSearch: function (index, offset) { - var interval = 1; - - while (index < this._cellCount && this.getSizeAndPositionOfCell(index).offset < offset) { - index += interval; - interval *= 2; - } - - return this._binarySearch(Math.min(index, this._cellCount - 1), Math.floor(index / 2), offset); - }, - - _findNearestCell: function (offset) { - if (isNaN(offset)) { - return; - } - - offset = Math.max(0, offset); - - var lastMeasuredCellSizeAndPosition = this.getSizeAndPositionOfLastMeasuredCell(); - var lastMeasuredIndex = Math.max(0, this._lastMeasuredIndex); - - if (lastMeasuredCellSizeAndPosition.offset >= offset) { - return this._binarySearch(lastMeasuredIndex, 0, offset); - } else { - return this._exponentialSearch(lastMeasuredIndex, offset); - } - } -}; - -BI.ScalingCellSizeAndPositionManager = function (cellCount, cellSizeGetter, estimatedCellSize, maxScrollSize) { - this._cellSizeAndPositionManager = new BI.CellSizeAndPositionManager(cellCount, cellSizeGetter, estimatedCellSize); - this._maxScrollSize = maxScrollSize || 10000000 -}; - -BI.ScalingCellSizeAndPositionManager.prototype = { - constructor: BI.ScalingCellSizeAndPositionManager, - - configure: function () { - this._cellSizeAndPositionManager.configure.apply(this._cellSizeAndPositionManager, arguments); - }, - - getCellCount: function () { - return this._cellSizeAndPositionManager.getCellCount() - }, - - getEstimatedCellSize: function () { - return this._cellSizeAndPositionManager.getEstimatedCellSize() - }, - - getLastMeasuredIndex: function () { - return this._cellSizeAndPositionManager.getLastMeasuredIndex() - }, - - getOffsetAdjustment: function (containerSize, offset) { - var totalSize = this._cellSizeAndPositionManager.getTotalSize(); - var safeTotalSize = this.getTotalSize(); - var offsetPercentage = this._getOffsetPercentage(containerSize, offset, safeTotalSize); - - return Math.round(offsetPercentage * (safeTotalSize - totalSize)); - }, - - getSizeAndPositionOfCell: function (index) { - return this._cellSizeAndPositionManager.getSizeAndPositionOfCell(index); - }, - - getSizeAndPositionOfLastMeasuredCell: function () { - return this._cellSizeAndPositionManager.getSizeAndPositionOfLastMeasuredCell(); - }, - - getTotalSize: function () { - return Math.min(this._maxScrollSize, this._cellSizeAndPositionManager.getTotalSize()); - }, - - getUpdatedOffsetForIndex: function (align, containerSize, currentOffset, targetIndex) { - currentOffset = this._safeOffsetToOffset(containerSize, currentOffset); - - var offset = this._cellSizeAndPositionManager.getUpdatedOffsetForIndex(align, containerSize, currentOffset, targetIndex); - - return this._offsetToSafeOffset(containerSize, offset); - }, - - getVisibleCellRange: function (containerSize, offset) { - offset = this._safeOffsetToOffset(containerSize, offset); - - return this._cellSizeAndPositionManager.getVisibleCellRange(containerSize, offset); - }, - - resetCell: function (index) { - this._cellSizeAndPositionManager.resetCell(index) - }, - - _getOffsetPercentage: function (containerSize, offset, totalSize) { - return totalSize <= containerSize - ? 0 - : offset / (totalSize - containerSize) - }, - - _offsetToSafeOffset: function (containerSize, offset) { - var totalSize = this._cellSizeAndPositionManager.getTotalSize(); - var safeTotalSize = this.getTotalSize(); - - if (totalSize === safeTotalSize) { - return offset; - } else { - var offsetPercentage = this._getOffsetPercentage(containerSize, offset, totalSize); - - return Math.round(offsetPercentage * (safeTotalSize - containerSize)); - } - }, - - _safeOffsetToOffset: function (containerSize, offset) { - var totalSize = this._cellSizeAndPositionManager.getTotalSize(); - var safeTotalSize = this.getTotalSize(); - - if (totalSize === safeTotalSize) { - return offset; - } else { - var offsetPercentage = this._getOffsetPercentage(containerSize, offset, safeTotalSize); - - return Math.round(offsetPercentage * (totalSize - containerSize)); - } - } -};/** - * 汉字拼音索引 - */ -; -!(function () { - var _ChineseFirstPY = "YDYQSXMWZSSXJBYMGCCZQPSSQBYCDSCDQLDYLYBSSJGYZZJJFKCCLZDHWDWZJLJPFYYNWJJTMYHZWZHFLZPPQHGSCYYYNJQYXXGJHHSDSJNKKTMOMLCRXYPSNQSECCQZGGLLYJLMYZZSECYKYYHQWJSSGGYXYZYJWWKDJHYCHMYXJTLXJYQBYXZLDWRDJRWYSRLDZJPCBZJJBR" - + "CFTLECZSTZFXXZHTRQHYBDLYCZSSYMMRFMYQZPWWJJYFCRWFDFZQPYDDWYXKYJAWJFFXYPSFTZYHHYZYSWCJYXSCLCXXWZZXNBGNNXBXLZSZSBSGPYSYZDHMDZBQBZCWDZZYYTZHBTSYYBZGNTNXQYWQSKBPHHLXGYBFMJEBJHHGQTJCYSXSTKZHLYCKGLYSMZXYALMELDCCXGZ" - + "YRJXSDLTYZCQKCNNJWHJTZZCQLJSTSTBNXBTYXCEQXGKWJYFLZQLYHYXSPSFXLMPBYSXXXYDJCZYLLLSJXFHJXPJBTFFYABYXBHZZBJYZLWLCZGGBTSSMDTJZXPTHYQTGLJSCQFZKJZJQNLZWLSLHDZBWJNCJZYZSQQYCQYRZCJJWYBRTWPYFTWEXCSKDZCTBZHYZZYYJXZCFFZ" - + "ZMJYXXSDZZOTTBZLQWFCKSZSXFYRLNYJMBDTHJXSQQCCSBXYYTSYFBXDZTGBCNSLCYZZPSAZYZZSCJCSHZQYDXLBPJLLMQXTYDZXSQJTZPXLCGLQTZWJBHCTSYJSFXYEJJTLBGXSXJMYJQQPFZASYJNTYDJXKJCDJSZCBARTDCLYJQMWNQNCLLLKBYBZZSYHQQLTWLCCXTXLLZN" - + "TYLNEWYZYXCZXXGRKRMTCNDNJTSYYSSDQDGHSDBJGHRWRQLYBGLXHLGTGXBQJDZPYJSJYJCTMRNYMGRZJCZGJMZMGXMPRYXKJNYMSGMZJYMKMFXMLDTGFBHCJHKYLPFMDXLQJJSMTQGZSJLQDLDGJYCALCMZCSDJLLNXDJFFFFJCZFMZFFPFKHKGDPSXKTACJDHHZDDCRRCFQYJ" - + "KQCCWJDXHWJLYLLZGCFCQDSMLZPBJJPLSBCJGGDCKKDEZSQCCKJGCGKDJTJDLZYCXKLQSCGJCLTFPCQCZGWPJDQYZJJBYJHSJDZWGFSJGZKQCCZLLPSPKJGQJHZZLJPLGJGJJTHJJYJZCZMLZLYQBGJWMLJKXZDZNJQSYZMLJLLJKYWXMKJLHSKJGBMCLYYMKXJQLBMLLKMDXXK" - + "WYXYSLMLPSJQQJQXYXFJTJDXMXXLLCXQBSYJBGWYMBGGBCYXPJYGPEPFGDJGBHBNSQJYZJKJKHXQFGQZKFHYGKHDKLLSDJQXPQYKYBNQSXQNSZSWHBSXWHXWBZZXDMNSJBSBKBBZKLYLXGWXDRWYQZMYWSJQLCJXXJXKJEQXSCYETLZHLYYYSDZPAQYZCMTLSHTZCFYZYXYLJSD" - + "CJQAGYSLCQLYYYSHMRQQKLDXZSCSSSYDYCJYSFSJBFRSSZQSBXXPXJYSDRCKGJLGDKZJZBDKTCSYQPYHSTCLDJDHMXMCGXYZHJDDTMHLTXZXYLYMOHYJCLTYFBQQXPFBDFHHTKSQHZYYWCNXXCRWHOWGYJLEGWDQCWGFJYCSNTMYTOLBYGWQWESJPWNMLRYDZSZTXYQPZGCWXHN" - + "GPYXSHMYQJXZTDPPBFYHZHTJYFDZWKGKZBLDNTSXHQEEGZZYLZMMZYJZGXZXKHKSTXNXXWYLYAPSTHXDWHZYMPXAGKYDXBHNHXKDPJNMYHYLPMGOCSLNZHKXXLPZZLBMLSFBHHGYGYYGGBHSCYAQTYWLXTZQCEZYDQDQMMHTKLLSZHLSJZWFYHQSWSCWLQAZYNYTLSXTHAZNKZZ" - + "SZZLAXXZWWCTGQQTDDYZTCCHYQZFLXPSLZYGPZSZNGLNDQTBDLXGTCTAJDKYWNSYZLJHHZZCWNYYZYWMHYCHHYXHJKZWSXHZYXLYSKQYSPSLYZWMYPPKBYGLKZHTYXAXQSYSHXASMCHKDSCRSWJPWXSGZJLWWSCHSJHSQNHCSEGNDAQTBAALZZMSSTDQJCJKTSCJAXPLGGXHHGX" - + "XZCXPDMMHLDGTYBYSJMXHMRCPXXJZCKZXSHMLQXXTTHXWZFKHCCZDYTCJYXQHLXDHYPJQXYLSYYDZOZJNYXQEZYSQYAYXWYPDGXDDXSPPYZNDLTWRHXYDXZZJHTCXMCZLHPYYYYMHZLLHNXMYLLLMDCPPXHMXDKYCYRDLTXJCHHZZXZLCCLYLNZSHZJZZLNNRLWHYQSNJHXYNTT" - + "TKYJPYCHHYEGKCTTWLGQRLGGTGTYGYHPYHYLQYQGCWYQKPYYYTTTTLHYHLLTYTTSPLKYZXGZWGPYDSSZZDQXSKCQNMJJZZBXYQMJRTFFBTKHZKBXLJJKDXJTLBWFZPPTKQTZTGPDGNTPJYFALQMKGXBDCLZFHZCLLLLADPMXDJHLCCLGYHDZFGYDDGCYYFGYDXKSSEBDHYKDKDK" - + "HNAXXYBPBYYHXZQGAFFQYJXDMLJCSQZLLPCHBSXGJYNDYBYQSPZWJLZKSDDTACTBXZDYZYPJZQSJNKKTKNJDJGYYPGTLFYQKASDNTCYHBLWDZHBBYDWJRYGKZYHEYYFJMSDTYFZJJHGCXPLXHLDWXXJKYTCYKSSSMTWCTTQZLPBSZDZWZXGZAGYKTYWXLHLSPBCLLOQMMZSSLCM" - + "BJCSZZKYDCZJGQQDSMCYTZQQLWZQZXSSFPTTFQMDDZDSHDTDWFHTDYZJYQJQKYPBDJYYXTLJHDRQXXXHAYDHRJLKLYTWHLLRLLRCXYLBWSRSZZSYMKZZHHKYHXKSMDSYDYCJPBZBSQLFCXXXNXKXWYWSDZYQOGGQMMYHCDZTTFJYYBGSTTTYBYKJDHKYXBELHTYPJQNFXFDYKZH" - + "QKZBYJTZBXHFDXKDASWTAWAJLDYJSFHBLDNNTNQJTJNCHXFJSRFWHZFMDRYJYJWZPDJKZYJYMPCYZNYNXFBYTFYFWYGDBNZZZDNYTXZEMMQBSQEHXFZMBMFLZZSRXYMJGSXWZJSPRYDJSJGXHJJGLJJYNZZJXHGXKYMLPYYYCXYTWQZSWHWLYRJLPXSLSXMFSWWKLCTNXNYNPSJ" - + "SZHDZEPTXMYYWXYYSYWLXJQZQXZDCLEEELMCPJPCLWBXSQHFWWTFFJTNQJHJQDXHWLBYZNFJLALKYYJLDXHHYCSTYYWNRJYXYWTRMDRQHWQCMFJDYZMHMYYXJWMYZQZXTLMRSPWWCHAQBXYGZYPXYYRRCLMPYMGKSJSZYSRMYJSNXTPLNBAPPYPYLXYYZKYNLDZYJZCZNNLMZHH" - + "ARQMPGWQTZMXXMLLHGDZXYHXKYXYCJMFFYYHJFSBSSQLXXNDYCANNMTCJCYPRRNYTYQNYYMBMSXNDLYLYSLJRLXYSXQMLLYZLZJJJKYZZCSFBZXXMSTBJGNXYZHLXNMCWSCYZYFZLXBRNNNYLBNRTGZQYSATSWRYHYJZMZDHZGZDWYBSSCSKXSYHYTXXGCQGXZZSHYXJSCRHMKK" - + "BXCZJYJYMKQHZJFNBHMQHYSNJNZYBKNQMCLGQHWLZNZSWXKHLJHYYBQLBFCDSXDLDSPFZPSKJYZWZXZDDXJSMMEGJSCSSMGCLXXKYYYLNYPWWWGYDKZJGGGZGGSYCKNJWNJPCXBJJTQTJWDSSPJXZXNZXUMELPXFSXTLLXCLJXJJLJZXCTPSWXLYDHLYQRWHSYCSQYYBYAYWJJJ" - + "QFWQCQQCJQGXALDBZZYJGKGXPLTZYFXJLTPADKYQHPMATLCPDCKBMTXYBHKLENXDLEEGQDYMSAWHZMLJTWYGXLYQZLJEEYYBQQFFNLYXRDSCTGJGXYYNKLLYQKCCTLHJLQMKKZGCYYGLLLJDZGYDHZWXPYSJBZKDZGYZZHYWYFQYTYZSZYEZZLYMHJJHTSMQWYZLKYYWZCSRKQY" - + "TLTDXWCTYJKLWSQZWBDCQYNCJSRSZJLKCDCDTLZZZACQQZZDDXYPLXZBQJYLZLLLQDDZQJYJYJZYXNYYYNYJXKXDAZWYRDLJYYYRJLXLLDYXJCYWYWNQCCLDDNYYYNYCKCZHXXCCLGZQJGKWPPCQQJYSBZZXYJSQPXJPZBSBDSFNSFPZXHDWZTDWPPTFLZZBZDMYYPQJRSDZSQZ" - + "SQXBDGCPZSWDWCSQZGMDHZXMWWFYBPDGPHTMJTHZSMMBGZMBZJCFZWFZBBZMQCFMBDMCJXLGPNJBBXGYHYYJGPTZGZMQBQTCGYXJXLWZKYDPDYMGCFTPFXYZTZXDZXTGKMTYBBCLBJASKYTSSQYYMSZXFJEWLXLLSZBQJJJAKLYLXLYCCTSXMCWFKKKBSXLLLLJYXTYLTJYYTDP" - + "JHNHNNKBYQNFQYYZBYYESSESSGDYHFHWTCJBSDZZTFDMXHCNJZYMQWSRYJDZJQPDQBBSTJGGFBKJBXTGQHNGWJXJGDLLTHZHHYYYYYYSXWTYYYCCBDBPYPZYCCZYJPZYWCBDLFWZCWJDXXHYHLHWZZXJTCZLCDPXUJCZZZLYXJJTXPHFXWPYWXZPTDZZBDZCYHJHMLXBQXSBYLR" - + "DTGJRRCTTTHYTCZWMXFYTWWZCWJWXJYWCSKYBZSCCTZQNHXNWXXKHKFHTSWOCCJYBCMPZZYKBNNZPBZHHZDLSYDDYTYFJPXYNGFXBYQXCBHXCPSXTYZDMKYSNXSXLHKMZXLYHDHKWHXXSSKQYHHCJYXGLHZXCSNHEKDTGZXQYPKDHEXTYKCNYMYYYPKQYYYKXZLTHJQTBYQHXBM" - + "YHSQCKWWYLLHCYYLNNEQXQWMCFBDCCMLJGGXDQKTLXKGNQCDGZJWYJJLYHHQTTTNWCHMXCXWHWSZJYDJCCDBQCDGDNYXZTHCQRXCBHZTQCBXWGQWYYBXHMBYMYQTYEXMQKYAQYRGYZSLFYKKQHYSSQYSHJGJCNXKZYCXSBXYXHYYLSTYCXQTHYSMGSCPMMGCCCCCMTZTASMGQZJ" - + "HKLOSQYLSWTMXSYQKDZLJQQYPLSYCZTCQQPBBQJZCLPKHQZYYXXDTDDTSJCXFFLLCHQXMJLWCJCXTSPYCXNDTJSHJWXDQQJSKXYAMYLSJHMLALYKXCYYDMNMDQMXMCZNNCYBZKKYFLMCHCMLHXRCJJHSYLNMTJZGZGYWJXSRXCWJGJQHQZDQJDCJJZKJKGDZQGJJYJYLXZXXCDQ" - + "HHHEYTMHLFSBDJSYYSHFYSTCZQLPBDRFRZTZYKYWHSZYQKWDQZRKMSYNBCRXQBJYFAZPZZEDZCJYWBCJWHYJBQSZYWRYSZPTDKZPFPBNZTKLQYHBBZPNPPTYZZYBQNYDCPJMMCYCQMCYFZZDCMNLFPBPLNGQJTBTTNJZPZBBZNJKLJQYLNBZQHKSJZNGGQSZZKYXSHPZSNBCGZK" - + "DDZQANZHJKDRTLZLSWJLJZLYWTJNDJZJHXYAYNCBGTZCSSQMNJPJYTYSWXZFKWJQTKHTZPLBHSNJZSYZBWZZZZLSYLSBJHDWWQPSLMMFBJDWAQYZTCJTBNNWZXQXCDSLQGDSDPDZHJTQQPSWLYYJZLGYXYZLCTCBJTKTYCZJTQKBSJLGMGZDMCSGPYNJZYQYYKNXRPWSZXMTNCS" - + "ZZYXYBYHYZAXYWQCJTLLCKJJTJHGDXDXYQYZZBYWDLWQCGLZGJGQRQZCZSSBCRPCSKYDZNXJSQGXSSJMYDNSTZTPBDLTKZWXQWQTZEXNQCZGWEZKSSBYBRTSSSLCCGBPSZQSZLCCGLLLZXHZQTHCZMQGYZQZNMCOCSZJMMZSQPJYGQLJYJPPLDXRGZYXCCSXHSHGTZNLZWZKJCX" - + "TCFCJXLBMQBCZZWPQDNHXLJCTHYZLGYLNLSZZPCXDSCQQHJQKSXZPBAJYEMSMJTZDXLCJYRYYNWJBNGZZTMJXLTBSLYRZPYLSSCNXPHLLHYLLQQZQLXYMRSYCXZLMMCZLTZSDWTJJLLNZGGQXPFSKYGYGHBFZPDKMWGHCXMSGDXJMCJZDYCABXJDLNBCDQYGSKYDQTXDJJYXMSZ" - + "QAZDZFSLQXYJSJZYLBTXXWXQQZBJZUFBBLYLWDSLJHXJYZJWTDJCZFQZQZZDZSXZZQLZCDZFJHYSPYMPQZMLPPLFFXJJNZZYLSJEYQZFPFZKSYWJJJHRDJZZXTXXGLGHYDXCSKYSWMMZCWYBAZBJKSHFHJCXMHFQHYXXYZFTSJYZFXYXPZLCHMZMBXHZZSXYFYMNCWDABAZLXKT" - + "CSHHXKXJJZJSTHYGXSXYYHHHJWXKZXSSBZZWHHHCWTZZZPJXSNXQQJGZYZYWLLCWXZFXXYXYHXMKYYSWSQMNLNAYCYSPMJKHWCQHYLAJJMZXHMMCNZHBHXCLXTJPLTXYJHDYYLTTXFSZHYXXSJBJYAYRSMXYPLCKDUYHLXRLNLLSTYZYYQYGYHHSCCSMZCTZQXKYQFPYYRPFFLK" - + "QUNTSZLLZMWWTCQQYZWTLLMLMPWMBZSSTZRBPDDTLQJJBXZCSRZQQYGWCSXFWZLXCCRSZDZMCYGGDZQSGTJSWLJMYMMZYHFBJDGYXCCPSHXNZCSBSJYJGJMPPWAFFYFNXHYZXZYLREMZGZCYZSSZDLLJCSQFNXZKPTXZGXJJGFMYYYSNBTYLBNLHPFZDCYFBMGQRRSSSZXYSGTZ" - + "RNYDZZCDGPJAFJFZKNZBLCZSZPSGCYCJSZLMLRSZBZZLDLSLLYSXSQZQLYXZLSKKBRXBRBZCYCXZZZEEYFGKLZLYYHGZSGZLFJHGTGWKRAAJYZKZQTSSHJJXDCYZUYJLZYRZDQQHGJZXSSZBYKJPBFRTJXLLFQWJHYLQTYMBLPZDXTZYGBDHZZRBGXHWNJTJXLKSCFSMWLSDQYS" - + "JTXKZSCFWJLBXFTZLLJZLLQBLSQMQQCGCZFPBPHZCZJLPYYGGDTGWDCFCZQYYYQYSSCLXZSKLZZZGFFCQNWGLHQYZJJCZLQZZYJPJZZBPDCCMHJGXDQDGDLZQMFGPSYTSDYFWWDJZJYSXYYCZCYHZWPBYKXRYLYBHKJKSFXTZJMMCKHLLTNYYMSYXYZPYJQYCSYCWMTJJKQYRHL" - + "LQXPSGTLYYCLJSCPXJYZFNMLRGJJTYZBXYZMSJYJHHFZQMSYXRSZCWTLRTQZSSTKXGQKGSPTGCZNJSJCQCXHMXGGZTQYDJKZDLBZSXJLHYQGGGTHQSZPYHJHHGYYGKGGCWJZZYLCZLXQSFTGZSLLLMLJSKCTBLLZZSZMMNYTPZSXQHJCJYQXYZXZQZCPSHKZZYSXCDFGMWQRLLQ" - + "XRFZTLYSTCTMJCXJJXHJNXTNRZTZFQYHQGLLGCXSZSJDJLJCYDSJTLNYXHSZXCGJZYQPYLFHDJSBPCCZHJJJQZJQDYBSSLLCMYTTMQTBHJQNNYGKYRQYQMZGCJKPDCGMYZHQLLSLLCLMHOLZGDYYFZSLJCQZLYLZQJESHNYLLJXGJXLYSYYYXNBZLJSSZCQQCJYLLZLTJYLLZLL" - + "BNYLGQCHXYYXOXCXQKYJXXXYKLXSXXYQXCYKQXQCSGYXXYQXYGYTQOHXHXPYXXXULCYEYCHZZCBWQBBWJQZSCSZSSLZYLKDESJZWMYMCYTSDSXXSCJPQQSQYLYYZYCMDJDZYWCBTJSYDJKCYDDJLBDJJSODZYSYXQQYXDHHGQQYQHDYXWGMMMAJDYBBBPPBCMUUPLJZSMTXERXJ" - + "MHQNUTPJDCBSSMSSSTKJTSSMMTRCPLZSZMLQDSDMJMQPNQDXCFYNBFSDQXYXHYAYKQYDDLQYYYSSZBYDSLNTFQTZQPZMCHDHCZCWFDXTMYQSPHQYYXSRGJCWTJTZZQMGWJJTJHTQJBBHWZPXXHYQFXXQYWYYHYSCDYDHHQMNMTMWCPBSZPPZZGLMZFOLLCFWHMMSJZTTDHZZYFF" - + "YTZZGZYSKYJXQYJZQBHMBZZLYGHGFMSHPZFZSNCLPBQSNJXZSLXXFPMTYJYGBXLLDLXPZJYZJYHHZCYWHJYLSJEXFSZZYWXKZJLUYDTMLYMQJPWXYHXSKTQJEZRPXXZHHMHWQPWQLYJJQJJZSZCPHJLCHHNXJLQWZJHBMZYXBDHHYPZLHLHLGFWLCHYYTLHJXCJMSCPXSTKPNHQ" - + "XSRTYXXTESYJCTLSSLSTDLLLWWYHDHRJZSFGXTSYCZYNYHTDHWJSLHTZDQDJZXXQHGYLTZPHCSQFCLNJTCLZPFSTPDYNYLGMJLLYCQHYSSHCHYLHQYQTMZYPBYWRFQYKQSYSLZDQJMPXYYSSRHZJNYWTQDFZBWWTWWRXCWHGYHXMKMYYYQMSMZHNGCEPMLQQMTCWCTMMPXJPJJH" - + "FXYYZSXZHTYBMSTSYJTTQQQYYLHYNPYQZLCYZHZWSMYLKFJXLWGXYPJYTYSYXYMZCKTTWLKSMZSYLMPWLZWXWQZSSAQSYXYRHSSNTSRAPXCPWCMGDXHXZDZYFJHGZTTSBJHGYZSZYSMYCLLLXBTYXHBBZJKSSDMALXHYCFYGMQYPJYCQXJLLLJGSLZGQLYCJCCZOTYXMTMTTLLW" - + "TGPXYMZMKLPSZZZXHKQYSXCTYJZYHXSHYXZKXLZWPSQPYHJWPJPWXQQYLXSDHMRSLZZYZWTTCYXYSZZSHBSCCSTPLWSSCJCHNLCGCHSSPHYLHFHHXJSXYLLNYLSZDHZXYLSXLWZYKCLDYAXZCMDDYSPJTQJZLNWQPSSSWCTSTSZLBLNXSMNYYMJQBQHRZWTYYDCHQLXKPZWBGQY" - + "BKFCMZWPZLLYYLSZYDWHXPSBCMLJBSCGBHXLQHYRLJXYSWXWXZSLDFHLSLYNJLZYFLYJYCDRJLFSYZFSLLCQYQFGJYHYXZLYLMSTDJCYHBZLLNWLXXYGYYHSMGDHXXHHLZZJZXCZZZCYQZFNGWPYLCPKPYYPMCLQKDGXZGGWQBDXZZKZFBXXLZXJTPJPTTBYTSZZDWSLCHZHSLT" - + "YXHQLHYXXXYYZYSWTXZKHLXZXZPYHGCHKCFSYHUTJRLXFJXPTZTWHPLYXFCRHXSHXKYXXYHZQDXQWULHYHMJTBFLKHTXCWHJFWJCFPQRYQXCYYYQYGRPYWSGSUNGWCHKZDXYFLXXHJJBYZWTSXXNCYJJYMSWZJQRMHXZWFQSYLZJZGBHYNSLBGTTCSYBYXXWXYHXYYXNSQYXMQY" - + "WRGYQLXBBZLJSYLPSYTJZYHYZAWLRORJMKSCZJXXXYXCHDYXRYXXJDTSQFXLYLTSFFYXLMTYJMJUYYYXLTZCSXQZQHZXLYYXZHDNBRXXXJCTYHLBRLMBRLLAXKYLLLJLYXXLYCRYLCJTGJCMTLZLLCYZZPZPCYAWHJJFYBDYYZSMPCKZDQYQPBPCJPDCYZMDPBCYYDYCNNPLMTM" - + "LRMFMMGWYZBSJGYGSMZQQQZTXMKQWGXLLPJGZBQCDJJJFPKJKCXBLJMSWMDTQJXLDLPPBXCWRCQFBFQJCZAHZGMYKPHYYHZYKNDKZMBPJYXPXYHLFPNYYGXJDBKXNXHJMZJXSTRSTLDXSKZYSYBZXJLXYSLBZYSLHXJPFXPQNBYLLJQKYGZMCYZZYMCCSLCLHZFWFWYXZMWSXTY" - + "NXJHPYYMCYSPMHYSMYDYSHQYZCHMJJMZCAAGCFJBBHPLYZYLXXSDJGXDHKXXTXXNBHRMLYJSLTXMRHNLXQJXYZLLYSWQGDLBJHDCGJYQYCMHWFMJYBMBYJYJWYMDPWHXQLDYGPDFXXBCGJSPCKRSSYZJMSLBZZJFLJJJLGXZGYXYXLSZQYXBEXYXHGCXBPLDYHWETTWWCJMBTXC" - + "HXYQXLLXFLYXLLJLSSFWDPZSMYJCLMWYTCZPCHQEKCQBWLCQYDPLQPPQZQFJQDJHYMMCXTXDRMJWRHXCJZYLQXDYYNHYYHRSLSRSYWWZJYMTLTLLGTQCJZYABTCKZCJYCCQLJZQXALMZYHYWLWDXZXQDLLQSHGPJFJLJHJABCQZDJGTKHSSTCYJLPSWZLXZXRWGLDLZRLZXTGSL" - + "LLLZLYXXWGDZYGBDPHZPBRLWSXQBPFDWOFMWHLYPCBJCCLDMBZPBZZLCYQXLDOMZBLZWPDWYYGDSTTHCSQSCCRSSSYSLFYBFNTYJSZDFNDPDHDZZMBBLSLCMYFFGTJJQWFTMTPJWFNLBZCMMJTGBDZLQLPYFHYYMJYLSDCHDZJWJCCTLJCLDTLJJCPDDSQDSSZYBNDBJLGGJZXS" - + "XNLYCYBJXQYCBYLZCFZPPGKCXZDZFZTJJFJSJXZBNZYJQTTYJYHTYCZHYMDJXTTMPXSPLZCDWSLSHXYPZGTFMLCJTYCBPMGDKWYCYZCDSZZYHFLYCTYGWHKJYYLSJCXGYWJCBLLCSNDDBTZBSCLYZCZZSSQDLLMQYYHFSLQLLXFTYHABXGWNYWYYPLLSDLDLLBJCYXJZMLHLJDX" - + "YYQYTDLLLBUGBFDFBBQJZZMDPJHGCLGMJJPGAEHHBWCQXAXHHHZCHXYPHJAXHLPHJPGPZJQCQZGJJZZUZDMQYYBZZPHYHYBWHAZYJHYKFGDPFQSDLZMLJXKXGALXZDAGLMDGXMWZQYXXDXXPFDMMSSYMPFMDMMKXKSYZYSHDZKXSYSMMZZZMSYDNZZCZXFPLSTMZDNMXCKJMZTY" - + "YMZMZZMSXHHDCZJEMXXKLJSTLWLSQLYJZLLZJSSDPPMHNLZJCZYHMXXHGZCJMDHXTKGRMXFWMCGMWKDTKSXQMMMFZZYDKMSCLCMPCGMHSPXQPZDSSLCXKYXTWLWJYAHZJGZQMCSNXYYMMPMLKJXMHLMLQMXCTKZMJQYSZJSYSZHSYJZJCDAJZYBSDQJZGWZQQXFKDMSDJLFWEHK" - + "ZQKJPEYPZYSZCDWYJFFMZZYLTTDZZEFMZLBNPPLPLPEPSZALLTYLKCKQZKGENQLWAGYXYDPXLHSXQQWQCQXQCLHYXXMLYCCWLYMQYSKGCHLCJNSZKPYZKCQZQLJPDMDZHLASXLBYDWQLWDNBQCRYDDZTJYBKBWSZDXDTNPJDTCTQDFXQQMGNXECLTTBKPWSLCTYQLPWYZZKLPYG" - + "ZCQQPLLKCCYLPQMZCZQCLJSLQZDJXLDDHPZQDLJJXZQDXYZQKZLJCYQDYJPPYPQYKJYRMPCBYMCXKLLZLLFQPYLLLMBSGLCYSSLRSYSQTMXYXZQZFDZUYSYZTFFMZZSMZQHZSSCCMLYXWTPZGXZJGZGSJSGKDDHTQGGZLLBJDZLCBCHYXYZHZFYWXYZYMSDBZZYJGTSMTFXQYXQ" - + "STDGSLNXDLRYZZLRYYLXQHTXSRTZNGZXBNQQZFMYKMZJBZYMKBPNLYZPBLMCNQYZZZSJZHJCTZKHYZZJRDYZHNPXGLFZTLKGJTCTSSYLLGZRZBBQZZKLPKLCZYSSUYXBJFPNJZZXCDWXZYJXZZDJJKGGRSRJKMSMZJLSJYWQSKYHQJSXPJZZZLSNSHRNYPZTWCHKLPSRZLZXYJQ" - + "XQKYSJYCZTLQZYBBYBWZPQDWWYZCYTJCJXCKCWDKKZXSGKDZXWWYYJQYYTCYTDLLXWKCZKKLCCLZCQQDZLQLCSFQCHQHSFSMQZZLNBJJZBSJHTSZDYSJQJPDLZCDCWJKJZZLPYCGMZWDJJBSJQZSYZYHHXJPBJYDSSXDZNCGLQMBTSFSBPDZDLZNFGFJGFSMPXJQLMBLGQCYYXB" - + "QKDJJQYRFKZTJDHCZKLBSDZCFJTPLLJGXHYXZCSSZZXSTJYGKGCKGYOQXJPLZPBPGTGYJZGHZQZZLBJLSQFZGKQQJZGYCZBZQTLDXRJXBSXXPZXHYZYCLWDXJJHXMFDZPFZHQHQMQGKSLYHTYCGFRZGNQXCLPDLBZCSCZQLLJBLHBZCYPZZPPDYMZZSGYHCKCPZJGSLJLNSCDSL" - + "DLXBMSTLDDFJMKDJDHZLZXLSZQPQPGJLLYBDSZGQLBZLSLKYYHZTTNTJYQTZZPSZQZTLLJTYYLLQLLQYZQLBDZLSLYYZYMDFSZSNHLXZNCZQZPBWSKRFBSYZMTHBLGJPMCZZLSTLXSHTCSYZLZBLFEQHLXFLCJLYLJQCBZLZJHHSSTBRMHXZHJZCLXFNBGXGTQJCZTMSFZKJMSS" - + "NXLJKBHSJXNTNLZDNTLMSJXGZJYJCZXYJYJWRWWQNZTNFJSZPZSHZJFYRDJSFSZJZBJFZQZZHZLXFYSBZQLZSGYFTZDCSZXZJBQMSZKJRHYJZCKMJKHCHGTXKXQGLXPXFXTRTYLXJXHDTSJXHJZJXZWZLCQSBTXWXGXTXXHXFTSDKFJHZYJFJXRZSDLLLTQSQQZQWZXSYQTWGWB" - + "ZCGZLLYZBCLMQQTZHZXZXLJFRMYZFLXYSQXXJKXRMQDZDMMYYBSQBHGZMWFWXGMXLZPYYTGZYCCDXYZXYWGSYJYZNBHPZJSQSYXSXRTFYZGRHZTXSZZTHCBFCLSYXZLZQMZLMPLMXZJXSFLBYZMYQHXJSXRXSQZZZSSLYFRCZJRCRXHHZXQYDYHXSJJHZCXZBTYNSYSXJBQLPXZ" - + "QPYMLXZKYXLXCJLCYSXXZZLXDLLLJJYHZXGYJWKJRWYHCPSGNRZLFZWFZZNSXGXFLZSXZZZBFCSYJDBRJKRDHHGXJLJJTGXJXXSTJTJXLYXQFCSGSWMSBCTLQZZWLZZKXJMLTMJYHSDDBXGZHDLBMYJFRZFSGCLYJBPMLYSMSXLSZJQQHJZFXGFQFQBPXZGYYQXGZTCQWYLTLGW" - + "SGWHRLFSFGZJMGMGBGTJFSYZZGZYZAFLSSPMLPFLCWBJZCLJJMZLPJJLYMQDMYYYFBGYGYZMLYZDXQYXRQQQHSYYYQXYLJTYXFSFSLLGNQCYHYCWFHCCCFXPYLYPLLZYXXXXXKQHHXSHJZCFZSCZJXCPZWHHHHHAPYLQALPQAFYHXDYLUKMZQGGGDDESRNNZLTZGCHYPPYSQJJH" - + "CLLJTOLNJPZLJLHYMHEYDYDSQYCDDHGZUNDZCLZYZLLZNTNYZGSLHSLPJJBDGWXPCDUTJCKLKCLWKLLCASSTKZZDNQNTTLYYZSSYSSZZRYLJQKCQDHHCRXRZYDGRGCWCGZQFFFPPJFZYNAKRGYWYQPQXXFKJTSZZXSWZDDFBBXTBGTZKZNPZZPZXZPJSZBMQHKCYXYLDKLJNYPK" - + "YGHGDZJXXEAHPNZKZTZCMXCXMMJXNKSZQNMNLWBWWXJKYHCPSTMCSQTZJYXTPCTPDTNNPGLLLZSJLSPBLPLQHDTNJNLYYRSZFFJFQWDPHZDWMRZCCLODAXNSSNYZRESTYJWJYJDBCFXNMWTTBYLWSTSZGYBLJPXGLBOCLHPCBJLTMXZLJYLZXCLTPNCLCKXTPZJSWCYXSFYSZDK" - + "NTLBYJCYJLLSTGQCBXRYZXBXKLYLHZLQZLNZCXWJZLJZJNCJHXMNZZGJZZXTZJXYCYYCXXJYYXJJXSSSJSTSSTTPPGQTCSXWZDCSYFPTFBFHFBBLZJCLZZDBXGCXLQPXKFZFLSYLTUWBMQJHSZBMDDBCYSCCLDXYCDDQLYJJWMQLLCSGLJJSYFPYYCCYLTJANTJJPWYCMMGQYYS" - + "XDXQMZHSZXPFTWWZQSWQRFKJLZJQQYFBRXJHHFWJJZYQAZMYFRHCYYBYQWLPEXCCZSTYRLTTDMQLYKMBBGMYYJPRKZNPBSXYXBHYZDJDNGHPMFSGMWFZMFQMMBCMZZCJJLCNUXYQLMLRYGQZCYXZLWJGCJCGGMCJNFYZZJHYCPRRCMTZQZXHFQGTJXCCJEAQCRJYHPLQLSZDJRB" - + "CQHQDYRHYLYXJSYMHZYDWLDFRYHBPYDTSSCNWBXGLPZMLZZTQSSCPJMXXYCSJYTYCGHYCJWYRXXLFEMWJNMKLLSWTXHYYYNCMMCWJDQDJZGLLJWJRKHPZGGFLCCSCZMCBLTBHBQJXQDSPDJZZGKGLFQYWBZYZJLTSTDHQHCTCBCHFLQMPWDSHYYTQWCNZZJTLBYMBPDYYYXSQKX" - + "WYYFLXXNCWCXYPMAELYKKJMZZZBRXYYQJFLJPFHHHYTZZXSGQQMHSPGDZQWBWPJHZJDYSCQWZKTXXSQLZYYMYSDZGRXCKKUJLWPYSYSCSYZLRMLQSYLJXBCXTLWDQZPCYCYKPPPNSXFYZJJRCEMHSZMSXLXGLRWGCSTLRSXBZGBZGZTCPLUJLSLYLYMTXMTZPALZXPXJTJWTCYY" - + "ZLBLXBZLQMYLXPGHDSLSSDMXMBDZZSXWHAMLCZCPJMCNHJYSNSYGCHSKQMZZQDLLKABLWJXSFMOCDXJRRLYQZKJMYBYQLYHETFJZFRFKSRYXFJTWDSXXSYSQJYSLYXWJHSNLXYYXHBHAWHHJZXWMYLJCSSLKYDZTXBZSYFDXGXZJKHSXXYBSSXDPYNZWRPTQZCZENYGCXQFJYKJ" - + "BZMLJCMQQXUOXSLYXXLYLLJDZBTYMHPFSTTQQWLHOKYBLZZALZXQLHZWRRQHLSTMYPYXJJXMQSJFNBXYXYJXXYQYLTHYLQYFMLKLJTMLLHSZWKZHLJMLHLJKLJSTLQXYLMBHHLNLZXQJHXCFXXLHYHJJGBYZZKBXSCQDJQDSUJZYYHZHHMGSXCSYMXFEBCQWWRBPYYJQTYZCYQY" - + "QQZYHMWFFHGZFRJFCDPXNTQYZPDYKHJLFRZXPPXZDBBGZQSTLGDGYLCQMLCHHMFYWLZYXKJLYPQHSYWMQQGQZMLZJNSQXJQSYJYCBEHSXFSZPXZWFLLBCYYJDYTDTHWZSFJMQQYJLMQXXLLDTTKHHYBFPWTYYSQQWNQWLGWDEBZWCMYGCULKJXTMXMYJSXHYBRWFYMWFRXYQMXY" - + "SZTZZTFYKMLDHQDXWYYNLCRYJBLPSXCXYWLSPRRJWXHQYPHTYDNXHHMMYWYTZCSQMTSSCCDALWZTCPQPYJLLQZYJSWXMZZMMYLMXCLMXCZMXMZSQTZPPQQBLPGXQZHFLJJHYTJSRXWZXSCCDLXTYJDCQJXSLQYCLZXLZZXMXQRJMHRHZJBHMFLJLMLCLQNLDXZLLLPYPSYJYSXC" - + "QQDCMQJZZXHNPNXZMEKMXHYKYQLXSXTXJYYHWDCWDZHQYYBGYBCYSCFGPSJNZDYZZJZXRZRQJJYMCANYRJTLDPPYZBSTJKXXZYPFDWFGZZRPYMTNGXZQBYXNBUFNQKRJQZMJEGRZGYCLKXZDSKKNSXKCLJSPJYYZLQQJYBZSSQLLLKJXTBKTYLCCDDBLSPPFYLGYDTZJYQGGKQT" - + "TFZXBDKTYYHYBBFYTYYBCLPDYTGDHRYRNJSPTCSNYJQHKLLLZSLYDXXWBCJQSPXBPJZJCJDZFFXXBRMLAZHCSNDLBJDSZBLPRZTSWSBXBCLLXXLZDJZSJPYLYXXYFTFFFBHJJXGBYXJPMMMPSSJZJMTLYZJXSWXTYLEDQPJMYGQZJGDJLQJWJQLLSJGJGYGMSCLJJXDTYGJQJQJ" - + "CJZCJGDZZSXQGSJGGCXHQXSNQLZZBXHSGZXCXYLJXYXYYDFQQJHJFXDHCTXJYRXYSQTJXYEFYYSSYYJXNCYZXFXMSYSZXYYSCHSHXZZZGZZZGFJDLTYLNPZGYJYZYYQZPBXQBDZTZCZYXXYHHSQXSHDHGQHJHGYWSZTMZMLHYXGEBTYLZKQWYTJZRCLEKYSTDBCYKQQSAYXCJXW" - + "WGSBHJYZYDHCSJKQCXSWXFLTYNYZPZCCZJQTZWJQDZZZQZLJJXLSBHPYXXPSXSHHEZTXFPTLQYZZXHYTXNCFZYYHXGNXMYWXTZSJPTHHGYMXMXQZXTSBCZYJYXXTYYZYPCQLMMSZMJZZLLZXGXZAAJZYXJMZXWDXZSXZDZXLEYJJZQBHZWZZZQTZPSXZTDSXJJJZNYAZPHXYYSR" - + "NQDTHZHYYKYJHDZXZLSWCLYBZYECWCYCRYLCXNHZYDZYDYJDFRJJHTRSQTXYXJRJHOJYNXELXSFSFJZGHPZSXZSZDZCQZBYYKLSGSJHCZSHDGQGXYZGXCHXZJWYQWGYHKSSEQZZNDZFKWYSSTCLZSTSYMCDHJXXYWEYXCZAYDMPXMDSXYBSQMJMZJMTZQLPJYQZCGQHXJHHLXXH" - + "LHDLDJQCLDWBSXFZZYYSCHTYTYYBHECXHYKGJPXHHYZJFXHWHBDZFYZBCAPNPGNYDMSXHMMMMAMYNBYJTMPXYYMCTHJBZYFCGTYHWPHFTWZZEZSBZEGPFMTSKFTYCMHFLLHGPZJXZJGZJYXZSBBQSCZZLZCCSTPGXMJSFTCCZJZDJXCYBZLFCJSYZFGSZLYBCWZZBYZDZYPSWYJ" - + "ZXZBDSYUXLZZBZFYGCZXBZHZFTPBGZGEJBSTGKDMFHYZZJHZLLZZGJQZLSFDJSSCBZGPDLFZFZSZYZYZSYGCXSNXXCHCZXTZZLJFZGQSQYXZJQDCCZTQCDXZJYQJQCHXZTDLGSCXZSYQJQTZWLQDQZTQCHQQJZYEZZZPBWKDJFCJPZTYPQYQTTYNLMBDKTJZPQZQZZFPZSBNJLG" - + "YJDXJDZZKZGQKXDLPZJTCJDQBXDJQJSTCKNXBXZMSLYJCQMTJQWWCJQNJNLLLHJCWQTBZQYDZCZPZZDZYDDCYZZZCCJTTJFZDPRRTZTJDCQTQZDTJNPLZBCLLCTZSXKJZQZPZLBZRBTJDCXFCZDBCCJJLTQQPLDCGZDBBZJCQDCJWYNLLZYZCCDWLLXWZLXRXNTQQCZXKQLSGDF" - + "QTDDGLRLAJJTKUYMKQLLTZYTDYYCZGJWYXDXFRSKSTQTENQMRKQZHHQKDLDAZFKYPBGGPZREBZZYKZZSPEGJXGYKQZZZSLYSYYYZWFQZYLZZLZHWCHKYPQGNPGBLPLRRJYXCCSYYHSFZFYBZYYTGZXYLXCZWXXZJZBLFFLGSKHYJZEYJHLPLLLLCZGXDRZELRHGKLZZYHZLYQSZ" - + "ZJZQLJZFLNBHGWLCZCFJYSPYXZLZLXGCCPZBLLCYBBBBUBBCBPCRNNZCZYRBFSRLDCGQYYQXYGMQZWTZYTYJXYFWTEHZZJYWLCCNTZYJJZDEDPZDZTSYQJHDYMBJNYJZLXTSSTPHNDJXXBYXQTZQDDTJTDYYTGWSCSZQFLSHLGLBCZPHDLYZJYCKWTYTYLBNYTSDSYCCTYSZYYE" - + "BHEXHQDTWNYGYCLXTSZYSTQMYGZAZCCSZZDSLZCLZRQXYYELJSBYMXSXZTEMBBLLYYLLYTDQYSHYMRQWKFKBFXNXSBYCHXBWJYHTQBPBSBWDZYLKGZSKYHXQZJXHXJXGNLJKZLYYCDXLFYFGHLJGJYBXQLYBXQPQGZTZPLNCYPXDJYQYDYMRBESJYYHKXXSTMXRCZZYWXYQYBMC" - + "LLYZHQYZWQXDBXBZWZMSLPDMYSKFMZKLZCYQYCZLQXFZZYDQZPZYGYJYZMZXDZFYFYTTQTZHGSPCZMLCCYTZXJCYTJMKSLPZHYSNZLLYTPZCTZZCKTXDHXXTQCYFKSMQCCYYAZHTJPCYLZLYJBJXTPNYLJYYNRXSYLMMNXJSMYBCSYSYLZYLXJJQYLDZLPQBFZZBLFNDXQKCZFY" - + "WHGQMRDSXYCYTXNQQJZYYPFZXDYZFPRXEJDGYQBXRCNFYYQPGHYJDYZXGRHTKYLNWDZNTSMPKLBTHBPYSZBZTJZSZZJTYYXZPHSSZZBZCZPTQFZMYFLYPYBBJQXZMXXDJMTSYSKKBJZXHJCKLPSMKYJZCXTMLJYXRZZQSLXXQPYZXMKYXXXJCLJPRMYYGADYSKQLSNDHYZKQXZY" - + "ZTCGHZTLMLWZYBWSYCTBHJHJFCWZTXWYTKZLXQSHLYJZJXTMPLPYCGLTBZZTLZJCYJGDTCLKLPLLQPJMZPAPXYZLKKTKDZCZZBNZDYDYQZJYJGMCTXLTGXSZLMLHBGLKFWNWZHDXUHLFMKYSLGXDTWWFRJEJZTZHYDXYKSHWFZCQSHKTMQQHTZHYMJDJSKHXZJZBZZXYMPAGQMS" - + "TPXLSKLZYNWRTSQLSZBPSPSGZWYHTLKSSSWHZZLYYTNXJGMJSZSUFWNLSOZTXGXLSAMMLBWLDSZYLAKQCQCTMYCFJBSLXCLZZCLXXKSBZQCLHJPSQPLSXXCKSLNHPSFQQYTXYJZLQLDXZQJZDYYDJNZPTUZDSKJFSLJHYLZSQZLBTXYDGTQFDBYAZXDZHZJNHHQBYKNXJJQCZML" - + "LJZKSPLDYCLBBLXKLELXJLBQYCXJXGCNLCQPLZLZYJTZLJGYZDZPLTQCSXFDMNYCXGBTJDCZNBGBQYQJWGKFHTNPYQZQGBKPBBYZMTJDYTBLSQMPSXTBNPDXKLEMYYCJYNZCTLDYKZZXDDXHQSHDGMZSJYCCTAYRZLPYLTLKXSLZCGGEXCLFXLKJRTLQJAQZNCMBYDKKCXGLCZJ" - + "ZXJHPTDJJMZQYKQSECQZDSHHADMLZFMMZBGNTJNNLGBYJBRBTMLBYJDZXLCJLPLDLPCQDHLXZLYCBLCXZZJADJLNZMMSSSMYBHBSQKBHRSXXJMXSDZNZPXLGBRHWGGFCXGMSKLLTSJYYCQLTSKYWYYHYWXBXQYWPYWYKQLSQPTNTKHQCWDQKTWPXXHCPTHTWUMSSYHBWCRWXHJM" - + "KMZNGWTMLKFGHKJYLSYYCXWHYECLQHKQHTTQKHFZLDXQWYZYYDESBPKYRZPJFYYZJCEQDZZDLATZBBFJLLCXDLMJSSXEGYGSJQXCWBXSSZPDYZCXDNYXPPZYDLYJCZPLTXLSXYZYRXCYYYDYLWWNZSAHJSYQYHGYWWAXTJZDAXYSRLTDPSSYYFNEJDXYZHLXLLLZQZSJNYQYQQX" - + "YJGHZGZCYJCHZLYCDSHWSHJZYJXCLLNXZJJYYXNFXMWFPYLCYLLABWDDHWDXJMCXZTZPMLQZHSFHZYNZTLLDYWLSLXHYMMYLMBWWKYXYADTXYLLDJPYBPWUXJMWMLLSAFDLLYFLBHHHBQQLTZJCQJLDJTFFKMMMBYTHYGDCQRDDWRQJXNBYSNWZDBYYTBJHPYBYTTJXAAHGQDQT" - + "MYSTQXKBTZPKJLZRBEQQSSMJJBDJOTGTBXPGBKTLHQXJJJCTHXQDWJLWRFWQGWSHCKRYSWGFTGYGBXSDWDWRFHWYTJJXXXJYZYSLPYYYPAYXHYDQKXSHXYXGSKQHYWFDDDPPLCJLQQEEWXKSYYKDYPLTJTHKJLTCYYHHJTTPLTZZCDLTHQKZXQYSTEEYWYYZYXXYYSTTJKLLPZM" - + "CYHQGXYHSRMBXPLLNQYDQHXSXXWGDQBSHYLLPJJJTHYJKYPPTHYYKTYEZYENMDSHLCRPQFDGFXZPSFTLJXXJBSWYYSKSFLXLPPLBBBLBSFXFYZBSJSSYLPBBFFFFSSCJDSTZSXZRYYSYFFSYZYZBJTBCTSBSDHRTJJBYTCXYJEYLXCBNEBJDSYXYKGSJZBXBYTFZWGENYHHTHZH" - + "HXFWGCSTBGXKLSXYWMTMBYXJSTZSCDYQRCYTWXZFHMYMCXLZNSDJTTTXRYCFYJSBSDYERXJLJXBBDEYNJGHXGCKGSCYMBLXJMSZNSKGXFBNBPTHFJAAFXYXFPXMYPQDTZCXZZPXRSYWZDLYBBKTYQPQJPZYPZJZNJPZJLZZFYSBTTSLMPTZRTDXQSJEHBZYLZDHLJSQMLHTXTJE" - + "CXSLZZSPKTLZKQQYFSYGYWPCPQFHQHYTQXZKRSGTTSQCZLPTXCDYYZXSQZSLXLZMYCPCQBZYXHBSXLZDLTCDXTYLZJYYZPZYZLTXJSJXHLPMYTXCQRBLZSSFJZZTNJYTXMYJHLHPPLCYXQJQQKZZSCPZKSWALQSBLCCZJSXGWWWYGYKTJBBZTDKHXHKGTGPBKQYSLPXPJCKBMLL" - + "XDZSTBKLGGQKQLSBKKTFXRMDKBFTPZFRTBBRFERQGXYJPZSSTLBZTPSZQZSJDHLJQLZBPMSMMSXLQQNHKNBLRDDNXXDHDDJCYYGYLXGZLXSYGMQQGKHBPMXYXLYTQWLWGCPBMQXCYZYDRJBHTDJYHQSHTMJSBYPLWHLZFFNYPMHXXHPLTBQPFBJWQDBYGPNZTPFZJGSDDTQSHZE" - + "AWZZYLLTYYBWJKXXGHLFKXDJTMSZSQYNZGGSWQSPHTLSSKMCLZXYSZQZXNCJDQGZDLFNYKLJCJLLZLMZZNHYDSSHTHZZLZZBBHQZWWYCRZHLYQQJBEYFXXXWHSRXWQHWPSLMSSKZTTYGYQQWRSLALHMJTQJSMXQBJJZJXZYZKXBYQXBJXSHZTSFJLXMXZXFGHKZSZGGYLCLSARJ" - + "YHSLLLMZXELGLXYDJYTLFBHBPNLYZFBBHPTGJKWETZHKJJXZXXGLLJLSTGSHJJYQLQZFKCGNNDJSSZFDBCTWWSEQFHQJBSAQTGYPQLBXBMMYWXGSLZHGLZGQYFLZBYFZJFRYSFMBYZHQGFWZSYFYJJPHZBYYZFFWODGRLMFTWLBZGYCQXCDJYGZYYYYTYTYDWEGAZYHXJLZYYHL" - + "RMGRXXZCLHNELJJTJTPWJYBJJBXJJTJTEEKHWSLJPLPSFYZPQQBDLQJJTYYQLYZKDKSQJYYQZLDQTGJQYZJSUCMRYQTHTEJMFCTYHYPKMHYZWJDQFHYYXWSHCTXRLJHQXHCCYYYJLTKTTYTMXGTCJTZAYYOCZLYLBSZYWJYTSJYHBYSHFJLYGJXXTMZYYLTXXYPZLXYJZYZYYPN" - + "HMYMDYYLBLHLSYYQQLLNJJYMSOYQBZGDLYXYLCQYXTSZEGXHZGLHWBLJHEYXTWQMAKBPQCGYSHHEGQCMWYYWLJYJHYYZLLJJYLHZYHMGSLJLJXCJJYCLYCJPCPZJZJMMYLCQLNQLJQJSXYJMLSZLJQLYCMMHCFMMFPQQMFYLQMCFFQMMMMHMZNFHHJGTTHHKHSLNCHHYQDXTMMQ" - + "DCYZYXYQMYQYLTDCYYYZAZZCYMZYDLZFFFMMYCQZWZZMABTBYZTDMNZZGGDFTYPCGQYTTSSFFWFDTZQSSYSTWXJHXYTSXXYLBYQHWWKXHZXWZNNZZJZJJQJCCCHYYXBZXZCYZTLLCQXYNJYCYYCYNZZQYYYEWYCZDCJYCCHYJLBTZYYCQWMPWPYMLGKDLDLGKQQBGYCHJXY"; - - //此处收录了375个多音字,数据来自于http://www.51window.net/page/pinyin - var oMultiDiff = { - "19969": "DZ", - "19975": "WM", - "19988": "QJ", - "20048": "YL", - "20056": "SC", - "20060": "NM", - "20094": "QG", - "20127": "QJ", - "20167": "QC", - "20193": "YG", - "20250": "KH", - "20256": "ZC", - "20282": "SC", - "20285": "QJG", - "20291": "TD", - "20314": "YD", - "20340": "NE", - "20375": "TD", - "20389": "YJ", - "20391": "CZ", - "20415": "PB", - "20446": "YS", - "20447": "SQ", - "20504": "TC", - "20608": "KG", - "20854": "QJ", - "20857": "ZC", - "20911": "PF", - "20504": "TC", - "20608": "KG", - "20854": "QJ", - "20857": "ZC", - "20911": "PF", - "20985": "AW", - "21032": "PB", - "21048": "XQ", - "21049": "SC", - "21089": "YS", - "21119": "JC", - "21242": "SB", - "21273": "SC", - "21305": "YP", - "21306": "QO", - "21330": "ZC", - "21333": "SDC", - "21345": "QK", - "21378": "CA", - "21397": "SC", - "21414": "XS", - "21442": "SC", - "21477": "JG", - "21480": "TD", - "21484": "ZS", - "21494": "YX", - "21505": "YX", - "21512": "HG", - "21523": "XH", - "21537": "PB", - "21542": "PF", - "21549": "KH", - "21571": "E", - "21574": "DA", - "21588": "TD", - "21589": "O", - "21618": "ZC", - "21621": "KHA", - "21632": "ZJ", - "21654": "KG", - "21679": "LKG", - "21683": "KH", - "21710": "A", - "21719": "YH", - "21734": "WOE", - "21769": "A", - "21780": "WN", - "21804": "XH", - "21834": "A", - "21899": "ZD", - "21903": "RN", - "21908": "WO", - "21939": "ZC", - "21956": "SA", - "21964": "YA", - "21970": "TD", - "22003": "A", - "22031": "JG", - "22040": "XS", - "22060": "ZC", - "22066": "ZC", - "22079": "MH", - "22129": "XJ", - "22179": "XA", - "22237": "NJ", - "22244": "TD", - "22280": "JQ", - "22300": "YH", - "22313": "XW", - "22331": "YQ", - "22343": "YJ", - "22351": "PH", - "22395": "DC", - "22412": "TD", - "22484": "PB", - "22500": "PB", - "22534": "ZD", - "22549": "DH", - "22561": "PB", - "22612": "TD", - "22771": "KQ", - "22831": "HB", - "22841": "JG", - "22855": "QJ", - "22865": "XQ", - "23013": "ML", - "23081": "WM", - "23487": "SX", - "23558": "QJ", - "23561": "YW", - "23586": "YW", - "23614": "YW", - "23615": "SN", - "23631": "PB", - "23646": "ZS", - "23663": "ZT", - "23673": "YG", - "23762": "TD", - "23769": "ZS", - "23780": "QJ", - "23884": "QK", - "24055": "XH", - "24113": "DC", - "24162": "ZC", - "24191": "GA", - "24273": "QJ", - "24324": "NL", - "24377": "TD", - "24378": "QJ", - "24439": "PF", - "24554": "ZS", - "24683": "TD", - "24694": "WE", - "24733": "LK", - "24925": "TN", - "25094": "ZG", - "25100": "XQ", - "25103": "XH", - "25153": "PB", - "25170": "PB", - "25179": "KG", - "25203": "PB", - "25240": "ZS", - "25282": "FB", - "25303": "NA", - "25324": "KG", - "25341": "ZY", - "25373": "WZ", - "25375": "XJ", - "25384": "A", - "25457": "A", - "25528": "SD", - "25530": "SC", - "25552": "TD", - "25774": "ZC", - "25874": "ZC", - "26044": "YW", - "26080": "WM", - "26292": "PB", - "26333": "PB", - "26355": "ZY", - "26366": "CZ", - "26397": "ZC", - "26399": "QJ", - "26415": "ZS", - "26451": "SB", - "26526": "ZC", - "26552": "JG", - "26561": "TD", - "26588": "JG", - "26597": "CZ", - "26629": "ZS", - "26638": "YL", - "26646": "XQ", - "26653": "KG", - "26657": "XJ", - "26727": "HG", - "26894": "ZC", - "26937": "ZS", - "26946": "ZC", - "26999": "KJ", - "27099": "KJ", - "27449": "YQ", - "27481": "XS", - "27542": "ZS", - "27663": "ZS", - "27748": "TS", - "27784": "SC", - "27788": "ZD", - "27795": "TD", - "27812": "O", - "27850": "PB", - "27852": "MB", - "27895": "SL", - "27898": "PL", - "27973": "QJ", - "27981": "KH", - "27986": "HX", - "27994": "XJ", - "28044": "YC", - "28065": "WG", - "28177": "SM", - "28267": "QJ", - "28291": "KH", - "28337": "ZQ", - "28463": "TL", - "28548": "DC", - "28601": "TD", - "28689": "PB", - "28805": "JG", - "28820": "QG", - "28846": "PB", - "28952": "TD", - "28975": "ZC", - "29100": "A", - "29325": "QJ", - "29575": "SL", - "29602": "FB", - "30010": "TD", - "30044": "CX", - "30058": "PF", - "30091": "YSP", - "30111": "YN", - "30229": "XJ", - "30427": "SC", - "30465": "SX", - "30631": "YQ", - "30655": "QJ", - "30684": "QJG", - "30707": "SD", - "30729": "XH", - "30796": "LG", - "30917": "PB", - "31074": "NM", - "31085": "JZ", - "31109": "SC", - "31181": "ZC", - "31192": "MLB", - "31293": "JQ", - "31400": "YX", - "31584": "YJ", - "31896": "ZN", - "31909": "ZY", - "31995": "XJ", - "32321": "PF", - "32327": "ZY", - "32418": "HG", - "32420": "XQ", - "32421": "HG", - "32438": "LG", - "32473": "GJ", - "32488": "TD", - "32521": "QJ", - "32527": "PB", - "32562": "ZSQ", - "32564": "JZ", - "32735": "ZD", - "32793": "PB", - "33071": "PF", - "33098": "XL", - "33100": "YA", - "33152": "PB", - "33261": "CX", - "33324": "BP", - "33333": "TD", - "33406": "YA", - "33426": "WM", - "33432": "PB", - "33445": "JG", - "33486": "ZN", - "33493": "TS", - "33507": "QJ", - "33540": "QJ", - "33544": "ZC", - "33564": "XQ", - "33617": "YT", - "33632": "QJ", - "33636": "XH", - "33637": "YX", - "33694": "WG", - "33705": "PF", - "33728": "YW", - "33882": "SR", - "34067": "WM", - "34074": "YW", - "34121": "QJ", - "34255": "ZC", - "34259": "XL", - "34425": "JH", - "34430": "XH", - "34485": "KH", - "34503": "YS", - "34532": "HG", - "34552": "XS", - "34558": "YE", - "34593": "ZL", - "34660": "YQ", - "34892": "XH", - "34928": "SC", - "34999": "QJ", - "35048": "PB", - "35059": "SC", - "35098": "ZC", - "35203": "TQ", - "35265": "JX", - "35299": "JX", - "35782": "SZ", - "35828": "YS", - "35830": "E", - "35843": "TD", - "35895": "YG", - "35977": "MH", - "36158": "JG", - "36228": "QJ", - "36426": "XQ", - "36466": "DC", - "36710": "JC", - "36711": "ZYG", - "36767": "PB", - "36866": "SK", - "36951": "YW", - "37034": "YX", - "37063": "XH", - "37218": "ZC", - "37325": "ZC", - "38063": "PB", - "38079": "TD", - "38085": "QY", - "38107": "DC", - "38116": "TD", - "38123": "YD", - "38224": "HG", - "38241": "XTC", - "38271": "ZC", - "38415": "YE", - "38426": "KH", - "38461": "YD", - "38463": "AE", - "38466": "PB", - "38477": "XJ", - "38518": "YT", - "38551": "WK", - "38585": "ZC", - "38704": "XS", - "38739": "LJ", - "38761": "GJ", - "38808": "SQ", - "39048": "JG", - "39049": "XJ", - "39052": "HG", - "39076": "CZ", - "39271": "XT", - "39534": "TD", - "39552": "TD", - "39584": "PB", - "39647": "SB", - "39730": "LG", - "39748": "TPB", - "40109": "ZQ", - "40479": "ND", - "40516": "HG", - "40536": "HG", - "40583": "QJ", - "40765": "YQ", - "40784": "QJ", - "40840": "YK", - "40863": "QJG" - }; - - var _checkPYCh = function (ch) { - var uni = ch.charCodeAt(0); - // 如果不在汉字处理范围之内,返回原字符,也可以调用自己的处理函数 - if (uni > 40869 || uni < 19968) - return ch; // dealWithOthers(ch); - return (oMultiDiff[uni] ? oMultiDiff[uni] : (_ChineseFirstPY.charAt(uni - 19968))); - }; - - var _mkPYRslt = function (arr) { - var arrRslt = [""], k; - for (var i = 0, len = arr.length; i < len; i++) { - var str = arr[i]; - var strlen = str.length; - if (strlen == 1) { - for (k = 0; k < arrRslt.length; k++) { - arrRslt[k] += str; - } - } else { - var tmpArr = arrRslt.slice(0); - arrRslt = []; - for (k = 0; k < strlen; k++) { - // 复制一个相同的arrRslt - var tmp = tmpArr.slice(0); - // 把当前字符str[k]添加到每个元素末尾 - for (var j = 0; j < tmp.length; j++) { - tmp[j] += str.charAt(k); - } - // 把复制并修改后的数组连接到arrRslt上 - arrRslt = arrRslt.concat(tmp); - } - } - } - return arrRslt.join("").toLowerCase(); - }; - - _.extend(BI, { - makeFirstPY: function (str) { - if (typeof (str) != "string") - return '' + str; - var arrResult = []; // 保存中间结果的数组 - for (var i = 0, len = str.length; i < len; i++) { - // 获得unicode码 - var ch = str.charAt(i); - // 检查该unicode码是否在处理范围之内,在则返回该码对映汉字的拼音首字母,不在则调用其它函数处理 - arrResult.push(_checkPYCh(ch)); - } - // 处理arrResult,返回所有可能的拼音首字母串数组 - return _mkPYRslt(arrResult); - } - }); -})();/** - * Detect Element Resize. - * Forked in order to guard against unsafe 'window' and 'document' references. - * - * https://github.com/sdecima/javascript-detect-element-resize - * Sebastian Decima - * - * version: 0.5.3 - **/ -!(function () { - // Check `document` and `window` in case of server-side rendering - var _window - if (typeof window !== 'undefined') { - _window = window - } else if (typeof self !== 'undefined') { - _window = self - } else { - _window = this - } - - var addEventListener = typeof document !== 'undefined' && document.addEventListener; - var stylesCreated = false; - - if (addEventListener) { - var requestFrame = (function () { - var raf = _window.requestAnimationFrame || _window.mozRequestAnimationFrame || _window.webkitRequestAnimationFrame || - function (fn) { - return _window.setTimeout(fn, 20); - }; - return function (fn) { - return raf(fn); - }; - })(); - - var cancelFrame = (function () { - var cancel = _window.cancelAnimationFrame || _window.mozCancelAnimationFrame || _window.webkitCancelAnimationFrame || - _window.clearTimeout; - return function (id) { - return cancel(id); - }; - })(); - - var resetTriggers = function (element) { - var triggers = element.__resizeTriggers__, - expand = triggers.firstElementChild, - contract = triggers.lastElementChild, - expandChild = expand.firstElementChild; - contract.scrollLeft = contract.scrollWidth; - contract.scrollTop = contract.scrollHeight; - expandChild.style.width = expand.offsetWidth + 1 + 'px'; - expandChild.style.height = expand.offsetHeight + 1 + 'px'; - expand.scrollLeft = expand.scrollWidth; - expand.scrollTop = expand.scrollHeight; - }; - - var checkTriggers = function (element) { - return element.offsetWidth !== element.__resizeLast__.width || - element.offsetHeight !== element.__resizeLast__.height; - } - - var scrollListener = function (e) { - var element = this; - resetTriggers(this); - if (this.__resizeRAF__) cancelFrame(this.__resizeRAF__); - this.__resizeRAF__ = requestFrame(function () { - if (checkTriggers(element)) { - element.__resizeLast__.width = element.offsetWidth; - element.__resizeLast__.height = element.offsetHeight; - element.__resizeListeners__.forEach(function (fn) { - fn.call(element, e); - }); - } - }); - }; - - /* Detect CSS Animations support to detect element display/re-attach */ - var animation = false, - animationstring = 'animation', - keyframeprefix = '', - animationstartevent = 'animationstart', - domPrefixes = 'Webkit Moz O ms'.split(' '), - startEvents = 'webkitAnimationStart animationstart oAnimationStart MSAnimationStart'.split(' '), - pfx = ''; - { - var elm = document.createElement('fakeelement'); - if (elm.style.animationName !== undefined) { - animation = true; - } - - if (animation === false) { - for (var i = 0; i < domPrefixes.length; i++) { - if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) { - pfx = domPrefixes[i]; - animationstring = pfx + 'Animation'; - keyframeprefix = '-' + pfx.toLowerCase() + '-'; - animationstartevent = startEvents[i]; - animation = true; - break; - } - } - } - } - - var animationName = 'resizeanim'; - var animationKeyframes = '@' + keyframeprefix + 'keyframes ' + animationName + ' { from { opacity: 0; } to { opacity: 0; } } '; - var animationStyle = keyframeprefix + 'animation: 1ms ' + animationName + '; '; - } - - var createStyles = function () { - if (!stylesCreated) { - //opacity:0 works around a chrome bug https://code.google.com/p/chromium/issues/detail?id=286360 - var css = (animationKeyframes ? animationKeyframes : '') + - '.resize-triggers { ' + (animationStyle ? animationStyle : '') + 'visibility: hidden; opacity: 0; } ' + - '.resize-triggers, .resize-triggers > div, .contract-trigger:before { content: \" \"; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', - head = document.head || document.getElementsByTagName('head')[0], - style = document.createElement('style'); - - style.type = 'text/css'; - if (style.styleSheet) { - style.styleSheet.cssText = css; - } else { - style.appendChild(document.createTextNode(css)); - } - - head.appendChild(style); - stylesCreated = true; - } - } - - var addResizeListener = function (element, fn) { - if (addEventListener){ - if (!element.__resizeTriggers__) { - if (getComputedStyle(element).position === 'static') element.style.position = 'relative'; - createStyles(); - element.__resizeLast__ = {}; - element.__resizeListeners__ = []; - (element.__resizeTriggers__ = document.createElement('div')).className = 'resize-triggers'; - element.__resizeTriggers__.innerHTML = '<div class="expand-trigger"><div></div></div>' + - '<div class="contract-trigger"></div>'; - element.appendChild(element.__resizeTriggers__); - resetTriggers(element); - element.addEventListener('scroll', scrollListener, true); - - /* Listen for a css animation to detect element display/re-attach */ - animationstartevent && element.__resizeTriggers__.addEventListener(animationstartevent, function (e) { - if (e.animationName === animationName) - resetTriggers(element); - }); - } - element.__resizeListeners__.push(fn); - - } else { - element.attachEvent('onresize', fn); - } - }; - - var removeResizeListener = function (element, fn) { - if (addEventListener) { - element.__resizeListeners__.splice(element.__resizeListeners__.indexOf(fn), 1); - if (!element.__resizeListeners__.length) { - element.removeEventListener('scroll', scrollListener, true); - element.__resizeTriggers__ = !element.removeChild(element.__resizeTriggers__); - } - } else { - element.detachEvent('onresize', fn); - } - }; - - BI.ResizeDetector = { - addResizeListener: function (widget, fn) { - addResizeListener(widget.element[0], fn); - return function () { - removeResizeListener(widget.element[0], fn); - } - }, - removeResizeListener: function (widget, fn) { - removeResizeListener(widget.element[0], fn); - } - }; -}()); -; -(function () { - function defaultComparator(a, b) { - return a < b; - } - - BI.Heap = function (items, comparator) { - this._items = items || []; - this._size = this._items.length; - this._comparator = comparator || defaultComparator; - this._heapify(); - }; - - BI.Heap.prototype = { - constructor: BI.Heap, - empty: function () { - return this._size === 0; - }, - - pop: function () { - if (this._size === 0) { - return; - } - - var elt = this._items[0]; - - var lastElt = this._items.pop(); - this._size--; - - if (this._size > 0) { - this._items[0] = lastElt; - this._sinkDown(0); - } - - return elt; - }, - - push: function (item) { - this._items[this._size++] = item; - this._bubbleUp(this._size - 1); - }, - - size: function () { - return this._size; - }, - - peek: function () { - if (this._size === 0) { - return; - } - - return this._items[0]; - }, - - _heapify: function () { - for (var index = Math.floor((this._size + 1) / 2); index >= 0; index--) { - this._sinkDown(index); - } - }, - - _bubbleUp: function (index) { - var elt = this._items[index]; - while (index > 0) { - var parentIndex = Math.floor((index + 1) / 2) - 1; - var parentElt = this._items[parentIndex]; - - // if parentElt < elt, stop - if (this._comparator(parentElt, elt)) { - return; - } - - // swap - this._items[parentIndex] = elt; - this._items[index] = parentElt; - index = parentIndex; - } - }, - - _sinkDown: function (index) { - var elt = this._items[index]; - - while (true) { - var leftChildIndex = 2 * (index + 1) - 1; - var rightChildIndex = 2 * (index + 1); - var swapIndex = -1; - - if (leftChildIndex < this._size) { - var leftChild = this._items[leftChildIndex]; - if (this._comparator(leftChild, elt)) { - swapIndex = leftChildIndex; - } - } - - if (rightChildIndex < this._size) { - var rightChild = this._items[rightChildIndex]; - if (this._comparator(rightChild, elt)) { - if (swapIndex === -1 || - this._comparator(rightChild, this._items[swapIndex])) { - swapIndex = rightChildIndex; - } - } - } - - // if we don't have a swap, stop - if (swapIndex === -1) { - return; - } - - this._items[index] = this._items[swapIndex]; - this._items[swapIndex] = elt; - index = swapIndex; - } - } - } -})(); -;(function () { - var clamp = function (min, value, max) { - if (value < min) { - return min; - } - if (value > max) { - return max; - } - return value; - }; - - var BUFFER_ROWS = 5; - var NO_ROWS_SCROLL_RESULT = { - index: 0, - offset: 0, - position: 0, - contentHeight: 0 - }; - - BI.TableScrollHelper = function (rowCount, - defaultRowHeight, - viewportHeight, - rowHeightGetter) { - this._rowOffsets = BI.PrefixIntervalTree.uniform(rowCount, defaultRowHeight); - this._storedHeights = new Array(rowCount); - for (var i = 0; i < rowCount; ++i) { - this._storedHeights[i] = defaultRowHeight; - } - this._rowCount = rowCount; - this._position = 0; - this._contentHeight = rowCount * defaultRowHeight; - this._defaultRowHeight = defaultRowHeight; - this._rowHeightGetter = rowHeightGetter ? - rowHeightGetter : function () { - return defaultRowHeight - }; - this._viewportHeight = viewportHeight; - - this._updateHeightsInViewport(0, 0); - }; - - BI.TableScrollHelper.prototype = { - constructor: BI.TableScrollHelper, - setRowHeightGetter: function (rowHeightGetter) { - this._rowHeightGetter = rowHeightGetter; - }, - - setViewportHeight: function (viewportHeight) { - this._viewportHeight = viewportHeight; - }, - - getContentHeight: function () { - return this._contentHeight; - }, - - _updateHeightsInViewport: function (firstRowIndex, - firstRowOffset) { - var top = firstRowOffset; - var index = firstRowIndex; - while (top <= this._viewportHeight && index < this._rowCount) { - this._updateRowHeight(index); - top += this._storedHeights[index]; - index++; - } - }, - - _updateHeightsAboveViewport: function (firstRowIndex) { - var index = firstRowIndex - 1; - while (index >= 0 && index >= firstRowIndex - BUFFER_ROWS) { - var delta = this._updateRowHeight(index); - this._position += delta; - index--; - } - }, - - _updateRowHeight: function (rowIndex) { - if (rowIndex < 0 || rowIndex >= this._rowCount) { - return 0; - } - var newHeight = this._rowHeightGetter(rowIndex); - if (newHeight !== this._storedHeights[rowIndex]) { - var change = newHeight - this._storedHeights[rowIndex]; - this._rowOffsets.set(rowIndex, newHeight); - this._storedHeights[rowIndex] = newHeight; - this._contentHeight += change; - return change; - } - return 0; - }, - - getRowPosition: function (rowIndex) { - this._updateRowHeight(rowIndex); - return this._rowOffsets.sumUntil(rowIndex); - }, - - scrollBy: function (delta) { - if (this._rowCount === 0) { - return NO_ROWS_SCROLL_RESULT; - } - var firstRow = this._rowOffsets.greatestLowerBound(this._position); - firstRow = clamp(firstRow, 0, Math.max(this._rowCount - 1, 0)); - var firstRowPosition = this._rowOffsets.sumUntil(firstRow); - var rowIndex = firstRow; - var position = this._position; - - var rowHeightChange = this._updateRowHeight(rowIndex); - if (firstRowPosition !== 0) { - position += rowHeightChange; - } - var visibleRowHeight = this._storedHeights[rowIndex] - - (position - firstRowPosition); - - if (delta >= 0) { - - while (delta > 0 && rowIndex < this._rowCount) { - if (delta < visibleRowHeight) { - position += delta; - delta = 0; - } else { - delta -= visibleRowHeight; - position += visibleRowHeight; - rowIndex++; - } - if (rowIndex < this._rowCount) { - this._updateRowHeight(rowIndex); - visibleRowHeight = this._storedHeights[rowIndex]; - } - } - } else if (delta < 0) { - delta = -delta; - var invisibleRowHeight = this._storedHeights[rowIndex] - visibleRowHeight; - - while (delta > 0 && rowIndex >= 0) { - if (delta < invisibleRowHeight) { - position -= delta; - delta = 0; - } else { - position -= invisibleRowHeight; - delta -= invisibleRowHeight; - rowIndex--; - } - if (rowIndex >= 0) { - var change = this._updateRowHeight(rowIndex); - invisibleRowHeight = this._storedHeights[rowIndex]; - position += change; - } - } - } - - var maxPosition = this._contentHeight - this._viewportHeight; - position = clamp(position, 0, maxPosition); - this._position = position; - var firstRowIndex = this._rowOffsets.greatestLowerBound(position); - firstRowIndex = clamp(firstRowIndex, 0, Math.max(this._rowCount - 1, 0)); - firstRowPosition = this._rowOffsets.sumUntil(firstRowIndex); - var firstRowOffset = firstRowPosition - position; - - this._updateHeightsInViewport(firstRowIndex, firstRowOffset); - this._updateHeightsAboveViewport(firstRowIndex); - - return { - index: firstRowIndex, - offset: firstRowOffset, - position: this._position, - contentHeight: this._contentHeight - }; - }, - - _getRowAtEndPosition: function (rowIndex) { - // We need to update enough rows above the selected one to be sure that when - // we scroll to selected position all rows between first shown and selected - // one have most recent heights computed and will not resize - this._updateRowHeight(rowIndex); - var currentRowIndex = rowIndex; - var top = this._storedHeights[currentRowIndex]; - while (top < this._viewportHeight && currentRowIndex >= 0) { - currentRowIndex--; - if (currentRowIndex >= 0) { - this._updateRowHeight(currentRowIndex); - top += this._storedHeights[currentRowIndex]; - } - } - var position = this._rowOffsets.sumTo(rowIndex) - this._viewportHeight; - if (position < 0) { - position = 0; - } - return position; - }, - - scrollTo: function (position) { - if (this._rowCount === 0) { - return NO_ROWS_SCROLL_RESULT; - } - if (position <= 0) { - // If position less than or equal to 0 first row should be fully visible - // on top - this._position = 0; - this._updateHeightsInViewport(0, 0); - - return { - index: 0, - offset: 0, - position: this._position, - contentHeight: this._contentHeight - }; - } else if (position >= this._contentHeight - this._viewportHeight) { - // If position is equal to or greater than max scroll value, we need - // to make sure to have bottom border of last row visible. - var rowIndex = this._rowCount - 1; - position = this._getRowAtEndPosition(rowIndex); - } - this._position = position; - - var firstRowIndex = this._rowOffsets.greatestLowerBound(position); - firstRowIndex = clamp(firstRowIndex, 0, Math.max(this._rowCount - 1, 0)); - var firstRowPosition = this._rowOffsets.sumUntil(firstRowIndex); - var firstRowOffset = firstRowPosition - position; - - this._updateHeightsInViewport(firstRowIndex, firstRowOffset); - this._updateHeightsAboveViewport(firstRowIndex); - - return { - index: firstRowIndex, - offset: firstRowOffset, - position: this._position, - contentHeight: this._contentHeight - }; - }, - - /** - * Allows to scroll to selected row with specified offset. It always - * brings that row to top of viewport with that offset - */ - scrollToRow: function (rowIndex, offset) { - rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0)); - offset = clamp(offset, -this._storedHeights[rowIndex], 0); - var firstRow = this._rowOffsets.sumUntil(rowIndex); - return this.scrollTo(firstRow - offset); - }, - - /** - * Allows to scroll to selected row by bringing it to viewport with minimal - * scrolling. This that if row is fully visible, scroll will not be changed. - * If top border of row is above top of viewport it will be scrolled to be - * fully visible on the top of viewport. If the bottom border of row is - * below end of viewport, it will be scrolled up to be fully visible on the - * bottom of viewport. - */ - scrollRowIntoView: function (rowIndex) { - rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0)); - var rowBegin = this._rowOffsets.sumUntil(rowIndex); - var rowEnd = rowBegin + this._storedHeights[rowIndex]; - if (rowBegin < this._position) { - return this.scrollTo(rowBegin); - } else if (this._position + this._viewportHeight < rowEnd) { - var position = this._getRowAtEndPosition(rowIndex); - return this.scrollTo(position); - } - return this.scrollTo(this._position); - } - }; - -})(); -// Data structure that allows to store values and assign positions to them -// in a way to minimize changing positions of stored values when new ones are -// added or when some values are replaced. Stored elements are alwasy assigned -// a consecutive set of positoins startin from 0 up to count of elements less 1 -// Following actions can be executed -// * get position assigned to given value (null if value is not stored) -// * create new entry for new value and get assigned position back -// * replace value that is furthest from specified value range with new value -// and get it's position back -// All operations take amortized log(n) time where n is number of elements in -// the set. -BI.IntegerBufferSet = function () { - this._valueToPositionMap = {}; - this._size = 0; - this._smallValues = new BI.Heap( - [], // Initial data in the heap - this._smallerComparator - ); - this._largeValues = new BI.Heap( - [], // Initial data in the heap - this._greaterComparator - ); - -}; - -BI.IntegerBufferSet.prototype = { - constructor: BI.IntegerBufferSet, - getSize: function () /*number*/ { - return this._size; - }, - - getValuePosition: function (/*number*/ value) /*?number*/ { - if (this._valueToPositionMap[value] === undefined) { - return null; - } - return this._valueToPositionMap[value]; - }, - - getNewPositionForValue: function (/*number*/ value) /*number*/ { - var newPosition = this._size; - this._size++; - this._pushToHeaps(newPosition, value); - this._valueToPositionMap[value] = newPosition; - return newPosition; - }, - - replaceFurthestValuePosition: function (/*number*/ lowValue, - /*number*/ highValue, - /*number*/ newValue) /*?number*/ { - this._cleanHeaps(); - if (this._smallValues.empty() || this._largeValues.empty()) { - // Threre are currently no values stored. We will have to create new - // position for this value. - return null; - } - - var minValue = this._smallValues.peek().value; - var maxValue = this._largeValues.peek().value; - if (minValue >= lowValue && maxValue <= highValue) { - // All values currently stored are necessary, we can't reuse any of them. - return null; - } - - var valueToReplace; - if (lowValue - minValue > maxValue - highValue) { - // minValue is further from provided range. We will reuse it's position. - valueToReplace = minValue; - this._smallValues.pop(); - } else { - valueToReplace = maxValue; - this._largeValues.pop(); - } - var position = this._valueToPositionMap[valueToReplace]; - delete this._valueToPositionMap[valueToReplace]; - this._valueToPositionMap[newValue] = position; - this._pushToHeaps(position, newValue); - - return position; - }, - - _pushToHeaps: function (/*number*/ position, /*number*/ value) { - var element = { - position: position, - value:value - }; - // We can reuse the same object in both heaps, because we don't mutate them - this._smallValues.push(element); - this._largeValues.push(element); - }, - - _cleanHeaps: function () { - // We not usually only remove object from one heap while moving value. - // Here we make sure that there is no stale data on top of heaps. - this._cleanHeap(this._smallValues); - this._cleanHeap(this._largeValues); - var minHeapSize = - Math.min(this._smallValues.size(), this._largeValues.size()); - var maxHeapSize = - Math.max(this._smallValues.size(), this._largeValues.size()); - if (maxHeapSize > 10 * minHeapSize) { - // There are many old values in one of heaps. We nned to get rid of them - // to not use too avoid memory leaks - this._recreateHeaps(); - } - }, - - _recreateHeaps: function () { - var sourceHeap = this._smallValues.size() < this._largeValues.size() ? - this._smallValues : - this._largeValues; - var newSmallValues = new Heap( - [], // Initial data in the heap - this._smallerComparator - ); - var newLargeValues = new Heap( - [], // Initial datat in the heap - this._greaterComparator - ); - while (!sourceHeap.empty()) { - var element = sourceHeap.pop(); - // Push all stil valid elements to new heaps - if (this._valueToPositionMap[element.value] !== undefined) { - newSmallValues.push(element); - newLargeValues.push(element); - } - } - this._smallValues = newSmallValues; - this._largeValues = newLargeValues; - }, - - _cleanHeap: function (/*object*/ heap) { - while (!heap.empty() && - this._valueToPositionMap[heap.peek().value] === undefined) { - heap.pop(); - } - }, - - _smallerComparator: function (/*object*/ lhs, /*object*/ rhs) /*boolean*/ { - return lhs.value < rhs.value; - }, - - _greaterComparator: function (/*object*/ lhs, /*object*/ rhs) /*boolean*/ { - return lhs.value > rhs.value; - } -}; -; -!(function () { - BI.LinkHashMap = function () { - this.array = []; - this.map = {}; - }; - BI.LinkHashMap.prototype = { - constructor: BI.LinkHashMap, - has: function (key) { - if (key in this.map) { - return true; - } - return false; - }, - - add: function (key, value) { - if (typeof key == 'undefined') { - return; - } - if (key in this.map) { - this.map[key] = value; - } else { - this.array.push(key); - this.map[key] = value; - } - }, - - remove: function (key) { - if (key in this.map) { - delete this.map[key]; - for (var i = 0; i < this.array.length; i++) { - if (this.array[i] == key) { - this.array.splice(i, 1); - break; - } - } - } - }, - - size: function () { - return this.array.length; - }, - - each: function (fn, scope) { - var scope = scope || window; - var fn = fn || null; - if (fn == null || typeof (fn) != "function") { - return; - } - for (var i = 0; i < this.array.length; i++) { - var key = this.array[i]; - var value = this.map[key]; - var re = fn.call(scope, key, value, i, this.array, this.map); - if (re == false) { - break; - } - } - }, - - get: function (key) { - return this.map[key]; - }, - - toArray: function () { - var array = []; - this.each(function (key, value) { - array.push(value); - }) - return array; - } - } -})();window.BI = window.BI || {}; - -$.extend(BI, { - $defaultImport: function (options) { - var config = $.extend({ - op: 'resource', - path: null, - type: null, - must: false - }, options); - config.url = BI.servletURL + '?op=' + config.op + '&resource=' + config.path; - this.$import(config.url, config.type,config.must); - }, - $import: function () { - var _LOADED = {}; // alex:保存加载过的 - function loadReady(src, must) { - var $scripts = $("head script"); - $.each($scripts, function (i, item) { - if (item.src.indexOf(src) != -1) { - _LOADED[src] = true; - } - }); - var $links = $("head link"); - $.each($links, function (i, item) { - if (item.href.indexOf(src) != -1 && must) { - _LOADED[src] = false; - $(item).remove(); - } - }); - } - - // must=true 强行加载 - return function (src, ext, must) { - loadReady(src, must); - // alex:如果已经加载过了的,直接return - if (_LOADED[src] === true) { - return; - } - if (ext === 'css') { - var link = document.createElement('link'); - link.rel = 'stylesheet'; - link.type = 'text/css'; - link.href = src; - var head = document.getElementsByTagName('head')[0]; - head.appendChild(link); - _LOADED[src] = true; - } else { - // alex:这里用同步调用的方式,必须等待ajax完成 - $.ajax({ - url: src, - dataType: "script", // alex:指定dataType为script,jquery会帮忙做globalEval的事情 - async: false, - cache: true, - complete: function (res, status) { - /* - * alex:发现jquery会很智能地判断一下返回的数据类型是不是script,然后做一个globalEval - * 所以当status为success时就不需要再把其中的内容加到script里面去了 - */ - if (status == 'success') { - _LOADED[src] = true; - } - } - }) - } - } - }() -});; -!(function () { - BI.LRU = function (limit) { - this.size = 0; - this.limit = limit; - this.head = this.tail = undefined; - this._keymap = {}; - }; - - var p = BI.LRU.prototype; - - p.put = function (key, value) { - var removed; - if (this.size === this.limit) { - removed = this.shift(); - } - - var entry = this.get(key, true); - if (!entry) { - entry = { - key: key - }; - this._keymap[key] = entry; - if (this.tail) { - this.tail.newer = entry; - entry.older = this.tail - } else { - this.head = entry - } - this.tail = entry; - this.size++; - } - entry.value = value; - - return removed; - }; - - p.shift = function () { - var entry = this.head; - if (entry) { - this.head = this.head.newer; - this.head.older = undefined; - entry.newer = entry.older = undefined; - this._keymap[entry.key] = undefined; - this.size--; - } - return entry; - }; - - - p.get = function (key, returnEntry) { - var entry = this._keymap[key]; - if (entry === undefined) return; - if (entry === this.tail) { - return returnEntry - ? entry - : entry.value - } - // HEAD--------------TAIL - // <.older .newer> - // <--- add direction -- - // A B C <D> E - if (entry.newer) { - if (entry === this.head) { - this.head = entry.newer - } - entry.newer.older = entry.older; // C <-- E. - } - if (entry.older) { - entry.older.newer = entry.newer; // C. --> E - } - entry.newer = undefined; // D --x - entry.older = this.tail; // D. --> E - if (this.tail) { - this.tail.newer = entry; // E. <-- D - } - this.tail = entry; - return returnEntry - ? entry - : entry.value - }; -})();; -!(function () { - var MD5 = function (hexcase) { - this.hexcase = !hexcase ? 0 : 1; - /* hex output format. 0 - lowercase; 1 - uppercase */ - this.b64pad = ""; - /* base-64 pad character. "=" for strict RFC compliance */ - this.chrsz = 8; - /* bits per input character. 8 - ASCII; 16 - Unicode */ - }; - - /* - * These are the functions you'll usually want to call - * They take string arguments and return either hex or base-64 encoded strings - */ - MD5.prototype.hex_md5 = function (s) { - return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz)); - }; - - MD5.prototype.hex_md5_salt = function (s) { - var md5ed = this.hex_md5(s); - - var items1 = []; - var items2 = []; - for (var i = 0; i < md5ed.length; i++) { - if (i % 2 === 0) { - items1.push(md5ed.charAt(i)); - } else { - items2.push(md5ed.charAt(i)); - } - } - var result = ":" + items1.join("") + items2.join(""); - return result; - }; - - MD5.prototype.b64_md5 = function (s) { - return this.binl2b64(this.core_md5(this.str2binl(s), s.length * this.chrsz)); - }; - - MD5.prototype.hex_hmac_md5 = function (key, data) { - return this.binl2hex(this.core_hmac_md5(key, data)); - }; - - MD5.prototype.b64_hmac_md5 = function (key, data) { - return this.binl2b64(this.core_hmac_md5(key, data)); - }; - - /* Backwards compatibility - same as hex_md5() */ - MD5.prototype.calcMD5 = function (s) { - return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz)); - }; - - MD5.prototype.core_md5 = function (x, len) { - /* append padding */ - x[len >> 5] |= 0x80 << ((len) % 32); - x[(((len + 64) >>> 9) << 4) + 14] = len; - - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; - - for (var i = 0; i < x.length; i += 16) { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; - - a = this.md5_ff(a, b, c, d, x[i + 0], 7, -680876936); - d = this.md5_ff(d, a, b, c, x[i + 1], 12, -389564586); - c = this.md5_ff(c, d, a, b, x[i + 2], 17, 606105819); - b = this.md5_ff(b, c, d, a, x[i + 3], 22, -1044525330); - a = this.md5_ff(a, b, c, d, x[i + 4], 7, -176418897); - d = this.md5_ff(d, a, b, c, x[i + 5], 12, 1200080426); - c = this.md5_ff(c, d, a, b, x[i + 6], 17, -1473231341); - b = this.md5_ff(b, c, d, a, x[i + 7], 22, -45705983); - a = this.md5_ff(a, b, c, d, x[i + 8], 7, 1770035416); - d = this.md5_ff(d, a, b, c, x[i + 9], 12, -1958414417); - c = this.md5_ff(c, d, a, b, x[i + 10], 17, -42063); - b = this.md5_ff(b, c, d, a, x[i + 11], 22, -1990404162); - a = this.md5_ff(a, b, c, d, x[i + 12], 7, 1804603682); - d = this.md5_ff(d, a, b, c, x[i + 13], 12, -40341101); - c = this.md5_ff(c, d, a, b, x[i + 14], 17, -1502002290); - b = this.md5_ff(b, c, d, a, x[i + 15], 22, 1236535329); - - a = this.md5_gg(a, b, c, d, x[i + 1], 5, -165796510); - d = this.md5_gg(d, a, b, c, x[i + 6], 9, -1069501632); - c = this.md5_gg(c, d, a, b, x[i + 11], 14, 643717713); - b = this.md5_gg(b, c, d, a, x[i + 0], 20, -373897302); - a = this.md5_gg(a, b, c, d, x[i + 5], 5, -701558691); - d = this.md5_gg(d, a, b, c, x[i + 10], 9, 38016083); - c = this.md5_gg(c, d, a, b, x[i + 15], 14, -660478335); - b = this.md5_gg(b, c, d, a, x[i + 4], 20, -405537848); - a = this.md5_gg(a, b, c, d, x[i + 9], 5, 568446438); - d = this.md5_gg(d, a, b, c, x[i + 14], 9, -1019803690); - c = this.md5_gg(c, d, a, b, x[i + 3], 14, -187363961); - b = this.md5_gg(b, c, d, a, x[i + 8], 20, 1163531501); - a = this.md5_gg(a, b, c, d, x[i + 13], 5, -1444681467); - d = this.md5_gg(d, a, b, c, x[i + 2], 9, -51403784); - c = this.md5_gg(c, d, a, b, x[i + 7], 14, 1735328473); - b = this.md5_gg(b, c, d, a, x[i + 12], 20, -1926607734); - - a = this.md5_hh(a, b, c, d, x[i + 5], 4, -378558); - d = this.md5_hh(d, a, b, c, x[i + 8], 11, -2022574463); - c = this.md5_hh(c, d, a, b, x[i + 11], 16, 1839030562); - b = this.md5_hh(b, c, d, a, x[i + 14], 23, -35309556); - a = this.md5_hh(a, b, c, d, x[i + 1], 4, -1530992060); - d = this.md5_hh(d, a, b, c, x[i + 4], 11, 1272893353); - c = this.md5_hh(c, d, a, b, x[i + 7], 16, -155497632); - b = this.md5_hh(b, c, d, a, x[i + 10], 23, -1094730640); - a = this.md5_hh(a, b, c, d, x[i + 13], 4, 681279174); - d = this.md5_hh(d, a, b, c, x[i + 0], 11, -358537222); - c = this.md5_hh(c, d, a, b, x[i + 3], 16, -722521979); - b = this.md5_hh(b, c, d, a, x[i + 6], 23, 76029189); - a = this.md5_hh(a, b, c, d, x[i + 9], 4, -640364487); - d = this.md5_hh(d, a, b, c, x[i + 12], 11, -421815835); - c = this.md5_hh(c, d, a, b, x[i + 15], 16, 530742520); - b = this.md5_hh(b, c, d, a, x[i + 2], 23, -995338651); - - a = this.md5_ii(a, b, c, d, x[i + 0], 6, -198630844); - d = this.md5_ii(d, a, b, c, x[i + 7], 10, 1126891415); - c = this.md5_ii(c, d, a, b, x[i + 14], 15, -1416354905); - b = this.md5_ii(b, c, d, a, x[i + 5], 21, -57434055); - a = this.md5_ii(a, b, c, d, x[i + 12], 6, 1700485571); - d = this.md5_ii(d, a, b, c, x[i + 3], 10, -1894986606); - c = this.md5_ii(c, d, a, b, x[i + 10], 15, -1051523); - b = this.md5_ii(b, c, d, a, x[i + 1], 21, -2054922799); - a = this.md5_ii(a, b, c, d, x[i + 8], 6, 1873313359); - d = this.md5_ii(d, a, b, c, x[i + 15], 10, -30611744); - c = this.md5_ii(c, d, a, b, x[i + 6], 15, -1560198380); - b = this.md5_ii(b, c, d, a, x[i + 13], 21, 1309151649); - a = this.md5_ii(a, b, c, d, x[i + 4], 6, -145523070); - d = this.md5_ii(d, a, b, c, x[i + 11], 10, -1120210379); - c = this.md5_ii(c, d, a, b, x[i + 2], 15, 718787259); - b = this.md5_ii(b, c, d, a, x[i + 9], 21, -343485551); - - a = this.safe_add(a, olda); - b = this.safe_add(b, oldb); - c = this.safe_add(c, oldc); - d = this.safe_add(d, oldd); - } - return Array(a, b, c, d); - - }; - - /* - * These functions implement the four basic operations the algorithm uses. - */ - MD5.prototype.md5_cmn = function (q, a, b, x, s, t) { - return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s), b); - }; - MD5.prototype.md5_ff = function (a, b, c, d, x, s, t) { - return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); - }; - MD5.prototype.md5_gg = function (a, b, c, d, x, s, t) { - return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); - }; - MD5.prototype.md5_hh = function (a, b, c, d, x, s, t) { - return this.md5_cmn(b ^ c ^ d, a, b, x, s, t); - }; - MD5.prototype.md5_ii = function (a, b, c, d, x, s, t) { - return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t); - }; - - /* - * Calculate the HMAC-MD5, of a key and some data - */ - MD5.prototype.core_hmac_md5 = function (key, data) { - var bkey = this.str2binl(key); - if (bkey.length > 16) - bkey = this.core_md5(bkey, key.length * this.chrsz); - - var ipad = Array(16), opad = Array(16); - for (var i = 0; i < 16; i++) { - ipad[i] = bkey[i] ^ 0x36363636; - opad[i] = bkey[i] ^ 0x5C5C5C5C; - } - - var hash = this.core_md5(ipad.concat(this.str2binl(data)), 512 + data.length * this.chrsz); - return this.core_md5(opad.concat(hash), 512 + 128); - }; - - /* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ - MD5.prototype.safe_add = function (x, y) { - var lsw = (x & 0xFFFF) + (y & 0xFFFF); - var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return (msw << 16) | (lsw & 0xFFFF); - }; - - /* - * Bitwise rotate a 32-bit number to the left. - */ - MD5.prototype.bit_rol = function (num, cnt) { - return (num << cnt) | (num >>> (32 - cnt)); - }; - - /* - * Convert a string to an array of little-endian words - * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. - */ - MD5.prototype.str2binl = function (str) { - var bin = Array(); - var mask = (1 << this.chrsz) - 1; - for (var i = 0; i < str.length * this.chrsz; i += this.chrsz) - bin[i >> 5] |= (str.charCodeAt(i / this.chrsz) & mask) << (i % 32); - return bin; - }; - - /* - * Convert an array of little-endian words to a hex string. - */ - MD5.prototype.binl2hex = function (binarray) { - var hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; - var str = ""; - for (var i = 0; i < binarray.length * 4; i++) { - str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) - + hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF); - } - return str; - }; - - /* - * Convert an array of little-endian words to a base-64 string - */ - MD5.prototype.binl2b64 = function (binarray) { - var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var str = ""; - for (var i = 0; i < binarray.length * 4; i += 3) { - var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16) - | (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8) - | ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF); - for (var j = 0; j < 4; j++) { - if (i * 8 + j * 6 > binarray.length * 32) - str += this.b64pad; - else - str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F); - } - } - return str; - }; - BI.MD5 = new MD5(); -})();//线段树 -;(function () { - var parent = function (node) { - return Math.floor(node / 2); - }; - - var Int32Array = window.Int32Array || function (size) { - var xs = []; - for (var i = size - 1; i >= 0; --i) { - xs[i] = 0; - } - return xs; - }; - - var ceilLog2 = function (x) { - var y = 1; - while (y < x) { - y *= 2; - } - return y; - }; - - BI.PrefixIntervalTree = function (xs) { - this._size = xs.length; - this._half = ceilLog2(this._size); - this._heap = new Int32Array(2 * this._half); - - var i; - for (i = 0; i < this._size; ++i) { - this._heap[this._half + i] = xs[i]; - } - - for (i = this._half - 1; i > 0; --i) { - this._heap[i] = this._heap[2 * i] + this._heap[2 * i + 1]; - } - }; - - BI.PrefixIntervalTree.prototype = { - constructor: BI.PrefixIntervalTree, - set: function (index, value) { - var node = this._half + index; - this._heap[node] = value; - - node = parent(node); - for (; node !== 0; node = parent(node)) { - this._heap[node] = - this._heap[2 * node] + this._heap[2 * node + 1]; - } - }, - - get: function (index) { - var node = this._half + index; - return this._heap[node]; - }, - - getSize: function () { - return this._size; - }, - - /** - * get(0) + get(1) + ... + get(end - 1). - */ - sumUntil: function (end) { - if (end === 0) { - return 0; - } - - var node = this._half + end - 1; - var sum = this._heap[node]; - for (; node !== 1; node = parent(node)) { - if (node % 2 === 1) { - sum += this._heap[node - 1]; - } - } - - return sum; - }, - - /** - * get(0) + get(1) + ... + get(inclusiveEnd). - */ - sumTo: function (inclusiveEnd) { - return this.sumUntil(inclusiveEnd + 1); - }, - - /** - * sum get(begin) + get(begin + 1) + ... + get(end - 1). - */ - sum: function (begin, end) { - return this.sumUntil(end) - this.sumUntil(begin); - }, - - /** - * Returns the smallest i such that 0 <= i <= size and sumUntil(i) <= t, or - * -1 if no such i exists. - */ - greatestLowerBound: function (t) { - if (t < 0) { - return -1; - } - - var node = 1; - if (this._heap[node] <= t) { - return this._size; - } - - while (node < this._half) { - var leftSum = this._heap[2 * node]; - if (t < leftSum) { - node = 2 * node; - } else { - node = 2 * node + 1; - t -= leftSum; - } - } - - return node - this._half; - }, - - /** - * Returns the smallest i such that 0 <= i <= size and sumUntil(i) < t, or - * -1 if no such i exists. - */ - greatestStrictLowerBound: function (t) { - if (t <= 0) { - return -1; - } - - var node = 1; - if (this._heap[node] < t) { - return this._size; - } - - while (node < this._half) { - var leftSum = this._heap[2 * node]; - if (t <= leftSum) { - node = 2 * node; - } else { - node = 2 * node + 1; - t -= leftSum; - } - } - - return node - this._half; - }, - - /** - * Returns the smallest i such that 0 <= i <= size and t <= sumUntil(i), or - * size + 1 if no such i exists. - */ - leastUpperBound: function (t) { - return this.greatestStrictLowerBound(t) + 1; - }, - - /** - * Returns the smallest i such that 0 <= i <= size and t < sumUntil(i), or - * size + 1 if no such i exists. - */ - leastStrictUpperBound: function (t) { - return this.greatestLowerBound(t) + 1; - } - }; - - BI.PrefixIntervalTree.uniform = function (size, initialValue) { - var xs = []; - for (var i = size - 1; i >= 0; --i) { - xs[i] = initialValue; - } - - return new BI.PrefixIntervalTree(xs); - }; - - BI.PrefixIntervalTree.empty = function (size) { - return BI.PrefixIntervalTree.uniform(size, 0); - }; - -})(); -; -!(function () { - BI.Queue = function (capacity) { - this.capacity = capacity; - this.array = []; - }; - BI.Queue.prototype = { - constructor: BI.Queue, - - contains: function (v) { - return this.array.contains(v); - }, - - indexOf: function (v) { - return this.array.contains(v); - }, - - getElementByIndex: function(index) { - return this.array[index]; - }, - - push: function (v) { - this.array.push(v); - if (this.capacity && this.array.length > this.capacity) { - this.array.shift(); - } - }, - - pop: function () { - this.array.pop(); - }, - - shift: function () { - this.array.shift(); - }, - - unshift: function (v) { - this.array.unshift(v); - if (this.capacity && this.array.length > this.capacity) { - this.array.pop(); - } - }, - - remove: function (v) { - this.array.remove(v); - }, - - splice: function() { - this.array.splice.apply(this.array, arguments); - }, - - slice: function() { - this.array.slice.apply(this.array, arguments); - }, - - size: function () { - return this.array.length; - }, - - each: function (fn, scope) { - var scope = scope || window; - var fn = fn || null; - if (fn == null || typeof (fn) != "function") { - return; - } - for (var i = 0; i < this.array.length; i++) { - var re = fn.call(scope, i, this.array[i], this.array); - if (re == false) { - break; - } - } - }, - - toArray: function () { - return this.array; - }, - - fromArray: function (array) { - var self = this; - BI.each(array, function (i, v) { - self.push(v); - }) - }, - - clear: function () { - this.array.clear(); - } - } -})();!(function () { - var Section = function (height, width, x, y) { - this.height = height; - this.width = width; - this.x = x; - this.y = y; - - this._indexMap = {}; - this._indices = []; - }; - - Section.prototype = { - constructor: Section, - addCellIndex: function (index) { - if (!this._indexMap[index]) { - this._indexMap[index] = true; - this._indices.push(index); - } - }, - - getCellIndices: function () { - return this._indices - } - }; - - var SECTION_SIZE = 100; - BI.SectionManager = function (sectionSize) { - this._sectionSize = sectionSize || SECTION_SIZE; - this._cellMetadata = []; - this._sections = {}; - }; - - BI.SectionManager.prototype = { - constructor: BI.SectionManager, - getCellIndices: function (height, width, x, y) { - var indices = {}; - - BI.each(this.getSections(height, width, x, y), function (i, section) { - BI.each(section.getCellIndices(), function (j, index) { - indices[index] = index - }) - }); - - return BI.map(BI.keys(indices), function (i, index) { - return indices[index] - }); - }, - - getCellMetadata: function (index) { - return this._cellMetadata[index]; - }, - - getSections: function (height, width, x, y) { - var sectionXStart = Math.floor(x / this._sectionSize); - var sectionXStop = Math.floor((x + width - 1) / this._sectionSize); - var sectionYStart = Math.floor(y / this._sectionSize); - var sectionYStop = Math.floor((y + height - 1) / this._sectionSize); - - var sections = []; - - for (var sectionX = sectionXStart; sectionX <= sectionXStop; sectionX++) { - for (var sectionY = sectionYStart; sectionY <= sectionYStop; sectionY++) { - var key = sectionX + "." + sectionY; - - if (!this._sections[key]) { - this._sections[key] = new Section(this._sectionSize, this._sectionSize, sectionX * this._sectionSize, sectionY * this._sectionSize) - } - - sections.push(this._sections[key]) - } - } - - return sections - }, - - getTotalSectionCount: function () { - return BI.size(this._sections); - }, - - registerCell: function (cellMetadatum, index) { - this._cellMetadata[index] = cellMetadatum; - - BI.each(this.getSections(cellMetadatum.height, cellMetadatum.width, cellMetadatum.x, cellMetadatum.y), function (i, section) { - section.addCellIndex(index); - }); - } - } -})();if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { - -} else { - Set = function () { - this.set = {} - }; - Set.prototype.has = function (key) { - return this.set[key] !== undefined; - }; - Set.prototype.add = function (key) { - this.set[key] = 1 - }; - Set.prototype.clear = function () { - this.set = {} - }; -}; -(function () { - var clamp = function (value, min, max) { - if (value < min) { - return min; - } - if (value > max) { - return max; - } - return value; - }; - var MIN_BUFFER_ROWS = 6; - var MAX_BUFFER_ROWS = 10; - - BI.TableRowBuffer = function (rowsCount, - defaultRowHeight, - viewportHeight, - rowHeightGetter) { - this._bufferSet = new BI.IntegerBufferSet(); - this._defaultRowHeight = defaultRowHeight; - this._viewportRowsBegin = 0; - this._viewportRowsEnd = 0; - this._maxVisibleRowCount = Math.ceil(viewportHeight / defaultRowHeight) + 1; - // this._bufferRowsCount = Math.floor(this._maxVisibleRowCount / 2); - this._bufferRowsCount = clamp( - Math.floor(this._maxVisibleRowCount / 2), - MIN_BUFFER_ROWS, - MAX_BUFFER_ROWS - ); - this._rowsCount = rowsCount; - this._rowHeightGetter = rowHeightGetter; - this._rows = []; - this._viewportHeight = viewportHeight; - - }; - BI.TableRowBuffer.prototype = { - constructor: BI.TableRowBuffer, - - getRowsWithUpdatedBuffer: function () { - var remainingBufferRows = 2 * this._bufferRowsCount; - var bufferRowIndex = - Math.max(this._viewportRowsBegin - this._bufferRowsCount, 0); - while (bufferRowIndex < this._viewportRowsBegin) { - this._addRowToBuffer( - bufferRowIndex, - this._viewportRowsBegin, - this._viewportRowsEnd - 1 - ); - bufferRowIndex++; - remainingBufferRows--; - } - bufferRowIndex = this._viewportRowsEnd; - while (bufferRowIndex < this._rowsCount && remainingBufferRows > 0) { - this._addRowToBuffer( - bufferRowIndex, - this._viewportRowsBegin, - this._viewportRowsEnd - 1 - ); - bufferRowIndex++; - remainingBufferRows--; - } - return this._rows; - }, - - getRows: function (firstRowIndex, - firstRowOffset) { - var top = firstRowOffset; - var totalHeight = top; - var rowIndex = firstRowIndex; - var endIndex = - Math.min(firstRowIndex + this._maxVisibleRowCount, this._rowsCount); - - this._viewportRowsBegin = firstRowIndex; - while (rowIndex < endIndex || - (totalHeight < this._viewportHeight && rowIndex < this._rowsCount)) { - this._addRowToBuffer( - rowIndex, - firstRowIndex, - endIndex - 1 - ); - totalHeight += this._rowHeightGetter(rowIndex); - ++rowIndex; - // Store index after the last viewport row as end, to be able to - // distinguish when there are no rows rendered in viewport - this._viewportRowsEnd = rowIndex; - } - - return this._rows; - }, - - _addRowToBuffer: function (rowIndex, - firstViewportRowIndex, - lastViewportRowIndex) { - var rowPosition = this._bufferSet.getValuePosition(rowIndex); - var viewportRowsCount = lastViewportRowIndex - firstViewportRowIndex + 1; - var allowedRowsCount = viewportRowsCount + this._bufferRowsCount * 2; - if (rowPosition === null && - this._bufferSet.getSize() >= allowedRowsCount) { - rowPosition = - this._bufferSet.replaceFurthestValuePosition( - firstViewportRowIndex, - lastViewportRowIndex, - rowIndex - ); - } - if (rowPosition === null) { - // We can't reuse any of existing positions for this row. We have to - // create new position - rowPosition = this._bufferSet.getNewPositionForValue(rowIndex); - this._rows[rowPosition] = rowIndex; - } else { - // This row already is in the table with rowPosition position or it - // can replace row that is in that position - this._rows[rowPosition] = rowIndex; - } - } - } - -})(); -; -(function () { - BI.Tree = function () { - this.root = new BI.Node(BI.UUID()); - }; - - BI.Tree.prototype = { - constructor: BI.Tree, - addNode: function (node, newNode, index) { - if (BI.isNull(newNode)) { - this.root.addChild(node, index); - } else if (BI.isNull(node)) { - this.root.addChild(newNode, index); - } else { - node.addChild(newNode, index); - } - }, - - isRoot: function (node) { - return node === this.root; - }, - - getRoot: function () { - return this.root; - }, - - clear: function () { - this.root.clear(); - }, - - initTree: function (nodes) { - var self = this; - this.clear(); - var queue = []; - BI.each(nodes, function (i, node) { - var n = new BI.Node(node); - n.set("data", node); - self.addNode(n); - queue.push(n); - }); - while (!BI.isEmpty(queue)) { - var parent = queue.shift(); - var node = parent.get("data"); - BI.each(node.children, function (i, child) { - var n = new BI.Node(child); - n.set("data", child); - queue.push(n); - self.addNode(parent, n); - }) - } - }, - - _toJSON: function (node) { - var self = this; - var children = []; - BI.each(node.getChildren(), function (i, child) { - children.push(self._toJSON(child)); - }); - return BI.extend({ - id: node.id - }, BI.deepClone(node.get("data")), (children.length > 0 ? { - children: children - } : {})); - }, - - toJSON: function (node) { - var self = this, result = []; - BI.each((node || this.root).getChildren(), function (i, child) { - result.push(self._toJSON(child)); - }); - return result; - }, - - _toJSONWithNode: function (node) { - var self = this; - var children = []; - BI.each(node.getChildren(), function (i, child) { - children.push(self._toJSONWithNode(child)); - }); - return BI.extend({ - id: node.id - }, BI.deepClone(node.get("data")), { - node: node - }, (children.length > 0 ? { - children: children - } : {})); - }, - - toJSONWithNode: function (node) { - var self = this, result = []; - BI.each((node || this.root).getChildren(), function (i, child) { - result.push(self._toJSONWithNode(child)); - }); - return result; - }, - - search: function (root, target, param) { - if (!(root instanceof BI.Node)) { - return arguments.callee.apply(this, [this.root, root, target]); - } - var self = this, next = null; - - if (BI.isNull(target)) { - return null; - } - if (BI.isEqual(root[param || "id"], target)) { - return root; - } - BI.any(root.getChildren(), function (i, child) { - next = self.search(child, target, param); - if (null !== next) { - return true; - } - }); - return next; - }, - - _traverse: function (node, callback) { - var queue = []; - queue.push(node); - while (!BI.isEmpty(queue)) { - var temp = queue.shift(); - var b = callback && callback(temp); - if (b === false) { - break; - } - if (b === true) { - continue; - } - if (temp != null) { - queue = queue.concat(temp.getChildren()); - } - } - }, - - traverse: function (callback) { - this._traverse(this.root, callback); - }, - - _recursion: function (node, route, callback) { - var self = this; - return BI.every(node.getChildren(), function (i, child) { - var next = BI.clone(route); - next.push(child.id); - var b = callback && callback(child, next); - if (b === false) { - return false; - } - if (b === true) { - return true; - } - return self._recursion(child, next, callback); - }); - }, - - recursion: function (callback) { - this._recursion(this.root, [], callback); - }, - - inOrderTraverse: function (callback) { - this._inOrderTraverse(this.root, callback); - }, - - //中序遍历(递归) - _inOrderTraverse: function (node, callback) { - if (node != null) { - this._inOrderTraverse(node.getLeft()); - callback && callback(node); - this._inOrderTraverse(node.getRight()); - } - }, - - //中序遍历(非递归) - nrInOrderTraverse: function (callback) { - - var stack = []; - var node = this.root; - while (node != null || !BI.isEmpty(stack)) { - while (node != null) { - stack.push(node); - node = node.getLeft(); - } - node = stack.pop(); - callback && callback(node); - node = node.getRight(); - } - }, - - preOrderTraverse: function (callback) { - this._preOrderTraverse(this.root, callback); - }, - - //先序遍历(递归) - _preOrderTraverse: function (node, callback) { - if (node != null) { - callback && callback(node); - this._preOrderTraverse(node.getLeft()); - this._preOrderTraverse(node.getRight()); - } - }, - - //先序遍历(非递归) - nrPreOrderTraverse: function (callback) { - - var stack = []; - var node = this.root; - - while (node != null || !BI.isEmpty(stack)) { - - while (node != null) { - callback && callback(node); - stack.push(node); - node = node.getLeft(); - } - node = stack.pop(); - node = node.getRight(); - } - }, - - postOrderTraverse: function (callback) { - this._postOrderTraverse(this.root, callback); - }, - - //后序遍历(递归) - _postOrderTraverse: function (node, callback) { - if (node != null) { - this._postOrderTraverse(node.getLeft()); - this._postOrderTraverse(node.getRight()); - callback && callback(node); - } - }, - - //后续遍历(非递归) - nrPostOrderTraverse: function (callback) { - - var stack = []; - var node = this.root; - var preNode = null;//表示最近一次访问的节点 - - while (node != null || !BI.isEmpty(stack)) { - - while (node != null) { - stack.push(node); - node = node.getLeft(); - } - - node = BI.last(stack); - - if (node.getRight() == null || node.getRight() == preNode) { - callback && callback(node); - node = stack.pop(); - preNode = node; - node = null; - } else { - node = node.getRight(); - } - } - } - }; - - BI.Node = function (id) { - if (BI.isObject(id)) { - BI.extend(this, id); - } else { - this.id = id; - } - this.clear.apply(this, arguments); - }; - - BI.Node.prototype = { - constructor: BI.Node, - - set: function (key, value) { - if (BI.isObject(key)) { - BI.extend(this, key); - return; - } - this[key] = value; - }, - - get: function (key) { - return this[key]; - }, - - isLeaf: function () { - return BI.isEmpty(this.children); - }, - - getChildren: function () { - return this.children; - }, - - getChildrenLength: function () { - return this.children.length; - }, - - getFirstChild: function () { - return BI.first(this.children); - }, - - getLastChild: function () { - return BI.last(this.children); - }, - - setLeft: function (left) { - this.left = left; - }, - - getLeft: function () { - return this.left; - }, - - setRight: function (right) { - this.right = right; - }, - - getRight: function () { - return this.right; - }, - - setParent: function (parent) { - this.parent = parent; - }, - - getParent: function () { - return this.parent; - }, - - getChild: function (index) { - return this.children[index]; - }, - - getChildIndex: function (id) { - return BI.findIndex(this.children, function (i, ch) { - return ch.get("id") === id; - }); - }, - - removeChild: function (id) { - this.removeChildByIndex(this.getChildIndex(id)); - }, - - removeChildByIndex: function (index) { - var before = this.getChild(index - 1); - var behind = this.getChild(index + 1); - if (before != null) { - before.setRight(behind || null); - } - if (behind != null) { - behind.setLeft(before || null); - } - this.children.splice(index, 1); - }, - - removeAllChilds: function () { - this.children = []; - }, - - addChild: function (child, index) { - var cur = null; - if (BI.isUndefined(index)) { - cur = this.children.length - 1; - } else { - cur = index - 1; - } - child.setParent(this); - if (cur >= 0) { - this.getChild(cur).setRight(child); - child.setLeft(this.getChild(cur)); - } - if (BI.isUndefined(index)) { - this.children.push(child); - } else { - this.children.splice(index, 0, child); - } - }, - - equals: function (obj) { - return this === obj || this.id === obj.id; - }, - - clear: function () { - this.parent = null; - this.left = null; - this.right = null; - this.children = []; - } - }; - - BI.extend(BI.Tree, { - transformToArrayFormat: function (nodes, pId) { - if (!nodes) return []; - var r = []; - if (BI.isArray(nodes)) { - for (var i = 0, l = nodes.length; i < l; i++) { - var node = BI.clone(nodes[i]); - node.pId = node.pId == null ? pId : node.pId; - delete node.children; - r.push(node); - if (nodes[i]["children"]) { - r = r.concat(BI.Tree.transformToArrayFormat(nodes[i]["children"], node.id)); - } - } - } else { - var newNodes = BI.clone(nodes); - newNodes.pId = newNodes.pId == null ? pId : newNodes.pId; - delete newNodes.children; - r.push(newNodes); - if (nodes["children"]) { - r = r.concat(BI.Tree.transformToArrayFormat(nodes["children"], newNodes.id)); - } - } - return r; - }, - - arrayFormat: function (nodes, pId) { - if (!nodes) { - return []; - } - var r = []; - if (BI.isArray(nodes)) { - for (var i = 0, l = nodes.length; i < l; i++) { - var node = nodes[i]; - node.pId = node.pId == null ? pId : node.pId; - r.push(node); - if (nodes[i]["children"]) { - r = r.concat(BI.Tree.arrayFormat(nodes[i]["children"], node.id)); - } - } - } else { - var newNodes = nodes; - newNodes.pId = newNodes.pId == null ? pId : newNodes.pId; - r.push(newNodes); - if (nodes["children"]) { - r = r.concat(BI.Tree.arrayFormat(nodes["children"], newNodes.id)); - } - } - return r; - }, - - transformToTreeFormat: function (sNodes) { - var i, l; - if (!sNodes) { - return []; - } - - if (BI.isArray(sNodes)) { - var r = []; - var tmpMap = []; - for (i = 0, l = sNodes.length; i < l; i++) { - if (BI.isNull(sNodes[i].id)) { - return sNodes; - } - tmpMap[sNodes[i].id] = BI.clone(sNodes[i]); - } - for (i = 0, l = sNodes.length; i < l; i++) { - if (tmpMap[sNodes[i].pId] && sNodes[i].id !== sNodes[i].pId) { - if (!tmpMap[sNodes[i].pId].children) { - tmpMap[sNodes[i].pId].children = []; - } - tmpMap[sNodes[i].pId].children.push(tmpMap[sNodes[i].id]); - } else { - r.push(tmpMap[sNodes[i].id]); - } - delete tmpMap[sNodes[i].id].pId; - } - return r; - } else { - return [sNodes]; - } - }, - - treeFormat: function (sNodes) { - var i, l; - if (!sNodes) { - return []; - } - - if (BI.isArray(sNodes)) { - var r = []; - var tmpMap = []; - for (i = 0, l = sNodes.length; i < l; i++) { - if (BI.isNull(sNodes[i].id)) { - return sNodes; - } - tmpMap[sNodes[i].id] = sNodes[i]; - } - for (i = 0, l = sNodes.length; i < l; i++) { - if (tmpMap[sNodes[i].pId] && sNodes[i].id !== sNodes[i].pId) { - if (!tmpMap[sNodes[i].pId].children) { - tmpMap[sNodes[i].pId].children = []; - } - tmpMap[sNodes[i].pId].children.push(tmpMap[sNodes[i].id]); - } else { - r.push(tmpMap[sNodes[i].id]); - } - } - return r; - } else { - return [sNodes]; - } - }, - - traversal: function (array, callback) { - if (BI.isNull(array)) { - return; - } - var self = this; - BI.any(array, function (i, item) { - if (callback(i, item) === false) { - return true; - } - self.traversal(item.children, callback); - }) - } - }) -})();//向量操作 -BI.Vector = function (x, y) { - this.x = x; - this.y = y; -}; -BI.Vector.prototype = { - constructor: BI.Vector, - cross: function (v) { - return (this.x * v.y - this.y * v.x); - }, - length: function (v) { - return (Math.sqrt(this.x * v.x + this.y * v.y)); - } -}; -BI.Region = function (x, y, w, h) { - this.x = x; - this.y = y; - this.w = w; - this.h = h; -}; -BI.Region.prototype = { - constructor: BI.Region, - //判断两个区域是否相交,若相交,则要么顶点互相包含,要么矩形边界(或对角线)相交 - isIntersects: function (obj) { - if (this.isPointInside(obj.x, obj.y) || - this.isPointInside(obj.x + obj.w, obj.y) || - this.isPointInside(obj.x, obj.y + obj.h) || - this.isPointInside(obj.x + obj.w, obj.y + obj.h)) { - return true; - } else if (obj.isPointInside(this.x, this.y) || - obj.isPointInside(this.x + this.w, this.y) || - obj.isPointInside(this.x, this.y + this.h) || - obj.isPointInside(this.x + this.w, this.y + this.h)) { - return true; - } else if (obj.x != null && obj.y != null)//判断矩形对角线相交 |v1 X v2||v1 X v3| < 0 - { - var vector1 = new BI.Vector(this.w, this.h);//矩形对角线向量 - var vector2 = new BI.Vector(obj.x - this.x, obj.y - this.y); - var vector3 = new BI.Vector(vector2.x + obj.w, vector2.y + obj.h); - if ((vector1.cross(vector2) * vector1.cross(vector3)) < 0) { - return true; - } - } - return false; - }, - //判断一个点是否在这个区域内部 - isPointInside: function (x, y) { - if (this.x == null || this.y == null) { - return false; - } - if (x >= this.x && x <= this.x + this.w && y >= this.y && y <= this.y + this.h) { - return true; - } - return false; - }, - //返回区域的重心,因为是矩形所以返回中点 - getPosition: function () { - var pos = []; - pos.push(this.x + this.w / 2); - pos.push(this.y + this.h / 2); - return pos; - } -};; -!(function (BI) { - - if (BI.isIE()) { - XMLSerializer = null; - DOMParser = null; - } - - - var XML = { - Document: { - NodeType: { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 - } - } - }; - - XML.ResultType = { - single: 'single', - array: 'array' - }; - - XML.fromString = function (xmlStr) { - try { - var parser = new DOMParser(); - return parser.parseFromString(xmlStr, "text/xml"); - } catch (e) { - var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; - for (var i = 0; i < arrMSXML.length; i++) { - try { - var xmlDoc = new ActiveXObject(arrMSXML[i]); - xmlDoc.setProperty("SelectionLanguage", "XPath"); - xmlDoc.async = false; - xmlDoc.loadXML(xmlStr); - return xmlDoc; - } catch (xmlError) { - } - } - } - }; - - XML.toString = function (xmlNode) { - if (!BI.isIE()) { - var xmlSerializer = new XMLSerializer(); - return xmlSerializer.serializeToString(xmlNode); - } else - return xmlNode.xml; - }; - - XML.getNSResolver = function (str) { - if (!str) { - return null; - } - var list = str.split(' '); - var namespaces = {}; - for (var i = 0; i < list.length; i++) { - var pair = list[i].split('='); - var fix = BI.trim(pair[0]).replace("xmlns:", ""); - namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); - } - return function (prefix) { - return namespaces[prefix]; - }; - }; - - XML.eval = function (context, xpathExp, resultType, namespaces) { - if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { - return XML.eval2(context, xpathExp, resultType, namespaces); - } else { - if (BI.isIE()) { - namespaces = namespaces ? namespaces : ""; - var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; - doc.setProperty("SelectionNamespaces", namespaces); - var result; - if (resultType == this.ResultType.single) { - result = context.selectSingleNode(xpathExp); - } else { - result = context.selectNodes(xpathExp) || []; - } - doc.setProperty("SelectionNamespaces", ""); - return result; - } else { - var node = context; - var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; - var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; - var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); - - if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { - return col.singleNodeValue; - } else { - var thisColMemb = col.iterateNext(); - var rowsCol = []; - while (thisColMemb) { - rowsCol[rowsCol.length] = thisColMemb; - thisColMemb = col.iterateNext(); - } - return rowsCol; - } - } - } - }; - - XML.eval2 = function (context, xpathExp, resultType, namespaces) { - if (resultType !== "single" && resultType !== undefined && resultType !== null) { - throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); - } - - if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { - return context; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs, i; - if (xpathExp.indexOf("/") != -1) { - var items = xpathExp.split("/"); - var isAbs = xpathExp.substring(0, 1) == "/"; - for (i = 0; i < items.length; i++) { - var item = items[i]; - if (item === "") { - continue; - } else { - var next = null; - var ii = i + 1; - for (; ii < items.length; ii++) { - if (next === null) { - next = items[ii]; - } else { - next = next + "/" + items[ii]; - } - } - - if (item == ".") { - return this.eval(context, next, resultType); - - } else if (item == "..") { - return this.eval2(context.parentNode, next, resultType); - - } else if (item == "*") { - if (isAbs) { - return this.eval2(context, next, resultType); - - } else { - childs = context.childNodes; - for (var j = 0; j < childs.length; j++) { - var tmp = this.eval2(childs[j], next, resultType); - if (tmp !== null) { - return tmp; - } - } - return null; - } - - } else { - if (isAbs) { - if (context.nodeName == item) { - return this.eval2(context, next, resultType); - } else { - return null; - } - } else { - var child = this.getChildByName(context, item); - if (child !== null) { - return this.eval2(child, next, resultType); - } else { - return null; - } - - } - } - - } - } - - return null; - - } else { - if ("text()" == xpathExp) { - childs = context.childNodes; - for (i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.TEXT) { - return childs[i]; - } - } - return null; - } else { - return this.getChildByName(context, xpathExp); - } - } - }; - - XML.getChildByName = function (context, name) { - if (context === null || context === undefined || name === null || name === undefined) { - return null; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs = context.childNodes; - for (var i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { - return childs[i]; - } - } - - return null; - }; - - XML.appendChildren = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - if (isBefore && finded[i].firstNode) { - this._insertBefore(finded[i], nodes, finded[i].firstNode); - } else { - for (var j = 0; j < nodes.length; j++) { - finded[i].appendChild(nodes[j]); - } - } - } - return count; - }; - - XML.removeNodes = function (context, xpathExp) { - var nodes = this.eval(context, xpathExp); - for (var i = 0; i < nodes.length; i++) { - nodes[i].parentNode.removeChild(nodes[i]); - } - }; - - XML._insertBefore = function (parent, newchildren, refchild) { - for (var i = 0; i < newchildren.length; i++) { - parent.insertBefore(newchildren[i], refchild); - } - }; - - XML.insertNodes = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; - this._insertBefore(finded[i].parentNode, nodes, refnode); - } - return count; - }; - - XML.replaceNodes = function (context, xpathExp, nodes) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = finded[i]; - var parent = refnode.parentNode; - this._insertBefore(parent, nodes, refnode); - parent.removeChild(refnode); - } - return count; - }; - - XML.setNodeText = function (context, xpathExp, text) { - var finded = this.eval(context, xpathExp, this.ResultType.single); - if (finded === null) { - return; - } - if (finded.nodeType == XML.Document.NodeType.ELEMENT) { - var textNode = this.eval(finded, "./text()", this.ResultType.single); - if (!textNode) { - textNode = finded.ownerDocument.createTextNode(""); - finded.appendChild(textNode); - } - textNode.nodeValue = text; - } else { - finded.nodeValue = text; - } - return; - }; - - XML.getNodeText = function (context, xpathExp, defaultValue) { - var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; - if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { - finded = this.eval(finded, "./text()", this.ResultType.single); - } - return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; - }; - - XML.Namespaces = { - XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", - XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", - XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", - XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', - XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', - XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', - XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', - XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', - XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', - XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', - XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', - XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', - JUSTEPSCHEMA: "http://www.justep.com/xbiz#", - RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - JUSTEP: "http://www.justep.com/x5#", - 'get': function (type) { - type = type ? type.toLowerCase() : "string"; - if ("string" == type) { - return XML.Namespaces.XMLSCHEMA_STRING; - } - else if ("integer" == type) { - return XML.Namespaces.XMLSCHEMA_INTEGER; - } - else if ("long" == type) { - return XML.Namespaces.XMLSCHEMA_LONG; - } - else if ("float" == type) { - return XML.Namespaces.XMLSCHEMA_FLOAT; - } - else if ("double" == type) { - return XML.Namespaces.XMLSCHEMA_DOUBLE; - } - else if ("decimal" == type) { - return XML.Namespaces.XMLSCHEMA_DECIMAL; - } - else if ("date" == type) { - return XML.Namespaces.XMLSCHEMA_DATE; - } - else if ("time" == type) { - return XML.Namespaces.XMLSCHEMA_TIME; - } - else if ("datetime" == type) { - return XML.Namespaces.XMLSCHEMA_DATETIME; - } - else if ("boolean" == type) { - return XML.Namespaces.XMLSCHEMA_BOOLEAN; - } - } - }; -})(BI);BI.BehaviorFactory = { - createBehavior: function(key, options){ - var behavior; - switch (key){ - case "highlight": - behavior = BI.HighlightBehavior; - break; - case "redmark": - behavior = BI.RedMarkBehavior; - break; - } - return new behavior(options); - } -} - -/** - * guy - * 行为控件 - * @class BI.Behavior - * @extends BI.OB - */ -BI.Behavior = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.Behavior.superclass._defaultConfig.apply(this, arguments), { - rule: function(){return true;} - }); - }, - - _init : function() { - BI.Behavior.superclass._init.apply(this, arguments); - - }, - - doBehavior: function(){ - - } -});/** - * 布局容器类 - * @class BI.Layout - * @extends BI.Widget - * - * @cfg {JSON} options 配置属性 - * @cfg {Boolean} [options.scrollable=false] 子组件超出容器边界之后是否会出现滚动条 - * @cfg {Boolean} [options.scrollx=false] 子组件超出容器边界之后是否会出现横向滚动条 - * @cfg {Boolean} [options.scrolly=false] 子组件超出容器边界之后是否会出现纵向滚动条 - */ -BI.Layout = BI.inherit(BI.Widget, { - props: function () { - return { - scrollable: null, //true, false, null - scrollx: false, //true, false - scrolly: false, //true, false - items: [] - }; - }, - - render: function () { - this._init4Margin(); - this._init4Scroll(); - }, - - _init4Margin: function () { - if (this.options.top) { - this.element.css('top', this.options.top); - } - if (this.options.left) { - this.element.css('left', this.options.left); - } - if (this.options.bottom) { - this.element.css('bottom', this.options.bottom); - } - if (this.options.right) { - this.element.css('right', this.options.right); - } - }, - - _init4Scroll: function () { - switch (this.options.scrollable) { - case true: - this.element.css("overflow", "auto"); - break; - case false: - this.element.css("overflow", "hidden"); - break; - default : - break; - } - if (this.options.scrollx) { - this.element.css({ - "overflow-x": "auto", - "overflow-y": "hidden" - }); - } - if (this.options.scrolly) { - this.element.css({ - "overflow-x": "hidden", - "overflow-y": "auto" - }); - } - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.element.append(frag); - } - }, - - _getChildName: function (index) { - return index + ""; - }, - - _addElement: function (i, item) { - var self = this, w; - if (!this.hasWidget(this._getChildName(i))) { - w = BI.createWidget(item); - w.on(BI.Events.DESTROY, function () { - BI.each(self._children, function (name, child) { - if (child === w) { - BI.remove(self._children, child); - self.removeItemAt(name | 0); - } - }); - }); - this.addWidget(this._getChildName(i), w); - } else { - w = this.getWidgetByName(this._getChildName(i)); - } - return w; - }, - - _getOptions: function (item) { - if (item instanceof BI.Widget) { - item = item.options; - } - item = BI.stripEL(item); - if (item instanceof BI.Widget) { - item = item.options; - } - return item; - }, - - _compare: function (item1, item2) { - var self = this; - return eq(item1, item2); - - //不比较函数 - function eq(a, b, aStack, bStack) { - if (a === b) { - return a !== 0 || 1 / a === 1 / b; - } - if (a == null || b == null) { - return a === b; - } - var className = Object.prototype.toString.call(a); - switch (className) { - case '[object RegExp]': - case '[object String]': - return '' + a === '' + b; - case '[object Number]': - if (+a !== +a) { - return +b !== +b; - } - return +a === 0 ? 1 / +a === 1 / b : +a === +b; - case '[object Date]': - case '[object Boolean]': - return +a === +b; - } - - var areArrays = className === '[object Array]'; - if (!areArrays) { - if (BI.isFunction(a) && BI.isFunction(b)) { - return true; - } - a = self._getOptions(a); - b = self._getOptions(b); - } - - aStack = aStack || []; - bStack = bStack || []; - var length = aStack.length; - while (length--) { - if (aStack[length] === a) { - return bStack[length] === b; - } - } - - aStack.push(a); - bStack.push(b); - - if (areArrays) { - length = a.length; - if (length !== b.length) { - return false; - } - while (length--) { - if (!eq(a[length], b[length], aStack, bStack)) { - return false; - } - } - } else { - var keys = _.keys(a), key; - length = keys.length; - if (_.keys(b).length !== length) { - return false; - } - while (length--) { - key = keys[length]; - if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) { - return false; - } - } - } - aStack.pop(); - bStack.pop(); - return true; - } - }, - - _getWrapper: function () { - return this.element; - }, - - _addItemAt: function (index, item) { - for (var i = this.options.items.length; i > index; i--) { - this._children[this._getChildName(i)] = this._children[this._getChildName(i - 1)]; - } - delete this._children[this._getChildName(index)]; - this.options.items.splice(index, 0, item); - }, - - _removeItemAt: function (index) { - for (var i = index; i < this.options.items.length - 1; i++) { - this._children[this._getChildName(i)] = this._children[this._getChildName(i + 1)]; - } - delete this._children[this._getChildName(this.options.items.length - 1)]; - this.options.items.splice(index, 1); - }, - - /** - * 添加一个子组件到容器中 - * @param {JSON/BI.Widget} item 子组件 - */ - addItem: function (item) { - return this.addItemAt(this.options.items.length, item); - }, - - prependItem: function (item) { - return this.addItemAt(0, item); - }, - - addItemAt: function (index, item) { - if (index < 0 || index > this.options.items.length) { - return; - } - this._addItemAt(index, item); - var w = this._addElement(index, item); - if (index > 0) { - this._children[this._getChildName(index - 1)].element.after(w.element); - } else { - w.element.prependTo(this._getWrapper()); - } - w._mount(); - return w; - }, - - removeItemAt: function (indexes) { - indexes = BI.isArray(indexes) ? indexes : [indexes]; - var deleted = []; - var newItems = [], newChildren = {}; - for (var i = 0, len = this.options.items.length; i < len; i++) { - var child = this._children[this._getChildName(i)]; - if (indexes.contains(i)) { - child && deleted.push(child); - } else { - newChildren[this._getChildName(newItems.length)] = child; - newItems.push(this.options.items[i]); - } - } - this.options.items = newItems; - this._children = newChildren; - BI.each(deleted, function (i, c) { - c._destroy(); - }); - }, - - updateItemAt: function (index, item) { - if (index < 0 || index > this.options.items.length - 1) { - return; - } - - var child = this._children[this._getChildName(index)]; - var updated; - if (updated = child.update(this._getOptions(item))) { - return updated; - } - var del = this._children[this._getChildName(index)]; - delete this._children[this._getChildName(index)]; - this.options.items.splice(index, 1); - var w = this._addElement(index, item); - this.options.items.splice(index, 0, item); - this._children[this._getChildName(index)] = w; - if (index > 0) { - this._children[this._getChildName(index - 1)].element.after(w.element); - } else { - w.element.prependTo(this._getWrapper()); - } - del._destroy(); - w._mount(); - }, - - addItems: function (items) { - var self = this, o = this.options; - var fragment = document.createDocumentFragment(); - var added = []; - BI.each(items, function (i, item) { - var w = self._addElement(o.items.length, item); - self._children[self._getChildName(o.items.length)] = w; - o.items.push(item); - added.push(w); - fragment.appendChild(w.element[0]); - }); - this._getWrapper().append(fragment); - BI.each(added, function (i, w) { - w._mount(); - }) - }, - - prependItems: function (items) { - var self = this; - items = items || []; - var fragment = document.createDocumentFragment(); - var added = []; - for (var i = items.length - 1; i >= 0; i--) { - this._addItemAt(0, items[i]); - var w = this._addElement(0, items[i]); - self._children[self._getChildName(0)] = w; - this.options.items.unshift(items[i]); - added.push(w); - fragment.appendChild(w.element[0]); - } - this._getWrapper().prepend(fragment); - BI.each(added, function (i, w) { - w._mount(); - }) - }, - - getValue: function () { - var self = this, value = [], child; - BI.each(this.options.items, function (i) { - if (child = self._children[self._getChildName(i)]) { - var v = child.getValue(); - v = BI.isArray(v) ? v : [v]; - value = value.concat(v); - } - }); - return value; - }, - - setValue: function (v) { - var self = this, child; - BI.each(this.options.items, function (i) { - if (child = self._children[self._getChildName(i)]) { - child.setValue(v); - } - }) - }, - - setText: function (v) { - var self = this, child; - BI.each(this.options.items, function (i) { - if (child = self._children[self._getChildName(i)]) { - child.setText(v); - } - }) - }, - - update: function (item) { - var o = this.options; - var items = item.items || []; - var updated, i, len; - for (i = 0, len = Math.min(o.items.length, items.length); i < len; i++) { - if (!this._compare(o.items[i], items[i])) { - updated = this.updateItemAt(i, items[i]) || updated; - } - } - if (o.items.length > items.length) { - var deleted = []; - for (i = items.length; i < o.items.length; i++) { - deleted.push(this._children[this._getChildName(i)]); - delete this._children[this._getChildName(i)]; - } - o.items.splice(items.length); - BI.each(deleted, function (i, w) { - w._destroy(); - }) - } else if (items.length > o.items.length) { - for (i = o.items.length; i < items.length; i++) { - this.addItemAt(i, items[i]); - } - } - return updated; - }, - - stroke: function (items) { - var self = this; - BI.each(items, function (i, item) { - if (!!item) { - self._addElement(i, item); - } - }); - }, - - removeWidget: function (nameOrWidget) { - var removeIndex; - if (BI.isWidget(nameOrWidget)) { - BI.each(this._children, function (name, child) { - if (child === nameOrWidget) { - removeIndex = name; - } - }) - } else { - removeIndex = nameOrWidget; - } - if (removeIndex) { - this._removeItemAt(removeIndex | 0); - } - }, - - empty: function () { - BI.Layout.superclass.empty.apply(this, arguments); - this.options.items = []; - }, - - destroy: function () { - BI.Layout.superclass.destroy.apply(this, arguments); - this.options.items = []; - }, - - populate: function (items) { - var self = this, o = this.options; - items = items || []; - if (this._isMounted) { - this.update({items: items}); - return; - } - this.options.items = items; - this.stroke(items); - }, - - resize: function () { - - } -}); -BI.shortcut('bi.layout', BI.Layout);/** - * guy - * 由一个元素切换到另一个元素的行为 - * @class BI.Action - * @extends BI.OB - * @abstract - */ -BI.Action = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.Action.superclass._defaultConfig.apply(this, arguments), { - src: null, - tar: null - }); - }, - - _init : function() { - BI.Action.superclass._init.apply(this, arguments); - }, - - actionPerformed: function(src, tar, callback){ - - }, - - actionBack: function(tar, src, callback){ - - } -}); - -BI.ActionFactory = { - createAction: function(key, options){ - var action; - switch (key){ - case "show": - action = BI.ShowAction; - break; - } - return new action(options); - } -}/** - * guy - * 由一个元素切换到另一个元素的行为 - * @class BI.ShowAction - * @extends BI.Action - */ -BI.ShowAction = BI.inherit(BI.Action, { - _defaultConfig: function () { - return BI.extend(BI.ShowAction.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.ShowAction.superclass._init.apply(this, arguments); - }, - - actionPerformed: function (src, tar, callback) { - tar = tar || this.options.tar; - tar.setVisible(true); - callback && callback(); - }, - - actionBack: function (tar, src, callback) { - tar = tar || this.options.tar; - tar.setVisible(false); - callback && callback(); - } -});/** - * @class BI.FloatSection - * @extends BI.View - * @abstract - */ -BI.FloatSection = BI.inherit(BI.View, { - _init : function() { - BI.FloatSection.superclass._init.apply(this, arguments); - var self = this; - var flatten = ["_init", "_defaultConfig", "_vessel", "_render", "getName", "listenEnd", "local", "refresh", "load", "change"]; - flatten = BI.makeObject(flatten, true); - BI.each(this.constructor.caller.caller.caller.prototype, function (key) { - if (flatten[key]) { - return; - } - var f = self[key]; - if (BI.isFunction(f)) { - self[key] = BI.bind(function () { - if (this.model._start === true) { - this._F.push({f: f, arg: arguments}); - return; - } - return f.apply(this, arguments); - }, self); - } - }) - }, - - rebuildNorth : function(north) { - return true; - }, - rebuildCenter : function(center) {}, - rebuildSouth : function(south) { - return false; - }, - close: function(){ - this.notifyParentEnd(); - this.trigger(BI.PopoverSection.EVENT_CLOSE); - }, - end: function(){ - - } -}); - -/** - * 弹出层 - * @class BI.PopoverSection - * @extends BI.Widget - * @abstract - */ -BI.PopoverSection = BI.inherit(BI.Widget, { - _init : function() { - BI.PopoverSection.superclass._init.apply(this, arguments); - }, - - rebuildNorth : function(north) { - return true; - }, - rebuildCenter : function(center) {}, - rebuildSouth : function(south) { - return false; - }, - close: function(){ - this.fireEvent(BI.PopoverSection.EVENT_CLOSE); - }, - end: function(){ - - } -}); -BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";;(function () { - if (!window.BI) { - window.BI = {}; - } - function isEmpty(value) { - // 判断是否为空值 - var result = value === "" || value === null || value === undefined; - return result; - } - - // 判断是否是无效的日期 - function isInvalidDate(date) { - return date == "Invalid Date" || date == "NaN"; - } - - /** - * 科学计数格式 - */ - function _eFormat(text, fmt) { - var e = fmt.indexOf("E"); - var eleft = fmt.substr(0, e), eright = fmt.substr(e + 1); - if (/^[0\.-]+$/.test(text)) { - text = BI._numberFormat(0.0, eleft) + 'E' + BI._numberFormat(0, eright) - } else { - var isNegative = text < 0; - if (isNegative) { - text = text.substr(1); - } - var elvl = (eleft.split('.')[0] || '').length; - var point = text.indexOf("."); - if (point < 0) { - point = text.length; - } - var i = 0; //第一个不为0的数的位置 - text = text.replace('.', ''); - for (var len = text.length; i < len; i++) { - var ech = text.charAt(i); - if (ech <= '9' && ech >= '1') { - break; - } - } - var right = point - i - elvl; - var left = text.substr(i, elvl); - var dis = i + elvl - text.length; - if (dis > 0) { - //末位补全0 - for (var k = 0; k < dis; k++) { - left += '0'; - } - } else { - left += '.' + text.substr(i + elvl); - } - left = left.replace(/^[0]+/, ''); - if (right < 0 && eright.indexOf('-') < 0) { - eright += ';-' + eright; - } - text = BI._numberFormat(left, eleft) + 'E' + BI._numberFormat(right, eright); - if (isNegative) { - text = '-' + text; - } - } - return text; - } - - /** - * 数字格式 - */ - function _numberFormat(text, format) { - var text = text + ''; - //数字格式,区分正负数 - var numMod = format.indexOf(';'); - if (numMod > -1) { - if (text >= 0) { - return _numberFormat(text + "", format.substring(0, numMod)); - } else { - return _numberFormat((-text) + "", format.substr(numMod + 1)); - } - } - var tp = text.split('.'), fp = format.split('.'), - tleft = tp[0] || '', fleft = fp[0] || '', - tright = tp[1] || '', fright = fp[1] || ''; - //百分比,千分比的小数点移位处理 - if (/[%‰]$/.test(format)) { - var paddingZero = /[%]$/.test(format) ? '00' : '000'; - tright += paddingZero; - tleft += tright.substr(0, paddingZero.length); - tleft = tleft.replace(/^0+/gi, ''); - tright = tright.substr(paddingZero.length).replace(/0+$/gi, ''); - } - var right = _dealWithRight(tright, fright); - if (right.leftPlus) { - //小数点后有进位 - tleft = parseInt(tleft) + 1 + ''; - - tleft = isNaN(tleft) ? '1' : tleft; - } - right = right.num; - var left = _dealWithLeft(tleft, fleft); - if (!(/[0-9]/.test(left))) { - left = left + '0'; - } - if (!(/[0-9]/.test(right))) { - return left + right; - } else { - return left + '.' + right; - } - } - - /** - * 处理小数点右边小数部分 - * @param tright 右边内容 - * @param fright 右边格式 - * @returns {JSON} 返回处理结果和整数部分是否需要进位 - * @private - */ - function _dealWithRight(tright, fright) { - var right = '', j = 0, i = 0; - for (var len = fright.length; i < len; i++) { - var ch = fright.charAt(i); - var c = tright.charAt(j); - switch (ch) { - case '0': - if (isEmpty(c)) { - c = '0'; - } - right += c; - j++; - break; - case '#': - right += c; - j++; - break; - default : - right += ch; - break; - } - } - var rll = tright.substr(j); - var result = {}; - if (!isEmpty(rll) && rll.charAt(0) > 4) { - //有多余字符,需要四舍五入 - result.leftPlus = true; - var numReg = right.match(/^[0-9]+/); - if (numReg) { - var num = numReg[0]; - var orilen = num.length; - var newnum = parseInt(num) + 1 + ''; - //进位到整数部分 - if (newnum.length > orilen) { - newnum = newnum.substr(1); - } else { - newnum = String.leftPad(newnum, orilen, '0'); - result.leftPlus = false; - } - right = right.replace(/^[0-9]+/, newnum); - } - } - result.num = right; - return result; - } - - /** - * 处理小数点左边整数部分 - * @param tleft 左边内容 - * @param fleft 左边格式 - * @returns {string} 返回处理结果 - * @private - */ - function _dealWithLeft(tleft, fleft) { - var left = ''; - var j = tleft.length - 1; - var combo = -1, last = -1; - var i = fleft.length - 1; - for (; i >= 0; i--) { - var ch = fleft.charAt(i); - var c = tleft.charAt(j); - switch (ch) { - case '0': - if (isEmpty(c)) { - c = '0'; - } - last = -1; - left = c + left; - j--; - break; - case '#': - last = i; - left = c + left; - j--; - break; - case ',': - if (!isEmpty(c)) { - //计算一个,分隔区间的长度 - var com = fleft.match(/,[#0]+/); - if (com) { - combo = com[0].length - 1; - } - left = ',' + left; - } - break; - default : - left = ch + left; - break; - } - } - if (last > -1) { - //处理剩余字符 - var tll = tleft.substr(0, j + 1); - left = left.substr(0, last) + tll + left.substr(last); - } - if (combo > 0) { - //处理,分隔区间 - var res = left.match(/[0-9]+,/); - if (res) { - res = res[0]; - var newstr = '', n = res.length - 1 - combo; - for (; n >= 0; n = n - combo) { - newstr = res.substr(n, combo) + ',' + newstr; - } - var lres = res.substr(0, n + combo); - if (!isEmpty(lres)) { - newstr = lres + ',' + newstr; - } - } - left = left.replace(/[0-9]+,/, newstr); - } - return left; - } - - BI.cjkEncode = function (text) { - // alex:如果非字符串,返回其本身(cjkEncode(234) 返回 ""是不对的) - if (typeof text !== 'string') { - return text; - } - - var newText = ""; - for (var i = 0; i < text.length; i++) { - var code = text.charCodeAt(i); - if (code >= 128 || code === 91 || code === 93) {//91 is "[", 93 is "]". - newText += "[" + code.toString(16) + "]"; - } else { - newText += text.charAt(i); - } - } - - return newText - }; - - BI.cjkEncodeDO = function (o) { - if (BI.isPlainObject(o)) { - var result = {}; - $.each(o, function (k, v) { - if (!(typeof v == "string")) { - v = BI.jsonEncode(v); - } - //wei:bug 43338,如果key是中文,cjkencode后o的长度就加了1,ie9以下版本死循环,所以新建对象result。 - k = BI.cjkEncode(k); - result[k] = BI.cjkEncode(v); - }); - return result; - } - return o; - }; - - BI.jsonEncode = function (o) { - //james:这个Encode是抄的EXT的 - var useHasOwn = {}.hasOwnProperty ? true : false; - - // crashes Safari in some instances - //var validRE = /^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/; - - var m = { - "\b": '\\b', - "\t": '\\t', - "\n": '\\n', - "\f": '\\f', - "\r": '\\r', - '"': '\\"', - "\\": '\\\\' - }; - - var encodeString = function (s) { - if (/["\\\x00-\x1f]/.test(s)) { - return '"' + s.replace(/([\x00-\x1f\\"])/g, function (a, b) { - var c = m[b]; - if (c) { - return c; - } - c = b.charCodeAt(); - return "\\u00" + - Math.floor(c / 16).toString(16) + - (c % 16).toString(16); - }) + '"'; - } - return '"' + s + '"'; - }; - - var encodeArray = function (o) { - var a = ["["], b, i, l = o.length, v; - for (i = 0; i < l; i += 1) { - v = o[i]; - switch (typeof v) { - case "undefined": - case "function": - case "unknown": - break; - default: - if (b) { - a.push(','); - } - a.push(v === null ? "null" : BI.jsonEncode(v)); - b = true; - } - } - a.push("]"); - return a.join(""); - }; - - if (typeof o == "undefined" || o === null) { - return "null"; - } else if (BI.isArray(o)) { - return encodeArray(o); - } else if (o instanceof Date) { - /* - * alex:原来只是把年月日时分秒简单地拼成一个String,无法decode - * 现在这么处理就可以decode了,但是JS.jsonDecode和Java.JSONObject也要跟着改一下 - */ - return BI.jsonEncode({ - __time__: o.getTime() - }) - } else if (typeof o == "string") { - return encodeString(o); - } else if (typeof o == "number") { - return isFinite(o) ? String(o) : "null"; - } else if (typeof o == "boolean") { - return String(o); - } else if (BI.isFunction(o)) { - return String(o); - } else { - var a = ["{"], b, i, v; - for (i in o) { - if (!useHasOwn || o.hasOwnProperty(i)) { - v = o[i]; - switch (typeof v) { - case "undefined": - case "unknown": - break; - default: - if (b) { - a.push(','); - } - a.push(BI.jsonEncode(i), ":", - v === null ? "null" : BI.jsonEncode(v)); - b = true; - } - } - } - a.push("}"); - return a.join(""); - } - }; - - BI.jsonDecode = function (text) { - - try { - // 注意0啊 - //var jo = $.parseJSON(text) || {}; - var jo = $.parseJSON(text); - if (jo == null) { - jo = {}; - } - } catch (e) { - /* - * richie:浏览器只支持标准的JSON字符串转换,而jQuery会默认调用浏览器的window.JSON.parse()函数进行解析 - * 比如:var str = "{'a':'b'}",这种形式的字符串转换为JSON就会抛异常 - */ - try { - jo = new Function("return " + text)() || {}; - } catch (e) { - //do nothing - } - if (jo == null) { - jo = []; - } - } - if (!_hasDateInJson(text)) { - return jo; - } - - function _hasDateInJson(json) { - if (!json || typeof json !== "string") { - return false; - } - return json.indexOf("__time__") != -1; - } - - return (function (o) { - if (typeof o === "string") { - return o; - } - if (o && o.__time__ != null) { - return new Date(o.__time__); - } - for (var a in o) { - if (o[a] == o || typeof o[a] == 'object' || $.isFunction(o[a])) { - break; - } - o[a] = arguments.callee(o[a]); - } - - return o; - })(jo); - }; - - BI.contentFormat = function (cv, fmt) { - if (isEmpty(cv)) { - //原值为空,返回空字符 - return ''; - } - var text = cv.toString(); - if (isEmpty(fmt)) { - //格式为空,返回原字符 - return text; - } - if (fmt.match(/^T/)) { - //T - 文本格式 - return text; - } else if (fmt.match(/^D/)) { - //D - 日期(时间)格式 - if (!(cv instanceof Date)) { - if (typeof cv === 'number') { - //毫秒数类型 - cv = new Date(cv); - } else { - //字符串类型,如yyyyMMdd、MMddyyyy等这样无分隔符的结构 - cv = Date.parseDate(cv + "", Date.patterns.ISO8601Long); - } - } - if (!BI.isNull(cv)) { - var needTrim = fmt.match(/^DT/); - text = BI.date2Str(cv, fmt.substring(needTrim ? 2 : 1)); - } - } else if (fmt.match(/E/)) { - //科学计数格式 - text = _eFormat(text, fmt); - } else { - //数字格式 - text = _numberFormat(text, fmt); - } - //¤ - 货币格式 - text = text.replace(/¤/g, '¥'); - return text; - }; - - /** - * 把日期对象按照指定格式转化成字符串 - * - * @example - * var date = new Date('Thu Dec 12 2013 00:00:00 GMT+0800'); - * var result = BI.date2Str(date, 'yyyy-MM-dd');//2013-12-12 - * - * @class BI.date2Str - * @param date 日期 - * @param format 日期格式 - * @returns {String} - */ - BI.date2Str = function (date, format) { - if (!date) { - return ''; - } - // O(len(format)) - var len = format.length, result = ''; - if (len > 0) { - var flagch = format.charAt(0), start = 0, str = flagch; - for (var i = 1; i < len; i++) { - var ch = format.charAt(i); - if (flagch !== ch) { - result += compileJFmt({ - 'char': flagch, - 'str': str, - 'len': i - start - }, date); - flagch = ch; - start = i; - str = flagch; - } else { - str += ch; - } - } - result += compileJFmt({ - 'char': flagch, - 'str': str, - 'len': len - start - }, date); - } - return result; - - function compileJFmt(jfmt, date) { - var str = jfmt.str, len = jfmt.len, ch = jfmt['char']; - switch (ch) { - case 'E': //星期 - str = Date._DN[date.getDay()]; - break; - case 'y': //年 - if (len <= 3) { - str = (date.getFullYear() + '').slice(2, 4); - } else { - str = date.getFullYear(); - } - break; - case 'M': //月 - if (len > 2) { - str = Date._MN[date.getMonth()]; - } else if (len < 2) { - str = date.getMonth() + 1; - } else { - str = String.leftPad(date.getMonth() + 1 + '', 2, '0'); - } - break; - case 'd': //日 - if (len > 1) { - str = String.leftPad(date.getDate() + '', 2, '0'); - } else { - str = date.getDate(); - } - break; - case 'h': //时(12) - var hour = date.getHours() % 12; - if (hour === 0) { - hour = 12; - } - if (len > 1) { - str = String.leftPad(hour + '', 2, '0'); - } else { - str = hour; - } - break; - case 'H': //时(24) - if (len > 1) { - str = String.leftPad(date.getHours() + '', 2, '0'); - } else { - str = date.getHours(); - } - break; - case 'm': - if (len > 1) { - str = String.leftPad(date.getMinutes() + '', 2, '0'); - } else { - str = date.getMinutes(); - } - break; - case 's': - if (len > 1) { - str = String.leftPad(date.getSeconds() + '', 2, '0'); - } else { - str = date.getSeconds(); - } - break; - case 'a': - str = date.getHours() < 12 ? 'am' : 'pm'; - break; - case 'z': - str = date.getTimezone(); - break; - default: - str = jfmt.str; - break; - } - return str; - } - }; - - BI.object2Number = function (value) { - if (value == null) { - return 0; - } - if (typeof value == 'number') { - return value; - } else { - var str = value + ""; - if (str.indexOf(".") === -1) { - return parseInt(str); - } else { - return parseFloat(str); - } - } - }; - - BI.object2Date = function (obj) { - if (obj == null) { - return new Date(); - } - if (obj instanceof Date) { - return obj; - } else if (typeof obj == 'number') { - return new Date(obj); - } else { - var str = obj + ""; - str = str.replace(/-/g, '/'); - var dt = new Date(str); - if (!isInvalidDate(dt)) { - return dt; - } - - return new Date(); - } - }; - - BI.object2Time = function (obj) { - if (obj == null) { - return new Date(); - } - if (obj instanceof Date) { - return obj; - } else { - var str = obj + ""; - str = str.replace(/-/g, '/'); - var dt = new Date(str); - if (!isInvalidDate(dt)) { - return dt; - } - if (str.indexOf('/') === -1 && str.indexOf(':') !== -1) { - dt = new Date("1970/01/01 " + str); - if (!isInvalidDate(dt)) { - return dt; - } - } - dt = BI.str2Date(str, "HH:mm:ss"); - if (!isInvalidDate(dt)) { - return dt; - } - return new Date(); - } - }; -})(); -/** - * guy - * - * @class BI.HighlightBehavior - * @extends BI.Behavior - */ -BI.HighlightBehavior = BI.inherit(BI.Behavior, { - _defaultConfig: function () { - return BI.extend(BI.HighlightBehavior.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.HighlightBehavior.superclass._init.apply(this, arguments); - - }, - - doBehavior: function (items) { - var args = Array.prototype.slice.call(arguments, 1), - o = this.options; - BI.each(items, function (i, item) { - if (item instanceof BI.Single) { - var rule = o.rule(item.getValue(), item); - - function doBe(run) { - if (run === true) { - item.doHighLight.apply(item, args); - } else { - item.unHighLight.apply(item, args); - } - } - - if (BI.isFunction(rule)) { - rule(doBe); - } else { - doBe(rule); - } - } else { - item.doBehavior.apply(item, args); - } - }) - } -});/** - * guy - * 标红行为 - * @class BI.RedMarkBehavior - * @extends BI.Behavior - */ -BI.RedMarkBehavior = BI.inherit(BI.Behavior, { - _defaultConfig: function() { - return BI.extend(BI.RedMarkBehavior.superclass._defaultConfig.apply(this, arguments), { - - }); - }, - - _init : function() { - BI.RedMarkBehavior.superclass._init.apply(this, arguments); - - }, - - doBehavior: function(items){ - var args = Array.prototype.slice.call(arguments, 1), - o = this.options; - BI.each(items, function(i, item){ - if(item instanceof BI.Single) { - if (o.rule(item.getValue(), item)) { - item.doRedMark.apply(item, args); - } else { - item.unRedMark.apply(item, args); - } - } else { - item.doBehavior.apply(item, args); - } - }) - } -});/** - * guy - * 控制器 - * Controller层超类 - * @class BI.Controller - * @extends BI.OB - * @abstract - */ -BI.Controller = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.Controller.superclass._defaultConfig.apply(this, arguments), { - - }) - }, - _init : function() { - BI.Controller.superclass._init.apply(this, arguments); - }, - - destroy: function(){ - - } -}); -BI.Controller.EVENT_CHANGE = "__EVENT_CHANGE__";/** - * 广播 - * - * Created by GUY on 2015/12/23. - * @class - */ -BI.BroadcastController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.BroadcastController.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.BroadcastController.superclass._init.apply(this, arguments); - this._broadcasts = {}; - }, - - on: function (name, fn) { - var self = this; - if (!this._broadcasts[name]) { - this._broadcasts[name] = []; - } - this._broadcasts[name].push(fn); - return function () { - self.remove(name, fn); - } - }, - - send: function (name) { - var args = [].slice.call(arguments, 1); - BI.each(this._broadcasts[name], function (i, fn) { - fn.apply(null, args); - }); - }, - - remove: function (name, fn) { - if (fn) { - this._broadcasts[name].remove(fn); - if (this._broadcasts[name].length === 0) { - delete this._broadcasts[name]; - } - } else { - delete this._broadcasts[name]; - } - return this; - } -});/** - * 气泡图控制器 - * 控制气泡图的显示方向 - * - * Created by GUY on 2015/8/21. - * @class - */ -BI.BubblesController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.BubblesController.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _const: { - bubbleHeight: 35 - }, - - _init: function () { - BI.BubblesController.superclass._init.apply(this, arguments); - this.bubblesManager = {}; - this.storeBubbles = {}; - }, - - _createBubble: function (direct, text, height) { - return BI.createWidget({ - type: "bi.bubble", - text: text, - height: height || 35, - direction: direct - }); - }, - - _getOffsetLeft: function (name, context, offsetStyle) { - var left = 0; - if ("center" === offsetStyle) { - left = context.element.offset().left + (context.element.bounds().width - this.get(name).element.bounds().width) / 2; - if (left < 0) { - left = 0; - } - return left; - } - if ("right" === offsetStyle) { - left = context.element.offset().left + context.element.bounds().width - this.get(name).element.bounds().width; - if (left < 0) { - left = 0; - } - return left; - } - return context.element.offset().left; - }, - - _getOffsetTop: function (name, context, offsetStyle) { - var top = 0; - if ("center" === offsetStyle) { - top = context.element.offset().top + (context.element.bounds().height - this.get(name).element.bounds().height) / 2; - if (top < 0) { - top = 0; - } - return top; - } else if ("right" === offsetStyle) { - top = context.element.offset().top + context.element.bounds().height - this.get(name).element.bounds().height; - if (top < 0) { - top = 0; - } - return top; - } - return context.element.offset().top; - }, - - _getLeftPosition: function (name, context, offsetStyle) { - var position = $.getLeftPosition(context, this.get(name)); - position.top = this._getOffsetTop(name, context, offsetStyle); - return position; - }, - - _getBottomPosition: function (name, context, offsetStyle) { - var position = $.getBottomPosition(context, this.get(name)); - position.left = this._getOffsetLeft(name, context, offsetStyle); - return position; - }, - - _getTopPosition: function (name, context, offsetStyle) { - var position = $.getTopPosition(context, this.get(name)); - position.left = this._getOffsetLeft(name, context, offsetStyle); - return position; - }, - - _getRightPosition: function (name, context, offsetStyle) { - var position = $.getRightPosition(context, this.get(name)); - position.top = this._getOffsetTop(name, context, offsetStyle); - return position; - }, - - /** - * - * @param name - * @param text - * @param context - * @param offsetStyle center, left, right三种类型, 默认left - * @returns {BI.BubblesController} - */ - show: function (name, text, context, opt) { - opt || (opt = {}); - var container = opt.container || context; - var offsetStyle = opt.offsetStyle || {}; - if (!this.storeBubbles[name]) { - this.storeBubbles[name] = {}; - } - if (!this.storeBubbles[name]["top"]) { - this.storeBubbles[name]["top"] = this._createBubble("top", text); - } - BI.createWidget({ - type: "bi.absolute", - element: container, - items: [{ - el: this.storeBubbles[name]["top"] - }] - }); - this.set(name, this.storeBubbles[name]["top"]); - var position = this._getTopPosition(name, context, offsetStyle); - this.get(name).element.css({left: position.left, top: position.top}); - this.get(name).invisible(); - if (!$.isTopSpaceEnough(context, this.get(name))) { - if (!this.storeBubbles[name]["left"]) { - this.storeBubbles[name]["left"] = this._createBubble("left", text, 30); - } - BI.createWidget({ - type: "bi.absolute", - element: container, - items: [{ - el: this.storeBubbles[name]["left"] - }] - }); - this.set(name, this.storeBubbles[name]["left"]); - var position = this._getLeftPosition(name, context, offsetStyle); - this.get(name).element.css({left: position.left, top: position.top}); - this.get(name).invisible(); - if (!$.isLeftSpaceEnough(context, this.get(name))) { - if (!this.storeBubbles[name]["right"]) { - this.storeBubbles[name]["right"] = this._createBubble("right", text, 30); - } - BI.createWidget({ - type: "bi.absolute", - element: container, - items: [{ - el: this.storeBubbles[name]["right"] - }] - }); - this.set(name, this.storeBubbles[name]["right"]); - var position = this._getRightPosition(name, context, offsetStyle); - this.get(name).element.css({left: position.left, top: position.top}); - this.get(name).invisible(); - if (!$.isRightSpaceEnough(context, this.get(name))) { - if (!this.storeBubbles[name]["bottom"]) { - this.storeBubbles[name]["bottom"] = this._createBubble("bottom", text); - } - BI.createWidget({ - type: "bi.absolute", - element: container, - items: [{ - el: this.storeBubbles[name]["bottom"] - }] - }); - this.set(name, this.storeBubbles[name]["bottom"]); - var position = this._getBottomPosition(name, context, offsetStyle); - this.get(name).element.css({left: position.left, top: position.top}); - this.get(name).invisible(); - } - } - } - this.get(name).setText(text); - this.get(name).visible(); - return this; - }, - - hide: function (name) { - if (!this.has(name)) { - return this; - } - this.get(name).invisible(); - return this; - }, - - add: function (name, bubble) { - if (this.has(name)) { - return this; - } - this.set(name, bubble); - return this; - }, - - get: function (name) { - return this.bubblesManager[name]; - }, - - set: function (name, bubble) { - this.bubblesManager[name] = bubble; - }, - - has: function (name) { - return this.bubblesManager[name] != null; - }, - - remove: function (name) { - if (!this.has(name)) { - return this; - } - BI.each(this.storeBubbles[name], function (dir, bubble) { - bubble.destroy(); - }); - delete this.storeBubbles[name]; - delete this.bubblesManager[name]; - return this; - } -});/** - * guy - * FloatBox弹出层控制器, z-index在100w层级 - * @class BI.FloatBoxController - * @extends BI.Controller - */ -BI.FloatBoxController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.FloatBoxController.superclass._defaultConfig.apply(this, arguments), { - modal: true, // 模态窗口 - render: "body" - }); - }, - - _init: function () { - BI.FloatBoxController.superclass._init.apply(this, arguments); - this.modal = this.options.modal; - this.floatManager = {}; - this.floatLayer = {}; - this.floatContainer = {}; - this.floatOpened = {}; - this.zindex = BI.zIndex_floatbox; - this.zindexMap = {}; - }, - - _check: function (name) { - return BI.isNotNull(this.floatManager[name]); - }, - - create: function (name, section, options) { - if (this._check(name)) { - return this; - } - var floatbox = BI.createWidget({ - type: "bi.float_box" - }, options); - floatbox.populate(section); - this.add(name, floatbox, options); - return this; - }, - - add: function (name, floatbox, options) { - var self = this; - options || (options = {}); - if (this._check(name)) { - return this; - } - this.floatContainer[name] = BI.createWidget({ - type: "bi.absolute", - cls: "bi-popup-view", - items: [{ - el: (this.floatLayer[name] = BI.createWidget({ - type: 'bi.absolute', - items: [floatbox] - })), - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); - this.floatManager[name] = floatbox; - (function (key) { - floatbox.on(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED, function () { - self.close(key); - }) - })(name); - BI.createWidget({ - type: "bi.absolute", - element: options.container || this.options.render, - items: [{ - el: this.floatContainer[name], - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); - return this; - }, - - open: function (name) { - if (!this._check(name)) { - return this; - } - if (!this.floatOpened[name]) { - this.floatOpened[name] = true; - var container = this.floatContainer[name]; - container.element.css("zIndex", this.zindex++); - this.modal && container.element.__hasZIndexMask__(this.zindexMap[name]) && container.element.__releaseZIndexMask__(this.zindexMap[name]); - this.zindexMap[name] = this.zindex; - this.modal && container.element.__buildZIndexMask__(this.zindex++); - this.get(name).setZindex(this.zindex++); - this.floatContainer[name].visible(); - var floatbox = this.get(name); - floatbox.show(); - var W = $(this.options.render).width(), H = $(this.options.render).height(); - var w = floatbox.element.width(), h = floatbox.element.height(); - var left = (W - w) / 2, top = (H - h) / 2; - if (left < 0) { - left = 0; - } - if (top < 0) { - top = 0; - } - floatbox.element.css({ - left: left + "px", - top: top + "px" - }); - } - return this; - }, - - close: function (name) { - if (!this._check(name)) { - return this; - } - if (this.floatOpened[name]) { - delete this.floatOpened[name]; - this.floatContainer[name].invisible(); - this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); - } - return this; - }, - - get: function (name) { - return this.floatManager[name]; - }, - - remove: function (name) { - if (!this._check(name)) { - return this; - } - this.floatContainer[name].destroy(); - this.modal && this.floatContainer[name].element.__releaseZIndexMask__(this.zindexMap[name]); - delete this.floatManager[name]; - delete this.floatLayer[name]; - delete this.zindexMap[name]; - delete this.floatContainer[name]; - delete this.floatOpened[name]; - return this; - } -});/** - * 弹出层面板控制器, z-index在10w层级 - * - * Created by GUY on 2015/6/24. - * @class - */ -BI.LayerController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.LayerController.superclass._defaultConfig.apply(this, arguments), { - render: "body" - }); - }, - - _init: function () { - BI.LayerController.superclass._init.apply(this, arguments); - this.layerManager = {}; - this.layouts = {}; - this.zindex = BI.zIndex_layer; - BI.Resizers.add("layerController" + BI.uniqueId(), BI.bind(this._resize, this)); - }, - - _resize: function () { - BI.each(this.layouts, function (i, layer) { - if (layer.element.is(":visible")) { - layer.element.trigger("__resize__"); - } - }) - }, - - make: function (name, container, op) { - if (this.has(name)) { - return this.get(name); - } - op || (op = {}); - var widget = BI.createWidget((op.render || {}), { - type: "bi.layout" - }); - BI.createWidget({ - type: "bi.absolute", - element: container || this.options.render, - items: [BI.extend({ - el: widget - }, { - top: 0, - left: 0, - right: 0, - bottom: 0 - }, op.offset)] - }); - this.add(name, widget, widget); - return widget; - }, - - create: function (name, from, op) { - if (this.has(name)) { - return this.get(name); - } - op || (op = {}); - var offset = op.offset || {}; - var w = from; - if (BI.isWidget(from)) { - w = from.element; - } - if (BI.isNotEmptyString(w)) { - w = $(w); - } - if (this.has(name)) { - return this.get(name); - } - var widget = BI.createWidget((op.render || {}), { - type: "bi.layout", - cls: op.cls - }); - var layout = BI.createWidget({ - type: "bi.absolute", - items: [{ - el: widget, - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); - BI.createWidget({ - type: "bi.absolute", - element: op.container || this.options.render, - items: [{ - el: layout, - left: offset.left || 0, - right: offset.right || 0, - top: offset.top || 0, - bottom: offset.bottom || 0 - }] - }); - if (w) { - layout.element.addClass("bi-popup-view"); - layout.element.css({ - left: w.offset().left + (offset.left || 0), - top: w.offset().top + (offset.top || 0), - width: offset.width || (w.outerWidth() - (offset.right || 0)) || "", - height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || "" - }); - layout.element.on("__resize__", function () { - w.is(":visible") && - layout.element.css({ - left: w.offset().left + (offset.left || 0), - top: w.offset().top + (offset.top || 0), - width: offset.width || (w.outerWidth() - (offset.right || 0)) || "", - height: offset.height || (w.outerHeight() - (offset.bottom || 0)) || "" - }); - }); - } - this.add(name, widget, layout); - return widget; - }, - - hide: function (name, callback) { - if (!this.has(name)) { - return this; - } - this._getLayout(name).invisible(); - this._getLayout(name).element.hide(0, callback); - return this; - }, - - show: function (name, callback) { - if (!this.has(name)) { - return this; - } - this._getLayout(name).visible(); - this._getLayout(name).element.css("z-index", this.zindex++).show(0, callback).trigger("__resize__"); - return this; - }, - - isVisible: function (name) { - return this.has(name) && this._getLayout(name).isVisible(); - }, - - add: function (name, layer, layout) { - if (this.has(name)) { - throw new Error("name is already exist"); - } - layout.setVisible(false); - this.layerManager[name] = layer; - this.layouts[name] = layout; - layout.element.css("z-index", this.zindex++); - return this; - }, - - _getLayout: function (name) { - return this.layouts[name]; - }, - - get: function (name) { - return this.layerManager[name]; - }, - - has: function (name) { - return this.layerManager[name] != null; - }, - - remove: function (name) { - if (!this.has(name)) { - return this; - } - this.layerManager[name].destroy(); - this.layouts[name].destroy(); - delete this.layerManager[name]; - delete this.layouts[name]; - return this; - } -});/** - * 遮罩面板, z-index在1亿层级 - * - * Created by GUY on 2015/6/24. - * @class - */ -BI.MaskersController = BI.inherit(BI.LayerController, { - _defaultConfig: function () { - return BI.extend(BI.MaskersController.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.MaskersController.superclass._init.apply(this, arguments); - this.zindex = BI.zIndex_masker; - } -});/** - * window.resize 控制器 - * - * Created by GUY on 2015/6/24. - * @class - */ -BI.ResizeController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.ResizeController.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.ResizeController.superclass._init.apply(this, arguments); - var self = this; - this.resizerManger = {}; - var fn = BI.debounce(function (ev) { - //if (BI.isWindow(ev.target)) { - self._resize(ev); - //} - }, 30); - $(window).resize(fn); - }, - - _resize: function (ev) { - BI.each(this.resizerManger, function (key, resizer) { - if (resizer instanceof $) { - if (resizer.is(":visible")) { - resizer.trigger("__resize__"); - } - return; - } - if (resizer instanceof BI.Layout) { - resizer.resize(); - return; - } - if (BI.isFunction(resizer)) { - resizer(ev); - return; - } - }) - }, - - add: function (name, resizer) { - var self = this; - if (this.has(name)) { - return this; - } - this.resizerManger[name] = resizer; - return function () { - self.remove(name); - }; - }, - - get: function (name) { - return this.resizerManger[name]; - }, - - has: function (name) { - return this.resizerManger[name] != null; - }, - - remove: function (name) { - if (!this.has(name)) { - return this; - } - delete this.resizerManger[name]; - return this; - } -});/** - * tooltip控制器 - * 控制tooltip的显示, 且页面中只有一个tooltip显示 - * - * Created by GUY on 2015/9/8. - * @class BI.TooltipsController - * @extends BI.Controller - */ -BI.TooltipsController = BI.inherit(BI.Controller, { - _defaultConfig: function () { - return BI.extend(BI.TooltipsController.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _const: { - height: 20 - }, - - _init: function () { - BI.TooltipsController.superclass._init.apply(this, arguments); - this.tooltipsManager = {}; - this.showingTips = {};//存储正在显示的tooltip - }, - - _createTooltip: function (text, level) { - return BI.createWidget({ - type: "bi.tooltip", - text: text, - level: level, - stopEvent: true, - height: this._const.height - }); - }, - - hide: function (name, callback) { - if (!this.has(name)) { - return this; - } - delete this.showingTips[name]; - this.get(name).element.hide(0, callback); - this.get(name).invisible(); - return this; - }, - - create: function (name, text, level, context) { - if (!this.has(name)) { - var tooltip = this._createTooltip(text, level); - this.add(name, tooltip); - BI.createWidget({ - type: "bi.absolute", - element: context || "body", - items: [{ - el: tooltip - }] - }); - tooltip.invisible(); - } - return this.get(name); - }, - - //opt: {container: '', belowMouse: false} - show: function (e, name, text, level, context, opt) { - opt || (opt = {}); - var self = this; - BI.each(this.showingTips, function (i, tip) { - self.hide(i); - }); - this.showingTips = {}; - if (!this.has(name)) { - this.create(name, text, level, opt.container || context); - } - - var offset = context.element.offset(); - var bounds = context.element.bounds(); - - var top = offset.top + bounds.height + 5; - var tooltip = this.get(name); - tooltip.setText(text); - tooltip.element.css({ - left: "0px", - top: "0px" - }); - tooltip.visible(); - tooltip.element.height(tooltip.element[0].scrollHeight); - this.showingTips[name] = true; - var x = e.pageX || e.clientX, y = (e.pageY || e.clientY) + 15; - if (x + tooltip.element.outerWidth() > $("body").outerWidth()) { - x -= tooltip.element.outerWidth(); - } - if (y + tooltip.element.outerHeight() > $("body").outerHeight()) { - y -= tooltip.element.outerHeight() + 15; - top = offset.top - tooltip.element.outerHeight() - 5; - !opt.belowMouse && (y = Math.min(y, top)); - } else { - !opt.belowMouse && (y = Math.max(y, top)); - } - tooltip.element.css({ - left: x < 0 ? 0 : x + "px", - top: y < 0 ? 0 : y + "px" - }); - tooltip.element.hover(function () { - self.remove(name); - context.element.trigger("mouseleave.title" + context.getName()); - }); - return this; - }, - - add: function (name, bubble) { - if (this.has(name)) { - return this; - } - this.set(name, bubble); - return this; - }, - - get: function (name) { - return this.tooltipsManager[name]; - }, - - set: function (name, bubble) { - this.tooltipsManager[name] = bubble; - }, - - has: function (name) { - return this.tooltipsManager[name] != null; - }, - - remove: function (name) { - if (!this.has(name)) { - return this; - } - this.tooltipsManager[name].destroy(); - delete this.tooltipsManager[name]; - return this; - } -});/** - * - * @class BI.FloatBoxRouter - * @extends BI.WRouter - */ -BI.FloatBoxRouter = BI.inherit(BI.WRouter, { - routes: {}, - - _init: function () { - this.store = {}; - this.views = {}; - }, - - createView: function (url, modelData, viewData, context) { - return BI.Factory.createView(url, this.get(url), modelData || {}, viewData || {}, context) - }, - - open: function (url, modelData, viewData, context, options) { - var self = this, isValid = BI.isKey(modelData); - options || (options = {}); - url = context.rootURL + "/" + url; - var data = void 0; - if (isValid) { - modelData = modelData + "";//避免modelData是数字 - var keys = modelData.split('.'); - BI.each(keys, function (i, k) { - if (i === 0) { - data = context.model.get(k) || {}; - } else { - data = data[k] || {}; - } - }); - data.id = options.id || keys[keys.length - 1]; - } else { - data = modelData; - } - BI.extend(data, options.data); - if (!this.controller) { - this.controller = new BI.FloatBoxController(); - } - if (!this.store[url]) { - this.store[url] = BI.createWidget({ - type: "bi.float_box" - }, options); - var view = this.createView(url, data, viewData, context); - isValid && context.model.addChild(modelData, view.model); - view.listenTo(view.model, "destroy", function () { - self.remove(url, context); - }); - context.on(BI.Events.UNMOUNT, function () { - self.remove(url, context); - }); - this.store[url].populate(view); - this.views[url] = view; - this.controller.add(url, this.store[url]); - context && context.on("end:" + view.cid, function () { - BI.nextTick(function () { - self.close(url); -// view.end(); - (context.listenEnd.apply(context, isValid ? modelData.split('.') : [modelData]) !== false) && context.populate(); - }, 30) - }).on("change:" + view.cid, _.bind(context.notifyParent, context)) - } - this.controller.open(url); - this.views[url].populate(data, options.force || true); - return this; - }, - - close: function (url) { - if (this.controller) { - this.controller.close(url); - } - return this; - }, - - remove: function (url, context) { - url = context.rootURL + "/" + url; - if (this.controller) { - this.controller.remove(url); - delete this.store[url]; - this.views[url] && this.views[url].model.destroy(); - delete this.views[url]; - } - return this; - } -});/** - * 统一绑定事件 - * @type {*|void|Object} - */ -BI.EventList = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.EventList.superclass._defaultConfig.apply(this, arguments), { - event: "click", - callback: BI.emptyFn, - handle: "", - items:[] - }); - }, - - _init : function() { - BI.EventList.superclass._init.apply(this, arguments); - this.populate(this.options.items); - }, - - _getHandle: function(item){ - var handle = this.options.handle ? _.result(item, this.options.handle) : item; - return handle.element || handle; - }, - - populate: function(items){ - var self = this, - event = this.options.event, - callback = this.options.callback; - BI.nextTick(function(){ - BI.each(items, function(i, item){ - var fn = callback(item); - BI.isFunction(fn) && (fn = BI.debounce(fn, BI.EVENT_RESPONSE_TIME, true)); - self._getHandle(item)[event](fn); - }) - }) - - } -});/** - * 统一监听jquery事件 - * @type {*|void|Object} - */ -BI.ListenerList = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.ListenerList.superclass._defaultConfig.apply(this, arguments), { - event: "click", - callback: BI.emptyFn, - items:[] - }); - }, - - _init : function() { - BI.ListenerList.superclass._init.apply(this, arguments); - this.populate(this.options.items); - }, - - _getHandle: function(item){ - var handle = this.options.handle ? _.result(item, this.options.handle) : item; - return handle.element || handle; - }, - - populate: function(items){ - var self = this, - event = this.options.event, - callback = this.options.callback; - BI.nextTick(function(){ - BI.each(items, function(i, item){ - var fn = callback(item); - BI.isFunction(fn) && (fn = BI.debounce(fn, BI.EVENT_RESPONSE_TIME, true)); - self._getHandle(item).on(event, fn); - }) - }) - } -});/** - * Created by GUY on 2015/6/25. - */ -/** - * 统一监听jquery事件 - * @type {*|void|Object} - */ -BI.OffList = BI.inherit(BI.OB, { - _defaultConfig: function() { - return BI.extend(BI.OffList.superclass._defaultConfig.apply(this, arguments), { - event: "click", - items:[] - }); - }, - - _init : function() { - BI.OffList.superclass._init.apply(this, arguments); - this.populate(this.options.items); - }, - - _getHandle: function(item){ - var handle = this.options.handle ? _.result(item, this.options.handle) : item; - return handle.element || handle; - }, - - populate: function(items){ - var self = this, - event = this.options.event; - BI.each(items, function(i, item){ - self._getHandle(item).off(event); - }) - } -});/** - * 事件集合 - * @class BI.Events - */ -_.extend(BI, { - Events: { - - /** - * @static - * @property keydown事件 - */ - KEYDOWN: "_KEYDOWN", - - /** - * @static - * @property 回撤事件 - */ - BACKSPACE: "_BACKSPACE", - - /** - * @static - * @property 空格事件 - */ - SPACE: "_SPACE", - - /** - * @static - * @property 回车事件 - */ - ENTER: "_ENTER", - - /** - * @static - * @property 确定事件 - */ - CONFIRM: '_CONFIRM', - - /** - * @static - * @property 错误事件 - */ - ERROR: '_ERROR', - - /** - * @static - * @property 暂停事件 - */ - PAUSE: '_PAUSE', - - /** - * @static - * @property destroy事件 - */ - DESTROY: '_DESTROY', - - /** - * @static - * @property 取消挂载事件 - */ - UNMOUNT: '_UNMOUNT', - - /** - * @static - * @property 清除选择 - */ - CLEAR: '_CLEAR', - - /** - * @static - * @property 添加数据 - */ - ADD: '_ADD', - - /** - * @static - * @property 正在编辑状态事件 - */ - EDITING: '_EDITING', - - /** - * @static - * @property 空状态事件 - */ - EMPTY: '_EMPTY', - - /** - * @static - * @property 显示隐藏事件 - */ - VIEW: '_VIEW', - - /** - * @static - * @property 窗体改变大小 - */ - RESIZE: "_RESIZE", - - /** - * @static - * @property 编辑前事件 - */ - BEFOREEDIT: '_BEFOREEDIT', - - /** - * @static - * @property 编辑后事件 - */ - AFTEREDIT: '_AFTEREDIT', - - /** - * @static - * @property 开始编辑事件 - */ - STARTEDIT: '_STARTEDIT', - - /** - * @static - * @property 停止编辑事件 - */ - STOPEDIT: '_STOPEDIT', - - /** - * @static - * @property 值改变事件 - */ - CHANGE: '_CHANGE', - - /** - * @static - * @property 下拉弹出菜单事件 - */ - EXPAND: '_EXPAND', - - /** - * @static - * @property 关闭下拉菜单事件 - */ - COLLAPSE: '_COLLAPSE', - - /** - * @static - * @property 回调事件 - */ - CALLBACK: '_CALLBACK', - - /** - * @static - * @property 点击事件 - */ - CLICK: '_CLICK', - - /** - * @static - * @property 状态改变事件,一般是用在复选按钮和单选按钮 - */ - STATECHANGE: '_STATECHANGE', - - /** - * @static - * @property 状态改变前事件 - */ - BEFORESTATECHANGE: '_BEFORESTATECHANGE', - - - /** - * @static - * @property 初始化事件 - */ - INIT: '_INIT', - - /** - * @static - * @property 初始化后事件 - */ - AFTERINIT: '_AFTERINIT', - - /** - * @static - * @property 滚动条滚动事件 - */ - SCROLL: '_SCROLL', - - - /** - * @static - * @property 开始加载事件 - */ - STARTLOAD: '_STARTLOAD', - - /** - * @static - * @property 加载后事件 - */ - AFTERLOAD: '_AFTERLOAD', - - - /** - * @static - * @property 提交前事件 - */ - BS: 'beforesubmit', - - /** - * @static - * @property 提交后事件 - */ - AS: 'aftersubmit', - - /** - * @static - * @property 提交完成事件 - */ - SC: 'submitcomplete', - - /** - * @static - * @property 提交失败事件 - */ - SF: 'submitfailure', - - /** - * @static - * @property 提交成功事件 - */ - SS: 'submitsuccess', - - /** - * @static - * @property 校验提交前事件 - */ - BVW: 'beforeverifywrite', - - /** - * @static - * @property 校验提交后事件 - */ - AVW: 'afterverifywrite', - - /** - * @static - * @property 校验后事件 - */ - AV: 'afterverify', - - /** - * @static - * @property 填报前事件 - */ - BW: 'beforewrite', - - /** - * @static - * @property 填报后事件 - */ - AW: 'afterwrite', - - /** - * @static - * @property 填报成功事件 - */ - WS: 'writesuccess', - - /** - * @static - * @property 填报失败事件 - */ - WF: 'writefailure', - - /** - * @static - * @property 添加行前事件 - */ - BA: 'beforeappend', - - /** - * @static - * @property 添加行后事件 - */ - AA: 'afterappend', - - /** - * @static - * @property 删除行前事件 - */ - BD: 'beforedelete', - - /** - * @static - * @property 删除行后事件 - */ - AD: 'beforedelete', - - /** - * @static - * @property 未提交离开事件 - */ - UC: 'unloadcheck', - - - /** - * @static - * @property PDF导出前事件 - */ - BTOPDF: 'beforetopdf', - - /** - * @static - * @property PDF导出后事件 - */ - ATOPDF: 'aftertopdf', - - /** - * @static - * @property Excel导出前事件 - */ - BTOEXCEL: 'beforetoexcel', - - /** - * @static - * @property Excel导出后事件 - */ - ATOEXCEL: 'aftertoexcel', - - /** - * @static - * @property Word导出前事件 - */ - BTOWORD: 'beforetoword', - - /** - * @static - * @property Word导出后事件 - */ - ATOWORD: 'aftertoword', - - /** - * @static - * @property 图片导出前事件 - */ - BTOIMAGE: 'beforetoimage', - - /** - * @static - * @property 图片导出后事件 - */ - ATOIMAGE: 'aftertoimage', - - /** - * @static - * @property HTML导出前事件 - */ - BTOHTML: 'beforetohtml', - - /** - * @static - * @property HTML导出后事件 - */ - ATOHTML: 'aftertohtml', - - /** - * @static - * @property Excel导入前事件 - */ - BIMEXCEL: 'beforeimportexcel', - - /** - * @static - * @property Excel导出后事件 - */ - AIMEXCEL: 'afterimportexcel', - - /** - * @static - * @property PDF打印前事件 - */ - BPDFPRINT: 'beforepdfprint', - - /** - * @static - * @property PDF打印后事件 - */ - APDFPRINT: 'afterpdfprint', - - /** - * @static - * @property Flash打印前事件 - */ - BFLASHPRINT: 'beforeflashprint', - - /** - * @static - * @property Flash打印后事件 - */ - AFLASHPRINT: 'afterflashprint', - - /** - * @static - * @property Applet打印前事件 - */ - BAPPLETPRINT: 'beforeappletprint', - - /** - * @static - * @property Applet打印后事件 - */ - AAPPLETPRINT: 'afterappletprint', - - /** - * @static - * @property 服务器打印前事件 - */ - BSEVERPRINT: 'beforeserverprint', - - /** - * @static - * @property 服务器打印后事件 - */ - ASERVERPRINT: 'afterserverprint', - - /** - * @static - * @property 邮件发送前事件 - */ - BEMAIL: 'beforeemail', - - /** - * @static - * @property 邮件发送后事件 - */ - AEMAIL: 'afteremail' - } -});/** - * guy - * 最基础的dom操作 - */ -BI.extend(jQuery.fn, { - - destroy: function () { - this.remove(); - if (BI.isIE() === true) { - this[0].outerHTML = ''; - } - }, - /** - * 高亮显示 - * @param text 必需 - * @param keyword - * @param py 必需 - * @returns {*} - * @private - */ - __textKeywordMarked__: function (text, keyword, py) { - if (!BI.isKey(keyword) || (text + "").length > 100) { - return this.text((text + "").replaceAll(" ", " ")); - } - keyword = keyword + ""; - keyword = BI.toUpperCase(keyword); - var textLeft = (text || "") + ""; - py = (py || BI.makeFirstPY(text)) + ""; - if (py != null) { - py = BI.toUpperCase(py); - } - this.empty(); - while (true) { - var tidx = BI.toUpperCase(textLeft).indexOf(keyword); - var pidx = null; - if (py != null) { - pidx = py.indexOf(keyword); - if (pidx >= 0) { - pidx = pidx % text.length; - } - } - - if (tidx >= 0) { - this.append(textLeft.substr(0, tidx)); - this.append($("<span>").addClass("bi-keyword-red-mark") - .text(textLeft.substr(tidx, keyword.length).replaceAll(" ", " "))); - - textLeft = textLeft.substr(tidx + keyword.length); - if (py != null) { - py = py.substr(tidx + keyword.length); - } - } else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) { - this.append(textLeft.substr(0, pidx)); - this.append($("<span>").addClass("bi-keyword-red-mark") - .text(textLeft.substr(pidx, keyword.length).replaceAll(" ", " "))); - if (py != null) { - py = py.substr(pidx + keyword.length); - } - textLeft = textLeft.substr(pidx + keyword.length); - } else { - this.append(textLeft); - break; - } - } - - return this; - }, - - getDomHeight: function (parent) { - var clone = $(this).clone(); - clone.appendTo($(parent || "body")); - var height = clone.height(); - clone.remove(); - return height; - }, - - //是否有竖直滚动条 - hasVerticalScroll: function () { - return this.height() > 0 && this[0].clientWidth < this[0].offsetWidth; - }, - - //是否有水平滚动条 - hasHorizonScroll: function () { - return this.width() > 0 && this[0].clientHeight < this[0].offsetHeight; - }, - - //获取计算后的样式 - getStyle: function (name) { - var node = this[0]; - var computedStyle = void 0; - - // W3C Standard - if (window.getComputedStyle) { - // In certain cases such as within an iframe in FF3, this returns null. - computedStyle = window.getComputedStyle(node, null); - if (computedStyle) { - return computedStyle.getPropertyValue(BI.hyphenate(name)); - } - } - // Safari - if (document.defaultView && document.defaultView.getComputedStyle) { - computedStyle = document.defaultView.getComputedStyle(node, null); - // A Safari bug causes this to return null for `display: none` elements. - if (computedStyle) { - return computedStyle.getPropertyValue(BI.hyphenate(name)); - } - if (name === 'display') { - return 'none'; - } - } - // Internet Explorer - if (node.currentStyle) { - if (name === 'float') { - return node.currentStyle.cssFloat || node.currentStyle.styleFloat; - } - return node.currentStyle[BI.camelize(name)]; - } - return node.style && node.style[BI.camelize(name)]; - }, - - __isMouseInBounds__: function (e) { - var offset2Body = this.offset(); - return !(e.pageX < offset2Body.left || e.pageX > offset2Body.left + this.outerWidth() - || e.pageY < offset2Body.top || e.pageY > offset2Body.top + this.outerHeight()) - }, - - __hasZIndexMask__: function (zindex) { - return zindex && this.zIndexMask[zindex] != null; - }, - - __buildZIndexMask__: function (zindex, domArray) { - this.zIndexMask = this.zIndexMask || {};//存储z-index的mask - this.indexMask = this.indexMask || [];//存储mask - var mask = BI.createWidget({ - type: "bi.center_adapt", - cls: "bi-z-index-mask", - items: domArray - }); - - mask.element.css({"z-index": zindex}); - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: mask, - left: 0, - right: 0, - top: 0, - bottom: 0 - }] - }); - this.indexMask.push(mask); - zindex && (this.zIndexMask[zindex] = mask); - return mask.element; - }, - - __releaseZIndexMask__: function (zindex) { - if (zindex && this.zIndexMask[zindex]) { - this.indexMask.remove(this.zIndexMask[zindex]); - this.zIndexMask[zindex].destroy(); - return; - } - this.indexMask = this.indexMask || []; - var indexMask = this.indexMask.pop(); - indexMask && indexMask.destroy(); - } -}); - -BI.extend(jQuery, { - - getLeftPosition: function (combo, popup, extraWidth) { - return { - left: combo.element.offset().left - popup.element.outerWidth() - (extraWidth || 0) - }; - }, - - getRightPosition: function (combo, popup, extraWidth) { - var el = combo.element; - return { - left: el.offset().left + el.outerWidth() + (extraWidth || 0) - } - }, - - getTopPosition: function (combo, popup, extraHeight) { - return { - top: combo.element.offset().top - popup.element.outerHeight() - (extraHeight || 0) - }; - }, - - getBottomPosition: function (combo, popup, extraHeight) { - var el = combo.element; - return { - top: el.offset().top + el.outerHeight() + (extraHeight || 0) - }; - }, - - isLeftSpaceEnough: function (combo, popup, extraWidth) { - return $.getLeftPosition(combo, popup, extraWidth).left >= 0; - }, - - isRightSpaceEnough: function (combo, popup, extraWidth) { - var viewBounds = popup.element.bounds(), windowBounds = $("body").bounds(); - return $.getRightPosition(combo, popup, extraWidth).left + viewBounds.width <= windowBounds.width; - }, - - isTopSpaceEnough: function (combo, popup, extraHeight) { - return $.getTopPosition(combo, popup, extraHeight).top >= 0; - }, - - isBottomSpaceEnough: function (combo, popup, extraHeight) { - var viewBounds = popup.element.bounds(), windowBounds = $("body").bounds(); - return $.getBottomPosition(combo, popup, extraHeight).top + viewBounds.height <= windowBounds.height; - }, - - isRightSpaceLarger: function (combo) { - var windowBounds = $("body").bounds(); - return windowBounds.width - combo.element.offset().left - combo.element.bounds().width >= combo.element.offset().left; - }, - - isBottomSpaceLarger: function (combo) { - var windowBounds = $("body").bounds(); - return windowBounds.height - combo.element.offset().top - combo.element.bounds().height >= combo.element.offset().top; - }, - - getLeftAlignPosition: function (combo, popup, extraWidth) { - var viewBounds = popup.element.bounds(), windowBounds = $("body").bounds(); - var left = combo.element.offset().left + extraWidth; - if (left + viewBounds.width > windowBounds.width) { - left = windowBounds.width - viewBounds.width; - } - if (left < 0) { - left = 0; - } - return { - left: left - } - }, - - getLeftAdaptPosition: function (combo, popup, extraWidth) { - if ($.isLeftSpaceEnough(combo, popup, extraWidth)) { - return $.getLeftPosition(combo, popup, extraWidth); - } - return { - left: 0 - } - }, - - getRightAlignPosition: function (combo, popup, extraWidth) { - var comboBounds = combo.element.bounds(), viewBounds = popup.element.bounds(); - var left = combo.element.offset().left + comboBounds.width - viewBounds.width - extraWidth; - if (left < 0) { - left = 0; - } - return { - left: left - } - }, - - getRightAdaptPosition: function (combo, popup, extraWidth) { - if ($.isRightSpaceEnough(combo, popup, extraWidth)) { - return $.getRightPosition(combo, popup, extraWidth); - } - return { - left: $("body").bounds().width - popup.element.bounds().width - } - }, - - getTopAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { - var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = $("body").bounds(); - var top, adaptHeight; - if ($.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { - top = comboOffset.top + extraHeight; - } else if (needAdaptHeight) { - top = comboOffset.top + extraHeight; - adaptHeight = windowBounds.height - top; - } else { - top = windowBounds.height - popupBounds.height; - if (top < extraHeight) { - adaptHeight = windowBounds.height - extraHeight; - } - } - if (top < extraHeight) { - top = extraHeight; - } - return adaptHeight ? { - top: top, - adaptHeight: adaptHeight - } : { - top: top - } - }, - - getTopAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { - var popupBounds = popup.element.bounds(), windowBounds = $("body").bounds(); - if ($.isTopSpaceEnough(combo, popup, extraHeight)) { - return $.getTopPosition(combo, popup, extraHeight); - } - if (needAdaptHeight) { - return { - top: 0, - adaptHeight: combo.element.offset().top - extraHeight - } - } - if (popupBounds.height + extraHeight > windowBounds.height) { - return { - top: 0, - adaptHeight: windowBounds.height - extraHeight - } - } - return { - top: 0 - } - }, - - getBottomAlignPosition: function (combo, popup, extraHeight, needAdaptHeight) { - var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = $("body").bounds(); - var top, adaptHeight; - if ($.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { - top = comboOffset.top + comboBounds.height - popupBounds.height - extraHeight; - } else if (needAdaptHeight) { - top = 0; - adaptHeight = comboOffset.top + comboBounds.height - extraHeight; - } else { - top = 0; - if (popupBounds.height + extraHeight > windowBounds.height) { - adaptHeight = windowBounds.height - extraHeight; - } - } - if (top < 0) { - top = 0; - } - return adaptHeight ? { - top: top, - adaptHeight: adaptHeight - } : { - top: top - } - }, - - getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { - var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = $("body").bounds(); - if ($.isBottomSpaceEnough(combo, popup, extraHeight)) { - return $.getBottomPosition(combo, popup, extraHeight); - } - if (needAdaptHeight) { - return { - top: comboOffset.top + comboBounds.height + extraHeight, - adaptHeight: windowBounds.height - comboOffset.top - comboBounds.height - extraHeight - } - } - if (popupBounds.height + extraHeight > windowBounds.height) { - return { - top: extraHeight, - adaptHeight: windowBounds.height - extraHeight - } - } - return { - top: windowBounds.height - popupBounds.height - extraHeight - } - }, - - getCenterAdaptPosition: function (combo, popup) { - var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = $("body").bounds(); - var left; - if (comboOffset.left + comboBounds.width / 2 + popupBounds.width / 2 > windowBounds.width) { - left = windowBounds.width - popupBounds.width; - } else { - left = comboOffset.left + comboBounds.width / 2 - popupBounds.width / 2; - } - if (left < 0) { - left = 0; - } - return { - left: left - } - }, - - getMiddleAdaptPosition: function (combo, popup) { - var comboOffset = combo.element.offset(); - var comboBounds = combo.element.bounds(), popupBounds = popup.element.bounds(), - windowBounds = $("body").bounds(); - var top; - if (comboOffset.top + comboBounds.height / 2 + popupBounds.height / 2 > windowBounds.height) { - top = windowBounds.height - popupBounds.height; - } else { - top = comboOffset.top + comboBounds.height / 2 - popupBounds.height / 2; - } - if (top < 0) { - top = 0; - } - return { - top: top - } - }, - - getComboPositionByDirections: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions) { - extraWidth || (extraWidth = 0); - extraHeight || (extraHeight = 0); - var i, direct; - var leftRight = [], topBottom = []; - var isNeedAdaptHeight = false, tbFirst = false, lrFirst = false; - var left, top, pos; - for (i = 0; i < directions.length; i++) { - direct = directions[i]; - switch (direct) { - case "left": - leftRight.push(direct); - break; - case "right": - leftRight.push(direct); - break; - case "top": - topBottom.push(direct); - break; - case "bottom": - topBottom.push(direct); - break; - } - } - for (i = 0; i < directions.length; i++) { - direct = directions[i]; - switch (direct) { - case "left": - if (!isNeedAdaptHeight) { - var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? 0 : extraHeight; - if ($.isLeftSpaceEnough(combo, popup, tW)) { - left = $.getLeftPosition(combo, popup, tW).left; - if (topBottom[0] === "bottom") { - pos = $.getTopAlignPosition(combo, popup, tH, needAdaptHeight); - pos.dir = "left,bottom"; - } else { - pos = $.getBottomAlignPosition(combo, popup, tH, needAdaptHeight); - pos.dir = "left,top"; - } - if (tbFirst) { - pos.change = "left"; - } - pos.left = left; - return pos; - } - } - lrFirst = true; - break; - case "right": - if (!isNeedAdaptHeight) { - var tW = tbFirst ? extraHeight : extraWidth, tH = tbFirst ? extraWidth : extraHeight; - if ($.isRightSpaceEnough(combo, popup, tW)) { - left = $.getRightPosition(combo, popup, tW).left; - if (topBottom[0] === "bottom") { - pos = $.getTopAlignPosition(combo, popup, tH, needAdaptHeight); - pos.dir = "right,bottom"; - } else { - pos = $.getBottomAlignPosition(combo, popup, tH, needAdaptHeight); - pos.dir = "right,top"; - } - if (tbFirst) { - pos.change = "right"; - } - pos.left = left; - return pos; - } - } - lrFirst = true; - break; - case "top": - var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight; - if ($.isTopSpaceEnough(combo, popup, tH)) { - top = $.getTopPosition(combo, popup, tH).top; - if (leftRight[0] === "right") { - pos = $.getLeftAlignPosition(combo, popup, tW, needAdaptHeight); - pos.dir = "top,right"; - } else { - pos = $.getRightAlignPosition(combo, popup, tW); - pos.dir = "top,left"; - } - if (lrFirst) { - pos.change = "top"; - } - pos.top = top; - return pos; - } - if (needAdaptHeight) { - isNeedAdaptHeight = true; - } - tbFirst = true; - break; - case "bottom": - var tW = lrFirst ? extraHeight : extraWidth, tH = lrFirst ? extraWidth : extraHeight; - if ($.isBottomSpaceEnough(combo, popup, tH)) { - top = $.getBottomPosition(combo, popup, tH).top; - if (leftRight[0] === "right") { - pos = $.getLeftAlignPosition(combo, popup, tW, needAdaptHeight); - pos.dir = "bottom,right"; - } else { - pos = $.getRightAlignPosition(combo, popup, tW); - pos.dir = "bottom,left"; - } - if (lrFirst) { - pos.change = "bottom"; - } - pos.top = top; - return pos; - } - if (needAdaptHeight) { - isNeedAdaptHeight = true; - } - tbFirst = true; - break; - } - } - - switch (directions[0]) { - case "left": - case "right": - if ($.isRightSpaceLarger(combo)) { - left = $.getRightAdaptPosition(combo, popup, extraWidth).left; - } else { - left = $.getLeftAdaptPosition(combo, popup, extraWidth).left; - } - if (topBottom[0] === "bottom") { - pos = $.getTopAlignPosition(combo, popup, extraHeight, needAdaptHeight); - pos.left = left; - pos.dir = directions[0] + ",bottom"; - return pos; - } - pos = $.getBottomAlignPosition(combo, popup, extraHeight, needAdaptHeight); - pos.left = left; - pos.dir = directions[0] + ",top"; - return pos; - default : - if ($.isBottomSpaceLarger(combo)) { - pos = $.getBottomAdaptPosition(combo, popup, extraHeight, needAdaptHeight); - } else { - pos = $.getTopAdaptPosition(combo, popup, extraHeight, needAdaptHeight); - } - if (leftRight[0] === "right") { - left = $.getLeftAlignPosition(combo, popup, extraWidth, needAdaptHeight).left; - pos.left = left; - pos.dir = directions[0] + ",right"; - return pos; - } - left = $.getRightAlignPosition(combo, popup, extraWidth).left; - pos.left = left; - pos.dir = directions[0] + ",left"; - return pos; - } - }, - - - getComboPosition: function (combo, popup, extraWidth, extraHeight, needAdaptHeight, directions, offsetStyle) { - extraWidth || (extraWidth = 0); - extraHeight || (extraHeight = 0); - var bodyHeight = $("body").bounds().height - extraHeight; - var maxHeight = Math.min(popup.attr("maxHeight") || bodyHeight, bodyHeight); - popup.resetHeight && popup.resetHeight(maxHeight); - var position = $.getComboPositionByDirections(combo, popup, extraWidth, extraHeight, needAdaptHeight, directions || ['bottom', 'top', 'right', 'left']); - switch (offsetStyle) { - case "center": - if (position.change) { - var p = $.getMiddleAdaptPosition(combo, popup); - position.top = p.top; - } else { - var p = $.getCenterAdaptPosition(combo, popup); - position.left = p.left; - } - break; - case "middle": - if (position.change) { - var p = $.getCenterAdaptPosition(combo, popup); - position.left = p.left; - } else { - var p = $.getMiddleAdaptPosition(combo, popup); - position.top = p.top; - } - break; - } - if (needAdaptHeight === true) { - popup.resetHeight && popup.resetHeight(Math.min(bodyHeight - position.top, maxHeight)); - } - return position; - } -});/** - * 基本的函数 - * Created by GUY on 2015/6/24. - */ -BI.Func = {}; -BI.extend(BI.Func, { - - /** - * 获取搜索结果 - * @param items - * @param keyword - * @param param 搜索哪个属性 - */ - getSearchResult: function (items, keyword, param) { - var isArray = BI.isArray(items); - items = isArray ? BI.flatten(items) : items; - param || (param = "text"); - if (!BI.isKey(keyword)) { - return { - finded: BI.deepClone(items), - matched: isArray ? [] : {} - }; - } - var t, text, py; - keyword = BI.toUpperCase(keyword); - var matched = isArray ? [] : {}, finded = isArray ? [] : {}; - BI.each(items, function (i, item) { - item = BI.deepClone(item); - t = BI.stripEL(item); - text = t[param] || t.text || t.value || t.name || t; - py = BI.makeFirstPY(text); - text = BI.toUpperCase(text); - py = BI.toUpperCase(py); - var pidx; - if (text.indexOf(keyword) > -1) { - if (text === keyword) { - isArray ? matched.push(item) : (matched[i] = item); - } else { - isArray ? finded.push(item) : (finded[i] = item); - } - } else if (pidx = py.indexOf(keyword), (pidx > -1 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length))) { - if (text === keyword || keyword.length === text.length) { - isArray ? matched.push(item) : (matched[i] = item); - } else { - isArray ? finded.push(item) : (finded[i] = item); - } - } - }); - return { - matched: matched, - finded: finded - } - }, -}); - -/** - * 对DOM操作的通用函数 - * @type {{}} - */ -BI.DOM = {}; -BI.extend(BI.DOM, { - - /** - * 把dom数组或元素悬挂起来,使其不对html产生影响 - * @param dom - */ - hang: function (doms) { - if (BI.isEmpty(doms)) { - return; - } - var frag = document.createDocumentFragment(); - BI.each(doms, function (i, dom) { - dom instanceof BI.Widget && (dom = dom.element); - dom instanceof $ && dom[0] && frag.appendChild(dom[0]); - }); - return frag; - }, - - isExist: function (obj) { - return $("body").find(obj.element).length > 0; - }, - - //预加载图片 - preloadImages: function (srcArray, onload) { - var count = 0, images = []; - - function complete() { - count++; - if (count >= srcArray.length) { - onload(); - } - } - - BI.each(srcArray, function (i, src) { - images[i] = new Image(); - images[i].src = src; - images[i].onload = function () { - complete() - }; - images[i].onerror = function () { - complete() - }; - }); - }, - - isColor: function (color) { - return color && (this.isRGBColor(color) || this.isHexColor(color)); - }, - - isRGBColor: function (color) { - if (!color) { - return false; - } - return color.substr(0, 3) === "rgb"; - }, - - isHexColor: function (color) { - if (!color) { - return false; - } - return color[0] === "#" && color.length === 7; - }, - - isDarkColor: function (hex) { - if (!hex || !this.isHexColor(hex)) { - return false; - } - var rgb = this.rgb2json(this.hex2rgb(hex)); - var grayLevel = Math.round(rgb.r * 0.299 + rgb.g * 0.587 + rgb.b * 0.114); - if (grayLevel < 192/**网上给的是140**/) { - return true; - } - return false; - }, - - //获取对比颜色 - getContrastColor: function (color) { - if (!color || !this.isColor(color)) { - return ""; - } - if (this.isDarkColor(color)) { - return "#ffffff"; - } - return "#1a1a1a"; - }, - - rgb2hex: function (rgbColour) { - if (!rgbColour || rgbColour.substr(0, 3) != "rgb") { - return ""; - } - var rgbValues = rgbColour.match(/\d+(\.\d+)?/g); - var red = BI.parseInt(rgbValues[0]); - var green = BI.parseInt(rgbValues[1]); - var blue = BI.parseInt(rgbValues[2]); - - var hexColour = "#" + this.int2hex(red) + this.int2hex(green) + this.int2hex(blue); - - return hexColour; - }, - - rgb2json: function (rgbColour) { - if (!rgbColour) { - return {}; - } - if (!this.isRGBColor(rgbColour)) { - return {}; - } - var rgbValues = rgbColour.match(/\d+(\.\d+)?/g); - return { - r: BI.parseInt(rgbValues[0]), - g: BI.parseInt(rgbValues[1]), - b: BI.parseInt(rgbValues[2]) - }; - }, - - rgba2json: function (rgbColour) { - if (!rgbColour) { - return {}; - } - var rgbValues = rgbColour.match(/\d+(\.\d+)?/g); - return { - r: BI.parseInt(rgbValues[0]), - g: BI.parseInt(rgbValues[1]), - b: BI.parseInt(rgbValues[2]), - a: BI.parseFloat(rgbValues[3]) - }; - }, - - json2rgb: function (rgb) { - if (!BI.isKey(rgb.r) || !BI.isKey(rgb.g) || !BI.isKey(rgb.b)) { - return ""; - } - return "rgb(" + rgb.r + "," + rgb.g + "," + rgb.b + ")"; - }, - - json2rgba: function (rgba) { - if (!BI.isKey(rgba.r) || !BI.isKey(rgba.g) || !BI.isKey(rgba.b)) { - return ""; - } - return "rgba(" + rgba.r + "," + rgba.g + "," + rgba.b + "," + rgba.a + ")"; - }, - - int2hex: function (strNum) { - var hexdig = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']; - - return hexdig[strNum >>> 4] + '' + hexdig[strNum & 15]; - }, - - hex2rgb: function (color) { - if (!color) { - return ""; - } - if (!this.isHexColor(color)) { - return color; - } - var tempValue = "rgb(", colorArray; - - if (color.length === 7) { - colorArray = [BI.parseInt('0x' + color.substring(1, 3)), - BI.parseInt('0x' + color.substring(3, 5)), - BI.parseInt('0x' + color.substring(5, 7))]; - } - else if (color.length === 4) { - colorArray = [BI.parseInt('0x' + color.substring(1, 2)), - BI.parseInt('0x' + color.substring(2, 3)), - BI.parseInt('0x' + color.substring(3, 4))]; - } - tempValue += colorArray[0] + ","; - tempValue += colorArray[1] + ","; - tempValue += colorArray[2] + ")"; - - return tempValue; - }, - - rgba2rgb: function (rgbColour, BGcolor) { - if (BI.isNull(BGcolor)) { - BGcolor = 1; - } - if (rgbColour.substr(0, 4) != "rgba") { - return ""; - } - var rgbValues = rgbColour.match(/\d+(\.\d+)?/g); - if (rgbValues.length < 4) { - return ""; - } - var R = BI.parseFloat(rgbValues[0]); - var G = BI.parseFloat(rgbValues[1]); - var B = BI.parseFloat(rgbValues[2]); - var A = BI.parseFloat(rgbValues[3]); - - return "rgb(" + Math.floor(255 * (BGcolor * (1 - A )) + R * A) + "," + - Math.floor(255 * (BGcolor * (1 - A )) + G * A) + "," + - Math.floor(255 * (BGcolor * (1 - A )) + B * A) + ")"; - }, - - getTextSizeWidth: function (text, fontSize) { - var span = $("<span></span>").addClass("text-width-span").appendTo($("body")); - - if (fontSize == null) { - fontSize = 12; - } - fontSize = fontSize + "px"; - - span.css("font-size", fontSize).text(text); - - var width = span.width(); - span.remove(); - - return width; - }, - - //获取滚动条的宽度 - getScrollWidth: function () { - if (this._scrollWidth == null) { - var ul = $("<div>").width(50).height(50).css({ - position: "absolute", - top: "-9999px", - overflow: "scroll" - }).appendTo($("body")); - this._scrollWidth = ul[0].offsetWidth - ul[0].clientWidth; - ul.destroy(); - } - return this._scrollWidth; - } -});/** - * guy - * 检测某个Widget的EventChange事件然后去show某个card - * @type {*|void|Object} - * @class BI.ShowListener - * @extends BI.OB - */ -BI.ShowListener = BI.inherit(BI.OB, { - _defaultConfig: function () { - return BI.extend(BI.ShowListener.superclass._defaultConfig.apply(this, arguments), { - eventObj: BI.createWidget(), - cardLayout: null, - cardNameCreator: function (v) { - return v; - }, - cardCreator: BI.emptyFn, - afterCardCreated: BI.emptyFn, - afterCardShow: BI.emptyFn - }); - }, - - _init: function () { - BI.ShowListener.superclass._init.apply(this, arguments); - var self = this, o = this.options; - o.eventObj.on(BI.Controller.EVENT_CHANGE, function (type, v, ob) { - if (type === BI.Events.CLICK) { - v = v || o.eventObj.getValue(); - v = BI.isArray(v) ? (v.length > 1 ? v.toString() : v[0]) : v; - if (BI.isNull(v)) { - throw new Error("value cannot be null"); - } - var cardName = o.cardNameCreator(v); - if (!o.cardLayout.isCardExisted(cardName)) { - var card = o.cardCreator(cardName); - o.cardLayout.addCardByName(cardName, card); - o.afterCardCreated(cardName); - } - o.cardLayout.showCardByName(cardName); - BI.nextTick(function () { - o.afterCardShow(cardName); - self.fireEvent(BI.ShowListener.EVENT_CHANGE, cardName); - }); - } - }) - } -}); -BI.ShowListener.EVENT_CHANGE = "ShowListener.EVENT_CHANGE";/** - * style加载管理器 - * - * Created by GUY on 2015/9/7. - * @class - */ -BI.StyleLoaderManager = BI.inherit(BI.OB, { - _defaultConfig: function () { - return BI.extend(BI.StyleLoaderManager.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.StyleLoaderManager.superclass._init.apply(this, arguments); - this.stylesManager = {}; - }, - - loadStyle: function (name, styleString) { - var d = document, styles = d.createElement('style'); - d.getElementsByTagName('head')[0].appendChild(styles); - styles.setAttribute('type', 'text/css'); - if (styles.styleSheet) { - styles.styleSheet.cssText = styleString; - } else { - styles.appendChild(document.createTextNode(styleString)); - } - this.stylesManager[name] = styles; - - return this; - }, - - get: function (name) { - return this.stylesManager[name]; - }, - - has: function (name) { - return this.stylesManager[name] != null; - }, - - removeStyle: function (name) { - if (!this.has(name)) { - return this; - } - this.stylesManager[name].parentNode.removeChild(this.stylesManager[name]); - delete this.stylesManager[name]; - return this; - } -});/** - * @class BI.Logic - * @extends BI.OB - */ -BI.Logic = BI.inherit(BI.OB, { - createLogic: function () { - return this.options || {}; - } -}); - -BI.LogicFactory = { - Type: { - Vertical: "vertical", - Horizontal: "horizontal", - Table: "table", - HorizontalFill: "horizontal_fill" - }, - createLogic: function (key, options) { - var logic; - switch (key) { - case BI.LogicFactory.Type.Vertical: - logic = BI.VerticalLayoutLogic; - break; - case BI.LogicFactory.Type.Horizontal: - logic = BI.HorizontalLayoutLogic; - break; - case BI.LogicFactory.Type.Table: - logic = BI.TableLayoutLogic; - break; - case BI.LogicFactory.Type.HorizontalFill: - logic = BI.HorizontalFillLayoutLogic; - break; - default : - logic = BI.Logic; - break; - } - return new logic(options).createLogic(); - }, - - createLogicTypeByDirection: function (direction) { - switch (direction) { - case BI.Direction.Top: - case BI.Direction.Bottom: - case BI.Direction.Custom: - return BI.LogicFactory.Type.Vertical; - break; - case BI.Direction.Left: - case BI.Direction.Right: - return BI.LogicFactory.Type.Horizontal; - } - }, - - createLogicItemsByDirection: function (direction) { - var layout; - var items = Array.prototype.slice.call(arguments, 1); - items = BI.map(items, function (i, item) { - if (BI.isWidget(item)) { - return { - el: item, - width: item.options.width, - height: item.options.height - } - } - return item; - }); - switch (direction) { - case BI.Direction.Bottom: - layout = BI.LogicFactory.Type.Vertical; - items.reverse(); - break; - case BI.Direction.Right: - layout = BI.LogicFactory.Type.Horizontal; - items.reverse(); - break; - case BI.Direction.Custom: - items = items.slice(1); - break; - } - return items; - } -};/** - * guy - * 上下布局逻辑 - * 上下布局的时候要考虑到是动态布局还是静态布局 - * - * @class BI.VerticalLayoutLogic - * @extends BI.Logic - */ -BI.VerticalLayoutLogic = BI.inherit(BI.Logic, { - _defaultConfig: function () { - return BI.extend(BI.VerticalLayoutLogic.superclass._defaultConfig.apply(this, arguments), { - dynamic: false, - scrollable: null, - scrolly: false, - scrollx: false, - items: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - createLogic: function () { - var layout, o = this.options; - if (o.dynamic) { - layout = "bi.vertical"; - } else { - layout = "bi.vtape"; - } - return { - type: layout, - scrollable: o.scrollable, - scrolly: o.scrolly, - scrollx: o.scrollx, - hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, - items: o.items - } - }, - - _init: function () { - BI.VerticalLayoutLogic.superclass._init.apply(this, arguments); - } -}); - - -/** - * guy - * 左右布局逻辑 - * 左右布局的时候要考虑到是动态布局还是静态布局 - * - * @class BI.HorizontalLayoutLogic - * @extends BI.Logic - */ -BI.HorizontalLayoutLogic = BI.inherit(BI.Logic, { - _defaultConfig: function () { - return BI.extend(BI.HorizontalLayoutLogic.superclass._defaultConfig.apply(this, arguments), { - dynamic: false, - scrollable: null, - scrolly: false, - scrollx: false, - items: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - createLogic: function () { - var layout, o = this.options; - if (o.dynamic) { - layout = "bi.horizontal"; - } else { - layout = "bi.htape"; - } - return { - type: layout, - scrollable: o.scrollable, - scrolly: o.scrolly, - scrollx: o.scrollx, - hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, - items: o.items - } - }, - - _init: function () { - BI.HorizontalLayoutLogic.superclass._init.apply(this, arguments); - } -}); - -/** - * guy - * 表格布局逻辑 - * 表格布局的时候要考虑到是动态布局还是静态布局 - * - * @class BI.TableLayoutLogic - * @extends BI.OB - */ -BI.TableLayoutLogic = BI.inherit(BI.Logic, { - _defaultConfig: function () { - return BI.extend(BI.TableLayoutLogic.superclass._defaultConfig.apply(this, arguments), { - dynamic: false, - scrollable: null, - scrolly: false, - scrollx: false, - columns: 0, - rows: 0, - columnSize: [], - rowSize: [], - hgap: 0, - vgap: 0, - items: [] - }); - }, - - createLogic: function () { - var layout, o = this.options; - if (o.dynamic) { - layout = "bi.table"; - } else { - layout = "bi.window"; - } - return { - type: layout, - scrollable: o.scrollable, - scrolly: o.scrolly, - scrollx: o.scrollx, - columns: o.columns, - rows: o.rows, - columnSize: o.columnSize, - rowSize: o.rowSize, - hgap: o.hgap, - vgap: o.vgap, - items: o.items - } - }, - - _init: function () { - BI.TableLayoutLogic.superclass._init.apply(this, arguments); - } -}); - -/** - * guy - * 左右充满布局逻辑 - * - * @class BI.HorizontalFillLayoutLogic - * @extends BI.Logic - */ -BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, { - _defaultConfig: function () { - return BI.extend(BI.HorizontalFillLayoutLogic.superclass._defaultConfig.apply(this, arguments), { - dynamic: false, - scrollable: null, - scrolly: false, - scrollx: false, - items: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - createLogic: function () { - var layout, o = this.options; - var columnSize = []; - BI.each(o.items, function (i, item) { - columnSize.push(item.width || 0); - }); - if (o.dynamic) { - layout = "bi.horizontal_adapt"; - } else { - layout = "bi.htape"; - } - return { - type: layout, - columnSize: columnSize, - scrollable: o.scrollable, - scrolly: o.scrolly, - scrollx: o.scrollx, - hgap: o.hgap, - vgap: o.vgap, - lgap: o.lgap, - rgap: o.rgap, - tgap: o.tgap, - bgap: o.bgap, - items: o.items - } - }, - - _init: function () { - BI.HorizontalFillLayoutLogic.superclass._init.apply(this, arguments); - } -});BI.Plugin = BI.Plugin || {}; -; -(function () { - var _WidgetsPlugin = {}; - var _ObjectPlugin = {}; - BI.extend(BI.Plugin, { - - getWidget: function (type, options) { - if (_WidgetsPlugin[type]) { - var res; - for (var i = _WidgetsPlugin[type].length-1; i >=0; i--) { - if (res = _WidgetsPlugin[type][i](options)) { - return res; - } - } - } - return options; - }, - - registerWidget: function (type, fn) { - if (!_WidgetsPlugin[type]) { - _WidgetsPlugin[type] = []; - } - if (_WidgetsPlugin[type].length > 0) { - console.log("组件已经注册过了!"); - } - _WidgetsPlugin[type].push(fn); - }, - - relieveWidget: function (type) { - delete _WidgetsPlugin[type]; - }, - - getObject: function (type, object) { - if (_ObjectPlugin[type]) { - var res; - for (var i = 0, len = _ObjectPlugin[type].length; i < len; i++) { - res = _ObjectPlugin[type][i](object); - } - } - return res || object; - }, - - registerObject: function (type, fn) { - if (!_ObjectPlugin[type]) { - _ObjectPlugin[type] = []; - } - if (_ObjectPlugin[type].length > 0) { - console.log("对象已经注册过了!"); - } - _ObjectPlugin[type].push(fn); - }, - - relieveObject: function (type) { - delete _ObjectPlugin[type]; - } - }); -})();/** - * 对数组对象的扩展 - * @class Array - */ -$.extend(Array.prototype, { - contains: function (o) { - return this.indexOf(o) > -1; - }, - - /** - * 从数组中移除指定的值,如果值不在数组中,则不产生任何效果 - * @param {Object} o 要移除的值 - * @return {Array} 移除制定值后的数组 - */ - remove: function (o) { - var index = this.indexOf(o); - if (index !== -1) { - this.splice(index, 1); - } - return this; - }, - - pushArray: function (array) { - for (var i = 0; i < array.length; i++) { - this.push(array[i]); - } - }, - pushDistinct: function (obj) { - if (!this.contains(obj)) { - this.push(obj); - } - }, - pushDistinctArray: function (array) { - for (var i = 0, len = array.length; i < len; i++) { - this.pushDistinct(array[i]); - } - } -}); - -BI.Cache = { - _prefix: "bi", - setUsername: function (username) { - localStorage.setItem(BI.Cache._prefix + ".username", (username + "" || "").toUpperCase()); - }, - getUsername: function () { - return localStorage.getItem(BI.Cache._prefix + ".username") || ""; - }, - _getKeyPrefix: function () { - return BI.Cache.getUsername() + "." + BI.Cache._prefix + "."; - }, - _generateKey: function (key) { - return BI.Cache._getKeyPrefix() + (key || ""); - }, - getItem: function (key) { - return localStorage.getItem(BI.Cache._generateKey(key)); - }, - setItem: function (key, value) { - localStorage.setItem(BI.Cache._generateKey(key), value); - }, - removeItem: function (key) { - localStorage.removeItem(BI.Cache._generateKey(key)); - }, - clear: function () { - for (var i = localStorage.length; i >= 0; i--) { - var key = localStorage.key(i); - if (key) { - if (key.indexOf(BI.Cache._getKeyPrefix()) === 0) { - localStorage.removeItem(key); - } - } - } - }, - keys: function () { - var result = []; - for (var i = localStorage.length; i >= 0; i--) { - var key = localStorage.key(i); - if (key) { - var prefix = BI.Cache._getKeyPrefix(); - if (key.indexOf(prefix) === 0) { - result[result.length] = key.substring(prefix.length); - } - } - } - return result; - }, - - addCookie: function (name, value, path, expiresHours) { - var cookieString = name + "=" + escape(value); - // 判断是否设置过期时间 - if (expiresHours && expiresHours > 0) { - var date = new Date(); - date.setTime(date.getTime() + expiresHours * 3600 * 1000); - cookieString = cookieString + "; expires=" + date.toGMTString(); - } - if (path) { - cookieString = cookieString + "; path=" + path; - } - document.cookie = cookieString; - }, - getCookie: function (name) { - var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)"); - if (arr = document.cookie.match(reg)) - return unescape(arr[2]); - else - return null; - }, - deleteCookie: function (name, path) { - var date = new Date(); - date.setTime(date.getTime() - 10000); - var cookieString = name + "=v; expires=" + date.toGMTString(); - if (path) { - cookieString = cookieString + "; path=" + path; - } - document.cookie = cookieString; - } -};// full day names -Date._DN = [BI.i18nText("BI-Basic_Sunday"), - BI.i18nText("BI-Basic_Monday"), - BI.i18nText("BI-Basic_Tuesday"), - BI.i18nText("BI-Basic_Wednesday"), - BI.i18nText("BI-Basic_Thursday"), - BI.i18nText("BI-Basic_Friday"), - BI.i18nText("BI-Basic_Saturday"), - BI.i18nText("BI-Basic_Sunday")]; - -// short day names -Date._SDN = [BI.i18nText("BI-Basic_Simple_Sunday"), - BI.i18nText("BI-Basic_Simple_Monday"), - BI.i18nText("BI-Basic_Simple_Tuesday"), - BI.i18nText("BI-Basic_Simple_Wednesday"), - BI.i18nText("BI-Basic_Simple_Thursday"), - BI.i18nText("BI-Basic_Simple_Friday"), - BI.i18nText("BI-Basic_Simple_Saturday"), - BI.i18nText("BI-Basic_Simple_Sunday")]; - -// Monday first, etc. -Date._FD = 1; - -// full month namesdat -Date._MN = [ - BI.i18nText("BI-Basic_January"), - BI.i18nText("BI-Basic_February"), - BI.i18nText("BI-Basic_March"), - BI.i18nText("BI-Basic_April"), - BI.i18nText("BI-Basic_May"), - BI.i18nText("BI-Basic_June"), - BI.i18nText("BI-Basic_July"), - BI.i18nText("BI-Basic_August"), - BI.i18nText("BI-Basic_September"), - BI.i18nText("BI-Basic_October"), - BI.i18nText("BI-Basic_November"), - BI.i18nText("BI-Basic_December")]; - -// short month names -Date._SMN = [0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11]; - -Date._QN = ["", BI.i18nText("BI-Quarter_1"), - BI.i18nText("BI-Quarter_2"), - BI.i18nText("BI-Quarter_3"), - BI.i18nText("BI-Quarter_4")]; - -/** Adds the number of days array to the Date object. */ -Date._MD = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; - -/** Constants used for time computations */ -Date.SECOND = 1000 /* milliseconds */; -Date.MINUTE = 60 * Date.SECOND; -Date.HOUR = 60 * Date.MINUTE; -Date.DAY = 24 * Date.HOUR; -Date.WEEK = 7 * Date.DAY; - -/** - * 获取时区 - * @returns {String} - */ -Date.prototype.getTimezone = function () { - return this.toString().replace(/^.* (?:\((.*)\)|([A-Z]{1,4})(?:[\-+][0-9]{4})?(?: -?\d+)?)$/, "$1$2").replace(/[^A-Z]/g, ""); -}; - -/** Returns the number of days in the current month */ -Date.prototype.getMonthDays = function (month) { - var year = this.getFullYear(); - if (typeof month == "undefined") { - month = this.getMonth(); - } - if (((0 == (year % 4)) && ( (0 != (year % 100)) || (0 == (year % 400)))) && month == 1) { - return 29; - } else { - return Date._MD[month]; - } -}; - -/** Returns the number of day in the year. */ -Date.prototype.getDayOfYear = function () { - var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); - var time = now - then; - return Math.floor(time / Date.DAY); -}; - -/** Returns the number of the week in year, as defined in ISO 8601. */ -Date.prototype.getWeekNumber = function () { - var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var week = d.getDay(); - if (this.getMonth() === 0 && this.getDate() <= week) { - return 1; - } - d.setDate(this.getDate() - week); - var ms = d.valueOf(); // GMT - d.setMonth(0); - d.setDate(1); - var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; - if (d.getDay() > 0) { - offset++; - } - return offset; -}; - -//离当前时间多少天的时间 -Date.prototype.getOffsetDate = function (offset) { - return new Date(this.getTime() + offset * 864e5); -}; - -Date.prototype.getAfterMulQuarter = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() + n * 3); - return dt; -}; -//获得n个季度前的日期 -Date.prototype.getBeforeMulQuarter = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() - n * 3); - return dt; -}; -//得到本季度的起始月份 -Date.prototype.getQuarterStartMonth = function () { - var quarterStartMonth = 0; - var nowMonth = this.getMonth(); - if (nowMonth < 3) { - quarterStartMonth = 0; - } - if (2 < nowMonth && nowMonth < 6) { - quarterStartMonth = 3; - } - if (5 < nowMonth && nowMonth < 9) { - quarterStartMonth = 6; - } - if (nowMonth > 8) { - quarterStartMonth = 9; - } - return quarterStartMonth; -}; -//获得本季度的起始日期 -Date.prototype.getQuarterStartDate = function () { - return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); -}; -//得到本季度的结束日期 -Date.prototype.getQuarterEndDate = function () { - var quarterEndMonth = this.getQuarterStartMonth() + 2; - return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); -}; -Date.prototype.getAfterMultiMonth = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() + n | 0); - return dt; -}; -Date.prototype.getBeforeMultiMonth = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() - n | 0); - return dt; -}; - -Date.prototype.getAfterMulQuarter = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() + n * 3); - return dt; -}; -//获得n个季度前的日期 -Date.prototype.getBeforeMulQuarter = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() - n * 3); - return dt; -}; -//得到本季度的起始月份 -Date.prototype.getQuarterStartMonth = function () { - var quarterStartMonth = 0; - var nowMonth = this.getMonth(); - if (nowMonth < 3) { - quarterStartMonth = 0; - } - if (2 < nowMonth && nowMonth < 6) { - quarterStartMonth = 3; - } - if (5 < nowMonth && nowMonth < 9) { - quarterStartMonth = 6; - } - if (nowMonth > 8) { - quarterStartMonth = 9; - } - return quarterStartMonth; -}; - -//指定日期n个月之前或之后的日期 -Date.prototype.getOffsetMonth = function (n) { - var dt = new Date(this.getTime()); - var day = dt.getDate(); - var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); - if (day > monthDay) { - day = monthDay; - } - dt.setDate(day); - dt.setMonth(dt.getMonth() + parseInt(n)); - return dt; -}; - -//获得本周的起始日期 -Date.prototype.getWeekStartDate = function () { - var w = this.getDay(); - return this.getOffsetDate(-w); -}; -//得到本周的结束日期 -Date.prototype.getWeekEndDate = function () { - var w = this.getDay(); - var offset = (w === 0 ? 6 : 6 - w); - return this.getOffsetDate(offset); -}; - -//获得本季度的起始日期 -Date.prototype.getQuarterStartDate = function () { - return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); -}; -//得到本季度的结束日期 -Date.prototype.getQuarterEndDate = function () { - var quarterEndMonth = this.getQuarterStartMonth() + 2; - return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); -}; -Date.prototype.getAfterMultiMonth = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() + n | 0); - return dt; -}; -Date.prototype.getBeforeMultiMonth = function (n) { - var dt = new Date(this.getTime()); - dt.setMonth(dt.getMonth() - n | 0); - return dt; -}; - -/** Checks date and time equality */ -Date.prototype.equalsTo = function (date) { - return ((this.getFullYear() == date.getFullYear()) && - (this.getMonth() == date.getMonth()) && - (this.getDate() == date.getDate()) && - (this.getHours() == date.getHours()) && - (this.getMinutes() == date.getMinutes()) && - (this.getSeconds() == date.getSeconds())); -}; - -/** Set only the year, month, date parts (keep existing time) */ -Date.prototype.setDateOnly = function (date) { - var tmp = new Date(date); - this.setDate(1); - this.setFullYear(tmp.getFullYear()); - this.setMonth(tmp.getMonth()); - this.setDate(tmp.getDate()); -}; -/** Prints the date in a string according to the given format. */ -Date.prototype.print = function (str) { - var m = this.getMonth(); - var d = this.getDate(); - var y = this.getFullYear(); - var wn = this.getWeekNumber(); - var w = this.getDay(); - var s = {}; - var hr = this.getHours(); - var pm = (hr >= 12); - var ir = (pm) ? (hr - 12) : hr; - var dy = this.getDayOfYear(); - if (ir == 0) { - ir = 12; - } - var min = this.getMinutes(); - var sec = this.getSeconds(); - s["%a"] = Date._SDN[w]; // abbreviated weekday name [FIXME: I18N] - s["%A"] = Date._DN[w]; // full weekday name - s["%b"] = Date._SMN[m]; // abbreviated month name [FIXME: I18N] - s["%B"] = Date._MN[m]; // full month name - // FIXME: %c : preferred date and time representation for the current locale - s["%C"] = 1 + Math.floor(y / 100); // the century number - s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31) - s["%e"] = d; // the day of the month (range 1 to 31) - // FIXME: %D : american date style: %m/%d/%y - // FIXME: %E, %F, %G, %g, %h (man strftime) - s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format) - s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format) - s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366) - s["%k"] = hr; // hour, range 0 to 23 (24h format) - s["%l"] = ir; // hour, range 1 to 12 (12h format) - s["%X"] = (m < 9) ? ("0" + (1 + m)) : (1 + m); // month, range 01 to 12 - s["%x"] = m + 1 // month, range 1 to 12 - s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59 - s["%n"] = "\n"; // a newline character - s["%p"] = pm ? "PM" : "AM"; - s["%P"] = pm ? "pm" : "am"; - // FIXME: %r : the time in am/pm notation %I:%M:%S %p - // FIXME: %R : the time in 24-hour notation %H:%M - s["%s"] = Math.floor(this.getTime() / 1000); - s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59 - s["%t"] = "\t"; // a tab character - // FIXME: %T : the time in 24-hour notation (%H:%M:%S) - s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn; - s["%u"] = w + 1; // the day of the week (range 1 to 7, 1 = MON) - s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) - // FIXME: %x : preferred date representation for the current locale without the time - // FIXME: %X : preferred time representation for the current locale without the date - s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) - s["%Y"] = y; // year with the century - s["%%"] = "%"; // a literal '%' character - - var re = /%./g; - if (!BI.isKhtml()) { - return str.replace(re, function (par) { - return s[par] || par; - }); - } - - var a = str.match(re); - for (var i = 0; i < a.length; i++) { - var tmp = s[a[i]]; - if (tmp) { - re = new RegExp(a[i], 'g'); - str = str.replace(re, tmp); - } - } - - return str; -}; - -/** - * 是否是闰年 - * @param year - * @returns {boolean} - */ -Date.isLeap = function (year) { - return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; -}; - -/** - * 检测是否在有效期 - * - * @param YY 年 - * @param MM 月 - * @param DD 日 - * @param minDate '1900-01-01' - * @param maxDate '2099-12-31' - * @returns {Array} 若无效返回无效状态 - */ -Date.checkVoid = function (YY, MM, DD, minDate, maxDate) { - var back = []; - YY = YY | 0; - MM = MM | 0; - DD = DD | 0; - minDate = BI.isString(minDate) ? minDate.match(/\d+/g) : minDate; - maxDate = BI.isString(maxDate) ? maxDate.match(/\d+/g) : maxDate; - if (YY < minDate[0]) { - back = ['y']; - } else if (YY > maxDate[0]) { - back = ['y', 1]; - } else if (YY >= minDate[0] && YY <= maxDate[0]) { - if (YY == minDate[0]) { - if (MM < minDate[1]) { - back = ['m']; - } else if (MM == minDate[1]) { - if (DD < minDate[2]) { - back = ['d']; - } - } - } - if (YY == maxDate[0]) { - if (MM > maxDate[1]) { - back = ['m', 1]; - } else if (MM == maxDate[1]) { - if (DD > maxDate[2]) { - back = ['d', 1]; - } - } - } - } - return back; -}; - -Date.checkLegal = function (str) { - var ar = str.match(/\d+/g); - var YY = ar[0] | 0, MM = ar[1] | 0, DD = ar[2] | 0; - if (ar.length <= 1) { - return true; - } - if (ar.length <= 2) { - return MM >= 1 && MM <= 12; - } - var MD = Date._MD.slice(0); - MD[1] = Date.isLeap(YY) ? 29 : 28; - return MM >= 1 && MM <= 12 && DD <= MD[MM - 1]; -}; - -Date.parseDateTime = function (str, fmt) { - var today = new Date(); - var y = 0; - var m = 0; - var d = 1; - //wei : 对于fmt为‘YYYYMM’或者‘YYYYMMdd’的格式,str的值为类似'201111'的形式,因为年月之间没有分隔符,所以正则表达式分割无效,导致bug7376。 - var a = str.split(/\W+/); - if (fmt.toLowerCase() == '%y%x' || fmt.toLowerCase() == '%y%x%d') { - var yearlength = 4; - var otherlength = 2; - a[0] = str.substring(0, yearlength); - a[1] = str.substring(yearlength, yearlength + otherlength); - a[2] = str.substring(yearlength + otherlength, yearlength + otherlength * 2); - } - var b = fmt.match(/%./g); - var i = 0, j = 0; - var hr = 0; - var min = 0; - var sec = 0; - for (i = 0; i < a.length; ++i) { - switch (b[i]) { - case "%d": - case "%e": - d = parseInt(a[i], 10); - break; - - case "%X": - m = parseInt(a[i], 10) - 1; - break; - case "%x": - m = parseInt(a[i], 10) - 1; - break; - - case "%Y": - case "%y": - y = parseInt(a[i], 10); - (y < 100) && (y += (y > 29) ? 1900 : 2000); - break; - - case "%b": - case "%B": - for (j = 0; j < 12; ++j) { - if (Date._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { - m = j; - break; - } - } - break; - - case "%H": - case "%I": - case "%k": - case "%l": - hr = parseInt(a[i], 10); - break; - - case "%P": - case "%p": - if (/pm/i.test(a[i]) && hr < 12) { - hr += 12; - } else if (/am/i.test(a[i]) && hr >= 12) { - hr -= 12; - } - break; - - case "%M": - min = parseInt(a[i], 10); - case "%S": - sec = parseInt(a[i], 10); - break; - } - } -// if (!a[i]) { -// continue; -// } - if (isNaN(y)) { - y = today.getFullYear(); - } - if (isNaN(m)) { - m = today.getMonth(); - } - if (isNaN(d)) { - d = today.getDate(); - } - if (isNaN(hr)) { - hr = today.getHours(); - } - if (isNaN(min)) { - min = today.getMinutes(); - } - if (isNaN(sec)) { - sec = today.getSeconds(); - } - if (y != 0) { - return new Date(y, m, d, hr, min, sec); - } - y = 0; - m = -1; - d = 0; - for (i = 0; i < a.length; ++i) { - if (a[i].search(/[a-zA-Z]+/) != -1) { - var t = -1; - for (j = 0; j < 12; ++j) { - if (Date._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { - t = j; - break; - } - } - if (t != -1) { - if (m != -1) { - d = m + 1; - } - m = t; - } - } else if (parseInt(a[i], 10) <= 12 && m == -1) { - m = a[i] - 1; - } else if (parseInt(a[i], 10) > 31 && y == 0) { - y = parseInt(a[i], 10); - (y < 100) && (y += (y > 29) ? 1900 : 2000); - } else if (d == 0) { - d = a[i]; - } - } - if (y == 0) { - y = today.getFullYear(); - } - if (m != -1 && d != 0) { - return new Date(y, m, d, hr, min, sec); - } - return today; -}; -/* - * 给jQuery.Event对象添加的工具方法 - */ -$.extend($.Event.prototype, { - // event.stopEvent - stopEvent: function () { - this.stopPropagation(); - this.preventDefault(); - } -});Function.prototype.before = function (func) { - var __self = this; - return function () { - if (func.apply(this, arguments) === false) { - return false; - } - return __self.apply(this, arguments); - } -}; - -Function.prototype.after = function (func) { - var __self = this; - return function () { - var ret = __self.apply(this, arguments); - if (ret === false) { - return false; - } - func.apply(this, arguments); - return ret; - } -};/*! - * jLayout JQuery Plugin v0.11 - * - * Licensed under the revised BSD License. - * Copyright 2008, Bram Stein - * All rights reserved. - */ -if (jQuery) { - (function ($) { - // richer:容器在其各个边缘留出的空间 - if (!$.fn.insets) { - $.fn.insets = function () { - var p = this.padding(), - b = this.border(); - return { - 'top': p.top, - 'bottom': p.bottom + b.bottom + b.top, - 'left': p.left, - 'right': p.right + b.right + b.left - }; - }; - } - - // richer:获取 && 设置jQuery元素的边界 - if (!$.fn.bounds) { - $.fn.bounds = function (value) { - var tmp = {hasIgnoredBounds: true}; - - if (value) { - if (!isNaN(value.x)) { - tmp.left = value.x; - } - if (!isNaN(value.y)) { - tmp.top = value.y; - } - if (value.width != null) { - tmp.width = (value.width - (this.outerWidth(true) - this.width())); - tmp.width = (tmp.width >= 0) ? tmp.width : value.width; - // fix chrome - //tmp.width = (tmp.width >= 0) ? tmp.width : 0; - } - if (value.height != null) { - tmp.height = value.height - (this.outerHeight(true) - this.height()); - tmp.height = (tmp.height >= 0) ? tmp.height : value.height; - // fix chrome - //tmp.height = (tmp.height >= 0) ? tmp.height : value.0; - } - this.css(tmp); - return this; - } - else { - // richer:注意此方法只对可见元素有效 - tmp = this.position(); - return { - 'x': tmp.left, - 'y': tmp.top, - // richer:这里计算外部宽度和高度的时候,都不包括边框 - 'width': this.outerWidth(), - 'height': this.outerHeight() - }; - } - }; - } - })(jQuery); -} -;if (!Number.prototype.toFixed || (0.00008).toFixed(3) !== '0.000' || - (0.9).toFixed(0) === '0' || (1.255).toFixed(2) !== '1.25' || - (1000000000000000128).toFixed(0) !== "1000000000000000128") { - (function () { - var base, size, data, i; - base = 1e7; - size = 6; - data = [0, 0, 0, 0, 0, 0]; - function multiply(n, c) { - var i = -1; - while (++i < size) { - c += n * data[i]; - data[i] = c % base; - c = Math.floor(c / base); - } - } - - function divide(n) { - var i = size, c = 0; - while (--i >= 0) { - c += data[i]; - data[i] = Math.floor(c / n); - c = (c % n) * base; - } - } - - function toString() { - var i = size; - var s = ''; - while (--i >= 0) { - if (s !== '' || i === 0 || data[i] !== 0) { - var t = String(data[i]); - if (s === '') { - s = t; - } else { - s += '0000000'.slice(0, 7 - t.length) + t; - } - } - } - return s; - } - - function pow(x, n, acc) { - return (n === 0 ? acc : (n % 2 === 1 ? pow(x, n - 1, acc * x) - : pow(x * x, n / 2, acc))); - } - - function log(x) { - var n = 0; - while (x >= 4096) { - n += 12; - x /= 4096; - } - while (x >= 2) { - n += 1; - x /= 2; - } - return n; - } - - Number.prototype.toFixed = function (fractionDigits) { - var f, x, s, m, e, z, j, k; - f = Number(fractionDigits); - f = f !== f ? 0 : Math.floor(f); - - if (f < 0 || f > 20) { - throw new RangeError('Number.toFixed called with invalid number of decimals'); - } - - x = Number(this); - - if (x !== x) { - return "NaN"; - } - - if (x <= -1e21 || x > 1e21) { - return String(x); - } - - s = ""; - - if (x < 0) { - s = "-"; - x = -x; - } - - m = "0"; - - if (x > 1e-21) { - //1e-21<x<1e21 - //-70<log2(x)<70 - e = log(x * pow(2, 69, 1)) - 69; - z = (e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1)); - z *= 0x10000000000000;//Math.pow(2,52); - e = 52 - e; - - //-18<e<122 - //x=z/2^e - if (e > 0) { - multiply(0, z); - j = f; - - while (j >= 7) { - multiply(1e7, 0); - j -= 7; - } - - multiply(pow(10, j, 1), 0); - j = e - 1; - - while (j >= 23) { - divide(1 << 23); - j -= 23; - } - divide(1 << j); - multiply(1, 1); - divide(2); - m = toString(); - } else { - multiply(0, z); - multiply(1 << (-e), 0); - m = toString() + '0.00000000000000000000'.slice(2, 2 + f); - } - } - - if (f > 0) { - k = m.length; - - if (k <= f) { - m = s + '0.0000000000000000000'.slice(0, f - k + 2) + m; - } else { - m = s + m.slice(0, k - f) + '.' + m.slice(k - f); - } - } else { - m = s + m; - } - - return m; - } - - })(); -} - - -/** - ** 加法函数,用来得到精确的加法结果 - ** 说明:javascript的加法结果会有误差,在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。 - ** 调用:accAdd(arg1,arg2) - ** 返回值:arg1加上arg2的精确结果 - **/ -function accAdd(arg1, arg2) { - var r1, r2, m, c; - try { - r1 = arg1.toString().split(".")[1].length; - } - catch (e) { - r1 = 0; - } - try { - r2 = arg2.toString().split(".")[1].length; - } - catch (e) { - r2 = 0; - } - c = Math.abs(r1 - r2); - m = Math.pow(10, Math.max(r1, r2)); - if (c > 0) { - var cm = Math.pow(10, c); - if (r1 > r2) { - arg1 = Number(arg1.toString().replace(".", "")); - arg2 = Number(arg2.toString().replace(".", "")) * cm; - } else { - arg1 = Number(arg1.toString().replace(".", "")) * cm; - arg2 = Number(arg2.toString().replace(".", "")); - } - } else { - arg1 = Number(arg1.toString().replace(".", "")); - arg2 = Number(arg2.toString().replace(".", "")); - } - return (arg1 + arg2) / m; -} - -//给Number类型增加一个add方法,调用起来更加方便。 -Number.prototype.add = function (arg) { - return accAdd(arg, this); -}; -/** - ** 减法函数,用来得到精确的减法结果 - ** 说明:javascript的减法结果会有误差,在两个浮点数相减的时候会比较明显。这个函数返回较为精确的减法结果。 - ** 调用:accSub(arg1,arg2) - ** 返回值:arg1加上arg2的精确结果 - **/ -function accSub(arg1, arg2) { - var r1, r2, m, n; - try { - r1 = arg1.toString().split(".")[1].length; - } - catch (e) { - r1 = 0; - } - try { - r2 = arg2.toString().split(".")[1].length; - } - catch (e) { - r2 = 0; - } - m = Math.pow(10, Math.max(r1, r2)); //last modify by deeka //动态控制精度长度 - n = (r1 >= r2) ? r1 : r2; - return ((arg1 * m - arg2 * m) / m).toFixed(n); -} - -// 给Number类型增加一个mul方法,调用起来更加方便。 -Number.prototype.sub = function (arg) { - return accSub(this, arg); -}; -/** - ** 乘法函数,用来得到精确的乘法结果 - ** 说明:javascript的乘法结果会有误差,在两个浮点数相乘的时候会比较明显。这个函数返回较为精确的乘法结果。 - ** 调用:accMul(arg1,arg2) - ** 返回值:arg1乘以 arg2的精确结果 - **/ -function accMul(arg1, arg2) { - var m = 0, s1 = arg1.toString(), s2 = arg2.toString(); - try { - m += s1.split(".")[1].length; - } - catch (e) { - } - try { - m += s2.split(".")[1].length; - } - catch (e) { - } - return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m); -} - -// 给Number类型增加一个mul方法,调用起来更加方便。 -Number.prototype.mul = function (arg) { - return accMul(arg, this); -}; -/** - ** 除法函数,用来得到精确的除法结果 - ** 说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显。这个函数返回较为精确的除法结果。 - ** 调用:accDiv(arg1,arg2) - ** 返回值:arg1除以arg2的精确结果 - **/ -function accDiv(arg1, arg2) { - var t1 = 0, t2 = 0, r1, r2; - try { - t1 = arg1.toString().split(".")[1].length; - } - catch (e) { - } - try { - t2 = arg2.toString().split(".")[1].length; - } - catch (e) { - } - with (Math) { - r1 = Number(arg1.toString().replace(".", "")); - r2 = Number(arg2.toString().replace(".", "")); - return (t2 > t1) ? (r1 / r2) * pow(10, t2 - t1) : (r1 / r2) / pow(10, t1 - t2); - } -} - -//给Number类型增加一个div方法,调用起来更加方便。 -Number.prototype.div = function (arg) { - return accDiv(this, arg); -};/** - * 对字符串对象的扩展 - * @class String - */ -$.extend(String.prototype, { - - /** - * 判断字符串是否已指定的字符串开始 - * @param {String} startTag 指定的开始字符串 - * @return {Boolean} 如果字符串以指定字符串开始则返回true,否则返回false - */ - startWith: function (startTag) { - if (startTag == null || startTag == "" || this.length === 0 || startTag.length > this.length) { - return false; - } - return this.substr(0, startTag.length) == startTag; - }, - /** - * 判断字符串是否以指定的字符串结束 - * @param {String} endTag 指定的字符串 - * @return {Boolean} 如果字符串以指定字符串结束则返回true,否则返回false - */ - endWith: function (endTag) { - if (endTag == null || endTag == "" || this.length === 0 || endTag.length > this.length) { - return false; - } - return this.substring(this.length - endTag.length) == endTag; - }, - - /** - * 获取url中指定名字的参数 - * @param {String} name 参数的名字 - * @return {String} 参数的值 - */ - getQuery: function (name) { - var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); - var r = this.substr(this.indexOf("?") + 1).match(reg); - if (r) { - return unescape(r[2]); - } - return null; - }, - - /** - * 给url加上给定的参数 - * @param {Object} paras 参数对象,是一个键值对对象 - * @return {String} 添加了给定参数的url - */ - appendQuery: function (paras) { - if (!paras) { - return this; - } - var src = this; - // 没有问号说明还没有参数 - if (src.indexOf("?") === -1) { - src += "?"; - } - // 如果以问号结尾,说明没有其他参数 - if (src.endWith("?") !== false) { - } else { - src += "&"; - } - $.each(paras, function (name, value) { - if (typeof(name) === 'string') { - src += name + "=" + value + "&"; - } - }); - src = src.substr(0, src.length - 1); - return src; - }, - /** - * 将所有符合第一个字符串所表示的字符串替换成为第二个字符串 - * @param {String} s1 要替换的字符串的正则表达式 - * @param {String} s2 替换的结果字符串 - * @returns {String} 替换后的字符串 - */ - replaceAll: function (s1, s2) { - return this.replace(new RegExp(s1, "gm"), s2); - }, - /** - * 总是让字符串以指定的字符开头 - * @param {String} start 指定的字符 - * @returns {String} 以指定字符开头的字符串 - */ - perfectStart: function (start) { - if (this.startWith(start)) { - return this; - } else { - return start + this; - } - }, - - /** - * 获取字符串中某字符串的所有项位置数组 - * @param {String} sub 子字符串 - * @return {Number[]} 子字符串在父字符串中出现的所有位置组成的数组 - */ - allIndexOf: function (sub) { - if (typeof sub != 'string') { - return []; - } - var str = this; - var location = []; - var offset = 0; - while (str.length > 0) { - var loc = str.indexOf(sub); - if (loc === -1) { - break; - } - location.push(offset + loc); - str = str.substring(loc + sub.length, str.length); - offset += loc + sub.length; - } - return location; - } -}); - -/** - * 对字符串对象的扩展 - * @class String - */ -$.extend(String, { - - /** - * 对字符串中的'和\做编码处理 - * @static - * @param {String} string 要做编码处理的字符串 - * @return {String} 编码后的字符串 - */ - escape: function (string) { - return string.replace(/('|\\)/g, "\\$1"); - }, - - /** - * 让字符串通过指定字符做补齐的函数 - * - * var s = String.leftPad('123', 5, '0');//s的值为:'00123' - * - * @static - * @param {String} val 原始值 - * @param {Number} size 总共需要的位数 - * @param {String} ch 用于补齐的字符 - * @return {String} 补齐后的字符串 - */ - leftPad: function (val, size, ch) { - var result = String(val); - if (!ch) { - ch = " "; - } - while (result.length < size) { - result = ch + result; - } - return result.toString(); - }, - - /** - * 对字符串做替换的函数 - * - * var cls = 'my-class', text = 'Some text'; - * var res = String.format('<div class="{0}>{1}</div>"', cls, text); - * //res的值为:'<div class="my-class">Some text</div>'; - * - * @static - * @param {String} format 要做替换的字符串,替换字符串1,替换字符串2... - * @return {String} 做了替换后的字符串 - */ - format: function (format) { - var args = Array.prototype.slice.call(arguments, 1); - return format.replace(/\{(\d+)\}/g, function (m, i) { - return args[i]; - }); - } -});BI.EventListener = { - listen: function listen(target, eventType, callback) { - if (target.addEventListener) { - target.addEventListener(eventType, callback, false); - return { - remove: function remove() { - target.removeEventListener(eventType, callback, false); - } - }; - } else if (target.attachEvent) { - target.attachEvent('on' + eventType, callback); - return { - remove: function remove() { - target.detachEvent('on' + eventType, callback); - } - }; - } - }, - - capture: function capture(target, eventType, callback) { - if (target.addEventListener) { - target.addEventListener(eventType, callback, true); - return { - remove: function remove() { - target.removeEventListener(eventType, callback, true); - } - }; - } else { - return { - remove: BI.emptyFn - }; - } - }, - - registerDefault: function registerDefault() { - } -};!(function () { - var cancelAnimationFrame = - window.cancelAnimationFrame || - window.webkitCancelAnimationFrame || - window.mozCancelAnimationFrame || - window.oCancelAnimationFrame || - window.msCancelAnimationFrame || - window.clearTimeout; - - var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout; - - - BI.MouseMoveTracker = function (onMove, onMoveEnd, domNode) { - this._isDragging = false; - this._animationFrameID = null; - this._domNode = domNode; - this._onMove = onMove; - this._onMoveEnd = onMoveEnd; - - this._onMouseMove = BI.bind(this._onMouseMove, this); - this._onMouseUp = BI.bind(this._onMouseUp, this); - this._didMouseMove = BI.bind(this._didMouseMove, this); - }; - BI.MouseMoveTracker.prototype = { - constructor: BI.MouseMoveTracker, - captureMouseMoves: function (/*object*/ event) { - if (!this._eventMoveToken && !this._eventUpToken) { - this._eventMoveToken = BI.EventListener.listen( - this._domNode, - 'mousemove', - this._onMouseMove - ); - this._eventUpToken = BI.EventListener.listen( - this._domNode, - 'mouseup', - this._onMouseUp - ); - } - - if (!this._isDragging) { - this._deltaX = 0; - this._deltaY = 0; - this._isDragging = true; - this._x = event.clientX; - this._y = event.clientY; - } - event.preventDefault ? event.preventDefault() : (event.returnValue = false); - }, - - releaseMouseMoves: function () { - if (this._eventMoveToken && this._eventUpToken) { - this._eventMoveToken.remove(); - this._eventMoveToken = null; - this._eventUpToken.remove(); - this._eventUpToken = null; - } - - if (this._animationFrameID !== null) { - cancelAnimationFrame(this._animationFrameID); - this._animationFrameID = null; - } - - if (this._isDragging) { - this._isDragging = false; - this._x = null; - this._y = null; - } - }, - - isDragging: function () /*boolean*/ { - return this._isDragging; - }, - - _onMouseMove: function (/*object*/ event) { - var x = event.clientX; - var y = event.clientY; - - this._deltaX += (x - this._x); - this._deltaY += (y - this._y); - - if (this._animationFrameID === null) { - // The mouse may move faster then the animation frame does. - // Use `requestAnimationFrame` to avoid over-updating. - this._animationFrameID = - requestAnimationFrame(this._didMouseMove); - } - - this._x = x; - this._y = y; - event.preventDefault ? event.preventDefault() : (event.returnValue = false); - }, - - _didMouseMove: function () { - this._animationFrameID = null; - this._onMove(this._deltaX, this._deltaY); - this._deltaX = 0; - this._deltaY = 0; - }, - - _onMouseUp: function () { - if (this._animationFrameID) { - this._didMouseMove(); - } - this._onMoveEnd(); - } - }; -})();!(function () { - var PIXEL_STEP = 10; - var LINE_HEIGHT = 40; - var PAGE_HEIGHT = 800; - var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || window.setTimeout; - - function normalizeWheel(/*object*/event) /*object*/ { - var sX = 0, - sY = 0, - // spinX, spinY - pX = 0, - pY = 0; // pixelX, pixelY - - // Legacy - if ('detail' in event) { - sY = event.detail; - } - if ('wheelDelta' in event) { - sY = -event.wheelDelta / 120; - } - if ('wheelDeltaY' in event) { - sY = -event.wheelDeltaY / 120; - } - if ('wheelDeltaX' in event) { - sX = -event.wheelDeltaX / 120; - } - - // side scrolling on FF with DOMMouseScroll - if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) { - sX = sY; - sY = 0; - } - - pX = sX * PIXEL_STEP; - pY = sY * PIXEL_STEP; - - if ('deltaY' in event) { - pY = event.deltaY; - } - if ('deltaX' in event) { - pX = event.deltaX; - } - - if ((pX || pY) && event.deltaMode) { - if (event.deltaMode === 1) { - // delta in LINE units - pX *= LINE_HEIGHT; - pY *= LINE_HEIGHT; - } else { - // delta in PAGE units - pX *= PAGE_HEIGHT; - pY *= PAGE_HEIGHT; - } - } - - // Fall-back if spin cannot be determined - if (pX && !sX) { - sX = pX < 1 ? -1 : 1; - } - if (pY && !sY) { - sY = pY < 1 ? -1 : 1; - } - - return { - spinX: sX, - spinY: sY, - pixelX: pX, - pixelY: pY - }; - } - - BI.WheelHandler = function (onWheel, handleScrollX, handleScrollY, stopPropagation) { - this._animationFrameID = null; - this._deltaX = 0; - this._deltaY = 0; - this._didWheel = BI.bind(this._didWheel, this); - if (typeof handleScrollX !== 'function') { - handleScrollX = handleScrollX ? - function () { - return true - } : - function () { - return false - }; - } - - if (typeof handleScrollY !== 'function') { - handleScrollY = handleScrollY ? - function () { - return true - } : - function () { - return false - }; - } - - if (typeof stopPropagation !== 'function') { - stopPropagation = stopPropagation ? - function () { - return true - } : - function () { - return false - }; - } - - this._handleScrollX = handleScrollX; - this._handleScrollY = handleScrollY; - this._stopPropagation = stopPropagation; - this._onWheelCallback = onWheel; - this.onWheel = BI.bind(this.onWheel, this); - }; - BI.WheelHandler.prototype = { - constructor: BI.WheelHandler, - onWheel: function (/*object*/ event) { - var normalizedEvent = normalizeWheel(event); - var deltaX = this._deltaX + normalizedEvent.pixelX; - var deltaY = this._deltaY + normalizedEvent.pixelY; - var handleScrollX = this._handleScrollX(deltaX, deltaY); - var handleScrollY = this._handleScrollY(deltaY, deltaX); - if (!handleScrollX && !handleScrollY) { - return; - } - - this._deltaX += handleScrollX ? normalizedEvent.pixelX : 0; - this._deltaY += handleScrollY ? normalizedEvent.pixelY : 0; - event.preventDefault ? event.preventDefault() : (event.returnValue = false); - - var changed; - if (this._deltaX !== 0 || this._deltaY !== 0) { - if (this._stopPropagation()) { - event.stopPropagation ? event.stopPropagation() : (event.cancelBubble = true); - } - changed = true; - } - - if (changed === true && this._animationFrameID === null) { - this._animationFrameID = requestAnimationFrame(this._didWheel); - } - }, - - _didWheel: function () { - this._animationFrameID = null; - this._onWheelCallback(this._deltaX, this._deltaY); - this._deltaX = 0; - this._deltaY = 0; - } - }; -})();/** - * 常量 - */ - -_.extend(BI, { - MAX: 0xfffffffffffffff, - MIN: -0xfffffffffffffff, - EVENT_RESPONSE_TIME: 200, - zIndex_layer: 1e5, - zIndex_floatbox: 1e6, - zIndex_popup: 1e7, - zIndex_masker: 1e8, - zIndex_tip: 1e9, - emptyStr: "", - emptyFn: function () { - }, - empty: null, - KeyCode: { - BACKSPACE: 8, - COMMA: 188, - DELETE: 46, - DOWN: 40, - END: 35, - ENTER: 13, - ESCAPE: 27, - HOME: 36, - LEFT: 37, - NUMPAD_ADD: 107, - NUMPAD_DECIMAL: 110, - NUMPAD_DIVIDE: 111, - NUMPAD_ENTER: 108, - NUMPAD_MULTIPLY: 106, - NUMPAD_SUBTRACT: 109, - PAGE_DOWN: 34, - PAGE_UP: 33, - PERIOD: 190, - RIGHT: 39, - SPACE: 32, - TAB: 9, - UP: 38 - }, - Status: { - SUCCESS: 1, - WRONG: 2, - START: 3, - END: 4, - WAITING: 5, - READY: 6, - RUNNING: 7, - OUTOFBOUNDS: 8, - NULL: -1 - }, - Direction: { - Top: "top", - Bottom: "bottom", - Left: "left", - Right: "right", - Custom: "custom" - }, - Axis: { - Vertical: "vertical", - Horizontal: "horizontal" - }, - Selection: { - Default: -2, - None: -1, - Single: 0, - Multi: 1, - All: 2 - }, - HorizontalAlign: { - Left: "left", - Right: "right", - Center: "center" - }, - VerticalAlign: { - Middle: "middle", - Top: "top", - Bottom: "bottom" - } -});BI.version = "2.0";/** - * absolute实现的居中布局 - * @class BI.AbsoluteCenterLayout - * @extends BI.Layout - */ -BI.AbsoluteCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.AbsoluteCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-absolute-center-layout", - hgap: 0, - lgap: 0, - rgap: 0, - vgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - render: function () { - BI.AbsoluteCenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.AbsoluteCenterLayout.superclass._addElement.apply(this, arguments); - w.element.css({ - "position": "absolute", - "left": o.hgap + o.lgap + (item.lgap || 0), - "right": o.hgap + o.rgap + (item.rgap || 0), - "top": o.vgap + o.tgap + (item.tgap || 0), - "bottom": o.vgap + o.bgap + (item.bgap || 0), - "margin": "auto" - }); - return w; - }, - - resize: function () { - // console.log("absolute_center_adapt布局不需要resize"); - }, - - populate: function (items) { - BI.AbsoluteCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.absolute_center_adapt', BI.AbsoluteCenterLayout);/** - * absolute实现的居中布局 - * @class BI.AbsoluteHorizontalLayout - * @extends BI.Layout - */ -BI.AbsoluteHorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.AbsoluteHorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-absolute-horizontal-layout", - hgap: 0, - lgap: 0, - rgap: 0, - vgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - render: function () { - BI.AbsoluteHorizontalLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.AbsoluteHorizontalLayout.superclass._addElement.apply(this, arguments); - w.element.css({ - "position": "absolute", - "left": o.hgap + o.lgap + (item.lgap || 0), - "right": o.hgap + o.rgap + (item.rgap || 0), - "margin": "auto" - }); - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css("top", o.vgap + o.tgap + (item.tgap || 0)); - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css("bottom", o.vgap + o.bgap + (item.bgap || 0)); - } - return w; - }, - - resize: function () { - // console.log("absolute_horizontal_adapt布局不需要resize"); - }, - - populate: function (items) { - BI.AbsoluteHorizontalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.absolute_horizontal_adapt', BI.AbsoluteHorizontalLayout);/** - * absolute实现的居中布局 - * @class BI.AbsoluteVerticalLayout - * @extends BI.Layout - */ -BI.AbsoluteVerticalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.AbsoluteVerticalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-absolute-vertical-layout", - hgap: 0, - lgap: 0, - rgap: 0, - vgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - render: function () { - BI.AbsoluteVerticalLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.AbsoluteVerticalLayout.superclass._addElement.apply(this, arguments); - w.element.css({ - "position": "absolute", - "left": item.lgap, - "right": item.rgap, - "top": o.vgap + o.tgap + (item.tgap || 0), - "bottom": o.vgap + o.bgap + (item.bgap || 0), - "margin": "auto" - }); - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css("left", o.hgap + o.lgap + (item.lgap || 0)); - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css("right", o.hgap + o.rgap + (item.rgap || 0)); - } - return w; - }, - - resize: function () { - // console.log("absolute_vertical_adapt布局不需要resize"); - }, - - populate: function (items) { - BI.AbsoluteVerticalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.absolute_vertical_adapt', BI.AbsoluteVerticalLayout);/** - * 自适应水平和垂直方向都居中容器 - * @class BI.CenterAdaptLayout - * @extends BI.Layout - */ -BI.CenterAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.CenterAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-center-adapt-layout", - columnSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.CenterAdaptLayout.superclass.render.apply(this, arguments); - this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ - "position": "relative", - "width": "100%", - "height": "100%", - "white-space": "nowrap", - "border-spacing": "0px", - "border": "none", - "border-collapse": "separate" - }); - this.$tr = $("<tr>"); - this.$tr.appendTo(this.$table); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var td; - var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; - if (!this.hasWidget(this._getChildName(i))) { - var w = BI.createWidget(item); - w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); - td = BI.createWidget({ - type: "bi.default", - tagName: "td", - attributes: { - width: width - }, - items: [w] - }); - this.addWidget(this._getChildName(i), td); - } else { - td = this.getWidgetByName(this._getChildName(i)); - td.element.attr("width", width); - } - td.element.css({"max-width": o.columnSize[i]}); - if (i === 0) { - td.element.addClass("first-element"); - } - td.element.css({ - "position": "relative", - "height": "100%", - "vertical-align": "middle", - "margin": "0", - "padding": "0", - "border": "none" - }); - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return td; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$tr.append(frag); - this.element.append(this.$table); - } - }, - - resize: function () { - // console.log("center_adapt布局不需要resize"); - }, - - _getWrapper: function(){ - return this.$tr; - }, - - populate: function (items) { - BI.CenterAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.center_adapt', BI.CenterAdaptLayout);/** - * 水平方向居中容器 - * @class BI.HorizontalAdaptLayout - * @extends BI.Layout - */ -BI.HorizontalAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HorizontalAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-horizontal-adapt-layout", - verticalAlign: BI.VerticalAlign.Middle, - columnSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.HorizontalAdaptLayout.superclass.render.apply(this, arguments); - this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ - "position": "relative", - "width": "100%", - "white-space": "nowrap", - "border-spacing": "0px", - "border": "none", - "border-collapse": "separate" - }); - this.$tr = $("<tr>"); - this.$tr.appendTo(this.$table); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var td; - var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; - if (!this.hasWidget(this._getChildName(i))) { - var w = BI.createWidget(item); - w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); - td = BI.createWidget({ - type: "bi.default", - tagName: "td", - attributes: { - width: width - }, - items: [w] - }); - this.addWidget(this._getChildName(i), td); - } else { - td = this.getWidgetByName(this._getChildName(i)); - td.element.attr("width", width); - } - td.element.css({"max-width": o.columnSize[i] + "px"}); - if (i === 0) { - td.element.addClass("first-element"); - } - td.element.css({ - "position": "relative", - "vertical-align": o.verticalAlign, - "margin": "0", - "padding": "0", - "border": "none" - }); - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return td; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$tr.append(frag); - this.element.append(this.$table); - } - }, - - resize: function () { - // console.log("horizontal_adapt布局不需要resize"); - }, - - _getWrapper: function () { - return this.$tr; - }, - - populate: function (items) { - BI.HorizontalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal_adapt', BI.HorizontalAdaptLayout);/** - * 左右分离,垂直方向居中容器 - * items:{ - left: [{el:{type:"bi.button"}}], - right:[{el:{type:"bi.button"}}] - } - * @class BI.LeftRightVerticalAdaptLayout - * @extends BI.Layout - */ -BI.LeftRightVerticalAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.LeftRightVerticalAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-left-right-vertical-adapt-layout", - items: {}, - llgap: 0, - lrgap: 0, - lhgap: 0, - rlgap: 0, - rrgap: 0, - rhgap: 0 - }); - }, - render: function () { - BI.LeftRightVerticalAdaptLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("left_right_vertical_adapt布局不需要resize"); - }, - - addItem: function () { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - if ("left" in items) { - var left = BI.createWidget({ - type: "bi.vertical_adapt", - items: items.left, - hgap: o.lhgap, - lgap: o.llgap, - rgap: o.lrgap - }); - left.element.css("height", "100%"); - BI.createWidget({ - type: "bi.left", - element: this, - items: [left] - }); - } - if ("right" in items) { - var right = BI.createWidget({ - type: "bi.vertical_adapt", - items: items.right, - hgap: o.rhgap, - lgap: o.rlgap, - rgap: o.rrgap - }); - right.element.css("height", "100%"); - BI.createWidget({ - type: "bi.right", - element: this, - items: [right] - }); - } - }, - - populate: function (items) { - BI.LeftRightVerticalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.left_right_vertical_adapt', BI.LeftRightVerticalAdaptLayout); - - -BI.LeftVerticalAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.LeftRightVerticalAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-left-vertical-adapt-layout", - items: [], - lgap: 0, - rgap: 0, - hgap: 0 - }); - }, - render: function () { - BI.LeftVerticalAdaptLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("left_vertical_adapt布局不需要resize"); - }, - - addItem: function () { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - var left = BI.createWidget({ - type: "bi.vertical_adapt", - items: items, - lgap: o.lgap, - hgap: o.hgap, - rgap: o.rgap - }); - left.element.css("height", "100%"); - BI.createWidget({ - type: "bi.left", - element: this, - items: [left] - }); - }, - - populate: function (items) { - BI.LeftVerticalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.left_vertical_adapt', BI.LeftVerticalAdaptLayout); - -BI.RightVerticalAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.RightVerticalAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-right-vertical-adapt-layout", - items: [], - lgap: 0, - rgap: 0, - hgap: 0 - }); - }, - render: function () { - BI.RightVerticalAdaptLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - - }, - - addItem: function () { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - var right = BI.createWidget({ - type: "bi.vertical_adapt", - items: items, - lgap: o.lgap, - hgap: o.hgap, - rgap: o.rgap - }); - right.element.css("height", "100%"); - BI.createWidget({ - type: "bi.right", - element: this, - items: [right] - }); - }, - - populate: function (items) { - BI.RightVerticalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.right_vertical_adapt', BI.RightVerticalAdaptLayout);/** - * 垂直方向居中容器 - * @class BI.VerticalAdaptLayout - * @extends BI.Layout - */ -BI.VerticalAdaptLayout = BI.inherit(BI.Layout, { - props: { - baseCls: "bi-vertical-adapt-layout", - columnSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }, - render: function () { - BI.VerticalAdaptLayout.superclass.render.apply(this, arguments); - this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ - "position": "relative", - "height": "100%", - "white-space": "nowrap", - "border-spacing": "0px", - "border": "none", - "border-collapse": "separate" - }); - this.$tr = $("<tr>"); - this.$tr.appendTo(this.$table); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var td; - var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; - if (!this.hasWidget(this._getChildName(i))) { - var w = BI.createWidget(item); - w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); - td = BI.createWidget({ - type: "bi.default", - tagName: "td", - attributes: { - width: width - }, - items: [w] - }); - this.addWidget(this._getChildName(i), td); - } else { - td = this.getWidgetByName(this._getChildName(i)); - td.element.attr("width", width); - } - - if (i === 0) { - td.element.addClass("first-element"); - } - td.element.css({ - "position": "relative", - "height": "100%", - "vertical-align": "middle", - "margin": "0", - "padding": "0", - "border": "none" - }); - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return td; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$tr.append(frag); - this.element.append(this.$table); - } - }, - - _getWrapper: function(){ - return this.$tr; - }, - - resize: function () { - // console.log("vertical_adapt布局不需要resize"); - }, - - populate: function (items) { - BI.VerticalAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.vertical_adapt', BI.VerticalAdaptLayout);/** - * 水平方向居中自适应容器 - * @class BI.HorizontalAutoLayout - * @extends BI.Layout - */ -BI.HorizontalAutoLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HorizontalAutoLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-horizon-auto-layout", - hgap: 0, - lgap: 0, - rgap: 0, - vgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - render: function () { - BI.HorizontalAutoLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.HorizontalAutoLayout.superclass._addElement.apply(this, arguments); - w.element.css({ - "position": "relative", - "margin": "0px auto" - }); - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - resize: function () { - // console.log("horizontal_adapt布局不需要resize"); - }, - - populate: function (items) { - BI.HorizontalAutoLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal_auto', BI.HorizontalAutoLayout);/** - * 浮动的居中布局 - */ -BI.FloatCenterAdaptLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatCenterAdaptLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-center-adapt-layout", - items: [], - hgap: 0, - vgap: 0, - tgap: 0, - bgap: 0, - lgap: 0, - rgap: 0 - }); - }, - render: function () { - BI.FloatCenterAdaptLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("float_center_adapt布局不需要resize"); - }, - - addItem: function () { - //do nothing - throw new Error("cannot be added") - }, - - mounted: function () { - var self = this; - var width = this.left.element.outerWidth(), - height = this.left.element.outerHeight(); - this.left.element.width(width).height(height).css("float", "none"); - BI.remove(this._children, function (i, wi) { - if (wi === self.container) { - delete self._children[i]; - } - }); - BI.createWidget({ - type: "bi.center_adapt", - element: this, - items: [this.left] - }); - }, - - stroke: function (items) { - var self = this, o = this.options; - this.left = BI.createWidget({ - type: "bi.vertical", - items: items, - hgap: o.hgap, - vgap: o.vgap, - tgap: o.tgap, - bgap: o.bgap, - lgap: o.lgap, - rgap: o.rgap - }); - - this.container = BI.createWidget({ - type: "bi.left", - element: this, - items: [this.left] - }); - - }, - - populate: function (items) { - BI.FloatCenterAdaptLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.float_center_adapt', BI.FloatCenterAdaptLayout);/** - * 浮动的水平居中布局 - */ -BI.FloatHorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatHorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-horizontal-adapt-layout", - items: [], - hgap: 0, - vgap: 0, - tgap: 0, - bgap: 0, - lgap: 0, - rgap: 0 - }); - }, - render: function () { - BI.FloatHorizontalLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("float_horizontal_adapt布局不需要resize"); - }, - - mounted: function () { - var self = this; - var width = this.left.element.width(), - height = this.left.element.height(); - this.left.element.width(width).height(height).css("float", "none"); - BI.remove(this._children, function (i, wi) { - if (wi === self.container) { - delete self._children[i]; - } - }); - BI.createWidget({ - type: "bi.horizontal_auto", - element: this, - items: [this.left] - }); - }, - - _addElement: function (i, item) { - var self = this, o = this.options; - this.left = BI.createWidget({ - type: "bi.vertical", - items: [item], - hgap: o.hgap, - vgap: o.vgap, - tgap: o.tgap, - bgap: o.bgap, - lgap: o.lgap, - rgap: o.rgap - }); - - this.container = BI.createWidget({ - type: "bi.left", - element: this, - items: [this.left] - }); - - return this.left; - }, - - populate: function (items) { - BI.HorizontalAutoLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal_float', BI.FloatHorizontalLayout);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexCenterLayout - * @extends BI.Layout - */ -BI.FlexCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-center-layout" - }); - }, - render: function () { - BI.FlexCenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexCenterLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "flex-shrink": "0"}); - return w; - }, - - resize: function () { - // console.log("flex_center布局不需要resize"); - }, - - populate: function (items) { - BI.FlexCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_center', BI.FlexCenterLayout);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexHorizontalLayout - * @extends BI.Layout - */ -BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexHorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-horizontal-layout", - verticalAlign: "middle", - columnSize: [], - scrollx: true, - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FlexHorizontalLayout.superclass.render.apply(this, arguments); - var o = this.options; - this.element.addClass(o.verticalAlign); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "flex-shrink": "0"}); - if (o.hgap + o.lgap + (item.lgap || 0) > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - resize: function () { - // console.log("flex_horizontal布局不需要resize"); - }, - - populate: function (items) { - BI.FlexHorizontalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_horizontal', BI.FlexHorizontalLayout);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexVerticalCenter - * @extends BI.Layout - */ -BI.FlexVerticalCenter = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexVerticalCenter.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-vertical-center", - columnSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FlexVerticalCenter.superclass.render.apply(this, arguments); - var o = this.options; - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexVerticalCenter.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "flex-shrink": "0"}); - if (o.hgap + o.lgap + (item.lgap || 0) > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - resize: function () { - // console.log("flex_vertical_center布局不需要resize"); - }, - - populate: function (items) { - BI.FlexVerticalCenter.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_vertical_center', BI.FlexVerticalCenter);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexCenterLayout - * @extends BI.Layout - */ -BI.FlexCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-wrapper-center-layout clearfix" - }); - }, - render: function () { - BI.FlexCenterLayout.superclass.render.apply(this, arguments); - this.$wrapper = $("<div>").addClass("flex-wrapper-center-layout-wrapper"); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexCenterLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative"}); - return w; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$wrapper.append(frag); - this.element.append(this.$wrapper); - } - }, - - _getWrapper: function(){ - return this.$wrapper; - }, - - resize: function () { - // console.log("flex_center布局不需要resize"); - }, - - populate: function (items) { - BI.FlexCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_wrapper_center', BI.FlexCenterLayout);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexHorizontalLayout - * @extends BI.Layout - */ -BI.FlexHorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexHorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-wrapper-horizontal-layout clearfix", - verticalAlign: "middle", - columnSize: [], - scrollx: true, - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FlexHorizontalLayout.superclass.render.apply(this, arguments); - var o = this.options; - this.$wrapper = $("<div>").addClass("flex-wrapper-horizontal-layout-wrapper " + o.verticalAlign); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexHorizontalLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative"}); - if (o.hgap + o.lgap + (item.lgap || 0) > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$wrapper.append(frag); - this.element.append(this.$wrapper); - } - }, - - _getWrapper: function(){ - return this.$wrapper; - }, - - resize: function () { - // console.log("flex_horizontal布局不需要resize"); - }, - - populate: function (items) { - BI.FlexHorizontalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_wrapper_horizontal', BI.FlexHorizontalLayout);/** - *自适应水平和垂直方向都居中容器 - * Created by GUY on 2016/12/2. - * - * @class BI.FlexVerticalCenter - * @extends BI.Layout - */ -BI.FlexVerticalCenter = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FlexVerticalCenter.superclass.props.apply(this, arguments), { - baseCls: "bi-flex-wrapper-vertical-center clearfix", - columnSize: [], - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FlexVerticalCenter.superclass.render.apply(this, arguments); - var o = this.options; - this.$wrapper = $("<div>").addClass("flex-wrapper-vertical-center-wrapper"); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FlexVerticalCenter.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative"}); - if (o.hgap + o.lgap + (item.lgap || 0) > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$wrapper.append(frag); - this.element.append(this.$wrapper); - } - }, - - _getWrapper: function(){ - return this.$wrapper; - }, - - resize: function () { - // console.log("flex_vertical_center布局不需要resize"); - }, - - populate: function (items) { - BI.FlexVerticalCenter.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.flex_wrapper_vertical_center', BI.FlexVerticalCenter);/** - * 固定子组件上下左右的布局容器 - * @class BI.AbsoluteLayout - * @extends BI.Layout - */ -BI.AbsoluteLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.AbsoluteLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-absolute-layout", - hgap: null, - vgap: null, - lgap: null, - rgap: null, - tgap: null, - bgap: null - }); - }, - render: function () { - BI.AbsoluteLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.AbsoluteLayout.superclass._addElement.apply(this, arguments); - var left = 0, right = 0, top = 0, bottom = 0; - if (BI.isNotNull(item.left)) { - w.element.css({"left": item.left}); - left += item.left; - } - if (BI.isNotNull(item.right)) { - w.element.css({"right": item.right}); - right += item.right; - } - if (BI.isNotNull(item.top)) { - w.element.css({"top": item.top}); - top += item.top; - } - if (BI.isNotNull(item.bottom)) { - w.element.css({"bottom": item.bottom}); - bottom += item.bottom; - } - - if (BI.isNotNull(o.hgap)) { - left += o.hgap; - w.element.css({"left": left}); - right += o.hgap; - w.element.css({"right": right}); - } - if (BI.isNotNull(o.vgap)) { - top += o.vgap; - w.element.css({"top": top}); - bottom += o.vgap; - w.element.css({"bottom": bottom}); - } - - if (BI.isNotNull(o.lgap)) { - left += o.lgap; - w.element.css({"left": left}); - } - if (BI.isNotNull(o.rgap)) { - right += o.rgap; - w.element.css({"right": right}); - } - if (BI.isNotNull(o.tgap)) { - top += o.tgap; - w.element.css({"top": top}); - } - if (BI.isNotNull(o.bgap)) { - bottom += o.bgap; - w.element.css({"bottom": bottom}); - } - - - if (BI.isNotNull(item.width)) { - w.element.css({"width": item.width}); - } - if (BI.isNotNull(item.height)) { - w.element.css({"height": item.height}); - } - w.element.css({"position": "absolute"}); - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - stroke: function (items) { - this.options.items = items || []; - var self = this; - BI.each(items, function (i, item) { - if (!!item) { - if (!BI.isWidget(item) && !item.el) { - throw new Error("el must be exist"); - } - self._addElement(i, item); - } - }); - }, - - populate: function (items) { - BI.AbsoluteLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.absolute', BI.AbsoluteLayout);BI.AdaptiveLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.AdaptiveLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-adaptive-layout", - hgap: null, - vgap: null, - lgap: null, - rgap: null, - tgap: null, - bgap: null - }); - }, - render: function () { - BI.AdaptiveLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.AdaptiveLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative"}); - var left = 0, right = 0, top = 0, bottom = 0; - if (BI.isNotNull(item.left)) { - w.element.css({ - "margin-left": item.left - }) - } - if (BI.isNotNull(item.right)) { - w.element.css({ - "margin-right": item.right - }) - } - if (BI.isNotNull(item.top)) { - w.element.css({ - "margin-top": item.top - }) - } - if (BI.isNotNull(item.bottom)) { - w.element.css({ - "margin-bottom": item.bottom - }) - } - - if (BI.isNotNull(o.hgap)) { - left += o.hgap; - w.element.css({"left": left}); - right += o.hgap; - w.element.css({"right": right}); - } - if (BI.isNotNull(o.vgap)) { - top += o.vgap; - w.element.css({"top": top}); - bottom += o.vgap; - w.element.css({"bottom": bottom}); - } - - if (BI.isNotNull(o.lgap)) { - left += o.lgap; - w.element.css({"left": left}); - } - if (BI.isNotNull(o.rgap)) { - right += o.rgap; - w.element.css({"right": right}); - } - if (BI.isNotNull(o.tgap)) { - top += o.tgap; - w.element.css({"top": top}); - } - if (BI.isNotNull(o.bgap)) { - bottom += o.bgap; - w.element.css({"bottom": bottom}); - } - - if (BI.isNotNull(item.width)) { - w.element.css({"width": item.width}); - } - if (BI.isNotNull(item.height)) { - w.element.css({"height": item.height}); - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - populate: function (items) { - BI.AbsoluteLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.adaptive', BI.AdaptiveLayout);/** - * 上下的高度固定/左右的宽度固定,中间的高度/宽度自适应 - * - * @class BI.BorderLayout - * @extends BI.Layout - */ -BI.BorderLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.BorderLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-border-layout", - items: {} - }); - }, - render: function () { - BI.BorderLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - this.stroke(this.options.items); - }, - - addItem: function (item) { - // do nothing - throw new Error("cannot be added") - }, - - stroke: function(regions){ - var item; - var top = 0; - var bottom = 0; - var left = 0; - var right = 0; - if ("north" in regions) { - item = regions["north"]; - if (item != null) { - if (item.el) { - if (!this.hasWidget(this.getName() + "north")) { - var w = BI.createWidget(item); - this.addWidget(this.getName() + "north", w); - } - this.getWidgetByName(this.getName() + "north").element.height(item.height) - .css({ - "position": "absolute", - "top": (item.top || 0), - "left": (item.left || 0), - "right": (item.right || 0), - "bottom": "initial" - }); - } - top = (item.height || 0) + (item.top || 0) + (item.bottom || 0); - } - } - if ("south" in regions) { - item = regions["south"]; - if (item != null) { - if (item.el) { - if (!this.hasWidget(this.getName() + "south")) { - var w = BI.createWidget(item); - this.addWidget(this.getName() + "south", w); - } - this.getWidgetByName(this.getName() + "south").element.height(item.height) - .css({ - "position": "absolute", - "bottom": (item.bottom || 0), - "left": (item.left || 0), - "right": (item.right || 0), - "top": "initial" - }); - } - bottom = (item.height || 0) + (item.top || 0) + (item.bottom || 0); - } - } - if ("west" in regions) { - item = regions["west"]; - if (item != null) { - if (item.el) { - if (!this.hasWidget(this.getName() + "west")) { - var w = BI.createWidget(item); - this.addWidget(this.getName() + "west", w); - } - this.getWidgetByName(this.getName() + "west").element.width(item.width) - .css({ - "position": "absolute", - "left": (item.left || 0), - top: top, - bottom: bottom, - "right": "initial" - }); - } - left = (item.width || 0) + (item.left || 0) + (item.right || 0); - } - } - if ("east" in regions) { - item = regions["east"]; - if (item != null) { - if (item.el) { - if (!this.hasWidget(this.getName() + "east")) { - var w = BI.createWidget(item); - this.addWidget(this.getName() + "east", w); - } - this.getWidgetByName(this.getName() + "east").element.width(item.width) - .css({ - "position": "absolute", - "right": (item.right || 0), - top: top, - bottom: bottom, - "left": "initial" - }); - } - right = (item.width || 0) + (item.left || 0) + (item.right || 0); - } - } - if ("center" in regions) { - item = regions["center"]; - if (item != null) { - if (!this.hasWidget(this.getName() + "center")) { - var w = BI.createWidget(item); - this.addWidget(this.getName() + "center", w); - } - this.getWidgetByName(this.getName() + "center").element - .css({"position": "absolute", "top": top, "bottom": bottom, "left": left, "right": right}); - } - } - }, - - populate: function (items) { - BI.BorderLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.border', BI.BorderLayout);/** - * 卡片布局,可以做到当前只显示一个组件,其他的都隐藏 - * @class BI.CardLayout - * @extends BI.Layout - * - * @cfg {JSON} options 配置属性 - * @cfg {String} options.defaultShowName 默认展示的子组件名 - */ -BI.CardLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.CardLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-card-layout", - items: [] - }); - }, - render: function () { - BI.CardLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("default布局不需要resize"); - }, - - stroke: function (items) { - var self = this, o = this.options; - this.showIndex = void 0; - BI.each(items, function (i, item) { - if (!!item) { - if (!self.hasWidget(item.cardName)) { - var w = BI.createWidget(item); - w.on(BI.Events.DESTROY, function () { - var index = BI.findIndex(o.items, function (i, tItem) { - return tItem.cardName == item.cardName; - }); - if (index > -1) { - o.items.splice(index, 1); - } - }); - self.addWidget(item.cardName, w); - } else { - var w = self.getWidgetByName(item.cardName); - } - w.element.css({"position": "absolute", "top": "0", "right": "0", "bottom": "0", "left": "0"}); - w.setVisible(false); - } - }); - }, - - update: function () { - }, - - empty: function () { - BI.CardLayout.superclass.empty.apply(this, arguments); - this.options.items = []; - }, - - populate: function (items) { - BI.CardLayout.superclass.populate.apply(this, arguments); - this._mount(); - this.options.defaultShowName && this.showCardByName(this.options.defaultShowName); - }, - - isCardExisted: function (cardName) { - return BI.some(this.options.items, function (i, item) { - return item.cardName == cardName && item.el; - }); - }, - - getCardByName: function (cardName) { - if (!this.isCardExisted(cardName)) { - throw new Error("cardName is not exist"); - } - return this._children[cardName]; - }, - - _deleteCardByName: function (cardName) { - delete this._children[cardName]; - var index = BI.findIndex(this.options.items, function (i, item) { - return item.cardName == cardName; - }); - if (index > -1) { - this.options.items.splice(index, 1); - } - }, - - deleteCardByName: function (cardName) { - if (!this.isCardExisted(cardName)) { - throw new Error("cardName is not exist"); - } - - var child = this._children[cardName]; - this._deleteCardByName(cardName); - child && child._destroy(); - }, - - addCardByName: function (cardName, cardItem) { - if (this.isCardExisted(cardName)) { - throw new Error("cardName is already exist"); - } - var widget = BI.createWidget(cardItem); - widget.element.css({ - "position": "relative", - "top": "0", - "left": "0", - "width": "100%", - "height": "100%" - }).appendTo(this.element); - widget.invisible(); - this.addWidget(cardName, widget); - this.options.items.push({el: cardItem, cardName: cardName}); - return widget; - }, - - showCardByName: function (name, action, callback) { - var self = this; - //name不存在的时候全部隐藏 - var exist = this.isCardExisted(name); - if (this.showIndex != null) { - this.lastShowIndex = this.showIndex; - } - this.showIndex = name; - var flag = false; - BI.each(this.options.items, function (i, item) { - var el = self._children[item.cardName]; - if (el) { - if (name != item.cardName) { - //动画效果只有在全部都隐藏的时候才有意义,且只要执行一次动画操作就够了 - !flag && !exist && (BI.Action && action instanceof BI.Action) ? (action.actionBack(el), flag = true) : el.invisible(); - } else { - (BI.Action && action instanceof BI.Action) ? action.actionPerformed(void 0, el, callback) : (el.visible(), callback && callback()) - } - } - }); - }, - - showLastCard: function () { - var self = this; - this.showIndex = this.lastShowIndex; - BI.each(this.options.items, function (i, item) { - self._children[item.cardName].setVisible(self.showIndex == i); - }) - }, - - setDefaultShowName: function (name) { - this.options.defaultShowName = name; - return this; - }, - - getDefaultShowName: function () { - return this.options.defaultShowName; - }, - - getAllCardNames: function () { - return BI.map(this.options.items, function (i, item) { - return item.cardName; - }) - }, - - getShowingCard: function () { - if (!BI.isKey(this.showIndex)) { - return void 0; - } - return this.getWidgetByName(this.showIndex); - }, - - deleteAllCard: function () { - var self = this; - BI.each(this.getAllCardNames(), function (i, name) { - self.deleteCardByName(name); - }) - }, - - hideAllCard: function () { - var self = this; - BI.each(this.options.items, function (i, item) { - self._children[item.cardName].invisible(); - }); - }, - - isAllCardHide: function () { - var self = this; - var flag = true; - BI.some(this.options.items, function (i, item) { - if (self._children[item.cardName].isVisible()) { - flag = false; - return false; - } - }); - return flag; - }, - - removeWidget: function (nameOrWidget) { - var removeName; - if (BI.isWidget(nameOrWidget)) { - BI.each(this._children, function (name, child) { - if (child === nameOrWidget) { - removeName = name; - } - }) - } else { - removeName = nameOrWidget; - } - if (removeName) { - this._deleteCardByName(removeName); - } - } -}); -BI.shortcut('bi.card', BI.CardLayout);/** - * 默认的布局方式 - * - * @class BI.DefaultLayout - * @extends BI.Layout - */ -BI.DefaultLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.DefaultLayout.superclass.props.apply(this, arguments), { - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - items: [] - }); - }, - render: function () { - BI.DefaultLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.DefaultLayout.superclass._addElement.apply(this, arguments); - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - resize: function () { - // console.log("default布局不需要resize") - }, - - populate: function (items) { - BI.DefaultLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.default', BI.DefaultLayout);/** - * 分隔容器的控件,按照宽度和高度所占比平分整个容器 - * - * @class BI.DivisionLayout - * @extends BI.Layout - */ -BI.DivisionLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.DivisionLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-division-layout", - columns: null, - rows: null, - items: [] - // [ - // { - // column: 0, - // row: 0, - // width: 0.25, - // height: 0.33, - // el: {type: 'bi.button', text: 'button1'} - // }, - // { - // column: 1, - // row: 1, - // width: 0.25, - // height: 0.33, - // el: {type: 'bi.button', text: 'button2'} - // }, - // { - // column: 3, - // row: 2, - // width: 0.25, - // height: 0.33, - // el: {type: 'bi.button', text: 'button3'} - // } - //] - }); - }, - render: function () { - BI.DivisionLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - this.stroke(this.opitons.items); - }, - - addItem: function (item) { - // do nothing - throw new Error("cannot be added") - }, - - stroke: function(items){ - var o = this.options; - var rows = o.rows || o.items.length, columns = o.columns || ((o.items[0] && o.items[0].length) | 0); - var map = BI.makeArray(rows), widths = {}, heights = {}; - function firstElement(item, row, col) { - if (row === 0) { - item.addClass("first-row") - } - if (col === 0) { - item.addClass("first-col"); - } - item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row"); - item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col"); - item.addClass("center-element"); - } - - function firstObject(item, row, col) { - var cls = ""; - if (row === 0) { - cls += " first-row"; - } - if (col === 0) { - cls += " first-col"; - } - BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row"); - BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col"); - item.cls = (item.cls || "") + cls + " center-element"; - } - - function first(item, row, col) { - if (item instanceof BI.Widget) { - firstElement(item.element, row, col); - } else if (item.el instanceof BI.Widget) { - firstElement(item.el.element, row, col); - } else if (item.el) { - firstObject(item.el, row, col) - } else { - firstObject(item, row, col); - } - } - BI.each(map, function (i) { - map[i] = BI.makeArray(columns); - }); - BI.each(items, function (i, item) { - if (BI.isArray(item)) { - BI.each(item, function (j, el) { - widths[i] = (widths[i] || 0) + item.width; - heights[j] = (heights[j] || 0) + item.height; - map[i][j] = el; - }); - return; - } - widths[item.row] = (widths[item.row] || 0) + item.width; - heights[item.column] = (heights[item.column] || 0) + item.height; - map[item.row][item.column] = item; - }); - for (var i = 0; i < rows; i++) { - var totalW = 0; - for (var j = 0; j < columns; j++) { - if (!map[i][j]) { - throw new Error("item be required"); - } - if(!this.hasWidget(this.getName() + i + "_" + j)) { - var w = BI.createWidget(map[i][j]); - this.addWidget(this.getName() + i + "_" + j, w); - } else { - w = this.getWidgetByName(this.getName() + i + "_" + j); - } - var left = totalW * 100 / widths[i]; - w.element.css({"position": "absolute", "left": left + "%"}); - if (j > 0) { - var lastW = this.getWidgetByName(this.getName() + i + "_" + (j - 1)); - lastW.element.css({"right": (100 - left) + "%"}); - } - if (j == o.columns - 1) { - w.element.css({"right": "0%"}); - } - first(w, i, j); - totalW += map[i][j].width; - } - } - for (var j = 0; j < o.columns; j++) { - var totalH = 0; - for (var i = 0; i < o.rows; i++) { - var w = this.getWidgetByName(this.getName() + i + "_" + j); - var top = totalH * 100 / heights[j]; - w.element.css({"top": top + "%"}); - if (i > 0) { - var lastW = this.getWidgetByName(this.getName() + (i - 1) + "_" + j); - lastW.element.css({"bottom": (100 - top) + "%"}); - } - if (i == o.rows - 1) { - w.element.css({"bottom": "0%"}); - } - totalH += map[i][j].height; - } - } - }, - - populate: function (items) { - BI.DivisionLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.division', BI.DivisionLayout);/** - * 靠左对齐的自由浮动布局 - * @class BI.FloatLeftLayout - * @extends BI.Layout - * - * @cfg {JSON} options 配置属性 - * @cfg {Number} [hgap=0] 水平间隙 - * @cfg {Number} [vgap=0] 垂直间隙 - */ -BI.FloatLeftLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatLeftLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-left-layout clearfix", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FloatLeftLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FloatLeftLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "float": "left"}); - if (BI.isNotNull(item.left)) { - w.element.css({"left": item.left}); - } - if (BI.isNotNull(item.right)) { - w.element.css({"right": item.right}); - } - if (BI.isNotNull(item.top)) { - w.element.css({"top": item.top}); - } - if ((item.lgap || 0) + o.hgap + o.lgap !== 0) { - w.element.css("margin-left", (item.lgap || 0) + o.hgap + o.lgap); - } - if ((item.rgap || 0) + o.hgap + o.rgap !== 0) { - w.element.css("margin-right", (item.rgap || 0) + o.hgap + o.rgap); - } - if ((item.tgap || 0) + o.vgap + o.tgap !== 0) { - w.element.css("margin-top", (item.tgap || 0) + o.vgap + o.tgap); - } - if ((item.bgap || 0) + o.vgap + o.bgap !== 0) { - w.element.css("margin-bottom", (item.bgap || 0) + o.vgap + o.bgap); - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - populate: function (items) { - BI.FloatLeftLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.left', BI.FloatLeftLayout); - -/** - * 靠右对齐的自由浮动布局 - * @class BI.FloatRightLayout - * @extends BI.Layout - * - * @cfg {JSON} options 配置属性 - * @cfg {Number} [hgap=0] 水平间隙 - * @cfg {Number} [vgap=0] 垂直间隙 - */ -BI.FloatRightLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatRightLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-right-layout clearfix", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FloatRightLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.FloatRightLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "float": "right"}); - if (BI.isNotNull(item.left)) { - w.element.css({"left": item.left}); - } - if (BI.isNotNull(item.right)) { - w.element.css({"right": item.right}); - } - if (BI.isNotNull(item.top)) { - w.element.css({"top": item.top}); - } - if ((item.lgap || 0) + o.hgap + o.lgap !== 0) { - w.element.css("margin-left", (item.lgap || 0) + o.hgap + o.lgap); - } - if ((item.rgap || 0) + o.hgap + o.rgap !== 0) { - w.element.css("margin-right", (item.rgap || 0) + o.hgap + o.rgap); - } - if ((item.tgap || 0) + o.vgap + o.tgap !== 0) { - w.element.css("margin-top", (item.tgap || 0) + o.vgap + o.tgap); - } - if ((item.bgap || 0) + o.vgap + o.bgap !== 0) { - w.element.css("margin-bottom", (item.bgap || 0) + o.vgap + o.bgap); - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - populate: function (items) { - BI.FloatRightLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.right', BI.FloatRightLayout);/** - * 上下的高度固定/左右的宽度固定,中间的高度/宽度自适应 - * - * @class BI.BorderLayout - * @extends BI.Layout - */ -BI.GridLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.GridLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-grid-layout", - columns: null, - rows: null, - items: [] - /*[ - { - column: 0, - row: 0, - el: {type: 'bi.button', text: 'button1'} - }, - { - column: 1, - row: 1, - el: {type: 'bi.button', text: 'button2'} - }, - { - column: 3, - row: 2, - el: {type: 'bi.button', text: 'button3'} - } - ]*/ - }); - }, - render: function () { - BI.GridLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("grid布局不需要resize") - }, - - addItem: function () { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - var rows = o.rows || o.items.length, columns = o.columns || ((o.items[0] && o.items[0].length) | 0); - var width = 100 / columns, height = 100 / rows; - var els = []; - for (var i = 0; i < rows; i++) { - els[i] = []; - } - function firstElement(item, row, col) { - if (row === 0) { - item.addClass("first-row") - } - if (col === 0) { - item.addClass("first-col"); - } - item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row"); - item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col"); - item.addClass("center-element"); - } - - function firstObject(item, row, col) { - var cls = ""; - if (row === 0) { - cls += " first-row"; - } - if (col === 0) { - cls += " first-col"; - } - BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row"); - BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col"); - item.cls = (item.cls || "") + cls + " center-element"; - } - - function first(item, row, col) { - if (item instanceof BI.Widget) { - firstElement(item.element, row, col); - } else if (item.el instanceof BI.Widget) { - firstElement(item.el.element, row, col); - } else if (item.el) { - firstObject(item.el, row, col) - } else { - firstObject(item, row, col); - } - } - - BI.each(items, function (i, item) { - if (BI.isArray(item)) { - BI.each(item, function (j, el) { - els[i][j] = BI.createWidget(el); - }); - return; - } - els[item.row][item.column] = BI.createWidget(item); - }); - for (var i = 0; i < rows; i++) { - for (var j = 0; j < columns; j++) { - if (!els[i][j]) { - els[i][j] = BI.createWidget({ - type: "bi.layout" - }); - } - first(els[i][j], i, j); - els[i][j].element.css({ - "position": "absolute", - "top": height * i + "%", - "left": width * j + "%", - "right": (100 - (width * (j + 1))) + "%", - "bottom": (100 - (height * (i + 1))) + "%" - }); - this.addWidget(els[i][j]); - } - } - }, - - populate: function (items) { - BI.GridLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.grid', BI.GridLayout);/** - * 水平布局 - * @class BI.HorizontalLayout - * @extends BI.Layout - */ -BI.HorizontalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HorizontalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-horizontal-layout", - verticalAlign: "middle", - columnSize: [], - scrollx: true, - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.HorizontalLayout.superclass.render.apply(this, arguments); - this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ - "position": "relative", - "white-space": "nowrap", - "border-spacing": "0px", - "border": "none", - "border-collapse": "separate" - }); - this.$tr = $("<tr>"); - this.$tr.appendTo(this.$table); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var td; - var width = o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i]; - if (!this.hasWidget(this._getChildName(i))) { - var w = BI.createWidget(item); - w.element.css({"position": "relative", "margin": "0px auto"}); - td = BI.createWidget({ - type: "bi.default", - tagName: "td", - attributes: { - width: width - }, - items: [w] - }); - this.addWidget(this._getChildName(i), td); - } else { - td = this.getWidgetByName(this._getChildName(i)); - td.element.attr("width", width); - } - - if (i === 0) { - td.element.addClass("first-element"); - } - td.element.css({ - "position": "relative", - "vertical-align": o.verticalAlign, - "margin": "0", - "padding": "0", - "border": "none" - }); - if (o.hgap + o.lgap + (item.lgap || 0) > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.tgap + (item.tgap || 0) > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return td; - }, - - _mountChildren: function () { - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$tr.append(frag); - this.element.append(this.$table); - } - }, - - - resize: function () { - // console.log("horizontal layout do not need to resize"); - }, - - _getWrapper: function(){ - return this.$tr; - }, - - populate: function (items) { - BI.HorizontalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal', BI.HorizontalLayout); - -/** - * 水平布局 - * @class BI.HorizontalCellLayout - * @extends BI.Layout - */ -BI.HorizontalCellLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HorizontalCellLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-horizontal-cell-layout", - scrollable: true, - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.HorizontalCellLayout.superclass.render.apply(this, arguments); - this.element.css({"display": "table", "vertical-align": "top"}); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.HorizontalCellLayout.superclass._addElement.apply(this, arguments); - w.element.css({"position": "relative", "display": "table-cell", "vertical-align": "middle"}); - if (o.hgap + o.lgap > 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + "px" - }) - } - if (o.hgap + o.rgap > 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + "px" - }) - } - if (o.vgap + o.tgap > 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + "px" - }) - } - if (o.vgap + o.bgap > 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + "px" - }) - } - return w; - }, - - resize: function () { - // console.log("horizontal do not need to resize"); - }, - - populate: function (items) { - BI.HorizontalCellLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal_cell', BI.HorizontalCellLayout);/** - * 靠左对齐的自由浮动布局 - * @class BI.LatticeLayout - * @extends BI.Layout - * - * @cfg {JSON} options 配置属性 - * @cfg {Number} [hgap=0] 水平间隙 - * @cfg {Number} [vgap=0] 垂直间隙 - */ -BI.LatticeLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.LatticeLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-lattice-layout clearfix" - //columnSize: [0.2, 0.2, 0.6], - }); - }, - render: function () { - BI.LatticeLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.LatticeLayout.superclass._addElement.apply(this, arguments); - if (o.columnSize && o.columnSize[i]) { - var width = o.columnSize[i] / BI.sum(o.columnSize) * 100 + "%"; - } else { - var width = 1 / this.options.items.length * 100 + "%" - } - w.element.css({"position": "relative", "float": "left", "width": width}); - return w; - }, - - addItem: function (item) { - var w = BI.LatticeLayout.superclass.addItem.apply(this, arguments); - this.resize(); - return w; - }, - - addItemAt: function (item) { - var w = BI.LatticeLayout.superclass.addItemAt.apply(this, arguments); - this.resize(); - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - populate: function (items) { - BI.LatticeLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.lattice', BI.LatticeLayout);/** - * 上下的高度固定/左右的宽度固定,中间的高度/宽度自适应 - * - * @class BI.TableLayout - * @extends BI.Layout - */ -BI.TableLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.TableLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-table-layout", - scrolly: true, - columnSize: [200, 200, 'fill'], - rowSize: 30, //or [30,30,30] - hgap: 0, - vgap: 0, - items: [[ - { - el: {text: 'label1'} - }, - { - el: {text: 'label2'} - }, - { - el: {text: 'label3'} - } - ]] - }); - }, - render: function () { - BI.TableLayout.superclass.render.apply(this, arguments); - this.rows = 0; - this.populate(this.options.items); - }, - - _addElement: function (idx, arr) { - var o = this.options; - var abs = [], left = 0, right = 0, i, j; - - function firstElement(item, row, col) { - if (row === 0) { - item.addClass("first-row") - } - if (col === 0) { - item.addClass("first-col"); - } - item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row"); - item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col"); - item.addClass("center-element"); - } - - function firstObject(item, row, col) { - var cls = ""; - if (row === 0) { - cls += " first-row"; - } - if (col === 0) { - cls += " first-col"; - } - BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row"); - BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col"); - item.cls = (item.cls || "") + cls + " center-element"; - } - - function first(item, row, col) { - if (item instanceof BI.Widget) { - firstElement(item.element, row, col); - } else if (item.el instanceof BI.Widget) { - firstElement(item.el.element, row, col); - } else if (item.el) { - firstObject(item.el, row, col) - } else { - firstObject(item, row, col); - } - } - - for (i = 0; i < arr.length; i++) { - if (BI.isNumber(o.columnSize[i])) { - first(arr[i], this.rows, i); - abs.push(BI.extend({ - top: 0, - bottom: 0, - left: o.columnSize[i] <= 1 ? left * 100 + "%" : left, - width: o.columnSize[i] <= 1 ? o.columnSize[i] * 100 + "%" : o.columnSize[i] - }, arr[i])); - left += o.columnSize[i] + (o.columnSize[i] < 1 ? 0 : o.hgap); - } else { - break; - } - } - for (j = arr.length - 1; j > i; j--) { - if (BI.isNumber(o.columnSize[j])) { - first(arr[j], this.rows, j); - abs.push(BI.extend({ - top: 0, - bottom: 0, - right: o.columnSize[j] <= 1 ? right * 100 + "%" : right, - width: o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] - }, arr[j])) - right += o.columnSize[j] + (o.columnSize[j] < 1 ? 0 : o.hgap); - } else { - throw new Error("item with fill can only be one"); - } - } - if (i >= 0 && i < arr.length) { - first(arr[i], this.rows, i); - abs.push(BI.extend({ - top: 0, - bottom: 0, - left: left <= 1 ? left * 100 + "%" : left, - right: right <= 1 ? right * 100 + "%" : right - }, arr[i])) - } - var w = BI.createWidget({ - type: "bi.absolute", - height: BI.isArray(o.rowSize) ? o.rowSize[this.rows] : o.rowSize, - items: abs - }); - if (this.rows > 0) { - this.getWidgetByName(this.getName() + (this.rows - 1)).element.css({ - "margin-bottom": o.vgap - }) - } - w.element.css({ - "position": "relative" - }); - this.addWidget(this.getName() + (this.rows++), w); - return w; - }, - - resize: function () { - // console.log("table布局不需要resize"); - }, - - addItem: function (arr) { - if (!BI.isArray(arr)) { - throw new Error("item must be array"); - } - return BI.TableLayout.superclass.addItem.apply(this, arguments); - }, - - populate: function (items) { - BI.TableLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.table', BI.TableLayout);/** - * 水平tape布局 - * @class BI.HTapeLayout - * @extends BI.Layout - */ -BI.HTapeLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HTapeLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-h-tape-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - items: [ - { - width: 100, - el: {type: 'bi.button', text: 'button1'} - }, - { - width: 'fill', - el: {type: 'bi.button', text: 'button2'} - }, - { - width: 200, - el: {type: 'bi.button', text: 'button3'} - } - ] - }); - }, - render: function () { - BI.HTapeLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - this.stroke(this.options.items); - }, - addItem: function (item) { - // do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var self = this, o = this.options; - items = BI.compact(items); - BI.each(items, function (i, item) { - if (!self.hasWidget(self.getName() + i + "")) { - var w = BI.createWidget(item); - self.addWidget(self.getName() + i + "", w); - } else { - w = self.getWidgetByName(self.getName() + i + ""); - } - w.element.css({"position": "absolute", top: o.vgap + o.tgap + "px", bottom: o.vgap + o.bgap + "px"}); - }); - - var left = {}, right = {}; - left[0] = 0; - right[items.length - 1] = 0; - - BI.any(items, function (i, item) { - var w = self.getWidgetByName(self.getName() + i + ""); - if (BI.isNull(left[i])) { - left[i] = left[i - 1] + items[i - 1].width + 2 * o.hgap + o.lgap + o.rgap; - } - if (item.width < 1 && item.width >= 0) { - w.element.css({"left": left[i] * 100 + "%", width: item.width * 100 + "%"}) - } else { - w.element.css({ - "left": left[i] + o.hgap + o.lgap + "px", - width: BI.isNumber(item.width) ? item.width : "" - }); - } - if (!BI.isNumber(item.width)) { - return true; - } - }); - BI.backAny(items, function (i, item) { - var w = self.getWidgetByName(self.getName() + i + ""); - if (BI.isNull(right[i])) { - right[i] = right[i + 1] + items[i + 1].width + 2 * o.hgap + o.lgap + o.rgap; - } - if (item.width < 1 && item.width >= 0) { - w.element.css({"right": right[i] * 100 + "%", width: item.width * 100 + "%"}) - } else { - w.element.css({ - "right": right[i] + o.hgap + o.rgap + "px", - width: BI.isNumber(item.width) ? item.width : "" - }); - } - if (!BI.isNumber(item.width)) { - return true; - } - }) - }, - - populate: function (items) { - BI.HTapeLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.htape', BI.HTapeLayout); - -/** - * 垂直tape布局 - * @class BI.VTapeLayout - * @extends BI.Layout - */ -BI.VTapeLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.VTapeLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-v-tape-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - items: [ - { - height: 100, - el: {type: 'bi.button', text: 'button1'} - }, - { - height: 'fill', - el: {type: 'bi.button', text: 'button2'} - }, - { - height: 200, - el: {type: 'bi.button', text: 'button3'} - } - ] - }); - }, - render: function () { - BI.VTapeLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - this.stroke(this.options.items); - }, - - addItem: function (item) { - // do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var self = this, o = this.options; - items = BI.compact(items); - BI.each(items, function (i, item) { - if (!self.hasWidget(self.getName() + i + "")) { - var w = BI.createWidget(item); - self.addWidget(self.getName() + i + "", w); - } else { - w = self.getWidgetByName(self.getName() + i + ""); - } - w.element.css({"position": "absolute", left: o.hgap + o.lgap + "px", right: o.hgap + o.rgap + "px"}); - }); - - var top = {}, bottom = {}; - top[0] = 0; - bottom[items.length - 1] = 0; - - BI.any(items, function (i, item) { - var w = self.getWidgetByName(self.getName() + i + ""); - if (BI.isNull(top[i])) { - top[i] = top[i - 1] + items[i - 1].height + 2 * o.vgap + o.tgap + o.bgap; - } - if (item.height < 1 && item.height >= 0) { - w.element.css({"top": top[i] * 100 + "%", height: item.height * 100 + "%"}) - } else { - w.element.css({ - "top": top[i] + o.vgap + o.tgap + "px", - height: BI.isNumber(item.height) ? item.height : "" - }); - } - if (!BI.isNumber(item.height)) { - return true; - } - }); - BI.backAny(items, function (i, item) { - var w = self.getWidgetByName(self.getName() + i + ""); - if (BI.isNull(bottom[i])) { - bottom[i] = bottom[i + 1] + items[i + 1].height + 2 * o.vgap + o.tgap + o.bgap; - } - if (item.height < 1 && item.height >= 0) { - w.element.css({"bottom": bottom[i] * 100 + "%", height: item.height * 100 + "%"}) - } else { - w.element.css({ - "bottom": bottom[i] + o.vgap + o.bgap + "px", - height: BI.isNumber(item.height) ? item.height : "" - }); - } - if (!BI.isNumber(item.height)) { - return true; - } - }) - }, - - populate: function (items) { - BI.VTapeLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.vtape', BI.VTapeLayout);/** - * td布局 - * @class BI.TdLayout - * @extends BI.Layout - */ -BI.TdLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.TdLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-td-layout", - columnSize: [200, 200, 200], - hgap: 0, - vgap: 0, - items: [[ - { - el: {text: 'label1'} - }, - { - el: {text: 'label2'} - }, - { - el: {text: 'label3'} - } - ]] - }); - }, - render: function () { - BI.TdLayout.superclass.render.apply(this, arguments); - this.$table = $("<table>").attr({"cellspacing": 0, "cellpadding": 0}).css({ - "position": "relative", - "width": "100%", - "height": "100%", - "border-spacing": "0px", - "border": "none", - "border-collapse": "separate" - }); - this.rows = 0; - this.populate(this.options.items); - }, - - _addElement: function (idx, arr) { - var o = this.options; - - function firstElement(item, row, col) { - if (row === 0) { - item.addClass("first-row") - } - if (col === 0) { - item.addClass("first-col"); - } - item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row"); - item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col"); - item.addClass("center-element"); - } - - function firstObject(item, row, col) { - var cls = ""; - if (row === 0) { - cls += " first-row"; - } - if (col === 0) { - cls += " first-col"; - } - BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row"); - BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col"); - item.cls = (item.cls || "") + cls + " center-element"; - } - - function first(item, row, col) { - if (item instanceof BI.Widget) { - firstElement(item.element, row, col); - } else if (item.el instanceof BI.Widget) { - firstElement(item.el.element, row, col); - } else if (item.el) { - firstObject(item.el, row, col) - } else { - firstObject(item, row, col); - } - } - - var tr = BI.createWidget({ - type: "bi.default", - tagName: "tr" - }); - - for (var i = 0; i < arr.length; i++) { - var w = BI.createWidget(arr[i]); - w.element.css({"position": "relative", "top": "0", "left": "0", "margin": "0px auto"}); - first(w, this.rows++, i); - var td = BI.createWidget({ - type: 'bi.default', - attributes: { - width: o.columnSize[i] <= 1 ? (o.columnSize[i] * 100 + "%") : o.columnSize[i] - }, - tagName: 'td', - items: [w] - }); - td.element.css({ - "position": "relative", - "vertical-align": "middle", - "margin": "0", - "padding": "0", - "border": "none" - }); - tr.addItem(td); - } - this.addWidget(this.getName() + idx, tr); - return tr; - }, - - _mountChildren: function(){ - var self = this; - var frag = document.createDocumentFragment(); - var hasChild = false; - BI.each(this._children, function (i, widget) { - if (widget.element !== self.element) { - frag.appendChild(widget.element[0]); - hasChild = true; - } - }); - if (hasChild === true) { - this.$table.append(frag); - this.element.append(this.$table); - } - }, - - resize: function () { - // console.log("td布局不需要resize"); - }, - - addItem: function (arr) { - if (!BI.isArray(arr)) { - throw new Error("item must be array"); - } - return BI.TdLayout.superclass.addItem.apply(this, arguments); - }, - - populate: function (items) { - BI.TdLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.td', BI.TdLayout);/** - * 垂直布局 - * @class BI.VerticalLayout - * @extends BI.Layout - */ -BI.VerticalLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.VerticalLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-vertical-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - scrolly: true - }); - }, - render: function () { - BI.VerticalLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - _addElement: function (i, item) { - var o = this.options; - var w = BI.VerticalLayout.superclass._addElement.apply(this, arguments); - w.element.css({ - "position": "relative" - }); - if (o.vgap + o.tgap + (item.tgap || 0) !== 0) { - w.element.css({ - "margin-top": o.vgap + o.tgap + (item.tgap || 0) + "px" - }) - } - if (o.hgap + o.lgap + (item.lgap || 0) !== 0) { - w.element.css({ - "margin-left": o.hgap + o.lgap + (item.lgap || 0) + "px" - }) - } - if (o.hgap + o.rgap + (item.rgap || 0) !== 0) { - w.element.css({ - "margin-right": o.hgap + o.rgap + (item.rgap || 0) + "px" - }) - } - if (o.vgap + o.bgap + (item.bgap || 0) !== 0) { - w.element.css({ - "margin-bottom": o.vgap + o.bgap + (item.bgap || 0) + "px" - }) - } - return w; - }, - - resize: function () { - this.stroke(this.options.items); - }, - - populate: function (items) { - BI.VerticalLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.vertical', BI.VerticalLayout);/** - * - * @class BI.WindowLayout - * @extends BI.Layout - */ -BI.WindowLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.WindowLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-window-layout", - columns: 3, - rows: 2, - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0, - columnSize: [100, "fill", 200], - rowSize: [100, "fill"], - items: [[ - { - el: {type: 'bi.button', text: 'button1'} - }, - { - el: {type: 'bi.button', text: 'button2'} - }, - { - el: {type: 'bi.button', text: 'button3'} - } - ]] - }); - }, - render: function () { - BI.WindowLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - this.stroke(this.options.items); - }, - - addItem: function (item) { - // do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - if (BI.isNumber(o.rowSize)) { - o.rowSize = BI.makeArray(o.items.length, 1 / o.items.length); - } - if (BI.isNumber(o.columnSize)) { - o.columnSize = BI.makeArray(o.items[0].length, 1 / o.items[0].length); - } - function firstElement(item, row, col) { - if (row === 0) { - item.addClass("first-row") - } - if (col === 0) { - item.addClass("first-col"); - } - item.addClass(BI.isOdd(row + 1) ? "odd-row" : "even-row"); - item.addClass(BI.isOdd(col + 1) ? "odd-col" : "even-col"); - item.addClass("center-element"); - } - - function firstObject(item, row, col) { - var cls = ""; - if (row === 0) { - cls += " first-row"; - } - if (col === 0) { - cls += " first-col"; - } - BI.isOdd(row + 1) ? (cls += " odd-row") : (cls += " even-row"); - BI.isOdd(col + 1) ? (cls += " odd-col") : (cls += " even-col"); - item.cls = (item.cls || "") + cls + " center-element"; - } - - function first(item, row, col) { - if (item instanceof BI.Widget) { - firstElement(item.element, row, col); - } else if (item.el instanceof BI.Widget) { - firstElement(item.el.element, row, col); - } else if (item.el) { - firstObject(item.el, row, col) - } else { - firstObject(item, row, col); - } - } - - for (var i = 0; i < o.rows; i++) { - for (var j = 0; j < o.columns; j++) { - if (!o.items[i][j]) { - throw new Error("item be required"); - } - if (!this.hasWidget(this.getName() + i + "_" + j)) { - var w = BI.createWidget(o.items[i][j]); - w.element.css({"position": "absolute"}); - this.addWidget(this.getName() + i + "_" + j, w); - } - } - } - var left = {}, right = {}, top = {}, bottom = {}; - left[0] = 0; - top[0] = 0; - right[o.columns - 1] = 0; - bottom[o.rows - 1] = 0; - //从上到下 - for (var i = 0; i < o.rows; i++) { - for (var j = 0; j < o.columns; j++) { - var wi = this.getWidgetByName(this.getName() + i + "_" + j); - if (BI.isNull(top[i])) { - top[i] = top[i - 1] + (o.rowSize[i - 1] < 1 ? o.rowSize[i - 1] : o.rowSize[i - 1] + o.vgap + o.bgap); - } - var t = top[i] <= 1 ? top[i] * 100 + "%" : top[i] + o.vgap + o.tgap + "px", h = ""; - if (BI.isNumber(o.rowSize[i])) { - h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] + "px"; - } - wi.element.css({"top": t, height: h}); - first(wi, i, j); - } - if (!BI.isNumber(o.rowSize[i])) { - break; - } - } - //从下到上 - for (var i = o.rows - 1; i >= 0; i--) { - for (var j = 0; j < o.columns; j++) { - var wi = this.getWidgetByName(this.getName() + i + "_" + j); - if (BI.isNull(bottom[i])) { - bottom[i] = bottom[i + 1] + (o.rowSize[i + 1] < 1 ? o.rowSize[i + 1] : o.rowSize[i + 1] + o.vgap + o.tgap); - } - var b = bottom[i] <= 1 ? bottom[i] * 100 + "%" : bottom[i] + o.vgap + o.bgap + "px", h = ""; - if (BI.isNumber(o.rowSize[i])) { - h = o.rowSize[i] <= 1 ? o.rowSize[i] * 100 + "%" : o.rowSize[i] + "px"; - } - wi.element.css({"bottom": b, height: h}); - first(wi, i, j); - } - if (!BI.isNumber(o.rowSize[i])) { - break; - } - } - //从左到右 - for (var j = 0; j < o.columns; j++) { - for (var i = 0; i < o.rows; i++) { - var wi = this.getWidgetByName(this.getName() + i + "_" + j); - if (BI.isNull(left[j])) { - left[j] = left[j - 1] + (o.columnSize[j - 1] < 1 ? o.columnSize[j - 1] : o.columnSize[j - 1] + o.hgap + o.rgap); - } - var l = left[j] <= 1 ? left[j] * 100 + "%" : left[j] + o.hgap + o.lgap + "px", w = ""; - if (BI.isNumber(o.columnSize[j])) { - w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] + "px"; - } - wi.element.css({"left": l, width: w}); - first(wi, i, j); - } - if (!BI.isNumber(o.columnSize[j])) { - break; - } - } - //从右到左 - for (var j = o.columns - 1; j >= 0; j--) { - for (var i = 0; i < o.rows; i++) { - var wi = this.getWidgetByName(this.getName() + i + "_" + j); - if (BI.isNull(right[j])) { - right[j] = right[j + 1] + (o.columnSize[j + 1] < 1 ? o.columnSize[j + 1] : o.columnSize[j + 1] + o.hgap + o.lgap) - } - var r = right[j] <= 1 ? right[j] * 100 + "%" : right[j] + o.hgap + o.rgap + "px", w = ""; - if (BI.isNumber(o.columnSize[j])) { - w = o.columnSize[j] <= 1 ? o.columnSize[j] * 100 + "%" : o.columnSize[j] + "px"; - } - wi.element.css({"right": r, width: w}); - first(wi, i, j); - } - if (!BI.isNumber(o.columnSize[j])) { - break; - } - } - }, - - populate: function (items) { - BI.WindowLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.window', BI.WindowLayout);/** - * 水平和垂直方向都居中容器, 非自适应,用于宽度高度固定的面板 - * @class BI.CenterLayout - * @extends BI.Layout - */ -BI.CenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.CenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-center-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - - render: function () { - BI.CenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("center布局不需要resize"); - }, - - addItem: function (item) { - //do nothing - throw new Error("cannot be added"); - }, - - stroke: function (items) { - var self = this, o = this.options; - var list = []; - BI.each(items, function (i) { - list.push({ - column: i, - row: 0, - el: BI.createWidget({ - type: "bi.default", - cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") - }) - }); - }); - BI.each(items, function (i, item) { - if (!!item) { - var w = BI.createWidget(item); - w.element.css({ - position: "absolute", - left: o.hgap + o.lgap, - right: o.hgap + o.rgap, - top: o.vgap + o.tgap, - bottom: o.vgap + o.bgap, - width: "auto", - height: "auto" - }); - list[i].el.addItem(w); - } - }); - BI.createWidget({ - type: "bi.grid", - element: this, - columns: list.length, - rows: 1, - items: list - }); - }, - - populate: function (items) { - BI.CenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.center', BI.CenterLayout);/** - * 浮动布局实现的居中容器 - * @class BI.FloatCenterLayout - * @extends BI.Layout - */ -BI.FloatCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.FloatCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-float-center-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.FloatCenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("floatcenter布局不需要resize"); - }, - - addItem: function (item) { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var self = this, o = this.options; - var list = [], width = 100 / items.length; - BI.each(items, function (i) { - var widget = BI.createWidget({ - type: "bi.default" - }); - widget.element.addClass("center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "")).css({ - width: width + "%", - height: "100%" - }); - list.push({ - el: widget - }); - }); - BI.each(items, function (i, item) { - if (!!item) { - var w = BI.createWidget(item); - w.element.css({ - position: "absolute", - left: o.hgap + o.lgap, - right: o.hgap + o.rgap, - top: o.vgap + o.tgap, - bottom: o.vgap + o.bgap, - width: "auto", - height: "auto" - }); - list[i].el.addItem(w); - } - }); - BI.createWidget({ - type: "bi.left", - element: this, - items: list - }); - }, - - populate: function (items) { - BI.FloatCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.float_center', BI.FloatCenterLayout);/** - * 水平和垂直方向都居中容器, 非自适应,用于宽度高度固定的面板 - * @class BI.HorizontalCenterLayout - * @extends BI.Layout - */ -BI.HorizontalCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.HorizontalCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-horizontal-center-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.HorizontalCenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("horizontal_center布局不需要resize"); - }, - - addItem: function (item) { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var o = this.options; - var list = []; - BI.each(items, function (i) { - list.push({ - column: i, - row: 0, - el: BI.createWidget({ - type: "bi.default", - cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") - }) - }); - }); - BI.each(items, function (i, item) { - if (!!item) { - var w = BI.createWidget(item); - w.element.css({ - position: "absolute", - left: o.hgap + o.lgap, - right: o.hgap + o.rgap, - top: o.vgap + o.tgap, - bottom: o.vgap + o.bgap, - width: "auto" - }); - list[i].el.addItem(w); - } - }); - BI.createWidget({ - type: "bi.grid", - element: this, - columns: list.length, - rows: 1, - items: list - }); - }, - - populate: function (items) { - BI.HorizontalCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.horizontal_center', BI.HorizontalCenterLayout);/** - * 垂直方向都居中容器, 非自适应,用于高度不固定的面板 - * @class BI.VerticalCenterLayout - * @extends BI.Layout - */ -BI.VerticalCenterLayout = BI.inherit(BI.Layout, { - props: function () { - return BI.extend(BI.VerticalCenterLayout.superclass.props.apply(this, arguments), { - baseCls: "bi-vertical-center-layout", - hgap: 0, - vgap: 0, - lgap: 0, - rgap: 0, - tgap: 0, - bgap: 0 - }); - }, - render: function () { - BI.VerticalCenterLayout.superclass.render.apply(this, arguments); - this.populate(this.options.items); - }, - - resize: function () { - // console.log("vertical_center布局不需要resize"); - }, - - addItem: function (item) { - //do nothing - throw new Error("cannot be added") - }, - - stroke: function (items) { - var self = this, o = this.options; - var list = []; - BI.each(items, function (i) { - list.push({ - column: 0, - row: i, - el: BI.createWidget({ - type: "bi.default", - cls: "center-element " + (i === 0 ? "first-element " : "") + (i === items.length - 1 ? "last-element" : "") - }) - }); - }); - BI.each(items, function (i, item) { - if (!!item) { - var w = BI.createWidget(item); - w.element.css({ - position: "absolute", - left: o.hgap + o.lgap, - right: o.hgap + o.rgap, - top: o.vgap + o.tgap, - bottom: o.vgap + o.bgap, - height: "auto" - }); - list[i].el.addItem(w); - } - }); - BI.createWidget({ - type: "bi.grid", - element: this, - columns: 1, - rows: list.length, - items: list - }); - }, - - populate: function (items) { - BI.VerticalCenterLayout.superclass.populate.apply(this, arguments); - this._mount(); - } -}); -BI.shortcut('bi.vertical_center', BI.VerticalCenterLayout);/** - * 保存数据,将js里面用到的常量数据都分离 - * - */ -BI.Data = Data = {}; - -/** - * 存放bi里面通用的一些常量 - * @type {{}} - */ -Data.Constant = BI.Constant = BICst = {}; -/** - * 缓冲池 - * @type {{Buffer: {}}} - */ -; -(function () { - var Buffer = {}; - var MODE = false;//设置缓存模式为关闭 - - Data.BufferPool = { - put: function (name, cache) { - if (BI.isNotNull(Buffer[name])) { - throw new Error("Buffer Pool has the key already!"); - } - Buffer[name] = cache; - }, - - get: function (name) { - return Buffer[name]; - }, - }; -})();/** - * 共享池 - * @type {{Shared: {}}} - */ -; -(function () { - var _Shared = {}; - Data.SharingPool = { - _Shared: _Shared, - put: function (name, shared) { - _Shared[name] = shared; - }, - - cat: function () { - var args = Array.prototype.slice.call(arguments, 0), - copy = _Shared; - for (var i = 0; i < args.length; i++) { - copy = copy[args[i]]; - } - return copy; - }, - - get: function () { - return BI.deepClone(this.cat.apply(this, arguments)); - }, - - remove: function (key) { - delete _Shared[key]; - } - }; -})();Data.Req = { - -}; -Data.Source = BISource = { - -};//工程配置 -$(function () { - //注册布局 - var isSupportFlex = BI.isSupportCss3("flex"); - BI.Plugin.registerWidget("bi.horizontal", function (ob) { - if (isSupportFlex) { - return BI.extend(ob, {type: "bi.flex_horizontal"}); - } else { - return ob; - } - }); - BI.Plugin.registerWidget("bi.center_adapt", function (ob) { - if (isSupportFlex && ob.items && ob.items.length <= 1) { - //有滚动条的情况下需要用到flex_wrapper_center布局 - if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { - //不是IE用flex_wrapper_center布局 - if (!BI.isIE()) { - return BI.extend(ob, {type: "bi.flex_wrapper_center"}); - } - return ob; - } - return BI.extend(ob, {type: "bi.flex_center"}); - } else { - return ob; - } - }); - BI.Plugin.registerWidget("bi.vertical_adapt", function (ob) { - if (isSupportFlex) { - //有滚动条的情况下需要用到flex_wrapper_center布局 - if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { - //不是IE用flex_wrapper_center布局 - if (!BI.isIE()) { - return BI.extend({}, ob, {type: "bi.flex_wrapper_vertical_center"}); - } - return ob; - } - return BI.extend(ob, {type: "bi.flex_vertical_center"}); - } else { - return ob; - } - }); - BI.Plugin.registerWidget("bi.float_center_adapt", function (ob) { - if (isSupportFlex) { - //有滚动条的情况下需要用到flex_wrapper_center布局 - if (ob.scrollable === true || ob.scrollx === true || ob.scrolly === true) { - //不是IE用flex_wrapper_center布局 - if (!BI.isIE()) { - return BI.extend({}, ob, {type: "bi.flex_wrapper_center"}); - } - return ob; - } - return BI.extend(ob, {type: "bi.flex_center"}); - } else { - return ob; - } - }); - //注册滚动条 - BI.Plugin.registerWidget("bi.grid_table_scrollbar", function (ob) { - if (BI.isIE9Below()) { - return BI.extend(ob, {type: "bi.native_table_scrollbar"}); - } else { - return ob; - } - }); - BI.Plugin.registerWidget("bi.grid_table_horizontal_scrollbar", function (ob) { - if (BI.isIE9Below()) { - return BI.extend(ob, {type: "bi.native_table_horizontal_scrollbar"}); - } else { - return ob; - } - }); - - //注册控件 - BI.Plugin.registerWidget("bi.grid_table", function (ob) { - //非chrome下滚动条滑动效果不好,禁止掉 - if (!(BI.isChrome() && BI.isWindows() && !BI.isEdge())) { - return BI.extend(ob, {type: "bi.quick_grid_table"}); - } else { - return ob; - } - }); - BI.Plugin.registerWidget("bi.collection_table", function (ob) { - //非chrome下滚动条滑动效果不好,禁止掉 - if (!(BI.isChrome() && BI.isWindows() && !BI.isEdge())) { - return BI.extend(ob, {type: "bi.quick_collection_table"}); - } else { - return ob; - } - }); - //IE8下滚动条用原生的 - if (BI.isIE9Below()) { - BI.GridTableScrollbar.SIZE = 18; - } ->>>>>>> f7ab8fadf8581f5a532908fdb0283047312fd570 -}); \ No newline at end of file diff --git a/docs/polyfill.js b/docs/polyfill.js index f493c89a5..f67d79a6e 100644 --- a/docs/polyfill.js +++ b/docs/polyfill.js @@ -1,34 +1,101 @@ -if(![].indexOf){ - /** - * 检查指定的值是否在数组中 - * @param {Object} o 要检查的值 - * @return {Number} o在数组中的索引(如果不在数组中则返回-1) - */ - Array.prototype.indexOf = function (o) { - for (var i = 0, len = this.length; i < len; i++) { - if (_.isEqual(o, this[i])) { - return i; +// Production steps of ECMA-262, Edition 5, 15.4.4.14 +// Reference: http://es5.github.io/#x15.4.4.14 +if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function (searchElement, fromIndex) { + + var k; + + // 1. Let o be the result of calling ToObject passing + // the this value as the argument. + if (this == null) { + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let lenValue be the result of calling the Get + // internal method of o with the argument "length". + // 3. Let len be ToUint32(lenValue). + var len = o.length >>> 0; + + // 4. If len is 0, return -1. + if (len === 0) { + return -1; + } + + // 5. If argument fromIndex was passed let n be + // ToInteger(fromIndex); else let n be 0. + var n = fromIndex | 0; + + // 6. If n >= len, return -1. + if (n >= len) { + return -1; + } + + // 7. If n >= 0, then Let k be n. + // 8. Else, n<0, Let k be len - abs(n). + // If k is less than 0, then let k be 0. + k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); + + // 9. Repeat, while k < len + while (k < len) { + // a. Let Pk be ToString(k). + // This is implicit for LHS operands of the in operator + // b. Let kPresent be the result of calling the + // HasProperty internal method of o with argument Pk. + // This step can be combined with c + // c. If kPresent is true, then + // i. Let elementK be the result of calling the Get + // internal method of o with the argument ToString(k). + // ii. Let same be the result of applying the + // Strict Equality Comparison Algorithm to + // searchElement and elementK. + // iii. If same is true, return k. + if (k in o && o[k] === searchElement) { + return k; } + k++; } return -1; - } + }; } -if(![].lastIndexOf){ - /** - * 检查指定的值是否在数组中 - * ie67不支持数组的这个方法 - * @param {Object} o 要检查的值 - * @return {Number} o在数组中的索引(如果不在数组中则返回-1) - */ - Array.prototype.lastIndexOf = function (o) { - for (var len = this.length, i = len - 1; i >= 0; i--) { - if (_.isEqual(o, this[i])) { - return i; +if (!Array.prototype.lastIndexOf) { + Array.prototype.lastIndexOf = function (searchElement /*, fromIndex*/) { + 'use strict'; + + if (this === void 0 || this === null) { + throw new TypeError(); + } + + var n, k, + t = Object(this), + len = t.length >>> 0; + if (len === 0) { + return -1; + } + + n = len - 1; + if (arguments.length > 1) { + n = Number(arguments[1]); + if (n != n) { + n = 0; + } + else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) { + n = (n > 0 || -1) * Math.floor(Math.abs(n)); + } + } + + for (k = n >= 0 + ? Math.min(n, len - 1) + : len - Math.abs(n); k >= 0; k--) { + if (k in t && t[k] === searchElement) { + return k; } } return -1; - } -}/** + }; +} +/** * 特殊情况 * Created by wang on 15/6/23. */ @@ -60,8 +127,23 @@ window.localStorage || (window.localStorage = { clear: function () { this.items = {}; } -});//修复ie9下sort方法的bug -!function (window) { +});if (typeof Set !== 'undefined' && Set.toString().match(/native code/)) { + +} else { + Set = function () { + this.set = {} + }; + Set.prototype.has = function (key) { + return this.set[key] !== undefined; + }; + Set.prototype.add = function (key) { + this.set[key] = 1 + }; + Set.prototype.clear = function () { + this.set = {} + }; +}//修复ie9下sort方法的bug +;!function (window) { var ua = window.navigator.userAgent.toLowerCase(), reg = /msie|applewebkit.+safari/; if (reg.test(ua)) { diff --git a/docs/widget.js b/docs/widget.js index 9799dd01a..2812c570b 100644 --- a/docs/widget.js +++ b/docs/widget.js @@ -5502,6 +5502,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { var self = this, o = this.options; this.editor = BI.createWidget({ type: "bi.sign_editor", + height: o.height, value: this._alertInEditorValue(o.value), errorText: BI.i18nText("BI-Please_Input_Natural_Number"), validationChecker: function(v){ @@ -5549,7 +5550,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { el: this.bottomBtn }] }, - width: 30 + width: 23 }] }); }, @@ -14632,12 +14633,6 @@ BI.SequenceTable = BI.inherit(BI.Widget, { _populate: function () { var o = this.options; - this.sequence.attr({ - items: o.items, - header: o.header, - crossItems: o.crossItems, - crossHeader: o.crossHeader - }); if (o.showSequence === true) { this.sequence.setVisible(true); this.table.element.css("left", "60px"); diff --git a/gitbook/LICENSE b/gitbook/LICENSE new file mode 100644 index 000000000..8fdf076ab --- /dev/null +++ b/gitbook/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 gittz + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/gitbook/gitbook/fonts/fontawesome/FontAwesome.otf b/gitbook/gitbook/fonts/fontawesome/FontAwesome.otf new file mode 100644 index 000000000..d4de13e83 Binary files /dev/null and b/gitbook/gitbook/fonts/fontawesome/FontAwesome.otf differ diff --git a/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.eot b/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.eot new file mode 100644 index 000000000..c7b00d2ba Binary files /dev/null and b/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.eot differ diff --git a/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.svg b/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.svg new file mode 100644 index 000000000..8b66187fe --- /dev/null +++ b/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.svg @@ -0,0 +1,685 @@ +<?xml version="1.0" standalone="no"?> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > +<svg xmlns="http://www.w3.org/2000/svg"> +<metadata></metadata> +<defs> +<font id="fontawesomeregular" horiz-adv-x="1536" > +<font-face units-per-em="1792" ascent="1536" descent="-256" /> +<missing-glyph horiz-adv-x="448" /> +<glyph unicode=" " horiz-adv-x="448" /> +<glyph unicode=" " horiz-adv-x="448" /> +<glyph unicode=" " horiz-adv-x="448" /> +<glyph unicode="¨" horiz-adv-x="1792" /> +<glyph unicode="©" horiz-adv-x="1792" /> +<glyph unicode="®" horiz-adv-x="1792" /> +<glyph unicode="´" horiz-adv-x="1792" /> +<glyph unicode="Æ" horiz-adv-x="1792" /> +<glyph unicode="Ø" horiz-adv-x="1792" /> +<glyph unicode=" " horiz-adv-x="768" /> +<glyph unicode=" " horiz-adv-x="1537" /> +<glyph unicode=" " horiz-adv-x="768" /> +<glyph unicode=" " horiz-adv-x="1537" /> +<glyph unicode=" " horiz-adv-x="512" /> +<glyph unicode=" " horiz-adv-x="384" /> +<glyph unicode=" " horiz-adv-x="256" /> +<glyph unicode=" " horiz-adv-x="256" /> +<glyph unicode=" " horiz-adv-x="192" /> +<glyph unicode=" " horiz-adv-x="307" /> +<glyph unicode=" " horiz-adv-x="85" /> +<glyph unicode=" " horiz-adv-x="307" /> +<glyph unicode=" " horiz-adv-x="384" /> +<glyph unicode="™" horiz-adv-x="1792" /> +<glyph unicode="∞" horiz-adv-x="1792" /> +<glyph unicode="≠" horiz-adv-x="1792" /> +<glyph unicode="◼" horiz-adv-x="500" d="M0 0z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1699 1350q0 -35 -43 -78l-632 -632v-768h320q26 0 45 -19t19 -45t-19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45t45 19h320v768l-632 632q-43 43 -43 78q0 23 18 36.5t38 17.5t43 4h1408q23 0 43 -4t38 -17.5t18 -36.5z" /> +<glyph unicode="" d="M1536 1312v-1120q0 -50 -34 -89t-86 -60.5t-103.5 -32t-96.5 -10.5t-96.5 10.5t-103.5 32t-86 60.5t-34 89t34 89t86 60.5t103.5 32t96.5 10.5q105 0 192 -39v537l-768 -237v-709q0 -50 -34 -89t-86 -60.5t-103.5 -32t-96.5 -10.5t-96.5 10.5t-103.5 32t-86 60.5t-34 89 t34 89t86 60.5t103.5 32t96.5 10.5q105 0 192 -39v967q0 31 19 56.5t49 35.5l832 256q12 4 28 4q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1664 -128q0 -52 -38 -90t-90 -38q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5 t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 32v768q-32 -36 -69 -66q-268 -206 -426 -338q-51 -43 -83 -67t-86.5 -48.5t-102.5 -24.5h-1h-1q-48 0 -102.5 24.5t-86.5 48.5t-83 67q-158 132 -426 338q-37 30 -69 66v-768q0 -13 9.5 -22.5t22.5 -9.5h1472q13 0 22.5 9.5t9.5 22.5zM1664 1083v11v13.5t-0.5 13 t-3 12.5t-5.5 9t-9 7.5t-14 2.5h-1472q-13 0 -22.5 -9.5t-9.5 -22.5q0 -168 147 -284q193 -152 401 -317q6 -5 35 -29.5t46 -37.5t44.5 -31.5t50.5 -27.5t43 -9h1h1q20 0 43 9t50.5 27.5t44.5 31.5t46 37.5t35 29.5q208 165 401 317q54 43 100.5 115.5t46.5 131.5z M1792 1120v-1088q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1472q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 -128q-26 0 -44 18l-624 602q-10 8 -27.5 26t-55.5 65.5t-68 97.5t-53.5 121t-23.5 138q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5q224 0 351 -124t127 -344q0 -221 -229 -450l-623 -600 q-18 -18 -44 -18z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -21 -10.5 -35.5t-30.5 -14.5q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455 l502 -73q56 -9 56 -46z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1137 532l306 297l-422 62l-189 382l-189 -382l-422 -62l306 -297l-73 -421l378 199l377 -199zM1664 889q0 -22 -26 -48l-363 -354l86 -500q1 -7 1 -20q0 -50 -41 -50q-19 0 -40 12l-449 236l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500 l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41t49 -41l225 -455l502 -73q56 -9 56 -46z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 131q0 -120 -73 -189.5t-194 -69.5h-874q-121 0 -194 69.5t-73 189.5q0 53 3.5 103.5t14 109t26.5 108.5t43 97.5t62 81t85.5 53.5t111.5 20q9 0 42 -21.5t74.5 -48t108 -48t133.5 -21.5t133.5 21.5t108 48t74.5 48t42 21.5q61 0 111.5 -20t85.5 -53.5t62 -81 t43 -97.5t26.5 -108.5t14 -109t3.5 -103.5zM1088 1024q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M384 -64v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM384 320v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM384 704v128q0 26 -19 45t-45 19h-128 q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1408 -64v512q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-512q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM384 1088v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45 t45 -19h128q26 0 45 19t19 45zM1792 -64v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1408 704v512q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-512q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM1792 320v128 q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1792 704v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1792 1088v128q0 26 -19 45t-45 19h-128q-26 0 -45 -19 t-19 -45v-128q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1920 1248v-1344q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1344q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 512v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM768 1280v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM1664 512v-384q0 -52 -38 -90t-90 -38 h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90zM1664 1280v-384q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h512q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M512 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 288v-192q0 -40 -28 -68t-68 -28h-320 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28 h320q40 0 68 -28t28 -68zM1792 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1152 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 800v-192 q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M512 288v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM512 800v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 288v-192q0 -40 -28 -68t-68 -28h-960 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h960q40 0 68 -28t28 -68zM512 1312v-192q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h320q40 0 68 -28t28 -68zM1792 800v-192q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v192q0 40 28 68t68 28 h960q40 0 68 -28t28 -68zM1792 1312v-192q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h960q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1671 970q0 -40 -28 -68l-724 -724l-136 -136q-28 -28 -68 -28t-68 28l-136 136l-362 362q-28 28 -28 68t28 68l136 136q28 28 68 28t68 -28l294 -295l656 657q28 28 68 28t68 -28l136 -136q28 -28 28 -68z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1298 214q0 -40 -28 -68l-136 -136q-28 -28 -68 -28t-68 28l-294 294l-294 -294q-28 -28 -68 -28t-68 28l-136 136q-28 28 -28 68t28 68l294 294l-294 294q-28 28 -28 68t28 68l136 136q28 28 68 28t68 -28l294 -294l294 294q28 28 68 28t68 -28l136 -136q28 -28 28 -68 t-28 -68l-294 -294l294 -294q28 -28 28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1024 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-224v-224q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v224h-224q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h224v224q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5v-224h224 q13 0 22.5 -9.5t9.5 -22.5zM1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1664 -128q0 -53 -37.5 -90.5t-90.5 -37.5q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5 t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1024 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-576q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h576q13 0 22.5 -9.5t9.5 -22.5zM1152 704q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5z M1664 -128q0 -53 -37.5 -90.5t-90.5 -37.5q-54 0 -90 38l-343 342q-179 -124 -399 -124q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -220 -124 -399l343 -343q37 -37 37 -90z " /> +<glyph unicode="" d="M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61t-298 61t-245 164t-164 245t-61 298q0 182 80.5 343t226.5 270q43 32 95.5 25t83.5 -50q32 -42 24.5 -94.5t-49.5 -84.5q-98 -74 -151.5 -181t-53.5 -228q0 -104 40.5 -198.5t109.5 -163.5t163.5 -109.5 t198.5 -40.5t198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5q0 121 -53.5 228t-151.5 181q-42 32 -49.5 84.5t24.5 94.5q31 43 84 50t95 -25q146 -109 226.5 -270t80.5 -343zM896 1408v-640q0 -52 -38 -90t-90 -38t-90 38t-38 90v640q0 52 38 90t90 38t90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M256 96v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM640 224v-320q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v320q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1024 480v-576q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23 v576q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1408 864v-960q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v960q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1792 1376v-1472q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v1472q0 14 9 23t23 9h192q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1024 640q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1536 749v-222q0 -12 -8 -23t-20 -13l-185 -28q-19 -54 -39 -91q35 -50 107 -138q10 -12 10 -25t-9 -23q-27 -37 -99 -108t-94 -71q-12 0 -26 9l-138 108q-44 -23 -91 -38 q-16 -136 -29 -186q-7 -28 -36 -28h-222q-14 0 -24.5 8.5t-11.5 21.5l-28 184q-49 16 -90 37l-141 -107q-10 -9 -25 -9q-14 0 -25 11q-126 114 -165 168q-7 10 -7 23q0 12 8 23q15 21 51 66.5t54 70.5q-27 50 -41 99l-183 27q-13 2 -21 12.5t-8 23.5v222q0 12 8 23t19 13 l186 28q14 46 39 92q-40 57 -107 138q-10 12 -10 24q0 10 9 23q26 36 98.5 107.5t94.5 71.5q13 0 26 -10l138 -107q44 23 91 38q16 136 29 186q7 28 36 28h222q14 0 24.5 -8.5t11.5 -21.5l28 -184q49 -16 90 -37l142 107q9 9 24 9q13 0 25 -10q129 -119 165 -170q7 -8 7 -22 q0 -12 -8 -23q-15 -21 -51 -66.5t-54 -70.5q26 -50 41 -98l183 -28q13 -2 21 -12.5t8 -23.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M512 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM768 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1024 800v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576 q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1152 76v948h-896v-948q0 -22 7 -40.5t14.5 -27t10.5 -8.5h832q3 0 10.5 8.5t14.5 27t7 40.5zM480 1152h448l-48 117q-7 9 -17 11h-317q-10 -2 -17 -11zM1408 1120v-64q0 -14 -9 -23t-23 -9h-96v-948q0 -83 -47 -143.5t-113 -60.5h-832 q-66 0 -113 58.5t-47 141.5v952h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h309l70 167q15 37 54 63t79 26h320q40 0 79 -26t54 -63l70 -167h309q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1408 544v-480q0 -26 -19 -45t-45 -19h-384v384h-256v-384h-384q-26 0 -45 19t-19 45v480q0 1 0.5 3t0.5 3l575 474l575 -474q1 -2 1 -6zM1631 613l-62 -74q-8 -9 -21 -11h-3q-13 0 -21 7l-692 577l-692 -577q-12 -8 -24 -7q-13 2 -21 11l-62 74q-8 10 -7 23.5t11 21.5 l719 599q32 26 76 26t76 -26l244 -204v195q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-408l219 -182q10 -8 11 -21.5t-7 -23.5z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z " /> +<glyph unicode="" d="M896 992v-448q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v352q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1111 540v4l-24 320q-1 13 -11 22.5t-23 9.5h-186q-13 0 -23 -9.5t-11 -22.5l-24 -320v-4q-1 -12 8 -20t21 -8h244q12 0 21 8t8 20zM1870 73q0 -73 -46 -73h-704q13 0 22 9.5t8 22.5l-20 256q-1 13 -11 22.5t-23 9.5h-272q-13 0 -23 -9.5t-11 -22.5l-20 -256 q-1 -13 8 -22.5t22 -9.5h-704q-46 0 -46 73q0 54 26 116l417 1044q8 19 26 33t38 14h339q-13 0 -23 -9.5t-11 -22.5l-15 -192q-1 -14 8 -23t22 -9h166q13 0 22 9t8 23l-15 192q-1 13 -11 22.5t-23 9.5h339q20 0 38 -14t26 -33l417 -1044q26 -62 26 -116z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1280 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 416v-320q0 -40 -28 -68t-68 -28h-1472q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h465l135 -136 q58 -56 136 -56t136 56l136 136h464q40 0 68 -28t28 -68zM1339 985q17 -41 -14 -70l-448 -448q-18 -19 -45 -19t-45 19l-448 448q-31 29 -14 70q17 39 59 39h256v448q0 26 19 45t45 19h256q26 0 45 -19t19 -45v-448h256q42 0 59 -39z" /> +<glyph unicode="" d="M1120 608q0 -12 -10 -24l-319 -319q-11 -9 -23 -9t-23 9l-320 320q-15 16 -7 35q8 20 30 20h192v352q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-352h192q14 0 23 -9t9 -23zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273 t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1118 660q-8 -20 -30 -20h-192v-352q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v352h-192q-14 0 -23 9t-9 23q0 12 10 24l319 319q11 9 23 9t23 -9l320 -320q15 -16 7 -35zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198 t73 273t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1023 576h316q-1 3 -2.5 8t-2.5 8l-212 496h-708l-212 -496q-1 -2 -2.5 -8t-2.5 -8h316l95 -192h320zM1536 546v-482q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v482q0 62 25 123l238 552q10 25 36.5 42t52.5 17h832q26 0 52.5 -17t36.5 -42l238 -552 q25 -61 25 -123z" /> +<glyph unicode="" d="M1184 640q0 -37 -32 -55l-544 -320q-15 -9 -32 -9q-16 0 -32 8q-32 19 -32 56v640q0 37 32 56q33 18 64 -1l544 -320q32 -18 32 -55zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1536 1280v-448q0 -26 -19 -45t-45 -19h-448q-42 0 -59 40q-17 39 14 69l138 138q-148 137 -349 137q-104 0 -198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5t40.5 -198.5t109.5 -163.5t163.5 -109.5t198.5 -40.5q119 0 225 52t179 147q7 10 23 12q14 0 25 -9 l137 -138q9 -8 9.5 -20.5t-7.5 -22.5q-109 -132 -264 -204.5t-327 -72.5q-156 0 -298 61t-245 164t-164 245t-61 298t61 298t164 245t245 164t298 61q147 0 284.5 -55.5t244.5 -156.5l130 129q29 31 70 14q39 -17 39 -59z" /> +<glyph unicode="" d="M1511 480q0 -5 -1 -7q-64 -268 -268 -434.5t-478 -166.5q-146 0 -282.5 55t-243.5 157l-129 -129q-19 -19 -45 -19t-45 19t-19 45v448q0 26 19 45t45 19h448q26 0 45 -19t19 -45t-19 -45l-137 -137q71 -66 161 -102t187 -36q134 0 250 65t186 179q11 17 53 117 q8 23 30 23h192q13 0 22.5 -9.5t9.5 -22.5zM1536 1280v-448q0 -26 -19 -45t-45 -19h-448q-26 0 -45 19t-19 45t19 45l138 138q-148 137 -349 137q-134 0 -250 -65t-186 -179q-11 -17 -53 -117q-8 -23 -30 -23h-199q-13 0 -22.5 9.5t-9.5 22.5v7q65 268 270 434.5t480 166.5 q146 0 284 -55.5t245 -156.5l130 129q19 19 45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 352v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 608v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M384 864v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1536 352v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5t9.5 -22.5z M1536 608v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5t9.5 -22.5zM1536 864v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h960q13 0 22.5 -9.5 t9.5 -22.5zM1664 160v832q0 13 -9.5 22.5t-22.5 9.5h-1472q-13 0 -22.5 -9.5t-9.5 -22.5v-832q0 -13 9.5 -22.5t22.5 -9.5h1472q13 0 22.5 9.5t9.5 22.5zM1792 1248v-1088q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1472q66 0 113 -47 t47 -113z" /> +<glyph unicode="" horiz-adv-x="1152" d="M320 768h512v192q0 106 -75 181t-181 75t-181 -75t-75 -181v-192zM1152 672v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h32v192q0 184 132 316t316 132t316 -132t132 -316v-192h32q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M320 1280q0 -72 -64 -110v-1266q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v1266q-64 38 -64 110q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1792 1216v-763q0 -25 -12.5 -38.5t-39.5 -27.5q-215 -116 -369 -116q-61 0 -123.5 22t-108.5 48 t-115.5 48t-142.5 22q-192 0 -464 -146q-17 -9 -33 -9q-26 0 -45 19t-19 45v742q0 32 31 55q21 14 79 43q236 120 421 120q107 0 200 -29t219 -88q38 -19 88 -19q54 0 117.5 21t110 47t88 47t54.5 21q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 650q0 -166 -60 -314l-20 -49l-185 -33q-22 -83 -90.5 -136.5t-156.5 -53.5v-32q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-32q71 0 130 -35.5t93 -95.5l68 12q29 95 29 193q0 148 -88 279t-236.5 209t-315.5 78 t-315.5 -78t-236.5 -209t-88 -279q0 -98 29 -193l68 -12q34 60 93 95.5t130 35.5v32q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-576q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v32q-88 0 -156.5 53.5t-90.5 136.5l-185 33l-20 49q-60 148 -60 314q0 151 67 291t179 242.5 t266 163.5t320 61t320 -61t266 -163.5t179 -242.5t67 -291z" /> +<glyph unicode="" horiz-adv-x="768" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1152" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45zM1152 640q0 -76 -42.5 -141.5t-112.5 -93.5q-10 -5 -25 -5q-26 0 -45 18.5t-19 45.5q0 21 12 35.5t29 25t34 23t29 35.5 t12 57t-12 57t-29 35.5t-34 23t-29 25t-12 35.5q0 27 19 45.5t45 18.5q15 0 25 -5q70 -27 112.5 -93t42.5 -142z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 1184v-1088q0 -26 -19 -45t-45 -19t-45 19l-333 333h-262q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h262l333 333q19 19 45 19t45 -19t19 -45zM1152 640q0 -76 -42.5 -141.5t-112.5 -93.5q-10 -5 -25 -5q-26 0 -45 18.5t-19 45.5q0 21 12 35.5t29 25t34 23t29 35.5 t12 57t-12 57t-29 35.5t-34 23t-29 25t-12 35.5q0 27 19 45.5t45 18.5q15 0 25 -5q70 -27 112.5 -93t42.5 -142zM1408 640q0 -153 -85 -282.5t-225 -188.5q-13 -5 -25 -5q-27 0 -46 19t-19 45q0 39 39 59q56 29 76 44q74 54 115.5 135.5t41.5 173.5t-41.5 173.5 t-115.5 135.5q-20 15 -76 44q-39 20 -39 59q0 26 19 45t45 19q13 0 26 -5q140 -59 225 -188.5t85 -282.5zM1664 640q0 -230 -127 -422.5t-338 -283.5q-13 -5 -26 -5q-26 0 -45 19t-19 45q0 36 39 59q7 4 22.5 10.5t22.5 10.5q46 25 82 51q123 91 192 227t69 289t-69 289 t-192 227q-36 26 -82 51q-7 4 -22.5 10.5t-22.5 10.5q-39 23 -39 59q0 26 19 45t45 19q13 0 26 -5q211 -91 338 -283.5t127 -422.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 384v-128h-128v128h128zM384 1152v-128h-128v128h128zM1152 1152v-128h-128v128h128zM128 129h384v383h-384v-383zM128 896h384v384h-384v-384zM896 896h384v384h-384v-384zM640 640v-640h-640v640h640zM1152 128v-128h-128v128h128zM1408 128v-128h-128v128h128z M1408 640v-384h-384v128h-128v-384h-128v640h384v-128h128v128h128zM640 1408v-640h-640v640h640zM1408 1408v-640h-640v640h640z" /> +<glyph unicode="" horiz-adv-x="1792" d="M63 0h-63v1408h63v-1408zM126 1h-32v1407h32v-1407zM220 1h-31v1407h31v-1407zM377 1h-31v1407h31v-1407zM534 1h-62v1407h62v-1407zM660 1h-31v1407h31v-1407zM723 1h-31v1407h31v-1407zM786 1h-31v1407h31v-1407zM943 1h-63v1407h63v-1407zM1100 1h-63v1407h63v-1407z M1226 1h-63v1407h63v-1407zM1352 1h-63v1407h63v-1407zM1446 1h-63v1407h63v-1407zM1635 1h-94v1407h94v-1407zM1698 1h-32v1407h32v-1407zM1792 0h-63v1408h63v-1408z" /> +<glyph unicode="" d="M448 1088q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1515 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-53 0 -90 37l-715 716q-38 37 -64.5 101t-26.5 117v416q0 52 38 90t90 38h416q53 0 117 -26.5t102 -64.5 l715 -714q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1920" d="M448 1088q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1515 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-53 0 -90 37l-715 716q-38 37 -64.5 101t-26.5 117v416q0 52 38 90t90 38h416q53 0 117 -26.5t102 -64.5 l715 -714q37 -39 37 -91zM1899 512q0 -53 -37 -90l-491 -492q-39 -37 -91 -37q-36 0 -59 14t-53 45l470 470q37 37 37 90q0 52 -37 91l-715 714q-38 38 -102 64.5t-117 26.5h224q53 0 117 -26.5t102 -64.5l715 -714q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1639 1058q40 -57 18 -129l-275 -906q-19 -64 -76.5 -107.5t-122.5 -43.5h-923q-77 0 -148.5 53.5t-99.5 131.5q-24 67 -2 127q0 4 3 27t4 37q1 8 -3 21.5t-3 19.5q2 11 8 21t16.5 23.5t16.5 23.5q23 38 45 91.5t30 91.5q3 10 0.5 30t-0.5 28q3 11 17 28t17 23 q21 36 42 92t25 90q1 9 -2.5 32t0.5 28q4 13 22 30.5t22 22.5q19 26 42.5 84.5t27.5 96.5q1 8 -3 25.5t-2 26.5q2 8 9 18t18 23t17 21q8 12 16.5 30.5t15 35t16 36t19.5 32t26.5 23.5t36 11.5t47.5 -5.5l-1 -3q38 9 51 9h761q74 0 114 -56t18 -130l-274 -906 q-36 -119 -71.5 -153.5t-128.5 -34.5h-869q-27 0 -38 -15q-11 -16 -1 -43q24 -70 144 -70h923q29 0 56 15.5t35 41.5l300 987q7 22 5 57q38 -15 59 -43zM575 1056q-4 -13 2 -22.5t20 -9.5h608q13 0 25.5 9.5t16.5 22.5l21 64q4 13 -2 22.5t-20 9.5h-608q-13 0 -25.5 -9.5 t-16.5 -22.5zM492 800q-4 -13 2 -22.5t20 -9.5h608q13 0 25.5 9.5t16.5 22.5l21 64q4 13 -2 22.5t-20 9.5h-608q-13 0 -25.5 -9.5t-16.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1164 1408q23 0 44 -9q33 -13 52.5 -41t19.5 -62v-1289q0 -34 -19.5 -62t-52.5 -41q-19 -8 -44 -8q-48 0 -83 32l-441 424l-441 -424q-36 -33 -83 -33q-23 0 -44 9q-33 13 -52.5 41t-19.5 62v1289q0 34 19.5 62t52.5 41q21 9 44 9h1048z" /> +<glyph unicode="" horiz-adv-x="1664" d="M384 0h896v256h-896v-256zM384 640h896v384h-160q-40 0 -68 28t-28 68v160h-640v-640zM1536 576q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 576v-416q0 -13 -9.5 -22.5t-22.5 -9.5h-224v-160q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68 v160h-224q-13 0 -22.5 9.5t-9.5 22.5v416q0 79 56.5 135.5t135.5 56.5h64v544q0 40 28 68t68 28h672q40 0 88 -20t76 -48l152 -152q28 -28 48 -76t20 -88v-256h64q79 0 135.5 -56.5t56.5 -135.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M960 864q119 0 203.5 -84.5t84.5 -203.5t-84.5 -203.5t-203.5 -84.5t-203.5 84.5t-84.5 203.5t84.5 203.5t203.5 84.5zM1664 1280q106 0 181 -75t75 -181v-896q0 -106 -75 -181t-181 -75h-1408q-106 0 -181 75t-75 181v896q0 106 75 181t181 75h224l51 136 q19 49 69.5 84.5t103.5 35.5h512q53 0 103.5 -35.5t69.5 -84.5l51 -136h224zM960 128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M725 977l-170 -450q33 0 136.5 -2t160.5 -2q19 0 57 2q-87 253 -184 452zM0 -128l2 79q23 7 56 12.5t57 10.5t49.5 14.5t44.5 29t31 50.5l237 616l280 724h75h53q8 -14 11 -21l205 -480q33 -78 106 -257.5t114 -274.5q15 -34 58 -144.5t72 -168.5q20 -45 35 -57 q19 -15 88 -29.5t84 -20.5q6 -38 6 -57q0 -4 -0.5 -13t-0.5 -13q-63 0 -190 8t-191 8q-76 0 -215 -7t-178 -8q0 43 4 78l131 28q1 0 12.5 2.5t15.5 3.5t14.5 4.5t15 6.5t11 8t9 11t2.5 14q0 16 -31 96.5t-72 177.5t-42 100l-450 2q-26 -58 -76.5 -195.5t-50.5 -162.5 q0 -22 14 -37.5t43.5 -24.5t48.5 -13.5t57 -8.5t41 -4q1 -19 1 -58q0 -9 -2 -27q-58 0 -174.5 10t-174.5 10q-8 0 -26.5 -4t-21.5 -4q-80 -14 -188 -14z" /> +<glyph unicode="" horiz-adv-x="1408" d="M555 15q74 -32 140 -32q376 0 376 335q0 114 -41 180q-27 44 -61.5 74t-67.5 46.5t-80.5 25t-84 10.5t-94.5 2q-73 0 -101 -10q0 -53 -0.5 -159t-0.5 -158q0 -8 -1 -67.5t-0.5 -96.5t4.5 -83.5t12 -66.5zM541 761q42 -7 109 -7q82 0 143 13t110 44.5t74.5 89.5t25.5 142 q0 70 -29 122.5t-79 82t-108 43.5t-124 14q-50 0 -130 -13q0 -50 4 -151t4 -152q0 -27 -0.5 -80t-0.5 -79q0 -46 1 -69zM0 -128l2 94q15 4 85 16t106 27q7 12 12.5 27t8.5 33.5t5.5 32.5t3 37.5t0.5 34v35.5v30q0 982 -22 1025q-4 8 -22 14.5t-44.5 11t-49.5 7t-48.5 4.5 t-30.5 3l-4 83q98 2 340 11.5t373 9.5q23 0 68.5 -0.5t67.5 -0.5q70 0 136.5 -13t128.5 -42t108 -71t74 -104.5t28 -137.5q0 -52 -16.5 -95.5t-39 -72t-64.5 -57.5t-73 -45t-84 -40q154 -35 256.5 -134t102.5 -248q0 -100 -35 -179.5t-93.5 -130.5t-138 -85.5t-163.5 -48.5 t-176 -14q-44 0 -132 3t-132 3q-106 0 -307 -11t-231 -12z" /> +<glyph unicode="" horiz-adv-x="1024" d="M0 -126l17 85q6 2 81.5 21.5t111.5 37.5q28 35 41 101q1 7 62 289t114 543.5t52 296.5v25q-24 13 -54.5 18.5t-69.5 8t-58 5.5l19 103q33 -2 120 -6.5t149.5 -7t120.5 -2.5q48 0 98.5 2.5t121 7t98.5 6.5q-5 -39 -19 -89q-30 -10 -101.5 -28.5t-108.5 -33.5 q-8 -19 -14 -42.5t-9 -40t-7.5 -45.5t-6.5 -42q-27 -148 -87.5 -419.5t-77.5 -355.5q-2 -9 -13 -58t-20 -90t-16 -83.5t-6 -57.5l1 -18q17 -4 185 -31q-3 -44 -16 -99q-11 0 -32.5 -1.5t-32.5 -1.5q-29 0 -87 10t-86 10q-138 2 -206 2q-51 0 -143 -9t-121 -11z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1744 128q33 0 42 -18.5t-11 -44.5l-126 -162q-20 -26 -49 -26t-49 26l-126 162q-20 26 -11 44.5t42 18.5h80v1024h-80q-33 0 -42 18.5t11 44.5l126 162q20 26 49 26t49 -26l126 -162q20 -26 11 -44.5t-42 -18.5h-80v-1024h80zM81 1407l54 -27q12 -5 211 -5q44 0 132 2 t132 2q36 0 107.5 -0.5t107.5 -0.5h293q6 0 21 -0.5t20.5 0t16 3t17.5 9t15 17.5l42 1q4 0 14 -0.5t14 -0.5q2 -112 2 -336q0 -80 -5 -109q-39 -14 -68 -18q-25 44 -54 128q-3 9 -11 48t-14.5 73.5t-7.5 35.5q-6 8 -12 12.5t-15.5 6t-13 2.5t-18 0.5t-16.5 -0.5 q-17 0 -66.5 0.5t-74.5 0.5t-64 -2t-71 -6q-9 -81 -8 -136q0 -94 2 -388t2 -455q0 -16 -2.5 -71.5t0 -91.5t12.5 -69q40 -21 124 -42.5t120 -37.5q5 -40 5 -50q0 -14 -3 -29l-34 -1q-76 -2 -218 8t-207 10q-50 0 -151 -9t-152 -9q-3 51 -3 52v9q17 27 61.5 43t98.5 29t78 27 q19 42 19 383q0 101 -3 303t-3 303v117q0 2 0.5 15.5t0.5 25t-1 25.5t-3 24t-5 14q-11 12 -162 12q-33 0 -93 -12t-80 -26q-19 -13 -34 -72.5t-31.5 -111t-42.5 -53.5q-42 26 -56 44v383z" /> +<glyph unicode="" d="M81 1407l54 -27q12 -5 211 -5q44 0 132 2t132 2q70 0 246.5 1t304.5 0.5t247 -4.5q33 -1 56 31l42 1q4 0 14 -0.5t14 -0.5q2 -112 2 -336q0 -80 -5 -109q-39 -14 -68 -18q-25 44 -54 128q-3 9 -11 47.5t-15 73.5t-7 36q-10 13 -27 19q-5 2 -66 2q-30 0 -93 1t-103 1 t-94 -2t-96 -7q-9 -81 -8 -136l1 -152v52q0 -55 1 -154t1.5 -180t0.5 -153q0 -16 -2.5 -71.5t0 -91.5t12.5 -69q40 -21 124 -42.5t120 -37.5q5 -40 5 -50q0 -14 -3 -29l-34 -1q-76 -2 -218 8t-207 10q-50 0 -151 -9t-152 -9q-3 51 -3 52v9q17 27 61.5 43t98.5 29t78 27 q7 16 11.5 74t6 145.5t1.5 155t-0.5 153.5t-0.5 89q0 7 -2.5 21.5t-2.5 22.5q0 7 0.5 44t1 73t0 76.5t-3 67.5t-6.5 32q-11 12 -162 12q-41 0 -163 -13.5t-138 -24.5q-19 -12 -34 -71.5t-31.5 -111.5t-42.5 -54q-42 26 -56 44v383zM1310 125q12 0 42 -19.5t57.5 -41.5 t59.5 -49t36 -30q26 -21 26 -49t-26 -49q-4 -3 -36 -30t-59.5 -49t-57.5 -41.5t-42 -19.5q-13 0 -20.5 10.5t-10 28.5t-2.5 33.5t1.5 33t1.5 19.5h-1024q0 -2 1.5 -19.5t1.5 -33t-2.5 -33.5t-10 -28.5t-20.5 -10.5q-12 0 -42 19.5t-57.5 41.5t-59.5 49t-36 30q-26 21 -26 49 t26 49q4 3 36 30t59.5 49t57.5 41.5t42 19.5q13 0 20.5 -10.5t10 -28.5t2.5 -33.5t-1.5 -33t-1.5 -19.5h1024q0 2 -1.5 19.5t-1.5 33t2.5 33.5t10 28.5t20.5 10.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1408 576v-128q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1280q26 0 45 -19t19 -45zM1664 960v-128q0 -26 -19 -45 t-45 -19h-1536q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1536q26 0 45 -19t19 -45zM1280 1344v-128q0 -26 -19 -45t-45 -19h-1152q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1408 576v-128q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h896q26 0 45 -19t19 -45zM1664 960v-128q0 -26 -19 -45t-45 -19 h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1280 1344v-128q0 -26 -19 -45t-45 -19h-640q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h640q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 576v-128q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1280q26 0 45 -19t19 -45zM1792 960v-128q0 -26 -19 -45 t-45 -19h-1536q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1536q26 0 45 -19t19 -45zM1792 1344v-128q0 -26 -19 -45t-45 -19h-1152q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 192v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 576v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 960v-128q0 -26 -19 -45 t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 1344v-128q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1664q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M256 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM256 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5 t9.5 -22.5zM256 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1344 q13 0 22.5 -9.5t9.5 -22.5zM256 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5 t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v192 q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 992v-576q0 -13 -9.5 -22.5t-22.5 -9.5q-14 0 -23 9l-288 288q-9 9 -9 23t9 23l288 288q9 9 23 9q13 0 22.5 -9.5t9.5 -22.5zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5 t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088 q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M352 704q0 -14 -9 -23l-288 -288q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v576q0 13 9.5 22.5t22.5 9.5q14 0 23 -9l288 -288q9 -9 9 -23zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5 t9.5 -22.5zM1792 608v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088q13 0 22.5 -9.5t9.5 -22.5zM1792 992v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1088q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1088 q13 0 22.5 -9.5t9.5 -22.5zM1792 1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1728q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1728q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 1184v-1088q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-403 403v-166q0 -119 -84.5 -203.5t-203.5 -84.5h-704q-119 0 -203.5 84.5t-84.5 203.5v704q0 119 84.5 203.5t203.5 84.5h704q119 0 203.5 -84.5t84.5 -203.5v-165l403 402q18 19 45 19q12 0 25 -5 q39 -17 39 -59z" /> +<glyph unicode="" horiz-adv-x="1920" d="M640 960q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1664 576v-448h-1408v192l320 320l160 -160l512 512zM1760 1280h-1600q-13 0 -22.5 -9.5t-9.5 -22.5v-1216q0 -13 9.5 -22.5t22.5 -9.5h1600q13 0 22.5 9.5t9.5 22.5v1216 q0 13 -9.5 22.5t-22.5 9.5zM1920 1248v-1216q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" d="M363 0l91 91l-235 235l-91 -91v-107h128v-128h107zM886 928q0 22 -22 22q-10 0 -17 -7l-542 -542q-7 -7 -7 -17q0 -22 22 -22q10 0 17 7l542 542q7 7 7 17zM832 1120l416 -416l-832 -832h-416v416zM1515 1024q0 -53 -37 -90l-166 -166l-416 416l166 165q36 38 90 38 q53 0 91 -38l235 -234q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1024" d="M768 896q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1024 896q0 -109 -33 -179l-364 -774q-16 -33 -47.5 -52t-67.5 -19t-67.5 19t-46.5 52l-365 774q-33 70 -33 179q0 212 150 362t362 150t362 -150t150 -362z" /> +<glyph unicode="" d="M768 96v1088q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M512 384q0 36 -20 69q-1 1 -15.5 22.5t-25.5 38t-25 44t-21 50.5q-4 16 -21 16t-21 -16q-7 -23 -21 -50.5t-25 -44t-25.5 -38t-15.5 -22.5q-20 -33 -20 -69q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1024 512q0 -212 -150 -362t-362 -150t-362 150t-150 362 q0 145 81 275q6 9 62.5 90.5t101 151t99.5 178t83 201.5q9 30 34 47t51 17t51.5 -17t33.5 -47q28 -93 83 -201.5t99.5 -178t101 -151t62.5 -90.5q81 -127 81 -275z" /> +<glyph unicode="" horiz-adv-x="1792" d="M888 352l116 116l-152 152l-116 -116v-56h96v-96h56zM1328 1072q-16 16 -33 -1l-350 -350q-17 -17 -1 -33t33 1l350 350q17 17 1 33zM1408 478v-190q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832 q63 0 117 -25q15 -7 18 -23q3 -17 -9 -29l-49 -49q-14 -14 -32 -8q-23 6 -45 6h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v126q0 13 9 22l64 64q15 15 35 7t20 -29zM1312 1216l288 -288l-672 -672h-288v288zM1756 1084l-92 -92 l-288 288l92 92q28 28 68 28t68 -28l152 -152q28 -28 28 -68t-28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1408 547v-259q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h255v0q13 0 22.5 -9.5t9.5 -22.5q0 -27 -26 -32q-77 -26 -133 -60q-10 -4 -16 -4h-112q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832 q66 0 113 47t47 113v214q0 19 18 29q28 13 54 37q16 16 35 8q21 -9 21 -29zM1645 1043l-384 -384q-18 -19 -45 -19q-12 0 -25 5q-39 17 -39 59v192h-160q-323 0 -438 -131q-119 -137 -74 -473q3 -23 -20 -34q-8 -2 -12 -2q-16 0 -26 13q-10 14 -21 31t-39.5 68.5t-49.5 99.5 t-38.5 114t-17.5 122q0 49 3.5 91t14 90t28 88t47 81.5t68.5 74t94.5 61.5t124.5 48.5t159.5 30.5t196.5 11h160v192q0 42 39 59q13 5 25 5q26 0 45 -19l384 -384q19 -19 19 -45t-19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1408 606v-318q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q63 0 117 -25q15 -7 18 -23q3 -17 -9 -29l-49 -49q-10 -10 -23 -10q-3 0 -9 2q-23 6 -45 6h-832q-66 0 -113 -47t-47 -113v-832 q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v254q0 13 9 22l64 64q10 10 23 10q6 0 12 -3q20 -8 20 -29zM1639 1095l-814 -814q-24 -24 -57 -24t-57 24l-430 430q-24 24 -24 57t24 57l110 110q24 24 57 24t57 -24l263 -263l647 647q24 24 57 24t57 -24l110 -110 q24 -24 24 -57t-24 -57z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -26 -19 -45l-256 -256q-19 -19 -45 -19t-45 19t-19 45v128h-384v-384h128q26 0 45 -19t19 -45t-19 -45l-256 -256q-19 -19 -45 -19t-45 19l-256 256q-19 19 -19 45t19 45t45 19h128v384h-384v-128q0 -26 -19 -45t-45 -19t-45 19l-256 256q-19 19 -19 45 t19 45l256 256q19 19 45 19t45 -19t19 -45v-128h384v384h-128q-26 0 -45 19t-19 45t19 45l256 256q19 19 45 19t45 -19l256 -256q19 -19 19 -45t-19 -45t-45 -19h-128v-384h384v128q0 26 19 45t45 19t45 -19l256 -256q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M979 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-678q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-678q4 11 13 19z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1747 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-710q0 -26 -13 -32t-32 13l-710 710q-9 9 -13 19v-678q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-678q4 11 13 19l710 710 q19 19 32 13t13 -32v-710q4 11 13 19z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1619 1395q19 19 32 13t13 -32v-1472q0 -26 -13 -32t-32 13l-710 710q-8 9 -13 19v-710q0 -26 -13 -32t-32 13l-710 710q-19 19 -19 45t19 45l710 710q19 19 32 13t13 -32v-710q5 11 13 19z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1384 609l-1328 -738q-23 -13 -39.5 -3t-16.5 36v1472q0 26 16.5 36t39.5 -3l1328 -738q23 -13 23 -31t-23 -31z" /> +<glyph unicode="" d="M1536 1344v-1408q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h512q26 0 45 -19t19 -45zM640 1344v-1408q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h512q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1536 1344v-1408q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v710q0 26 13 32t32 -13l710 -710q19 -19 19 -45t-19 -45l-710 -710q-19 -19 -32 -13t-13 32v710q-5 -10 -13 -19z" /> +<glyph unicode="" horiz-adv-x="1792" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v710q0 26 13 32t32 -13l710 -710q8 -8 13 -19v678q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-1408q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v678q-5 -10 -13 -19l-710 -710 q-19 -19 -32 -13t-13 32v710q-5 -10 -13 -19z" /> +<glyph unicode="" horiz-adv-x="1024" d="M45 -115q-19 -19 -32 -13t-13 32v1472q0 26 13 32t32 -13l710 -710q8 -8 13 -19v678q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-1408q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v678q-5 -10 -13 -19z" /> +<glyph unicode="" horiz-adv-x="1538" d="M14 557l710 710q19 19 45 19t45 -19l710 -710q19 -19 13 -32t-32 -13h-1472q-26 0 -32 13t13 32zM1473 0h-1408q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1408q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1171 1235l-531 -531l531 -531q19 -19 19 -45t-19 -45l-166 -166q-19 -19 -45 -19t-45 19l-742 742q-19 19 -19 45t19 45l742 742q19 19 45 19t45 -19l166 -166q19 -19 19 -45t-19 -45z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1107 659l-742 -742q-19 -19 -45 -19t-45 19l-166 166q-19 19 -19 45t19 45l531 531l-531 531q-19 19 -19 45t19 45l166 166q19 19 45 19t45 -19l742 -742q19 -19 19 -45t-19 -45z" /> +<glyph unicode="" d="M1216 576v128q0 26 -19 45t-45 19h-256v256q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-256h-256q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h256v-256q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v256h256q26 0 45 19t19 45zM1536 640q0 -209 -103 -385.5 t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1216 576v128q0 26 -19 45t-45 19h-768q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h768q26 0 45 19t19 45zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5 t103 -385.5z" /> +<glyph unicode="" d="M1149 414q0 26 -19 45l-181 181l181 181q19 19 19 45q0 27 -19 46l-90 90q-19 19 -46 19q-26 0 -45 -19l-181 -181l-181 181q-19 19 -45 19q-27 0 -46 -19l-90 -90q-19 -19 -19 -46q0 -26 19 -45l181 -181l-181 -181q-19 -19 -19 -45q0 -27 19 -46l90 -90q19 -19 46 -19 q26 0 45 19l181 181l181 -181q19 -19 45 -19q27 0 46 19l90 90q19 19 19 46zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1284 802q0 28 -18 46l-91 90q-19 19 -45 19t-45 -19l-408 -407l-226 226q-19 19 -45 19t-45 -19l-91 -90q-18 -18 -18 -46q0 -27 18 -45l362 -362q19 -19 45 -19q27 0 46 19l543 543q18 18 18 45zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M896 160v192q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h192q14 0 23 9t9 23zM1152 832q0 88 -55.5 163t-138.5 116t-170 41q-243 0 -371 -213q-15 -24 8 -42l132 -100q7 -6 19 -6q16 0 25 12q53 68 86 92q34 24 86 24q48 0 85.5 -26t37.5 -59 q0 -38 -20 -61t-68 -45q-63 -28 -115.5 -86.5t-52.5 -125.5v-36q0 -14 9 -23t23 -9h192q14 0 23 9t9 23q0 19 21.5 49.5t54.5 49.5q32 18 49 28.5t46 35t44.5 48t28 60.5t12.5 81zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1024 160v160q0 14 -9 23t-23 9h-96v512q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23t23 -9h96v-320h-96q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23t23 -9h448q14 0 23 9t9 23zM896 1056v160q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-160q0 -14 9 -23 t23 -9h192q14 0 23 9t9 23zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1197 512h-109q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h109q-32 108 -112.5 188.5t-188.5 112.5v-109q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v109q-108 -32 -188.5 -112.5t-112.5 -188.5h109q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-109 q32 -108 112.5 -188.5t188.5 -112.5v109q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-109q108 32 188.5 112.5t112.5 188.5zM1536 704v-128q0 -26 -19 -45t-45 -19h-143q-37 -161 -154.5 -278.5t-278.5 -154.5v-143q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v143 q-161 37 -278.5 154.5t-154.5 278.5h-143q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h143q37 161 154.5 278.5t278.5 154.5v143q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-143q161 -37 278.5 -154.5t154.5 -278.5h143q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1097 457l-146 -146q-10 -10 -23 -10t-23 10l-137 137l-137 -137q-10 -10 -23 -10t-23 10l-146 146q-10 10 -10 23t10 23l137 137l-137 137q-10 10 -10 23t10 23l146 146q10 10 23 10t23 -10l137 -137l137 137q10 10 23 10t23 -10l146 -146q10 -10 10 -23t-10 -23 l-137 -137l137 -137q10 -10 10 -23t-10 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5 t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1171 723l-422 -422q-19 -19 -45 -19t-45 19l-294 294q-19 19 -19 45t19 45l102 102q19 19 45 19t45 -19l147 -147l275 275q19 19 45 19t45 -19l102 -102q19 -19 19 -45t-19 -45zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198 t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1312 643q0 161 -87 295l-754 -753q137 -89 297 -89q111 0 211.5 43.5t173.5 116.5t116 174.5t43 212.5zM313 344l755 754q-135 91 -300 91q-148 0 -273 -73t-198 -199t-73 -274q0 -162 89 -299zM1536 643q0 -157 -61 -300t-163.5 -246t-245 -164t-298.5 -61t-298.5 61 t-245 164t-163.5 246t-61 300t61 299.5t163.5 245.5t245 164t298.5 61t298.5 -61t245 -164t163.5 -245.5t61 -299.5z" /> +<glyph unicode="" d="M1536 640v-128q0 -53 -32.5 -90.5t-84.5 -37.5h-704l293 -294q38 -36 38 -90t-38 -90l-75 -76q-37 -37 -90 -37q-52 0 -91 37l-651 652q-37 37 -37 90q0 52 37 91l651 650q38 38 91 38q52 0 90 -38l75 -74q38 -38 38 -91t-38 -91l-293 -293h704q52 0 84.5 -37.5 t32.5 -90.5z" /> +<glyph unicode="" d="M1472 576q0 -54 -37 -91l-651 -651q-39 -37 -91 -37q-51 0 -90 37l-75 75q-38 38 -38 91t38 91l293 293h-704q-52 0 -84.5 37.5t-32.5 90.5v128q0 53 32.5 90.5t84.5 37.5h704l-293 294q-38 36 -38 90t38 90l75 75q38 38 90 38q53 0 91 -38l651 -651q37 -35 37 -90z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1611 565q0 -51 -37 -90l-75 -75q-38 -38 -91 -38q-54 0 -90 38l-294 293v-704q0 -52 -37.5 -84.5t-90.5 -32.5h-128q-53 0 -90.5 32.5t-37.5 84.5v704l-294 -293q-36 -38 -90 -38t-90 38l-75 75q-38 38 -38 90q0 53 38 91l651 651q35 37 90 37q54 0 91 -37l651 -651 q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1611 704q0 -53 -37 -90l-651 -652q-39 -37 -91 -37q-53 0 -90 37l-651 652q-38 36 -38 90q0 53 38 91l74 75q39 37 91 37q53 0 90 -37l294 -294v704q0 52 38 90t90 38h128q52 0 90 -38t38 -90v-704l294 294q37 37 90 37q52 0 91 -37l75 -75q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 896q0 -26 -19 -45l-512 -512q-19 -19 -45 -19t-45 19t-19 45v256h-224q-98 0 -175.5 -6t-154 -21.5t-133 -42.5t-105.5 -69.5t-80 -101t-48.5 -138.5t-17.5 -181q0 -55 5 -123q0 -6 2.5 -23.5t2.5 -26.5q0 -15 -8.5 -25t-23.5 -10q-16 0 -28 17q-7 9 -13 22 t-13.5 30t-10.5 24q-127 285 -127 451q0 199 53 333q162 403 875 403h224v256q0 26 19 45t45 19t45 -19l512 -512q19 -19 19 -45z" /> +<glyph unicode="" d="M755 480q0 -13 -10 -23l-332 -332l144 -144q19 -19 19 -45t-19 -45t-45 -19h-448q-26 0 -45 19t-19 45v448q0 26 19 45t45 19t45 -19l144 -144l332 332q10 10 23 10t23 -10l114 -114q10 -10 10 -23zM1536 1344v-448q0 -26 -19 -45t-45 -19t-45 19l-144 144l-332 -332 q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l332 332l-144 144q-19 19 -19 45t19 45t45 19h448q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M768 576v-448q0 -26 -19 -45t-45 -19t-45 19l-144 144l-332 -332q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l332 332l-144 144q-19 19 -19 45t19 45t45 19h448q26 0 45 -19t19 -45zM1523 1248q0 -13 -10 -23l-332 -332l144 -144q19 -19 19 -45t-19 -45 t-45 -19h-448q-26 0 -45 19t-19 45v448q0 26 19 45t45 19t45 -19l144 -144l332 332q10 10 23 10t23 -10l114 -114q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 800v-192q0 -40 -28 -68t-68 -28h-416v-416q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v416h-416q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h416v416q0 40 28 68t68 28h192q40 0 68 -28t28 -68v-416h416q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 800v-192q0 -40 -28 -68t-68 -28h-1216q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h1216q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1482 486q46 -26 59.5 -77.5t-12.5 -97.5l-64 -110q-26 -46 -77.5 -59.5t-97.5 12.5l-266 153v-307q0 -52 -38 -90t-90 -38h-128q-52 0 -90 38t-38 90v307l-266 -153q-46 -26 -97.5 -12.5t-77.5 59.5l-64 110q-26 46 -12.5 97.5t59.5 77.5l266 154l-266 154 q-46 26 -59.5 77.5t12.5 97.5l64 110q26 46 77.5 59.5t97.5 -12.5l266 -153v307q0 52 38 90t90 38h128q52 0 90 -38t38 -90v-307l266 153q46 26 97.5 12.5t77.5 -59.5l64 -110q26 -46 12.5 -97.5t-59.5 -77.5l-266 -154z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM896 161v190q0 14 -9 23.5t-22 9.5h-192q-13 0 -23 -10t-10 -23v-190q0 -13 10 -23t23 -10h192 q13 0 22 9.5t9 23.5zM894 505l18 621q0 12 -10 18q-10 8 -24 8h-220q-14 0 -24 -8q-10 -6 -10 -18l17 -621q0 -10 10 -17.5t24 -7.5h185q14 0 23.5 7.5t10.5 17.5z" /> +<glyph unicode="" d="M928 180v56v468v192h-320v-192v-468v-56q0 -25 18 -38.5t46 -13.5h192q28 0 46 13.5t18 38.5zM472 1024h195l-126 161q-26 31 -69 31q-40 0 -68 -28t-28 -68t28 -68t68 -28zM1160 1120q0 40 -28 68t-68 28q-43 0 -69 -31l-125 -161h194q40 0 68 28t28 68zM1536 864v-320 q0 -14 -9 -23t-23 -9h-96v-416q0 -40 -28 -68t-68 -28h-1088q-40 0 -68 28t-28 68v416h-96q-14 0 -23 9t-9 23v320q0 14 9 23t23 9h440q-93 0 -158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5q107 0 168 -77l128 -165l128 165q61 77 168 77q93 0 158.5 -65.5t65.5 -158.5 t-65.5 -158.5t-158.5 -65.5h440q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 832q0 26 -19 45t-45 19q-172 0 -318 -49.5t-259.5 -134t-235.5 -219.5q-19 -21 -19 -45q0 -26 19 -45t45 -19q24 0 45 19q27 24 74 71t67 66q137 124 268.5 176t313.5 52q26 0 45 19t19 45zM1792 1030q0 -95 -20 -193q-46 -224 -184.5 -383t-357.5 -268 q-214 -108 -438 -108q-148 0 -286 47q-15 5 -88 42t-96 37q-16 0 -39.5 -32t-45 -70t-52.5 -70t-60 -32q-30 0 -51 11t-31 24t-27 42q-2 4 -6 11t-5.5 10t-3 9.5t-1.5 13.5q0 35 31 73.5t68 65.5t68 56t31 48q0 4 -14 38t-16 44q-9 51 -9 104q0 115 43.5 220t119 184.5 t170.5 139t204 95.5q55 18 145 25.5t179.5 9t178.5 6t163.5 24t113.5 56.5l29.5 29.5t29.5 28t27 20t36.5 16t43.5 4.5q39 0 70.5 -46t47.5 -112t24 -124t8 -96z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 -160v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-1344q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h1344q13 0 22.5 -9.5t9.5 -22.5zM1152 896q0 -78 -24.5 -144t-64 -112.5t-87.5 -88t-96 -77.5t-87.5 -72t-64 -81.5t-24.5 -96.5q0 -96 67 -224l-4 1l1 -1 q-90 41 -160 83t-138.5 100t-113.5 122.5t-72.5 150.5t-27.5 184q0 78 24.5 144t64 112.5t87.5 88t96 77.5t87.5 72t64 81.5t24.5 96.5q0 94 -66 224l3 -1l-1 1q90 -41 160 -83t138.5 -100t113.5 -122.5t72.5 -150.5t27.5 -184z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 576q-152 236 -381 353q61 -104 61 -225q0 -185 -131.5 -316.5t-316.5 -131.5t-316.5 131.5t-131.5 316.5q0 121 61 225q-229 -117 -381 -353q133 -205 333.5 -326.5t434.5 -121.5t434.5 121.5t333.5 326.5zM944 960q0 20 -14 34t-34 14q-125 0 -214.5 -89.5 t-89.5 -214.5q0 -20 14 -34t34 -14t34 14t14 34q0 86 61 147t147 61q20 0 34 14t14 34zM1792 576q0 -34 -20 -69q-140 -230 -376.5 -368.5t-499.5 -138.5t-499.5 139t-376.5 368q-20 35 -20 69t20 69q140 229 376.5 368t499.5 139t499.5 -139t376.5 -368q20 -35 20 -69z" /> +<glyph unicode="" horiz-adv-x="1792" d="M555 201l78 141q-87 63 -136 159t-49 203q0 121 61 225q-229 -117 -381 -353q167 -258 427 -375zM944 960q0 20 -14 34t-34 14q-125 0 -214.5 -89.5t-89.5 -214.5q0 -20 14 -34t34 -14t34 14t14 34q0 86 61 147t147 61q20 0 34 14t14 34zM1307 1151q0 -7 -1 -9 q-105 -188 -315 -566t-316 -567l-49 -89q-10 -16 -28 -16q-12 0 -134 70q-16 10 -16 28q0 12 44 87q-143 65 -263.5 173t-208.5 245q-20 31 -20 69t20 69q153 235 380 371t496 136q89 0 180 -17l54 97q10 16 28 16q5 0 18 -6t31 -15.5t33 -18.5t31.5 -18.5t19.5 -11.5 q16 -10 16 -27zM1344 704q0 -139 -79 -253.5t-209 -164.5l280 502q8 -45 8 -84zM1792 576q0 -35 -20 -69q-39 -64 -109 -145q-150 -172 -347.5 -267t-419.5 -95l74 132q212 18 392.5 137t301.5 307q-115 179 -282 294l63 112q95 -64 182.5 -153t144.5 -184q20 -34 20 -69z " /> +<glyph unicode="" horiz-adv-x="1792" d="M1024 161v190q0 14 -9.5 23.5t-22.5 9.5h-192q-13 0 -22.5 -9.5t-9.5 -23.5v-190q0 -14 9.5 -23.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 23.5zM1022 535l18 459q0 12 -10 19q-13 11 -24 11h-220q-11 0 -24 -11q-10 -7 -10 -21l17 -457q0 -10 10 -16.5t24 -6.5h185 q14 0 23.5 6.5t10.5 16.5zM1008 1469l768 -1408q35 -63 -2 -126q-17 -29 -46.5 -46t-63.5 -17h-1536q-34 0 -63.5 17t-46.5 46q-37 63 -2 126l768 1408q17 31 47 49t65 18t65 -18t47 -49z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1376 1376q44 -52 12 -148t-108 -172l-161 -161l160 -696q5 -19 -12 -33l-128 -96q-7 -6 -19 -6q-4 0 -7 1q-15 3 -21 16l-279 508l-259 -259l53 -194q5 -17 -8 -31l-96 -96q-9 -9 -23 -9h-2q-15 2 -24 13l-189 252l-252 189q-11 7 -13 23q-1 13 9 25l96 97q9 9 23 9 q6 0 8 -1l194 -53l259 259l-508 279q-14 8 -17 24q-2 16 9 27l128 128q14 13 30 8l665 -159l160 160q76 76 172 108t148 -12z" /> +<glyph unicode="" horiz-adv-x="1664" d="M128 -128h288v288h-288v-288zM480 -128h320v288h-320v-288zM128 224h288v320h-288v-320zM480 224h320v320h-320v-320zM128 608h288v288h-288v-288zM864 -128h320v288h-320v-288zM480 608h320v288h-320v-288zM1248 -128h288v288h-288v-288zM864 224h320v320h-320v-320z M512 1088v288q0 13 -9.5 22.5t-22.5 9.5h-64q-13 0 -22.5 -9.5t-9.5 -22.5v-288q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1248 224h288v320h-288v-320zM864 608h320v288h-320v-288zM1248 608h288v288h-288v-288zM1280 1088v288q0 13 -9.5 22.5t-22.5 9.5h-64 q-13 0 -22.5 -9.5t-9.5 -22.5v-288q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1664 1152v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47 h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M666 1055q-60 -92 -137 -273q-22 45 -37 72.5t-40.5 63.5t-51 56.5t-63 35t-81.5 14.5h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224q250 0 410 -225zM1792 256q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v192q-32 0 -85 -0.5t-81 -1t-73 1 t-71 5t-64 10.5t-63 18.5t-58 28.5t-59 40t-55 53.5t-56 69.5q59 93 136 273q22 -45 37 -72.5t40.5 -63.5t51 -56.5t63 -35t81.5 -14.5h256v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23zM1792 1152q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5 v192h-256q-48 0 -87 -15t-69 -45t-51 -61.5t-45 -77.5q-32 -62 -78 -171q-29 -66 -49.5 -111t-54 -105t-64 -100t-74 -83t-90 -68.5t-106.5 -42t-128 -16.5h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224q48 0 87 15t69 45t51 61.5t45 77.5q32 62 78 171q29 66 49.5 111 t54 105t64 100t74 83t90 68.5t106.5 42t128 16.5h256v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -174 -120 -321.5t-326 -233t-450 -85.5q-70 0 -145 8q-198 -175 -460 -242q-49 -14 -114 -22q-17 -2 -30.5 9t-17.5 29v1q-3 4 -0.5 12t2 10t4.5 9.5l6 9t7 8.5t8 9q7 8 31 34.5t34.5 38t31 39.5t32.5 51t27 59t26 76q-157 89 -247.5 220t-90.5 281 q0 130 71 248.5t191 204.5t286 136.5t348 50.5q244 0 450 -85.5t326 -233t120 -321.5z" /> +<glyph unicode="" d="M1536 704v-128q0 -201 -98.5 -362t-274 -251.5t-395.5 -90.5t-395.5 90.5t-274 251.5t-98.5 362v128q0 26 19 45t45 19h384q26 0 45 -19t19 -45v-128q0 -52 23.5 -90t53.5 -57t71 -30t64 -13t44 -2t44 2t64 13t71 30t53.5 57t23.5 90v128q0 26 19 45t45 19h384 q26 0 45 -19t19 -45zM512 1344v-384q0 -26 -19 -45t-45 -19h-384q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h384q26 0 45 -19t19 -45zM1536 1344v-384q0 -26 -19 -45t-45 -19h-384q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h384q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1683 205l-166 -165q-19 -19 -45 -19t-45 19l-531 531l-531 -531q-19 -19 -45 -19t-45 19l-166 165q-19 19 -19 45.5t19 45.5l742 741q19 19 45 19t45 -19l742 -741q19 -19 19 -45.5t-19 -45.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1683 728l-742 -741q-19 -19 -45 -19t-45 19l-742 741q-19 19 -19 45.5t19 45.5l166 165q19 19 45 19t45 -19l531 -531l531 531q19 19 45 19t45 -19l166 -165q19 -19 19 -45.5t-19 -45.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1280 32q0 -13 -9.5 -22.5t-22.5 -9.5h-960q-8 0 -13.5 2t-9 7t-5.5 8t-3 11.5t-1 11.5v13v11v160v416h-192q-26 0 -45 19t-19 45q0 24 15 41l320 384q19 22 49 22t49 -22l320 -384q15 -17 15 -41q0 -26 -19 -45t-45 -19h-192v-384h576q16 0 25 -11l160 -192q7 -11 7 -21 zM1920 448q0 -24 -15 -41l-320 -384q-20 -23 -49 -23t-49 23l-320 384q-15 17 -15 41q0 26 19 45t45 19h192v384h-576q-16 0 -25 12l-160 192q-7 9 -7 20q0 13 9.5 22.5t22.5 9.5h960q8 0 13.5 -2t9 -7t5.5 -8t3 -11.5t1 -11.5v-13v-11v-160v-416h192q26 0 45 -19t19 -45z " /> +<glyph unicode="" horiz-adv-x="1664" d="M640 0q0 -52 -38 -90t-90 -38t-90 38t-38 90t38 90t90 38t90 -38t38 -90zM1536 0q0 -52 -38 -90t-90 -38t-90 38t-38 90t38 90t90 38t90 -38t38 -90zM1664 1088v-512q0 -24 -16.5 -42.5t-40.5 -21.5l-1044 -122q13 -60 13 -70q0 -16 -24 -64h920q26 0 45 -19t19 -45 t-19 -45t-45 -19h-1024q-26 0 -45 19t-19 45q0 11 8 31.5t16 36t21.5 40t15.5 29.5l-177 823h-204q-26 0 -45 19t-19 45t19 45t45 19h256q16 0 28.5 -6.5t19.5 -15.5t13 -24.5t8 -26t5.5 -29.5t4.5 -26h1201q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 928v-704q0 -92 -66 -158t-158 -66h-1216q-92 0 -158 66t-66 158v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h672q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1879 584q0 -31 -31 -66l-336 -396q-43 -51 -120.5 -86.5t-143.5 -35.5h-1088q-34 0 -60.5 13t-26.5 43q0 31 31 66l336 396q43 51 120.5 86.5t143.5 35.5h1088q34 0 60.5 -13t26.5 -43zM1536 928v-160h-832q-94 0 -197 -47.5t-164 -119.5l-337 -396l-5 -6q0 4 -0.5 12.5 t-0.5 12.5v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h544q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="768" d="M704 1216q0 -26 -19 -45t-45 -19h-128v-1024h128q26 0 45 -19t19 -45t-19 -45l-256 -256q-19 -19 -45 -19t-45 19l-256 256q-19 19 -19 45t19 45t45 19h128v1024h-128q-26 0 -45 19t-19 45t19 45l256 256q19 19 45 19t45 -19l256 -256q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 640q0 -26 -19 -45l-256 -256q-19 -19 -45 -19t-45 19t-19 45v128h-1024v-128q0 -26 -19 -45t-45 -19t-45 19l-256 256q-19 19 -19 45t19 45l256 256q19 19 45 19t45 -19t19 -45v-128h1024v128q0 26 19 45t45 19t45 -19l256 -256q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="2048" d="M640 640v-512h-256v512h256zM1024 1152v-1024h-256v1024h256zM2048 0v-128h-2048v1536h128v-1408h1920zM1408 896v-768h-256v768h256zM1792 1280v-1152h-256v1152h256z" /> +<glyph unicode="" d="M1280 926q-56 -25 -121 -34q68 40 93 117q-65 -38 -134 -51q-61 66 -153 66q-87 0 -148.5 -61.5t-61.5 -148.5q0 -29 5 -48q-129 7 -242 65t-192 155q-29 -50 -29 -106q0 -114 91 -175q-47 1 -100 26v-2q0 -75 50 -133.5t123 -72.5q-29 -8 -51 -8q-13 0 -39 4 q21 -63 74.5 -104t121.5 -42q-116 -90 -261 -90q-26 0 -50 3q148 -94 322 -94q112 0 210 35.5t168 95t120.5 137t75 162t24.5 168.5q0 18 -1 27q63 45 105 109zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5 t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-188v595h199l30 232h-229v148q0 56 23.5 84t91.5 28l122 1v207q-63 9 -178 9q-136 0 -217.5 -80t-81.5 -226v-171h-200v-232h200v-595h-532q-119 0 -203.5 84.5t-84.5 203.5v960 q0 119 84.5 203.5t203.5 84.5h960z" /> +<glyph unicode="" horiz-adv-x="1792" d="M928 704q0 14 -9 23t-23 9q-66 0 -113 -47t-47 -113q0 -14 9 -23t23 -9t23 9t9 23q0 40 28 68t68 28q14 0 23 9t9 23zM1152 574q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181zM128 0h1536v128h-1536v-128zM1280 574q0 159 -112.5 271.5 t-271.5 112.5t-271.5 -112.5t-112.5 -271.5t112.5 -271.5t271.5 -112.5t271.5 112.5t112.5 271.5zM256 1216h384v128h-384v-128zM128 1024h1536v118v138h-828l-64 -128h-644v-128zM1792 1280v-1280q0 -53 -37.5 -90.5t-90.5 -37.5h-1536q-53 0 -90.5 37.5t-37.5 90.5v1280 q0 53 37.5 90.5t90.5 37.5h1536q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M832 1024q0 80 -56 136t-136 56t-136 -56t-56 -136q0 -42 19 -83q-41 19 -83 19q-80 0 -136 -56t-56 -136t56 -136t136 -56t136 56t56 136q0 42 -19 83q41 -19 83 -19q80 0 136 56t56 136zM1683 320q0 -17 -49 -66t-66 -49q-9 0 -28.5 16t-36.5 33t-38.5 40t-24.5 26 l-96 -96l220 -220q28 -28 28 -68q0 -42 -39 -81t-81 -39q-40 0 -68 28l-671 671q-176 -131 -365 -131q-163 0 -265.5 102.5t-102.5 265.5q0 160 95 313t248 248t313 95q163 0 265.5 -102.5t102.5 -265.5q0 -189 -131 -365l355 -355l96 96q-3 3 -26 24.5t-40 38.5t-33 36.5 t-16 28.5q0 17 49 66t66 49q13 0 23 -10q6 -6 46 -44.5t82 -79.5t86.5 -86t73 -78t28.5 -41z" /> +<glyph unicode="" horiz-adv-x="1920" d="M896 640q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1664 128q0 52 -38 90t-90 38t-90 -38t-38 -90q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1664 1152q0 52 -38 90t-90 38t-90 -38t-38 -90q0 -53 37.5 -90.5t90.5 -37.5 t90.5 37.5t37.5 90.5zM1280 731v-185q0 -10 -7 -19.5t-16 -10.5l-155 -24q-11 -35 -32 -76q34 -48 90 -115q7 -10 7 -20q0 -12 -7 -19q-23 -30 -82.5 -89.5t-78.5 -59.5q-11 0 -21 7l-115 90q-37 -19 -77 -31q-11 -108 -23 -155q-7 -24 -30 -24h-186q-11 0 -20 7.5t-10 17.5 l-23 153q-34 10 -75 31l-118 -89q-7 -7 -20 -7q-11 0 -21 8q-144 133 -144 160q0 9 7 19q10 14 41 53t47 61q-23 44 -35 82l-152 24q-10 1 -17 9.5t-7 19.5v185q0 10 7 19.5t16 10.5l155 24q11 35 32 76q-34 48 -90 115q-7 11 -7 20q0 12 7 20q22 30 82 89t79 59q11 0 21 -7 l115 -90q34 18 77 32q11 108 23 154q7 24 30 24h186q11 0 20 -7.5t10 -17.5l23 -153q34 -10 75 -31l118 89q8 7 20 7q11 0 21 -8q144 -133 144 -160q0 -9 -7 -19q-12 -16 -42 -54t-45 -60q23 -48 34 -82l152 -23q10 -2 17 -10.5t7 -19.5zM1920 198v-140q0 -16 -149 -31 q-12 -27 -30 -52q51 -113 51 -138q0 -4 -4 -7q-122 -71 -124 -71q-8 0 -46 47t-52 68q-20 -2 -30 -2t-30 2q-14 -21 -52 -68t-46 -47q-2 0 -124 71q-4 3 -4 7q0 25 51 138q-18 25 -30 52q-149 15 -149 31v140q0 16 149 31q13 29 30 52q-51 113 -51 138q0 4 4 7q4 2 35 20 t59 34t30 16q8 0 46 -46.5t52 -67.5q20 2 30 2t30 -2q51 71 92 112l6 2q4 0 124 -70q4 -3 4 -7q0 -25 -51 -138q17 -23 30 -52q149 -15 149 -31zM1920 1222v-140q0 -16 -149 -31q-12 -27 -30 -52q51 -113 51 -138q0 -4 -4 -7q-122 -71 -124 -71q-8 0 -46 47t-52 68 q-20 -2 -30 -2t-30 2q-14 -21 -52 -68t-46 -47q-2 0 -124 71q-4 3 -4 7q0 25 51 138q-18 25 -30 52q-149 15 -149 31v140q0 16 149 31q13 29 30 52q-51 113 -51 138q0 4 4 7q4 2 35 20t59 34t30 16q8 0 46 -46.5t52 -67.5q20 2 30 2t30 -2q51 71 92 112l6 2q4 0 124 -70 q4 -3 4 -7q0 -25 -51 -138q17 -23 30 -52q149 -15 149 -31z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1408 768q0 -139 -94 -257t-256.5 -186.5t-353.5 -68.5q-86 0 -176 16q-124 -88 -278 -128q-36 -9 -86 -16h-3q-11 0 -20.5 8t-11.5 21q-1 3 -1 6.5t0.5 6.5t2 6l2.5 5t3.5 5.5t4 5t4.5 5t4 4.5q5 6 23 25t26 29.5t22.5 29t25 38.5t20.5 44q-124 72 -195 177t-71 224 q0 139 94 257t256.5 186.5t353.5 68.5t353.5 -68.5t256.5 -186.5t94 -257zM1792 512q0 -120 -71 -224.5t-195 -176.5q10 -24 20.5 -44t25 -38.5t22.5 -29t26 -29.5t23 -25q1 -1 4 -4.5t4.5 -5t4 -5t3.5 -5.5l2.5 -5t2 -6t0.5 -6.5t-1 -6.5q-3 -14 -13 -22t-22 -7 q-50 7 -86 16q-154 40 -278 128q-90 -16 -176 -16q-271 0 -472 132q58 -4 88 -4q161 0 309 45t264 129q125 92 192 212t67 254q0 77 -23 152q129 -71 204 -178t75 -230z" /> +<glyph unicode="" d="M256 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 768q0 51 -39 89.5t-89 38.5h-352q0 58 48 159.5t48 160.5q0 98 -32 145t-128 47q-26 -26 -38 -85t-30.5 -125.5t-59.5 -109.5q-22 -23 -77 -91q-4 -5 -23 -30t-31.5 -41t-34.5 -42.5 t-40 -44t-38.5 -35.5t-40 -27t-35.5 -9h-32v-640h32q13 0 31.5 -3t33 -6.5t38 -11t35 -11.5t35.5 -12.5t29 -10.5q211 -73 342 -73h121q192 0 192 167q0 26 -5 56q30 16 47.5 52.5t17.5 73.5t-18 69q53 50 53 119q0 25 -10 55.5t-25 47.5q32 1 53.5 47t21.5 81zM1536 769 q0 -89 -49 -163q9 -33 9 -69q0 -77 -38 -144q3 -21 3 -43q0 -101 -60 -178q1 -139 -85 -219.5t-227 -80.5h-36h-93q-96 0 -189.5 22.5t-216.5 65.5q-116 40 -138 40h-288q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5h274q36 24 137 155q58 75 107 128 q24 25 35.5 85.5t30.5 126.5t62 108q39 37 90 37q84 0 151 -32.5t102 -101.5t35 -186q0 -93 -48 -192h176q104 0 180 -76t76 -179z" /> +<glyph unicode="" d="M256 1088q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 512q0 35 -21.5 81t-53.5 47q15 17 25 47.5t10 55.5q0 69 -53 119q18 32 18 69t-17.5 73.5t-47.5 52.5q5 30 5 56q0 85 -49 126t-136 41h-128q-131 0 -342 -73q-5 -2 -29 -10.5 t-35.5 -12.5t-35 -11.5t-38 -11t-33 -6.5t-31.5 -3h-32v-640h32q16 0 35.5 -9t40 -27t38.5 -35.5t40 -44t34.5 -42.5t31.5 -41t23 -30q55 -68 77 -91q41 -43 59.5 -109.5t30.5 -125.5t38 -85q96 0 128 47t32 145q0 59 -48 160.5t-48 159.5h352q50 0 89 38.5t39 89.5z M1536 511q0 -103 -76 -179t-180 -76h-176q48 -99 48 -192q0 -118 -35 -186q-35 -69 -102 -101.5t-151 -32.5q-51 0 -90 37q-34 33 -54 82t-25.5 90.5t-17.5 84.5t-31 64q-48 50 -107 127q-101 131 -137 155h-274q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5 h288q22 0 138 40q128 44 223 66t200 22h112q140 0 226.5 -79t85.5 -216v-5q60 -77 60 -178q0 -22 -3 -43q38 -67 38 -144q0 -36 -9 -69q49 -74 49 -163z" /> +<glyph unicode="" horiz-adv-x="896" d="M832 1504v-1339l-449 -236q-22 -12 -40 -12q-21 0 -31.5 14.5t-10.5 35.5q0 6 2 20l86 500l-364 354q-25 27 -25 48q0 37 56 46l502 73l225 455q19 41 49 41z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 940q0 81 -21.5 143t-55 98.5t-81.5 59.5t-94 31t-98 8t-112 -25.5t-110.5 -64t-86.5 -72t-60 -61.5q-18 -22 -49 -22t-49 22q-24 28 -60 61.5t-86.5 72t-110.5 64t-112 25.5t-98 -8t-94 -31t-81.5 -59.5t-55 -98.5t-21.5 -143q0 -168 187 -355l581 -560l580 559 q188 188 188 356zM1792 940q0 -221 -229 -450l-623 -600q-18 -18 -44 -18t-44 18l-624 602q-10 8 -27.5 26t-55.5 65.5t-68 97.5t-53.5 121t-23.5 138q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5 q224 0 351 -124t127 -344z" /> +<glyph unicode="" horiz-adv-x="1664" d="M640 96q0 -4 1 -20t0.5 -26.5t-3 -23.5t-10 -19.5t-20.5 -6.5h-320q-119 0 -203.5 84.5t-84.5 203.5v704q0 119 84.5 203.5t203.5 84.5h320q13 0 22.5 -9.5t9.5 -22.5q0 -4 1 -20t0.5 -26.5t-3 -23.5t-10 -19.5t-20.5 -6.5h-320q-66 0 -113 -47t-47 -113v-704 q0 -66 47 -113t113 -47h288h11h13t11.5 -1t11.5 -3t8 -5.5t7 -9t2 -13.5zM1568 640q0 -26 -19 -45l-544 -544q-19 -19 -45 -19t-45 19t-19 45v288h-448q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h448v288q0 26 19 45t45 19t45 -19l544 -544q19 -19 19 -45z" /> +<glyph unicode="" d="M237 122h231v694h-231v-694zM483 1030q-1 52 -36 86t-93 34t-94.5 -34t-36.5 -86q0 -51 35.5 -85.5t92.5 -34.5h1q59 0 95 34.5t36 85.5zM1068 122h231v398q0 154 -73 233t-193 79q-136 0 -209 -117h2v101h-231q3 -66 0 -694h231v388q0 38 7 56q15 35 45 59.5t74 24.5 q116 0 116 -157v-371zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1152" d="M480 672v448q0 14 -9 23t-23 9t-23 -9t-9 -23v-448q0 -14 9 -23t23 -9t23 9t9 23zM1152 320q0 -26 -19 -45t-45 -19h-429l-51 -483q-2 -12 -10.5 -20.5t-20.5 -8.5h-1q-27 0 -32 27l-76 485h-404q-26 0 -45 19t-19 45q0 123 78.5 221.5t177.5 98.5v512q-52 0 -90 38 t-38 90t38 90t90 38h640q52 0 90 -38t38 -90t-38 -90t-90 -38v-512q99 0 177.5 -98.5t78.5 -221.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1408 608v-320q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h704q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v320 q0 14 9 23t23 9h64q14 0 23 -9t9 -23zM1792 1472v-512q0 -26 -19 -45t-45 -19t-45 19l-176 176l-652 -652q-10 -10 -23 -10t-23 10l-114 114q-10 10 -10 23t10 23l652 652l-176 176q-19 19 -19 45t19 45t45 19h512q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1184 640q0 -26 -19 -45l-544 -544q-19 -19 -45 -19t-45 19t-19 45v288h-448q-26 0 -45 19t-19 45v384q0 26 19 45t45 19h448v288q0 26 19 45t45 19t45 -19l544 -544q19 -19 19 -45zM1536 992v-704q0 -119 -84.5 -203.5t-203.5 -84.5h-320q-13 0 -22.5 9.5t-9.5 22.5 q0 4 -1 20t-0.5 26.5t3 23.5t10 19.5t20.5 6.5h320q66 0 113 47t47 113v704q0 66 -47 113t-113 47h-288h-11h-13t-11.5 1t-11.5 3t-8 5.5t-7 9t-2 13.5q0 4 -1 20t-0.5 26.5t3 23.5t10 19.5t20.5 6.5h320q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M458 653q-74 162 -74 371h-256v-96q0 -78 94.5 -162t235.5 -113zM1536 928v96h-256q0 -209 -74 -371q141 29 235.5 113t94.5 162zM1664 1056v-128q0 -71 -41.5 -143t-112 -130t-173 -97.5t-215.5 -44.5q-42 -54 -95 -95q-38 -34 -52.5 -72.5t-14.5 -89.5q0 -54 30.5 -91 t97.5 -37q75 0 133.5 -45.5t58.5 -114.5v-64q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23v64q0 69 58.5 114.5t133.5 45.5q67 0 97.5 37t30.5 91q0 51 -14.5 89.5t-52.5 72.5q-53 41 -95 95q-113 5 -215.5 44.5t-173 97.5t-112 130t-41.5 143v128q0 40 28 68t68 28h288v96 q0 66 47 113t113 47h576q66 0 113 -47t47 -113v-96h288q40 0 68 -28t28 -68z" /> +<glyph unicode="" d="M519 336q4 6 -3 13q-9 7 -14 2q-4 -6 3 -13q9 -7 14 -2zM491 377q-5 7 -12 4q-6 -4 0 -12q7 -8 12 -5q6 4 0 13zM450 417q2 4 -5 8q-7 2 -8 -2q-3 -5 4 -8q8 -2 9 2zM471 394q2 1 1.5 4.5t-3.5 5.5q-6 7 -10 3t1 -11q6 -6 11 -2zM557 319q2 7 -9 11q-9 3 -13 -4 q-2 -7 9 -11q9 -3 13 4zM599 316q0 8 -12 8q-10 0 -10 -8t11 -8t11 8zM638 323q-2 7 -13 5t-9 -9q2 -8 12 -6t10 10zM1280 640q0 212 -150 362t-362 150t-362 -150t-150 -362q0 -167 98 -300.5t252 -185.5q18 -3 26.5 5t8.5 20q0 52 -1 95q-6 -1 -15.5 -2.5t-35.5 -2t-48 4 t-43.5 20t-29.5 41.5q-23 59 -57 74q-2 1 -4.5 3.5l-8 8t-7 9.5t4 7.5t19.5 3.5q6 0 15 -2t30 -15.5t33 -35.5q16 -28 37.5 -42t43.5 -14t38 3.5t30 9.5q7 47 33 69q-49 6 -86 18.5t-73 39t-55.5 76t-19.5 119.5q0 79 53 137q-24 62 5 136q19 6 54.5 -7.5t60.5 -29.5l26 -16 q58 17 128 17t128 -17q11 7 28.5 18t55.5 26t57 9q29 -74 5 -136q53 -58 53 -137q0 -57 -14 -100.5t-35.5 -70t-53.5 -44.5t-62.5 -26t-68.5 -12q35 -31 35 -95q0 -40 -0.5 -89t-0.5 -51q0 -12 8.5 -20t26.5 -5q154 52 252 185.5t98 300.5zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1280 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 288v-320q0 -40 -28 -68t-68 -28h-1472q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h427q21 -56 70.5 -92 t110.5 -36h256q61 0 110.5 36t70.5 92h427q40 0 68 -28t28 -68zM1339 936q-17 -40 -59 -40h-256v-448q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v448h-256q-42 0 -59 40q-17 39 14 69l448 448q18 19 45 19t45 -19l448 -448q31 -30 14 -69z" /> +<glyph unicode="" d="M1407 710q0 44 -7 113.5t-18 96.5q-12 30 -17 44t-9 36.5t-4 48.5q0 23 5 68.5t5 67.5q0 37 -10 55q-4 1 -13 1q-19 0 -58 -4.5t-59 -4.5q-60 0 -176 24t-175 24q-43 0 -94.5 -11.5t-85 -23.5t-89.5 -34q-137 -54 -202 -103q-96 -73 -159.5 -189.5t-88 -236t-24.5 -248.5 q0 -40 12.5 -120t12.5 -121q0 -23 -11 -66.5t-11 -65.5t12 -36.5t34 -14.5q24 0 72.5 11t73.5 11q57 0 169.5 -15.5t169.5 -15.5q181 0 284 36q129 45 235.5 152.5t166 245.5t59.5 275zM1535 712q0 -165 -70 -327.5t-196 -288t-281 -180.5q-124 -44 -326 -44 q-57 0 -170 14.5t-169 14.5q-24 0 -72.5 -14.5t-73.5 -14.5q-73 0 -123.5 55.5t-50.5 128.5q0 24 11 68t11 67q0 40 -12.5 120.5t-12.5 121.5q0 111 18 217.5t54.5 209.5t100.5 194t150 156q78 59 232 120q194 78 316 78q60 0 175.5 -24t173.5 -24q19 0 57 5t58 5 q81 0 118 -50.5t37 -134.5q0 -23 -5 -68t-5 -68q0 -10 1 -18.5t3 -17t4 -13.5t6.5 -16t6.5 -17q16 -40 25 -118.5t9 -136.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1408 296q0 -27 -10 -70.5t-21 -68.5q-21 -50 -122 -106q-94 -51 -186 -51q-27 0 -52.5 3.5t-57.5 12.5t-47.5 14.5t-55.5 20.5t-49 18q-98 35 -175 83q-128 79 -264.5 215.5t-215.5 264.5q-48 77 -83 175q-3 9 -18 49t-20.5 55.5t-14.5 47.5t-12.5 57.5t-3.5 52.5 q0 92 51 186q56 101 106 122q25 11 68.5 21t70.5 10q14 0 21 -3q18 -6 53 -76q11 -19 30 -54t35 -63.5t31 -53.5q3 -4 17.5 -25t21.5 -35.5t7 -28.5q0 -20 -28.5 -50t-62 -55t-62 -53t-28.5 -46q0 -9 5 -22.5t8.5 -20.5t14 -24t11.5 -19q76 -137 174 -235t235 -174 q2 -1 19 -11.5t24 -14t20.5 -8.5t22.5 -5q18 0 46 28.5t53 62t55 62t50 28.5q14 0 28.5 -7t35.5 -21.5t25 -17.5q25 -15 53.5 -31t63.5 -35t54 -30q70 -35 76 -53q3 -7 3 -21z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1120 1280h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113v832q0 66 -47 113t-113 47zM1408 1120v-832q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832 q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1152 1280h-1024v-1242l423 406l89 85l89 -85l423 -406v1242zM1164 1408q23 0 44 -9q33 -13 52.5 -41t19.5 -62v-1289q0 -34 -19.5 -62t-52.5 -41q-19 -8 -44 -8q-48 0 -83 32l-441 424l-441 -424q-36 -33 -83 -33q-23 0 -44 9q-33 13 -52.5 41t-19.5 62v1289 q0 34 19.5 62t52.5 41q21 9 44 9h1048z" /> +<glyph unicode="" d="M1280 343q0 11 -2 16q-3 8 -38.5 29.5t-88.5 49.5l-53 29q-5 3 -19 13t-25 15t-21 5q-18 0 -47 -32.5t-57 -65.5t-44 -33q-7 0 -16.5 3.5t-15.5 6.5t-17 9.5t-14 8.5q-99 55 -170.5 126.5t-126.5 170.5q-2 3 -8.5 14t-9.5 17t-6.5 15.5t-3.5 16.5q0 13 20.5 33.5t45 38.5 t45 39.5t20.5 36.5q0 10 -5 21t-15 25t-13 19q-3 6 -15 28.5t-25 45.5t-26.5 47.5t-25 40.5t-16.5 18t-16 2q-48 0 -101 -22q-46 -21 -80 -94.5t-34 -130.5q0 -16 2.5 -34t5 -30.5t9 -33t10 -29.5t12.5 -33t11 -30q60 -164 216.5 -320.5t320.5 -216.5q6 -2 30 -11t33 -12.5 t29.5 -10t33 -9t30.5 -5t34 -2.5q57 0 130.5 34t94.5 80q22 53 22 101zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1620 1128q-67 -98 -162 -167q1 -14 1 -42q0 -130 -38 -259.5t-115.5 -248.5t-184.5 -210.5t-258 -146t-323 -54.5q-271 0 -496 145q35 -4 78 -4q225 0 401 138q-105 2 -188 64.5t-114 159.5q33 -5 61 -5q43 0 85 11q-112 23 -185.5 111.5t-73.5 205.5v4q68 -38 146 -41 q-66 44 -105 115t-39 154q0 88 44 163q121 -149 294.5 -238.5t371.5 -99.5q-8 38 -8 74q0 134 94.5 228.5t228.5 94.5q140 0 236 -102q109 21 205 78q-37 -115 -142 -178q93 10 186 50z" /> +<glyph unicode="" horiz-adv-x="1024" d="M959 1524v-264h-157q-86 0 -116 -36t-30 -108v-189h293l-39 -296h-254v-759h-306v759h-255v296h255v218q0 186 104 288.5t277 102.5q147 0 228 -12z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5q0 -251 -146.5 -451.5t-378.5 -277.5q-27 -5 -40 7t-13 30q0 3 0.5 76.5t0.5 134.5q0 97 -52 142q57 6 102.5 18t94 39t81 66.5t53 105t20.5 150.5q0 119 -79 206q37 91 -8 204q-28 9 -81 -11t-92 -44l-38 -24 q-93 26 -192 26t-192 -26q-16 11 -42.5 27t-83.5 38.5t-85 13.5q-45 -113 -8 -204q-79 -87 -79 -206q0 -85 20.5 -150t52.5 -105t80.5 -67t94 -39t102.5 -18q-39 -36 -49 -103q-21 -10 -45 -15t-57 -5t-65.5 21.5t-55.5 62.5q-19 32 -48.5 52t-49.5 24l-20 3q-21 0 -29 -4.5 t-5 -11.5t9 -14t13 -12l7 -5q22 -10 43.5 -38t31.5 -51l10 -23q13 -38 44 -61.5t67 -30t69.5 -7t55.5 3.5l23 4q0 -38 0.5 -88.5t0.5 -54.5q0 -18 -13 -30t-40 -7q-232 77 -378.5 277.5t-146.5 451.5q0 209 103 385.5t279.5 279.5t385.5 103zM291 305q3 7 -7 12 q-10 3 -13 -2q-3 -7 7 -12q9 -6 13 2zM322 271q7 5 -2 16q-10 9 -16 3q-7 -5 2 -16q10 -10 16 -3zM352 226q9 7 0 19q-8 13 -17 6q-9 -5 0 -18t17 -7zM394 184q8 8 -4 19q-12 12 -20 3q-9 -8 4 -19q12 -12 20 -3zM451 159q3 11 -13 16q-15 4 -19 -7t13 -15q15 -6 19 6z M514 154q0 13 -17 11q-16 0 -16 -11q0 -13 17 -11q16 0 16 11zM572 164q-2 11 -18 9q-16 -3 -14 -15t18 -8t14 14z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 960v-256q0 -26 -19 -45t-45 -19h-64q-26 0 -45 19t-19 45v256q0 106 -75 181t-181 75t-181 -75t-75 -181v-192h96q40 0 68 -28t28 -68v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h672v192q0 185 131.5 316.5t316.5 131.5 t316.5 -131.5t131.5 -316.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1760 1408q66 0 113 -47t47 -113v-1216q0 -66 -47 -113t-113 -47h-1600q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1600zM160 1280q-13 0 -22.5 -9.5t-9.5 -22.5v-224h1664v224q0 13 -9.5 22.5t-22.5 9.5h-1600zM1760 0q13 0 22.5 9.5t9.5 22.5v608h-1664v-608 q0 -13 9.5 -22.5t22.5 -9.5h1600zM256 128v128h256v-128h-256zM640 128v128h384v-128h-384z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 192q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM896 69q2 -28 -17 -48q-18 -21 -47 -21h-135q-25 0 -43 16.5t-20 41.5q-22 229 -184.5 391.5t-391.5 184.5q-25 2 -41.5 20t-16.5 43v135q0 29 21 47q17 17 43 17h5q160 -13 306 -80.5 t259 -181.5q114 -113 181.5 -259t80.5 -306zM1408 67q2 -27 -18 -47q-18 -20 -46 -20h-143q-26 0 -44.5 17.5t-19.5 42.5q-12 215 -101 408.5t-231.5 336t-336 231.5t-408.5 102q-25 1 -42.5 19.5t-17.5 43.5v143q0 28 20 46q18 18 44 18h3q262 -13 501.5 -120t425.5 -294 q187 -186 294 -425.5t120 -501.5z" /> +<glyph unicode="" d="M1040 320q0 -33 -23.5 -56.5t-56.5 -23.5t-56.5 23.5t-23.5 56.5t23.5 56.5t56.5 23.5t56.5 -23.5t23.5 -56.5zM1296 320q0 -33 -23.5 -56.5t-56.5 -23.5t-56.5 23.5t-23.5 56.5t23.5 56.5t56.5 23.5t56.5 -23.5t23.5 -56.5zM1408 160v320q0 13 -9.5 22.5t-22.5 9.5 h-1216q-13 0 -22.5 -9.5t-9.5 -22.5v-320q0 -13 9.5 -22.5t22.5 -9.5h1216q13 0 22.5 9.5t9.5 22.5zM178 640h1180l-157 482q-4 13 -16 21.5t-26 8.5h-782q-14 0 -26 -8.5t-16 -21.5zM1536 480v-320q0 -66 -47 -113t-113 -47h-1216q-66 0 -113 47t-47 113v320q0 25 16 75 l197 606q17 53 63 86t101 33h782q55 0 101 -33t63 -86l197 -606q16 -50 16 -75z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 896q53 0 90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5v-384q0 -52 -38 -90t-90 -38q-417 347 -812 380q-58 -19 -91 -66t-31 -100.5t40 -92.5q-20 -33 -23 -65.5t6 -58t33.5 -55t48 -50t61.5 -50.5q-29 -58 -111.5 -83t-168.5 -11.5t-132 55.5q-7 23 -29.5 87.5 t-32 94.5t-23 89t-15 101t3.5 98.5t22 110.5h-122q-66 0 -113 47t-47 113v192q0 66 47 113t113 47h480q435 0 896 384q52 0 90 -38t38 -90v-384zM1536 292v954q-394 -302 -768 -343v-270q377 -42 768 -341z" /> +<glyph unicode="" horiz-adv-x="1792" d="M912 -160q0 16 -16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5q16 0 16 16zM246 128h1300q-266 300 -266 832q0 51 -24 105t-69 103t-121.5 80.5t-169.5 31.5t-169.5 -31.5t-121.5 -80.5t-69 -103t-24 -105q0 -532 -266 -832z M1728 128q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-181 75t-75 181h-448q-52 0 -90 38t-38 90q50 42 91 88t85 119.5t74.5 158.5t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q190 -28 307 -158.5 t117 -282.5q0 -139 19.5 -260t50 -206t74.5 -158.5t85 -119.5t91 -88z" /> +<glyph unicode="" d="M1376 640l138 -135q30 -28 20 -70q-12 -41 -52 -51l-188 -48l53 -186q12 -41 -19 -70q-29 -31 -70 -19l-186 53l-48 -188q-10 -40 -51 -52q-12 -2 -19 -2q-31 0 -51 22l-135 138l-135 -138q-28 -30 -70 -20q-41 11 -51 52l-48 188l-186 -53q-41 -12 -70 19q-31 29 -19 70 l53 186l-188 48q-40 10 -52 51q-10 42 20 70l138 135l-138 135q-30 28 -20 70q12 41 52 51l188 48l-53 186q-12 41 19 70q29 31 70 19l186 -53l48 188q10 41 51 51q41 12 70 -19l135 -139l135 139q29 30 70 19q41 -10 51 -51l48 -188l186 53q41 12 70 -19q31 -29 19 -70 l-53 -186l188 -48q40 -10 52 -51q10 -42 -20 -70z" /> +<glyph unicode="" horiz-adv-x="1792" d="M256 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1664 768q0 51 -39 89.5t-89 38.5h-576q0 20 15 48.5t33 55t33 68t15 84.5q0 67 -44.5 97.5t-115.5 30.5q-24 0 -90 -139q-24 -44 -37 -65q-40 -64 -112 -145q-71 -81 -101 -106 q-69 -57 -140 -57h-32v-640h32q72 0 167 -32t193.5 -64t179.5 -32q189 0 189 167q0 26 -5 56q30 16 47.5 52.5t17.5 73.5t-18 69q53 50 53 119q0 25 -10 55.5t-25 47.5h331q52 0 90 38t38 90zM1792 769q0 -105 -75.5 -181t-180.5 -76h-169q-4 -62 -37 -119q3 -21 3 -43 q0 -101 -60 -178q1 -139 -85 -219.5t-227 -80.5q-133 0 -322 69q-164 59 -223 59h-288q-53 0 -90.5 37.5t-37.5 90.5v640q0 53 37.5 90.5t90.5 37.5h288q10 0 21.5 4.5t23.5 14t22.5 18t24 22.5t20.5 21.5t19 21.5t14 17q65 74 100 129q13 21 33 62t37 72t40.5 63t55 49.5 t69.5 17.5q125 0 206.5 -67t81.5 -189q0 -68 -22 -128h374q104 0 180 -76t76 -179z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1376 128h32v640h-32q-35 0 -67.5 12t-62.5 37t-50 46t-49 54q-2 3 -3.5 4.5t-4 4.5t-4.5 5q-72 81 -112 145q-14 22 -38 68q-1 3 -10.5 22.5t-18.5 36t-20 35.5t-21.5 30.5t-18.5 11.5q-71 0 -115.5 -30.5t-44.5 -97.5q0 -43 15 -84.5t33 -68t33 -55t15 -48.5h-576 q-50 0 -89 -38.5t-39 -89.5q0 -52 38 -90t90 -38h331q-15 -17 -25 -47.5t-10 -55.5q0 -69 53 -119q-18 -32 -18 -69t17.5 -73.5t47.5 -52.5q-4 -24 -4 -56q0 -85 48.5 -126t135.5 -41q84 0 183 32t194 64t167 32zM1664 192q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45 t45 -19t45 19t19 45zM1792 768v-640q0 -53 -37.5 -90.5t-90.5 -37.5h-288q-59 0 -223 -59q-190 -69 -317 -69q-142 0 -230 77.5t-87 217.5l1 5q-61 76 -61 178q0 22 3 43q-33 57 -37 119h-169q-105 0 -180.5 76t-75.5 181q0 103 76 179t180 76h374q-22 60 -22 128 q0 122 81.5 189t206.5 67q38 0 69.5 -17.5t55 -49.5t40.5 -63t37 -72t33 -62q35 -55 100 -129q2 -3 14 -17t19 -21.5t20.5 -21.5t24 -22.5t22.5 -18t23.5 -14t21.5 -4.5h288q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" d="M1280 -64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 700q0 189 -167 189q-26 0 -56 -5q-16 30 -52.5 47.5t-73.5 17.5t-69 -18q-50 53 -119 53q-25 0 -55.5 -10t-47.5 -25v331q0 52 -38 90t-90 38q-51 0 -89.5 -39t-38.5 -89v-576 q-20 0 -48.5 15t-55 33t-68 33t-84.5 15q-67 0 -97.5 -44.5t-30.5 -115.5q0 -24 139 -90q44 -24 65 -37q64 -40 145 -112q81 -71 106 -101q57 -69 57 -140v-32h640v32q0 72 32 167t64 193.5t32 179.5zM1536 705q0 -133 -69 -322q-59 -164 -59 -223v-288q0 -53 -37.5 -90.5 t-90.5 -37.5h-640q-53 0 -90.5 37.5t-37.5 90.5v288q0 10 -4.5 21.5t-14 23.5t-18 22.5t-22.5 24t-21.5 20.5t-21.5 19t-17 14q-74 65 -129 100q-21 13 -62 33t-72 37t-63 40.5t-49.5 55t-17.5 69.5q0 125 67 206.5t189 81.5q68 0 128 -22v374q0 104 76 180t179 76 q105 0 181 -75.5t76 -180.5v-169q62 -4 119 -37q21 3 43 3q101 0 178 -60q139 1 219.5 -85t80.5 -227z" /> +<glyph unicode="" d="M1408 576q0 84 -32 183t-64 194t-32 167v32h-640v-32q0 -35 -12 -67.5t-37 -62.5t-46 -50t-54 -49q-9 -8 -14 -12q-81 -72 -145 -112q-22 -14 -68 -38q-3 -1 -22.5 -10.5t-36 -18.5t-35.5 -20t-30.5 -21.5t-11.5 -18.5q0 -71 30.5 -115.5t97.5 -44.5q43 0 84.5 15t68 33 t55 33t48.5 15v-576q0 -50 38.5 -89t89.5 -39q52 0 90 38t38 90v331q46 -35 103 -35q69 0 119 53q32 -18 69 -18t73.5 17.5t52.5 47.5q24 -4 56 -4q85 0 126 48.5t41 135.5zM1280 1344q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1536 580 q0 -142 -77.5 -230t-217.5 -87l-5 1q-76 -61 -178 -61q-22 0 -43 3q-54 -30 -119 -37v-169q0 -105 -76 -180.5t-181 -75.5q-103 0 -179 76t-76 180v374q-54 -22 -128 -22q-121 0 -188.5 81.5t-67.5 206.5q0 38 17.5 69.5t49.5 55t63 40.5t72 37t62 33q55 35 129 100 q3 2 17 14t21.5 19t21.5 20.5t22.5 24t18 22.5t14 23.5t4.5 21.5v288q0 53 37.5 90.5t90.5 37.5h640q53 0 90.5 -37.5t37.5 -90.5v-288q0 -59 59 -223q69 -190 69 -317z" /> +<glyph unicode="" d="M1280 576v128q0 26 -19 45t-45 19h-502l189 189q19 19 19 45t-19 45l-91 91q-18 18 -45 18t-45 -18l-362 -362l-91 -91q-18 -18 -18 -45t18 -45l91 -91l362 -362q18 -18 45 -18t45 18l91 91q18 18 18 45t-18 45l-189 189h502q26 0 45 19t19 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1285 640q0 27 -18 45l-91 91l-362 362q-18 18 -45 18t-45 -18l-91 -91q-18 -18 -18 -45t18 -45l189 -189h-502q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h502l-189 -189q-19 -19 -19 -45t19 -45l91 -91q18 -18 45 -18t45 18l362 362l91 91q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1284 641q0 27 -18 45l-362 362l-91 91q-18 18 -45 18t-45 -18l-91 -91l-362 -362q-18 -18 -18 -45t18 -45l91 -91q18 -18 45 -18t45 18l189 189v-502q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v502l189 -189q19 -19 45 -19t45 19l91 91q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1284 639q0 27 -18 45l-91 91q-18 18 -45 18t-45 -18l-189 -189v502q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-502l-189 189q-19 19 -45 19t-45 -19l-91 -91q-18 -18 -18 -45t18 -45l362 -362l91 -91q18 -18 45 -18t45 18l91 91l362 362q18 18 18 45zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM1042 887q-2 -1 -9.5 -9.5t-13.5 -9.5q2 0 4.5 5t5 11t3.5 7q6 7 22 15q14 6 52 12q34 8 51 -11 q-2 2 9.5 13t14.5 12q3 2 15 4.5t15 7.5l2 22q-12 -1 -17.5 7t-6.5 21q0 -2 -6 -8q0 7 -4.5 8t-11.5 -1t-9 -1q-10 3 -15 7.5t-8 16.5t-4 15q-2 5 -9.5 10.5t-9.5 10.5q-1 2 -2.5 5.5t-3 6.5t-4 5.5t-5.5 2.5t-7 -5t-7.5 -10t-4.5 -5q-3 2 -6 1.5t-4.5 -1t-4.5 -3t-5 -3.5 q-3 -2 -8.5 -3t-8.5 -2q15 5 -1 11q-10 4 -16 3q9 4 7.5 12t-8.5 14h5q-1 4 -8.5 8.5t-17.5 8.5t-13 6q-8 5 -34 9.5t-33 0.5q-5 -6 -4.5 -10.5t4 -14t3.5 -12.5q1 -6 -5.5 -13t-6.5 -12q0 -7 14 -15.5t10 -21.5q-3 -8 -16 -16t-16 -12q-5 -8 -1.5 -18.5t10.5 -16.5 q2 -2 1.5 -4t-3.5 -4.5t-5.5 -4t-6.5 -3.5l-3 -2q-11 -5 -20.5 6t-13.5 26q-7 25 -16 30q-23 8 -29 -1q-5 13 -41 26q-25 9 -58 4q6 1 0 15q-7 15 -19 12q3 6 4 17.5t1 13.5q3 13 12 23q1 1 7 8.5t9.5 13.5t0.5 6q35 -4 50 11q5 5 11.5 17t10.5 17q9 6 14 5.5t14.5 -5.5 t14.5 -5q14 -1 15.5 11t-7.5 20q12 -1 3 17q-5 7 -8 9q-12 4 -27 -5q-8 -4 2 -8q-1 1 -9.5 -10.5t-16.5 -17.5t-16 5q-1 1 -5.5 13.5t-9.5 13.5q-8 0 -16 -15q3 8 -11 15t-24 8q19 12 -8 27q-7 4 -20.5 5t-19.5 -4q-5 -7 -5.5 -11.5t5 -8t10.5 -5.5t11.5 -4t8.5 -3 q14 -10 8 -14q-2 -1 -8.5 -3.5t-11.5 -4.5t-6 -4q-3 -4 0 -14t-2 -14q-5 5 -9 17.5t-7 16.5q7 -9 -25 -6l-10 1q-4 0 -16 -2t-20.5 -1t-13.5 8q-4 8 0 20q1 4 4 2q-4 3 -11 9.5t-10 8.5q-46 -15 -94 -41q6 -1 12 1q5 2 13 6.5t10 5.5q34 14 42 7l5 5q14 -16 20 -25 q-7 4 -30 1q-20 -6 -22 -12q7 -12 5 -18q-4 3 -11.5 10t-14.5 11t-15 5q-16 0 -22 -1q-146 -80 -235 -222q7 -7 12 -8q4 -1 5 -9t2.5 -11t11.5 3q9 -8 3 -19q1 1 44 -27q19 -17 21 -21q3 -11 -10 -18q-1 2 -9 9t-9 4q-3 -5 0.5 -18.5t10.5 -12.5q-7 0 -9.5 -16t-2.5 -35.5 t-1 -23.5l2 -1q-3 -12 5.5 -34.5t21.5 -19.5q-13 -3 20 -43q6 -8 8 -9q3 -2 12 -7.5t15 -10t10 -10.5q4 -5 10 -22.5t14 -23.5q-2 -6 9.5 -20t10.5 -23q-1 0 -2.5 -1t-2.5 -1q3 -7 15.5 -14t15.5 -13q1 -3 2 -10t3 -11t8 -2q2 20 -24 62q-15 25 -17 29q-3 5 -5.5 15.5 t-4.5 14.5q2 0 6 -1.5t8.5 -3.5t7.5 -4t2 -3q-3 -7 2 -17.5t12 -18.5t17 -19t12 -13q6 -6 14 -19.5t0 -13.5q9 0 20 -10t17 -20q5 -8 8 -26t5 -24q2 -7 8.5 -13.5t12.5 -9.5l16 -8t13 -7q5 -2 18.5 -10.5t21.5 -11.5q10 -4 16 -4t14.5 2.5t13.5 3.5q15 2 29 -15t21 -21 q36 -19 55 -11q-2 -1 0.5 -7.5t8 -15.5t9 -14.5t5.5 -8.5q5 -6 18 -15t18 -15q6 4 7 9q-3 -8 7 -20t18 -10q14 3 14 32q-31 -15 -49 18q0 1 -2.5 5.5t-4 8.5t-2.5 8.5t0 7.5t5 3q9 0 10 3.5t-2 12.5t-4 13q-1 8 -11 20t-12 15q-5 -9 -16 -8t-16 9q0 -1 -1.5 -5.5t-1.5 -6.5 q-13 0 -15 1q1 3 2.5 17.5t3.5 22.5q1 4 5.5 12t7.5 14.5t4 12.5t-4.5 9.5t-17.5 2.5q-19 -1 -26 -20q-1 -3 -3 -10.5t-5 -11.5t-9 -7q-7 -3 -24 -2t-24 5q-13 8 -22.5 29t-9.5 37q0 10 2.5 26.5t3 25t-5.5 24.5q3 2 9 9.5t10 10.5q2 1 4.5 1.5t4.5 0t4 1.5t3 6q-1 1 -4 3 q-3 3 -4 3q7 -3 28.5 1.5t27.5 -1.5q15 -11 22 2q0 1 -2.5 9.5t-0.5 13.5q5 -27 29 -9q3 -3 15.5 -5t17.5 -5q3 -2 7 -5.5t5.5 -4.5t5 0.5t8.5 6.5q10 -14 12 -24q11 -40 19 -44q7 -3 11 -2t4.5 9.5t0 14t-1.5 12.5l-1 8v18l-1 8q-15 3 -18.5 12t1.5 18.5t15 18.5q1 1 8 3.5 t15.5 6.5t12.5 8q21 19 15 35q7 0 11 9q-1 0 -5 3t-7.5 5t-4.5 2q9 5 2 16q5 3 7.5 11t7.5 10q9 -12 21 -2q7 8 1 16q5 7 20.5 10.5t18.5 9.5q7 -2 8 2t1 12t3 12q4 5 15 9t13 5l17 11q3 4 0 4q18 -2 31 11q10 11 -6 20q3 6 -3 9.5t-15 5.5q3 1 11.5 0.5t10.5 1.5 q15 10 -7 16q-17 5 -43 -12zM879 10q206 36 351 189q-3 3 -12.5 4.5t-12.5 3.5q-18 7 -24 8q1 7 -2.5 13t-8 9t-12.5 8t-11 7q-2 2 -7 6t-7 5.5t-7.5 4.5t-8.5 2t-10 -1l-3 -1q-3 -1 -5.5 -2.5t-5.5 -3t-4 -3t0 -2.5q-21 17 -36 22q-5 1 -11 5.5t-10.5 7t-10 1.5t-11.5 -7 q-5 -5 -6 -15t-2 -13q-7 5 0 17.5t2 18.5q-3 6 -10.5 4.5t-12 -4.5t-11.5 -8.5t-9 -6.5t-8.5 -5.5t-8.5 -7.5q-3 -4 -6 -12t-5 -11q-2 4 -11.5 6.5t-9.5 5.5q2 -10 4 -35t5 -38q7 -31 -12 -48q-27 -25 -29 -40q-4 -22 12 -26q0 -7 -8 -20.5t-7 -21.5q0 -6 2 -16z" /> +<glyph unicode="" horiz-adv-x="1664" d="M384 64q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1028 484l-682 -682q-37 -37 -90 -37q-52 0 -91 37l-106 108q-38 36 -38 90q0 53 38 91l681 681q39 -98 114.5 -173.5t173.5 -114.5zM1662 919q0 -39 -23 -106q-47 -134 -164.5 -217.5 t-258.5 -83.5q-185 0 -316.5 131.5t-131.5 316.5t131.5 316.5t316.5 131.5q58 0 121.5 -16.5t107.5 -46.5q16 -11 16 -28t-16 -28l-293 -169v-224l193 -107q5 3 79 48.5t135.5 81t70.5 35.5q15 0 23.5 -10t8.5 -25z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1024 128h640v128h-640v-128zM640 640h1024v128h-1024v-128zM1280 1152h384v128h-384v-128zM1792 320v-256q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 832v-256q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19 t-19 45v256q0 26 19 45t45 19h1664q26 0 45 -19t19 -45zM1792 1344v-256q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1664q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1403 1241q17 -41 -14 -70l-493 -493v-742q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-256 256q-19 19 -19 45v486l-493 493q-31 29 -14 70q17 39 59 39h1280q42 0 59 -39z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 1280h512v128h-512v-128zM1792 640v-480q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v480h672v-160q0 -26 19 -45t45 -19h320q26 0 45 19t19 45v160h672zM1024 640v-128h-256v128h256zM1792 1120v-384h-1792v384q0 66 47 113t113 47h352v160q0 40 28 68 t68 28h576q40 0 68 -28t28 -68v-160h352q66 0 113 -47t47 -113z" /> +<glyph unicode="" d="M1283 995l-355 -355l355 -355l144 144q29 31 70 14q39 -17 39 -59v-448q0 -26 -19 -45t-45 -19h-448q-42 0 -59 40q-17 39 14 69l144 144l-355 355l-355 -355l144 -144q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l144 -144 l355 355l-355 355l-144 -144q-19 -19 -45 -19q-12 0 -24 5q-40 17 -40 59v448q0 26 19 45t45 19h448q42 0 59 -40q17 -39 -14 -69l-144 -144l355 -355l355 355l-144 144q-31 30 -14 69q17 40 59 40h448q26 0 45 -19t19 -45v-448q0 -42 -39 -59q-13 -5 -25 -5q-26 0 -45 19z " /> +<glyph unicode="" horiz-adv-x="1920" d="M593 640q-162 -5 -265 -128h-134q-82 0 -138 40.5t-56 118.5q0 353 124 353q6 0 43.5 -21t97.5 -42.5t119 -21.5q67 0 133 23q-5 -37 -5 -66q0 -139 81 -256zM1664 3q0 -120 -73 -189.5t-194 -69.5h-874q-121 0 -194 69.5t-73 189.5q0 53 3.5 103.5t14 109t26.5 108.5 t43 97.5t62 81t85.5 53.5t111.5 20q10 0 43 -21.5t73 -48t107 -48t135 -21.5t135 21.5t107 48t73 48t43 21.5q61 0 111.5 -20t85.5 -53.5t62 -81t43 -97.5t26.5 -108.5t14 -109t3.5 -103.5zM640 1280q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75 t75 -181zM1344 896q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5zM1920 671q0 -78 -56 -118.5t-138 -40.5h-134q-103 123 -265 128q81 117 81 256q0 29 -5 66q66 -23 133 -23q59 0 119 21.5t97.5 42.5 t43.5 21q124 0 124 -353zM1792 1280q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1456 320q0 40 -28 68l-208 208q-28 28 -68 28q-42 0 -72 -32q3 -3 19 -18.5t21.5 -21.5t15 -19t13 -25.5t3.5 -27.5q0 -40 -28 -68t-68 -28q-15 0 -27.5 3.5t-25.5 13t-19 15t-21.5 21.5t-18.5 19q-33 -31 -33 -73q0 -40 28 -68l206 -207q27 -27 68 -27q40 0 68 26 l147 146q28 28 28 67zM753 1025q0 40 -28 68l-206 207q-28 28 -68 28q-39 0 -68 -27l-147 -146q-28 -28 -28 -67q0 -40 28 -68l208 -208q27 -27 68 -27q42 0 72 31q-3 3 -19 18.5t-21.5 21.5t-15 19t-13 25.5t-3.5 27.5q0 40 28 68t68 28q15 0 27.5 -3.5t25.5 -13t19 -15 t21.5 -21.5t18.5 -19q33 31 33 73zM1648 320q0 -120 -85 -203l-147 -146q-83 -83 -203 -83q-121 0 -204 85l-206 207q-83 83 -83 203q0 123 88 209l-88 88q-86 -88 -208 -88q-120 0 -204 84l-208 208q-84 84 -84 204t85 203l147 146q83 83 203 83q121 0 204 -85l206 -207 q83 -83 83 -203q0 -123 -88 -209l88 -88q86 88 208 88q120 0 204 -84l208 -208q84 -84 84 -204z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1920 384q0 -159 -112.5 -271.5t-271.5 -112.5h-1088q-185 0 -316.5 131.5t-131.5 316.5q0 132 71 241.5t187 163.5q-2 28 -2 43q0 212 150 362t362 150q158 0 286.5 -88t187.5 -230q70 62 166 62q106 0 181 -75t75 -181q0 -75 -41 -138q129 -30 213 -134.5t84 -239.5z " /> +<glyph unicode="" horiz-adv-x="1664" d="M1527 88q56 -89 21.5 -152.5t-140.5 -63.5h-1152q-106 0 -140.5 63.5t21.5 152.5l503 793v399h-64q-26 0 -45 19t-19 45t19 45t45 19h512q26 0 45 -19t19 -45t-19 -45t-45 -19h-64v-399zM748 813l-272 -429h712l-272 429l-20 31v37v399h-128v-399v-37z" /> +<glyph unicode="" horiz-adv-x="1792" d="M960 640q26 0 45 -19t19 -45t-19 -45t-45 -19t-45 19t-19 45t19 45t45 19zM1260 576l507 -398q28 -20 25 -56q-5 -35 -35 -51l-128 -64q-13 -7 -29 -7q-17 0 -31 8l-690 387l-110 -66q-8 -4 -12 -5q14 -49 10 -97q-7 -77 -56 -147.5t-132 -123.5q-132 -84 -277 -84 q-136 0 -222 78q-90 84 -79 207q7 76 56 147t131 124q132 84 278 84q83 0 151 -31q9 13 22 22l122 73l-122 73q-13 9 -22 22q-68 -31 -151 -31q-146 0 -278 84q-82 53 -131 124t-56 147q-5 59 15.5 113t63.5 93q85 79 222 79q145 0 277 -84q83 -52 132 -123t56 -148 q4 -48 -10 -97q4 -1 12 -5l110 -66l690 387q14 8 31 8q16 0 29 -7l128 -64q30 -16 35 -51q3 -36 -25 -56zM579 836q46 42 21 108t-106 117q-92 59 -192 59q-74 0 -113 -36q-46 -42 -21 -108t106 -117q92 -59 192 -59q74 0 113 36zM494 91q81 51 106 117t-21 108 q-39 36 -113 36q-100 0 -192 -59q-81 -51 -106 -117t21 -108q39 -36 113 -36q100 0 192 59zM672 704l96 -58v11q0 36 33 56l14 8l-79 47l-26 -26q-3 -3 -10 -11t-12 -12q-2 -2 -4 -3.5t-3 -2.5zM896 480l96 -32l736 576l-128 64l-768 -431v-113l-160 -96l9 -8q2 -2 7 -6 q4 -4 11 -12t11 -12l26 -26zM1600 64l128 64l-520 408l-177 -138q-2 -3 -13 -7z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1696 1152q40 0 68 -28t28 -68v-1216q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v288h-544q-40 0 -68 28t-28 68v672q0 40 20 88t48 76l408 408q28 28 76 48t88 20h416q40 0 68 -28t28 -68v-328q68 40 128 40h416zM1152 939l-299 -299h299v299zM512 1323l-299 -299 h299v299zM708 676l316 316v416h-384v-416q0 -40 -28 -68t-68 -28h-416v-640h512v256q0 40 20 88t48 76zM1664 -128v1152h-384v-416q0 -40 -28 -68t-68 -28h-416v-640h896z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1404 151q0 -117 -79 -196t-196 -79q-135 0 -235 100l-777 776q-113 115 -113 271q0 159 110 270t269 111q158 0 273 -113l605 -606q10 -10 10 -22q0 -16 -30.5 -46.5t-46.5 -30.5q-13 0 -23 10l-606 607q-79 77 -181 77q-106 0 -179 -75t-73 -181q0 -105 76 -181 l776 -777q63 -63 145 -63q64 0 106 42t42 106q0 82 -63 145l-581 581q-26 24 -60 24q-29 0 -48 -19t-19 -48q0 -32 25 -59l410 -410q10 -10 10 -22q0 -16 -31 -47t-47 -31q-12 0 -22 10l-410 410q-63 61 -63 149q0 82 57 139t139 57q88 0 149 -63l581 -581q100 -98 100 -235 z" /> +<glyph unicode="" d="M384 0h768v384h-768v-384zM1280 0h128v896q0 14 -10 38.5t-20 34.5l-281 281q-10 10 -34 20t-39 10v-416q0 -40 -28 -68t-68 -28h-576q-40 0 -68 28t-28 68v416h-128v-1280h128v416q0 40 28 68t68 28h832q40 0 68 -28t28 -68v-416zM896 928v320q0 13 -9.5 22.5t-22.5 9.5 h-192q-13 0 -22.5 -9.5t-9.5 -22.5v-320q0 -13 9.5 -22.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 22.5zM1536 896v-928q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h928q40 0 88 -20t76 -48l280 -280q28 -28 48 -76t20 -88z" /> +<glyph unicode="" d="M1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1536 192v-128q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1536 704v-128q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1536 1216v-128q0 -26 -19 -45 t-45 -19h-1408q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 128q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM384 640q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1792 224v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5 t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5zM384 1152q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1792 736v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5z M1792 1248v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M381 -84q0 -80 -54.5 -126t-135.5 -46q-106 0 -172 66l57 88q49 -45 106 -45q29 0 50.5 14.5t21.5 42.5q0 64 -105 56l-26 56q8 10 32.5 43.5t42.5 54t37 38.5v1q-16 0 -48.5 -1t-48.5 -1v-53h-106v152h333v-88l-95 -115q51 -12 81 -49t30 -88zM383 543v-159h-362 q-6 36 -6 54q0 51 23.5 93t56.5 68t66 47.5t56.5 43.5t23.5 45q0 25 -14.5 38.5t-39.5 13.5q-46 0 -81 -58l-85 59q24 51 71.5 79.5t105.5 28.5q73 0 123 -41.5t50 -112.5q0 -50 -34 -91.5t-75 -64.5t-75.5 -50.5t-35.5 -52.5h127v60h105zM1792 224v-192q0 -13 -9.5 -22.5 t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 14 9 23t23 9h1216q13 0 22.5 -9.5t9.5 -22.5zM384 1123v-99h-335v99h107q0 41 0.5 122t0.5 121v12h-2q-8 -17 -50 -54l-71 76l136 127h106v-404h108zM1792 736v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5 t-9.5 22.5v192q0 14 9 23t23 9h1216q13 0 22.5 -9.5t9.5 -22.5zM1792 1248v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1216q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1216q13 0 22.5 -9.5t9.5 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1760 640q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1728q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h1728zM483 704q-28 35 -51 80q-48 97 -48 188q0 181 134 309q133 127 393 127q50 0 167 -19q66 -12 177 -48q10 -38 21 -118q14 -123 14 -183q0 -18 -5 -45l-12 -3l-84 6 l-14 2q-50 149 -103 205q-88 91 -210 91q-114 0 -182 -59q-67 -58 -67 -146q0 -73 66 -140t279 -129q69 -20 173 -66q58 -28 95 -52h-743zM990 448h411q7 -39 7 -92q0 -111 -41 -212q-23 -55 -71 -104q-37 -35 -109 -81q-80 -48 -153 -66q-80 -21 -203 -21q-114 0 -195 23 l-140 40q-57 16 -72 28q-8 8 -8 22v13q0 108 -2 156q-1 30 0 68l2 37v44l102 2q15 -34 30 -71t22.5 -56t12.5 -27q35 -57 80 -94q43 -36 105 -57q59 -22 132 -22q64 0 139 27q77 26 122 86q47 61 47 129q0 84 -81 157q-34 29 -137 71z" /> +<glyph unicode="" d="M48 1313q-37 2 -45 4l-3 88q13 1 40 1q60 0 112 -4q132 -7 166 -7q86 0 168 3q116 4 146 5q56 0 86 2l-1 -14l2 -64v-9q-60 -9 -124 -9q-60 0 -79 -25q-13 -14 -13 -132q0 -13 0.5 -32.5t0.5 -25.5l1 -229l14 -280q6 -124 51 -202q35 -59 96 -92q88 -47 177 -47 q104 0 191 28q56 18 99 51q48 36 65 64q36 56 53 114q21 73 21 229q0 79 -3.5 128t-11 122.5t-13.5 159.5l-4 59q-5 67 -24 88q-34 35 -77 34l-100 -2l-14 3l2 86h84l205 -10q76 -3 196 10l18 -2q6 -38 6 -51q0 -7 -4 -31q-45 -12 -84 -13q-73 -11 -79 -17q-15 -15 -15 -41 q0 -7 1.5 -27t1.5 -31q8 -19 22 -396q6 -195 -15 -304q-15 -76 -41 -122q-38 -65 -112 -123q-75 -57 -182 -89q-109 -33 -255 -33q-167 0 -284 46q-119 47 -179 122q-61 76 -83 195q-16 80 -16 237v333q0 188 -17 213q-25 36 -147 39zM1536 -96v64q0 14 -9 23t-23 9h-1472 q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h1472q14 0 23 9t9 23z" /> +<glyph unicode="" horiz-adv-x="1664" d="M512 160v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM512 544v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1024 160v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23 v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM512 928v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1024 544v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1536 160v192 q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1024 928v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1536 544v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192 q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1536 928v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM1664 1248v-1088q0 -66 -47 -113t-113 -47h-1344q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1344q66 0 113 -47t47 -113 z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1190 955l293 293l-107 107l-293 -293zM1637 1248q0 -27 -18 -45l-1286 -1286q-18 -18 -45 -18t-45 18l-198 198q-18 18 -18 45t18 45l1286 1286q18 18 45 18t45 -18l198 -198q18 -18 18 -45zM286 1438l98 -30l-98 -30l-30 -98l-30 98l-98 30l98 30l30 98zM636 1276 l196 -60l-196 -60l-60 -196l-60 196l-196 60l196 60l60 196zM1566 798l98 -30l-98 -30l-30 -98l-30 98l-98 30l98 30l30 98zM926 1438l98 -30l-98 -30l-30 -98l-30 98l-98 30l98 30l30 98z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 128q0 52 -38 90t-90 38t-90 -38t-38 -90t38 -90t90 -38t90 38t38 90zM256 640h384v256h-158q-13 0 -22 -9l-195 -195q-9 -9 -9 -22v-30zM1536 128q0 52 -38 90t-90 38t-90 -38t-38 -90t38 -90t90 -38t90 38t38 90zM1792 1216v-1024q0 -15 -4 -26.5t-13.5 -18.5 t-16.5 -11.5t-23.5 -6t-22.5 -2t-25.5 0t-22.5 0.5q0 -106 -75 -181t-181 -75t-181 75t-75 181h-384q0 -106 -75 -181t-181 -75t-181 75t-75 181h-64q-3 0 -22.5 -0.5t-25.5 0t-22.5 2t-23.5 6t-16.5 11.5t-13.5 18.5t-4 26.5q0 26 19 45t45 19v320q0 8 -0.5 35t0 38 t2.5 34.5t6.5 37t14 30.5t22.5 30l198 198q19 19 50.5 32t58.5 13h160v192q0 26 19 45t45 19h1024q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103q-111 0 -218 32q59 93 78 164q9 34 54 211q20 -39 73 -67.5t114 -28.5q121 0 216 68.5t147 188.5t52 270q0 114 -59.5 214t-172.5 163t-255 63q-105 0 -196 -29t-154.5 -77t-109 -110.5t-67 -129.5t-21.5 -134 q0 -104 40 -183t117 -111q30 -12 38 20q2 7 8 31t8 30q6 23 -11 43q-51 61 -51 151q0 151 104.5 259.5t273.5 108.5q151 0 235.5 -82t84.5 -213q0 -170 -68.5 -289t-175.5 -119q-61 0 -98 43.5t-23 104.5q8 35 26.5 93.5t30 103t11.5 75.5q0 50 -27 83t-77 33 q-62 0 -105 -57t-43 -142q0 -73 25 -122l-99 -418q-17 -70 -13 -177q-206 91 -333 281t-127 423q0 209 103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-725q85 122 108 210q9 34 53 209q21 -39 73.5 -67t112.5 -28q181 0 295.5 147.5t114.5 373.5q0 84 -35 162.5t-96.5 139t-152.5 97t-197 36.5q-104 0 -194.5 -28.5t-153 -76.5 t-107.5 -109.5t-66.5 -128t-21.5 -132.5q0 -102 39.5 -180t116.5 -110q13 -5 23.5 0t14.5 19q10 44 15 61q6 23 -11 42q-50 62 -50 150q0 150 103.5 256.5t270.5 106.5q149 0 232.5 -81t83.5 -210q0 -168 -67.5 -286t-173.5 -118q-60 0 -97 43.5t-23 103.5q8 34 26.5 92.5 t29.5 102t11 74.5q0 49 -26.5 81.5t-75.5 32.5q-61 0 -103.5 -56.5t-42.5 -139.5q0 -72 24 -121l-98 -414q-24 -100 -7 -254h-183q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960z" /> +<glyph unicode="" d="M917 631q0 26 -6 64h-362v-132h217q-3 -24 -16.5 -50t-37.5 -53t-66.5 -44.5t-96.5 -17.5q-99 0 -169 71t-70 171t70 171t169 71q92 0 153 -59l104 101q-108 100 -257 100q-160 0 -272 -112.5t-112 -271.5t112 -271.5t272 -112.5q165 0 266.5 105t101.5 270zM1262 585 h109v110h-109v110h-110v-110h-110v-110h110v-110h110v110zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1437 623q0 -208 -87 -370.5t-248 -254t-369 -91.5q-149 0 -285 58t-234 156t-156 234t-58 285t58 285t156 234t234 156t285 58q286 0 491 -192l-199 -191q-117 113 -292 113q-123 0 -227.5 -62t-165.5 -168.5t-61 -232.5t61 -232.5t165.5 -168.5t227.5 -62 q83 0 152.5 23t114.5 57.5t78.5 78.5t49 83t21.5 74h-416v252h692q12 -63 12 -122zM2304 745v-210h-209v-209h-210v209h-209v210h209v209h210v-209h209z" /> +<glyph unicode="" horiz-adv-x="1920" d="M768 384h384v96h-128v448h-114l-148 -137l77 -80q42 37 55 57h2v-288h-128v-96zM1280 640q0 -70 -21 -142t-59.5 -134t-101.5 -101t-138 -39t-138 39t-101.5 101t-59.5 134t-21 142t21 142t59.5 134t101.5 101t138 39t138 -39t101.5 -101t59.5 -134t21 -142zM1792 384 v512q-106 0 -181 75t-75 181h-1152q0 -106 -75 -181t-181 -75v-512q106 0 181 -75t75 -181h1152q0 106 75 181t181 75zM1920 1216v-1152q0 -26 -19 -45t-45 -19h-1792q-26 0 -45 19t-19 45v1152q0 26 19 45t45 19h1792q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 832q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19l-448 448q-19 19 -19 45t19 45t45 19h896q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 320q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45l448 448q19 19 45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="640" d="M640 1088v-896q0 -26 -19 -45t-45 -19t-45 19l-448 448q-19 19 -19 45t19 45l448 448q19 19 45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="640" d="M576 640q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19t-19 45v896q0 26 19 45t45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M160 0h608v1152h-640v-1120q0 -13 9.5 -22.5t22.5 -9.5zM1536 32v1120h-640v-1152h608q13 0 22.5 9.5t9.5 22.5zM1664 1248v-1216q0 -66 -47 -113t-113 -47h-1344q-66 0 -113 47t-47 113v1216q0 66 47 113t113 47h1344q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 448q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19l-448 448q-19 19 -19 45t19 45t45 19h896q26 0 45 -19t19 -45zM1024 832q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45l448 448q19 19 45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 448q0 -26 -19 -45l-448 -448q-19 -19 -45 -19t-45 19l-448 448q-19 19 -19 45t19 45t45 19h896q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 832q0 -26 -19 -45t-45 -19h-896q-26 0 -45 19t-19 45t19 45l448 448q19 19 45 19t45 -19l448 -448q19 -19 19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 826v-794q0 -66 -47 -113t-113 -47h-1472q-66 0 -113 47t-47 113v794q44 -49 101 -87q362 -246 497 -345q57 -42 92.5 -65.5t94.5 -48t110 -24.5h1h1q51 0 110 24.5t94.5 48t92.5 65.5q170 123 498 345q57 39 100 87zM1792 1120q0 -79 -49 -151t-122 -123 q-376 -261 -468 -325q-10 -7 -42.5 -30.5t-54 -38t-52 -32.5t-57.5 -27t-50 -9h-1h-1q-23 0 -50 9t-57.5 27t-52 32.5t-54 38t-42.5 30.5q-91 64 -262 182.5t-205 142.5q-62 42 -117 115.5t-55 136.5q0 78 41.5 130t118.5 52h1472q65 0 112.5 -47t47.5 -113z" /> +<glyph unicode="" d="M349 911v-991h-330v991h330zM370 1217q1 -73 -50.5 -122t-135.5 -49h-2q-82 0 -132 49t-50 122q0 74 51.5 122.5t134.5 48.5t133 -48.5t51 -122.5zM1536 488v-568h-329v530q0 105 -40.5 164.5t-126.5 59.5q-63 0 -105.5 -34.5t-63.5 -85.5q-11 -30 -11 -81v-553h-329 q2 399 2 647t-1 296l-1 48h329v-144h-2q20 32 41 56t56.5 52t87 43.5t114.5 15.5q171 0 275 -113.5t104 -332.5z" /> +<glyph unicode="" d="M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61q-172 0 -327 72.5t-264 204.5q-7 10 -6.5 22.5t8.5 20.5l137 138q10 9 25 9q16 -2 23 -12q73 -95 179 -147t225 -52q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5t-40.5 198.5t-109.5 163.5 t-163.5 109.5t-198.5 40.5q-98 0 -188 -35.5t-160 -101.5l137 -138q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l130 -129q107 101 244.5 156.5t284.5 55.5q156 0 298 -61t245 -164t164 -245t61 -298z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1771 0q0 -53 -37 -90l-107 -108q-39 -37 -91 -37q-53 0 -90 37l-363 364q-38 36 -38 90q0 53 43 96l-256 256l-126 -126q-14 -14 -34 -14t-34 14q2 -2 12.5 -12t12.5 -13t10 -11.5t10 -13.5t6 -13.5t5.5 -16.5t1.5 -18q0 -38 -28 -68q-3 -3 -16.5 -18t-19 -20.5 t-18.5 -16.5t-22 -15.5t-22 -9t-26 -4.5q-40 0 -68 28l-408 408q-28 28 -28 68q0 13 4.5 26t9 22t15.5 22t16.5 18.5t20.5 19t18 16.5q30 28 68 28q10 0 18 -1.5t16.5 -5.5t13.5 -6t13.5 -10t11.5 -10t13 -12.5t12 -12.5q-14 14 -14 34t14 34l348 348q14 14 34 14t34 -14 q-2 2 -12.5 12t-12.5 13t-10 11.5t-10 13.5t-6 13.5t-5.5 16.5t-1.5 18q0 38 28 68q3 3 16.5 18t19 20.5t18.5 16.5t22 15.5t22 9t26 4.5q40 0 68 -28l408 -408q28 -28 28 -68q0 -13 -4.5 -26t-9 -22t-15.5 -22t-16.5 -18.5t-20.5 -19t-18 -16.5q-30 -28 -68 -28 q-10 0 -18 1.5t-16.5 5.5t-13.5 6t-13.5 10t-11.5 10t-13 12.5t-12 12.5q14 -14 14 -34t-14 -34l-126 -126l256 -256q43 43 96 43q52 0 91 -37l363 -363q37 -39 37 -91z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM576 832q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1004 351l101 382q6 26 -7.5 48.5t-38.5 29.5 t-48 -6.5t-30 -39.5l-101 -382q-60 -5 -107 -43.5t-63 -98.5q-20 -77 20 -146t117 -89t146 20t89 117q16 60 -6 117t-72 91zM1664 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1024 1024q0 53 -37.5 90.5 t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1472 832q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1792 384q0 -261 -141 -483q-19 -29 -54 -29h-1402q-35 0 -54 29 q-141 221 -141 483q0 182 71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1152q-204 0 -381.5 -69.5t-282 -187.5t-104.5 -255q0 -112 71.5 -213.5t201.5 -175.5l87 -50l-27 -96q-24 -91 -70 -172q152 63 275 171l43 38l57 -6q69 -8 130 -8q204 0 381.5 69.5t282 187.5t104.5 255t-104.5 255t-282 187.5t-381.5 69.5zM1792 640 q0 -174 -120 -321.5t-326 -233t-450 -85.5q-70 0 -145 8q-198 -175 -460 -242q-49 -14 -114 -22h-5q-15 0 -27 10.5t-16 27.5v1q-3 4 -0.5 12t2 10t4.5 9.5l6 9t7 8.5t8 9q7 8 31 34.5t34.5 38t31 39.5t32.5 51t27 59t26 76q-157 89 -247.5 220t-90.5 281q0 174 120 321.5 t326 233t450 85.5t450 -85.5t326 -233t120 -321.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M704 1152q-153 0 -286 -52t-211.5 -141t-78.5 -191q0 -82 53 -158t149 -132l97 -56l-35 -84q34 20 62 39l44 31l53 -10q78 -14 153 -14q153 0 286 52t211.5 141t78.5 191t-78.5 191t-211.5 141t-286 52zM704 1280q191 0 353.5 -68.5t256.5 -186.5t94 -257t-94 -257 t-256.5 -186.5t-353.5 -68.5q-86 0 -176 16q-124 -88 -278 -128q-36 -9 -86 -16h-3q-11 0 -20.5 8t-11.5 21q-1 3 -1 6.5t0.5 6.5t2 6l2.5 5t3.5 5.5t4 5t4.5 5t4 4.5q5 6 23 25t26 29.5t22.5 29t25 38.5t20.5 44q-124 72 -195 177t-71 224q0 139 94 257t256.5 186.5 t353.5 68.5zM1526 111q10 -24 20.5 -44t25 -38.5t22.5 -29t26 -29.5t23 -25q1 -1 4 -4.5t4.5 -5t4 -5t3.5 -5.5l2.5 -5t2 -6t0.5 -6.5t-1 -6.5q-3 -14 -13 -22t-22 -7q-50 7 -86 16q-154 40 -278 128q-90 -16 -176 -16q-271 0 -472 132q58 -4 88 -4q161 0 309 45t264 129 q125 92 192 212t67 254q0 77 -23 152q129 -71 204 -178t75 -230q0 -120 -71 -224.5t-195 -176.5z" /> +<glyph unicode="" horiz-adv-x="896" d="M885 970q18 -20 7 -44l-540 -1157q-13 -25 -42 -25q-4 0 -14 2q-17 5 -25.5 19t-4.5 30l197 808l-406 -101q-4 -1 -12 -1q-18 0 -31 11q-18 15 -13 39l201 825q4 14 16 23t28 9h328q19 0 32 -12.5t13 -29.5q0 -8 -5 -18l-171 -463l396 98q8 2 12 2q19 0 34 -15z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 288v-320q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h96v192h-512v-192h96q40 0 68 -28t28 -68v-320q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h96v192h-512v-192h96q40 0 68 -28t28 -68v-320 q0 -40 -28 -68t-68 -28h-320q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h96v192q0 52 38 90t90 38h512v192h-96q-40 0 -68 28t-28 68v320q0 40 28 68t68 28h320q40 0 68 -28t28 -68v-320q0 -40 -28 -68t-68 -28h-96v-192h512q52 0 90 -38t38 -90v-192h96q40 0 68 -28t28 -68 z" /> +<glyph unicode="" horiz-adv-x="1664" d="M896 708v-580q0 -104 -76 -180t-180 -76t-180 76t-76 180q0 26 19 45t45 19t45 -19t19 -45q0 -50 39 -89t89 -39t89 39t39 89v580q33 11 64 11t64 -11zM1664 681q0 -13 -9.5 -22.5t-22.5 -9.5q-11 0 -23 10q-49 46 -93 69t-102 23q-68 0 -128 -37t-103 -97 q-7 -10 -17.5 -28t-14.5 -24q-11 -17 -28 -17q-18 0 -29 17q-4 6 -14.5 24t-17.5 28q-43 60 -102.5 97t-127.5 37t-127.5 -37t-102.5 -97q-7 -10 -17.5 -28t-14.5 -24q-11 -17 -29 -17q-17 0 -28 17q-4 6 -14.5 24t-17.5 28q-43 60 -103 97t-128 37q-58 0 -102 -23t-93 -69 q-12 -10 -23 -10q-13 0 -22.5 9.5t-9.5 22.5q0 5 1 7q45 183 172.5 319.5t298 204.5t360.5 68q140 0 274.5 -40t246.5 -113.5t194.5 -187t115.5 -251.5q1 -2 1 -7zM896 1408v-98q-42 2 -64 2t-64 -2v98q0 26 19 45t45 19t45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M768 -128h896v640h-416q-40 0 -68 28t-28 68v416h-384v-1152zM1024 1312v64q0 13 -9.5 22.5t-22.5 9.5h-704q-13 0 -22.5 -9.5t-9.5 -22.5v-64q0 -13 9.5 -22.5t22.5 -9.5h704q13 0 22.5 9.5t9.5 22.5zM1280 640h299l-299 299v-299zM1792 512v-672q0 -40 -28 -68t-68 -28 h-960q-40 0 -68 28t-28 68v160h-544q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h1088q40 0 68 -28t28 -68v-328q21 -13 36 -28l408 -408q28 -28 48 -76t20 -88z" /> +<glyph unicode="" horiz-adv-x="1024" d="M736 960q0 -13 -9.5 -22.5t-22.5 -9.5t-22.5 9.5t-9.5 22.5q0 46 -54 71t-106 25q-13 0 -22.5 9.5t-9.5 22.5t9.5 22.5t22.5 9.5q50 0 99.5 -16t87 -54t37.5 -90zM896 960q0 72 -34.5 134t-90 101.5t-123 62t-136.5 22.5t-136.5 -22.5t-123 -62t-90 -101.5t-34.5 -134 q0 -101 68 -180q10 -11 30.5 -33t30.5 -33q128 -153 141 -298h228q13 145 141 298q10 11 30.5 33t30.5 33q68 79 68 180zM1024 960q0 -155 -103 -268q-45 -49 -74.5 -87t-59.5 -95.5t-34 -107.5q47 -28 47 -82q0 -37 -25 -64q25 -27 25 -64q0 -52 -45 -81q13 -23 13 -47 q0 -46 -31.5 -71t-77.5 -25q-20 -44 -60 -70t-87 -26t-87 26t-60 70q-46 0 -77.5 25t-31.5 71q0 24 13 47q-45 29 -45 81q0 37 25 64q-25 27 -25 64q0 54 47 82q-4 50 -34 107.5t-59.5 95.5t-74.5 87q-103 113 -103 268q0 99 44.5 184.5t117 142t164 89t186.5 32.5 t186.5 -32.5t164 -89t117 -142t44.5 -184.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 352v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-1376v-192q0 -13 -9.5 -22.5t-22.5 -9.5q-12 0 -24 10l-319 320q-9 9 -9 22q0 14 9 23l320 320q9 9 23 9q13 0 22.5 -9.5t9.5 -22.5v-192h1376q13 0 22.5 -9.5t9.5 -22.5zM1792 896q0 -14 -9 -23l-320 -320q-9 -9 -23 -9 q-13 0 -22.5 9.5t-9.5 22.5v192h-1376q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h1376v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1280 608q0 14 -9 23t-23 9h-224v352q0 13 -9.5 22.5t-22.5 9.5h-192q-13 0 -22.5 -9.5t-9.5 -22.5v-352h-224q-13 0 -22.5 -9.5t-9.5 -22.5q0 -14 9 -23l352 -352q9 -9 23 -9t23 9l351 351q10 12 10 24zM1920 384q0 -159 -112.5 -271.5t-271.5 -112.5h-1088 q-185 0 -316.5 131.5t-131.5 316.5q0 130 70 240t188 165q-2 30 -2 43q0 212 150 362t362 150q156 0 285.5 -87t188.5 -231q71 62 166 62q106 0 181 -75t75 -181q0 -76 -41 -138q130 -31 213.5 -135.5t83.5 -238.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1280 672q0 14 -9 23l-352 352q-9 9 -23 9t-23 -9l-351 -351q-10 -12 -10 -24q0 -14 9 -23t23 -9h224v-352q0 -13 9.5 -22.5t22.5 -9.5h192q13 0 22.5 9.5t9.5 22.5v352h224q13 0 22.5 9.5t9.5 22.5zM1920 384q0 -159 -112.5 -271.5t-271.5 -112.5h-1088 q-185 0 -316.5 131.5t-131.5 316.5q0 130 70 240t188 165q-2 30 -2 43q0 212 150 362t362 150q156 0 285.5 -87t188.5 -231q71 62 166 62q106 0 181 -75t75 -181q0 -76 -41 -138q130 -31 213.5 -135.5t83.5 -238.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 192q0 -26 -19 -45t-45 -19t-45 19t-19 45t19 45t45 19t45 -19t19 -45zM1408 131q0 -121 -73 -190t-194 -69h-874q-121 0 -194 69t-73 190q0 68 5.5 131t24 138t47.5 132.5t81 103t120 60.5q-22 -52 -22 -120v-203q-58 -20 -93 -70t-35 -111q0 -80 56 -136t136 -56 t136 56t56 136q0 61 -35.5 111t-92.5 70v203q0 62 25 93q132 -104 295 -104t295 104q25 -31 25 -93v-64q-106 0 -181 -75t-75 -181v-89q-32 -29 -32 -71q0 -40 28 -68t68 -28t68 28t28 68q0 42 -32 71v89q0 52 38 90t90 38t90 -38t38 -90v-89q-32 -29 -32 -71q0 -40 28 -68 t68 -28t68 28t28 68q0 42 -32 71v89q0 68 -34.5 127.5t-93.5 93.5q0 10 0.5 42.5t0 48t-2.5 41.5t-7 47t-13 40q68 -15 120 -60.5t81 -103t47.5 -132.5t24 -138t5.5 -131zM1088 1024q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5 t271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1280 832q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 832q0 -62 -35.5 -111t-92.5 -70v-395q0 -159 -131.5 -271.5t-316.5 -112.5t-316.5 112.5t-131.5 271.5v132q-164 20 -274 128t-110 252v512q0 26 19 45t45 19q6 0 16 -2q17 30 47 48 t65 18q53 0 90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5q-33 0 -64 18v-402q0 -106 94 -181t226 -75t226 75t94 181v402q-31 -18 -64 -18q-53 0 -90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5q35 0 65 -18t47 -48q10 2 16 2q26 0 45 -19t19 -45v-512q0 -144 -110 -252 t-274 -128v-132q0 -106 94 -181t226 -75t226 75t94 181v395q-57 21 -92.5 70t-35.5 111q0 80 56 136t136 56t136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 1152h512v128h-512v-128zM288 1152v-1280h-64q-92 0 -158 66t-66 158v832q0 92 66 158t158 66h64zM1408 1152v-1280h-1024v1280h128v160q0 40 28 68t68 28h576q40 0 68 -28t28 -68v-160h128zM1792 928v-832q0 -92 -66 -158t-158 -66h-64v1280h64q92 0 158 -66 t66 -158z" /> +<glyph unicode="" horiz-adv-x="1792" d="M912 -160q0 16 -16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5q16 0 16 16zM1728 128q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-181 75t-75 181h-448q-52 0 -90 38t-38 90q50 42 91 88t85 119.5t74.5 158.5 t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q190 -28 307 -158.5t117 -282.5q0 -139 19.5 -260t50 -206t74.5 -158.5t85 -119.5t91 -88z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1664 896q0 80 -56 136t-136 56h-64v-384h64q80 0 136 56t56 136zM0 128h1792q0 -106 -75 -181t-181 -75h-1280q-106 0 -181 75t-75 181zM1856 896q0 -159 -112.5 -271.5t-271.5 -112.5h-64v-32q0 -92 -66 -158t-158 -66h-704q-92 0 -158 66t-66 158v736q0 26 19 45 t45 19h1152q159 0 271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M640 1472v-640q0 -61 -35.5 -111t-92.5 -70v-779q0 -52 -38 -90t-90 -38h-128q-52 0 -90 38t-38 90v779q-57 20 -92.5 70t-35.5 111v640q0 26 19 45t45 19t45 -19t19 -45v-416q0 -26 19 -45t45 -19t45 19t19 45v416q0 26 19 45t45 19t45 -19t19 -45v-416q0 -26 19 -45 t45 -19t45 19t19 45v416q0 26 19 45t45 19t45 -19t19 -45zM1408 1472v-1600q0 -52 -38 -90t-90 -38h-128q-52 0 -90 38t-38 90v512h-224q-13 0 -22.5 9.5t-9.5 22.5v800q0 132 94 226t226 94h256q26 0 45 -19t19 -45z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M384 736q0 14 9 23t23 9h704q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704q-14 0 -23 9t-9 23v64zM1120 512q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h704zM1120 256q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-704 q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h704z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 992v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 1248v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 -128h384v1536h-1152v-1536h384v224q0 13 9.5 22.5t22.5 9.5h320q13 0 22.5 -9.5t9.5 -22.5v-224zM1408 1472v-1664q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v1664q0 26 19 45t45 19h1280q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM384 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M1152 224v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM896 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M640 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 480v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5zM1152 736v-64q0 -13 -9.5 -22.5t-22.5 -9.5h-64q-13 0 -22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h64q13 0 22.5 -9.5t9.5 -22.5z M896 -128h384v1152h-256v-32q0 -40 -28 -68t-68 -28h-448q-40 0 -68 28t-28 68v32h-256v-1152h384v224q0 13 9.5 22.5t22.5 9.5h320q13 0 22.5 -9.5t9.5 -22.5v-224zM896 1056v320q0 13 -9.5 22.5t-22.5 9.5h-64q-13 0 -22.5 -9.5t-9.5 -22.5v-96h-128v96q0 13 -9.5 22.5 t-22.5 9.5h-64q-13 0 -22.5 -9.5t-9.5 -22.5v-320q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5v96h128v-96q0 -13 9.5 -22.5t22.5 -9.5h64q13 0 22.5 9.5t9.5 22.5zM1408 1088v-1280q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v1280q0 26 19 45t45 19h320 v288q0 40 28 68t68 28h448q40 0 68 -28t28 -68v-288h320q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1920" d="M640 128q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM256 640h384v256h-158q-14 -2 -22 -9l-195 -195q-7 -12 -9 -22v-30zM1536 128q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5 t90.5 37.5t37.5 90.5zM1664 800v192q0 14 -9 23t-23 9h-224v224q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-224h-224q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h224v-224q0 -14 9 -23t23 -9h192q14 0 23 9t9 23v224h224q14 0 23 9t9 23zM1920 1344v-1152 q0 -26 -19 -45t-45 -19h-192q0 -106 -75 -181t-181 -75t-181 75t-75 181h-384q0 -106 -75 -181t-181 -75t-181 75t-75 181h-128q-26 0 -45 19t-19 45t19 45t45 19v416q0 26 13 58t32 51l198 198q19 19 51 32t58 13h160v320q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 416v192q0 14 -9 23t-23 9h-224v224q0 14 -9 23t-23 9h-192q-14 0 -23 -9t-9 -23v-224h-224q-14 0 -23 -9t-9 -23v-192q0 -14 9 -23t23 -9h224v-224q0 -14 9 -23t23 -9h192q14 0 23 9t9 23v224h224q14 0 23 9t9 23zM640 1152h512v128h-512v-128zM256 1152v-1280h-32 q-92 0 -158 66t-66 158v832q0 92 66 158t158 66h32zM1440 1152v-1280h-1088v1280h160v160q0 40 28 68t68 28h576q40 0 68 -28t28 -68v-160h160zM1792 928v-832q0 -92 -66 -158t-158 -66h-32v1280h32q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1920 576q-1 -32 -288 -96l-352 -32l-224 -64h-64l-293 -352h69q26 0 45 -4.5t19 -11.5t-19 -11.5t-45 -4.5h-96h-160h-64v32h64v416h-160l-192 -224h-96l-32 32v192h32v32h128v8l-192 24v128l192 24v8h-128v32h-32v192l32 32h96l192 -224h160v416h-64v32h64h160h96 q26 0 45 -4.5t19 -11.5t-19 -11.5t-45 -4.5h-69l293 -352h64l224 -64l352 -32q261 -58 287 -93z" /> +<glyph unicode="" horiz-adv-x="1664" d="M640 640v384h-256v-256q0 -53 37.5 -90.5t90.5 -37.5h128zM1664 192v-192h-1152v192l128 192h-128q-159 0 -271.5 112.5t-112.5 271.5v320l-64 64l32 128h480l32 128h960l32 -192l-64 -32v-800z" /> +<glyph unicode="" d="M1280 192v896q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-320h-512v320q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-896q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v320h512v-320q0 -26 19 -45t45 -19h128q26 0 45 19t19 45zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1280 576v128q0 26 -19 45t-45 19h-320v320q0 26 -19 45t-45 19h-128q-26 0 -45 -19t-19 -45v-320h-320q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h320v-320q0 -26 19 -45t45 -19h128q26 0 45 19t19 45v320h320q26 0 45 19t19 45zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M627 160q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23t-10 -23l-393 -393l393 -393q10 -10 10 -23zM1011 160q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23 t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23t-10 -23l-393 -393l393 -393q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1024" d="M595 576q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23zM979 576q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23 l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 224q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-393 393l-393 -393q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l466 -466q10 -10 10 -23zM1075 608q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-393 393l-393 -393 q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 672q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l393 -393l393 393q10 10 23 10t23 -10l50 -50q10 -10 10 -23zM1075 1056q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23 t10 23l50 50q10 10 23 10t23 -10l393 -393l393 393q10 10 23 10t23 -10l50 -50q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="640" d="M627 992q0 -13 -10 -23l-393 -393l393 -393q10 -10 10 -23t-10 -23l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="640" d="M595 576q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 352q0 -13 -10 -23l-50 -50q-10 -10 -23 -10t-23 10l-393 393l-393 -393q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l466 -466q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1075 800q0 -13 -10 -23l-466 -466q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l393 -393l393 393q10 10 23 10t23 -10l50 -50q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1792 544v832q0 13 -9.5 22.5t-22.5 9.5h-1600q-13 0 -22.5 -9.5t-9.5 -22.5v-832q0 -13 9.5 -22.5t22.5 -9.5h1600q13 0 22.5 9.5t9.5 22.5zM1920 1376v-1088q0 -66 -47 -113t-113 -47h-544q0 -37 16 -77.5t32 -71t16 -43.5q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19 t-19 45q0 14 16 44t32 70t16 78h-544q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1920" d="M416 256q-66 0 -113 47t-47 113v704q0 66 47 113t113 47h1088q66 0 113 -47t47 -113v-704q0 -66 -47 -113t-113 -47h-1088zM384 1120v-704q0 -13 9.5 -22.5t22.5 -9.5h1088q13 0 22.5 9.5t9.5 22.5v704q0 13 -9.5 22.5t-22.5 9.5h-1088q-13 0 -22.5 -9.5t-9.5 -22.5z M1760 192h160v-96q0 -40 -47 -68t-113 -28h-1600q-66 0 -113 28t-47 68v96h160h1600zM1040 96q16 0 16 16t-16 16h-160q-16 0 -16 -16t16 -16h160z" /> +<glyph unicode="" horiz-adv-x="1152" d="M640 128q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1024 288v960q0 13 -9.5 22.5t-22.5 9.5h-832q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h832q13 0 22.5 9.5t9.5 22.5zM1152 1248v-1088q0 -66 -47 -113t-113 -47h-832 q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h832q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="768" d="M464 128q0 33 -23.5 56.5t-56.5 23.5t-56.5 -23.5t-23.5 -56.5t23.5 -56.5t56.5 -23.5t56.5 23.5t23.5 56.5zM672 288v704q0 13 -9.5 22.5t-22.5 9.5h-512q-13 0 -22.5 -9.5t-9.5 -22.5v-704q0 -13 9.5 -22.5t22.5 -9.5h512q13 0 22.5 9.5t9.5 22.5zM480 1136 q0 16 -16 16h-160q-16 0 -16 -16t16 -16h160q16 0 16 16zM768 1152v-1024q0 -52 -38 -90t-90 -38h-512q-52 0 -90 38t-38 90v1024q0 52 38 90t90 38h512q52 0 90 -38t38 -90z" /> +<glyph unicode="" d="M768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103 t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 576v-384q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v704q0 104 40.5 198.5t109.5 163.5t163.5 109.5t198.5 40.5h64q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-64q-106 0 -181 -75t-75 -181v-32q0 -40 28 -68t68 -28h224q80 0 136 -56t56 -136z M1664 576v-384q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v704q0 104 40.5 198.5t109.5 163.5t163.5 109.5t198.5 40.5h64q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-64q-106 0 -181 -75t-75 -181v-32q0 -40 28 -68t68 -28h224q80 0 136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1664" d="M768 1216v-704q0 -104 -40.5 -198.5t-109.5 -163.5t-163.5 -109.5t-198.5 -40.5h-64q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h64q106 0 181 75t75 181v32q0 40 -28 68t-68 28h-224q-80 0 -136 56t-56 136v384q0 80 56 136t136 56h384q80 0 136 -56t56 -136zM1664 1216 v-704q0 -104 -40.5 -198.5t-109.5 -163.5t-163.5 -109.5t-198.5 -40.5h-64q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h64q106 0 181 75t75 181v32q0 40 -28 68t-68 28h-224q-80 0 -136 56t-56 136v384q0 80 56 136t136 56h384q80 0 136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1792" d="M526 142q0 -53 -37.5 -90.5t-90.5 -37.5q-52 0 -90 38t-38 90q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1024 -64q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM320 640q0 -53 -37.5 -90.5t-90.5 -37.5 t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1522 142q0 -52 -38 -90t-90 -38q-53 0 -90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM558 1138q0 -66 -47 -113t-113 -47t-113 47t-47 113t47 113t113 47t113 -47t47 -113z M1728 640q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1088 1344q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1618 1138q0 -93 -66 -158.5t-158 -65.5q-93 0 -158.5 65.5t-65.5 158.5 q0 92 65.5 158t158.5 66q92 0 158 -66t66 -158z" /> +<glyph unicode="" d="M1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 416q0 -166 -127 -451q-3 -7 -10.5 -24t-13.5 -30t-13 -22q-12 -17 -28 -17q-15 0 -23.5 10t-8.5 25q0 9 2.5 26.5t2.5 23.5q5 68 5 123q0 101 -17.5 181t-48.5 138.5t-80 101t-105.5 69.5t-133 42.5t-154 21.5t-175.5 6h-224v-256q0 -26 -19 -45t-45 -19t-45 19 l-512 512q-19 19 -19 45t19 45l512 512q19 19 45 19t45 -19t19 -45v-256h224q713 0 875 -403q53 -134 53 -333z" /> +<glyph unicode="" horiz-adv-x="1664" d="M640 320q0 -40 -12.5 -82t-43 -76t-72.5 -34t-72.5 34t-43 76t-12.5 82t12.5 82t43 76t72.5 34t72.5 -34t43 -76t12.5 -82zM1280 320q0 -40 -12.5 -82t-43 -76t-72.5 -34t-72.5 34t-43 76t-12.5 82t12.5 82t43 76t72.5 34t72.5 -34t43 -76t12.5 -82zM1440 320 q0 120 -69 204t-187 84q-41 0 -195 -21q-71 -11 -157 -11t-157 11q-152 21 -195 21q-118 0 -187 -84t-69 -204q0 -88 32 -153.5t81 -103t122 -60t140 -29.5t149 -7h168q82 0 149 7t140 29.5t122 60t81 103t32 153.5zM1664 496q0 -207 -61 -331q-38 -77 -105.5 -133t-141 -86 t-170 -47.5t-171.5 -22t-167 -4.5q-78 0 -142 3t-147.5 12.5t-152.5 30t-137 51.5t-121 81t-86 115q-62 123 -62 331q0 237 136 396q-27 82 -27 170q0 116 51 218q108 0 190 -39.5t189 -123.5q147 35 309 35q148 0 280 -32q105 82 187 121t189 39q51 -102 51 -218 q0 -87 -27 -168q136 -160 136 -398z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1536 224v704q0 40 -28 68t-68 28h-704q-40 0 -68 28t-28 68v64q0 40 -28 68t-68 28h-320q-40 0 -68 -28t-28 -68v-960q0 -40 28 -68t68 -28h1216q40 0 68 28t28 68zM1664 928v-704q0 -92 -66 -158t-158 -66h-1216q-92 0 -158 66t-66 158v960q0 92 66 158t158 66h320 q92 0 158 -66t66 -158v-32h672q92 0 158 -66t66 -158z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1781 605q0 35 -53 35h-1088q-40 0 -85.5 -21.5t-71.5 -52.5l-294 -363q-18 -24 -18 -40q0 -35 53 -35h1088q40 0 86 22t71 53l294 363q18 22 18 39zM640 768h768v160q0 40 -28 68t-68 28h-576q-40 0 -68 28t-28 68v64q0 40 -28 68t-68 28h-320q-40 0 -68 -28t-28 -68 v-853l256 315q44 53 116 87.5t140 34.5zM1909 605q0 -62 -46 -120l-295 -363q-43 -53 -116 -87.5t-140 -34.5h-1088q-92 0 -158 66t-66 158v960q0 92 66 158t158 66h320q92 0 158 -66t66 -158v-32h544q92 0 158 -66t66 -158v-160h192q54 0 99 -24.5t67 -70.5q15 -32 15 -68z " /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" d="M1134 461q-37 -121 -138 -195t-228 -74t-228 74t-138 195q-8 25 4 48.5t38 31.5q25 8 48.5 -4t31.5 -38q25 -80 92.5 -129.5t151.5 -49.5t151.5 49.5t92.5 129.5q8 26 32 38t49 4t37 -31.5t4 -48.5zM640 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5 t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1152 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5 t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1134 307q8 -25 -4 -48.5t-37 -31.5t-49 4t-32 38q-25 80 -92.5 129.5t-151.5 49.5t-151.5 -49.5t-92.5 -129.5q-8 -26 -31.5 -38t-48.5 -4q-26 8 -38 31.5t-4 48.5q37 121 138 195t228 74t228 -74t138 -195zM640 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5 t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1152 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204 t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1152 448q0 -26 -19 -45t-45 -19h-640q-26 0 -45 19t-19 45t19 45t45 19h640q26 0 45 -19t19 -45zM640 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1152 896q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5 t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M832 448v128q0 14 -9 23t-23 9h-192v192q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-192h-192q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h192v-192q0 -14 9 -23t23 -9h128q14 0 23 9t9 23v192h192q14 0 23 9t9 23zM1408 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1664 640q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1920 512q0 -212 -150 -362t-362 -150q-192 0 -338 128h-220q-146 -128 -338 -128q-212 0 -362 150 t-150 362t150 362t362 150h896q212 0 362 -150t150 -362z" /> +<glyph unicode="" horiz-adv-x="1920" d="M384 368v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM512 624v-96q0 -16 -16 -16h-224q-16 0 -16 16v96q0 16 16 16h224q16 0 16 -16zM384 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1408 368v-96q0 -16 -16 -16 h-864q-16 0 -16 16v96q0 16 16 16h864q16 0 16 -16zM768 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM640 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1024 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16 h96q16 0 16 -16zM896 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1280 624v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1664 368v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1152 880v-96 q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1408 880v-96q0 -16 -16 -16h-96q-16 0 -16 16v96q0 16 16 16h96q16 0 16 -16zM1664 880v-352q0 -16 -16 -16h-224q-16 0 -16 16v96q0 16 16 16h112v240q0 16 16 16h96q16 0 16 -16zM1792 128v896h-1664v-896 h1664zM1920 1024v-896q0 -53 -37.5 -90.5t-90.5 -37.5h-1664q-53 0 -90.5 37.5t-37.5 90.5v896q0 53 37.5 90.5t90.5 37.5h1664q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 491v616q-169 -91 -306 -91q-82 0 -145 32q-100 49 -184 76.5t-178 27.5q-173 0 -403 -127v-599q245 113 433 113q55 0 103.5 -7.5t98 -26t77 -31t82.5 -39.5l28 -14q44 -22 101 -22q120 0 293 92zM320 1280q0 -35 -17.5 -64t-46.5 -46v-1266q0 -14 -9 -23t-23 -9 h-64q-14 0 -23 9t-9 23v1266q-29 17 -46.5 46t-17.5 64q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1792 1216v-763q0 -39 -35 -57q-10 -5 -17 -9q-218 -116 -369 -116q-88 0 -158 35l-28 14q-64 33 -99 48t-91 29t-114 14q-102 0 -235.5 -44t-228.5 -102 q-15 -9 -33 -9q-16 0 -32 8q-32 19 -32 56v742q0 35 31 55q35 21 78.5 42.5t114 52t152.5 49.5t155 19q112 0 209 -31t209 -86q38 -19 89 -19q122 0 310 112q22 12 31 17q31 16 62 -2q31 -20 31 -55z" /> +<glyph unicode="" horiz-adv-x="1792" d="M832 536v192q-181 -16 -384 -117v-185q205 96 384 110zM832 954v197q-172 -8 -384 -126v-189q215 111 384 118zM1664 491v184q-235 -116 -384 -71v224q-20 6 -39 15q-5 3 -33 17t-34.5 17t-31.5 15t-34.5 15.5t-32.5 13t-36 12.5t-35 8.5t-39.5 7.5t-39.5 4t-44 2 q-23 0 -49 -3v-222h19q102 0 192.5 -29t197.5 -82q19 -9 39 -15v-188q42 -17 91 -17q120 0 293 92zM1664 918v189q-169 -91 -306 -91q-45 0 -78 8v-196q148 -42 384 90zM320 1280q0 -35 -17.5 -64t-46.5 -46v-1266q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v1266 q-29 17 -46.5 46t-17.5 64q0 53 37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1792 1216v-763q0 -39 -35 -57q-10 -5 -17 -9q-218 -116 -369 -116q-88 0 -158 35l-28 14q-64 33 -99 48t-91 29t-114 14q-102 0 -235.5 -44t-228.5 -102q-15 -9 -33 -9q-16 0 -32 8 q-32 19 -32 56v742q0 35 31 55q35 21 78.5 42.5t114 52t152.5 49.5t155 19q112 0 209 -31t209 -86q38 -19 89 -19q122 0 310 112q22 12 31 17q31 16 62 -2q31 -20 31 -55z" /> +<glyph unicode="" horiz-adv-x="1664" d="M585 553l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23t-10 -23zM1664 96v-64q0 -14 -9 -23t-23 -9h-960q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h960q14 0 23 -9 t9 -23z" /> +<glyph unicode="" horiz-adv-x="1920" d="M617 137l-50 -50q-10 -10 -23 -10t-23 10l-466 466q-10 10 -10 23t10 23l466 466q10 10 23 10t23 -10l50 -50q10 -10 10 -23t-10 -23l-393 -393l393 -393q10 -10 10 -23t-10 -23zM1208 1204l-373 -1291q-4 -13 -15.5 -19.5t-23.5 -2.5l-62 17q-13 4 -19.5 15.5t-2.5 24.5 l373 1291q4 13 15.5 19.5t23.5 2.5l62 -17q13 -4 19.5 -15.5t2.5 -24.5zM1865 553l-466 -466q-10 -10 -23 -10t-23 10l-50 50q-10 10 -10 23t10 23l393 393l-393 393q-10 10 -10 23t10 23l50 50q10 10 23 10t23 -10l466 -466q10 -10 10 -23t-10 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 454v-70q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-512 512q-19 19 -19 45t19 45l512 512q29 31 70 14q39 -17 39 -59v-69l-397 -398q-19 -19 -19 -45t19 -45zM1792 416q0 -58 -17 -133.5t-38.5 -138t-48 -125t-40.5 -90.5l-20 -40q-8 -17 -28 -17q-6 0 -9 1 q-25 8 -23 34q43 400 -106 565q-64 71 -170.5 110.5t-267.5 52.5v-251q0 -42 -39 -59q-13 -5 -25 -5q-27 0 -45 19l-512 512q-19 19 -19 45t19 45l512 512q29 31 70 14q39 -17 39 -59v-262q411 -28 599 -221q169 -173 169 -509z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1186 579l257 250l-356 52l-66 10l-30 60l-159 322v-963l59 -31l318 -168l-60 355l-12 66zM1638 841l-363 -354l86 -500q5 -33 -6 -51.5t-34 -18.5q-17 0 -40 12l-449 236l-449 -236q-23 -12 -40 -12q-23 0 -34 18.5t-6 51.5l86 500l-364 354q-32 32 -23 59.5t54 34.5 l502 73l225 455q20 41 49 41q28 0 49 -41l225 -455l502 -73q45 -7 54 -34.5t-24 -59.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1401 1187l-640 -1280q-17 -35 -57 -35q-5 0 -15 2q-22 5 -35.5 22.5t-13.5 39.5v576h-576q-22 0 -39.5 13.5t-22.5 35.5t4 42t29 30l1280 640q13 7 29 7q27 0 45 -19q15 -14 18.5 -34.5t-6.5 -39.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M557 256h595v595zM512 301l595 595h-595v-595zM1664 224v-192q0 -14 -9 -23t-23 -9h-224v-224q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v224h-864q-14 0 -23 9t-9 23v864h-224q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h224v224q0 14 9 23t23 9h192q14 0 23 -9t9 -23 v-224h851l246 247q10 9 23 9t23 -9q9 -10 9 -23t-9 -23l-247 -246v-851h224q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1024" d="M288 64q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM288 1216q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM928 1088q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1024 1088q0 -52 -26 -96.5t-70 -69.5 q-2 -287 -226 -414q-68 -38 -203 -81q-128 -40 -169.5 -71t-41.5 -100v-26q44 -25 70 -69.5t26 -96.5q0 -80 -56 -136t-136 -56t-136 56t-56 136q0 52 26 96.5t70 69.5v820q-44 25 -70 69.5t-26 96.5q0 80 56 136t136 56t136 -56t56 -136q0 -52 -26 -96.5t-70 -69.5v-497 q54 26 154 57q55 17 87.5 29.5t70.5 31t59 39.5t40.5 51t28 69.5t8.5 91.5q-44 25 -70 69.5t-26 96.5q0 80 56 136t136 56t136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1664" d="M439 265l-256 -256q-10 -9 -23 -9q-12 0 -23 9q-9 10 -9 23t9 23l256 256q10 9 23 9t23 -9q9 -10 9 -23t-9 -23zM608 224v-320q0 -14 -9 -23t-23 -9t-23 9t-9 23v320q0 14 9 23t23 9t23 -9t9 -23zM384 448q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9t-9 23t9 23t23 9h320 q14 0 23 -9t9 -23zM1648 320q0 -120 -85 -203l-147 -146q-83 -83 -203 -83q-121 0 -204 85l-334 335q-21 21 -42 56l239 18l273 -274q27 -27 68 -27.5t68 26.5l147 146q28 28 28 67q0 40 -28 68l-274 275l18 239q35 -21 56 -42l336 -336q84 -86 84 -204zM1031 1044l-239 -18 l-273 274q-28 28 -68 28q-39 0 -68 -27l-147 -146q-28 -28 -28 -67q0 -40 28 -68l274 -274l-18 -240q-35 21 -56 42l-336 336q-84 86 -84 204q0 120 85 203l147 146q83 83 203 83q121 0 204 -85l334 -335q21 -21 42 -56zM1664 960q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9 t-9 23t9 23t23 9h320q14 0 23 -9t9 -23zM1120 1504v-320q0 -14 -9 -23t-23 -9t-23 9t-9 23v320q0 14 9 23t23 9t23 -9t9 -23zM1527 1353l-256 -256q-11 -9 -23 -9t-23 9q-9 10 -9 23t9 23l256 256q10 9 23 9t23 -9q9 -10 9 -23t-9 -23z" /> +<glyph unicode="" horiz-adv-x="1024" d="M704 280v-240q0 -16 -12 -28t-28 -12h-240q-16 0 -28 12t-12 28v240q0 16 12 28t28 12h240q16 0 28 -12t12 -28zM1020 880q0 -54 -15.5 -101t-35 -76.5t-55 -59.5t-57.5 -43.5t-61 -35.5q-41 -23 -68.5 -65t-27.5 -67q0 -17 -12 -32.5t-28 -15.5h-240q-15 0 -25.5 18.5 t-10.5 37.5v45q0 83 65 156.5t143 108.5q59 27 84 56t25 76q0 42 -46.5 74t-107.5 32q-65 0 -108 -29q-35 -25 -107 -115q-13 -16 -31 -16q-12 0 -25 8l-164 125q-13 10 -15.5 25t5.5 28q160 266 464 266q80 0 161 -31t146 -83t106 -127.5t41 -158.5z" /> +<glyph unicode="" horiz-adv-x="640" d="M640 192v-128q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h64v384h-64q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h384q26 0 45 -19t19 -45v-576h64q26 0 45 -19t19 -45zM512 1344v-192q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v192 q0 26 19 45t45 19h256q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="640" d="M512 288v-224q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v224q0 26 19 45t45 19h256q26 0 45 -19t19 -45zM542 1344l-28 -768q-1 -26 -20.5 -45t-45.5 -19h-256q-26 0 -45.5 19t-20.5 45l-28 768q-1 26 17.5 45t44.5 19h320q26 0 44.5 -19t17.5 -45z" /> +<glyph unicode="" d="M897 167v-167h-248l-159 252l-24 42q-8 9 -11 21h-3l-9 -21q-10 -20 -25 -44l-155 -250h-258v167h128l197 291l-185 272h-137v168h276l139 -228q2 -4 23 -42q8 -9 11 -21h3q3 9 11 21l25 42l140 228h257v-168h-125l-184 -267l204 -296h109zM1534 846v-206h-514l-3 27 q-4 28 -4 46q0 64 26 117t65 86.5t84 65t84 54.5t65 54t26 64q0 38 -29.5 62.5t-70.5 24.5q-51 0 -97 -39q-14 -11 -36 -38l-105 92q26 37 63 66q83 65 188 65q110 0 178 -59.5t68 -158.5q0 -56 -24.5 -103t-62 -76.5t-81.5 -58.5t-82 -50.5t-65.5 -51.5t-30.5 -63h232v80 h126z" /> +<glyph unicode="" d="M897 167v-167h-248l-159 252l-24 42q-8 9 -11 21h-3l-9 -21q-10 -20 -25 -44l-155 -250h-258v167h128l197 291l-185 272h-137v168h276l139 -228q2 -4 23 -42q8 -9 11 -21h3q3 9 11 21l25 42l140 228h257v-168h-125l-184 -267l204 -296h109zM1536 -50v-206h-514l-4 27 q-3 45 -3 46q0 64 26 117t65 86.5t84 65t84 54.5t65 54t26 64q0 38 -29.5 62.5t-70.5 24.5q-51 0 -97 -39q-14 -11 -36 -38l-105 92q26 37 63 66q80 65 188 65q110 0 178 -59.5t68 -158.5q0 -66 -34.5 -118.5t-84 -86t-99.5 -62.5t-87 -63t-41 -73h232v80h126z" /> +<glyph unicode="" horiz-adv-x="1920" d="M896 128l336 384h-768l-336 -384h768zM1909 1205q15 -34 9.5 -71.5t-30.5 -65.5l-896 -1024q-38 -44 -96 -44h-768q-38 0 -69.5 20.5t-47.5 54.5q-15 34 -9.5 71.5t30.5 65.5l896 1024q38 44 96 44h768q38 0 69.5 -20.5t47.5 -54.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1664 438q0 -81 -44.5 -135t-123.5 -54q-41 0 -77.5 17.5t-59 38t-56.5 38t-71 17.5q-110 0 -110 -124q0 -39 16 -115t15 -115v-5q-22 0 -33 -1q-34 -3 -97.5 -11.5t-115.5 -13.5t-98 -5q-61 0 -103 26.5t-42 83.5q0 37 17.5 71t38 56.5t38 59t17.5 77.5q0 79 -54 123.5 t-135 44.5q-84 0 -143 -45.5t-59 -127.5q0 -43 15 -83t33.5 -64.5t33.5 -53t15 -50.5q0 -45 -46 -89q-37 -35 -117 -35q-95 0 -245 24q-9 2 -27.5 4t-27.5 4l-13 2q-1 0 -3 1q-2 0 -2 1v1024q2 -1 17.5 -3.5t34 -5t21.5 -3.5q150 -24 245 -24q80 0 117 35q46 44 46 89 q0 22 -15 50.5t-33.5 53t-33.5 64.5t-15 83q0 82 59 127.5t144 45.5q80 0 134 -44.5t54 -123.5q0 -41 -17.5 -77.5t-38 -59t-38 -56.5t-17.5 -71q0 -57 42 -83.5t103 -26.5q64 0 180 15t163 17v-2q-1 -2 -3.5 -17.5t-5 -34t-3.5 -21.5q-24 -150 -24 -245q0 -80 35 -117 q44 -46 89 -46q22 0 50.5 15t53 33.5t64.5 33.5t83 15q82 0 127.5 -59t45.5 -143z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1152 832v-128q0 -221 -147.5 -384.5t-364.5 -187.5v-132h256q26 0 45 -19t19 -45t-19 -45t-45 -19h-640q-26 0 -45 19t-19 45t19 45t45 19h256v132q-217 24 -364.5 187.5t-147.5 384.5v128q0 26 19 45t45 19t45 -19t19 -45v-128q0 -185 131.5 -316.5t316.5 -131.5 t316.5 131.5t131.5 316.5v128q0 26 19 45t45 19t45 -19t19 -45zM896 1216v-512q0 -132 -94 -226t-226 -94t-226 94t-94 226v512q0 132 94 226t226 94t226 -94t94 -226z" /> +<glyph unicode="" horiz-adv-x="1408" d="M271 591l-101 -101q-42 103 -42 214v128q0 26 19 45t45 19t45 -19t19 -45v-128q0 -53 15 -113zM1385 1193l-361 -361v-128q0 -132 -94 -226t-226 -94q-55 0 -109 19l-96 -96q97 -51 205 -51q185 0 316.5 131.5t131.5 316.5v128q0 26 19 45t45 19t45 -19t19 -45v-128 q0 -221 -147.5 -384.5t-364.5 -187.5v-132h256q26 0 45 -19t19 -45t-19 -45t-45 -19h-640q-26 0 -45 19t-19 45t19 45t45 19h256v132q-125 13 -235 81l-254 -254q-10 -10 -23 -10t-23 10l-82 82q-10 10 -10 23t10 23l1234 1234q10 10 23 10t23 -10l82 -82q10 -10 10 -23 t-10 -23zM1005 1325l-621 -621v512q0 132 94 226t226 94q102 0 184.5 -59t116.5 -152z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1088 576v640h-448v-1137q119 63 213 137q235 184 235 360zM1280 1344v-768q0 -86 -33.5 -170.5t-83 -150t-118 -127.5t-126.5 -103t-121 -77.5t-89.5 -49.5t-42.5 -20q-12 -6 -26 -6t-26 6q-16 7 -42.5 20t-89.5 49.5t-121 77.5t-126.5 103t-118 127.5t-83 150 t-33.5 170.5v768q0 26 19 45t45 19h1152q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280 q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1408" d="M512 1344q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1408 1376v-320q0 -16 -12 -25q-8 -7 -20 -7q-4 0 -7 1l-448 96q-11 2 -18 11t-7 20h-256v-102q111 -23 183.5 -111t72.5 -203v-800q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v800 q0 106 62.5 190.5t161.5 114.5v111h-32q-59 0 -115 -23.5t-91.5 -53t-66 -66.5t-40.5 -53.5t-14 -24.5q-17 -35 -57 -35q-16 0 -29 7q-23 12 -31.5 37t3.5 49q5 10 14.5 26t37.5 53.5t60.5 70t85 67t108.5 52.5q-25 42 -25 86q0 66 47 113t113 47t113 -47t47 -113 q0 -33 -14 -64h302q0 11 7 20t18 11l448 96q3 1 7 1q12 0 20 -7q12 -9 12 -25z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1440 1088q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1664 1376q0 -249 -75.5 -430.5t-253.5 -360.5q-81 -80 -195 -176l-20 -379q-2 -16 -16 -26l-384 -224q-7 -4 -16 -4q-12 0 -23 9l-64 64q-13 14 -8 32l85 276l-281 281l-276 -85q-3 -1 -9 -1 q-14 0 -23 9l-64 64q-17 19 -5 39l224 384q10 14 26 16l379 20q96 114 176 195q188 187 358 258t431 71q14 0 24 -9.5t10 -22.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1745 763l-164 -763h-334l178 832q13 56 -15 88q-27 33 -83 33h-169l-204 -953h-334l204 953h-286l-204 -953h-334l204 953l-153 327h1276q101 0 189.5 -40.5t147.5 -113.5q60 -73 81 -168.5t0 -194.5z" /> +<glyph unicode="" d="M909 141l102 102q19 19 19 45t-19 45l-307 307l307 307q19 19 19 45t-19 45l-102 102q-19 19 -45 19t-45 -19l-454 -454q-19 -19 -19 -45t19 -45l454 -454q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M717 141l454 454q19 19 19 45t-19 45l-454 454q-19 19 -45 19t-45 -19l-102 -102q-19 -19 -19 -45t19 -45l307 -307l-307 -307q-19 -19 -19 -45t19 -45l102 -102q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1165 397l102 102q19 19 19 45t-19 45l-454 454q-19 19 -45 19t-45 -19l-454 -454q-19 -19 -19 -45t19 -45l102 -102q19 -19 45 -19t45 19l307 307l307 -307q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M813 237l454 454q19 19 19 45t-19 45l-102 102q-19 19 -45 19t-45 -19l-307 -307l-307 307q-19 19 -45 19t-45 -19l-102 -102q-19 -19 -19 -45t19 -45l454 -454q19 -19 45 -19t45 19zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5 t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1130 939l16 175h-884l47 -534h612l-22 -228l-197 -53l-196 53l-13 140h-175l22 -278l362 -100h4v1l359 99l50 544h-644l-15 181h674zM0 1408h1408l-128 -1438l-578 -162l-574 162z" /> +<glyph unicode="" horiz-adv-x="1792" d="M275 1408h1505l-266 -1333l-804 -267l-698 267l71 356h297l-29 -147l422 -161l486 161l68 339h-1208l58 297h1209l38 191h-1208z" /> +<glyph unicode="" horiz-adv-x="1792" d="M960 1280q0 26 -19 45t-45 19t-45 -19t-19 -45t19 -45t45 -19t45 19t19 45zM1792 352v-352q0 -22 -20 -30q-8 -2 -12 -2q-13 0 -23 9l-93 93q-119 -143 -318.5 -226.5t-429.5 -83.5t-429.5 83.5t-318.5 226.5l-93 -93q-9 -9 -23 -9q-4 0 -12 2q-20 8 -20 30v352 q0 14 9 23t23 9h352q22 0 30 -20q8 -19 -7 -35l-100 -100q67 -91 189.5 -153.5t271.5 -82.5v647h-192q-26 0 -45 19t-19 45v128q0 26 19 45t45 19h192v163q-58 34 -93 92.5t-35 128.5q0 106 75 181t181 75t181 -75t75 -181q0 -70 -35 -128.5t-93 -92.5v-163h192q26 0 45 -19 t19 -45v-128q0 -26 -19 -45t-45 -19h-192v-647q149 20 271.5 82.5t189.5 153.5l-100 100q-15 16 -7 35q8 20 30 20h352q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1056 768q40 0 68 -28t28 -68v-576q0 -40 -28 -68t-68 -28h-960q-40 0 -68 28t-28 68v576q0 40 28 68t68 28h32v320q0 185 131.5 316.5t316.5 131.5t316.5 -131.5t131.5 -316.5q0 -26 -19 -45t-45 -19h-64q-26 0 -45 19t-19 45q0 106 -75 181t-181 75t-181 -75t-75 -181 v-320h736z" /> +<glyph unicode="" d="M1024 640q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181zM1152 640q0 159 -112.5 271.5t-271.5 112.5t-271.5 -112.5t-112.5 -271.5t112.5 -271.5t271.5 -112.5t271.5 112.5t112.5 271.5zM1280 640q0 -212 -150 -362t-362 -150t-362 150 t-150 362t150 362t362 150t362 -150t150 -362zM1408 640q0 130 -51 248.5t-136.5 204t-204 136.5t-248.5 51t-248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5zM1536 640 q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M384 800v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM896 800v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM1408 800v-192q0 -40 -28 -68t-68 -28h-192 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68z" /> +<glyph unicode="" horiz-adv-x="384" d="M384 288v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM384 800v-192q0 -40 -28 -68t-68 -28h-192q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68zM384 1312v-192q0 -40 -28 -68t-68 -28h-192 q-40 0 -68 28t-28 68v192q0 40 28 68t68 28h192q40 0 68 -28t28 -68z" /> +<glyph unicode="" d="M512 256q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM863 162q-13 232 -177 396t-396 177q-14 1 -24 -9t-10 -23v-128q0 -13 8.5 -22t21.5 -10q154 -11 264 -121t121 -264q1 -13 10 -21.5t22 -8.5h128q13 0 23 10 t9 24zM1247 161q-5 154 -56 297.5t-139.5 260t-205 205t-260 139.5t-297.5 56q-14 1 -23 -9q-10 -10 -10 -23v-128q0 -13 9 -22t22 -10q204 -7 378 -111.5t278.5 -278.5t111.5 -378q1 -13 10 -22t22 -9h128q13 0 23 10q11 9 9 23zM1536 1120v-960q0 -119 -84.5 -203.5 t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM1152 585q32 18 32 55t-32 55l-544 320q-31 19 -64 1q-32 -19 -32 -56v-640q0 -37 32 -56 q16 -8 32 -8q17 0 32 9z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1024 1084l316 -316l-572 -572l-316 316zM813 105l618 618q19 19 19 45t-19 45l-362 362q-18 18 -45 18t-45 -18l-618 -618q-19 -19 -19 -45t19 -45l362 -362q18 -18 45 -18t45 18zM1702 742l-907 -908q-37 -37 -90.5 -37t-90.5 37l-126 126q56 56 56 136t-56 136 t-136 56t-136 -56l-125 126q-37 37 -37 90.5t37 90.5l907 906q37 37 90.5 37t90.5 -37l125 -125q-56 -56 -56 -136t56 -136t136 -56t136 56l126 -125q37 -37 37 -90.5t-37 -90.5z" /> +<glyph unicode="" d="M1280 576v128q0 26 -19 45t-45 19h-896q-26 0 -45 -19t-19 -45v-128q0 -26 19 -45t45 -19h896q26 0 45 19t19 45zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5 t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1152 736v-64q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h832q14 0 23 -9t9 -23zM1280 288v832q0 66 -47 113t-113 47h-832q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113zM1408 1120v-832q0 -119 -84.5 -203.5 t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1018 933q-18 -37 -58 -37h-192v-864q0 -14 -9 -23t-23 -9h-704q-21 0 -29 18q-8 20 4 35l160 192q9 11 25 11h320v640h-192q-40 0 -58 37q-17 37 9 68l320 384q18 22 49 22t49 -22l320 -384q27 -32 9 -68z" /> +<glyph unicode="" horiz-adv-x="1024" d="M32 1280h704q13 0 22.5 -9.5t9.5 -23.5v-863h192q40 0 58 -37t-9 -69l-320 -384q-18 -22 -49 -22t-49 22l-320 384q-26 31 -9 69q18 37 58 37h192v640h-320q-14 0 -25 11l-160 192q-13 14 -4 34q9 19 29 19z" /> +<glyph unicode="" d="M685 237l614 614q19 19 19 45t-19 45l-102 102q-19 19 -45 19t-45 -19l-467 -467l-211 211q-19 19 -45 19t-45 -19l-102 -102q-19 -19 -19 -45t19 -45l358 -358q19 -19 45 -19t45 19zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5 t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M404 428l152 -152l-52 -52h-56v96h-96v56zM818 818q14 -13 -3 -30l-291 -291q-17 -17 -30 -3q-14 13 3 30l291 291q17 17 30 3zM544 128l544 544l-288 288l-544 -544v-288h288zM1152 736l92 92q28 28 28 68t-28 68l-152 152q-28 28 -68 28t-68 -28l-92 -92zM1536 1120 v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1280 608v480q0 26 -19 45t-45 19h-480q-42 0 -59 -39q-17 -41 14 -70l144 -144l-534 -534q-19 -19 -19 -45t19 -45l102 -102q19 -19 45 -19t45 19l534 534l144 -144q18 -19 45 -19q12 0 25 5q39 17 39 59zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960 q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1005 435l352 352q19 19 19 45t-19 45l-352 352q-30 31 -69 14q-40 -17 -40 -59v-160q-119 0 -216 -19.5t-162.5 -51t-114 -79t-76.5 -95.5t-44.5 -109t-21.5 -111.5t-5 -110.5q0 -181 167 -404q10 -12 25 -12q7 0 13 3q22 9 19 33q-44 354 62 473q46 52 130 75.5 t224 23.5v-160q0 -42 40 -59q12 -5 24 -5q26 0 45 19zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M640 448l256 128l-256 128v-256zM1024 1039v-542l-512 -256v542zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1145 861q18 -35 -5 -66l-320 -448q-19 -27 -52 -27t-52 27l-320 448q-23 31 -5 66q17 35 57 35h640q40 0 57 -35zM1280 160v960q0 13 -9.5 22.5t-22.5 9.5h-960q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h960q13 0 22.5 9.5t9.5 22.5zM1536 1120 v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1145 419q-17 -35 -57 -35h-640q-40 0 -57 35q-18 35 5 66l320 448q19 27 52 27t52 -27l320 -448q23 -31 5 -66zM1280 160v960q0 13 -9.5 22.5t-22.5 9.5h-960q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h960q13 0 22.5 9.5t9.5 22.5zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1088 640q0 -33 -27 -52l-448 -320q-31 -23 -66 -5q-35 17 -35 57v640q0 40 35 57q35 18 66 -5l448 -320q27 -19 27 -52zM1280 160v960q0 14 -9 23t-23 9h-960q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h960q14 0 23 9t9 23zM1536 1120v-960q0 -119 -84.5 -203.5 t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M976 229l35 -159q3 -12 -3 -22.5t-17 -14.5l-5 -1q-4 -2 -10.5 -3.5t-16 -4.5t-21.5 -5.5t-25.5 -5t-30 -5t-33.5 -4.5t-36.5 -3t-38.5 -1q-234 0 -409 130.5t-238 351.5h-95q-13 0 -22.5 9.5t-9.5 22.5v113q0 13 9.5 22.5t22.5 9.5h66q-2 57 1 105h-67q-14 0 -23 9 t-9 23v114q0 14 9 23t23 9h98q67 210 243.5 338t400.5 128q102 0 194 -23q11 -3 20 -15q6 -11 3 -24l-43 -159q-3 -13 -14 -19.5t-24 -2.5l-4 1q-4 1 -11.5 2.5l-17.5 3.5t-22.5 3.5t-26 3t-29 2.5t-29.5 1q-126 0 -226 -64t-150 -176h468q16 0 25 -12q10 -12 7 -26 l-24 -114q-5 -26 -32 -26h-488q-3 -37 0 -105h459q15 0 25 -12q9 -12 6 -27l-24 -112q-2 -11 -11 -18.5t-20 -7.5h-387q48 -117 149.5 -185.5t228.5 -68.5q18 0 36 1.5t33.5 3.5t29.5 4.5t24.5 5t18.5 4.5l12 3l5 2q13 5 26 -2q12 -7 15 -21z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1020 399v-367q0 -14 -9 -23t-23 -9h-956q-14 0 -23 9t-9 23v150q0 13 9.5 22.5t22.5 9.5h97v383h-95q-14 0 -23 9.5t-9 22.5v131q0 14 9 23t23 9h95v223q0 171 123.5 282t314.5 111q185 0 335 -125q9 -8 10 -20.5t-7 -22.5l-103 -127q-9 -11 -22 -12q-13 -2 -23 7 q-5 5 -26 19t-69 32t-93 18q-85 0 -137 -47t-52 -123v-215h305q13 0 22.5 -9t9.5 -23v-131q0 -13 -9.5 -22.5t-22.5 -9.5h-305v-379h414v181q0 13 9 22.5t23 9.5h162q14 0 23 -9.5t9 -22.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M978 351q0 -153 -99.5 -263.5t-258.5 -136.5v-175q0 -14 -9 -23t-23 -9h-135q-13 0 -22.5 9.5t-9.5 22.5v175q-66 9 -127.5 31t-101.5 44.5t-74 48t-46.5 37.5t-17.5 18q-17 21 -2 41l103 135q7 10 23 12q15 2 24 -9l2 -2q113 -99 243 -125q37 -8 74 -8q81 0 142.5 43 t61.5 122q0 28 -15 53t-33.5 42t-58.5 37.5t-66 32t-80 32.5q-39 16 -61.5 25t-61.5 26.5t-62.5 31t-56.5 35.5t-53.5 42.5t-43.5 49t-35.5 58t-21 66.5t-8.5 78q0 138 98 242t255 134v180q0 13 9.5 22.5t22.5 9.5h135q14 0 23 -9t9 -23v-176q57 -6 110.5 -23t87 -33.5 t63.5 -37.5t39 -29t15 -14q17 -18 5 -38l-81 -146q-8 -15 -23 -16q-14 -3 -27 7q-3 3 -14.5 12t-39 26.5t-58.5 32t-74.5 26t-85.5 11.5q-95 0 -155 -43t-60 -111q0 -26 8.5 -48t29.5 -41.5t39.5 -33t56 -31t60.5 -27t70 -27.5q53 -20 81 -31.5t76 -35t75.5 -42.5t62 -50 t53 -63.5t31.5 -76.5t13 -94z" /> +<glyph unicode="" horiz-adv-x="898" d="M898 1066v-102q0 -14 -9 -23t-23 -9h-168q-23 -144 -129 -234t-276 -110q167 -178 459 -536q14 -16 4 -34q-8 -18 -29 -18h-195q-16 0 -25 12q-306 367 -498 571q-9 9 -9 22v127q0 13 9.5 22.5t22.5 9.5h112q132 0 212.5 43t102.5 125h-427q-14 0 -23 9t-9 23v102 q0 14 9 23t23 9h413q-57 113 -268 113h-145q-13 0 -22.5 9.5t-9.5 22.5v133q0 14 9 23t23 9h832q14 0 23 -9t9 -23v-102q0 -14 -9 -23t-23 -9h-233q47 -61 64 -144h171q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1027" d="M603 0h-172q-13 0 -22.5 9t-9.5 23v330h-288q-13 0 -22.5 9t-9.5 23v103q0 13 9.5 22.5t22.5 9.5h288v85h-288q-13 0 -22.5 9t-9.5 23v104q0 13 9.5 22.5t22.5 9.5h214l-321 578q-8 16 0 32q10 16 28 16h194q19 0 29 -18l215 -425q19 -38 56 -125q10 24 30.5 68t27.5 61 l191 420q8 19 29 19h191q17 0 27 -16q9 -14 1 -31l-313 -579h215q13 0 22.5 -9.5t9.5 -22.5v-104q0 -14 -9.5 -23t-22.5 -9h-290v-85h290q13 0 22.5 -9.5t9.5 -22.5v-103q0 -14 -9.5 -23t-22.5 -9h-290v-330q0 -13 -9.5 -22.5t-22.5 -9.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1043 971q0 100 -65 162t-171 62h-320v-448h320q106 0 171 62t65 162zM1280 971q0 -193 -126.5 -315t-326.5 -122h-340v-118h505q14 0 23 -9t9 -23v-128q0 -14 -9 -23t-23 -9h-505v-192q0 -14 -9.5 -23t-22.5 -9h-167q-14 0 -23 9t-9 23v192h-224q-14 0 -23 9t-9 23v128 q0 14 9 23t23 9h224v118h-224q-14 0 -23 9t-9 23v149q0 13 9 22.5t23 9.5h224v629q0 14 9 23t23 9h539q200 0 326.5 -122t126.5 -315z" /> +<glyph unicode="" horiz-adv-x="1792" d="M514 341l81 299h-159l75 -300q1 -1 1 -3t1 -3q0 1 0.5 3.5t0.5 3.5zM630 768l35 128h-292l32 -128h225zM822 768h139l-35 128h-70zM1271 340l78 300h-162l81 -299q0 -1 0.5 -3.5t1.5 -3.5q0 1 0.5 3t0.5 3zM1382 768l33 128h-297l34 -128h230zM1792 736v-64q0 -14 -9 -23 t-23 -9h-213l-164 -616q-7 -24 -31 -24h-159q-24 0 -31 24l-166 616h-209l-167 -616q-7 -24 -31 -24h-159q-11 0 -19.5 7t-10.5 17l-160 616h-208q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h175l-33 128h-142q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h109l-89 344q-5 15 5 28 q10 12 26 12h137q26 0 31 -24l90 -360h359l97 360q7 24 31 24h126q24 0 31 -24l98 -360h365l93 360q5 24 31 24h137q16 0 26 -12q10 -13 5 -28l-91 -344h111q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-145l-34 -128h179q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1167 896q18 -182 -131 -258q117 -28 175 -103t45 -214q-7 -71 -32.5 -125t-64.5 -89t-97 -58.5t-121.5 -34.5t-145.5 -15v-255h-154v251q-80 0 -122 1v-252h-154v255q-18 0 -54 0.5t-55 0.5h-200l31 183h111q50 0 58 51v402h16q-6 1 -16 1v287q-13 68 -89 68h-111v164 l212 -1q64 0 97 1v252h154v-247q82 2 122 2v245h154v-252q79 -7 140 -22.5t113 -45t82.5 -78t36.5 -114.5zM952 351q0 36 -15 64t-37 46t-57.5 30.5t-65.5 18.5t-74 9t-69 3t-64.5 -1t-47.5 -1v-338q8 0 37 -0.5t48 -0.5t53 1.5t58.5 4t57 8.5t55.5 14t47.5 21t39.5 30 t24.5 40t9.5 51zM881 827q0 33 -12.5 58.5t-30.5 42t-48 28t-55 16.5t-61.5 8t-58 2.5t-54 -1t-39.5 -0.5v-307q5 0 34.5 -0.5t46.5 0t50 2t55 5.5t51.5 11t48.5 18.5t37 27t27 38.5t9 51z" /> +<glyph unicode="" d="M1024 1024v472q22 -14 36 -28l408 -408q14 -14 28 -36h-472zM896 992q0 -40 28 -68t68 -28h544v-1056q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h800v-544z" /> +<glyph unicode="" d="M1468 1060q14 -14 28 -36h-472v472q22 -14 36 -28zM992 896h544v-1056q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h800v-544q0 -40 28 -68t68 -28zM1152 160v64q0 14 -9 23t-23 9h-704q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h704 q14 0 23 9t9 23zM1152 416v64q0 14 -9 23t-23 9h-704q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h704q14 0 23 9t9 23zM1152 672v64q0 14 -9 23t-23 9h-704q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h704q14 0 23 9t9 23z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1191 1128h177l-72 218l-12 47q-2 16 -2 20h-4l-3 -20q0 -1 -3.5 -18t-7.5 -29zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23zM1572 -23 v-233h-584v90l369 529q12 18 21 27l11 9v3q-2 0 -6.5 -0.5t-7.5 -0.5q-12 -3 -30 -3h-232v-115h-120v229h567v-89l-369 -530q-6 -8 -21 -26l-11 -11v-2l14 2q9 2 30 2h248v119h121zM1661 874v-106h-288v106h75l-47 144h-243l-47 -144h75v-106h-287v106h70l230 662h162 l230 -662h70z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1191 104h177l-72 218l-12 47q-2 16 -2 20h-4l-3 -20q0 -1 -3.5 -18t-7.5 -29zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23zM1661 -150 v-106h-288v106h75l-47 144h-243l-47 -144h75v-106h-287v106h70l230 662h162l230 -662h70zM1572 1001v-233h-584v90l369 529q12 18 21 27l11 9v3q-2 0 -6.5 -0.5t-7.5 -0.5q-12 -3 -30 -3h-232v-115h-120v229h567v-89l-369 -530q-6 -8 -21 -26l-11 -10v-3l14 3q9 1 30 1h248 v119h121z" /> +<glyph unicode="" horiz-adv-x="1792" d="M736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23zM1792 -32v-192q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h832 q14 0 23 -9t9 -23zM1600 480v-192q0 -14 -9 -23t-23 -9h-640q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h640q14 0 23 -9t9 -23zM1408 992v-192q0 -14 -9 -23t-23 -9h-448q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h448q14 0 23 -9t9 -23zM1216 1504v-192q0 -14 -9 -23t-23 -9h-256 q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h256q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1216 -32v-192q0 -14 -9 -23t-23 -9h-256q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h256q14 0 23 -9t9 -23zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192 q14 0 23 -9t9 -23zM1408 480v-192q0 -14 -9 -23t-23 -9h-448q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h448q14 0 23 -9t9 -23zM1600 992v-192q0 -14 -9 -23t-23 -9h-640q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h640q14 0 23 -9t9 -23zM1792 1504v-192q0 -14 -9 -23t-23 -9h-832 q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h832q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1346 223q0 63 -44 116t-103 53q-52 0 -83 -37t-31 -94t36.5 -95t104.5 -38q50 0 85 27t35 68zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9t9 -23 zM1486 165q0 -62 -13 -121.5t-41 -114t-68 -95.5t-98.5 -65.5t-127.5 -24.5q-62 0 -108 16q-24 8 -42 15l39 113q15 -7 31 -11q37 -13 75 -13q84 0 134.5 58.5t66.5 145.5h-2q-21 -23 -61.5 -37t-84.5 -14q-106 0 -173 71.5t-67 172.5q0 105 72 178t181 73q123 0 205 -94.5 t82 -252.5zM1456 882v-114h-469v114h167v432q0 7 0.5 19t0.5 17v16h-2l-7 -12q-8 -13 -26 -31l-62 -58l-82 86l192 185h123v-654h165z" /> +<glyph unicode="" d="M1346 1247q0 63 -44 116t-103 53q-52 0 -83 -37t-31 -94t36.5 -95t104.5 -38q50 0 85 27t35 68zM736 96q0 -12 -10 -24l-319 -319q-10 -9 -23 -9q-12 0 -23 9l-320 320q-15 16 -7 35q8 20 30 20h192v1376q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1376h192q14 0 23 -9 t9 -23zM1456 -142v-114h-469v114h167v432q0 7 0.5 19t0.5 17v16h-2l-7 -12q-8 -13 -26 -31l-62 -58l-82 86l192 185h123v-654h165zM1486 1189q0 -62 -13 -121.5t-41 -114t-68 -95.5t-98.5 -65.5t-127.5 -24.5q-62 0 -108 16q-24 8 -42 15l39 113q15 -7 31 -11q37 -13 75 -13 q84 0 134.5 58.5t66.5 145.5h-2q-21 -23 -61.5 -37t-84.5 -14q-106 0 -173 71.5t-67 172.5q0 105 72 178t181 73q123 0 205 -94.5t82 -252.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M256 192q0 26 -19 45t-45 19q-27 0 -45.5 -19t-18.5 -45q0 -27 18.5 -45.5t45.5 -18.5q26 0 45 18.5t19 45.5zM416 704v-640q0 -26 -19 -45t-45 -19h-288q-26 0 -45 19t-19 45v640q0 26 19 45t45 19h288q26 0 45 -19t19 -45zM1600 704q0 -86 -55 -149q15 -44 15 -76 q3 -76 -43 -137q17 -56 0 -117q-15 -57 -54 -94q9 -112 -49 -181q-64 -76 -197 -78h-36h-76h-17q-66 0 -144 15.5t-121.5 29t-120.5 39.5q-123 43 -158 44q-26 1 -45 19.5t-19 44.5v641q0 25 18 43.5t43 20.5q24 2 76 59t101 121q68 87 101 120q18 18 31 48t17.5 48.5 t13.5 60.5q7 39 12.5 61t19.5 52t34 50q19 19 45 19q46 0 82.5 -10.5t60 -26t40 -40.5t24 -45t12 -50t5 -45t0.5 -39q0 -38 -9.5 -76t-19 -60t-27.5 -56q-3 -6 -10 -18t-11 -22t-8 -24h277q78 0 135 -57t57 -135z" /> +<glyph unicode="" horiz-adv-x="1664" d="M256 960q0 -26 -19 -45t-45 -19q-27 0 -45.5 19t-18.5 45q0 27 18.5 45.5t45.5 18.5q26 0 45 -18.5t19 -45.5zM416 448v640q0 26 -19 45t-45 19h-288q-26 0 -45 -19t-19 -45v-640q0 -26 19 -45t45 -19h288q26 0 45 19t19 45zM1545 597q55 -61 55 -149q-1 -78 -57.5 -135 t-134.5 -57h-277q4 -14 8 -24t11 -22t10 -18q18 -37 27 -57t19 -58.5t10 -76.5q0 -24 -0.5 -39t-5 -45t-12 -50t-24 -45t-40 -40.5t-60 -26t-82.5 -10.5q-26 0 -45 19q-20 20 -34 50t-19.5 52t-12.5 61q-9 42 -13.5 60.5t-17.5 48.5t-31 48q-33 33 -101 120q-49 64 -101 121 t-76 59q-25 2 -43 20.5t-18 43.5v641q0 26 19 44.5t45 19.5q35 1 158 44q77 26 120.5 39.5t121.5 29t144 15.5h17h76h36q133 -2 197 -78q58 -69 49 -181q39 -37 54 -94q17 -61 0 -117q46 -61 43 -137q0 -32 -15 -76z" /> +<glyph unicode="" d="M919 233v157q0 50 -29 50q-17 0 -33 -16v-224q16 -16 33 -16q29 0 29 49zM1103 355h66v34q0 51 -33 51t-33 -51v-34zM532 621v-70h-80v-423h-74v423h-78v70h232zM733 495v-367h-67v40q-39 -45 -76 -45q-33 0 -42 28q-6 16 -6 54v290h66v-270q0 -24 1 -26q1 -15 15 -15 q20 0 42 31v280h67zM985 384v-146q0 -52 -7 -73q-12 -42 -53 -42q-35 0 -68 41v-36h-67v493h67v-161q32 40 68 40q41 0 53 -42q7 -21 7 -74zM1236 255v-9q0 -29 -2 -43q-3 -22 -15 -40q-27 -40 -80 -40q-52 0 -81 38q-21 27 -21 86v129q0 59 20 86q29 38 80 38t78 -38 q21 -28 21 -86v-76h-133v-65q0 -51 34 -51q24 0 30 26q0 1 0.5 7t0.5 16.5v21.5h68zM785 1079v-156q0 -51 -32 -51t-32 51v156q0 52 32 52t32 -52zM1318 366q0 177 -19 260q-10 44 -43 73.5t-76 34.5q-136 15 -412 15q-275 0 -411 -15q-44 -5 -76.5 -34.5t-42.5 -73.5 q-20 -87 -20 -260q0 -176 20 -260q10 -43 42.5 -73t75.5 -35q137 -15 412 -15t412 15q43 5 75.5 35t42.5 73q20 84 20 260zM563 1017l90 296h-75l-51 -195l-53 195h-78l24 -69t23 -69q35 -103 46 -158v-201h74v201zM852 936v130q0 58 -21 87q-29 38 -78 38q-51 0 -78 -38 q-21 -29 -21 -87v-130q0 -58 21 -87q27 -38 78 -38q49 0 78 38q21 27 21 87zM1033 816h67v370h-67v-283q-22 -31 -42 -31q-15 0 -16 16q-1 2 -1 26v272h-67v-293q0 -37 6 -55q11 -27 43 -27q36 0 77 45v-40zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960 q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M971 292v-211q0 -67 -39 -67q-23 0 -45 22v301q22 22 45 22q39 0 39 -67zM1309 291v-46h-90v46q0 68 45 68t45 -68zM343 509h107v94h-312v-94h105v-569h100v569zM631 -60h89v494h-89v-378q-30 -42 -57 -42q-18 0 -21 21q-1 3 -1 35v364h-89v-391q0 -49 8 -73 q12 -37 58 -37q48 0 102 61v-54zM1060 88v197q0 73 -9 99q-17 56 -71 56q-50 0 -93 -54v217h-89v-663h89v48q45 -55 93 -55q54 0 71 55q9 27 9 100zM1398 98v13h-91q0 -51 -2 -61q-7 -36 -40 -36q-46 0 -46 69v87h179v103q0 79 -27 116q-39 51 -106 51q-68 0 -107 -51 q-28 -37 -28 -116v-173q0 -79 29 -116q39 -51 108 -51q72 0 108 53q18 27 21 54q2 9 2 58zM790 1011v210q0 69 -43 69t-43 -69v-210q0 -70 43 -70t43 70zM1509 260q0 -234 -26 -350q-14 -59 -58 -99t-102 -46q-184 -21 -555 -21t-555 21q-58 6 -102.5 46t-57.5 99 q-26 112 -26 350q0 234 26 350q14 59 58 99t103 47q183 20 554 20t555 -20q58 -7 102.5 -47t57.5 -99q26 -112 26 -350zM511 1536h102l-121 -399v-271h-100v271q-14 74 -61 212q-37 103 -65 187h106l71 -263zM881 1203v-175q0 -81 -28 -118q-37 -51 -106 -51q-67 0 -105 51 q-28 38 -28 118v175q0 80 28 117q38 51 105 51q69 0 106 -51q28 -37 28 -117zM1216 1365v-499h-91v55q-53 -62 -103 -62q-46 0 -59 37q-8 24 -8 75v394h91v-367q0 -33 1 -35q3 -22 21 -22q27 0 57 43v381h91z" /> +<glyph unicode="" horiz-adv-x="1408" d="M597 869q-10 -18 -257 -456q-27 -46 -65 -46h-239q-21 0 -31 17t0 36l253 448q1 0 0 1l-161 279q-12 22 -1 37q9 15 32 15h239q40 0 66 -45zM1403 1511q11 -16 0 -37l-528 -934v-1l336 -615q11 -20 1 -37q-10 -15 -32 -15h-239q-42 0 -66 45l-339 622q18 32 531 942 q25 45 64 45h241q22 0 31 -15z" /> +<glyph unicode="" d="M685 771q0 1 -126 222q-21 34 -52 34h-184q-18 0 -26 -11q-7 -12 1 -29l125 -216v-1l-196 -346q-9 -14 0 -28q8 -13 24 -13h185q31 0 50 36zM1309 1268q-7 12 -24 12h-187q-30 0 -49 -35l-411 -729q1 -2 262 -481q20 -35 52 -35h184q18 0 25 12q8 13 -1 28l-260 476v1 l409 723q8 16 0 28zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 640q0 37 -30 54l-512 320q-31 20 -65 2q-33 -18 -33 -56v-640q0 -38 33 -56q16 -8 31 -8q20 0 34 10l512 320q30 17 30 54zM1792 640q0 -96 -1 -150t-8.5 -136.5t-22.5 -147.5q-16 -73 -69 -123t-124 -58q-222 -25 -671 -25t-671 25q-71 8 -124.5 58t-69.5 123 q-14 65 -21.5 147.5t-8.5 136.5t-1 150t1 150t8.5 136.5t22.5 147.5q16 73 69 123t124 58q222 25 671 25t671 -25q71 -8 124.5 -58t69.5 -123q14 -65 21.5 -147.5t8.5 -136.5t1 -150z" /> +<glyph unicode="" horiz-adv-x="1792" d="M402 829l494 -305l-342 -285l-490 319zM1388 274v-108l-490 -293v-1l-1 1l-1 -1v1l-489 293v108l147 -96l342 284v2l1 -1l1 1v-2l343 -284zM554 1418l342 -285l-494 -304l-338 270zM1390 829l338 -271l-489 -319l-343 285zM1239 1418l489 -319l-338 -270l-494 304z" /> +<glyph unicode="" d="M1289 -96h-1118v480h-160v-640h1438v640h-160v-480zM347 428l33 157l783 -165l-33 -156zM450 802l67 146l725 -339l-67 -145zM651 1158l102 123l614 -513l-102 -123zM1048 1536l477 -641l-128 -96l-477 641zM330 65v159h800v-159h-800z" /> +<glyph unicode="" d="M1024 640q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM1162 640q0 -164 -115 -279t-279 -115t-279 115t-115 279t115 279t279 115t279 -115t115 -279zM1270 1050q0 -38 -27 -65t-65 -27t-65 27t-27 65t27 65t65 27t65 -27t27 -65zM768 1270 q-7 0 -76.5 0.5t-105.5 0t-96.5 -3t-103 -10t-71.5 -18.5q-50 -20 -88 -58t-58 -88q-11 -29 -18.5 -71.5t-10 -103t-3 -96.5t0 -105.5t0.5 -76.5t-0.5 -76.5t0 -105.5t3 -96.5t10 -103t18.5 -71.5q20 -50 58 -88t88 -58q29 -11 71.5 -18.5t103 -10t96.5 -3t105.5 0t76.5 0.5 t76.5 -0.5t105.5 0t96.5 3t103 10t71.5 18.5q50 20 88 58t58 88q11 29 18.5 71.5t10 103t3 96.5t0 105.5t-0.5 76.5t0.5 76.5t0 105.5t-3 96.5t-10 103t-18.5 71.5q-20 50 -58 88t-88 58q-29 11 -71.5 18.5t-103 10t-96.5 3t-105.5 0t-76.5 -0.5zM1536 640q0 -229 -5 -317 q-10 -208 -124 -322t-322 -124q-88 -5 -317 -5t-317 5q-208 10 -322 124t-124 322q-5 88 -5 317t5 317q10 208 124 322t322 124q88 5 317 5t317 -5q208 -10 322 -124t124 -322q5 -88 5 -317z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960zM698 640q0 88 -62 150t-150 62t-150 -62t-62 -150t62 -150t150 -62t150 62t62 150zM1262 640q0 88 -62 150 t-150 62t-150 -62t-62 -150t62 -150t150 -62t150 62t62 150z" /> +<glyph unicode="" d="M768 914l201 -306h-402zM1133 384h94l-459 691l-459 -691h94l104 160h522zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M815 677q8 -63 -50.5 -101t-111.5 -6q-39 17 -53.5 58t-0.5 82t52 58q36 18 72.5 12t64 -35.5t27.5 -67.5zM926 698q-14 107 -113 164t-197 13q-63 -28 -100.5 -88.5t-34.5 -129.5q4 -91 77.5 -155t165.5 -56q91 8 152 84t50 168zM1165 1240q-20 27 -56 44.5t-58 22 t-71 12.5q-291 47 -566 -2q-43 -7 -66 -12t-55 -22t-50 -43q30 -28 76 -45.5t73.5 -22t87.5 -11.5q228 -29 448 -1q63 8 89.5 12t72.5 21.5t75 46.5zM1222 205q-8 -26 -15.5 -76.5t-14 -84t-28.5 -70t-58 -56.5q-86 -48 -189.5 -71.5t-202 -22t-201.5 18.5q-46 8 -81.5 18 t-76.5 27t-73 43.5t-52 61.5q-25 96 -57 292l6 16l18 9q223 -148 506.5 -148t507.5 148q21 -6 24 -23t-5 -45t-8 -37zM1403 1166q-26 -167 -111 -655q-5 -30 -27 -56t-43.5 -40t-54.5 -31q-252 -126 -610 -88q-248 27 -394 139q-15 12 -25.5 26.5t-17 35t-9 34t-6 39.5 t-5.5 35q-9 50 -26.5 150t-28 161.5t-23.5 147.5t-22 158q3 26 17.5 48.5t31.5 37.5t45 30t46 22.5t48 18.5q125 46 313 64q379 37 676 -50q155 -46 215 -122q16 -20 16.5 -51t-5.5 -54z" /> +<glyph unicode="" d="M848 666q0 43 -41 66t-77 1q-43 -20 -42.5 -72.5t43.5 -70.5q39 -23 81 4t36 72zM928 682q8 -66 -36 -121t-110 -61t-119 40t-56 113q-2 49 25.5 93t72.5 64q70 31 141.5 -10t81.5 -118zM1100 1073q-20 -21 -53.5 -34t-53 -16t-63.5 -8q-155 -20 -324 0q-44 6 -63 9.5 t-52.5 16t-54.5 32.5q13 19 36 31t40 15.5t47 8.5q198 35 408 1q33 -5 51 -8.5t43 -16t39 -31.5zM1142 327q0 7 5.5 26.5t3 32t-17.5 16.5q-161 -106 -365 -106t-366 106l-12 -6l-5 -12q26 -154 41 -210q47 -81 204 -108q249 -46 428 53q34 19 49 51.5t22.5 85.5t12.5 71z M1272 1020q9 53 -8 75q-43 55 -155 88q-216 63 -487 36q-132 -12 -226 -46q-38 -15 -59.5 -25t-47 -34t-29.5 -54q8 -68 19 -138t29 -171t24 -137q1 -5 5 -31t7 -36t12 -27t22 -28q105 -80 284 -100q259 -28 440 63q24 13 39.5 23t31 29t19.5 40q48 267 80 473zM1536 1120 v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M944 207l80 -237q-23 -35 -111 -66t-177 -32q-104 -2 -190.5 26t-142.5 74t-95 106t-55.5 120t-16.5 118v544h-168v215q72 26 129 69.5t91 90t58 102t34 99t15 88.5q1 5 4.5 8.5t7.5 3.5h244v-424h333v-252h-334v-518q0 -30 6.5 -56t22.5 -52.5t49.5 -41.5t81.5 -14 q78 2 134 29z" /> +<glyph unicode="" d="M1136 75l-62 183q-44 -22 -103 -22q-36 -1 -62 10.5t-38.5 31.5t-17.5 40.5t-5 43.5v398h257v194h-256v326h-188q-8 0 -9 -10q-5 -44 -17.5 -87t-39 -95t-77 -95t-118.5 -68v-165h130v-418q0 -57 21.5 -115t65 -111t121 -85.5t176.5 -30.5q69 1 136.5 25t85.5 50z M1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="768" d="M765 237q8 -19 -5 -35l-350 -384q-10 -10 -23 -10q-14 0 -24 10l-355 384q-13 16 -5 35q9 19 29 19h224v1248q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-1248h224q21 0 29 -19z" /> +<glyph unicode="" horiz-adv-x="768" d="M765 1043q-9 -19 -29 -19h-224v-1248q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v1248h-224q-21 0 -29 19t5 35l350 384q10 10 23 10q14 0 24 -10l355 -384q13 -16 5 -35z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 736v-192q0 -14 -9 -23t-23 -9h-1248v-224q0 -21 -19 -29t-35 5l-384 350q-10 10 -10 23q0 14 10 24l384 354q16 14 35 6q19 -9 19 -29v-224h1248q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1728 643q0 -14 -10 -24l-384 -354q-16 -14 -35 -6q-19 9 -19 29v224h-1248q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h1248v224q0 21 19 29t35 -5l384 -350q10 -10 10 -23z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1393 321q-39 -125 -123 -250q-129 -196 -257 -196q-49 0 -140 32q-86 32 -151 32q-61 0 -142 -33q-81 -34 -132 -34q-152 0 -301 259q-147 261 -147 503q0 228 113 374q112 144 284 144q72 0 177 -30q104 -30 138 -30q45 0 143 34q102 34 173 34q119 0 213 -65 q52 -36 104 -100q-79 -67 -114 -118q-65 -94 -65 -207q0 -124 69 -223t158 -126zM1017 1494q0 -61 -29 -136q-30 -75 -93 -138q-54 -54 -108 -72q-37 -11 -104 -17q3 149 78 257q74 107 250 148q1 -3 2.5 -11t2.5 -11q0 -4 0.5 -10t0.5 -10z" /> +<glyph unicode="" horiz-adv-x="1664" d="M682 530v-651l-682 94v557h682zM682 1273v-659h-682v565zM1664 530v-786l-907 125v661h907zM1664 1408v-794h-907v669z" /> +<glyph unicode="" horiz-adv-x="1408" d="M493 1053q16 0 27.5 11.5t11.5 27.5t-11.5 27.5t-27.5 11.5t-27 -11.5t-11 -27.5t11 -27.5t27 -11.5zM915 1053q16 0 27 11.5t11 27.5t-11 27.5t-27 11.5t-27.5 -11.5t-11.5 -27.5t11.5 -27.5t27.5 -11.5zM103 869q42 0 72 -30t30 -72v-430q0 -43 -29.5 -73t-72.5 -30 t-73 30t-30 73v430q0 42 30 72t73 30zM1163 850v-666q0 -46 -32 -78t-77 -32h-75v-227q0 -43 -30 -73t-73 -30t-73 30t-30 73v227h-138v-227q0 -43 -30 -73t-73 -30q-42 0 -72 30t-30 73l-1 227h-74q-46 0 -78 32t-32 78v666h918zM931 1255q107 -55 171 -153.5t64 -215.5 h-925q0 117 64 215.5t172 153.5l-71 131q-7 13 5 20q13 6 20 -6l72 -132q95 42 201 42t201 -42l72 132q7 12 20 6q12 -7 5 -20zM1408 767v-430q0 -43 -30 -73t-73 -30q-42 0 -72 30t-30 73v430q0 43 30 72.5t72 29.5q43 0 73 -29.5t30 -72.5z" /> +<glyph unicode="" d="M663 1125q-11 -1 -15.5 -10.5t-8.5 -9.5q-5 -1 -5 5q0 12 19 15h10zM750 1111q-4 -1 -11.5 6.5t-17.5 4.5q24 11 32 -2q3 -6 -3 -9zM399 684q-4 1 -6 -3t-4.5 -12.5t-5.5 -13.5t-10 -13q-7 -10 -1 -12q4 -1 12.5 7t12.5 18q1 3 2 7t2 6t1.5 4.5t0.5 4v3t-1 2.5t-3 2z M1254 325q0 18 -55 42q4 15 7.5 27.5t5 26t3 21.5t0.5 22.5t-1 19.5t-3.5 22t-4 20.5t-5 25t-5.5 26.5q-10 48 -47 103t-72 75q24 -20 57 -83q87 -162 54 -278q-11 -40 -50 -42q-31 -4 -38.5 18.5t-8 83.5t-11.5 107q-9 39 -19.5 69t-19.5 45.5t-15.5 24.5t-13 15t-7.5 7 q-14 62 -31 103t-29.5 56t-23.5 33t-15 40q-4 21 6 53.5t4.5 49.5t-44.5 25q-15 3 -44.5 18t-35.5 16q-8 1 -11 26t8 51t36 27q37 3 51 -30t4 -58q-11 -19 -2 -26.5t30 -0.5q13 4 13 36v37q-5 30 -13.5 50t-21 30.5t-23.5 15t-27 7.5q-107 -8 -89 -134q0 -15 -1 -15 q-9 9 -29.5 10.5t-33 -0.5t-15.5 5q1 57 -16 90t-45 34q-27 1 -41.5 -27.5t-16.5 -59.5q-1 -15 3.5 -37t13 -37.5t15.5 -13.5q10 3 16 14q4 9 -7 8q-7 0 -15.5 14.5t-9.5 33.5q-1 22 9 37t34 14q17 0 27 -21t9.5 -39t-1.5 -22q-22 -15 -31 -29q-8 -12 -27.5 -23.5 t-20.5 -12.5q-13 -14 -15.5 -27t7.5 -18q14 -8 25 -19.5t16 -19t18.5 -13t35.5 -6.5q47 -2 102 15q2 1 23 7t34.5 10.5t29.5 13t21 17.5q9 14 20 8q5 -3 6.5 -8.5t-3 -12t-16.5 -9.5q-20 -6 -56.5 -21.5t-45.5 -19.5q-44 -19 -70 -23q-25 -5 -79 2q-10 2 -9 -2t17 -19 q25 -23 67 -22q17 1 36 7t36 14t33.5 17.5t30 17t24.5 12t17.5 2.5t8.5 -11q0 -2 -1 -4.5t-4 -5t-6 -4.5t-8.5 -5t-9 -4.5t-10 -5t-9.5 -4.5q-28 -14 -67.5 -44t-66.5 -43t-49 -1q-21 11 -63 73q-22 31 -25 22q-1 -3 -1 -10q0 -25 -15 -56.5t-29.5 -55.5t-21 -58t11.5 -63 q-23 -6 -62.5 -90t-47.5 -141q-2 -18 -1.5 -69t-5.5 -59q-8 -24 -29 -3q-32 31 -36 94q-2 28 4 56q4 19 -1 18l-4 -5q-36 -65 10 -166q5 -12 25 -28t24 -20q20 -23 104 -90.5t93 -76.5q16 -15 17.5 -38t-14 -43t-45.5 -23q8 -15 29 -44.5t28 -54t7 -70.5q46 24 7 92 q-4 8 -10.5 16t-9.5 12t-2 6q3 5 13 9.5t20 -2.5q46 -52 166 -36q133 15 177 87q23 38 34 30q12 -6 10 -52q-1 -25 -23 -92q-9 -23 -6 -37.5t24 -15.5q3 19 14.5 77t13.5 90q2 21 -6.5 73.5t-7.5 97t23 70.5q15 18 51 18q1 37 34.5 53t72.5 10.5t60 -22.5zM626 1152 q3 17 -2.5 30t-11.5 15q-9 2 -9 -7q2 -5 5 -6q10 0 7 -15q-3 -20 8 -20q3 0 3 3zM1045 955q-2 8 -6.5 11.5t-13 5t-14.5 5.5q-5 3 -9.5 8t-7 8t-5.5 6.5t-4 4t-4 -1.5q-14 -16 7 -43.5t39 -31.5q9 -1 14.5 8t3.5 20zM867 1168q0 11 -5 19.5t-11 12.5t-9 3q-14 -1 -7 -7l4 -2 q14 -4 18 -31q0 -3 8 2zM921 1401q0 2 -2.5 5t-9 7t-9.5 6q-15 15 -24 15q-9 -1 -11.5 -7.5t-1 -13t-0.5 -12.5q-1 -4 -6 -10.5t-6 -9t3 -8.5q4 -3 8 0t11 9t15 9q1 1 9 1t15 2t9 7zM1486 60q20 -12 31 -24.5t12 -24t-2.5 -22.5t-15.5 -22t-23.5 -19.5t-30 -18.5 t-31.5 -16.5t-32 -15.5t-27 -13q-38 -19 -85.5 -56t-75.5 -64q-17 -16 -68 -19.5t-89 14.5q-18 9 -29.5 23.5t-16.5 25.5t-22 19.5t-47 9.5q-44 1 -130 1q-19 0 -57 -1.5t-58 -2.5q-44 -1 -79.5 -15t-53.5 -30t-43.5 -28.5t-53.5 -11.5q-29 1 -111 31t-146 43q-19 4 -51 9.5 t-50 9t-39.5 9.5t-33.5 14.5t-17 19.5q-10 23 7 66.5t18 54.5q1 16 -4 40t-10 42.5t-4.5 36.5t10.5 27q14 12 57 14t60 12q30 18 42 35t12 51q21 -73 -32 -106q-32 -20 -83 -15q-34 3 -43 -10q-13 -15 5 -57q2 -6 8 -18t8.5 -18t4.5 -17t1 -22q0 -15 -17 -49t-14 -48 q3 -17 37 -26q20 -6 84.5 -18.5t99.5 -20.5q24 -6 74 -22t82.5 -23t55.5 -4q43 6 64.5 28t23 48t-7.5 58.5t-19 52t-20 36.5q-121 190 -169 242q-68 74 -113 40q-11 -9 -15 15q-3 16 -2 38q1 29 10 52t24 47t22 42q8 21 26.5 72t29.5 78t30 61t39 54q110 143 124 195 q-12 112 -16 310q-2 90 24 151.5t106 104.5q39 21 104 21q53 1 106 -13.5t89 -41.5q57 -42 91.5 -121.5t29.5 -147.5q-5 -95 30 -214q34 -113 133 -218q55 -59 99.5 -163t59.5 -191q8 -49 5 -84.5t-12 -55.5t-20 -22q-10 -2 -23.5 -19t-27 -35.5t-40.5 -33.5t-61 -14 q-18 1 -31.5 5t-22.5 13.5t-13.5 15.5t-11.5 20.5t-9 19.5q-22 37 -41 30t-28 -49t7 -97q20 -70 1 -195q-10 -65 18 -100.5t73 -33t85 35.5q59 49 89.5 66.5t103.5 42.5q53 18 77 36.5t18.5 34.5t-25 28.5t-51.5 23.5q-33 11 -49.5 48t-15 72.5t15.5 47.5q1 -31 8 -56.5 t14.5 -40.5t20.5 -28.5t21 -19t21.5 -13t16.5 -9.5z" /> +<glyph unicode="" d="M1024 36q-42 241 -140 498h-2l-2 -1q-16 -6 -43 -16.5t-101 -49t-137 -82t-131 -114.5t-103 -148l-15 11q184 -150 418 -150q132 0 256 52zM839 643q-21 49 -53 111q-311 -93 -673 -93q-1 -7 -1 -21q0 -124 44 -236.5t124 -201.5q50 89 123.5 166.5t142.5 124.5t130.5 81 t99.5 48l37 13q4 1 13 3.5t13 4.5zM732 855q-120 213 -244 378q-138 -65 -234 -186t-128 -272q302 0 606 80zM1416 536q-210 60 -409 29q87 -239 128 -469q111 75 185 189.5t96 250.5zM611 1277q-1 0 -2 -1q1 1 2 1zM1201 1132q-185 164 -433 164q-76 0 -155 -19 q131 -170 246 -382q69 26 130 60.5t96.5 61.5t65.5 57t37.5 40.5zM1424 647q-3 232 -149 410l-1 -1q-9 -12 -19 -24.5t-43.5 -44.5t-71 -60.5t-100 -65t-131.5 -64.5q25 -53 44 -95q2 -6 6.5 -17.5t7.5 -16.5q36 5 74.5 7t73.5 2t69 -1.5t64 -4t56.5 -5.5t48 -6.5t36.5 -6 t25 -4.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1173 473q0 50 -19.5 91.5t-48.5 68.5t-73 49t-82.5 34t-87.5 23l-104 24q-30 7 -44 10.5t-35 11.5t-30 16t-16.5 21t-7.5 30q0 77 144 77q43 0 77 -12t54 -28.5t38 -33.5t40 -29t48 -12q47 0 75.5 32t28.5 77q0 55 -56 99.5t-142 67.5t-182 23q-68 0 -132 -15.5 t-119.5 -47t-89 -87t-33.5 -128.5q0 -61 19 -106.5t56 -75.5t80 -48.5t103 -32.5l146 -36q90 -22 112 -36q32 -20 32 -60q0 -39 -40 -64.5t-105 -25.5q-51 0 -91.5 16t-65 38.5t-45.5 45t-46 38.5t-54 16q-50 0 -75.5 -30t-25.5 -75q0 -92 122 -157.5t291 -65.5 q73 0 140 18.5t122.5 53.5t88.5 93.5t33 131.5zM1536 256q0 -159 -112.5 -271.5t-271.5 -112.5q-130 0 -234 80q-77 -16 -150 -16q-143 0 -273.5 55.5t-225 150t-150 225t-55.5 273.5q0 73 16 150q-80 104 -80 234q0 159 112.5 271.5t271.5 112.5q130 0 234 -80 q77 16 150 16q143 0 273.5 -55.5t225 -150t150 -225t55.5 -273.5q0 -73 -16 -150q80 -104 80 -234z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1000 1102l37 194q5 23 -9 40t-35 17h-712q-23 0 -38.5 -17t-15.5 -37v-1101q0 -7 6 -1l291 352q23 26 38 33.5t48 7.5h239q22 0 37 14.5t18 29.5q24 130 37 191q4 21 -11.5 40t-36.5 19h-294q-29 0 -48 19t-19 48v42q0 29 19 47.5t48 18.5h346q18 0 35 13.5t20 29.5z M1227 1324q-15 -73 -53.5 -266.5t-69.5 -350t-35 -173.5q-6 -22 -9 -32.5t-14 -32.5t-24.5 -33t-38.5 -21t-58 -10h-271q-13 0 -22 -10q-8 -9 -426 -494q-22 -25 -58.5 -28.5t-48.5 5.5q-55 22 -55 98v1410q0 55 38 102.5t120 47.5h888q95 0 127 -53t10 -159zM1227 1324 l-158 -790q4 17 35 173.5t69.5 350t53.5 266.5z" /> +<glyph unicode="" d="M704 192v1024q0 14 -9 23t-23 9h-480q-14 0 -23 -9t-9 -23v-1024q0 -14 9 -23t23 -9h480q14 0 23 9t9 23zM1376 576v640q0 14 -9 23t-23 9h-480q-14 0 -23 -9t-9 -23v-640q0 -14 9 -23t23 -9h480q14 0 23 9t9 23zM1536 1344v-1408q0 -26 -19 -45t-45 -19h-1408 q-26 0 -45 19t-19 45v1408q0 26 19 45t45 19h1408q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1280 480q0 -40 -28 -68t-68 -28q-51 0 -80 43l-227 341h-45v-132l247 -411q9 -15 9 -33q0 -26 -19 -45t-45 -19h-192v-272q0 -46 -33 -79t-79 -33h-160q-46 0 -79 33t-33 79v272h-192q-26 0 -45 19t-19 45q0 18 9 33l247 411v132h-45l-227 -341q-29 -43 -80 -43 q-40 0 -68 28t-28 68q0 29 16 53l256 384q73 107 176 107h384q103 0 176 -107l256 -384q16 -24 16 -53zM864 1280q0 -93 -65.5 -158.5t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 832v-416q0 -40 -28 -68t-68 -28t-68 28t-28 68v352h-64v-912q0 -46 -33 -79t-79 -33t-79 33t-33 79v464h-64v-464q0 -46 -33 -79t-79 -33t-79 33t-33 79v912h-64v-352q0 -40 -28 -68t-68 -28t-68 28t-28 68v416q0 80 56 136t136 56h640q80 0 136 -56t56 -136z M736 1280q0 -93 -65.5 -158.5t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" d="M773 234l350 473q16 22 24.5 59t-6 85t-61.5 79q-40 26 -83 25.5t-73.5 -17.5t-54.5 -45q-36 -40 -96 -40q-59 0 -95 40q-24 28 -54.5 45t-73.5 17.5t-84 -25.5q-46 -31 -60.5 -79t-6 -85t24.5 -59zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1472 640q0 117 -45.5 223.5t-123 184t-184 123t-223.5 45.5t-223.5 -45.5t-184 -123t-123 -184t-45.5 -223.5t45.5 -223.5t123 -184t184 -123t223.5 -45.5t223.5 45.5t184 123t123 184t45.5 223.5zM1748 363q-4 -15 -20 -20l-292 -96v-306q0 -16 -13 -26q-15 -10 -29 -4 l-292 94l-180 -248q-10 -13 -26 -13t-26 13l-180 248l-292 -94q-14 -6 -29 4q-13 10 -13 26v306l-292 96q-16 5 -20 20q-5 17 4 29l180 248l-180 248q-9 13 -4 29q4 15 20 20l292 96v306q0 16 13 26q15 10 29 4l292 -94l180 248q9 12 26 12t26 -12l180 -248l292 94 q14 6 29 -4q13 -10 13 -26v-306l292 -96q16 -5 20 -20q5 -16 -4 -29l-180 -248l180 -248q9 -12 4 -29z" /> +<glyph unicode="" d="M1262 233q-54 -9 -110 -9q-182 0 -337 90t-245 245t-90 337q0 192 104 357q-201 -60 -328.5 -229t-127.5 -384q0 -130 51 -248.5t136.5 -204t204 -136.5t248.5 -51q144 0 273.5 61.5t220.5 171.5zM1465 318q-94 -203 -283.5 -324.5t-413.5 -121.5q-156 0 -298 61 t-245 164t-164 245t-61 298q0 153 57.5 292.5t156 241.5t235.5 164.5t290 68.5q44 2 61 -39q18 -41 -15 -72q-86 -78 -131.5 -181.5t-45.5 -218.5q0 -148 73 -273t198 -198t273 -73q118 0 228 51q41 18 72 -13q14 -14 17.5 -34t-4.5 -38z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1088 704q0 26 -19 45t-45 19h-256q-26 0 -45 -19t-19 -45t19 -45t45 -19h256q26 0 45 19t19 45zM1664 896v-960q0 -26 -19 -45t-45 -19h-1408q-26 0 -45 19t-19 45v960q0 26 19 45t45 19h1408q26 0 45 -19t19 -45zM1728 1344v-256q0 -26 -19 -45t-45 -19h-1536 q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h1536q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1632 576q0 -26 -19 -45t-45 -19h-224q0 -171 -67 -290l208 -209q19 -19 19 -45t-19 -45q-18 -19 -45 -19t-45 19l-198 197q-5 -5 -15 -13t-42 -28.5t-65 -36.5t-82 -29t-97 -13v896h-128v-896q-51 0 -101.5 13.5t-87 33t-66 39t-43.5 32.5l-15 14l-183 -207 q-20 -21 -48 -21q-24 0 -43 16q-19 18 -20.5 44.5t15.5 46.5l202 227q-58 114 -58 274h-224q-26 0 -45 19t-19 45t19 45t45 19h224v294l-173 173q-19 19 -19 45t19 45t45 19t45 -19l173 -173h844l173 173q19 19 45 19t45 -19t19 -45t-19 -45l-173 -173v-294h224q26 0 45 -19 t19 -45zM1152 1152h-640q0 133 93.5 226.5t226.5 93.5t226.5 -93.5t93.5 -226.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1917 1016q23 -64 -150 -294q-24 -32 -65 -85q-78 -100 -90 -131q-17 -41 14 -81q17 -21 81 -82h1l1 -1l1 -1l2 -2q141 -131 191 -221q3 -5 6.5 -12.5t7 -26.5t-0.5 -34t-25 -27.5t-59 -12.5l-256 -4q-24 -5 -56 5t-52 22l-20 12q-30 21 -70 64t-68.5 77.5t-61 58 t-56.5 15.5q-3 -1 -8 -3.5t-17 -14.5t-21.5 -29.5t-17 -52t-6.5 -77.5q0 -15 -3.5 -27.5t-7.5 -18.5l-4 -5q-18 -19 -53 -22h-115q-71 -4 -146 16.5t-131.5 53t-103 66t-70.5 57.5l-25 24q-10 10 -27.5 30t-71.5 91t-106 151t-122.5 211t-130.5 272q-6 16 -6 27t3 16l4 6 q15 19 57 19l274 2q12 -2 23 -6.5t16 -8.5l5 -3q16 -11 24 -32q20 -50 46 -103.5t41 -81.5l16 -29q29 -60 56 -104t48.5 -68.5t41.5 -38.5t34 -14t27 5q2 1 5 5t12 22t13.5 47t9.5 81t0 125q-2 40 -9 73t-14 46l-6 12q-25 34 -85 43q-13 2 5 24q17 19 38 30q53 26 239 24 q82 -1 135 -13q20 -5 33.5 -13.5t20.5 -24t10.5 -32t3.5 -45.5t-1 -55t-2.5 -70.5t-1.5 -82.5q0 -11 -1 -42t-0.5 -48t3.5 -40.5t11.5 -39t22.5 -24.5q8 -2 17 -4t26 11t38 34.5t52 67t68 107.5q60 104 107 225q4 10 10 17.5t11 10.5l4 3l5 2.5t13 3t20 0.5l288 2 q39 5 64 -2.5t31 -16.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M675 252q21 34 11 69t-45 50q-34 14 -73 1t-60 -46q-22 -34 -13 -68.5t43 -50.5t74.5 -2.5t62.5 47.5zM769 373q8 13 3.5 26.5t-17.5 18.5q-14 5 -28.5 -0.5t-21.5 -18.5q-17 -31 13 -45q14 -5 29 0.5t22 18.5zM943 266q-45 -102 -158 -150t-224 -12 q-107 34 -147.5 126.5t6.5 187.5q47 93 151.5 139t210.5 19q111 -29 158.5 -119.5t2.5 -190.5zM1255 426q-9 96 -89 170t-208.5 109t-274.5 21q-223 -23 -369.5 -141.5t-132.5 -264.5q9 -96 89 -170t208.5 -109t274.5 -21q223 23 369.5 141.5t132.5 264.5zM1563 422 q0 -68 -37 -139.5t-109 -137t-168.5 -117.5t-226 -83t-270.5 -31t-275 33.5t-240.5 93t-171.5 151t-65 199.5q0 115 69.5 245t197.5 258q169 169 341.5 236t246.5 -7q65 -64 20 -209q-4 -14 -1 -20t10 -7t14.5 0.5t13.5 3.5l6 2q139 59 246 59t153 -61q45 -63 0 -178 q-2 -13 -4.5 -20t4.5 -12.5t12 -7.5t17 -6q57 -18 103 -47t80 -81.5t34 -116.5zM1489 1046q42 -47 54.5 -108.5t-6.5 -117.5q-8 -23 -29.5 -34t-44.5 -4q-23 8 -34 29.5t-4 44.5q20 63 -24 111t-107 35q-24 -5 -45 8t-25 37q-5 24 8 44.5t37 25.5q60 13 119 -5.5t101 -65.5z M1670 1209q87 -96 112.5 -222.5t-13.5 -241.5q-9 -27 -34 -40t-52 -4t-40 34t-5 52q28 82 10 172t-80 158q-62 69 -148 95.5t-173 8.5q-28 -6 -52 9.5t-30 43.5t9.5 51.5t43.5 29.5q123 26 244 -11.5t208 -134.5z" /> +<glyph unicode="" d="M1133 -34q-171 -94 -368 -94q-196 0 -367 94q138 87 235.5 211t131.5 268q35 -144 132.5 -268t235.5 -211zM638 1394v-485q0 -252 -126.5 -459.5t-330.5 -306.5q-181 215 -181 495q0 187 83.5 349.5t229.5 269.5t325 137zM1536 638q0 -280 -181 -495 q-204 99 -330.5 306.5t-126.5 459.5v485q179 -30 325 -137t229.5 -269.5t83.5 -349.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1402 433q-32 -80 -76 -138t-91 -88.5t-99 -46.5t-101.5 -14.5t-96.5 8.5t-86.5 22t-69.5 27.5t-46 22.5l-17 10q-113 -228 -289.5 -359.5t-384.5 -132.5q-19 0 -32 13t-13 32t13 31.5t32 12.5q173 1 322.5 107.5t251.5 294.5q-36 -14 -72 -23t-83 -13t-91 2.5t-93 28.5 t-92 59t-84.5 100t-74.5 146q114 47 214 57t167.5 -7.5t124.5 -56.5t88.5 -77t56.5 -82q53 131 79 291q-7 -1 -18 -2.5t-46.5 -2.5t-69.5 0.5t-81.5 10t-88.5 23t-84 42.5t-75 65t-54.5 94.5t-28.5 127.5q70 28 133.5 36.5t112.5 -1t92 -30t73.5 -50t56 -61t42 -63t27.5 -56 t16 -39.5l4 -16q12 122 12 195q-8 6 -21.5 16t-49 44.5t-63.5 71.5t-54 93t-33 112.5t12 127t70 138.5q73 -25 127.5 -61.5t84.5 -76.5t48 -85t20.5 -89t-0.5 -85.5t-13 -76.5t-19 -62t-17 -42l-7 -15q1 -5 1 -50.5t-1 -71.5q3 7 10 18.5t30.5 43t50.5 58t71 55.5t91.5 44.5 t112 14.5t132.5 -24q-2 -78 -21.5 -141.5t-50 -104.5t-69.5 -71.5t-81.5 -45.5t-84.5 -24t-80 -9.5t-67.5 1t-46.5 4.5l-17 3q-23 -147 -73 -283q6 7 18 18.5t49.5 41t77.5 52.5t99.5 42t117.5 20t129 -23.5t137 -77.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1259 283v-66q0 -85 -57.5 -144.5t-138.5 -59.5h-57l-260 -269v269h-529q-81 0 -138.5 59.5t-57.5 144.5v66h1238zM1259 609v-255h-1238v255h1238zM1259 937v-255h-1238v255h1238zM1259 1077v-67h-1238v67q0 84 57.5 143.5t138.5 59.5h846q81 0 138.5 -59.5t57.5 -143.5z " /> +<glyph unicode="" d="M1152 640q0 -14 -9 -23l-320 -320q-9 -9 -23 -9q-13 0 -22.5 9.5t-9.5 22.5v192h-352q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h352v192q0 14 9 23t23 9q12 0 24 -10l319 -319q9 -9 9 -23zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198 t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1152 736v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-352v-192q0 -14 -9 -23t-23 -9q-12 0 -24 10l-319 319q-9 9 -9 23t9 23l320 320q9 9 23 9q13 0 22.5 -9.5t9.5 -22.5v-192h352q13 0 22.5 -9.5t9.5 -22.5zM1312 640q0 148 -73 273t-198 198t-273 73t-273 -73t-198 -198 t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1024 960v-640q0 -26 -19 -45t-45 -19q-20 0 -37 12l-448 320q-27 19 -27 52t27 52l448 320q17 12 37 12q26 0 45 -19t19 -45zM1280 160v960q0 13 -9.5 22.5t-22.5 9.5h-960q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h960q13 0 22.5 9.5t9.5 22.5z M1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M1024 640q0 -106 -75 -181t-181 -75t-181 75t-75 181t75 181t181 75t181 -75t75 -181zM768 1184q-148 0 -273 -73t-198 -198t-73 -273t73 -273t198 -198t273 -73t273 73t198 198t73 273t-73 273t-198 198t-273 73zM1536 640q0 -209 -103 -385.5t-279.5 -279.5 t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1023 349l102 -204q-58 -179 -210 -290t-339 -111q-156 0 -288.5 77.5t-210 210t-77.5 288.5q0 181 104.5 330t274.5 211l17 -131q-122 -54 -195 -165.5t-73 -244.5q0 -185 131.5 -316.5t316.5 -131.5q126 0 232.5 65t165 175.5t49.5 236.5zM1571 249l58 -114l-256 -128 q-13 -7 -29 -7q-40 0 -57 35l-239 477h-472q-24 0 -42.5 16.5t-21.5 40.5l-96 779q-2 16 6 42q14 51 57 82.5t97 31.5q66 0 113 -47t47 -113q0 -69 -52 -117.5t-120 -41.5l37 -289h423v-128h-407l16 -128h455q40 0 57 -35l228 -455z" /> +<glyph unicode="" d="M1292 898q10 216 -161 222q-231 8 -312 -261q44 19 82 19q85 0 74 -96q-4 -57 -74 -167t-105 -110q-43 0 -82 169q-13 54 -45 255q-30 189 -160 177q-59 -7 -164 -100l-81 -72l-81 -72l52 -67q76 52 87 52q57 0 107 -179q15 -55 45 -164.5t45 -164.5q68 -179 164 -179 q157 0 383 294q220 283 226 444zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1152" d="M1152 704q0 -191 -94.5 -353t-256.5 -256.5t-353 -94.5h-160q-14 0 -23 9t-9 23v611l-215 -66q-3 -1 -9 -1q-10 0 -19 6q-13 10 -13 26v128q0 23 23 31l233 71v93l-215 -66q-3 -1 -9 -1q-10 0 -19 6q-13 10 -13 26v128q0 23 23 31l233 71v250q0 14 9 23t23 9h160 q14 0 23 -9t9 -23v-181l375 116q15 5 28 -5t13 -26v-128q0 -23 -23 -31l-393 -121v-93l375 116q15 5 28 -5t13 -26v-128q0 -23 -23 -31l-393 -121v-487q188 13 318 151t130 328q0 14 9 23t23 9h160q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1408" d="M1152 736v-64q0 -14 -9 -23t-23 -9h-352v-352q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v352h-352q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h352v352q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-352h352q14 0 23 -9t9 -23zM1280 288v832q0 66 -47 113t-113 47h-832 q-66 0 -113 -47t-47 -113v-832q0 -66 47 -113t113 -47h832q66 0 113 47t47 113zM1408 1120v-832q0 -119 -84.5 -203.5t-203.5 -84.5h-832q-119 0 -203.5 84.5t-84.5 203.5v832q0 119 84.5 203.5t203.5 84.5h832q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2176" d="M620 416q-110 -64 -268 -64h-128v64h-64q-13 0 -22.5 23.5t-9.5 56.5q0 24 7 49q-58 2 -96.5 10.5t-38.5 20.5t38.5 20.5t96.5 10.5q-7 25 -7 49q0 33 9.5 56.5t22.5 23.5h64v64h128q158 0 268 -64h1113q42 -7 106.5 -18t80.5 -14q89 -15 150 -40.5t83.5 -47.5t22.5 -40 t-22.5 -40t-83.5 -47.5t-150 -40.5q-16 -3 -80.5 -14t-106.5 -18h-1113zM1739 668q53 -36 53 -92t-53 -92l81 -30q68 48 68 122t-68 122zM625 400h1015q-217 -38 -456 -80q-57 0 -113 -24t-83 -48l-28 -24l-288 -288q-26 -26 -70.5 -45t-89.5 -19h-96l-93 464h29 q157 0 273 64zM352 816h-29l93 464h96q46 0 90 -19t70 -45l288 -288q4 -4 11 -10.5t30.5 -23t48.5 -29t61.5 -23t72.5 -10.5l456 -80h-1015q-116 64 -273 64z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1519 760q62 0 103.5 -40.5t41.5 -101.5q0 -97 -93 -130l-172 -59l56 -167q7 -21 7 -47q0 -59 -42 -102t-101 -43q-47 0 -85.5 27t-53.5 72l-55 165l-310 -106l55 -164q8 -24 8 -47q0 -59 -42 -102t-102 -43q-47 0 -85 27t-53 72l-55 163l-153 -53q-29 -9 -50 -9 q-61 0 -101.5 40t-40.5 101q0 47 27.5 85t71.5 53l156 53l-105 313l-156 -54q-26 -8 -48 -8q-60 0 -101 40.5t-41 100.5q0 47 27.5 85t71.5 53l157 53l-53 159q-8 24 -8 47q0 60 42 102.5t102 42.5q47 0 85 -27t53 -72l54 -160l310 105l-54 160q-8 24 -8 47q0 59 42.5 102 t101.5 43q47 0 85.5 -27.5t53.5 -71.5l53 -161l162 55q21 6 43 6q60 0 102.5 -39.5t42.5 -98.5q0 -45 -30 -81.5t-74 -51.5l-157 -54l105 -316l164 56q24 8 46 8zM725 498l310 105l-105 315l-310 -107z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960zM1280 352v436q-31 -35 -64 -55q-34 -22 -132.5 -85t-151.5 -99q-98 -69 -164 -69v0v0q-66 0 -164 69 q-46 32 -141.5 92.5t-142.5 92.5q-12 8 -33 27t-31 27v-436q0 -40 28 -68t68 -28h832q40 0 68 28t28 68zM1280 925q0 41 -27.5 70t-68.5 29h-832q-40 0 -68 -28t-28 -68q0 -37 30.5 -76.5t67.5 -64.5q47 -32 137.5 -89t129.5 -83q3 -2 17 -11.5t21 -14t21 -13t23.5 -13 t21.5 -9.5t22.5 -7.5t20.5 -2.5t20.5 2.5t22.5 7.5t21.5 9.5t23.5 13t21 13t21 14t17 11.5l267 174q35 23 66.5 62.5t31.5 73.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M127 640q0 163 67 313l367 -1005q-196 95 -315 281t-119 411zM1415 679q0 -19 -2.5 -38.5t-10 -49.5t-11.5 -44t-17.5 -59t-17.5 -58l-76 -256l-278 826q46 3 88 8q19 2 26 18.5t-2.5 31t-28.5 13.5l-205 -10q-75 1 -202 10q-12 1 -20.5 -5t-11.5 -15t-1.5 -18.5t9 -16.5 t19.5 -8l80 -8l120 -328l-168 -504l-280 832q46 3 88 8q19 2 26 18.5t-2.5 31t-28.5 13.5l-205 -10q-7 0 -23 0.5t-26 0.5q105 160 274.5 253.5t367.5 93.5q147 0 280.5 -53t238.5 -149h-10q-55 0 -92 -40.5t-37 -95.5q0 -12 2 -24t4 -21.5t8 -23t9 -21t12 -22.5t12.5 -21 t14.5 -24t14 -23q63 -107 63 -212zM909 573l237 -647q1 -6 5 -11q-126 -44 -255 -44q-112 0 -217 32zM1570 1009q95 -174 95 -369q0 -209 -104 -385.5t-279 -278.5l235 678q59 169 59 276q0 42 -6 79zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286 t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM896 -215q173 0 331.5 68t273 182.5t182.5 273t68 331.5t-68 331.5t-182.5 273t-273 182.5t-331.5 68t-331.5 -68t-273 -182.5t-182.5 -273t-68 -331.5t68 -331.5t182.5 -273 t273 -182.5t331.5 -68z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1086 1536v-1536l-272 -128q-228 20 -414 102t-293 208.5t-107 272.5q0 140 100.5 263.5t275 205.5t391.5 108v-172q-217 -38 -356.5 -150t-139.5 -255q0 -152 154.5 -267t388.5 -145v1360zM1755 954l37 -390l-525 114l147 83q-119 70 -280 99v172q277 -33 481 -157z" /> +<glyph unicode="" horiz-adv-x="2048" d="M960 1536l960 -384v-128h-128q0 -26 -20.5 -45t-48.5 -19h-1526q-28 0 -48.5 19t-20.5 45h-128v128zM256 896h256v-768h128v768h256v-768h128v768h256v-768h128v768h256v-768h59q28 0 48.5 -19t20.5 -45v-64h-1664v64q0 26 20.5 45t48.5 19h59v768zM1851 -64 q28 0 48.5 -19t20.5 -45v-128h-1920v128q0 26 20.5 45t48.5 19h1782z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1774 700l18 -316q4 -69 -82 -128t-235 -93.5t-323 -34.5t-323 34.5t-235 93.5t-82 128l18 316l574 -181q22 -7 48 -7t48 7zM2304 1024q0 -23 -22 -31l-1120 -352q-4 -1 -10 -1t-10 1l-652 206q-43 -34 -71 -111.5t-34 -178.5q63 -36 63 -109q0 -69 -58 -107l58 -433 q2 -14 -8 -25q-9 -11 -24 -11h-192q-15 0 -24 11q-10 11 -8 25l58 433q-58 38 -58 107q0 73 65 111q11 207 98 330l-333 104q-22 8 -22 31t22 31l1120 352q4 1 10 1t10 -1l1120 -352q22 -8 22 -31z" /> +<glyph unicode="" d="M859 579l13 -707q-62 11 -105 11q-41 0 -105 -11l13 707q-40 69 -168.5 295.5t-216.5 374.5t-181 287q58 -15 108 -15q43 0 111 15q63 -111 133.5 -229.5t167 -276.5t138.5 -227q37 61 109.5 177.5t117.5 190t105 176t107 189.5q54 -14 107 -14q56 0 114 14v0 q-28 -39 -60 -88.5t-49.5 -78.5t-56.5 -96t-49 -84q-146 -248 -353 -610z" /> +<glyph unicode="" d="M768 750h725q12 -67 12 -128q0 -217 -91 -387.5t-259.5 -266.5t-386.5 -96q-157 0 -299 60.5t-245 163.5t-163.5 245t-60.5 299t60.5 299t163.5 245t245 163.5t299 60.5q300 0 515 -201l-209 -201q-123 119 -306 119q-129 0 -238.5 -65t-173.5 -176.5t-64 -243.5 t64 -243.5t173.5 -176.5t238.5 -65q87 0 160 24t120 60t82 82t51.5 87t22.5 78h-436v264z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1095 369q16 -16 0 -31q-62 -62 -199 -62t-199 62q-16 15 0 31q6 6 15 6t15 -6q48 -49 169 -49q120 0 169 49q6 6 15 6t15 -6zM788 550q0 -37 -26 -63t-63 -26t-63.5 26t-26.5 63q0 38 26.5 64t63.5 26t63 -26.5t26 -63.5zM1183 550q0 -37 -26.5 -63t-63.5 -26t-63 26 t-26 63t26 63.5t63 26.5t63.5 -26t26.5 -64zM1434 670q0 49 -35 84t-85 35t-86 -36q-130 90 -311 96l63 283l200 -45q0 -37 26 -63t63 -26t63.5 26.5t26.5 63.5t-26.5 63.5t-63.5 26.5q-54 0 -80 -50l-221 49q-19 5 -25 -16l-69 -312q-180 -7 -309 -97q-35 37 -87 37 q-50 0 -85 -35t-35 -84q0 -35 18.5 -64t49.5 -44q-6 -27 -6 -56q0 -142 140 -243t337 -101q198 0 338 101t140 243q0 32 -7 57q30 15 48 43.5t18 63.5zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191 t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" d="M939 407q13 -13 0 -26q-53 -53 -171 -53t-171 53q-13 13 0 26q5 6 13 6t13 -6q42 -42 145 -42t145 42q5 6 13 6t13 -6zM676 563q0 -31 -23 -54t-54 -23t-54 23t-23 54q0 32 22.5 54.5t54.5 22.5t54.5 -22.5t22.5 -54.5zM1014 563q0 -31 -23 -54t-54 -23t-54 23t-23 54 q0 32 22.5 54.5t54.5 22.5t54.5 -22.5t22.5 -54.5zM1229 666q0 42 -30 72t-73 30q-42 0 -73 -31q-113 78 -267 82l54 243l171 -39q1 -32 23.5 -54t53.5 -22q32 0 54.5 22.5t22.5 54.5t-22.5 54.5t-54.5 22.5q-48 0 -69 -43l-189 42q-17 5 -21 -13l-60 -268q-154 -6 -265 -83 q-30 32 -74 32q-43 0 -73 -30t-30 -72q0 -30 16 -55t42 -38q-5 -25 -5 -48q0 -122 120 -208.5t289 -86.5q170 0 290 86.5t120 208.5q0 25 -6 49q25 13 40.5 37.5t15.5 54.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960 q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" d="M866 697l90 27v62q0 79 -58 135t-138 56t-138 -55.5t-58 -134.5v-283q0 -20 -14 -33.5t-33 -13.5t-32.5 13.5t-13.5 33.5v120h-151v-122q0 -82 57.5 -139t139.5 -57q81 0 138.5 56.5t57.5 136.5v280q0 19 13.5 33t33.5 14q19 0 32.5 -14t13.5 -33v-54zM1199 502v122h-150 v-126q0 -20 -13.5 -33.5t-33.5 -13.5q-19 0 -32.5 14t-13.5 33v123l-90 -26l-60 28v-123q0 -80 58 -137t139 -57t138.5 57t57.5 139zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103 t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1062 824v118q0 42 -30 72t-72 30t-72 -30t-30 -72v-612q0 -175 -126 -299t-303 -124q-178 0 -303.5 125.5t-125.5 303.5v266h328v-262q0 -43 30 -72.5t72 -29.5t72 29.5t30 72.5v620q0 171 126.5 292t301.5 121q176 0 302 -122t126 -294v-136l-195 -58zM1592 602h328 v-266q0 -178 -125.5 -303.5t-303.5 -125.5q-177 0 -303 124.5t-126 300.5v268l131 -61l195 58v-270q0 -42 30 -71.5t72 -29.5t72 29.5t30 71.5v275z" /> +<glyph unicode="" d="M1472 160v480h-704v704h-480q-93 0 -158.5 -65.5t-65.5 -158.5v-480h704v-704h480q93 0 158.5 65.5t65.5 158.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5 t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M328 1254h204v-983h-532v697h328v286zM328 435v369h-123v-369h123zM614 968v-697h205v697h-205zM614 1254v-204h205v204h-205zM901 968h533v-942h-533v163h328v82h-328v697zM1229 435v369h-123v-369h123zM1516 968h532v-942h-532v163h327v82h-327v697zM1843 435v369h-123 v-369h123z" /> +<glyph unicode="" d="M1046 516q0 -64 -38 -109t-91 -45q-43 0 -70 15v277q28 17 70 17q53 0 91 -45.5t38 -109.5zM703 944q0 -64 -38 -109.5t-91 -45.5q-43 0 -70 15v277q28 17 70 17q53 0 91 -45t38 -109zM1265 513q0 134 -88 229t-213 95q-20 0 -39 -3q-23 -78 -78 -136q-87 -95 -211 -101 v-636l211 41v206q51 -19 117 -19q125 0 213 95t88 229zM922 940q0 134 -88.5 229t-213.5 95q-74 0 -141 -36h-186v-840l211 41v206q55 -19 116 -19q125 0 213.5 95t88.5 229zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960 q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2038" d="M1222 607q75 3 143.5 -20.5t118 -58.5t101 -94.5t84 -108t75.5 -120.5q33 -56 78.5 -109t75.5 -80.5t99 -88.5q-48 -30 -108.5 -57.5t-138.5 -59t-114 -47.5q-44 37 -74 115t-43.5 164.5t-33 180.5t-42.5 168.5t-72.5 123t-122.5 48.5l-10 -2l-6 -4q4 -5 13 -14 q6 -5 28 -23.5t25.5 -22t19 -18t18 -20.5t11.5 -21t10.5 -27.5t4.5 -31t4 -40.5l1 -33q1 -26 -2.5 -57.5t-7.5 -52t-12.5 -58.5t-11.5 -53q-35 1 -101 -9.5t-98 -10.5q-39 0 -72 10q-2 16 -2 47q0 74 3 96q2 13 31.5 41.5t57 59t26.5 51.5q-24 2 -43 -24 q-36 -53 -111.5 -99.5t-136.5 -46.5q-25 0 -75.5 63t-106.5 139.5t-84 96.5q-6 4 -27 30q-482 -112 -513 -112q-16 0 -28 11t-12 27q0 15 8.5 26.5t22.5 14.5l486 106q-8 14 -8 25t5.5 17.5t16 11.5t20 7t23 4.5t18.5 4.5q4 1 15.5 7.5t17.5 6.5q15 0 28 -16t20 -33 q163 37 172 37q17 0 29.5 -11t12.5 -28q0 -15 -8.5 -26t-23.5 -14l-182 -40l-1 -16q-1 -26 81.5 -117.5t104.5 -91.5q47 0 119 80t72 129q0 36 -23.5 53t-51 18.5t-51 11.5t-23.5 34q0 16 10 34l-68 19q43 44 43 117q0 26 -5 58q82 16 144 16q44 0 71.5 -1.5t48.5 -8.5 t31 -13.5t20.5 -24.5t15.5 -33.5t17 -47.5t24 -60l50 25q-3 -40 -23 -60t-42.5 -21t-40 -6.5t-16.5 -20.5zM1282 842q-5 5 -13.5 15.5t-12 14.5t-10.5 11.5t-10 10.5l-8 8t-8.5 7.5t-8 5t-8.5 4.5q-7 3 -14.5 5t-20.5 2.5t-22 0.5h-32.5h-37.5q-126 0 -217 -43 q16 30 36 46.5t54 29.5t65.5 36t46 36.5t50 55t43.5 50.5q12 -9 28 -31.5t32 -36.5t38 -13l12 1v-76l22 -1q247 95 371 190q28 21 50 39t42.5 37.5t33 31t29.5 34t24 31t24.5 37t23 38t27 47.5t29.5 53l7 9q-2 -53 -43 -139q-79 -165 -205 -264t-306 -142q-14 -3 -42 -7.5 t-50 -9.5t-39 -14q3 -19 24.5 -46t21.5 -34q0 -11 -26 -30zM1061 -79q39 26 131.5 47.5t146.5 21.5q9 0 22.5 -15.5t28 -42.5t26 -50t24 -51t14.5 -33q-121 -45 -244 -45q-61 0 -125 11zM822 568l48 12l109 -177l-73 -48zM1323 51q3 -15 3 -16q0 -7 -17.5 -14.5t-46 -13 t-54 -9.5t-53.5 -7.5t-32 -4.5l-7 43q21 2 60.5 8.5t72 10t60.5 3.5h14zM866 679l-96 -20l-6 17q10 1 32.5 7t34.5 6q19 0 35 -10zM1061 45h31l10 -83l-41 -12v95zM1950 1535v1v-1zM1950 1535l-1 -5l-2 -2l1 3zM1950 1535l1 1z" /> +<glyph unicode="" d="M1167 -50q-5 19 -24 5q-30 -22 -87 -39t-131 -17q-129 0 -193 49q-5 4 -13 4q-11 0 -26 -12q-7 -6 -7.5 -16t7.5 -20q34 -32 87.5 -46t102.5 -12.5t99 4.5q41 4 84.5 20.5t65 30t28.5 20.5q12 12 7 29zM1128 65q-19 47 -39 61q-23 15 -76 15q-47 0 -71 -10 q-29 -12 -78 -56q-26 -24 -12 -44q9 -8 17.5 -4.5t31.5 23.5q3 2 10.5 8.5t10.5 8.5t10 7t11.5 7t12.5 5t15 4.5t16.5 2.5t20.5 1q27 0 44.5 -7.5t23 -14.5t13.5 -22q10 -17 12.5 -20t12.5 1q23 12 14 34zM1483 346q0 22 -5 44.5t-16.5 45t-34 36.5t-52.5 14 q-33 0 -97 -41.5t-129 -83.5t-101 -42q-27 -1 -63.5 19t-76 49t-83.5 58t-100 49t-111 19q-115 -1 -197 -78.5t-84 -178.5q-2 -112 74 -164q29 -20 62.5 -28.5t103.5 -8.5q57 0 132 32.5t134 71t120 70.5t93 31q26 -1 65 -31.5t71.5 -67t68 -67.5t55.5 -32q35 -3 58.5 14 t55.5 63q28 41 42.5 101t14.5 106zM1536 506q0 -164 -62 -304.5t-166 -236t-242.5 -149.5t-290.5 -54t-293 57.5t-247.5 157t-170.5 241.5t-64 302q0 89 19.5 172.5t49 145.5t70.5 118.5t78.5 94t78.5 69.5t64.5 46.5t42.5 24.5q14 8 51 26.5t54.5 28.5t48 30t60.5 44 q36 28 58 72.5t30 125.5q129 -155 186 -193q44 -29 130 -68t129 -66q21 -13 39 -25t60.5 -46.5t76 -70.5t75 -95t69 -122t47 -148.5t19.5 -177.5z" /> +<glyph unicode="" d="M1070 463l-160 -160l-151 -152l-30 -30q-65 -64 -151.5 -87t-171.5 -2q-16 -70 -72 -115t-129 -45q-85 0 -145 60.5t-60 145.5q0 72 44.5 128t113.5 72q-22 86 1 173t88 152l12 12l151 -152l-11 -11q-37 -37 -37 -89t37 -90q37 -37 89 -37t89 37l30 30l151 152l161 160z M729 1145l12 -12l-152 -152l-12 12q-37 37 -89 37t-89 -37t-37 -89.5t37 -89.5l29 -29l152 -152l160 -160l-151 -152l-161 160l-151 152l-30 30q-68 67 -90 159.5t5 179.5q-70 15 -115 71t-45 129q0 85 60 145.5t145 60.5q76 0 133.5 -49t69.5 -123q84 20 169.5 -3.5 t149.5 -87.5zM1536 78q0 -85 -60 -145.5t-145 -60.5q-74 0 -131 47t-71 118q-86 -28 -179.5 -6t-161.5 90l-11 12l151 152l12 -12q37 -37 89 -37t89 37t37 89t-37 89l-30 30l-152 152l-160 160l152 152l160 -160l152 -152l29 -30q64 -64 87.5 -150.5t2.5 -171.5 q76 -11 126.5 -68.5t50.5 -134.5zM1534 1202q0 -77 -51 -135t-127 -69q26 -85 3 -176.5t-90 -158.5l-12 -12l-151 152l12 12q37 37 37 89t-37 89t-89 37t-89 -37l-30 -30l-152 -152l-160 -160l-152 152l161 160l152 152l29 30q67 67 159 89.5t178 -3.5q11 75 68.5 126 t135.5 51q85 0 145 -60.5t60 -145.5z" /> +<glyph unicode="" d="M654 458q-1 -3 -12.5 0.5t-31.5 11.5l-20 9q-44 20 -87 49q-7 5 -41 31.5t-38 28.5q-67 -103 -134 -181q-81 -95 -105 -110q-4 -2 -19.5 -4t-18.5 0q6 4 82 92q21 24 85.5 115t78.5 118q17 30 51 98.5t36 77.5q-8 1 -110 -33q-8 -2 -27.5 -7.5t-34.5 -9.5t-17 -5 q-2 -2 -2 -10.5t-1 -9.5q-5 -10 -31 -15q-23 -7 -47 0q-18 4 -28 21q-4 6 -5 23q6 2 24.5 5t29.5 6q58 16 105 32q100 35 102 35q10 2 43 19.5t44 21.5q9 3 21.5 8t14.5 5.5t6 -0.5q2 -12 -1 -33q0 -2 -12.5 -27t-26.5 -53.5t-17 -33.5q-25 -50 -77 -131l64 -28 q12 -6 74.5 -32t67.5 -28q4 -1 10.5 -25.5t4.5 -30.5zM449 944q3 -15 -4 -28q-12 -23 -50 -38q-30 -12 -60 -12q-26 3 -49 26q-14 15 -18 41l1 3q3 -3 19.5 -5t26.5 0t58 16q36 12 55 14q17 0 21 -17zM1147 815l63 -227l-139 42zM39 15l694 232v1032l-694 -233v-1031z M1280 332l102 -31l-181 657l-100 31l-216 -536l102 -31l45 110l211 -65zM777 1294l573 -184v380zM1088 -29l158 -13l-54 -160l-40 66q-130 -83 -276 -108q-58 -12 -91 -12h-84q-79 0 -199.5 39t-183.5 85q-8 7 -8 16q0 8 5 13.5t13 5.5q4 0 18 -7.5t30.5 -16.5t20.5 -11 q73 -37 159.5 -61.5t157.5 -24.5q95 0 167 14.5t157 50.5q15 7 30.5 15.5t34 19t28.5 16.5zM1536 1050v-1079l-774 246q-14 -6 -375 -127.5t-368 -121.5q-13 0 -18 13q0 1 -1 3v1078q3 9 4 10q5 6 20 11q106 35 149 50v384l558 -198q2 0 160.5 55t316 108.5t161.5 53.5 q20 0 20 -21v-418z" /> +<glyph unicode="" horiz-adv-x="1792" d="M288 1152q66 0 113 -47t47 -113v-1088q0 -66 -47 -113t-113 -47h-128q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h128zM1664 989q58 -34 93 -93t35 -128v-768q0 -106 -75 -181t-181 -75h-864q-66 0 -113 47t-47 113v1536q0 40 28 68t68 28h672q40 0 88 -20t76 -48 l152 -152q28 -28 48 -76t20 -88v-163zM928 0v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM928 256v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM928 512v128q0 14 -9 23 t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1184 0v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1184 256v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128 q14 0 23 9t9 23zM1184 512v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1440 0v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1440 256v128q0 14 -9 23t-23 9h-128 q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1440 512v128q0 14 -9 23t-23 9h-128q-14 0 -23 -9t-9 -23v-128q0 -14 9 -23t23 -9h128q14 0 23 9t9 23zM1536 896v256h-160q-40 0 -68 28t-28 68v160h-640v-512h896z" /> +<glyph unicode="" d="M1344 1536q26 0 45 -19t19 -45v-1664q0 -26 -19 -45t-45 -19h-1280q-26 0 -45 19t-19 45v1664q0 26 19 45t45 19h1280zM512 1248v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM512 992v-64q0 -14 9 -23t23 -9h64q14 0 23 9 t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM512 736v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM512 480v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM384 160v64 q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM384 416v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM384 672v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64 q14 0 23 9t9 23zM384 928v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM384 1184v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 -96v192q0 14 -9 23t-23 9h-320q-14 0 -23 -9 t-9 -23v-192q0 -14 9 -23t23 -9h320q14 0 23 9t9 23zM896 416v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 672v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 928v64 q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM896 1184v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 160v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64 q14 0 23 9t9 23zM1152 416v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 672v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 928v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9 t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1152 1184v64q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-64q0 -14 9 -23t23 -9h64q14 0 23 9t9 23z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1188 988l-292 -292v-824q0 -46 -33 -79t-79 -33t-79 33t-33 79v384h-64v-384q0 -46 -33 -79t-79 -33t-79 33t-33 79v824l-292 292q-28 28 -28 68t28 68t68 28t68 -28l228 -228h368l228 228q28 28 68 28t68 -28t28 -68t-28 -68zM864 1152q0 -93 -65.5 -158.5 t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M780 1064q0 -60 -19 -113.5t-63 -92.5t-105 -39q-76 0 -138 57.5t-92 135.5t-30 151q0 60 19 113.5t63 92.5t105 39q77 0 138.5 -57.5t91.5 -135t30 -151.5zM438 581q0 -80 -42 -139t-119 -59q-76 0 -141.5 55.5t-100.5 133.5t-35 152q0 80 42 139.5t119 59.5 q76 0 141.5 -55.5t100.5 -134t35 -152.5zM832 608q118 0 255 -97.5t229 -237t92 -254.5q0 -46 -17 -76.5t-48.5 -45t-64.5 -20t-76 -5.5q-68 0 -187.5 45t-182.5 45q-66 0 -192.5 -44.5t-200.5 -44.5q-183 0 -183 146q0 86 56 191.5t139.5 192.5t187.5 146t193 59zM1071 819 q-61 0 -105 39t-63 92.5t-19 113.5q0 74 30 151.5t91.5 135t138.5 57.5q61 0 105 -39t63 -92.5t19 -113.5q0 -73 -30 -151t-92 -135.5t-138 -57.5zM1503 923q77 0 119 -59.5t42 -139.5q0 -74 -35 -152t-100.5 -133.5t-141.5 -55.5q-77 0 -119 59t-42 139q0 74 35 152.5 t100.5 134t141.5 55.5z" /> +<glyph unicode="" horiz-adv-x="768" d="M704 1008q0 -145 -57 -243.5t-152 -135.5l45 -821q2 -26 -16 -45t-44 -19h-192q-26 0 -44 19t-16 45l45 821q-95 37 -152 135.5t-57 243.5q0 128 42.5 249.5t117.5 200t160 78.5t160 -78.5t117.5 -200t42.5 -249.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 -93l640 349v636l-640 -233v-752zM832 772l698 254l-698 254l-698 -254zM1664 1024v-768q0 -35 -18 -65t-49 -47l-704 -384q-28 -16 -61 -16t-61 16l-704 384q-31 17 -49 47t-18 65v768q0 40 23 73t61 47l704 256q22 8 44 8t44 -8l704 -256q38 -14 61 -47t23 -73z " /> +<glyph unicode="" horiz-adv-x="2304" d="M640 -96l384 192v314l-384 -164v-342zM576 358l404 173l-404 173l-404 -173zM1664 -96l384 192v314l-384 -164v-342zM1600 358l404 173l-404 173l-404 -173zM1152 651l384 165v266l-384 -164v-267zM1088 1030l441 189l-441 189l-441 -189zM2176 512v-416q0 -36 -19 -67 t-52 -47l-448 -224q-25 -14 -57 -14t-57 14l-448 224q-5 2 -7 4q-2 -2 -7 -4l-448 -224q-25 -14 -57 -14t-57 14l-448 224q-33 16 -52 47t-19 67v416q0 38 21.5 70t56.5 48l434 186v400q0 38 21.5 70t56.5 48l448 192q23 10 50 10t50 -10l448 -192q35 -16 56.5 -48t21.5 -70 v-400l434 -186q36 -16 57 -48t21 -70z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1848 1197h-511v-124h511v124zM1596 771q-90 0 -146 -52.5t-62 -142.5h408q-18 195 -200 195zM1612 186q63 0 122 32t76 87h221q-100 -307 -427 -307q-214 0 -340.5 132t-126.5 347q0 208 130.5 345.5t336.5 137.5q138 0 240.5 -68t153 -179t50.5 -248q0 -17 -2 -47h-658 q0 -111 57.5 -171.5t166.5 -60.5zM277 236h296q205 0 205 167q0 180 -199 180h-302v-347zM277 773h281q78 0 123.5 36.5t45.5 113.5q0 144 -190 144h-260v-294zM0 1282h594q87 0 155 -14t126.5 -47.5t90 -96.5t31.5 -154q0 -181 -172 -263q114 -32 172 -115t58 -204 q0 -75 -24.5 -136.5t-66 -103.5t-98.5 -71t-121 -42t-134 -13h-611v1260z" /> +<glyph unicode="" d="M1248 1408q119 0 203.5 -84.5t84.5 -203.5v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960zM499 1041h-371v-787h382q117 0 197 57.5t80 170.5q0 158 -143 200q107 52 107 164q0 57 -19.5 96.5 t-56.5 60.5t-79 29.5t-97 8.5zM477 723h-176v184h163q119 0 119 -90q0 -94 -106 -94zM486 388h-185v217h189q124 0 124 -113q0 -104 -128 -104zM1136 356q-68 0 -104 38t-36 107h411q1 10 1 30q0 132 -74.5 220.5t-203.5 88.5q-128 0 -210 -86t-82 -216q0 -135 79 -217 t213 -82q205 0 267 191h-138q-11 -34 -47.5 -54t-75.5 -20zM1126 722q113 0 124 -122h-254q4 56 39 89t91 33zM964 988h319v-77h-319v77z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1582 954q0 -101 -71.5 -172.5t-172.5 -71.5t-172.5 71.5t-71.5 172.5t71.5 172.5t172.5 71.5t172.5 -71.5t71.5 -172.5zM812 212q0 104 -73 177t-177 73q-27 0 -54 -6l104 -42q77 -31 109.5 -106.5t1.5 -151.5q-31 -77 -107 -109t-152 -1q-21 8 -62 24.5t-61 24.5 q32 -60 91 -96.5t130 -36.5q104 0 177 73t73 177zM1642 953q0 126 -89.5 215.5t-215.5 89.5q-127 0 -216.5 -89.5t-89.5 -215.5q0 -127 89.5 -216t216.5 -89q126 0 215.5 89t89.5 216zM1792 953q0 -189 -133.5 -322t-321.5 -133l-437 -319q-12 -129 -109 -218t-229 -89 q-121 0 -214 76t-118 192l-230 92v429l389 -157q79 48 173 48q13 0 35 -2l284 407q2 187 135.5 319t320.5 132q188 0 321.5 -133.5t133.5 -321.5z" /> +<glyph unicode="" d="M1242 889q0 80 -57 136.5t-137 56.5t-136.5 -57t-56.5 -136q0 -80 56.5 -136.5t136.5 -56.5t137 56.5t57 136.5zM632 301q0 -83 -58 -140.5t-140 -57.5q-56 0 -103 29t-72 77q52 -20 98 -40q60 -24 120 1.5t85 86.5q24 60 -1.5 120t-86.5 84l-82 33q22 5 42 5 q82 0 140 -57.5t58 -140.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v153l172 -69q20 -92 93.5 -152t168.5 -60q104 0 181 70t87 173l345 252q150 0 255.5 105.5t105.5 254.5q0 150 -105.5 255.5t-255.5 105.5 q-148 0 -253 -104.5t-107 -252.5l-225 -322q-9 1 -28 1q-75 0 -137 -37l-297 119v468q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5zM1289 887q0 -100 -71 -170.5t-171 -70.5t-170.5 70.5t-70.5 170.5t70.5 171t170.5 71q101 0 171.5 -70.5t70.5 -171.5z " /> +<glyph unicode="" horiz-adv-x="1792" d="M836 367l-15 -368l-2 -22l-420 29q-36 3 -67 31.5t-47 65.5q-11 27 -14.5 55t4 65t12 55t21.5 64t19 53q78 -12 509 -28zM449 953l180 -379l-147 92q-63 -72 -111.5 -144.5t-72.5 -125t-39.5 -94.5t-18.5 -63l-4 -21l-190 357q-17 26 -18 56t6 47l8 18q35 63 114 188 l-140 86zM1680 436l-188 -359q-12 -29 -36.5 -46.5t-43.5 -20.5l-18 -4q-71 -7 -219 -12l8 -164l-230 367l211 362l7 -173q170 -16 283 -5t170 33zM895 1360q-47 -63 -265 -435l-317 187l-19 12l225 356q20 31 60 45t80 10q24 -2 48.5 -12t42 -21t41.5 -33t36 -34.5 t36 -39.5t32 -35zM1550 1053l212 -363q18 -37 12.5 -76t-27.5 -74q-13 -20 -33 -37t-38 -28t-48.5 -22t-47 -16t-51.5 -14t-46 -12q-34 72 -265 436l313 195zM1407 1279l142 83l-220 -373l-419 20l151 86q-34 89 -75 166t-75.5 123.5t-64.5 80t-47 46.5l-17 13l405 -1 q31 3 58 -10.5t39 -28.5l11 -15q39 -61 112 -190z" /> +<glyph unicode="" horiz-adv-x="2048" d="M480 448q0 66 -47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47t113 47t47 113zM516 768h1016l-89 357q-2 8 -14 17.5t-21 9.5h-768q-9 0 -21 -9.5t-14 -17.5zM1888 448q0 66 -47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47t113 47t47 113zM2048 544v-384 q0 -14 -9 -23t-23 -9h-96v-128q0 -80 -56 -136t-136 -56t-136 56t-56 136v128h-1024v-128q0 -80 -56 -136t-136 -56t-136 56t-56 136v128h-96q-14 0 -23 9t-9 23v384q0 93 65.5 158.5t158.5 65.5h28l105 419q23 94 104 157.5t179 63.5h768q98 0 179 -63.5t104 -157.5 l105 -419h28q93 0 158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1824 640q93 0 158.5 -65.5t65.5 -158.5v-384q0 -14 -9 -23t-23 -9h-96v-64q0 -80 -56 -136t-136 -56t-136 56t-56 136v64h-1024v-64q0 -80 -56 -136t-136 -56t-136 56t-56 136v64h-96q-14 0 -23 9t-9 23v384q0 93 65.5 158.5t158.5 65.5h28l105 419q23 94 104 157.5 t179 63.5h128v224q0 14 9 23t23 9h448q14 0 23 -9t9 -23v-224h128q98 0 179 -63.5t104 -157.5l105 -419h28zM320 160q66 0 113 47t47 113t-47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47zM516 640h1016l-89 357q-2 8 -14 17.5t-21 9.5h-768q-9 0 -21 -9.5t-14 -17.5z M1728 160q66 0 113 47t47 113t-47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47z" /> +<glyph unicode="" d="M1504 64q0 -26 -19 -45t-45 -19h-462q1 -17 6 -87.5t5 -108.5q0 -25 -18 -42.5t-43 -17.5h-320q-25 0 -43 17.5t-18 42.5q0 38 5 108.5t6 87.5h-462q-26 0 -45 19t-19 45t19 45l402 403h-229q-26 0 -45 19t-19 45t19 45l402 403h-197q-26 0 -45 19t-19 45t19 45l384 384 q19 19 45 19t45 -19l384 -384q19 -19 19 -45t-19 -45t-45 -19h-197l402 -403q19 -19 19 -45t-19 -45t-45 -19h-229l402 -403q19 -19 19 -45z" /> +<glyph unicode="" d="M1127 326q0 32 -30 51q-193 115 -447 115q-133 0 -287 -34q-42 -9 -42 -52q0 -20 13.5 -34.5t35.5 -14.5q5 0 37 8q132 27 243 27q226 0 397 -103q19 -11 33 -11q19 0 33 13.5t14 34.5zM1223 541q0 40 -35 61q-237 141 -548 141q-153 0 -303 -42q-48 -13 -48 -64 q0 -25 17.5 -42.5t42.5 -17.5q7 0 37 8q122 33 251 33q279 0 488 -124q24 -13 38 -13q25 0 42.5 17.5t17.5 42.5zM1331 789q0 47 -40 70q-126 73 -293 110.5t-343 37.5q-204 0 -364 -47q-23 -7 -38.5 -25.5t-15.5 -48.5q0 -31 20.5 -52t51.5 -21q11 0 40 8q133 37 307 37 q159 0 309.5 -34t253.5 -95q21 -12 40 -12q29 0 50.5 20.5t21.5 51.5zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M1024 1233l-303 -582l24 -31h279v-415h-507l-44 -30l-142 -273l-30 -30h-301v303l303 583l-24 30h-279v415h507l44 30l142 273l30 30h301v-303z" /> +<glyph unicode="" horiz-adv-x="2304" d="M784 164l16 241l-16 523q-1 10 -7.5 17t-16.5 7q-9 0 -16 -7t-7 -17l-14 -523l14 -241q1 -10 7.5 -16.5t15.5 -6.5q22 0 24 23zM1080 193l11 211l-12 586q0 16 -13 24q-8 5 -16 5t-16 -5q-13 -8 -13 -24l-1 -6l-10 -579q0 -1 11 -236v-1q0 -10 6 -17q9 -11 23 -11 q11 0 20 9q9 7 9 20zM35 533l20 -128l-20 -126q-2 -9 -9 -9t-9 9l-17 126l17 128q2 9 9 9t9 -9zM121 612l26 -207l-26 -203q-2 -9 -10 -9q-9 0 -9 10l-23 202l23 207q0 9 9 9q8 0 10 -9zM401 159zM213 650l25 -245l-25 -237q0 -11 -11 -11q-10 0 -12 11l-21 237l21 245 q2 12 12 12q11 0 11 -12zM307 657l23 -252l-23 -244q-2 -13 -14 -13q-13 0 -13 13l-21 244l21 252q0 13 13 13q12 0 14 -13zM401 639l21 -234l-21 -246q-2 -16 -16 -16q-6 0 -10.5 4.5t-4.5 11.5l-20 246l20 234q0 6 4.5 10.5t10.5 4.5q14 0 16 -15zM784 164zM495 785 l21 -380l-21 -246q0 -7 -5 -12.5t-12 -5.5q-16 0 -18 18l-18 246l18 380q2 18 18 18q7 0 12 -5.5t5 -12.5zM589 871l19 -468l-19 -244q0 -8 -5.5 -13.5t-13.5 -5.5q-18 0 -20 19l-16 244l16 468q2 19 20 19q8 0 13.5 -5.5t5.5 -13.5zM687 911l18 -506l-18 -242 q-2 -21 -22 -21q-19 0 -21 21l-16 242l16 506q0 9 6.5 15.5t14.5 6.5q9 0 15 -6.5t7 -15.5zM1079 169v0v0zM881 915l15 -510l-15 -239q0 -10 -7.5 -17.5t-17.5 -7.5t-17 7t-8 18l-14 239l14 510q0 11 7.5 18t17.5 7t17.5 -7t7.5 -18zM980 896l14 -492l-14 -236q0 -11 -8 -19 t-19 -8t-19 8t-9 19l-12 236l12 492q1 12 9 20t19 8t18.5 -8t8.5 -20zM1192 404l-14 -231v0q0 -13 -9 -22t-22 -9t-22 9t-10 22l-6 114l-6 117l12 636v3q2 15 12 24q9 7 20 7q8 0 15 -5q14 -8 16 -26zM2304 423q0 -117 -83 -199.5t-200 -82.5h-786q-13 2 -22 11t-9 22v899 q0 23 28 33q85 34 181 34q195 0 338 -131.5t160 -323.5q53 22 110 22q117 0 200 -83t83 -201z" /> +<glyph unicode="" d="M768 768q237 0 443 43t325 127v-170q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5t-103 128v170q119 -84 325 -127t443 -43zM768 0q237 0 443 43t325 127v-170q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5t-103 128v170q119 -84 325 -127 t443 -43zM768 384q237 0 443 43t325 127v-170q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5t-103 128v170q119 -84 325 -127t443 -43zM768 1536q208 0 385 -34.5t280 -93.5t103 -128v-128q0 -69 -103 -128t-280 -93.5t-385 -34.5t-385 34.5t-280 93.5 t-103 128v128q0 69 103 128t280 93.5t385 34.5z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M894 465q33 -26 84 -56q59 7 117 7q147 0 177 -49q16 -22 2 -52q0 -1 -1 -2l-2 -2v-1q-6 -38 -71 -38q-48 0 -115 20t-130 53q-221 -24 -392 -83q-153 -262 -242 -262q-15 0 -28 7l-24 12q-1 1 -6 5q-10 10 -6 36q9 40 56 91.5t132 96.5q14 9 23 -6q2 -2 2 -4q52 85 107 197 q68 136 104 262q-24 82 -30.5 159.5t6.5 127.5q11 40 42 40h21h1q23 0 35 -15q18 -21 9 -68q-2 -6 -4 -8q1 -3 1 -8v-30q-2 -123 -14 -192q55 -164 146 -238zM318 54q52 24 137 158q-51 -40 -87.5 -84t-49.5 -74zM716 974q-15 -42 -2 -132q1 7 7 44q0 3 7 43q1 4 4 8 q-1 1 -1 2t-0.5 1.5t-0.5 1.5q-1 22 -13 36q0 -1 -1 -2v-2zM592 313q135 54 284 81q-2 1 -13 9.5t-16 13.5q-76 67 -127 176q-27 -86 -83 -197q-30 -56 -45 -83zM1238 329q-24 24 -140 24q76 -28 124 -28q14 0 18 1q0 1 -2 3z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M233 768v-107h70l164 -661h159l128 485q7 20 10 46q2 16 2 24h4l3 -24q1 -3 3.5 -20t5.5 -26l128 -485h159l164 661h70v107h-300v-107h90l-99 -438q-5 -20 -7 -46l-2 -21h-4l-3 21q-1 5 -4 21t-5 25l-144 545h-114l-144 -545q-2 -9 -4.5 -24.5t-3.5 -21.5l-4 -21h-4l-2 21 q-2 26 -7 46l-99 438h90v107h-300z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M429 106v-106h281v106h-75l103 161q5 7 10 16.5t7.5 13.5t3.5 4h2q1 -4 5 -10q2 -4 4.5 -7.5t6 -8t6.5 -8.5l107 -161h-76v-106h291v106h-68l-192 273l195 282h67v107h-279v-107h74l-103 -159q-4 -7 -10 -16.5t-9 -13.5l-2 -3h-2q-1 4 -5 10q-6 11 -17 23l-106 159h76v107 h-290v-107h68l189 -272l-194 -283h-68z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M416 106v-106h327v106h-93v167h137q76 0 118 15q67 23 106.5 87t39.5 146q0 81 -37 141t-100 87q-48 19 -130 19h-368v-107h92v-555h-92zM769 386h-119v268h120q52 0 83 -18q56 -33 56 -115q0 -89 -62 -120q-31 -15 -78 -15z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M1280 320v-320h-1024v192l192 192l128 -128l384 384zM448 512q-80 0 -136 56t-56 136t56 136t136 56t136 -56t56 -136t-56 -136t-136 -56z" /> +<glyph unicode="" d="M640 1152v128h-128v-128h128zM768 1024v128h-128v-128h128zM640 896v128h-128v-128h128zM768 768v128h-128v-128h128zM1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400 v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-128v-128h-128v128h-512v-1536h1280zM781 593l107 -349q8 -27 8 -52q0 -83 -72.5 -137.5t-183.5 -54.5t-183.5 54.5t-72.5 137.5q0 25 8 52q21 63 120 396v128h128v-128h79 q22 0 39 -13t23 -34zM640 128q53 0 90.5 19t37.5 45t-37.5 45t-90.5 19t-90.5 -19t-37.5 -45t37.5 -45t90.5 -19z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M620 686q20 -8 20 -30v-544q0 -22 -20 -30q-8 -2 -12 -2q-12 0 -23 9l-166 167h-131q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h131l166 167q16 15 35 7zM1037 -3q31 0 50 24q129 159 129 363t-129 363q-16 21 -43 24t-47 -14q-21 -17 -23.5 -43.5t14.5 -47.5 q100 -123 100 -282t-100 -282q-17 -21 -14.5 -47.5t23.5 -42.5q18 -15 40 -15zM826 145q27 0 47 20q87 93 87 219t-87 219q-18 19 -45 20t-46 -17t-20 -44.5t18 -46.5q52 -57 52 -131t-52 -131q-19 -20 -18 -46.5t20 -44.5q20 -17 44 -17z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M768 768q52 0 90 -38t38 -90v-384q0 -52 -38 -90t-90 -38h-384q-52 0 -90 38t-38 90v384q0 52 38 90t90 38h384zM1260 766q20 -8 20 -30v-576q0 -22 -20 -30q-8 -2 -12 -2q-14 0 -23 9l-265 266v90l265 266q9 9 23 9q4 0 12 -2z" /> +<glyph unicode="" d="M1468 1156q28 -28 48 -76t20 -88v-1152q0 -40 -28 -68t-68 -28h-1344q-40 0 -68 28t-28 68v1600q0 40 28 68t68 28h896q40 0 88 -20t76 -48zM1024 1400v-376h376q-10 29 -22 41l-313 313q-12 12 -41 22zM1408 -128v1024h-416q-40 0 -68 28t-28 68v416h-768v-1536h1280z M480 768q8 11 21 12.5t24 -6.5l51 -38q11 -8 12.5 -21t-6.5 -24l-182 -243l182 -243q8 -11 6.5 -24t-12.5 -21l-51 -38q-11 -8 -24 -6.5t-21 12.5l-226 301q-14 19 0 38zM1282 467q14 -19 0 -38l-226 -301q-8 -11 -21 -12.5t-24 6.5l-51 38q-11 8 -12.5 21t6.5 24l182 243 l-182 243q-8 11 -6.5 24t12.5 21l51 38q11 8 24 6.5t21 -12.5zM662 6q-13 2 -20.5 13t-5.5 24l138 831q2 13 13 20.5t24 5.5l63 -10q13 -2 20.5 -13t5.5 -24l-138 -831q-2 -13 -13 -20.5t-24 -5.5z" /> +<glyph unicode="" d="M1497 709v-198q-101 -23 -198 -23q-65 -136 -165.5 -271t-181.5 -215.5t-128 -106.5q-80 -45 -162 3q-28 17 -60.5 43.5t-85 83.5t-102.5 128.5t-107.5 184t-105.5 244t-91.5 314.5t-70.5 390h283q26 -218 70 -398.5t104.5 -317t121.5 -235.5t140 -195q169 169 287 406 q-142 72 -223 220t-81 333q0 192 104 314.5t284 122.5q178 0 273 -105.5t95 -297.5q0 -159 -58 -286q-7 -1 -19.5 -3t-46 -2t-63 6t-62 25.5t-50.5 51.5q31 103 31 184q0 87 -29 132t-79 45q-53 0 -85 -49.5t-32 -140.5q0 -186 105 -293.5t267 -107.5q62 0 121 14z" /> +<glyph unicode="" horiz-adv-x="1792" d="M216 367l603 -402v359l-334 223zM154 511l193 129l-193 129v-258zM973 -35l603 402l-269 180l-334 -223v-359zM896 458l272 182l-272 182l-272 -182zM485 733l334 223v359l-603 -402zM1445 640l193 -129v258zM1307 733l269 180l-603 402v-359zM1792 913v-546 q0 -41 -34 -64l-819 -546q-21 -13 -43 -13t-43 13l-819 546q-34 23 -34 64v546q0 41 34 64l819 546q21 13 43 13t43 -13l819 -546q34 -23 34 -64z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1800 764q111 -46 179.5 -145.5t68.5 -221.5q0 -164 -118 -280.5t-285 -116.5q-4 0 -11.5 0.5t-10.5 0.5h-1209h-1h-2h-5q-170 10 -288 125.5t-118 280.5q0 110 55 203t147 147q-12 39 -12 82q0 115 82 196t199 81q95 0 172 -58q75 154 222.5 248t326.5 94 q166 0 306 -80.5t221.5 -218.5t81.5 -301q0 -6 -0.5 -18t-0.5 -18zM468 498q0 -122 84 -193t208 -71q137 0 240 99q-16 20 -47.5 56.5t-43.5 50.5q-67 -65 -144 -65q-55 0 -93.5 33.5t-38.5 87.5q0 53 38.5 87t91.5 34q44 0 84.5 -21t73 -55t65 -75t69 -82t77 -75t97 -55 t121.5 -21q121 0 204.5 71.5t83.5 190.5q0 121 -84 192t-207 71q-143 0 -241 -97q14 -16 29.5 -34t34.5 -40t29 -34q66 64 142 64q52 0 92 -33t40 -84q0 -57 -37 -91.5t-94 -34.5q-43 0 -82.5 21t-72 55t-65.5 75t-69.5 82t-77.5 75t-96.5 55t-118.5 21q-122 0 -207 -70.5 t-85 -189.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM896 1408q-190 0 -361 -90l194 -194q82 28 167 28t167 -28l194 194q-171 90 -361 90zM218 279l194 194 q-28 82 -28 167t28 167l-194 194q-90 -171 -90 -361t90 -361zM896 -128q190 0 361 90l-194 194q-82 -28 -167 -28t-167 28l-194 -194q171 -90 361 -90zM896 256q159 0 271.5 112.5t112.5 271.5t-112.5 271.5t-271.5 112.5t-271.5 -112.5t-112.5 -271.5t112.5 -271.5 t271.5 -112.5zM1380 473l194 -194q90 171 90 361t-90 361l-194 -194q28 -82 28 -167t-28 -167z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1760 640q0 -176 -68.5 -336t-184 -275.5t-275.5 -184t-336 -68.5t-336 68.5t-275.5 184t-184 275.5t-68.5 336q0 213 97 398.5t265 305.5t374 151v-228q-221 -45 -366.5 -221t-145.5 -406q0 -130 51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5 t136.5 204t51 248.5q0 230 -145.5 406t-366.5 221v228q206 -31 374 -151t265 -305.5t97 -398.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M19 662q8 217 116 406t305 318h5q0 -1 -1 -3q-8 -8 -28 -33.5t-52 -76.5t-60 -110.5t-44.5 -135.5t-14 -150.5t39 -157.5t108.5 -154q50 -50 102 -69.5t90.5 -11.5t69.5 23.5t47 32.5l16 16q39 51 53 116.5t6.5 122.5t-21 107t-26.5 80l-14 29q-10 25 -30.5 49.5t-43 41 t-43.5 29.5t-35 19l-13 6l104 115q39 -17 78 -52t59 -61l19 -27q1 48 -18.5 103.5t-40.5 87.5l-20 31l161 183l160 -181q-33 -46 -52.5 -102.5t-22.5 -90.5l-4 -33q22 37 61.5 72.5t67.5 52.5l28 17l103 -115q-44 -14 -85 -50t-60 -65l-19 -29q-31 -56 -48 -133.5t-7 -170 t57 -156.5q33 -45 77.5 -60.5t85 -5.5t76 26.5t57.5 33.5l21 16q60 53 96.5 115t48.5 121.5t10 121.5t-18 118t-37 107.5t-45.5 93t-45 72t-34.5 47.5l-13 17q-14 13 -7 13l10 -3q40 -29 62.5 -46t62 -50t64 -58t58.5 -65t55.5 -77t45.5 -88t38 -103t23.5 -117t10.5 -136 q3 -259 -108 -465t-312 -321t-456 -115q-185 0 -351 74t-283.5 198t-184 293t-60.5 353z" /> +<glyph unicode="" horiz-adv-x="1792" d="M874 -102v-66q-208 6 -385 109.5t-283 275.5l58 34q29 -49 73 -99l65 57q148 -168 368 -212l-17 -86q65 -12 121 -13zM276 428l-83 -28q22 -60 49 -112l-57 -33q-98 180 -98 385t98 385l57 -33q-30 -56 -49 -112l82 -28q-35 -100 -35 -212q0 -109 36 -212zM1528 251 l58 -34q-106 -172 -283 -275.5t-385 -109.5v66q56 1 121 13l-17 86q220 44 368 212l65 -57q44 50 73 99zM1377 805l-233 -80q14 -42 14 -85t-14 -85l232 -80q-31 -92 -98 -169l-185 162q-57 -67 -147 -85l48 -241q-52 -10 -98 -10t-98 10l48 241q-90 18 -147 85l-185 -162 q-67 77 -98 169l232 80q-14 42 -14 85t14 85l-233 80q33 93 99 169l185 -162q59 68 147 86l-48 240q44 10 98 10t98 -10l-48 -240q88 -18 147 -86l185 162q66 -76 99 -169zM874 1448v-66q-65 -2 -121 -13l17 -86q-220 -42 -368 -211l-65 56q-38 -42 -73 -98l-57 33 q106 172 282 275.5t385 109.5zM1705 640q0 -205 -98 -385l-57 33q27 52 49 112l-83 28q36 103 36 212q0 112 -35 212l82 28q-19 56 -49 112l57 33q98 -180 98 -385zM1585 1063l-57 -33q-35 56 -73 98l-65 -56q-148 169 -368 211l17 86q-56 11 -121 13v66q209 -6 385 -109.5 t282 -275.5zM1748 640q0 173 -67.5 331t-181.5 272t-272 181.5t-331 67.5t-331 -67.5t-272 -181.5t-181.5 -272t-67.5 -331t67.5 -331t181.5 -272t272 -181.5t331 -67.5t331 67.5t272 181.5t181.5 272t67.5 331zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71 t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" d="M582 228q0 -66 -93 -66q-107 0 -107 63q0 64 98 64q102 0 102 -61zM546 694q0 -85 -74 -85q-77 0 -77 84q0 90 77 90q36 0 55 -25.5t19 -63.5zM712 769v125q-78 -29 -135 -29q-50 29 -110 29q-86 0 -145 -57t-59 -143q0 -50 29.5 -102t73.5 -67v-3q-38 -17 -38 -85 q0 -53 41 -77v-3q-113 -37 -113 -139q0 -45 20 -78.5t54 -51t72 -25.5t81 -8q224 0 224 188q0 67 -48 99t-126 46q-27 5 -51.5 20.5t-24.5 39.5q0 44 49 52q77 15 122 70t45 134q0 24 -10 52q37 9 49 13zM771 350h137q-2 27 -2 82v387q0 46 2 69h-137q3 -23 3 -71v-392 q0 -50 -3 -75zM1280 366v121q-30 -21 -68 -21q-53 0 -53 82v225h52q9 0 26.5 -1t26.5 -1v117h-105q0 82 3 102h-140q4 -24 4 -55v-47h-60v-117q36 3 37 3q3 0 11 -0.5t12 -0.5v-2h-2v-217q0 -37 2.5 -64t11.5 -56.5t24.5 -48.5t43.5 -31t66 -12q64 0 108 24zM924 1072 q0 36 -24 63.5t-60 27.5t-60.5 -27t-24.5 -64q0 -36 25 -62.5t60 -26.5t59.5 27t24.5 62zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M595 22q0 100 -165 100q-158 0 -158 -104q0 -101 172 -101q151 0 151 105zM536 777q0 61 -30 102t-89 41q-124 0 -124 -145q0 -135 124 -135q119 0 119 137zM805 1101v-202q-36 -12 -79 -22q16 -43 16 -84q0 -127 -73 -216.5t-197 -112.5q-40 -8 -59.5 -27t-19.5 -58 q0 -31 22.5 -51.5t58 -32t78.5 -22t86 -25.5t78.5 -37.5t58 -64t22.5 -98.5q0 -304 -363 -304q-69 0 -130 12.5t-116 41t-87.5 82t-32.5 127.5q0 165 182 225v4q-67 41 -67 126q0 109 63 137v4q-72 24 -119.5 108.5t-47.5 165.5q0 139 95 231.5t235 92.5q96 0 178 -47 q98 0 218 47zM1123 220h-222q4 45 4 134v609q0 94 -4 128h222q-4 -33 -4 -124v-613q0 -89 4 -134zM1724 442v-196q-71 -39 -174 -39q-62 0 -107 20t-70 50t-39.5 78t-18.5 92t-4 103v351h2v4q-7 0 -19 1t-18 1q-21 0 -59 -6v190h96v76q0 54 -6 89h227q-6 -41 -6 -165h171 v-190q-15 0 -43.5 2t-42.5 2h-85v-365q0 -131 87 -131q61 0 109 33zM1148 1389q0 -58 -39 -101.5t-96 -43.5q-58 0 -98 43.5t-40 101.5q0 59 39.5 103t98.5 44q58 0 96.5 -44.5t38.5 -102.5z" /> +<glyph unicode="" d="M809 532l266 499h-112l-157 -312q-24 -48 -44 -92l-42 92l-155 312h-120l263 -493v-324h101v318zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M842 964q0 -80 -57 -136.5t-136 -56.5q-60 0 -111 35q-62 -67 -115 -146q-247 -371 -202 -859q1 -22 -12.5 -38.5t-34.5 -18.5h-5q-20 0 -35 13.5t-17 33.5q-14 126 -3.5 247.5t29.5 217t54 186t69 155.5t74 125q61 90 132 165q-16 35 -16 77q0 80 56.5 136.5t136.5 56.5 t136.5 -56.5t56.5 -136.5zM1223 953q0 -158 -78 -292t-212.5 -212t-292.5 -78q-64 0 -131 14q-21 5 -32.5 23.5t-6.5 39.5q5 20 23 31.5t39 7.5q51 -13 108 -13q97 0 186 38t153 102t102 153t38 186t-38 186t-102 153t-153 102t-186 38t-186 -38t-153 -102t-102 -153 t-38 -186q0 -114 52 -218q10 -20 3.5 -40t-25.5 -30t-39.5 -3t-30.5 26q-64 123 -64 265q0 119 46.5 227t124.5 186t186 124t226 46q158 0 292.5 -78t212.5 -212.5t78 -292.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M270 730q-8 19 -8 52q0 20 11 49t24 45q-1 22 7.5 53t22.5 43q0 139 92.5 288.5t217.5 209.5q139 66 324 66q133 0 266 -55q49 -21 90 -48t71 -56t55 -68t42 -74t32.5 -84.5t25.5 -89.5t22 -98l1 -5q55 -83 55 -150q0 -14 -9 -40t-9 -38q0 -1 1.5 -3.5t3.5 -5t2 -3.5 q77 -114 120.5 -214.5t43.5 -208.5q0 -43 -19.5 -100t-55.5 -57q-9 0 -19.5 7.5t-19 17.5t-19 26t-16 26.5t-13.5 26t-9 17.5q-1 1 -3 1l-5 -4q-59 -154 -132 -223q20 -20 61.5 -38.5t69 -41.5t35.5 -65q-2 -4 -4 -16t-7 -18q-64 -97 -302 -97q-53 0 -110.5 9t-98 20 t-104.5 30q-15 5 -23 7q-14 4 -46 4.5t-40 1.5q-41 -45 -127.5 -65t-168.5 -20q-35 0 -69 1.5t-93 9t-101 20.5t-74.5 40t-32.5 64q0 40 10 59.5t41 48.5q11 2 40.5 13t49.5 12q4 0 14 2q2 2 2 4l-2 3q-48 11 -108 105.5t-73 156.5l-5 3q-4 0 -12 -20q-18 -41 -54.5 -74.5 t-77.5 -37.5h-1q-4 0 -6 4.5t-5 5.5q-23 54 -23 100q0 275 252 466z" /> +<glyph unicode="" horiz-adv-x="2048" d="M580 1075q0 41 -25 66t-66 25q-43 0 -76 -25.5t-33 -65.5q0 -39 33 -64.5t76 -25.5q41 0 66 24.5t25 65.5zM1323 568q0 28 -25.5 50t-65.5 22q-27 0 -49.5 -22.5t-22.5 -49.5q0 -28 22.5 -50.5t49.5 -22.5q40 0 65.5 22t25.5 51zM1087 1075q0 41 -24.5 66t-65.5 25 q-43 0 -76 -25.5t-33 -65.5q0 -39 33 -64.5t76 -25.5q41 0 65.5 24.5t24.5 65.5zM1722 568q0 28 -26 50t-65 22q-27 0 -49.5 -22.5t-22.5 -49.5q0 -28 22.5 -50.5t49.5 -22.5q39 0 65 22t26 51zM1456 965q-31 4 -70 4q-169 0 -311 -77t-223.5 -208.5t-81.5 -287.5 q0 -78 23 -152q-35 -3 -68 -3q-26 0 -50 1.5t-55 6.5t-44.5 7t-54.5 10.5t-50 10.5l-253 -127l72 218q-290 203 -290 490q0 169 97.5 311t264 223.5t363.5 81.5q176 0 332.5 -66t262 -182.5t136.5 -260.5zM2048 404q0 -117 -68.5 -223.5t-185.5 -193.5l55 -181l-199 109 q-150 -37 -218 -37q-169 0 -311 70.5t-223.5 191.5t-81.5 264t81.5 264t223.5 191.5t311 70.5q161 0 303 -70.5t227.5 -192t85.5 -263.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1764 1525q33 -24 27 -64l-256 -1536q-5 -29 -32 -45q-14 -8 -31 -8q-11 0 -24 5l-453 185l-242 -295q-18 -23 -49 -23q-13 0 -22 4q-19 7 -30.5 23.5t-11.5 36.5v349l864 1059l-1069 -925l-395 162q-37 14 -40 55q-2 40 32 59l1664 960q15 9 32 9q20 0 36 -11z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1764 1525q33 -24 27 -64l-256 -1536q-5 -29 -32 -45q-14 -8 -31 -8q-11 0 -24 5l-527 215l-298 -327q-18 -21 -47 -21q-14 0 -23 4q-19 7 -30 23.5t-11 36.5v452l-472 193q-37 14 -40 55q-3 39 32 59l1664 960q35 21 68 -2zM1422 26l221 1323l-1434 -827l336 -137 l863 639l-478 -797z" /> +<glyph unicode="" d="M1536 640q0 -156 -61 -298t-164 -245t-245 -164t-298 -61q-172 0 -327 72.5t-264 204.5q-7 10 -6.5 22.5t8.5 20.5l137 138q10 9 25 9q16 -2 23 -12q73 -95 179 -147t225 -52q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5t-40.5 198.5t-109.5 163.5 t-163.5 109.5t-198.5 40.5q-98 0 -188 -35.5t-160 -101.5l137 -138q31 -30 14 -69q-17 -40 -59 -40h-448q-26 0 -45 19t-19 45v448q0 42 40 59q39 17 69 -14l130 -129q107 101 244.5 156.5t284.5 55.5q156 0 298 -61t245 -164t164 -245t61 -298zM896 928v-448q0 -14 -9 -23 t-23 -9h-320q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v352q0 14 9 23t23 9h64q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M768 1280q-130 0 -248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5t-51 248.5t-136.5 204t-204 136.5t-248.5 51zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103 t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1682 -128q-44 0 -132.5 3.5t-133.5 3.5q-44 0 -132 -3.5t-132 -3.5q-24 0 -37 20.5t-13 45.5q0 31 17 46t39 17t51 7t45 15q33 21 33 140l-1 391q0 21 -1 31q-13 4 -50 4h-675q-38 0 -51 -4q-1 -10 -1 -31l-1 -371q0 -142 37 -164q16 -10 48 -13t57 -3.5t45 -15 t20 -45.5q0 -26 -12.5 -48t-36.5 -22q-47 0 -139.5 3.5t-138.5 3.5q-43 0 -128 -3.5t-127 -3.5q-23 0 -35.5 21t-12.5 45q0 30 15.5 45t36 17.5t47.5 7.5t42 15q33 23 33 143l-1 57v813q0 3 0.5 26t0 36.5t-1.5 38.5t-3.5 42t-6.5 36.5t-11 31.5t-16 18q-15 10 -45 12t-53 2 t-41 14t-18 45q0 26 12 48t36 22q46 0 138.5 -3.5t138.5 -3.5q42 0 126.5 3.5t126.5 3.5q25 0 37.5 -22t12.5 -48q0 -30 -17 -43.5t-38.5 -14.5t-49.5 -4t-43 -13q-35 -21 -35 -160l1 -320q0 -21 1 -32q13 -3 39 -3h699q25 0 38 3q1 11 1 32l1 320q0 139 -35 160 q-18 11 -58.5 12.5t-66 13t-25.5 49.5q0 26 12.5 48t37.5 22q44 0 132 -3.5t132 -3.5q43 0 129 3.5t129 3.5q25 0 37.5 -22t12.5 -48q0 -30 -17.5 -44t-40 -14.5t-51.5 -3t-44 -12.5q-35 -23 -35 -161l1 -943q0 -119 34 -140q16 -10 46 -13.5t53.5 -4.5t41.5 -15.5t18 -44.5 q0 -26 -12 -48t-36 -22z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1278 1347v-73q0 -29 -18.5 -61t-42.5 -32q-50 0 -54 -1q-26 -6 -32 -31q-3 -11 -3 -64v-1152q0 -25 -18 -43t-43 -18h-108q-25 0 -43 18t-18 43v1218h-143v-1218q0 -25 -17.5 -43t-43.5 -18h-108q-26 0 -43.5 18t-17.5 43v496q-147 12 -245 59q-126 58 -192 179 q-64 117 -64 259q0 166 88 286q88 118 209 159q111 37 417 37h479q25 0 43 -18t18 -43z" /> +<glyph unicode="" d="M352 128v-128h-352v128h352zM704 256q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h256zM864 640v-128h-864v128h864zM224 1152v-128h-224v128h224zM1536 128v-128h-736v128h736zM576 1280q26 0 45 -19t19 -45v-256 q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h256zM1216 768q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h256zM1536 640v-128h-224v128h224zM1536 1152v-128h-864v128h864z" /> +<glyph unicode="" d="M1216 512q133 0 226.5 -93.5t93.5 -226.5t-93.5 -226.5t-226.5 -93.5t-226.5 93.5t-93.5 226.5q0 12 2 34l-360 180q-92 -86 -218 -86q-133 0 -226.5 93.5t-93.5 226.5t93.5 226.5t226.5 93.5q126 0 218 -86l360 180q-2 22 -2 34q0 133 93.5 226.5t226.5 93.5 t226.5 -93.5t93.5 -226.5t-93.5 -226.5t-226.5 -93.5q-126 0 -218 86l-360 -180q2 -22 2 -34t-2 -34l360 -180q92 86 218 86z" /> +<glyph unicode="" d="M1280 341q0 88 -62.5 151t-150.5 63q-84 0 -145 -58l-241 120q2 16 2 23t-2 23l241 120q61 -58 145 -58q88 0 150.5 63t62.5 151t-62.5 150.5t-150.5 62.5t-151 -62.5t-63 -150.5q0 -7 2 -23l-241 -120q-62 57 -145 57q-88 0 -150.5 -62.5t-62.5 -150.5t62.5 -150.5 t150.5 -62.5q83 0 145 57l241 -120q-2 -16 -2 -23q0 -88 63 -150.5t151 -62.5t150.5 62.5t62.5 150.5zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M571 947q-10 25 -34 35t-49 0q-108 -44 -191 -127t-127 -191q-10 -25 0 -49t35 -34q13 -5 24 -5q42 0 60 40q34 84 98.5 148.5t148.5 98.5q25 11 35 35t0 49zM1513 1303l46 -46l-244 -243l68 -68q19 -19 19 -45.5t-19 -45.5l-64 -64q89 -161 89 -343q0 -143 -55.5 -273.5 t-150 -225t-225 -150t-273.5 -55.5t-273.5 55.5t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5q182 0 343 -89l64 64q19 19 45.5 19t45.5 -19l68 -68zM1521 1359q-10 -10 -22 -10q-13 0 -23 10l-91 90q-9 10 -9 23t9 23q10 9 23 9t23 -9l90 -91 q10 -9 10 -22.5t-10 -22.5zM1751 1129q-11 -9 -23 -9t-23 9l-90 91q-10 9 -10 22.5t10 22.5q9 10 22.5 10t22.5 -10l91 -90q9 -10 9 -23t-9 -23zM1792 1312q0 -14 -9 -23t-23 -9h-96q-14 0 -23 9t-9 23t9 23t23 9h96q14 0 23 -9t9 -23zM1600 1504v-96q0 -14 -9 -23t-23 -9 t-23 9t-9 23v96q0 14 9 23t23 9t23 -9t9 -23zM1751 1449l-91 -90q-10 -10 -22 -10q-13 0 -23 10q-10 9 -10 22.5t10 22.5l90 91q10 9 23 9t23 -9q9 -10 9 -23t-9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M609 720l287 208l287 -208l-109 -336h-355zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM1515 186q149 203 149 454v3l-102 -89l-240 224l63 323 l134 -12q-150 206 -389 282l53 -124l-287 -159l-287 159l53 124q-239 -76 -389 -282l135 12l62 -323l-240 -224l-102 89v-3q0 -251 149 -454l30 132l326 -40l139 -298l-116 -69q117 -39 240 -39t240 39l-116 69l139 298l326 40z" /> +<glyph unicode="" horiz-adv-x="1792" d="M448 224v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM256 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM832 224v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23 v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM640 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM66 768q-28 0 -47 19t-19 46v129h514v-129q0 -27 -19 -46t-46 -19h-383zM1216 224v-192q0 -14 -9 -23t-23 -9h-192 q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1024 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1600 224v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23 zM1408 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1792 1016v-13h-514v10q0 104 -382 102q-382 -1 -382 -102v-10h-514v13q0 17 8.5 43t34 64t65.5 75.5t110.5 76t160 67.5t224 47.5t293.5 18.5t293 -18.5t224 -47.5 t160.5 -67.5t110.5 -76t65.5 -75.5t34 -64t8.5 -43zM1792 608v-192q0 -14 -9 -23t-23 -9h-192q-14 0 -23 9t-9 23v192q0 14 9 23t23 9h192q14 0 23 -9t9 -23zM1792 962v-129q0 -27 -19 -46t-46 -19h-384q-27 0 -46 19t-19 46v129h514z" /> +<glyph unicode="" horiz-adv-x="1792" d="M704 1216v-768q0 -26 -19 -45t-45 -19v-576q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v512l249 873q7 23 31 23h424zM1024 1216v-704h-256v704h256zM1792 320v-512q0 -26 -19 -45t-45 -19h-512q-26 0 -45 19t-19 45v576q-26 0 -45 19t-19 45v768h424q24 0 31 -23z M736 1504v-224h-352v224q0 14 9 23t23 9h288q14 0 23 -9t9 -23zM1408 1504v-224h-352v224q0 14 9 23t23 9h288q14 0 23 -9t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1755 1083q37 -37 37 -90t-37 -91l-401 -400l150 -150l-160 -160q-163 -163 -389.5 -186.5t-411.5 100.5l-362 -362h-181v181l362 362q-124 185 -100.5 411.5t186.5 389.5l160 160l150 -150l400 401q38 37 91 37t90 -37t37 -90.5t-37 -90.5l-400 -401l234 -234l401 400 q38 37 91 37t90 -37z" /> +<glyph unicode="" horiz-adv-x="1792" d="M873 796q0 -83 -63.5 -142.5t-152.5 -59.5t-152.5 59.5t-63.5 142.5q0 84 63.5 143t152.5 59t152.5 -59t63.5 -143zM1375 796q0 -83 -63 -142.5t-153 -59.5q-89 0 -152.5 59.5t-63.5 142.5q0 84 63.5 143t152.5 59q90 0 153 -59t63 -143zM1600 616v667q0 87 -32 123.5 t-111 36.5h-1112q-83 0 -112.5 -34t-29.5 -126v-673q43 -23 88.5 -40t81 -28t81 -18.5t71 -11t70 -4t58.5 -0.5t56.5 2t44.5 2q68 1 95 -27q6 -6 10 -9q26 -25 61 -51q7 91 118 87q5 0 36.5 -1.5t43 -2t45.5 -1t53 1t54.5 4.5t61 8.5t62 13.5t67 19.5t67.5 27t72 34.5z M1763 621q-121 -149 -372 -252q84 -285 -23 -465q-66 -113 -183 -148q-104 -32 -182 15q-86 51 -82 164l-1 326v1q-8 2 -24.5 6t-23.5 5l-1 -338q4 -114 -83 -164q-79 -47 -183 -15q-117 36 -182 150q-105 180 -22 463q-251 103 -372 252q-25 37 -4 63t60 -1q3 -2 11 -7 t11 -8v694q0 72 47 123t114 51h1257q67 0 114 -51t47 -123v-694l21 15q39 27 60 1t-4 -63z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1102v-434h-145v434h145zM1294 1102v-434h-145v434h145zM1294 342l253 254v795h-1194v-1049h326v-217l217 217h398zM1692 1536v-1013l-434 -434h-326l-217 -217h-217v217h-398v1158l109 289h1483z" /> +<glyph unicode="" d="M773 217v-127q-1 -292 -6 -305q-12 -32 -51 -40q-54 -9 -181.5 38t-162.5 89q-13 15 -17 36q-1 12 4 26q4 10 34 47t181 216q1 0 60 70q15 19 39.5 24.5t49.5 -3.5q24 -10 37.5 -29t12.5 -42zM624 468q-3 -55 -52 -70l-120 -39q-275 -88 -292 -88q-35 2 -54 36 q-12 25 -17 75q-8 76 1 166.5t30 124.5t56 32q13 0 202 -77q70 -29 115 -47l84 -34q23 -9 35.5 -30.5t11.5 -48.5zM1450 171q-7 -54 -91.5 -161t-135.5 -127q-37 -14 -63 7q-14 10 -184 287l-47 77q-14 21 -11.5 46t19.5 46q35 43 83 26q1 -1 119 -40q203 -66 242 -79.5 t47 -20.5q28 -22 22 -61zM778 803q5 -102 -54 -122q-58 -17 -114 71l-378 598q-8 35 19 62q41 43 207.5 89.5t224.5 31.5q40 -10 49 -45q3 -18 22 -305.5t24 -379.5zM1440 695q3 -39 -26 -59q-15 -10 -329 -86q-67 -15 -91 -23l1 2q-23 -6 -46 4t-37 32q-30 47 0 87 q1 1 75 102q125 171 150 204t34 39q28 19 65 2q48 -23 123 -133.5t81 -167.5v-3z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1024 1024h-384v-384h384v384zM1152 384v-128h-640v128h640zM1152 1152v-640h-640v640h640zM1792 384v-128h-512v128h512zM1792 640v-128h-512v128h512zM1792 896v-128h-512v128h512zM1792 1152v-128h-512v128h512zM256 192v960h-128v-960q0 -26 19 -45t45 -19t45 19 t19 45zM1920 192v1088h-1536v-1088q0 -33 -11 -64h1483q26 0 45 19t19 45zM2048 1408v-1216q0 -80 -56 -136t-136 -56h-1664q-80 0 -136 56t-56 136v1088h256v128h1792z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1024 13q-20 0 -93 73.5t-73 93.5q0 32 62.5 54t103.5 22t103.5 -22t62.5 -54q0 -20 -73 -93.5t-93 -73.5zM1294 284q-2 0 -40 25t-101.5 50t-128.5 25t-128.5 -25t-101 -50t-40.5 -25q-18 0 -93.5 75t-75.5 93q0 13 10 23q78 77 196 121t233 44t233 -44t196 -121 q10 -10 10 -23q0 -18 -75.5 -93t-93.5 -75zM1567 556q-11 0 -23 8q-136 105 -252 154.5t-268 49.5q-85 0 -170.5 -22t-149 -53t-113.5 -62t-79 -53t-31 -22q-17 0 -92 75t-75 93q0 12 10 22q132 132 320 205t380 73t380 -73t320 -205q10 -10 10 -22q0 -18 -75 -93t-92 -75z M1838 827q-11 0 -22 9q-179 157 -371.5 236.5t-420.5 79.5t-420.5 -79.5t-371.5 -236.5q-11 -9 -22 -9q-17 0 -92.5 75t-75.5 93q0 13 10 23q187 186 445 288t527 102t527 -102t445 -288q10 -10 10 -23q0 -18 -75.5 -93t-92.5 -75z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 0q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM768 0q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM384 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5 t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1152 0q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM768 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5 t37.5 90.5zM384 768q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1152 384q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM768 768q0 53 -37.5 90.5t-90.5 37.5 t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1536 0v384q0 52 -38 90t-90 38t-90 -38t-38 -90v-384q0 -52 38 -90t90 -38t90 38t38 90zM1152 768q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5z M1536 1088v256q0 26 -19 45t-45 19h-1280q-26 0 -45 -19t-19 -45v-256q0 -26 19 -45t45 -19h1280q26 0 45 19t19 45zM1536 768q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1664 1408v-1536q0 -52 -38 -90t-90 -38 h-1408q-52 0 -90 38t-38 90v1536q0 52 38 90t90 38h1408q52 0 90 -38t38 -90z" /> +<glyph unicode="" d="M1519 890q18 -84 -4 -204q-87 -444 -565 -444h-44q-25 0 -44 -16.5t-24 -42.5l-4 -19l-55 -346l-2 -15q-5 -26 -24.5 -42.5t-44.5 -16.5h-251q-21 0 -33 15t-9 36q9 56 26.5 168t26.5 168t27 167.5t27 167.5q5 37 43 37h131q133 -2 236 21q175 39 287 144q102 95 155 246 q24 70 35 133q1 6 2.5 7.5t3.5 1t6 -3.5q79 -59 98 -162zM1347 1172q0 -107 -46 -236q-80 -233 -302 -315q-113 -40 -252 -42q0 -1 -90 -1l-90 1q-100 0 -118 -96q-2 -8 -85 -530q-1 -10 -12 -10h-295q-22 0 -36.5 16.5t-11.5 38.5l232 1471q5 29 27.5 48t51.5 19h598 q34 0 97.5 -13t111.5 -32q107 -41 163.5 -123t56.5 -196z" /> +<glyph unicode="" horiz-adv-x="1792" d="M441 864q32 0 52 -26q266 -364 362 -774h-446q-127 441 -367 749q-12 16 -3 33.5t29 17.5h373zM1000 507q-49 -199 -125 -393q-79 310 -256 594q40 221 44 449q211 -340 337 -650zM1099 1216q235 -324 384.5 -698.5t184.5 -773.5h-451q-41 665 -553 1472h435zM1792 640 q0 -424 -101 -812q-67 560 -359 1083q-25 301 -106 584q-4 16 5.5 28.5t25.5 12.5h359q21 0 38.5 -13t22.5 -33q115 -409 115 -850z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1975 546h-138q14 37 66 179l3 9q4 10 10 26t9 26l12 -55zM531 611l-58 295q-11 54 -75 54h-268l-2 -13q311 -79 403 -336zM710 960l-162 -438l-17 89q-26 70 -85 129.5t-131 88.5l135 -510h175l261 641h-176zM849 318h166l104 642h-166zM1617 944q-69 27 -149 27 q-123 0 -201 -59t-79 -153q-1 -102 145 -174q48 -23 67 -41t19 -39q0 -30 -30 -46t-69 -16q-86 0 -156 33l-22 11l-23 -144q74 -34 185 -34q130 -1 208.5 59t80.5 160q0 106 -140 174q-49 25 -71 42t-22 38q0 22 24.5 38.5t70.5 16.5q70 1 124 -24l15 -8zM2042 960h-128 q-65 0 -87 -54l-246 -588h174l35 96h212q5 -22 20 -96h154zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M671 603h-13q-47 0 -47 -32q0 -22 20 -22q17 0 28 15t12 39zM1066 639h62v3q1 4 0.5 6.5t-1 7t-2 8t-4.5 6.5t-7.5 5t-11.5 2q-28 0 -36 -38zM1606 603h-12q-48 0 -48 -32q0 -22 20 -22q17 0 28 15t12 39zM1925 629q0 41 -30 41q-19 0 -31 -20t-12 -51q0 -42 28 -42 q20 0 32.5 20t12.5 52zM480 770h87l-44 -262h-56l32 201l-71 -201h-39l-4 200l-34 -200h-53l44 262h81l2 -163zM733 663q0 -6 -4 -42q-16 -101 -17 -113h-47l1 22q-20 -26 -58 -26q-23 0 -37.5 16t-14.5 42q0 39 26 60.5t73 21.5q14 0 23 -1q0 3 0.5 5.5t1 4.5t0.5 3 q0 20 -36 20q-29 0 -59 -10q0 4 7 48q38 11 67 11q74 0 74 -62zM889 721l-8 -49q-22 3 -41 3q-27 0 -27 -17q0 -8 4.5 -12t21.5 -11q40 -19 40 -60q0 -72 -87 -71q-34 0 -58 6q0 2 7 49q29 -8 51 -8q32 0 32 19q0 7 -4.5 11.5t-21.5 12.5q-43 20 -43 59q0 72 84 72 q30 0 50 -4zM977 721h28l-7 -52h-29q-2 -17 -6.5 -40.5t-7 -38.5t-2.5 -18q0 -16 19 -16q8 0 16 2l-8 -47q-21 -7 -40 -7q-43 0 -45 47q0 12 8 56q3 20 25 146h55zM1180 648q0 -23 -7 -52h-111q-3 -22 10 -33t38 -11q30 0 58 14l-9 -54q-30 -8 -57 -8q-95 0 -95 95 q0 55 27.5 90.5t69.5 35.5q35 0 55.5 -21t20.5 -56zM1319 722q-13 -23 -22 -62q-22 2 -31 -24t-25 -128h-56l3 14q22 130 29 199h51l-3 -33q14 21 25.5 29.5t28.5 4.5zM1506 763l-9 -57q-28 14 -50 14q-31 0 -51 -27.5t-20 -70.5q0 -30 13.5 -47t38.5 -17q21 0 48 13 l-10 -59q-28 -8 -50 -8q-45 0 -71.5 30.5t-26.5 82.5q0 70 35.5 114.5t91.5 44.5q26 0 61 -13zM1668 663q0 -18 -4 -42q-13 -79 -17 -113h-46l1 22q-20 -26 -59 -26q-23 0 -37 16t-14 42q0 39 25.5 60.5t72.5 21.5q15 0 23 -1q2 7 2 13q0 20 -36 20q-29 0 -59 -10q0 4 8 48 q38 11 67 11q73 0 73 -62zM1809 722q-14 -24 -21 -62q-23 2 -31.5 -23t-25.5 -129h-56l3 14q19 104 29 199h52q0 -11 -4 -33q15 21 26.5 29.5t27.5 4.5zM1950 770h56l-43 -262h-53l3 19q-23 -23 -52 -23q-31 0 -49.5 24t-18.5 64q0 53 27.5 92t64.5 39q31 0 53 -29z M2061 640q0 148 -72.5 273t-198 198t-273.5 73q-181 0 -328 -110q127 -116 171 -284h-50q-44 150 -158 253q-114 -103 -158 -253h-50q44 168 171 284q-147 110 -328 110q-148 0 -273.5 -73t-198 -198t-72.5 -273t72.5 -273t198 -198t273.5 -73q181 0 328 110 q-120 111 -165 264h50q46 -138 152 -233q106 95 152 233h50q-45 -153 -165 -264q147 -110 328 -110q148 0 273.5 73t198 198t72.5 273zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M313 759q0 -51 -36 -84q-29 -26 -89 -26h-17v220h17q61 0 89 -27q36 -31 36 -83zM2089 824q0 -52 -64 -52h-19v101h20q63 0 63 -49zM380 759q0 74 -50 120.5t-129 46.5h-95v-333h95q74 0 119 38q60 51 60 128zM410 593h65v333h-65v-333zM730 694q0 40 -20.5 62t-75.5 42 q-29 10 -39.5 19t-10.5 23q0 16 13.5 26.5t34.5 10.5q29 0 53 -27l34 44q-41 37 -98 37q-44 0 -74 -27.5t-30 -67.5q0 -35 18 -55.5t64 -36.5q37 -13 45 -19q19 -12 19 -34q0 -20 -14 -33.5t-36 -13.5q-48 0 -71 44l-42 -40q44 -64 115 -64q51 0 83 30.5t32 79.5zM1008 604 v77q-37 -37 -78 -37q-49 0 -80.5 32.5t-31.5 82.5q0 48 31.5 81.5t77.5 33.5q43 0 81 -38v77q-40 20 -80 20q-74 0 -125.5 -50.5t-51.5 -123.5t51 -123.5t125 -50.5q42 0 81 19zM2240 0v527q-65 -40 -144.5 -84t-237.5 -117t-329.5 -137.5t-417.5 -134.5t-504 -118h1569 q26 0 45 19t19 45zM1389 757q0 75 -53 128t-128 53t-128 -53t-53 -128t53 -128t128 -53t128 53t53 128zM1541 584l144 342h-71l-90 -224l-89 224h-71l142 -342h35zM1714 593h184v56h-119v90h115v56h-115v74h119v57h-184v-333zM2105 593h80l-105 140q76 16 76 94q0 47 -31 73 t-87 26h-97v-333h65v133h9zM2304 1274v-1268q0 -56 -38.5 -95t-93.5 -39h-2040q-55 0 -93.5 39t-38.5 95v1268q0 56 38.5 95t93.5 39h2040q55 0 93.5 -39t38.5 -95z" /> +<glyph unicode="" horiz-adv-x="2304" d="M119 854h89l-45 108zM740 328l74 79l-70 79h-163v-49h142v-55h-142v-54h159zM898 406l99 -110v217zM1186 453q0 33 -40 33h-84v-69h83q41 0 41 36zM1475 457q0 29 -42 29h-82v-61h81q43 0 43 32zM1197 923q0 29 -42 29h-82v-60h81q43 0 43 31zM1656 854h89l-44 108z M699 1009v-271h-66v212l-94 -212h-57l-94 212v-212h-132l-25 60h-135l-25 -60h-70l116 271h96l110 -257v257h106l85 -184l77 184h108zM1255 453q0 -20 -5.5 -35t-14 -25t-22.5 -16.5t-26 -10t-31.5 -4.5t-31.5 -1t-32.5 0.5t-29.5 0.5v-91h-126l-80 90l-83 -90h-256v271h260 l80 -89l82 89h207q109 0 109 -89zM964 794v-56h-217v271h217v-57h-152v-49h148v-55h-148v-54h152zM2304 235v-229q0 -55 -38.5 -94.5t-93.5 -39.5h-2040q-55 0 -93.5 39.5t-38.5 94.5v678h111l25 61h55l25 -61h218v46l19 -46h113l20 47v-47h541v99l10 1q10 0 10 -14v-86h279 v23q23 -12 55 -18t52.5 -6.5t63 0.5t51.5 1l25 61h56l25 -61h227v58l34 -58h182v378h-180v-44l-25 44h-185v-44l-23 44h-249q-69 0 -109 -22v22h-172v-22q-24 22 -73 22h-628l-43 -97l-43 97h-198v-44l-22 44h-169l-78 -179v391q0 55 38.5 94.5t93.5 39.5h2040 q55 0 93.5 -39.5t38.5 -94.5v-678h-120q-51 0 -81 -22v22h-177q-55 0 -78 -22v22h-316v-22q-31 22 -87 22h-209v-22q-23 22 -91 22h-234l-54 -58l-50 58h-349v-378h343l55 59l52 -59h211v89h21q59 0 90 13v-102h174v99h8q8 0 10 -2t2 -10v-87h529q57 0 88 24v-24h168 q60 0 95 17zM1546 469q0 -23 -12 -43t-34 -29q25 -9 34 -26t9 -46v-54h-65v45q0 33 -12 43.5t-46 10.5h-69v-99h-65v271h154q48 0 77 -15t29 -58zM1269 936q0 -24 -12.5 -44t-33.5 -29q26 -9 34.5 -25.5t8.5 -46.5v-53h-65q0 9 0.5 26.5t0 25t-3 18.5t-8.5 16t-17.5 8.5 t-29.5 3.5h-70v-98h-64v271l153 -1q49 0 78 -14.5t29 -57.5zM1798 327v-56h-216v271h216v-56h-151v-49h148v-55h-148v-54zM1372 1009v-271h-66v271h66zM2065 357q0 -86 -102 -86h-126v58h126q34 0 34 25q0 16 -17 21t-41.5 5t-49.5 3.5t-42 22.5t-17 55q0 39 26 60t66 21 h130v-57h-119q-36 0 -36 -25q0 -16 17.5 -20.5t42 -4t49 -2.5t42 -21.5t17.5 -54.5zM2304 407v-101q-24 -35 -88 -35h-125v58h125q33 0 33 25q0 13 -12.5 19t-31 5.5t-40 2t-40 8t-31 24t-12.5 48.5q0 39 26.5 60t66.5 21h129v-57h-118q-36 0 -36 -25q0 -20 29 -22t68.5 -5 t56.5 -26zM2139 1008v-270h-92l-122 203v-203h-132l-26 60h-134l-25 -60h-75q-129 0 -129 133q0 138 133 138h63v-59q-7 0 -28 1t-28.5 0.5t-23 -2t-21.5 -6.5t-14.5 -13.5t-11.5 -23t-3 -33.5q0 -38 13.5 -58t49.5 -20h29l92 213h97l109 -256v256h99l114 -188v188h66z" /> +<glyph unicode="" horiz-adv-x="2304" d="M745 630q0 -37 -25.5 -61.5t-62.5 -24.5q-29 0 -46.5 16t-17.5 44q0 37 25 62.5t62 25.5q28 0 46.5 -16.5t18.5 -45.5zM1530 779q0 -42 -22 -57t-66 -15l-32 -1l17 107q2 11 13 11h18q22 0 35 -2t25 -12.5t12 -30.5zM1881 630q0 -36 -25.5 -61t-61.5 -25q-29 0 -47 16 t-18 44q0 37 25 62.5t62 25.5q28 0 46.5 -16.5t18.5 -45.5zM513 801q0 59 -38.5 85.5t-100.5 26.5h-160q-19 0 -21 -19l-65 -408q-1 -6 3 -11t10 -5h76q20 0 22 19l18 110q1 8 7 13t15 6.5t17 1.5t19 -1t14 -1q86 0 135 48.5t49 134.5zM822 489l41 261q1 6 -3 11t-10 5h-76 q-14 0 -17 -33q-27 40 -95 40q-72 0 -122.5 -54t-50.5 -127q0 -59 34.5 -94t92.5 -35q28 0 58 12t48 32q-4 -12 -4 -21q0 -16 13 -16h69q19 0 22 19zM1269 752q0 5 -4 9.5t-9 4.5h-77q-11 0 -18 -10l-106 -156l-44 150q-5 16 -22 16h-75q-5 0 -9 -4.5t-4 -9.5q0 -2 19.5 -59 t42 -123t23.5 -70q-82 -112 -82 -120q0 -13 13 -13h77q11 0 18 10l255 368q2 2 2 7zM1649 801q0 59 -38.5 85.5t-100.5 26.5h-159q-20 0 -22 -19l-65 -408q-1 -6 3 -11t10 -5h82q12 0 16 13l18 116q1 8 7 13t15 6.5t17 1.5t19 -1t14 -1q86 0 135 48.5t49 134.5zM1958 489 l41 261q1 6 -3 11t-10 5h-76q-14 0 -17 -33q-26 40 -95 40q-72 0 -122.5 -54t-50.5 -127q0 -59 34.5 -94t92.5 -35q29 0 59 12t47 32q0 -1 -2 -9t-2 -12q0 -16 13 -16h69q19 0 22 19zM2176 898v1q0 14 -13 14h-74q-11 0 -13 -11l-65 -416l-1 -2q0 -5 4 -9.5t10 -4.5h66 q19 0 21 19zM392 764q-5 -35 -26 -46t-60 -11l-33 -1l17 107q2 11 13 11h19q40 0 58 -11.5t12 -48.5zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1597 633q0 -69 -21 -106q-19 -35 -52 -35q-23 0 -41 9v224q29 30 57 30q57 0 57 -122zM2035 669h-110q6 98 56 98q51 0 54 -98zM476 534q0 59 -33 91.5t-101 57.5q-36 13 -52 24t-16 25q0 26 38 26q58 0 124 -33l18 112q-67 32 -149 32q-77 0 -123 -38q-48 -39 -48 -109 q0 -58 32.5 -90.5t99.5 -56.5q39 -14 54.5 -25.5t15.5 -27.5q0 -31 -48 -31q-29 0 -70 12.5t-72 30.5l-18 -113q72 -41 168 -41q81 0 129 37q51 41 51 117zM771 749l19 111h-96v135l-129 -21l-18 -114l-46 -8l-17 -103h62v-219q0 -84 44 -120q38 -30 111 -30q32 0 79 11v118 q-32 -7 -44 -7q-42 0 -42 50v197h77zM1087 724v139q-15 3 -28 3q-32 0 -55.5 -16t-33.5 -46l-10 56h-131v-471h150v306q26 31 82 31q16 0 26 -2zM1124 389h150v471h-150v-471zM1746 638q0 122 -45 179q-40 52 -111 52q-64 0 -117 -56l-8 47h-132v-645l150 25v151 q36 -11 68 -11q83 0 134 56q61 65 61 202zM1278 986q0 33 -23 56t-56 23t-56 -23t-23 -56t23 -56.5t56 -23.5t56 23.5t23 56.5zM2176 629q0 113 -48 176q-50 64 -144 64q-96 0 -151.5 -66t-55.5 -180q0 -128 63 -188q55 -55 161 -55q101 0 160 40l-16 103q-57 -31 -128 -31 q-43 0 -63 19q-23 19 -28 66h248q2 14 2 52zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1558 684q61 -356 298 -556q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-180.5 74.5t-75.5 180.5zM1024 -176q16 0 16 16t-16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5zM2026 1424q8 -10 7.5 -23.5t-10.5 -22.5 l-1872 -1622q-10 -8 -23.5 -7t-21.5 11l-84 96q-8 10 -7.5 23.5t10.5 21.5l186 161q-19 32 -19 66q50 42 91 88t85 119.5t74.5 158.5t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q124 -18 219 -82.5t148 -157.5 l418 363q10 8 23.5 7t21.5 -11z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1040 -160q0 16 -16 16q-59 0 -101.5 42.5t-42.5 101.5q0 16 -16 16t-16 -16q0 -73 51.5 -124.5t124.5 -51.5q16 0 16 16zM503 315l877 760q-42 88 -132.5 146.5t-223.5 58.5q-93 0 -169.5 -31.5t-121.5 -80.5t-69 -103t-24 -105q0 -384 -137 -645zM1856 128 q0 -52 -38 -90t-90 -38h-448q0 -106 -75 -181t-181 -75t-180.5 74.5t-75.5 180.5l149 129h757q-166 187 -227 459l111 97q61 -356 298 -556zM1942 1520l84 -96q8 -10 7.5 -23.5t-10.5 -22.5l-1872 -1622q-10 -8 -23.5 -7t-21.5 11l-84 96q-8 10 -7.5 23.5t10.5 21.5l186 161 q-19 32 -19 66q50 42 91 88t85 119.5t74.5 158.5t50 206t19.5 260q0 152 117 282.5t307 158.5q-8 19 -8 39q0 40 28 68t68 28t68 -28t28 -68q0 -20 -8 -39q124 -18 219 -82.5t148 -157.5l418 363q10 8 23.5 7t21.5 -11z" /> +<glyph unicode="" horiz-adv-x="1408" d="M512 160v704q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-704q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM768 160v704q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-704q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1024 160v704q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-704 q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM480 1152h448l-48 117q-7 9 -17 11h-317q-10 -2 -17 -11zM1408 1120v-64q0 -14 -9 -23t-23 -9h-96v-948q0 -83 -47 -143.5t-113 -60.5h-832q-66 0 -113 58.5t-47 141.5v952h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h309l70 167 q15 37 54 63t79 26h320q40 0 79 -26t54 -63l70 -167h309q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1150 462v-109q0 -50 -36.5 -89t-94 -60.5t-118 -32.5t-117.5 -11q-205 0 -342.5 139t-137.5 346q0 203 136 339t339 136q34 0 75.5 -4.5t93 -18t92.5 -34t69 -56.5t28 -81v-109q0 -16 -16 -16h-118q-16 0 -16 16v70q0 43 -65.5 67.5t-137.5 24.5q-140 0 -228.5 -91.5 t-88.5 -237.5q0 -151 91.5 -249.5t233.5 -98.5q68 0 138 24t70 66v70q0 7 4.5 11.5t10.5 4.5h119q6 0 11 -4.5t5 -11.5zM768 1280q-130 0 -248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5 t-51 248.5t-136.5 204t-204 136.5t-248.5 51zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M972 761q0 108 -53.5 169t-147.5 61q-63 0 -124 -30.5t-110 -84.5t-79.5 -137t-30.5 -180q0 -112 53.5 -173t150.5 -61q96 0 176 66.5t122.5 166t42.5 203.5zM1536 640q0 -111 -37 -197t-98.5 -135t-131.5 -74.5t-145 -27.5q-6 0 -15.5 -0.5t-16.5 -0.5q-95 0 -142 53 q-28 33 -33 83q-52 -66 -131.5 -110t-173.5 -44q-161 0 -249.5 95.5t-88.5 269.5q0 157 66 290t179 210.5t246 77.5q87 0 155 -35.5t106 -99.5l2 19l11 56q1 6 5.5 12t9.5 6h118q5 0 13 -11q5 -5 3 -16l-120 -614q-5 -24 -5 -48q0 -39 12.5 -52t44.5 -13q28 1 57 5.5t73 24 t77 50t57 89.5t24 137q0 292 -174 466t-466 174q-130 0 -248.5 -51t-204 -136.5t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51q228 0 405 144q11 9 24 8t21 -12l41 -49q8 -12 7 -24q-2 -13 -12 -22q-102 -83 -227.5 -128t-258.5 -45q-156 0 -298 61 t-245 164t-164 245t-61 298t61 298t164 245t245 164t298 61q344 0 556 -212t212 -556z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1698 1442q94 -94 94 -226.5t-94 -225.5l-225 -223l104 -104q10 -10 10 -23t-10 -23l-210 -210q-10 -10 -23 -10t-23 10l-105 105l-603 -603q-37 -37 -90 -37h-203l-256 -128l-64 64l128 256v203q0 53 37 90l603 603l-105 105q-10 10 -10 23t10 23l210 210q10 10 23 10 t23 -10l104 -104l223 225q93 94 225.5 94t226.5 -94zM512 64l576 576l-192 192l-576 -576v-192h192z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1615 1536q70 0 122.5 -46.5t52.5 -116.5q0 -63 -45 -151q-332 -629 -465 -752q-97 -91 -218 -91q-126 0 -216.5 92.5t-90.5 219.5q0 128 92 212l638 579q59 54 130 54zM706 502q39 -76 106.5 -130t150.5 -76l1 -71q4 -213 -129.5 -347t-348.5 -134q-123 0 -218 46.5 t-152.5 127.5t-86.5 183t-29 220q7 -5 41 -30t62 -44.5t59 -36.5t46 -17q41 0 55 37q25 66 57.5 112.5t69.5 76t88 47.5t103 25.5t125 10.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 128v-384h-1792v384q45 0 85 14t59 27.5t47 37.5q30 27 51.5 38t56.5 11t55.5 -11t52.5 -38q29 -25 47 -38t58 -27t86 -14q45 0 85 14.5t58 27t48 37.5q21 19 32.5 27t31 15t43.5 7q35 0 56.5 -11t51.5 -38q28 -24 47 -37.5t59 -27.5t85 -14t85 14t59 27.5t47 37.5 q30 27 51.5 38t56.5 11q34 0 55.5 -11t51.5 -38q28 -24 47 -37.5t59 -27.5t85 -14zM1792 448v-192q-35 0 -55.5 11t-52.5 38q-29 25 -47 38t-58 27t-85 14q-46 0 -86 -14t-58 -27t-47 -38q-22 -19 -33 -27t-31 -15t-44 -7q-35 0 -56.5 11t-51.5 38q-29 25 -47 38t-58 27 t-86 14q-45 0 -85 -14.5t-58 -27t-48 -37.5q-21 -19 -32.5 -27t-31 -15t-43.5 -7q-35 0 -56.5 11t-51.5 38q-28 24 -47 37.5t-59 27.5t-85 14q-46 0 -86 -14t-58 -27t-47 -38q-30 -27 -51.5 -38t-56.5 -11v192q0 80 56 136t136 56h64v448h256v-448h256v448h256v-448h256v448 h256v-448h64q80 0 136 -56t56 -136zM512 1312q0 -77 -36 -118.5t-92 -41.5q-53 0 -90.5 37.5t-37.5 90.5q0 29 9.5 51t23.5 34t31 28t31 31.5t23.5 44.5t9.5 67q38 0 83 -74t45 -150zM1024 1312q0 -77 -36 -118.5t-92 -41.5q-53 0 -90.5 37.5t-37.5 90.5q0 29 9.5 51 t23.5 34t31 28t31 31.5t23.5 44.5t9.5 67q38 0 83 -74t45 -150zM1536 1312q0 -77 -36 -118.5t-92 -41.5q-53 0 -90.5 37.5t-37.5 90.5q0 29 9.5 51t23.5 34t31 28t31 31.5t23.5 44.5t9.5 67q38 0 83 -74t45 -150z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 0v-128h-2048v1536h128v-1408h1920zM1664 1024l256 -896h-1664v576l448 576l576 -576z" /> +<glyph unicode="" horiz-adv-x="1792" d="M768 646l546 -546q-106 -108 -247.5 -168t-298.5 -60q-209 0 -385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103v-762zM955 640h773q0 -157 -60 -298.5t-168 -247.5zM1664 768h-768v768q209 0 385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 0v-128h-2048v1536h128v-1408h1920zM1920 1248v-435q0 -21 -19.5 -29.5t-35.5 7.5l-121 121l-633 -633q-10 -10 -23 -10t-23 10l-233 233l-416 -416l-192 192l585 585q10 10 23 10t23 -10l233 -233l464 464l-121 121q-16 16 -7.5 35.5t29.5 19.5h435q14 0 23 -9 t9 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1292 832q0 -6 10 -41q10 -29 25 -49.5t41 -34t44 -20t55 -16.5q325 -91 325 -332q0 -146 -105.5 -242.5t-254.5 -96.5q-59 0 -111.5 18.5t-91.5 45.5t-77 74.5t-63 87.5t-53.5 103.5t-43.5 103t-39.5 106.5t-35.5 95q-32 81 -61.5 133.5t-73.5 96.5t-104 64t-142 20 q-96 0 -183 -55.5t-138 -144.5t-51 -185q0 -160 106.5 -279.5t263.5 -119.5q177 0 258 95q56 63 83 116l84 -152q-15 -34 -44 -70l1 -1q-131 -152 -388 -152q-147 0 -269.5 79t-190.5 207.5t-68 274.5q0 105 43.5 206t116 176.5t172 121.5t204.5 46q87 0 159 -19t123.5 -50 t95 -80t72.5 -99t58.5 -117t50.5 -124.5t50 -130.5t55 -127q96 -200 233 -200q81 0 138.5 48.5t57.5 128.5q0 42 -19 72t-50.5 46t-72.5 31.5t-84.5 27t-87.5 34t-81 52t-65 82t-39 122.5q-3 16 -3 33q0 110 87.5 192t198.5 78q78 -3 120.5 -14.5t90.5 -53.5h-1 q12 -11 23 -24.5t26 -36t19 -27.5l-129 -99q-26 49 -54 70v1q-23 21 -97 21q-49 0 -84 -33t-35 -83z" /> +<glyph unicode="" d="M1432 484q0 173 -234 239q-35 10 -53 16.5t-38 25t-29 46.5q0 2 -2 8.5t-3 12t-1 7.5q0 36 24.5 59.5t60.5 23.5q54 0 71 -15h-1q20 -15 39 -51l93 71q-39 54 -49 64q-33 29 -67.5 39t-85.5 10q-80 0 -142 -57.5t-62 -137.5q0 -7 2 -23q16 -96 64.5 -140t148.5 -73 q29 -8 49 -15.5t45 -21.5t38.5 -34.5t13.5 -46.5v-5q1 -58 -40.5 -93t-100.5 -35q-97 0 -167 144q-23 47 -51.5 121.5t-48 125.5t-54 110.5t-74 95.5t-103.5 60.5t-147 24.5q-101 0 -192 -56t-144 -148t-50 -192v-1q4 -108 50.5 -199t133.5 -147.5t196 -56.5q186 0 279 110 q20 27 31 51l-60 109q-42 -80 -99 -116t-146 -36q-115 0 -191 87t-76 204q0 105 82 189t186 84q112 0 170 -53.5t104 -172.5q8 -21 25.5 -68.5t28.5 -76.5t31.5 -74.5t38.5 -74t45.5 -62.5t55.5 -53.5t66 -33t80 -13.5q107 0 183 69.5t76 174.5zM1536 1120v-960 q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1152 640q0 104 -40.5 198.5t-109.5 163.5t-163.5 109.5t-198.5 40.5t-198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5t40.5 -198.5t109.5 -163.5t163.5 -109.5t198.5 -40.5t198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5zM1920 640q0 104 -40.5 198.5 t-109.5 163.5t-163.5 109.5t-198.5 40.5h-386q119 -90 188.5 -224t69.5 -288t-69.5 -288t-188.5 -224h386q104 0 198.5 40.5t163.5 109.5t109.5 163.5t40.5 198.5zM2048 640q0 -130 -51 -248.5t-136.5 -204t-204 -136.5t-248.5 -51h-768q-130 0 -248.5 51t-204 136.5 t-136.5 204t-51 248.5t51 248.5t136.5 204t204 136.5t248.5 51h768q130 0 248.5 -51t204 -136.5t136.5 -204t51 -248.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M0 640q0 130 51 248.5t136.5 204t204 136.5t248.5 51h768q130 0 248.5 -51t204 -136.5t136.5 -204t51 -248.5t-51 -248.5t-136.5 -204t-204 -136.5t-248.5 -51h-768q-130 0 -248.5 51t-204 136.5t-136.5 204t-51 248.5zM1408 128q104 0 198.5 40.5t163.5 109.5 t109.5 163.5t40.5 198.5t-40.5 198.5t-109.5 163.5t-163.5 109.5t-198.5 40.5t-198.5 -40.5t-163.5 -109.5t-109.5 -163.5t-40.5 -198.5t40.5 -198.5t109.5 -163.5t163.5 -109.5t198.5 -40.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M762 384h-314q-40 0 -57.5 35t6.5 67l188 251q-65 31 -137 31q-132 0 -226 -94t-94 -226t94 -226t226 -94q115 0 203 72.5t111 183.5zM576 512h186q-18 85 -75 148zM1056 512l288 384h-480l-99 -132q105 -103 126 -252h165zM2176 448q0 132 -94 226t-226 94 q-60 0 -121 -24l174 -260q15 -23 10 -49t-27 -40q-15 -11 -36 -11q-35 0 -53 29l-174 260q-93 -95 -93 -225q0 -132 94 -226t226 -94t226 94t94 226zM2304 448q0 -185 -131.5 -316.5t-316.5 -131.5t-316.5 131.5t-131.5 316.5q0 97 39.5 183.5t109.5 149.5l-65 98l-353 -469 q-18 -26 -51 -26h-197q-23 -164 -149 -274t-294 -110q-185 0 -316.5 131.5t-131.5 316.5t131.5 316.5t316.5 131.5q114 0 215 -55l137 183h-224q-26 0 -45 19t-19 45t19 45t45 19h384v-128h435l-85 128h-222q-26 0 -45 19t-19 45t19 45t45 19h256q33 0 53 -28l267 -400 q91 44 192 44q185 0 316.5 -131.5t131.5 -316.5z" /> +<glyph unicode="" d="M384 320q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1408 320q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1362 716l-72 384q-5 23 -22.5 37.5t-40.5 14.5 h-918q-23 0 -40.5 -14.5t-22.5 -37.5l-72 -384q-5 -30 14 -53t49 -23h1062q30 0 49 23t14 53zM1136 1328q0 20 -14 34t-34 14h-640q-20 0 -34 -14t-14 -34t14 -34t34 -14h640q20 0 34 14t14 34zM1536 603v-603h-128v-128q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5 t-37.5 90.5v128h-768v-128q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5v128h-128v603q0 112 25 223l103 454q9 78 97.5 137t230 89t312.5 30t312.5 -30t230 -89t97.5 -137l105 -454q23 -102 23 -223z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1463 704q0 -35 -25 -60.5t-61 -25.5h-702q-36 0 -61 25.5t-25 60.5t25 60.5t61 25.5h702q36 0 61 -25.5t25 -60.5zM1677 704q0 86 -23 170h-982q-36 0 -61 25t-25 60q0 36 25 61t61 25h908q-88 143 -235 227t-320 84q-177 0 -327.5 -87.5t-238 -237.5t-87.5 -327 q0 -86 23 -170h982q36 0 61 -25t25 -60q0 -36 -25 -61t-61 -25h-908q88 -143 235.5 -227t320.5 -84q132 0 253 51.5t208 139t139 208t52 253.5zM2048 959q0 -35 -25 -60t-61 -25h-131q17 -85 17 -170q0 -167 -65.5 -319.5t-175.5 -263t-262.5 -176t-319.5 -65.5 q-246 0 -448.5 133t-301.5 350h-189q-36 0 -61 25t-25 61q0 35 25 60t61 25h132q-17 85 -17 170q0 167 65.5 319.5t175.5 263t262.5 176t320.5 65.5q245 0 447.5 -133t301.5 -350h188q36 0 61 -25t25 -61z" /> +<glyph unicode="" horiz-adv-x="1280" d="M953 1158l-114 -328l117 -21q165 451 165 518q0 56 -38 56q-57 0 -130 -225zM654 471l33 -88q37 42 71 67l-33 5.5t-38.5 7t-32.5 8.5zM362 1367q0 -98 159 -521q18 10 49 10q15 0 75 -5l-121 351q-75 220 -123 220q-19 0 -29 -17.5t-10 -37.5zM283 608q0 -36 51.5 -119 t117.5 -153t100 -70q14 0 25.5 13t11.5 27q0 24 -32 102q-13 32 -32 72t-47.5 89t-61.5 81t-62 32q-20 0 -45.5 -27t-25.5 -47zM125 273q0 -41 25 -104q59 -145 183.5 -227t281.5 -82q227 0 382 170q152 169 152 427q0 43 -1 67t-11.5 62t-30.5 56q-56 49 -211.5 75.5 t-270.5 26.5q-37 0 -49 -11q-12 -5 -12 -35q0 -34 21.5 -60t55.5 -40t77.5 -23.5t87.5 -11.5t85 -4t70 0h23q24 0 40 -19q15 -19 19 -55q-28 -28 -96 -54q-61 -22 -93 -46q-64 -46 -108.5 -114t-44.5 -137q0 -31 18.5 -88.5t18.5 -87.5l-3 -12q-4 -12 -4 -14 q-137 10 -146 216q-8 -2 -41 -2q2 -7 2 -21q0 -53 -40.5 -89.5t-94.5 -36.5q-82 0 -166.5 78t-84.5 159q0 34 33 67q52 -64 60 -76q77 -104 133 -104q12 0 26.5 8.5t14.5 20.5q0 34 -87.5 145t-116.5 111q-43 0 -70 -44.5t-27 -90.5zM11 264q0 101 42.5 163t136.5 88 q-28 74 -28 104q0 62 61 123t122 61q29 0 70 -15q-163 462 -163 567q0 80 41 130.5t119 50.5q131 0 325 -581q6 -17 8 -23q6 16 29 79.5t43.5 118.5t54 127.5t64.5 123t70.5 86.5t76.5 36q71 0 112 -49t41 -122q0 -108 -159 -550q61 -15 100.5 -46t58.5 -78t26 -93.5 t7 -110.5q0 -150 -47 -280t-132 -225t-211 -150t-278 -55q-111 0 -223 42q-149 57 -258 191.5t-109 286.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M785 528h207q-14 -158 -98.5 -248.5t-214.5 -90.5q-162 0 -254.5 116t-92.5 316q0 194 93 311.5t233 117.5q148 0 232 -87t97 -247h-203q-5 64 -35.5 99t-81.5 35q-57 0 -88.5 -60.5t-31.5 -177.5q0 -48 5 -84t18 -69.5t40 -51.5t66 -18q95 0 109 139zM1497 528h206 q-14 -158 -98 -248.5t-214 -90.5q-162 0 -254.5 116t-92.5 316q0 194 93 311.5t233 117.5q148 0 232 -87t97 -247h-204q-4 64 -35 99t-81 35q-57 0 -88.5 -60.5t-31.5 -177.5q0 -48 5 -84t18 -69.5t39.5 -51.5t65.5 -18q49 0 76.5 38t33.5 101zM1856 647q0 207 -15.5 307 t-60.5 161q-6 8 -13.5 14t-21.5 15t-16 11q-86 63 -697 63q-625 0 -710 -63q-5 -4 -17.5 -11.5t-21 -14t-14.5 -14.5q-45 -60 -60 -159.5t-15 -308.5q0 -208 15 -307.5t60 -160.5q6 -8 15 -15t20.5 -14t17.5 -12q44 -33 239.5 -49t470.5 -16q610 0 697 65q5 4 17 11t20.5 14 t13.5 16q46 60 61 159t15 309zM2048 1408v-1536h-2048v1536h2048z" /> +<glyph unicode="" d="M992 912v-496q0 -14 -9 -23t-23 -9h-160q-14 0 -23 9t-9 23v496q0 112 -80 192t-192 80h-272v-1152q0 -14 -9 -23t-23 -9h-160q-14 0 -23 9t-9 23v1344q0 14 9 23t23 9h464q135 0 249 -66.5t180.5 -180.5t66.5 -249zM1376 1376v-880q0 -135 -66.5 -249t-180.5 -180.5 t-249 -66.5h-464q-14 0 -23 9t-9 23v960q0 14 9 23t23 9h160q14 0 23 -9t9 -23v-768h272q112 0 192 80t80 192v880q0 14 9 23t23 9h160q14 0 23 -9t9 -23z" /> +<glyph unicode="" d="M1311 694v-114q0 -24 -13.5 -38t-37.5 -14h-202q-24 0 -38 14t-14 38v114q0 24 14 38t38 14h202q24 0 37.5 -14t13.5 -38zM821 464v250q0 53 -32.5 85.5t-85.5 32.5h-133q-68 0 -96 -52q-28 52 -96 52h-130q-53 0 -85.5 -32.5t-32.5 -85.5v-250q0 -22 21 -22h55 q22 0 22 22v230q0 24 13.5 38t38.5 14h94q24 0 38 -14t14 -38v-230q0 -22 21 -22h54q22 0 22 22v230q0 24 14 38t38 14h97q24 0 37.5 -14t13.5 -38v-230q0 -22 22 -22h55q21 0 21 22zM1410 560v154q0 53 -33 85.5t-86 32.5h-264q-53 0 -86 -32.5t-33 -85.5v-410 q0 -21 22 -21h55q21 0 21 21v180q31 -42 94 -42h191q53 0 86 32.5t33 85.5zM1536 1176v-1072q0 -96 -68 -164t-164 -68h-1072q-96 0 -164 68t-68 164v1072q0 96 68 164t164 68h1072q96 0 164 -68t68 -164z" /> +<glyph unicode="" d="M915 450h-294l147 551zM1001 128h311l-324 1024h-440l-324 -1024h311l383 314zM1536 1120v-960q0 -118 -85 -203t-203 -85h-960q-118 0 -203 85t-85 203v960q0 118 85 203t203 85h960q118 0 203 -85t85 -203z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 641q0 -21 -13 -36.5t-33 -19.5l-205 -356q3 -9 3 -18q0 -20 -12.5 -35.5t-32.5 -19.5l-193 -337q3 -8 3 -16q0 -23 -16.5 -40t-40.5 -17q-25 0 -41 18h-400q-17 -20 -43 -20t-43 20h-399q-17 -20 -43 -20q-23 0 -40 16.5t-17 40.5q0 8 4 20l-193 335 q-20 4 -32.5 19.5t-12.5 35.5q0 9 3 18l-206 356q-20 5 -32.5 20.5t-12.5 35.5q0 21 13.5 36.5t33.5 19.5l199 344q0 1 -0.5 3t-0.5 3q0 36 34 51l209 363q-4 10 -4 18q0 24 17 40.5t40 16.5q26 0 44 -21h396q16 21 43 21t43 -21h398q18 21 44 21q23 0 40 -16.5t17 -40.5 q0 -6 -4 -18l207 -358q23 -1 39 -17.5t16 -38.5q0 -13 -7 -27l187 -324q19 -4 31.5 -19.5t12.5 -35.5zM1063 -158h389l-342 354h-143l-342 -354h360q18 16 39 16t39 -16zM112 654q1 -4 1 -13q0 -10 -2 -15l208 -360q2 0 4.5 -1t5.5 -2.5l5 -2.5l188 199v347l-187 194 q-13 -8 -29 -10zM986 1438h-388l190 -200l554 200h-280q-16 -16 -38 -16t-38 16zM1689 226q1 6 5 11l-64 68l-17 -79h76zM1583 226l22 105l-252 266l-296 -307l63 -64h463zM1495 -142l16 28l65 310h-427l333 -343q8 4 13 5zM578 -158h5l342 354h-373v-335l4 -6q14 -5 22 -13 zM552 226h402l64 66l-309 321l-157 -166v-221zM359 226h163v189l-168 -177q4 -8 5 -12zM358 1051q0 -1 0.5 -2t0.5 -2q0 -16 -8 -29l171 -177v269zM552 1121v-311l153 -157l297 314l-223 236zM556 1425l-4 -8v-264l205 74l-191 201q-6 -2 -10 -3zM1447 1438h-16l-621 -224 l213 -225zM1023 946l-297 -315l311 -319l296 307zM688 634l-136 141v-284zM1038 270l-42 -44h85zM1374 618l238 -251l132 624l-3 5l-1 1zM1718 1018q-8 13 -8 29v2l-216 376q-5 1 -13 5l-437 -463l310 -327zM522 1142v223l-163 -282zM522 196h-163l163 -283v283zM1607 196 l-48 -227l130 227h-82zM1729 266l207 361q-2 10 -2 14q0 1 3 16l-171 296l-129 -612l77 -82q5 3 15 7z" /> +<glyph unicode="" d="M0 856q0 131 91.5 226.5t222.5 95.5h742l352 358v-1470q0 -132 -91.5 -227t-222.5 -95h-780q-131 0 -222.5 95t-91.5 227v790zM1232 102l-176 180v425q0 46 -32 79t-78 33h-484q-46 0 -78 -33t-32 -79v-492q0 -46 32.5 -79.5t77.5 -33.5h770z" /> +<glyph unicode="" d="M934 1386q-317 -121 -556 -362.5t-358 -560.5q-20 89 -20 176q0 208 102.5 384.5t278.5 279t384 102.5q82 0 169 -19zM1203 1267q93 -65 164 -155q-389 -113 -674.5 -400.5t-396.5 -676.5q-93 72 -155 162q112 386 395 671t667 399zM470 -67q115 356 379.5 622t619.5 384 q40 -92 54 -195q-292 -120 -516 -345t-343 -518q-103 14 -194 52zM1536 -125q-193 50 -367 115q-135 -84 -290 -107q109 205 274 370.5t369 275.5q-21 -152 -101 -284q65 -175 115 -370z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1893 1144l155 -1272q-131 0 -257 57q-200 91 -393 91q-226 0 -374 -148q-148 148 -374 148q-193 0 -393 -91q-128 -57 -252 -57h-5l155 1272q224 127 482 127q233 0 387 -106q154 106 387 106q258 0 482 -127zM1398 157q129 0 232 -28.5t260 -93.5l-124 1021 q-171 78 -368 78q-224 0 -374 -141q-150 141 -374 141q-197 0 -368 -78l-124 -1021q105 43 165.5 65t148.5 39.5t178 17.5q202 0 374 -108q172 108 374 108zM1438 191l-55 907q-211 -4 -359 -155q-152 155 -374 155q-176 0 -336 -66l-114 -941q124 51 228.5 76t221.5 25 q209 0 374 -102q172 107 374 102z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1500 165v733q0 21 -15 36t-35 15h-93q-20 0 -35 -15t-15 -36v-733q0 -20 15 -35t35 -15h93q20 0 35 15t15 35zM1216 165v531q0 20 -15 35t-35 15h-101q-20 0 -35 -15t-15 -35v-531q0 -20 15 -35t35 -15h101q20 0 35 15t15 35zM924 165v429q0 20 -15 35t-35 15h-101 q-20 0 -35 -15t-15 -35v-429q0 -20 15 -35t35 -15h101q20 0 35 15t15 35zM632 165v362q0 20 -15 35t-35 15h-101q-20 0 -35 -15t-15 -35v-362q0 -20 15 -35t35 -15h101q20 0 35 15t15 35zM2048 311q0 -166 -118 -284t-284 -118h-1244q-166 0 -284 118t-118 284 q0 116 63 214.5t168 148.5q-10 34 -10 73q0 113 80.5 193.5t193.5 80.5q102 0 180 -67q45 183 194 300t338 117q149 0 275 -73.5t199.5 -199.5t73.5 -275q0 -66 -14 -122q135 -33 221 -142.5t86 -247.5z" /> +<glyph unicode="" d="M0 1536h1536v-1392l-776 -338l-760 338v1392zM1436 209v926h-1336v-926l661 -294zM1436 1235v201h-1336v-201h1336zM181 937v-115h-37v115h37zM181 789v-115h-37v115h37zM181 641v-115h-37v115h37zM181 493v-115h-37v115h37zM181 345v-115h-37v115h37zM207 202l15 34 l105 -47l-15 -33zM343 142l15 34l105 -46l-15 -34zM478 82l15 34l105 -46l-15 -34zM614 23l15 33l104 -46l-15 -34zM797 10l105 46l15 -33l-105 -47zM932 70l105 46l15 -34l-105 -46zM1068 130l105 46l15 -34l-105 -46zM1203 189l105 47l15 -34l-105 -46zM259 1389v-36h-114 v36h114zM421 1389v-36h-115v36h115zM583 1389v-36h-115v36h115zM744 1389v-36h-114v36h114zM906 1389v-36h-114v36h114zM1068 1389v-36h-115v36h115zM1230 1389v-36h-115v36h115zM1391 1389v-36h-114v36h114zM181 1049v-79h-37v115h115v-36h-78zM421 1085v-36h-115v36h115z M583 1085v-36h-115v36h115zM744 1085v-36h-114v36h114zM906 1085v-36h-114v36h114zM1068 1085v-36h-115v36h115zM1230 1085v-36h-115v36h115zM1355 970v79h-78v36h115v-115h-37zM1355 822v115h37v-115h-37zM1355 674v115h37v-115h-37zM1355 526v115h37v-115h-37zM1355 378 v115h37v-115h-37zM1355 230v115h37v-115h-37zM760 265q-129 0 -221 91.5t-92 221.5q0 129 92 221t221 92q130 0 221.5 -92t91.5 -221q0 -130 -91.5 -221.5t-221.5 -91.5zM595 646q0 -36 19.5 -56.5t49.5 -25t64 -7t64 -2t49.5 -9t19.5 -30.5q0 -49 -112 -49q-97 0 -123 51 h-3l-31 -63q67 -42 162 -42q29 0 56.5 5t55.5 16t45.5 33t17.5 53q0 46 -27.5 69.5t-67.5 27t-79.5 3t-67 5t-27.5 25.5q0 21 20.5 33t40.5 15t41 3q34 0 70.5 -11t51.5 -34h3l30 58q-3 1 -21 8.5t-22.5 9t-19.5 7t-22 7t-20 4.5t-24 4t-23 1q-29 0 -56.5 -5t-54 -16.5 t-43 -34t-16.5 -53.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M863 504q0 112 -79.5 191.5t-191.5 79.5t-191 -79.5t-79 -191.5t79 -191t191 -79t191.5 79t79.5 191zM1726 505q0 112 -79 191t-191 79t-191.5 -79t-79.5 -191q0 -113 79.5 -192t191.5 -79t191 79.5t79 191.5zM2048 1314v-1348q0 -44 -31.5 -75.5t-76.5 -31.5h-1832 q-45 0 -76.5 31.5t-31.5 75.5v1348q0 44 31.5 75.5t76.5 31.5h431q44 0 76 -31.5t32 -75.5v-161h754v161q0 44 32 75.5t76 31.5h431q45 0 76.5 -31.5t31.5 -75.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1430 953zM1690 749q148 0 253 -98.5t105 -244.5q0 -157 -109 -261.5t-267 -104.5q-85 0 -162 27.5t-138 73.5t-118 106t-109 126.5t-103.5 132.5t-108.5 126t-117 106t-136 73.5t-159 27.5q-154 0 -251.5 -91.5t-97.5 -244.5q0 -157 104 -250t263 -93q100 0 208 37.5 t193 98.5q5 4 21 18.5t30 24t22 9.5q14 0 24.5 -10.5t10.5 -24.5q0 -24 -60 -77q-101 -88 -234.5 -142t-260.5 -54q-133 0 -245.5 58t-180 165t-67.5 241q0 205 141.5 341t347.5 136q120 0 226.5 -43.5t185.5 -113t151.5 -153t139 -167.5t133.5 -153.5t149.5 -113 t172.5 -43.5q102 0 168.5 61.5t66.5 162.5q0 95 -64.5 159t-159.5 64q-30 0 -81.5 -18.5t-68.5 -18.5q-20 0 -35.5 15t-15.5 35q0 18 8.5 57t8.5 59q0 159 -107.5 263t-266.5 104q-58 0 -111.5 -18.5t-84 -40.5t-55.5 -40.5t-33 -18.5q-15 0 -25.5 10.5t-10.5 25.5 q0 19 25 46q59 67 147 103.5t182 36.5q191 0 318 -125.5t127 -315.5q0 -37 -4 -66q57 15 115 15z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1216 832q0 26 -19 45t-45 19h-128v128q0 26 -19 45t-45 19t-45 -19t-19 -45v-128h-128q-26 0 -45 -19t-19 -45t19 -45t45 -19h128v-128q0 -26 19 -45t45 -19t45 19t19 45v128h128q26 0 45 19t19 45zM640 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5 t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1536 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1664 1088v-512q0 -24 -16 -42.5t-41 -21.5l-1044 -122q1 -7 4.5 -21.5t6 -26.5t2.5 -22q0 -16 -24 -64h920 q26 0 45 -19t19 -45t-19 -45t-45 -19h-1024q-26 0 -45 19t-19 45q0 14 11 39.5t29.5 59.5t20.5 38l-177 823h-204q-26 0 -45 19t-19 45t19 45t45 19h256q16 0 28.5 -6.5t20 -15.5t13 -24.5t7.5 -26.5t5.5 -29.5t4.5 -25.5h1201q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1664" d="M1280 832q0 26 -19 45t-45 19t-45 -19l-147 -146v293q0 26 -19 45t-45 19t-45 -19t-19 -45v-293l-147 146q-19 19 -45 19t-45 -19t-19 -45t19 -45l256 -256q19 -19 45 -19t45 19l256 256q19 19 19 45zM640 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5 t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1536 0q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1664 1088v-512q0 -24 -16 -42.5t-41 -21.5l-1044 -122q1 -7 4.5 -21.5t6 -26.5t2.5 -22q0 -16 -24 -64h920 q26 0 45 -19t19 -45t-19 -45t-45 -19h-1024q-26 0 -45 19t-19 45q0 14 11 39.5t29.5 59.5t20.5 38l-177 823h-204q-26 0 -45 19t-19 45t19 45t45 19h256q16 0 28.5 -6.5t20 -15.5t13 -24.5t7.5 -26.5t5.5 -29.5t4.5 -25.5h1201q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="2048" d="M212 768l623 -665l-300 665h-323zM1024 -4l349 772h-698zM538 896l204 384h-262l-288 -384h346zM1213 103l623 665h-323zM683 896h682l-204 384h-274zM1510 896h346l-288 384h-262zM1651 1382l384 -512q14 -18 13 -41.5t-17 -40.5l-960 -1024q-18 -20 -47 -20t-47 20 l-960 1024q-16 17 -17 40.5t13 41.5l384 512q18 26 51 26h1152q33 0 51 -26z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1811 -19q19 19 45 19t45 -19l128 -128l-90 -90l-83 83l-83 -83q-18 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83 q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-128 128l90 90l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83q19 19 45 19t45 -19l83 -83l83 83 q19 19 45 19t45 -19l83 -83zM237 19q-19 -19 -45 -19t-45 19l-128 128l90 90l83 -82l83 82q19 19 45 19t45 -19l83 -82l64 64v293l-210 314q-17 26 -7 56.5t40 40.5l177 58v299h128v128h256v128h256v-128h256v-128h128v-299l177 -58q30 -10 40 -40.5t-7 -56.5l-210 -314 v-293l19 18q19 19 45 19t45 -19l83 -82l83 82q19 19 45 19t45 -19l128 -128l-90 -90l-83 83l-83 -83q-18 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83l-83 -83 q-19 -19 -45 -19t-45 19l-83 83l-83 -83q-19 -19 -45 -19t-45 19l-83 83zM640 1152v-128l384 128l384 -128v128h-128v128h-512v-128h-128z" /> +<glyph unicode="" d="M576 0l96 448l-96 128l-128 64zM832 0l128 640l-128 -64l-96 -128zM992 1010q-2 4 -4 6q-10 8 -96 8q-70 0 -167 -19q-7 -2 -21 -2t-21 2q-97 19 -167 19q-86 0 -96 -8q-2 -2 -4 -6q2 -18 4 -27q2 -3 7.5 -6.5t7.5 -10.5q2 -4 7.5 -20.5t7 -20.5t7.5 -17t8.5 -17t9 -14 t12 -13.5t14 -9.5t17.5 -8t20.5 -4t24.5 -2q36 0 59 12.5t32.5 30t14.5 34.5t11.5 29.5t17.5 12.5h12q11 0 17.5 -12.5t11.5 -29.5t14.5 -34.5t32.5 -30t59 -12.5q13 0 24.5 2t20.5 4t17.5 8t14 9.5t12 13.5t9 14t8.5 17t7.5 17t7 20.5t7.5 20.5q2 7 7.5 10.5t7.5 6.5 q2 9 4 27zM1408 131q0 -121 -73 -190t-194 -69h-874q-121 0 -194 69t-73 190q0 61 4.5 118t19 125.5t37.5 123.5t63.5 103.5t93.5 74.5l-90 220h214q-22 64 -22 128q0 12 2 32q-194 40 -194 96q0 57 210 99q17 62 51.5 134t70.5 114q32 37 76 37q30 0 84 -31t84 -31t84 31 t84 31q44 0 76 -37q36 -42 70.5 -114t51.5 -134q210 -42 210 -99q0 -56 -194 -96q7 -81 -20 -160h214l-82 -225q63 -33 107.5 -96.5t65.5 -143.5t29 -151.5t8 -148.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2301 500q12 -103 -22 -198.5t-99 -163.5t-158.5 -106t-196.5 -31q-161 11 -279.5 125t-134.5 274q-12 111 27.5 210.5t118.5 170.5l-71 107q-96 -80 -151 -194t-55 -244q0 -27 -18.5 -46.5t-45.5 -19.5h-256h-69q-23 -164 -149 -274t-294 -110q-185 0 -316.5 131.5 t-131.5 316.5t131.5 316.5t316.5 131.5q76 0 152 -27l24 45q-123 110 -304 110h-64q-26 0 -45 19t-19 45t19 45t45 19h128q78 0 145 -13.5t116.5 -38.5t71.5 -39.5t51 -36.5h512h115l-85 128h-222q-30 0 -49 22.5t-14 52.5q4 23 23 38t43 15h253q33 0 53 -28l70 -105 l114 114q19 19 46 19h101q26 0 45 -19t19 -45v-128q0 -26 -19 -45t-45 -19h-179l115 -172q131 63 275 36q143 -26 244 -134.5t118 -253.5zM448 128q115 0 203 72.5t111 183.5h-314q-35 0 -55 31q-18 32 -1 63l147 277q-47 13 -91 13q-132 0 -226 -94t-94 -226t94 -226 t226 -94zM1856 128q132 0 226 94t94 226t-94 226t-226 94q-60 0 -121 -24l174 -260q15 -23 10 -49t-27 -40q-15 -11 -36 -11q-35 0 -53 29l-174 260q-93 -95 -93 -225q0 -132 94 -226t226 -94z" /> +<glyph unicode="" d="M1408 0q0 -63 -61.5 -113.5t-164 -81t-225 -46t-253.5 -15.5t-253.5 15.5t-225 46t-164 81t-61.5 113.5q0 49 33 88.5t91 66.5t118 44.5t131 29.5q26 5 48 -10.5t26 -41.5q5 -26 -10.5 -48t-41.5 -26q-58 -10 -106 -23.5t-76.5 -25.5t-48.5 -23.5t-27.5 -19.5t-8.5 -12 q3 -11 27 -26.5t73 -33t114 -32.5t160.5 -25t201.5 -10t201.5 10t160.5 25t114 33t73 33.5t27 27.5q-1 4 -8.5 11t-27.5 19t-48.5 23.5t-76.5 25t-106 23.5q-26 4 -41.5 26t-10.5 48q4 26 26 41.5t48 10.5q71 -12 131 -29.5t118 -44.5t91 -66.5t33 -88.5zM1024 896v-384 q0 -26 -19 -45t-45 -19h-64v-384q0 -26 -19 -45t-45 -19h-256q-26 0 -45 19t-19 45v384h-64q-26 0 -45 19t-19 45v384q0 53 37.5 90.5t90.5 37.5h384q53 0 90.5 -37.5t37.5 -90.5zM928 1280q0 -93 -65.5 -158.5t-158.5 -65.5t-158.5 65.5t-65.5 158.5t65.5 158.5t158.5 65.5 t158.5 -65.5t65.5 -158.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 512h305q-5 -6 -10 -10.5t-9 -7.5l-3 -4l-623 -600q-18 -18 -44 -18t-44 18l-624 602q-5 2 -21 20h369q22 0 39.5 13.5t22.5 34.5l70 281l190 -667q6 -20 23 -33t39 -13q21 0 38 13t23 33l146 485l56 -112q18 -35 57 -35zM1792 940q0 -145 -103 -300h-369l-111 221 q-8 17 -25.5 27t-36.5 8q-45 -5 -56 -46l-129 -430l-196 686q-6 20 -23.5 33t-39.5 13t-39 -13.5t-22 -34.5l-116 -464h-423q-103 155 -103 300q0 220 127 344t351 124q62 0 126.5 -21.5t120 -58t95.5 -68.5t76 -68q36 36 76 68t95.5 68.5t120 58t126.5 21.5q224 0 351 -124 t127 -344z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1152 960q0 -221 -147.5 -384.5t-364.5 -187.5v-260h224q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-224v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-224q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v260q-150 16 -271.5 103t-186 224t-52.5 292 q11 134 80.5 249t182 188t245.5 88q170 19 319 -54t236 -212t87 -306zM128 960q0 -185 131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5z" /> +<glyph unicode="" d="M1472 1408q26 0 45 -19t19 -45v-416q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v262l-382 -383q126 -156 126 -359q0 -117 -45.5 -223.5t-123 -184t-184 -123t-223.5 -45.5t-223.5 45.5t-184 123t-123 184t-45.5 223.5t45.5 223.5t123 184t184 123t223.5 45.5 q203 0 359 -126l382 382h-261q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h416zM576 0q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M830 1220q145 -72 233.5 -210.5t88.5 -305.5q0 -221 -147.5 -384.5t-364.5 -187.5v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-217 24 -364.5 187.5 t-147.5 384.5q0 167 88.5 305.5t233.5 210.5q-165 96 -228 273q-6 16 3.5 29.5t26.5 13.5h69q21 0 29 -20q44 -106 140 -171t214 -65t214 65t140 171q8 20 37 20h61q17 0 26.5 -13.5t3.5 -29.5q-63 -177 -228 -273zM576 256q185 0 316.5 131.5t131.5 316.5t-131.5 316.5 t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" d="M1024 1504q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q126 -158 126 -359q0 -221 -147.5 -384.5t-364.5 -187.5v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64 q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-149 16 -270.5 103t-186.5 223.5t-53 291.5q16 204 160 353.5t347 172.5q118 14 228 -19t198 -103l255 254h-134q-14 0 -23 9t-9 23v64zM576 256q185 0 316.5 131.5t131.5 316.5t-131.5 316.5 t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1280 1504q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q126 -158 126 -359q0 -221 -147.5 -384.5t-364.5 -187.5v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64 q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-217 24 -364.5 187.5t-147.5 384.5q0 201 126 359l-52 53l-101 -111q-9 -10 -22 -10.5t-23 7.5l-48 44q-10 8 -10.5 21.5t8.5 23.5l105 115l-111 112v-134q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9 t-9 23v288q0 26 19 45t45 19h288q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-133l106 -107l86 94q9 10 22 10.5t23 -7.5l48 -44q10 -8 10.5 -21.5t-8.5 -23.5l-90 -99l57 -56q158 126 359 126t359 -126l255 254h-134q-14 0 -23 9t-9 23v64zM832 256q185 0 316.5 131.5 t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1790 1007q12 -155 -52.5 -292t-186 -224t-271.5 -103v-260h224q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-224v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-512v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-224q-14 0 -23 9t-9 23v64q0 14 9 23 t23 9h224v260q-150 16 -271.5 103t-186 224t-52.5 292q17 206 164.5 356.5t352.5 169.5q206 21 377 -94q171 115 377 94q205 -19 352.5 -169.5t164.5 -356.5zM896 647q128 131 128 313t-128 313q-128 -131 -128 -313t128 -313zM576 512q115 0 218 57q-154 165 -154 391 q0 224 154 391q-103 57 -218 57q-185 0 -316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5zM1152 128v260q-137 15 -256 94q-119 -79 -256 -94v-260h512zM1216 512q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5q-115 0 -218 -57q154 -167 154 -391 q0 -226 -154 -391q103 -57 218 -57z" /> +<glyph unicode="" horiz-adv-x="1920" d="M1536 1120q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q76 -95 107.5 -214t9.5 -247q-31 -182 -166 -312t-318 -156q-210 -29 -384.5 80t-241.5 300q-117 6 -221 57.5t-177.5 133t-113.5 192.5t-32 230 q9 135 78 252t182 191.5t248 89.5q118 14 227.5 -19t198.5 -103l255 254h-134q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q59 -74 93 -169q182 -9 328 -124l255 254h-134q-14 0 -23 9 t-9 23v64zM1024 704q0 20 -4 58q-162 -25 -271 -150t-109 -292q0 -20 4 -58q162 25 271 150t109 292zM128 704q0 -168 111 -294t276 -149q-3 29 -3 59q0 210 135 369.5t338 196.5q-53 120 -163.5 193t-245.5 73q-185 0 -316.5 -131.5t-131.5 -316.5zM1088 -128 q185 0 316.5 131.5t131.5 316.5q0 168 -111 294t-276 149q3 -29 3 -59q0 -210 -135 -369.5t-338 -196.5q53 -120 163.5 -193t245.5 -73z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1664 1504q0 14 9 23t23 9h288q26 0 45 -19t19 -45v-288q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v134l-254 -255q76 -95 107.5 -214t9.5 -247q-32 -180 -164.5 -310t-313.5 -157q-223 -34 -409 90q-117 -78 -256 -93v-132h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23 t-23 -9h-96v-96q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v96h-96q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96v132q-155 17 -279.5 109.5t-187 237.5t-39.5 307q25 187 159.5 322.5t320.5 164.5q224 34 410 -90q146 97 320 97q201 0 359 -126l255 254h-134q-14 0 -23 9 t-9 23v64zM896 391q128 131 128 313t-128 313q-128 -131 -128 -313t128 -313zM128 704q0 -185 131.5 -316.5t316.5 -131.5q117 0 218 57q-154 167 -154 391t154 391q-101 57 -218 57q-185 0 -316.5 -131.5t-131.5 -316.5zM1216 256q185 0 316.5 131.5t131.5 316.5 t-131.5 316.5t-316.5 131.5q-117 0 -218 -57q154 -167 154 -391t-154 -391q101 -57 218 -57z" /> +<glyph unicode="" d="M1472 1408q26 0 45 -19t19 -45v-416q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v262l-213 -214l140 -140q9 -10 9 -23t-9 -22l-46 -46q-9 -9 -22 -9t-23 9l-140 141l-78 -79q126 -156 126 -359q0 -117 -45.5 -223.5t-123 -184t-184 -123t-223.5 -45.5t-223.5 45.5 t-184 123t-123 184t-45.5 223.5t45.5 223.5t123 184t184 123t223.5 45.5q203 0 359 -126l78 78l-172 172q-9 10 -9 23t9 22l46 46q9 9 22 9t23 -9l172 -172l213 213h-261q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h416zM576 0q185 0 316.5 131.5t131.5 316.5t-131.5 316.5 t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M640 892q217 -24 364.5 -187.5t147.5 -384.5q0 -167 -87 -306t-236 -212t-319 -54q-133 15 -245.5 88t-182 188t-80.5 249q-12 155 52.5 292t186 224t271.5 103v132h-160q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h160v165l-92 -92q-10 -9 -23 -9t-22 9l-46 46q-9 9 -9 22 t9 23l202 201q19 19 45 19t45 -19l202 -201q9 -10 9 -23t-9 -22l-46 -46q-9 -9 -22 -9t-23 9l-92 92v-165h160q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-160v-132zM576 -128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5 t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1901 621q19 -19 19 -45t-19 -45l-294 -294q-9 -10 -22.5 -10t-22.5 10l-45 45q-10 9 -10 22.5t10 22.5l185 185h-294v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-132q-24 -217 -187.5 -364.5t-384.5 -147.5q-167 0 -306 87t-212 236t-54 319q15 133 88 245.5 t188 182t249 80.5q155 12 292 -52.5t224 -186t103 -271.5h132v224q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-224h294l-185 185q-10 9 -10 22.5t10 22.5l45 45q9 10 22.5 10t22.5 -10zM576 128q185 0 316.5 131.5t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5 t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1152 960q0 -221 -147.5 -384.5t-364.5 -187.5v-612q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v612q-217 24 -364.5 187.5t-147.5 384.5q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5zM576 512q185 0 316.5 131.5 t131.5 316.5t-131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1024 576q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5t131.5 -316.5t316.5 -131.5t316.5 131.5t131.5 316.5zM1152 576q0 -117 -45.5 -223.5t-123 -184t-184 -123t-223.5 -45.5t-223.5 45.5t-184 123t-123 184t-45.5 223.5t45.5 223.5t123 184t184 123 t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5z" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" d="M1451 1408q35 0 60 -25t25 -60v-1366q0 -35 -25 -60t-60 -25h-391v595h199l30 232h-229v148q0 56 23.5 84t91.5 28l122 1v207q-63 9 -178 9q-136 0 -217.5 -80t-81.5 -226v-171h-200v-232h200v-595h-735q-35 0 -60 25t-25 60v1366q0 35 25 60t60 25h1366z" /> +<glyph unicode="" horiz-adv-x="1280" d="M0 939q0 108 37.5 203.5t103.5 166.5t152 123t185 78t202 26q158 0 294 -66.5t221 -193.5t85 -287q0 -96 -19 -188t-60 -177t-100 -149.5t-145 -103t-189 -38.5q-68 0 -135 32t-96 88q-10 -39 -28 -112.5t-23.5 -95t-20.5 -71t-26 -71t-32 -62.5t-46 -77.5t-62 -86.5 l-14 -5l-9 10q-15 157 -15 188q0 92 21.5 206.5t66.5 287.5t52 203q-32 65 -32 169q0 83 52 156t132 73q61 0 95 -40.5t34 -102.5q0 -66 -44 -191t-44 -187q0 -63 45 -104.5t109 -41.5q55 0 102 25t78.5 68t56 95t38 110.5t20 111t6.5 99.5q0 173 -109.5 269.5t-285.5 96.5 q-200 0 -334 -129.5t-134 -328.5q0 -44 12.5 -85t27 -65t27 -45.5t12.5 -30.5q0 -28 -15 -73t-37 -45q-2 0 -17 3q-51 15 -90.5 56t-61 94.5t-32.5 108t-11 106.5z" /> +<glyph unicode="" d="M985 562q13 0 97.5 -44t89.5 -53q2 -5 2 -15q0 -33 -17 -76q-16 -39 -71 -65.5t-102 -26.5q-57 0 -190 62q-98 45 -170 118t-148 185q-72 107 -71 194v8q3 91 74 158q24 22 52 22q6 0 18 -1.5t19 -1.5q19 0 26.5 -6.5t15.5 -27.5q8 -20 33 -88t25 -75q0 -21 -34.5 -57.5 t-34.5 -46.5q0 -7 5 -15q34 -73 102 -137q56 -53 151 -101q12 -7 22 -7q15 0 54 48.5t52 48.5zM782 32q127 0 243.5 50t200.5 134t134 200.5t50 243.5t-50 243.5t-134 200.5t-200.5 134t-243.5 50t-243.5 -50t-200.5 -134t-134 -200.5t-50 -243.5q0 -203 120 -368l-79 -233 l242 77q158 -104 345 -104zM782 1414q153 0 292.5 -60t240.5 -161t161 -240.5t60 -292.5t-60 -292.5t-161 -240.5t-240.5 -161t-292.5 -60q-195 0 -365 94l-417 -134l136 405q-108 178 -108 389q0 153 60 292.5t161 240.5t240.5 161t292.5 60z" /> +<glyph unicode="" horiz-adv-x="1792" d="M128 128h1024v128h-1024v-128zM128 640h1024v128h-1024v-128zM1696 192q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM128 1152h1024v128h-1024v-128zM1696 704q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1696 1216 q0 40 -28 68t-68 28t-68 -28t-28 -68t28 -68t68 -28t68 28t28 68zM1792 384v-384h-1792v384h1792zM1792 896v-384h-1792v384h1792zM1792 1408v-384h-1792v384h1792z" /> +<glyph unicode="" horiz-adv-x="2048" d="M704 640q-159 0 -271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5t-112.5 -271.5t-271.5 -112.5zM1664 512h352q13 0 22.5 -9.5t9.5 -22.5v-192q0 -13 -9.5 -22.5t-22.5 -9.5h-352v-352q0 -13 -9.5 -22.5t-22.5 -9.5h-192q-13 0 -22.5 9.5 t-9.5 22.5v352h-352q-13 0 -22.5 9.5t-9.5 22.5v192q0 13 9.5 22.5t22.5 9.5h352v352q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5 -9.5t9.5 -22.5v-352zM928 288q0 -52 38 -90t90 -38h256v-238q-68 -50 -171 -50h-874q-121 0 -194 69t-73 190q0 53 3.5 103.5t14 109t26.5 108.5 t43 97.5t62 81t85.5 53.5t111.5 20q19 0 39 -17q79 -61 154.5 -91.5t164.5 -30.5t164.5 30.5t154.5 91.5q20 17 39 17q132 0 217 -96h-223q-52 0 -90 -38t-38 -90v-192z" /> +<glyph unicode="" horiz-adv-x="2048" d="M704 640q-159 0 -271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5t-112.5 -271.5t-271.5 -112.5zM1781 320l249 -249q9 -9 9 -23q0 -13 -9 -22l-136 -136q-9 -9 -22 -9q-14 0 -23 9l-249 249l-249 -249q-9 -9 -23 -9q-13 0 -22 9l-136 136 q-9 9 -9 22q0 14 9 23l249 249l-249 249q-9 9 -9 23q0 13 9 22l136 136q9 9 22 9q14 0 23 -9l249 -249l249 249q9 9 23 9q13 0 22 -9l136 -136q9 -9 9 -22q0 -14 -9 -23zM1283 320l-181 -181q-37 -37 -37 -91q0 -53 37 -90l83 -83q-21 -3 -44 -3h-874q-121 0 -194 69 t-73 190q0 53 3.5 103.5t14 109t26.5 108.5t43 97.5t62 81t85.5 53.5t111.5 20q19 0 39 -17q154 -122 319 -122t319 122q20 17 39 17q28 0 57 -6q-28 -27 -41 -50t-13 -56q0 -54 37 -91z" /> +<glyph unicode="" horiz-adv-x="2048" d="M256 512h1728q26 0 45 -19t19 -45v-448h-256v256h-1536v-256h-256v1216q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-704zM832 832q0 106 -75 181t-181 75t-181 -75t-75 -181t75 -181t181 -75t181 75t75 181zM2048 576v64q0 159 -112.5 271.5t-271.5 112.5h-704 q-26 0 -45 -19t-19 -45v-384h1152z" /> +<glyph unicode="" d="M1536 1536l-192 -448h192v-192h-274l-55 -128h329v-192h-411l-357 -832l-357 832h-411v192h329l-55 128h-274v192h192l-192 448h256l323 -768h378l323 768h256zM768 320l108 256h-216z" /> +<glyph unicode="" d="M1088 1536q185 0 316.5 -93.5t131.5 -226.5v-896q0 -130 -125.5 -222t-305.5 -97l213 -202q16 -15 8 -35t-30 -20h-1056q-22 0 -30 20t8 35l213 202q-180 5 -305.5 97t-125.5 222v896q0 133 131.5 226.5t316.5 93.5h640zM768 192q80 0 136 56t56 136t-56 136t-136 56 t-136 -56t-56 -136t56 -136t136 -56zM1344 768v512h-1152v-512h1152z" /> +<glyph unicode="" d="M1088 1536q185 0 316.5 -93.5t131.5 -226.5v-896q0 -130 -125.5 -222t-305.5 -97l213 -202q16 -15 8 -35t-30 -20h-1056q-22 0 -30 20t8 35l213 202q-180 5 -305.5 97t-125.5 222v896q0 133 131.5 226.5t316.5 93.5h640zM288 224q66 0 113 47t47 113t-47 113t-113 47 t-113 -47t-47 -113t47 -113t113 -47zM704 768v512h-544v-512h544zM1248 224q66 0 113 47t47 113t-47 113t-113 47t-113 -47t-47 -113t47 -113t113 -47zM1408 768v512h-576v-512h576z" /> +<glyph unicode="" horiz-adv-x="1792" d="M597 1115v-1173q0 -25 -12.5 -42.5t-36.5 -17.5q-17 0 -33 8l-465 233q-21 10 -35.5 33.5t-14.5 46.5v1140q0 20 10 34t29 14q14 0 44 -15l511 -256q3 -3 3 -5zM661 1014l534 -866l-534 266v600zM1792 996v-1054q0 -25 -14 -40.5t-38 -15.5t-47 13l-441 220zM1789 1116 q0 -3 -256.5 -419.5t-300.5 -487.5l-390 634l324 527q17 28 52 28q14 0 26 -6l541 -270q4 -2 4 -6z" /> +<glyph unicode="" d="M809 532l266 499h-112l-157 -312q-24 -48 -44 -92l-42 92l-155 312h-120l263 -493v-324h101v318zM1536 1408v-1536h-1536v1536h1536z" /> +<glyph unicode="" horiz-adv-x="2296" d="M478 -139q-8 -16 -27 -34.5t-37 -25.5q-25 -9 -51.5 3.5t-28.5 31.5q-1 22 40 55t68 38q23 4 34 -21.5t2 -46.5zM1819 -139q7 -16 26 -34.5t38 -25.5q25 -9 51.5 3.5t27.5 31.5q2 22 -39.5 55t-68.5 38q-22 4 -33 -21.5t-2 -46.5zM1867 -30q13 -27 56.5 -59.5t77.5 -41.5 q45 -13 82 4.5t37 50.5q0 46 -67.5 100.5t-115.5 59.5q-40 5 -63.5 -37.5t-6.5 -76.5zM428 -30q-13 -27 -56 -59.5t-77 -41.5q-45 -13 -82 4.5t-37 50.5q0 46 67.5 100.5t115.5 59.5q40 5 63 -37.5t6 -76.5zM1158 1094h1q-41 0 -76 -15q27 -8 44 -30.5t17 -49.5 q0 -35 -27 -60t-65 -25q-52 0 -80 43q-5 -23 -5 -42q0 -74 56 -126.5t135 -52.5q80 0 136 52.5t56 126.5t-56 126.5t-136 52.5zM1462 1312q-99 109 -220.5 131.5t-245.5 -44.5q27 60 82.5 96.5t118 39.5t121.5 -17t99.5 -74.5t44.5 -131.5zM2212 73q8 -11 -11 -42 q7 -23 7 -40q1 -56 -44.5 -112.5t-109.5 -91.5t-118 -37q-48 -2 -92 21.5t-66 65.5q-687 -25 -1259 0q-23 -41 -66.5 -65t-92.5 -22q-86 3 -179.5 80.5t-92.5 160.5q2 22 7 40q-19 31 -11 42q6 10 31 1q14 22 41 51q-7 29 2 38q11 10 39 -4q29 20 59 34q0 29 13 37 q23 12 51 -16q35 5 61 -2q18 -4 38 -19v73q-11 0 -18 2q-53 10 -97 44.5t-55 87.5q-9 38 0 81q15 62 93 95q2 17 19 35.5t36 23.5t33 -7.5t19 -30.5h13q46 -5 60 -23q3 -3 5 -7q10 1 30.5 3.5t30.5 3.5q-15 11 -30 17q-23 40 -91 43q0 6 1 10q-62 2 -118.5 18.5t-84.5 47.5 q-32 36 -42.5 92t-2.5 112q16 126 90 179q23 16 52 4.5t32 -40.5q0 -1 1.5 -14t2.5 -21t3 -20t5.5 -19t8.5 -10q27 -14 76 -12q48 46 98 74q-40 4 -162 -14l47 46q61 58 163 111q145 73 282 86q-20 8 -41 15.5t-47 14t-42.5 10.5t-47.5 11t-43 10q595 126 904 -139 q98 -84 158 -222q85 -10 121 9h1q5 3 8.5 10t5.5 19t3 19.5t3 21.5l1 14q3 28 32 40t52 -5q73 -52 91 -178q7 -57 -3.5 -113t-42.5 -91q-28 -32 -83.5 -48.5t-115.5 -18.5v-10q-71 -2 -95 -43q-14 -5 -31 -17q11 -1 32 -3.5t30 -3.5q1 4 5 8q16 18 60 23h13q5 18 19 30t33 8 t36 -23t19 -36q79 -32 93 -95q9 -40 1 -81q-12 -53 -56 -88t-97 -44q-10 -2 -17 -2q0 -49 -1 -73q20 15 38 19q26 7 61 2q28 28 51 16q14 -9 14 -37q33 -16 59 -34q27 13 38 4q10 -10 2 -38q28 -30 41 -51q23 8 31 -1zM1937 1025q0 -29 -9 -54q82 -32 112 -132 q4 37 -9.5 98.5t-41.5 90.5q-20 19 -36 17t-16 -20zM1859 925q35 -42 47.5 -108.5t-0.5 -124.5q67 13 97 45q13 14 18 28q-3 64 -31 114.5t-79 66.5q-15 -15 -52 -21zM1822 921q-30 0 -44 1q42 -115 53 -239q21 0 43 3q16 68 1 135t-53 100zM258 839q30 100 112 132 q-9 25 -9 54q0 18 -16.5 20t-35.5 -17q-28 -29 -41.5 -90.5t-9.5 -98.5zM294 737q29 -31 97 -45q-13 58 -0.5 124.5t47.5 108.5v0q-37 6 -52 21q-51 -16 -78.5 -66t-31.5 -115q9 -17 18 -28zM471 683q14 124 73 235q-19 -4 -55 -18l-45 -19v1q-46 -89 -20 -196q25 -3 47 -3z M1434 644q8 -38 16.5 -108.5t11.5 -89.5q3 -18 9.5 -21.5t23.5 4.5q40 20 62 85.5t23 125.5q-24 2 -146 4zM1152 1285q-116 0 -199 -82.5t-83 -198.5q0 -117 83 -199.5t199 -82.5t199 82.5t83 199.5q0 116 -83 198.5t-199 82.5zM1380 646q-106 2 -211 0v1q-1 -27 2.5 -86 t13.5 -66q29 -14 93.5 -14.5t95.5 10.5q9 3 11 39t-0.5 69.5t-4.5 46.5zM1112 447q8 4 9.5 48t-0.5 88t-4 63v1q-212 -3 -214 -3q-4 -20 -7 -62t0 -83t14 -46q34 -15 101 -16t101 10zM718 636q-16 -59 4.5 -118.5t77.5 -84.5q15 -8 24 -5t12 21q3 16 8 90t10 103 q-69 -2 -136 -6zM591 510q3 -23 -34 -36q132 -141 271.5 -240t305.5 -154q172 49 310.5 146t293.5 250q-33 13 -30 34l3 9v1v-1q-17 2 -50 5.5t-48 4.5q-26 -90 -82 -132q-51 -38 -82 1q-5 6 -9 14q-7 13 -17 62q-2 -5 -5 -9t-7.5 -7t-8 -5.5t-9.5 -4l-10 -2.5t-12 -2 l-12 -1.5t-13.5 -1t-13.5 -0.5q-106 -9 -163 11q-4 -17 -10 -26.5t-21 -15t-23 -7t-36 -3.5q-2 0 -3 -0.5t-3 -0.5h-3q-179 -17 -203 40q-2 -63 -56 -54q-47 8 -91 54q-12 13 -20 26q-17 29 -26 65q-58 -6 -87 -10q1 -2 4 -10zM507 -118q3 14 3 30q-17 71 -51 130t-73 70 q-41 12 -101.5 -14.5t-104.5 -80t-39 -107.5q35 -53 100 -93t119 -42q51 -2 94 28t53 79zM510 53q23 -63 27 -119q195 113 392 174q-98 52 -180.5 120t-179.5 165q-6 -4 -29 -13q0 -2 -1 -5t-1 -4q31 -18 22 -37q-12 -23 -56 -34q-10 -13 -29 -24h-1q-2 -83 1 -150 q19 -34 35 -73zM579 -113q532 -21 1145 0q-254 147 -428 196q-76 -35 -156 -57q-8 -3 -16 0q-65 21 -129 49q-208 -60 -416 -188h-1v-1q1 0 1 1zM1763 -67q4 54 28 120q14 38 33 71l-1 -1q3 77 3 153q-15 8 -30 25q-42 9 -56 33q-9 20 22 38q-2 4 -2 9q-16 4 -28 12 q-204 -190 -383 -284q198 -59 414 -176zM2155 -90q5 54 -39 107.5t-104 80t-102 14.5q-38 -11 -72.5 -70.5t-51.5 -129.5q0 -16 3 -30q10 -49 53 -79t94 -28q54 2 119 42t100 93z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1524 -25q0 -68 -48 -116t-116 -48t-116.5 48t-48.5 116t48.5 116.5t116.5 48.5t116 -48.5t48 -116.5zM775 -25q0 -68 -48.5 -116t-116.5 -48t-116 48t-48 116t48 116.5t116 48.5t116.5 -48.5t48.5 -116.5zM0 1469q57 -60 110.5 -104.5t121 -82t136 -63t166 -45.5 t200 -31.5t250 -18.5t304 -9.5t372.5 -2.5q139 0 244.5 -5t181 -16.5t124 -27.5t71 -39.5t24 -51.5t-19.5 -64t-56.5 -76.5t-89.5 -91t-116 -104.5t-139 -119q-185 -157 -286 -247q29 51 76.5 109t94 105.5t94.5 98.5t83 91.5t54 80.5t13 70t-45.5 55.5t-116.5 41t-204 23.5 t-304 5q-168 -2 -314 6t-256 23t-204.5 41t-159.5 51.5t-122.5 62.5t-91.5 66.5t-68 71.5t-50.5 69.5t-40 68t-36.5 59.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 1472q-169 0 -323 -66t-265.5 -177.5t-177.5 -265.5t-66 -323t66 -323t177.5 -265.5t265.5 -177.5t323 -66t323 66t265.5 177.5t177.5 265.5t66 323t-66 323t-177.5 265.5t-265.5 177.5t-323 66zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348 t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71zM496 704q16 0 16 -16v-480q0 -16 -16 -16h-32q-16 0 -16 16v480q0 16 16 16h32zM896 640q53 0 90.5 -37.5t37.5 -90.5q0 -35 -17.5 -64t-46.5 -46v-114q0 -14 -9 -23 t-23 -9h-64q-14 0 -23 9t-9 23v114q-29 17 -46.5 46t-17.5 64q0 53 37.5 90.5t90.5 37.5zM896 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM544 928v-96 q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v96q0 93 65.5 158.5t158.5 65.5t158.5 -65.5t65.5 -158.5v-96q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v96q0 146 -103 249t-249 103t-249 -103t-103 -249zM1408 192v512q0 26 -19 45t-45 19h-896q-26 0 -45 -19t-19 -45v-512 q0 -26 19 -45t45 -19h896q26 0 45 19t19 45z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1920 1024v-768h-1664v768h1664zM2048 448h128v384h-128v288q0 14 -9 23t-23 9h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288zM2304 832v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113 v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160q53 0 90.5 -37.5t37.5 -90.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M256 256v768h1280v-768h-1280zM2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9 h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="2304" d="M256 256v768h896v-768h-896zM2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9 h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="2304" d="M256 256v768h512v-768h-512zM2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9 h-1856q-14 0 -23 -9t-9 -23v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2176 960q53 0 90.5 -37.5t37.5 -90.5v-384q0 -53 -37.5 -90.5t-90.5 -37.5v-160q0 -66 -47 -113t-113 -47h-1856q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1856q66 0 113 -47t47 -113v-160zM2176 448v384h-128v288q0 14 -9 23t-23 9h-1856q-14 0 -23 -9t-9 -23 v-960q0 -14 9 -23t23 -9h1856q14 0 23 9t9 23v288h128z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1133 493q31 -30 14 -69q-17 -40 -59 -40h-382l201 -476q10 -25 0 -49t-34 -35l-177 -75q-25 -10 -49 0t-35 34l-191 452l-312 -312q-19 -19 -45 -19q-12 0 -24 5q-40 17 -40 59v1504q0 42 40 59q12 5 24 5q27 0 45 -19z" /> +<glyph unicode="" horiz-adv-x="1024" d="M832 1408q-320 0 -320 -224v-416h128v-128h-128v-544q0 -224 320 -224h64v-128h-64q-272 0 -384 146q-112 -146 -384 -146h-64v128h64q320 0 320 224v544h-128v128h128v416q0 224 -320 224h-64v128h64q272 0 384 -146q112 146 384 146h64v-128h-64z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2048 1152h-128v-1024h128v-384h-384v128h-1280v-128h-384v384h128v1024h-128v384h384v-128h1280v128h384v-384zM1792 1408v-128h128v128h-128zM128 1408v-128h128v128h-128zM256 -128v128h-128v-128h128zM1664 0v128h128v1024h-128v128h-1280v-128h-128v-1024h128v-128 h1280zM1920 -128v128h-128v-128h128zM1280 896h384v-768h-896v256h-384v768h896v-256zM512 512h640v512h-640v-512zM1536 256v512h-256v-384h-384v-128h640z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2304 768h-128v-640h128v-384h-384v128h-896v-128h-384v384h128v128h-384v-128h-384v384h128v640h-128v384h384v-128h896v128h384v-384h-128v-128h384v128h384v-384zM2048 1024v-128h128v128h-128zM1408 1408v-128h128v128h-128zM128 1408v-128h128v128h-128zM256 256 v128h-128v-128h128zM1536 384h-128v-128h128v128zM384 384h896v128h128v640h-128v128h-896v-128h-128v-640h128v-128zM896 -128v128h-128v-128h128zM2176 -128v128h-128v-128h128zM2048 128v640h-128v128h-384v-384h128v-384h-384v128h-384v-128h128v-128h896v128h128z" /> +<glyph unicode="" d="M1024 288v-416h-928q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h1344q40 0 68 -28t28 -68v-928h-416q-40 0 -68 -28t-28 -68zM1152 256h381q-15 -82 -65 -132l-184 -184q-50 -50 -132 -65v381z" /> +<glyph unicode="" d="M1400 256h-248v-248q29 10 41 22l185 185q12 12 22 41zM1120 384h288v896h-1280v-1280h896v288q0 40 28 68t68 28zM1536 1312v-1024q0 -40 -20 -88t-48 -76l-184 -184q-28 -28 -76 -48t-88 -20h-1024q-40 0 -68 28t-28 68v1344q0 40 28 68t68 28h1344q40 0 68 -28t28 -68 z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1951 538q0 -26 -15.5 -44.5t-38.5 -23.5q-8 -2 -18 -2h-153v140h153q10 0 18 -2q23 -5 38.5 -23.5t15.5 -44.5zM1933 751q0 -25 -15 -42t-38 -21q-3 -1 -15 -1h-139v129h139q3 0 8.5 -0.5t6.5 -0.5q23 -4 38 -21.5t15 -42.5zM728 587v308h-228v-308q0 -58 -38 -94.5 t-105 -36.5q-108 0 -229 59v-112q53 -15 121 -23t109 -9l42 -1q328 0 328 217zM1442 403v113q-99 -52 -200 -59q-108 -8 -169 41t-61 142t61 142t169 41q101 -7 200 -58v112q-48 12 -100 19.5t-80 9.5l-28 2q-127 6 -218.5 -14t-140.5 -60t-71 -88t-22 -106t22 -106t71 -88 t140.5 -60t218.5 -14q101 4 208 31zM2176 518q0 54 -43 88.5t-109 39.5v3q57 8 89 41.5t32 79.5q0 55 -41 88t-107 36q-3 0 -12 0.5t-14 0.5h-455v-510h491q74 0 121.5 36.5t47.5 96.5zM2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90 t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="2304" d="M858 295v693q-106 -41 -172 -135.5t-66 -211.5t66 -211.5t172 -134.5zM1362 641q0 117 -66 211.5t-172 135.5v-694q106 41 172 135.5t66 211.5zM1577 641q0 -159 -78.5 -294t-213.5 -213.5t-294 -78.5q-119 0 -227.5 46.5t-187 125t-125 187t-46.5 227.5q0 159 78.5 294 t213.5 213.5t294 78.5t294 -78.5t213.5 -213.5t78.5 -294zM1960 634q0 139 -55.5 261.5t-147.5 205.5t-213.5 131t-252.5 48h-301q-176 0 -323.5 -81t-235 -230t-87.5 -335q0 -171 87 -317.5t236 -231.5t323 -85h301q129 0 251.5 50.5t214.5 135t147.5 202.5t55.5 246z M2304 1280v-1280q0 -52 -38 -90t-90 -38h-2048q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h2048q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1664 -96v1088q0 13 -9.5 22.5t-22.5 9.5h-1088q-13 0 -22.5 -9.5t-9.5 -22.5v-1088q0 -13 9.5 -22.5t22.5 -9.5h1088q13 0 22.5 9.5t9.5 22.5zM1792 992v-1088q0 -66 -47 -113t-113 -47h-1088q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1088q66 0 113 -47t47 -113 zM1408 1376v-160h-128v160q0 13 -9.5 22.5t-22.5 9.5h-1088q-13 0 -22.5 -9.5t-9.5 -22.5v-1088q0 -13 9.5 -22.5t22.5 -9.5h160v-128h-160q-66 0 -113 47t-47 113v1088q0 66 47 113t113 47h1088q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1728 1088l-384 -704h768zM448 1088l-384 -704h768zM1269 1280q-14 -40 -45.5 -71.5t-71.5 -45.5v-1291h608q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1344q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h608v1291q-40 14 -71.5 45.5t-45.5 71.5h-491q-14 0 -23 9t-9 23v64 q0 14 9 23t23 9h491q21 57 70 92.5t111 35.5t111 -35.5t70 -92.5h491q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-491zM1088 1264q33 0 56.5 23.5t23.5 56.5t-23.5 56.5t-56.5 23.5t-56.5 -23.5t-23.5 -56.5t23.5 -56.5t56.5 -23.5zM2176 384q0 -73 -46.5 -131t-117.5 -91 t-144.5 -49.5t-139.5 -16.5t-139.5 16.5t-144.5 49.5t-117.5 91t-46.5 131q0 11 35 81t92 174.5t107 195.5t102 184t56 100q18 33 56 33t56 -33q4 -7 56 -100t102 -184t107 -195.5t92 -174.5t35 -81zM896 384q0 -73 -46.5 -131t-117.5 -91t-144.5 -49.5t-139.5 -16.5 t-139.5 16.5t-144.5 49.5t-117.5 91t-46.5 131q0 11 35 81t92 174.5t107 195.5t102 184t56 100q18 33 56 33t56 -33q4 -7 56 -100t102 -184t107 -195.5t92 -174.5t35 -81z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM874 700q77 29 149 92.5t129.5 152.5t92.5 210t35 253h-1024q0 -132 35 -253t92.5 -210t129.5 -152.5t149 -92.5q19 -7 30.5 -23.5t11.5 -36.5t-11.5 -36.5t-30.5 -23.5q-77 -29 -149 -92.5 t-129.5 -152.5t-92.5 -210t-35 -253h1024q0 132 -35 253t-92.5 210t-129.5 152.5t-149 92.5q-19 7 -30.5 23.5t-11.5 36.5t11.5 36.5t30.5 23.5z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM1280 1408h-1024q0 -66 9 -128h1006q9 61 9 128zM1280 -128q0 130 -34 249.5t-90.5 208t-126.5 152t-146 94.5h-230q-76 -31 -146 -94.5t-126.5 -152t-90.5 -208t-34 -249.5h1024z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM1280 1408h-1024q0 -206 85 -384h854q85 178 85 384zM1223 192q-54 141 -145.5 241.5t-194.5 142.5h-230q-103 -42 -194.5 -142.5t-145.5 -241.5h910z" /> +<glyph unicode="" d="M1408 1408q0 -261 -106.5 -461.5t-266.5 -306.5q160 -106 266.5 -306.5t106.5 -461.5h96q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h96q0 261 106.5 461.5t266.5 306.5q-160 106 -266.5 306.5t-106.5 461.5h-96q-14 0 -23 9 t-9 23v64q0 14 9 23t23 9h1472q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-96zM874 700q77 29 149 92.5t129.5 152.5t92.5 210t35 253h-1024q0 -132 35 -253t92.5 -210t129.5 -152.5t149 -92.5q19 -7 30.5 -23.5t11.5 -36.5t-11.5 -36.5t-30.5 -23.5q-137 -51 -244 -196 h700q-107 145 -244 196q-19 7 -30.5 23.5t-11.5 36.5t11.5 36.5t30.5 23.5z" /> +<glyph unicode="" d="M1504 -64q14 0 23 -9t9 -23v-128q0 -14 -9 -23t-23 -9h-1472q-14 0 -23 9t-9 23v128q0 14 9 23t23 9h1472zM130 0q3 55 16 107t30 95t46 87t53.5 76t64.5 69.5t66 60t70.5 55t66.5 47.5t65 43q-43 28 -65 43t-66.5 47.5t-70.5 55t-66 60t-64.5 69.5t-53.5 76t-46 87 t-30 95t-16 107h1276q-3 -55 -16 -107t-30 -95t-46 -87t-53.5 -76t-64.5 -69.5t-66 -60t-70.5 -55t-66.5 -47.5t-65 -43q43 -28 65 -43t66.5 -47.5t70.5 -55t66 -60t64.5 -69.5t53.5 -76t46 -87t30 -95t16 -107h-1276zM1504 1536q14 0 23 -9t9 -23v-128q0 -14 -9 -23t-23 -9 h-1472q-14 0 -23 9t-9 23v128q0 14 9 23t23 9h1472z" /> +<glyph unicode="" d="M768 1152q-53 0 -90.5 -37.5t-37.5 -90.5v-128h-32v93q0 48 -32 81.5t-80 33.5q-46 0 -79 -33t-33 -79v-429l-32 30v172q0 48 -32 81.5t-80 33.5q-46 0 -79 -33t-33 -79v-224q0 -47 35 -82l310 -296q39 -39 39 -102q0 -26 19 -45t45 -19h640q26 0 45 19t19 45v25 q0 41 10 77l108 436q10 36 10 77v246q0 48 -32 81.5t-80 33.5q-46 0 -79 -33t-33 -79v-32h-32v125q0 40 -25 72.5t-64 40.5q-14 2 -23 2q-46 0 -79 -33t-33 -79v-128h-32v122q0 51 -32.5 89.5t-82.5 43.5q-5 1 -13 1zM768 1280q84 0 149 -50q57 34 123 34q59 0 111 -27 t86 -76q27 7 59 7q100 0 170 -71.5t70 -171.5v-246q0 -51 -13 -108l-109 -436q-6 -24 -6 -71q0 -80 -56 -136t-136 -56h-640q-84 0 -138 58.5t-54 142.5l-308 296q-76 73 -76 175v224q0 99 70.5 169.5t169.5 70.5q11 0 16 -1q6 95 75.5 160t164.5 65q52 0 98 -21 q72 69 174 69z" /> +<glyph unicode="" horiz-adv-x="1792" d="M880 1408q-46 0 -79 -33t-33 -79v-656h-32v528q0 46 -33 79t-79 33t-79 -33t-33 -79v-528v-256l-154 205q-38 51 -102 51q-53 0 -90.5 -37.5t-37.5 -90.5q0 -43 26 -77l384 -512q38 -51 102 -51h688q34 0 61 22t34 56l76 405q5 32 5 59v498q0 46 -33 79t-79 33t-79 -33 t-33 -79v-272h-32v528q0 46 -33 79t-79 33t-79 -33t-33 -79v-528h-32v656q0 46 -33 79t-79 33zM880 1536q68 0 125.5 -35.5t88.5 -96.5q19 4 42 4q99 0 169.5 -70.5t70.5 -169.5v-17q105 6 180.5 -64t75.5 -175v-498q0 -40 -8 -83l-76 -404q-14 -79 -76.5 -131t-143.5 -52 h-688q-60 0 -114.5 27.5t-90.5 74.5l-384 512q-51 68 -51 154q0 106 75 181t181 75q78 0 128 -34v434q0 99 70.5 169.5t169.5 70.5q23 0 42 -4q31 61 88.5 96.5t125.5 35.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1073 -128h-177q-163 0 -226 141q-23 49 -23 102v5q-62 30 -98.5 88.5t-36.5 127.5q0 38 5 48h-261q-106 0 -181 75t-75 181t75 181t181 75h113l-44 17q-74 28 -119.5 93.5t-45.5 145.5q0 106 75 181t181 75q46 0 91 -17l628 -239h401q106 0 181 -75t75 -181v-668 q0 -88 -54 -157.5t-140 -90.5l-339 -85q-92 -23 -186 -23zM1024 583l-155 -71l-163 -74q-30 -14 -48 -41.5t-18 -60.5q0 -46 33 -79t79 -33q26 0 46 10l338 154q-49 10 -80.5 50t-31.5 90v55zM1344 272q0 46 -33 79t-79 33q-26 0 -46 -10l-290 -132q-28 -13 -37 -17 t-30.5 -17t-29.5 -23.5t-16 -29t-8 -40.5q0 -50 31.5 -82t81.5 -32q20 0 38 9l352 160q30 14 48 41.5t18 60.5zM1112 1024l-650 248q-24 8 -46 8q-53 0 -90.5 -37.5t-37.5 -90.5q0 -40 22.5 -73t59.5 -47l526 -200v-64h-640q-53 0 -90.5 -37.5t-37.5 -90.5t37.5 -90.5 t90.5 -37.5h535l233 106v198q0 63 46 106l111 102h-69zM1073 0q82 0 155 19l339 85q43 11 70 45.5t27 78.5v668q0 53 -37.5 90.5t-90.5 37.5h-308l-136 -126q-36 -33 -36 -82v-296q0 -46 33 -77t79 -31t79 35t33 81v208h32v-208q0 -70 -57 -114q52 -8 86.5 -48.5t34.5 -93.5 q0 -42 -23 -78t-61 -53l-310 -141h91z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1151 1536q61 0 116 -28t91 -77l572 -781q118 -159 118 -359v-355q0 -80 -56 -136t-136 -56h-384q-80 0 -136 56t-56 136v177l-286 143h-546q-80 0 -136 56t-56 136v32q0 119 84.5 203.5t203.5 84.5h420l42 128h-686q-100 0 -173.5 67.5t-81.5 166.5q-65 79 -65 182v32 q0 80 56 136t136 56h959zM1920 -64v355q0 157 -93 284l-573 781q-39 52 -103 52h-959q-26 0 -45 -19t-19 -45q0 -32 1.5 -49.5t9.5 -40.5t25 -43q10 31 35.5 50t56.5 19h832v-32h-832q-26 0 -45 -19t-19 -45q0 -44 3 -58q8 -44 44 -73t81 -29h640h91q40 0 68 -28t28 -68 q0 -15 -5 -30l-64 -192q-10 -29 -35 -47.5t-56 -18.5h-443q-66 0 -113 -47t-47 -113v-32q0 -26 19 -45t45 -19h561q16 0 29 -7l317 -158q24 -13 38.5 -36t14.5 -50v-197q0 -26 19 -45t45 -19h384q26 0 45 19t19 45z" /> +<glyph unicode="" horiz-adv-x="2048" d="M816 1408q-48 0 -79.5 -34t-31.5 -82q0 -14 3 -28l150 -624h-26l-116 482q-9 38 -39.5 62t-69.5 24q-47 0 -79 -34t-32 -81q0 -11 4 -29q3 -13 39 -161t68 -282t32 -138v-227l-307 230q-34 26 -77 26q-52 0 -89.5 -36.5t-37.5 -88.5q0 -67 56 -110l507 -379 q34 -26 76 -26h694q33 0 59 20.5t34 52.5l100 401q8 30 10 88t9 86l116 478q3 12 3 26q0 46 -33 79t-80 33q-38 0 -69 -25.5t-40 -62.5l-99 -408h-26l132 547q3 14 3 28q0 47 -32 80t-80 33q-38 0 -68.5 -24t-39.5 -62l-145 -602h-127l-164 682q-9 38 -39.5 62t-68.5 24z M1461 -256h-694q-85 0 -153 51l-507 380q-50 38 -78.5 94t-28.5 118q0 105 75 179t180 74q25 0 49.5 -5.5t41.5 -11t41 -20.5t35 -23t38.5 -29.5t37.5 -28.5l-123 512q-7 35 -7 59q0 93 60 162t152 79q14 87 80.5 144.5t155.5 57.5q83 0 148 -51.5t85 -132.5l103 -428 l83 348q20 81 85 132.5t148 51.5q87 0 152.5 -54t82.5 -139q93 -10 155 -78t62 -161q0 -30 -7 -57l-116 -477q-5 -22 -5 -67q0 -51 -13 -108l-101 -401q-19 -75 -79.5 -122.5t-137.5 -47.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 1408q-53 0 -90.5 -37.5t-37.5 -90.5v-512v-384l-151 202q-41 54 -107 54q-52 0 -89 -38t-37 -90q0 -43 26 -77l384 -512q38 -51 102 -51h718q22 0 39.5 13.5t22.5 34.5l92 368q24 96 24 194v217q0 41 -28 71t-68 30t-68 -28t-28 -68h-32v61q0 48 -32 81.5t-80 33.5 q-46 0 -79 -33t-33 -79v-64h-32v90q0 55 -37 94.5t-91 39.5q-53 0 -90.5 -37.5t-37.5 -90.5v-96h-32v570q0 55 -37 94.5t-91 39.5zM640 1536q107 0 181.5 -77.5t74.5 -184.5v-220q22 2 32 2q99 0 173 -69q47 21 99 21q113 0 184 -87q27 7 56 7q94 0 159 -67.5t65 -161.5 v-217q0 -116 -28 -225l-92 -368q-16 -64 -68 -104.5t-118 -40.5h-718q-60 0 -114.5 27.5t-90.5 74.5l-384 512q-51 68 -51 154q0 105 74.5 180.5t179.5 75.5q71 0 130 -35v547q0 106 75 181t181 75zM768 128v384h-32v-384h32zM1024 128v384h-32v-384h32zM1280 128v384h-32 v-384h32z" /> +<glyph unicode="" d="M1288 889q60 0 107 -23q141 -63 141 -226v-177q0 -94 -23 -186l-85 -339q-21 -86 -90.5 -140t-157.5 -54h-668q-106 0 -181 75t-75 181v401l-239 628q-17 45 -17 91q0 106 75 181t181 75q80 0 145.5 -45.5t93.5 -119.5l17 -44v113q0 106 75 181t181 75t181 -75t75 -181 v-261q27 5 48 5q69 0 127.5 -36.5t88.5 -98.5zM1072 896q-33 0 -60.5 -18t-41.5 -48l-74 -163l-71 -155h55q50 0 90 -31.5t50 -80.5l154 338q10 20 10 46q0 46 -33 79t-79 33zM1293 761q-22 0 -40.5 -8t-29 -16t-23.5 -29.5t-17 -30.5t-17 -37l-132 -290q-10 -20 -10 -46 q0 -46 33 -79t79 -33q33 0 60.5 18t41.5 48l160 352q9 18 9 38q0 50 -32 81.5t-82 31.5zM128 1120q0 -22 8 -46l248 -650v-69l102 111q43 46 106 46h198l106 233v535q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5v-640h-64l-200 526q-14 37 -47 59.5t-73 22.5 q-53 0 -90.5 -37.5t-37.5 -90.5zM1180 -128q44 0 78.5 27t45.5 70l85 339q19 73 19 155v91l-141 -310q-17 -38 -53 -61t-78 -23q-53 0 -93.5 34.5t-48.5 86.5q-44 -57 -114 -57h-208v32h208q46 0 81 33t35 79t-31 79t-77 33h-296q-49 0 -82 -36l-126 -136v-308 q0 -53 37.5 -90.5t90.5 -37.5h668z" /> +<glyph unicode="" horiz-adv-x="1973" d="M857 992v-117q0 -13 -9.5 -22t-22.5 -9h-298v-812q0 -13 -9 -22.5t-22 -9.5h-135q-13 0 -22.5 9t-9.5 23v812h-297q-13 0 -22.5 9t-9.5 22v117q0 14 9 23t23 9h793q13 0 22.5 -9.5t9.5 -22.5zM1895 995l77 -961q1 -13 -8 -24q-10 -10 -23 -10h-134q-12 0 -21 8.5 t-10 20.5l-46 588l-189 -425q-8 -19 -29 -19h-120q-20 0 -29 19l-188 427l-45 -590q-1 -12 -10 -20.5t-21 -8.5h-135q-13 0 -23 10q-9 10 -9 24l78 961q1 12 10 20.5t21 8.5h142q20 0 29 -19l220 -520q10 -24 20 -51q3 7 9.5 24.5t10.5 26.5l221 520q9 19 29 19h141 q13 0 22 -8.5t10 -20.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1042 833q0 88 -60 121q-33 18 -117 18h-123v-281h162q66 0 102 37t36 105zM1094 548l205 -373q8 -17 -1 -31q-8 -16 -27 -16h-152q-20 0 -28 17l-194 365h-155v-350q0 -14 -9 -23t-23 -9h-134q-14 0 -23 9t-9 23v960q0 14 9 23t23 9h294q128 0 190 -24q85 -31 134 -109 t49 -180q0 -92 -42.5 -165.5t-115.5 -109.5q6 -10 9 -16zM896 1376q-150 0 -286 -58.5t-234.5 -157t-157 -234.5t-58.5 -286t58.5 -286t157 -234.5t234.5 -157t286 -58.5t286 58.5t234.5 157t157 234.5t58.5 286t-58.5 286t-157 234.5t-234.5 157t-286 58.5zM1792 640 q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="1792" d="M605 303q153 0 257 104q14 18 3 36l-45 82q-6 13 -24 17q-16 2 -27 -11l-4 -3q-4 -4 -11.5 -10t-17.5 -13t-23.5 -14.5t-28.5 -13.5t-33.5 -9.5t-37.5 -3.5q-76 0 -125 50t-49 127q0 76 48 125.5t122 49.5q37 0 71.5 -14t50.5 -28l16 -14q11 -11 26 -10q16 2 24 14l53 78 q13 20 -2 39q-3 4 -11 12t-30 23.5t-48.5 28t-67.5 22.5t-86 10q-148 0 -246 -96.5t-98 -240.5q0 -146 97 -241.5t247 -95.5zM1235 303q153 0 257 104q14 18 4 36l-45 82q-8 14 -25 17q-16 2 -27 -11l-4 -3q-4 -4 -11.5 -10t-17.5 -13t-23.5 -14.5t-28.5 -13.5t-33.5 -9.5 t-37.5 -3.5q-76 0 -125 50t-49 127q0 76 48 125.5t122 49.5q37 0 71.5 -14t50.5 -28l16 -14q11 -11 26 -10q16 2 24 14l53 78q13 20 -2 39q-3 4 -11 12t-30 23.5t-48.5 28t-67.5 22.5t-86 10q-147 0 -245.5 -96.5t-98.5 -240.5q0 -146 97 -241.5t247 -95.5zM896 1376 q-150 0 -286 -58.5t-234.5 -157t-157 -234.5t-58.5 -286t58.5 -286t157 -234.5t234.5 -157t286 -58.5t286 58.5t234.5 157t157 234.5t58.5 286t-58.5 286t-157 234.5t-234.5 157t-286 58.5zM896 1536q182 0 348 -71t286 -191t191 -286t71 -348t-71 -348t-191 -286t-286 -191 t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71z" /> +<glyph unicode="" horiz-adv-x="2048" d="M736 736l384 -384l-384 -384l-672 672l672 672l168 -168l-96 -96l-72 72l-480 -480l480 -480l193 193l-289 287zM1312 1312l672 -672l-672 -672l-168 168l96 96l72 -72l480 480l-480 480l-193 -193l289 -287l-96 -96l-384 384z" /> +<glyph unicode="" horiz-adv-x="1792" d="M717 182l271 271l-279 279l-88 -88l192 -191l-96 -96l-279 279l279 279l40 -40l87 87l-127 128l-454 -454zM1075 190l454 454l-454 454l-271 -271l279 -279l88 88l-192 191l96 96l279 -279l-279 -279l-40 40l-87 -88zM1792 640q0 -182 -71 -348t-191 -286t-286 -191 t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="2304" d="M651 539q0 -39 -27.5 -66.5t-65.5 -27.5q-39 0 -66.5 27.5t-27.5 66.5q0 38 27.5 65.5t66.5 27.5q38 0 65.5 -27.5t27.5 -65.5zM1805 540q0 -39 -27.5 -66.5t-66.5 -27.5t-66.5 27.5t-27.5 66.5t27.5 66t66.5 27t66.5 -27t27.5 -66zM765 539q0 79 -56.5 136t-136.5 57 t-136.5 -56.5t-56.5 -136.5t56.5 -136.5t136.5 -56.5t136.5 56.5t56.5 136.5zM1918 540q0 80 -56.5 136.5t-136.5 56.5q-79 0 -136 -56.5t-57 -136.5t56.5 -136.5t136.5 -56.5t136.5 56.5t56.5 136.5zM850 539q0 -116 -81.5 -197.5t-196.5 -81.5q-116 0 -197.5 82t-81.5 197 t82 196.5t197 81.5t196.5 -81.5t81.5 -196.5zM2004 540q0 -115 -81.5 -196.5t-197.5 -81.5q-115 0 -196.5 81.5t-81.5 196.5t81.5 196.5t196.5 81.5q116 0 197.5 -81.5t81.5 -196.5zM1040 537q0 191 -135.5 326.5t-326.5 135.5q-125 0 -231 -62t-168 -168.5t-62 -231.5 t62 -231.5t168 -168.5t231 -62q191 0 326.5 135.5t135.5 326.5zM1708 1110q-254 111 -556 111q-319 0 -573 -110q117 0 223 -45.5t182.5 -122.5t122 -183t45.5 -223q0 115 43.5 219.5t118 180.5t177.5 123t217 50zM2187 537q0 191 -135 326.5t-326 135.5t-326.5 -135.5 t-135.5 -326.5t135.5 -326.5t326.5 -135.5t326 135.5t135 326.5zM1921 1103h383q-44 -51 -75 -114.5t-40 -114.5q110 -151 110 -337q0 -156 -77 -288t-209 -208.5t-287 -76.5q-133 0 -249 56t-196 155q-47 -56 -129 -179q-11 22 -53.5 82.5t-74.5 97.5 q-80 -99 -196.5 -155.5t-249.5 -56.5q-155 0 -287 76.5t-209 208.5t-77 288q0 186 110 337q-9 51 -40 114.5t-75 114.5h365q149 100 355 156.5t432 56.5q224 0 421 -56t348 -157z" /> +<glyph unicode="" horiz-adv-x="1280" d="M640 629q-188 0 -321 133t-133 320q0 188 133 321t321 133t321 -133t133 -321q0 -187 -133 -320t-321 -133zM640 1306q-92 0 -157.5 -65.5t-65.5 -158.5q0 -92 65.5 -157.5t157.5 -65.5t157.5 65.5t65.5 157.5q0 93 -65.5 158.5t-157.5 65.5zM1163 574q13 -27 15 -49.5 t-4.5 -40.5t-26.5 -38.5t-42.5 -37t-61.5 -41.5q-115 -73 -315 -94l73 -72l267 -267q30 -31 30 -74t-30 -73l-12 -13q-31 -30 -74 -30t-74 30q-67 68 -267 268l-267 -268q-31 -30 -74 -30t-73 30l-12 13q-31 30 -31 73t31 74l267 267l72 72q-203 21 -317 94 q-39 25 -61.5 41.5t-42.5 37t-26.5 38.5t-4.5 40.5t15 49.5q10 20 28 35t42 22t56 -2t65 -35q5 -4 15 -11t43 -24.5t69 -30.5t92 -24t113 -11q91 0 174 25.5t120 50.5l38 25q33 26 65 35t56 2t42 -22t28 -35z" /> +<glyph unicode="" d="M927 956q0 -66 -46.5 -112.5t-112.5 -46.5t-112.5 46.5t-46.5 112.5t46.5 112.5t112.5 46.5t112.5 -46.5t46.5 -112.5zM1141 593q-10 20 -28 32t-47.5 9.5t-60.5 -27.5q-10 -8 -29 -20t-81 -32t-127 -20t-124 18t-86 36l-27 18q-31 25 -60.5 27.5t-47.5 -9.5t-28 -32 q-22 -45 -2 -74.5t87 -73.5q83 -53 226 -67l-51 -52q-142 -142 -191 -190q-22 -22 -22 -52.5t22 -52.5l9 -9q22 -22 52.5 -22t52.5 22l191 191q114 -115 191 -191q22 -22 52.5 -22t52.5 22l9 9q22 22 22 52.5t-22 52.5l-191 190l-52 52q141 14 225 67q67 44 87 73.5t-2 74.5 zM1092 956q0 134 -95 229t-229 95t-229 -95t-95 -229t95 -229t229 -95t229 95t95 229zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1720" d="M1565 1408q65 0 110 -45.5t45 -110.5v-519q0 -176 -68 -336t-182.5 -275t-274 -182.5t-334.5 -67.5q-176 0 -335.5 67.5t-274.5 182.5t-183 275t-68 336v519q0 64 46 110t110 46h1409zM861 344q47 0 82 33l404 388q37 35 37 85q0 49 -34.5 83.5t-83.5 34.5q-47 0 -82 -33 l-323 -310l-323 310q-35 33 -81 33q-49 0 -83.5 -34.5t-34.5 -83.5q0 -51 36 -85l405 -388q33 -33 81 -33z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1494 -103l-295 695q-25 -49 -158.5 -305.5t-198.5 -389.5q-1 -1 -27.5 -0.5t-26.5 1.5q-82 193 -255.5 587t-259.5 596q-21 50 -66.5 107.5t-103.5 100.5t-102 43q0 5 -0.5 24t-0.5 27h583v-50q-39 -2 -79.5 -16t-66.5 -43t-10 -64q26 -59 216.5 -499t235.5 -540 q31 61 140 266.5t131 247.5q-19 39 -126 281t-136 295q-38 69 -201 71v50l513 -1v-47q-60 -2 -93.5 -25t-12.5 -69q33 -70 87 -189.5t86 -187.5q110 214 173 363q24 55 -10 79.5t-129 26.5q1 7 1 25v24q64 0 170.5 0.5t180 1t92.5 0.5v-49q-62 -2 -119 -33t-90 -81 l-213 -442q13 -33 127.5 -290t121.5 -274l441 1017q-14 38 -49.5 62.5t-65 31.5t-55.5 8v50l460 -4l1 -2l-1 -44q-139 -4 -201 -145q-526 -1216 -559 -1291h-49z" /> +<glyph unicode="" horiz-adv-x="1792" d="M949 643q0 -26 -16.5 -45t-41.5 -19q-26 0 -45 16.5t-19 41.5q0 26 17 45t42 19t44 -16.5t19 -41.5zM964 585l350 581q-9 -8 -67.5 -62.5t-125.5 -116.5t-136.5 -127t-117 -110.5t-50.5 -51.5l-349 -580q7 7 67 62t126 116.5t136 127t117 111t50 50.5zM1611 640 q0 -201 -104 -371q-3 2 -17 11t-26.5 16.5t-16.5 7.5q-13 0 -13 -13q0 -10 59 -44q-74 -112 -184.5 -190.5t-241.5 -110.5l-16 67q-1 10 -15 10q-5 0 -8 -5.5t-2 -9.5l16 -68q-72 -15 -146 -15q-199 0 -372 105q1 2 13 20.5t21.5 33.5t9.5 19q0 13 -13 13q-6 0 -17 -14.5 t-22.5 -34.5t-13.5 -23q-113 75 -192 187.5t-110 244.5l69 15q10 3 10 15q0 5 -5.5 8t-10.5 2l-68 -15q-14 72 -14 139q0 206 109 379q2 -1 18.5 -12t30 -19t17.5 -8q13 0 13 12q0 6 -12.5 15.5t-32.5 21.5l-20 12q77 112 189 189t244 107l15 -67q2 -10 15 -10q5 0 8 5.5 t2 10.5l-15 66q71 13 134 13q204 0 379 -109q-39 -56 -39 -65q0 -13 12 -13q11 0 48 64q111 -75 187.5 -186t107.5 -241l-56 -12q-10 -2 -10 -16q0 -5 5.5 -8t9.5 -2l57 13q14 -72 14 -140zM1696 640q0 163 -63.5 311t-170.5 255t-255 170.5t-311 63.5t-311 -63.5 t-255 -170.5t-170.5 -255t-63.5 -311t63.5 -311t170.5 -255t255 -170.5t311 -63.5t311 63.5t255 170.5t170.5 255t63.5 311zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191 t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="1792" d="M893 1536q240 2 451 -120q232 -134 352 -372l-742 39q-160 9 -294 -74.5t-185 -229.5l-276 424q128 159 311 245.5t383 87.5zM146 1131l337 -663q72 -143 211 -217t293 -45l-230 -451q-212 33 -385 157.5t-272.5 316t-99.5 411.5q0 267 146 491zM1732 962 q58 -150 59.5 -310.5t-48.5 -306t-153 -272t-246 -209.5q-230 -133 -498 -119l405 623q88 131 82.5 290.5t-106.5 277.5zM896 942q125 0 213.5 -88.5t88.5 -213.5t-88.5 -213.5t-213.5 -88.5t-213.5 88.5t-88.5 213.5t88.5 213.5t213.5 88.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M903 -256q-283 0 -504.5 150.5t-329.5 398.5q-58 131 -67 301t26 332.5t111 312t179 242.5l-11 -281q11 14 68 15.5t70 -15.5q42 81 160.5 138t234.5 59q-54 -45 -119.5 -148.5t-58.5 -163.5q25 -8 62.5 -13.5t63 -7.5t68 -4t50.5 -3q15 -5 9.5 -45.5t-30.5 -75.5 q-5 -7 -16.5 -18.5t-56.5 -35.5t-101 -34l15 -189l-139 67q-18 -43 -7.5 -81.5t36 -66.5t65.5 -41.5t81 -6.5q51 9 98 34.5t83.5 45t73.5 17.5q61 -4 89.5 -33t19.5 -65q-1 -2 -2.5 -5.5t-8.5 -12.5t-18 -15.5t-31.5 -10.5t-46.5 -1q-60 -95 -144.5 -135.5t-209.5 -29.5 q74 -61 162.5 -82.5t168.5 -6t154.5 52t128 87.5t80.5 104q43 91 39 192.5t-37.5 188.5t-78.5 125q87 -38 137 -79.5t77 -112.5q15 170 -57.5 343t-209.5 284q265 -77 412 -279.5t151 -517.5q2 -127 -40.5 -255t-123.5 -238t-189 -196t-247.5 -135.5t-288.5 -49.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1493 1308q-165 110 -359 110q-155 0 -293 -73t-240 -200q-75 -93 -119.5 -218t-48.5 -266v-42q4 -141 48.5 -266t119.5 -218q102 -127 240 -200t293 -73q194 0 359 110q-121 -108 -274.5 -168t-322.5 -60q-29 0 -43 1q-175 8 -333 82t-272 193t-181 281t-67 339 q0 182 71 348t191 286t286 191t348 71h3q168 -1 320.5 -60.5t273.5 -167.5zM1792 640q0 -192 -77 -362.5t-213 -296.5q-104 -63 -222 -63q-137 0 -255 84q154 56 253.5 233t99.5 405q0 227 -99 404t-253 234q119 83 254 83q119 0 226 -65q135 -125 210.5 -295t75.5 -361z " /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 599q0 -56 -7 -104h-1151q0 -146 109.5 -244.5t257.5 -98.5q99 0 185.5 46.5t136.5 130.5h423q-56 -159 -170.5 -281t-267.5 -188.5t-321 -66.5q-187 0 -356 83q-228 -116 -394 -116q-237 0 -237 263q0 115 45 275q17 60 109 229q199 360 475 606 q-184 -79 -427 -354q63 274 283.5 449.5t501.5 175.5q30 0 45 -1q255 117 433 117q64 0 116 -13t94.5 -40.5t66.5 -76.5t24 -115q0 -116 -75 -286q101 -182 101 -390zM1722 1239q0 83 -53 132t-137 49q-108 0 -254 -70q121 -47 222.5 -131.5t170.5 -195.5q51 135 51 216z M128 2q0 -86 48.5 -132.5t134.5 -46.5q115 0 266 83q-122 72 -213.5 183t-137.5 245q-98 -205 -98 -332zM632 715h728q-5 142 -113 237t-251 95q-144 0 -251.5 -95t-112.5 -237z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1792 288v960q0 13 -9.5 22.5t-22.5 9.5h-1600q-13 0 -22.5 -9.5t-9.5 -22.5v-960q0 -13 9.5 -22.5t22.5 -9.5h1600q13 0 22.5 9.5t9.5 22.5zM1920 1248v-960q0 -66 -47 -113t-113 -47h-736v-128h352q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-832q-14 0 -23 9t-9 23 v64q0 14 9 23t23 9h352v128h-736q-66 0 -113 47t-47 113v960q0 66 47 113t113 47h1600q66 0 113 -47t47 -113z" /> +<glyph unicode="" horiz-adv-x="1792" d="M138 1408h197q-70 -64 -126 -149q-36 -56 -59 -115t-30 -125.5t-8.5 -120t10.5 -132t21 -126t28 -136.5q4 -19 6 -28q51 -238 81 -329q57 -171 152 -275h-272q-48 0 -82 34t-34 82v1304q0 48 34 82t82 34zM1346 1408h308q48 0 82 -34t34 -82v-1304q0 -48 -34 -82t-82 -34 h-178q212 210 196 565l-469 -101q-2 -45 -12 -82t-31 -72t-59.5 -59.5t-93.5 -36.5q-123 -26 -199 40q-32 27 -53 61t-51.5 129t-64.5 258q-35 163 -45.5 263t-5.5 139t23 77q20 41 62.5 73t102.5 45q45 12 83.5 6.5t67 -17t54 -35t43 -48t34.5 -56.5l468 100 q-68 175 -180 287z" /> +<glyph unicode="" d="M1401 -11l-6 -6q-113 -114 -259 -175q-154 -64 -317 -64q-165 0 -317 64q-148 63 -259 175q-113 112 -175 258q-42 103 -54 189q-4 28 48 36q51 8 56 -20q1 -1 1 -4q18 -90 46 -159q50 -124 152 -226q98 -98 226 -152q132 -56 276 -56q143 0 276 56q128 55 225 152l6 6 q10 10 25 6q12 -3 33 -22q36 -37 17 -58zM929 604l-66 -66l63 -63q21 -21 -7 -49q-17 -17 -32 -17q-10 0 -19 10l-62 61l-66 -66q-5 -5 -15 -5q-15 0 -31 16l-2 2q-18 15 -18 29q0 7 8 17l66 65l-66 66q-16 16 14 45q18 18 31 18q6 0 13 -5l65 -66l65 65q18 17 48 -13 q27 -27 11 -44zM1400 547q0 -118 -46 -228q-45 -105 -126 -186q-80 -80 -187 -126t-228 -46t-228 46t-187 126q-82 82 -125 186q-15 32 -15 40h-1q-9 27 43 44q50 16 60 -12q37 -99 97 -167h1v339v2q3 136 102 232q105 103 253 103q147 0 251 -103t104 -249 q0 -147 -104.5 -251t-250.5 -104q-58 0 -112 16q-28 11 -13 61q16 51 44 43l14 -3q14 -3 32.5 -6t30.5 -3q104 0 176 71.5t72 174.5q0 101 -72 171q-71 71 -175 71q-107 0 -178 -80q-64 -72 -64 -160v-413q110 -67 242 -67q96 0 185 36.5t156 103.5t103.5 155t36.5 183 q0 198 -141 339q-140 140 -339 140q-200 0 -340 -140q-53 -53 -77 -87l-2 -2q-8 -11 -13 -15.5t-21.5 -9.5t-38.5 3q-21 5 -36.5 16.5t-15.5 26.5v680q0 15 10.5 26.5t27.5 11.5h877q30 0 30 -55t-30 -55h-811v-483h1q40 42 102 84t108 61q109 46 231 46q121 0 228 -46 t187 -126q81 -81 126 -186q46 -112 46 -229zM1369 1128q9 -8 9 -18t-5.5 -18t-16.5 -21q-26 -26 -39 -26q-9 0 -16 7q-106 91 -207 133q-128 56 -276 56q-133 0 -262 -49q-27 -10 -45 37q-9 25 -8 38q3 16 16 20q130 57 299 57q164 0 316 -64q137 -58 235 -152z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1551 60q15 6 26 3t11 -17.5t-15 -33.5q-13 -16 -44 -43.5t-95.5 -68t-141 -74t-188 -58t-229.5 -24.5q-119 0 -238 31t-209 76.5t-172.5 104t-132.5 105t-84 87.5q-8 9 -10 16.5t1 12t8 7t11.5 2t11.5 -4.5q192 -117 300 -166q389 -176 799 -90q190 40 391 135z M1758 175q11 -16 2.5 -69.5t-28.5 -102.5q-34 -83 -85 -124q-17 -14 -26 -9t0 24q21 45 44.5 121.5t6.5 98.5q-5 7 -15.5 11.5t-27 6t-29.5 2.5t-35 0t-31.5 -2t-31 -3t-22.5 -2q-6 -1 -13 -1.5t-11 -1t-8.5 -1t-7 -0.5h-5.5h-4.5t-3 0.5t-2 1.5l-1.5 3q-6 16 47 40t103 30 q46 7 108 1t76 -24zM1364 618q0 -31 13.5 -64t32 -58t37.5 -46t33 -32l13 -11l-227 -224q-40 37 -79 75.5t-58 58.5l-19 20q-11 11 -25 33q-38 -59 -97.5 -102.5t-127.5 -63.5t-140 -23t-137.5 21t-117.5 65.5t-83 113t-31 162.5q0 84 28 154t72 116.5t106.5 83t122.5 57 t130 34.5t119.5 18.5t99.5 6.5v127q0 65 -21 97q-34 53 -121 53q-6 0 -16.5 -1t-40.5 -12t-56 -29.5t-56 -59.5t-48 -96l-294 27q0 60 22 119t67 113t108 95t151.5 65.5t190.5 24.5q100 0 181 -25t129.5 -61.5t81 -83t45 -86t12.5 -73.5v-589zM692 597q0 -86 70 -133 q66 -44 139 -22q84 25 114 123q14 45 14 101v162q-59 -2 -111 -12t-106.5 -33.5t-87 -71t-32.5 -114.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1536 1280q52 0 90 -38t38 -90v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128zM1152 1376v-288q0 -14 9 -23t23 -9 h64q14 0 23 9t9 23v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM384 1376v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23zM1536 -128v1024h-1408v-1024h1408zM896 448h224q14 0 23 -9t9 -23v-64q0 -14 -9 -23t-23 -9h-224 v-224q0 -14 -9 -23t-23 -9h-64q-14 0 -23 9t-9 23v224h-224q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h224v224q0 14 9 23t23 9h64q14 0 23 -9t9 -23v-224z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1152 416v-64q0 -14 -9 -23t-23 -9h-576q-14 0 -23 9t-9 23v64q0 14 9 23t23 9h576q14 0 23 -9t9 -23zM128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23 t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47 t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1111 151l-46 -46q-9 -9 -22 -9t-23 9l-188 189l-188 -189q-10 -9 -23 -9t-22 9l-46 46q-9 9 -9 22t9 23l189 188l-189 188q-9 10 -9 23t9 22l46 46q9 9 22 9t23 -9l188 -188l188 188q10 9 23 9t22 -9l46 -46q9 -9 9 -22t-9 -23l-188 -188l188 -188q9 -10 9 -23t-9 -22z M128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280 q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1303 572l-512 -512q-10 -9 -23 -9t-23 9l-288 288q-9 10 -9 23t9 22l46 46q9 9 22 9t23 -9l220 -220l444 444q10 9 23 9t22 -9l46 -46q9 -9 9 -22t-9 -23zM128 -128h1408v1024h-1408v-1024zM512 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23 t23 -9h64q14 0 23 9t9 23zM1280 1088v288q0 14 -9 23t-23 9h-64q-14 0 -23 -9t-9 -23v-288q0 -14 9 -23t23 -9h64q14 0 23 9t9 23zM1664 1152v-1280q0 -52 -38 -90t-90 -38h-1408q-52 0 -90 38t-38 90v1280q0 52 38 90t90 38h128v96q0 66 47 113t113 47h64q66 0 113 -47 t47 -113v-96h384v96q0 66 47 113t113 47h64q66 0 113 -47t47 -113v-96h128q52 0 90 -38t38 -90z" /> +<glyph unicode="" horiz-adv-x="1792" d="M448 1536q26 0 45 -19t19 -45v-891l536 429q17 14 40 14q26 0 45 -19t19 -45v-379l536 429q17 14 40 14q26 0 45 -19t19 -45v-1152q0 -26 -19 -45t-45 -19h-1664q-26 0 -45 19t-19 45v1664q0 26 19 45t45 19h384z" /> +<glyph unicode="" horiz-adv-x="1024" d="M512 448q66 0 128 15v-655q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v655q61 -15 128 -15zM512 1536q212 0 362 -150t150 -362t-150 -362t-362 -150t-362 150t-150 362t150 362t362 150zM512 1312q14 0 23 9t9 23t-9 23t-23 9q-146 0 -249 -103t-103 -249 q0 -14 9 -23t23 -9t23 9t9 23q0 119 84.5 203.5t203.5 84.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1745 1239q10 -10 10 -23t-10 -23l-141 -141q-28 -28 -68 -28h-1344q-26 0 -45 19t-19 45v256q0 26 19 45t45 19h576v64q0 26 19 45t45 19h128q26 0 45 -19t19 -45v-64h512q40 0 68 -28zM768 320h256v-512q0 -26 -19 -45t-45 -19h-128q-26 0 -45 19t-19 45v512zM1600 768 q26 0 45 -19t19 -45v-256q0 -26 -19 -45t-45 -19h-1344q-40 0 -68 28l-141 141q-10 10 -10 23t10 23l141 141q28 28 68 28h512v192h256v-192h576z" /> +<glyph unicode="" horiz-adv-x="2048" d="M2020 1525q28 -20 28 -53v-1408q0 -20 -11 -36t-29 -23l-640 -256q-24 -11 -48 0l-616 246l-616 -246q-10 -5 -24 -5q-19 0 -36 11q-28 20 -28 53v1408q0 20 11 36t29 23l640 256q24 11 48 0l616 -246l616 246q32 13 60 -6zM736 1390v-1270l576 -230v1270zM128 1173 v-1270l544 217v1270zM1920 107v1270l-544 -217v-1270z" /> +<glyph unicode="" horiz-adv-x="1792" d="M512 1536q13 0 22.5 -9.5t9.5 -22.5v-1472q0 -20 -17 -28l-480 -256q-7 -4 -15 -4q-13 0 -22.5 9.5t-9.5 22.5v1472q0 20 17 28l480 256q7 4 15 4zM1760 1536q13 0 22.5 -9.5t9.5 -22.5v-1472q0 -20 -17 -28l-480 -256q-7 -4 -15 -4q-13 0 -22.5 9.5t-9.5 22.5v1472 q0 20 17 28l480 256q7 4 15 4zM640 1536q8 0 14 -3l512 -256q18 -10 18 -29v-1472q0 -13 -9.5 -22.5t-22.5 -9.5q-8 0 -14 3l-512 256q-18 10 -18 29v1472q0 13 9.5 22.5t22.5 9.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 640q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1024 640q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1408 640q0 53 -37.5 90.5t-90.5 37.5 t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5zM1792 640q0 -174 -120 -321.5t-326 -233t-450 -85.5q-110 0 -211 18q-173 -173 -435 -229q-52 -10 -86 -13q-12 -1 -22 6t-13 18q-4 15 20 37q5 5 23.5 21.5t25.5 23.5t23.5 25.5t24 31.5t20.5 37 t20 48t14.5 57.5t12.5 72.5q-146 90 -229.5 216.5t-83.5 269.5q0 174 120 321.5t326 233t450 85.5t450 -85.5t326 -233t120 -321.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 640q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1024 640q0 -53 -37.5 -90.5t-90.5 -37.5t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM1408 640q0 -53 -37.5 -90.5t-90.5 -37.5 t-90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5t90.5 -37.5t37.5 -90.5zM896 1152q-204 0 -381.5 -69.5t-282 -187.5t-104.5 -255q0 -112 71.5 -213.5t201.5 -175.5l87 -50l-27 -96q-24 -91 -70 -172q152 63 275 171l43 38l57 -6q69 -8 130 -8q204 0 381.5 69.5t282 187.5 t104.5 255t-104.5 255t-282 187.5t-381.5 69.5zM1792 640q0 -174 -120 -321.5t-326 -233t-450 -85.5q-70 0 -145 8q-198 -175 -460 -242q-49 -14 -114 -22h-5q-15 0 -27 10.5t-16 27.5v1q-3 4 -0.5 12t2 10t4.5 9.5l6 9t7 8.5t8 9q7 8 31 34.5t34.5 38t31 39.5t32.5 51 t27 59t26 76q-157 89 -247.5 220t-90.5 281q0 130 71 248.5t191 204.5t286 136.5t348 50.5t348 -50.5t286 -136.5t191 -204.5t71 -248.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M512 345l512 295v-591l-512 -296v592zM0 640v-591l512 296zM512 1527v-591l-512 -296v591zM512 936l512 295v-591z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1709 1018q-10 -236 -332 -651q-333 -431 -562 -431q-142 0 -240 263q-44 160 -132 482q-72 262 -157 262q-18 0 -127 -76l-77 98q24 21 108 96.5t130 115.5q156 138 241 146q95 9 153 -55.5t81 -203.5q44 -287 66 -373q55 -249 120 -249q51 0 154 161q101 161 109 246 q13 139 -109 139q-57 0 -121 -26q120 393 459 382q251 -8 236 -326z" /> +<glyph unicode="" d="M0 1408h1536v-1536h-1536v1536zM1085 293l-221 631l221 297h-634l221 -297l-221 -631l317 -304z" /> +<glyph unicode="" d="M0 1408h1536v-1536h-1536v1536zM908 1088l-12 -33l75 -83l-31 -114l25 -25l107 57l107 -57l25 25l-31 114l75 83l-12 33h-95l-53 96h-32l-53 -96h-95zM641 925q32 0 44.5 -16t11.5 -63l174 21q0 55 -17.5 92.5t-50.5 56t-69 25.5t-85 7q-133 0 -199 -57.5t-66 -182.5v-72 h-96v-128h76q20 0 20 -8v-382q0 -14 -5 -20t-18 -7l-73 -7v-88h448v86l-149 14q-6 1 -8.5 1.5t-3.5 2.5t-0.5 4t1 7t0.5 10v387h191l38 128h-231q-6 0 -2 6t4 9v80q0 27 1.5 40.5t7.5 28t19.5 20t36.5 5.5zM1248 96v86l-54 9q-7 1 -9.5 2.5t-2.5 3t1 7.5t1 12v520h-275 l-23 -101l83 -22q23 -7 23 -27v-370q0 -14 -6 -18.5t-20 -6.5l-70 -9v-86h352z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1792 690q0 -58 -29.5 -105.5t-79.5 -72.5q12 -46 12 -96q0 -155 -106.5 -287t-290.5 -208.5t-400 -76.5t-399.5 76.5t-290 208.5t-106.5 287q0 47 11 94q-51 25 -82 73.5t-31 106.5q0 82 58 140.5t141 58.5q85 0 145 -63q218 152 515 162l116 521q3 13 15 21t26 5 l369 -81q18 37 54 59.5t79 22.5q62 0 106 -43.5t44 -105.5t-44 -106t-106 -44t-105.5 43.5t-43.5 105.5l-334 74l-104 -472q300 -9 519 -160q58 61 143 61q83 0 141 -58.5t58 -140.5zM418 491q0 -62 43.5 -106t105.5 -44t106 44t44 106t-44 105.5t-106 43.5q-61 0 -105 -44 t-44 -105zM1228 136q11 11 11 26t-11 26q-10 10 -25 10t-26 -10q-41 -42 -121 -62t-160 -20t-160 20t-121 62q-11 10 -26 10t-25 -10q-11 -10 -11 -25.5t11 -26.5q43 -43 118.5 -68t122.5 -29.5t91 -4.5t91 4.5t122.5 29.5t118.5 68zM1225 341q62 0 105.5 44t43.5 106 q0 61 -44 105t-105 44q-62 0 -106 -43.5t-44 -105.5t44 -106t106 -44z" /> +<glyph unicode="" horiz-adv-x="1792" d="M69 741h1q16 126 58.5 241.5t115 217t167.5 176t223.5 117.5t276.5 43q231 0 414 -105.5t294 -303.5q104 -187 104 -442v-188h-1125q1 -111 53.5 -192.5t136.5 -122.5t189.5 -57t213 -3t208 46.5t173.5 84.5v-377q-92 -55 -229.5 -92t-312.5 -38t-316 53 q-189 73 -311.5 249t-124.5 372q-3 242 111 412t325 268q-48 -60 -78 -125.5t-46 -159.5h635q8 77 -8 140t-47 101.5t-70.5 66.5t-80.5 41t-75 20.5t-56 8.5l-22 1q-135 -5 -259.5 -44.5t-223.5 -104.5t-176 -140.5t-138 -163.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M0 32v608h2304v-608q0 -66 -47 -113t-113 -47h-1984q-66 0 -113 47t-47 113zM640 256v-128h384v128h-384zM256 256v-128h256v128h-256zM2144 1408q66 0 113 -47t47 -113v-224h-2304v224q0 66 47 113t113 47h1984z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1549 857q55 0 85.5 -28.5t30.5 -83.5t-34 -82t-91 -27h-136v-177h-25v398h170zM1710 267l-4 -11l-5 -10q-113 -230 -330.5 -366t-474.5 -136q-182 0 -348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71q244 0 454.5 -124t329.5 -338l2 -4l8 -16 q-30 -15 -136.5 -68.5t-163.5 -84.5q-6 -3 -479 -268q384 -183 799 -366zM896 -234q250 0 462.5 132.5t322.5 357.5l-287 129q-72 -140 -206 -222t-292 -82q-151 0 -280 75t-204 204t-75 280t75 280t204 204t280 75t280 -73.5t204 -204.5l280 143q-116 208 -321 329 t-443 121q-119 0 -232.5 -31.5t-209 -87.5t-176.5 -137t-137 -176.5t-87.5 -209t-31.5 -232.5t31.5 -232.5t87.5 -209t137 -176.5t176.5 -137t209 -87.5t232.5 -31.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1427 827l-614 386l92 151h855zM405 562l-184 116v858l1183 -743zM1424 697l147 -95v-858l-532 335zM1387 718l-500 -802h-855l356 571z" /> +<glyph unicode="" horiz-adv-x="1792" d="M640 528v224q0 16 -16 16h-96q-16 0 -16 -16v-224q0 -16 16 -16h96q16 0 16 16zM1152 528v224q0 16 -16 16h-96q-16 0 -16 -16v-224q0 -16 16 -16h96q16 0 16 16zM1664 496v-752h-640v320q0 80 -56 136t-136 56t-136 -56t-56 -136v-320h-640v752q0 16 16 16h96 q16 0 16 -16v-112h128v624q0 16 16 16h96q16 0 16 -16v-112h128v112q0 16 16 16h96q16 0 16 -16v-112h128v112q0 6 2.5 9.5t8.5 5t9.5 2t11.5 0t9 -0.5v391q-32 15 -32 50q0 23 16.5 39t38.5 16t38.5 -16t16.5 -39q0 -35 -32 -50v-17q45 10 83 10q21 0 59.5 -7.5t54.5 -7.5 q17 0 47 7.5t37 7.5q16 0 16 -16v-210q0 -15 -35 -21.5t-62 -6.5q-18 0 -54.5 7.5t-55.5 7.5q-40 0 -90 -12v-133q1 0 9 0.5t11.5 0t9.5 -2t8.5 -5t2.5 -9.5v-112h128v112q0 16 16 16h96q16 0 16 -16v-112h128v112q0 16 16 16h96q16 0 16 -16v-624h128v112q0 16 16 16h96 q16 0 16 -16z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2288 731q16 -8 16 -27t-16 -27l-320 -192q-8 -5 -16 -5q-9 0 -16 4q-16 10 -16 28v128h-858q37 -58 83 -165q16 -37 24.5 -55t24 -49t27 -47t27 -34t31.5 -26t33 -8h96v96q0 14 9 23t23 9h320q14 0 23 -9t9 -23v-320q0 -14 -9 -23t-23 -9h-320q-14 0 -23 9t-9 23v96h-96 q-32 0 -61 10t-51 23.5t-45 40.5t-37 46t-33.5 57t-28.5 57.5t-28 60.5q-23 53 -37 81.5t-36 65t-44.5 53.5t-46.5 17h-360q-22 -84 -91 -138t-157 -54q-106 0 -181 75t-75 181t75 181t181 75q88 0 157 -54t91 -138h104q24 0 46.5 17t44.5 53.5t36 65t37 81.5q19 41 28 60.5 t28.5 57.5t33.5 57t37 46t45 40.5t51 23.5t61 10h107q21 57 70 92.5t111 35.5q80 0 136 -56t56 -136t-56 -136t-136 -56q-62 0 -111 35.5t-70 92.5h-107q-17 0 -33 -8t-31.5 -26t-27 -34t-27 -47t-24 -49t-24.5 -55q-46 -107 -83 -165h1114v128q0 18 16 28t32 -1z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1150 774q0 -56 -39.5 -95t-95.5 -39h-253v269h253q56 0 95.5 -39.5t39.5 -95.5zM1329 774q0 130 -91.5 222t-222.5 92h-433v-896h180v269h253q130 0 222 91.5t92 221.5zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348 t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1645 438q0 59 -34 106.5t-87 68.5q-7 -45 -23 -92q-7 -24 -27.5 -38t-44.5 -14q-12 0 -24 3q-31 10 -45 38.5t-4 58.5q23 71 23 143q0 123 -61 227.5t-166 165.5t-228 61q-134 0 -247 -73t-167 -194q108 -28 188 -106q22 -23 22 -55t-22 -54t-54 -22t-55 22 q-75 75 -180 75q-106 0 -181 -74.5t-75 -180.5t75 -180.5t181 -74.5h1046q79 0 134.5 55.5t55.5 133.5zM1798 438q0 -142 -100.5 -242t-242.5 -100h-1046q-169 0 -289 119.5t-120 288.5q0 153 100 267t249 136q62 184 221 298t354 114q235 0 408.5 -158.5t196.5 -389.5 q116 -25 192.5 -118.5t76.5 -214.5zM2048 438q0 -175 -97 -319q-23 -33 -64 -33q-24 0 -43 13q-26 17 -32 48.5t12 57.5q71 104 71 233t-71 233q-18 26 -12 57t32 49t57.5 11.5t49.5 -32.5q97 -142 97 -318zM2304 438q0 -244 -134 -443q-23 -34 -64 -34q-23 0 -42 13 q-26 18 -32.5 49t11.5 57q108 164 108 358q0 195 -108 357q-18 26 -11.5 57.5t32.5 48.5q26 18 57 12t49 -33q134 -198 134 -442z" /> +<glyph unicode="" d="M1500 -13q0 -89 -63 -152.5t-153 -63.5t-153.5 63.5t-63.5 152.5q0 90 63.5 153.5t153.5 63.5t153 -63.5t63 -153.5zM1267 268q-115 -15 -192.5 -102.5t-77.5 -205.5q0 -74 33 -138q-146 -78 -379 -78q-109 0 -201 21t-153.5 54.5t-110.5 76.5t-76 85t-44.5 83 t-23.5 66.5t-6 39.5q0 19 4.5 42.5t18.5 56t36.5 58t64 43.5t94.5 18t94 -17.5t63 -41t35.5 -53t17.5 -49t4 -33.5q0 -34 -23 -81q28 -27 82 -42t93 -17l40 -1q115 0 190 51t75 133q0 26 -9 48.5t-31.5 44.5t-49.5 41t-74 44t-93.5 47.5t-119.5 56.5q-28 13 -43 20 q-116 55 -187 100t-122.5 102t-72 125.5t-20.5 162.5q0 78 20.5 150t66 137.5t112.5 114t166.5 77t221.5 28.5q120 0 220 -26t164.5 -67t109.5 -94t64 -105.5t19 -103.5q0 -46 -15 -82.5t-36.5 -58t-48.5 -36t-49 -19.5t-39 -5h-8h-32t-39 5t-44 14t-41 28t-37 46t-24 70.5 t-10 97.5q-15 16 -59 25.5t-81 10.5l-37 1q-68 0 -117.5 -31t-70.5 -70t-21 -76q0 -24 5 -43t24 -46t53 -51t97 -53.5t150 -58.5q76 -25 138.5 -53.5t109 -55.5t83 -59t60.5 -59.5t41 -62.5t26.5 -62t14.5 -63.5t6 -62t1 -62.5z" /> +<glyph unicode="" d="M704 352v576q0 14 -9 23t-23 9h-256q-14 0 -23 -9t-9 -23v-576q0 -14 9 -23t23 -9h256q14 0 23 9t9 23zM1152 352v576q0 14 -9 23t-23 9h-256q-14 0 -23 -9t-9 -23v-576q0 -14 9 -23t23 -9h256q14 0 23 9t9 23zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103 t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM768 96q148 0 273 73t198 198t73 273t-73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273 t73 -273t198 -198t273 -73zM864 320q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-576q0 -14 -9 -23t-23 -9h-192zM480 320q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h192q14 0 23 -9t9 -23v-576q0 -14 -9 -23t-23 -9h-192z" /> +<glyph unicode="" d="M1088 352v576q0 14 -9 23t-23 9h-576q-14 0 -23 -9t-9 -23v-576q0 -14 9 -23t23 -9h576q14 0 23 9t9 23zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5 t103 -385.5z" /> +<glyph unicode="" d="M768 1408q209 0 385.5 -103t279.5 -279.5t103 -385.5t-103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103zM768 96q148 0 273 73t198 198t73 273t-73 273t-198 198t-273 73t-273 -73t-198 -198t-73 -273 t73 -273t198 -198t273 -73zM480 320q-14 0 -23 9t-9 23v576q0 14 9 23t23 9h576q14 0 23 -9t9 -23v-576q0 -14 -9 -23t-23 -9h-576z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1757 128l35 -313q3 -28 -16 -50q-19 -21 -48 -21h-1664q-29 0 -48 21q-19 22 -16 50l35 313h1722zM1664 967l86 -775h-1708l86 775q3 24 21 40.5t43 16.5h256v-128q0 -53 37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5v128h384v-128q0 -53 37.5 -90.5t90.5 -37.5 t90.5 37.5t37.5 90.5v128h256q25 0 43 -16.5t21 -40.5zM1280 1152v-256q0 -26 -19 -45t-45 -19t-45 19t-19 45v256q0 106 -75 181t-181 75t-181 -75t-75 -181v-256q0 -26 -19 -45t-45 -19t-45 19t-19 45v256q0 159 112.5 271.5t271.5 112.5t271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="2048" d="M1920 768q53 0 90.5 -37.5t37.5 -90.5t-37.5 -90.5t-90.5 -37.5h-15l-115 -662q-8 -46 -44 -76t-82 -30h-1280q-46 0 -82 30t-44 76l-115 662h-15q-53 0 -90.5 37.5t-37.5 90.5t37.5 90.5t90.5 37.5h1792zM485 -32q26 2 43.5 22.5t15.5 46.5l-32 416q-2 26 -22.5 43.5 t-46.5 15.5t-43.5 -22.5t-15.5 -46.5l32 -416q2 -25 20.5 -42t43.5 -17h5zM896 32v416q0 26 -19 45t-45 19t-45 -19t-19 -45v-416q0 -26 19 -45t45 -19t45 19t19 45zM1280 32v416q0 26 -19 45t-45 19t-45 -19t-19 -45v-416q0 -26 19 -45t45 -19t45 19t19 45zM1632 27l32 416 q2 26 -15.5 46.5t-43.5 22.5t-46.5 -15.5t-22.5 -43.5l-32 -416q-2 -26 15.5 -46.5t43.5 -22.5h5q25 0 43.5 17t20.5 42zM476 1244l-93 -412h-132l101 441q19 88 89 143.5t160 55.5h167q0 26 19 45t45 19h384q26 0 45 -19t19 -45h167q90 0 160 -55.5t89 -143.5l101 -441 h-132l-93 412q-11 44 -45.5 72t-79.5 28h-167q0 -26 -19 -45t-45 -19h-384q-26 0 -45 19t-19 45h-167q-45 0 -79.5 -28t-45.5 -72z" /> +<glyph unicode="" horiz-adv-x="1792" d="M991 512l64 256h-254l-64 -256h254zM1759 1016l-56 -224q-7 -24 -31 -24h-327l-64 -256h311q15 0 25 -12q10 -14 6 -28l-56 -224q-5 -24 -31 -24h-327l-81 -328q-7 -24 -31 -24h-224q-16 0 -26 12q-9 12 -6 28l78 312h-254l-81 -328q-7 -24 -31 -24h-225q-15 0 -25 12 q-9 12 -6 28l78 312h-311q-15 0 -25 12q-9 12 -6 28l56 224q7 24 31 24h327l64 256h-311q-15 0 -25 12q-10 14 -6 28l56 224q5 24 31 24h327l81 328q7 24 32 24h224q15 0 25 -12q9 -12 6 -28l-78 -312h254l81 328q7 24 32 24h224q15 0 25 -12q9 -12 6 -28l-78 -312h311 q15 0 25 -12q9 -12 6 -28z" /> +<glyph unicode="" d="M841 483l148 -148l-149 -149zM840 1094l149 -149l-148 -148zM710 -130l464 464l-306 306l306 306l-464 464v-611l-255 255l-93 -93l320 -321l-320 -321l93 -93l255 255v-611zM1429 640q0 -209 -32 -365.5t-87.5 -257t-140.5 -162.5t-181.5 -86.5t-219.5 -24.5 t-219.5 24.5t-181.5 86.5t-140.5 162.5t-87.5 257t-32 365.5t32 365.5t87.5 257t140.5 162.5t181.5 86.5t219.5 24.5t219.5 -24.5t181.5 -86.5t140.5 -162.5t87.5 -257t32 -365.5z" /> +<glyph unicode="" horiz-adv-x="1024" d="M596 113l173 172l-173 172v-344zM596 823l173 172l-173 172v-344zM628 640l356 -356l-539 -540v711l-297 -296l-108 108l372 373l-372 373l108 108l297 -296v711l539 -540z" /> +<glyph unicode="" d="M1280 256q0 52 -38 90t-90 38t-90 -38t-38 -90t38 -90t90 -38t90 38t38 90zM512 1024q0 52 -38 90t-90 38t-90 -38t-38 -90t38 -90t90 -38t90 38t38 90zM1536 256q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5t271.5 -112.5 t112.5 -271.5zM1440 1344q0 -20 -13 -38l-1056 -1408q-19 -26 -51 -26h-160q-26 0 -45 19t-19 45q0 20 13 38l1056 1408q19 26 51 26h160q26 0 45 -19t19 -45zM768 1024q0 -159 -112.5 -271.5t-271.5 -112.5t-271.5 112.5t-112.5 271.5t112.5 271.5t271.5 112.5 t271.5 -112.5t112.5 -271.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M104 830l792 -1015l-868 630q-18 13 -25 34.5t0 42.5l101 308v0zM566 830h660l-330 -1015v0zM368 1442l198 -612h-462l198 612q8 23 33 23t33 -23zM1688 830l101 -308q7 -21 0 -42.5t-25 -34.5l-868 -630l792 1015v0zM1688 830h-462l198 612q8 23 33 23t33 -23z" /> +<glyph unicode="" horiz-adv-x="1792" d="M384 704h160v224h-160v-224zM1221 372v92q-104 -36 -243 -38q-135 -1 -259.5 46.5t-220.5 122.5l1 -96q88 -80 212 -128.5t272 -47.5q129 0 238 49zM640 704h640v224h-640v-224zM1792 736q0 -187 -99 -352q89 -102 89 -229q0 -157 -129.5 -268t-313.5 -111 q-122 0 -225 52.5t-161 140.5q-19 -1 -57 -1t-57 1q-58 -88 -161 -140.5t-225 -52.5q-184 0 -313.5 111t-129.5 268q0 127 89 229q-99 165 -99 352q0 209 120 385.5t326.5 279.5t449.5 103t449.5 -103t326.5 -279.5t120 -385.5z" /> +<glyph unicode="" d="M515 625v-128h-252v128h252zM515 880v-127h-252v127h252zM1273 369v-128h-341v128h341zM1273 625v-128h-672v128h672zM1273 880v-127h-672v127h672zM1408 20v1240q0 8 -6 14t-14 6h-32l-378 -256l-210 171l-210 -171l-378 256h-32q-8 0 -14 -6t-6 -14v-1240q0 -8 6 -14 t14 -6h1240q8 0 14 6t6 14zM553 1130l185 150h-406zM983 1130l221 150h-406zM1536 1260v-1240q0 -62 -43 -105t-105 -43h-1240q-62 0 -105 43t-43 105v1240q0 62 43 105t105 43h1240q62 0 105 -43t43 -105z" /> +<glyph unicode="" horiz-adv-x="1792" d="M896 720q-104 196 -160 278q-139 202 -347 318q-34 19 -70 36q-89 40 -94 32t34 -38l39 -31q62 -43 112.5 -93.5t94.5 -116.5t70.5 -113t70.5 -131q9 -17 13 -25q44 -84 84 -153t98 -154t115.5 -150t131 -123.5t148.5 -90.5q153 -66 154 -60q1 3 -49 37q-53 36 -81 57 q-77 58 -179 211t-185 310zM549 177q-76 60 -132.5 125t-98 143.5t-71 154.5t-58.5 186t-52 209t-60.5 252t-76.5 289q273 0 497.5 -36t379 -92t271 -144.5t185.5 -172.5t110 -198.5t56 -199.5t12.5 -198.5t-9.5 -173t-20 -143.5t-13 -107l323 -327h-104l-281 285 q-22 -2 -91.5 -14t-121.5 -19t-138 -6t-160.5 17t-167.5 59t-179 111z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1374 879q-6 26 -28.5 39.5t-48.5 7.5q-261 -62 -401 -62t-401 62q-26 6 -48.5 -7.5t-28.5 -39.5t7.5 -48.5t39.5 -28.5q194 -46 303 -58q-2 -158 -15.5 -269t-26.5 -155.5t-41 -115.5l-9 -21q-10 -25 1 -49t36 -34q9 -4 23 -4q44 0 60 41l8 20q54 139 71 259h42 q17 -120 71 -259l8 -20q16 -41 60 -41q14 0 23 4q25 10 36 34t1 49l-9 21q-28 71 -41 115.5t-26.5 155.5t-15.5 269q109 12 303 58q26 6 39.5 28.5t7.5 48.5zM1024 1024q0 53 -37.5 90.5t-90.5 37.5t-90.5 -37.5t-37.5 -90.5t37.5 -90.5t90.5 -37.5t90.5 37.5t37.5 90.5z M1600 640q0 -143 -55.5 -273.5t-150 -225t-225 -150t-273.5 -55.5t-273.5 55.5t-225 150t-150 225t-55.5 273.5t55.5 273.5t150 225t225 150t273.5 55.5t273.5 -55.5t225 -150t150 -225t55.5 -273.5zM896 1408q-156 0 -298 -61t-245 -164t-164 -245t-61 -298t61 -298 t164 -245t245 -164t298 -61t298 61t245 164t164 245t61 298t-61 298t-164 245t-245 164t-298 61zM1792 640q0 -182 -71 -348t-191 -286t-286 -191t-348 -71t-348 71t-286 191t-191 286t-71 348t71 348t191 286t286 191t348 71t348 -71t286 -191t191 -286t71 -348z" /> +<glyph unicode="" d="M1438 723q34 -35 29 -82l-44 -551q-4 -42 -34.5 -70t-71.5 -28q-6 0 -9 1q-44 3 -72.5 36.5t-25.5 77.5l35 429l-143 -8q55 -113 55 -240q0 -216 -148 -372l-137 137q91 101 91 235q0 145 -102.5 248t-247.5 103q-134 0 -236 -92l-137 138q120 114 284 141l264 300 l-149 87l-181 -161q-33 -30 -77 -27.5t-73 35.5t-26.5 77t34.5 73l239 213q26 23 60 26.5t64 -14.5l488 -283q36 -21 48 -68q17 -67 -26 -117l-205 -232l371 20q49 3 83 -32zM1240 1180q-74 0 -126 52t-52 126t52 126t126 52t126.5 -52t52.5 -126t-52.5 -126t-126.5 -52z M613 -62q106 0 196 61l139 -139q-146 -116 -335 -116q-148 0 -273.5 73t-198.5 198t-73 273q0 188 116 336l139 -139q-60 -88 -60 -197q0 -145 102.5 -247.5t247.5 -102.5z" /> +<glyph unicode="" d="M880 336v-160q0 -14 -9 -23t-23 -9h-160q-14 0 -23 9t-9 23v160q0 14 9 23t23 9h160q14 0 23 -9t9 -23zM1136 832q0 -50 -15 -90t-45.5 -69t-52 -44t-59.5 -36q-32 -18 -46.5 -28t-26 -24t-11.5 -29v-32q0 -14 -9 -23t-23 -9h-160q-14 0 -23 9t-9 23v68q0 35 10.5 64.5 t24 47.5t39 35.5t41 25.5t44.5 21q53 25 75 43t22 49q0 42 -43.5 71.5t-95.5 29.5q-56 0 -95 -27q-29 -20 -80 -83q-9 -12 -25 -12q-11 0 -19 6l-108 82q-10 7 -12 20t5 23q122 192 349 192q129 0 238.5 -89.5t109.5 -214.5zM768 1280q-130 0 -248.5 -51t-204 -136.5 t-136.5 -204t-51 -248.5t51 -248.5t136.5 -204t204 -136.5t248.5 -51t248.5 51t204 136.5t136.5 204t51 248.5t-51 248.5t-136.5 204t-204 136.5t-248.5 51zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5 t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M366 1225q-64 0 -110 45.5t-46 110.5q0 64 46 109.5t110 45.5t109.5 -45.5t45.5 -109.5q0 -65 -45.5 -110.5t-109.5 -45.5zM917 583q0 -50 -30 -67.5t-63.5 -6.5t-47.5 34l-367 438q-7 12 -14 15.5t-11 1.5l-3 -3q-7 -8 4 -21l122 -139l1 -354l-161 -457 q-67 -192 -92 -234q-16 -26 -28 -32q-50 -26 -103 -1q-29 13 -41.5 43t-9.5 57q2 17 197 618l5 416l-85 -164l35 -222q4 -24 -1 -42t-14 -27.5t-19 -16t-17 -7.5l-7 -2q-19 -3 -34.5 3t-24 16t-14 22t-7.5 19.5t-2 9.5l-46 299l211 381q23 34 113 34q75 0 107 -40l424 -521 q7 -5 14 -17l3 -3l-1 -1q7 -13 7 -29zM514 433q43 -113 88.5 -225t69.5 -168l24 -55q36 -93 42 -125q11 -70 -36 -97q-35 -22 -66 -16t-51 22t-29 35h-1q-6 16 -8 25l-124 351zM1338 -159q31 -49 31 -57q0 -5 -3 -7q-9 -5 -14.5 0.5t-15.5 26t-16 30.5q-114 172 -423 661 q3 -1 7 1t7 4l3 2q11 9 11 17z" /> +<glyph unicode="" horiz-adv-x="2304" d="M504 542h171l-1 265zM1530 641q0 87 -50.5 140t-146.5 53h-54v-388h52q91 0 145 57t54 138zM956 1018l1 -756q0 -14 -9.5 -24t-23.5 -10h-216q-14 0 -23.5 10t-9.5 24v62h-291l-55 -81q-10 -15 -28 -15h-267q-21 0 -30.5 18t3.5 35l556 757q9 14 27 14h332q14 0 24 -10 t10 -24zM1783 641q0 -193 -125.5 -303t-324.5 -110h-270q-14 0 -24 10t-10 24v756q0 14 10 24t24 10h268q200 0 326 -109t126 -302zM1939 640q0 -11 -0.5 -29t-8 -71.5t-21.5 -102t-44.5 -108t-73.5 -102.5h-51q38 45 66.5 104.5t41.5 112t21 98t9 72.5l1 27q0 8 -0.5 22.5 t-7.5 60t-20 91.5t-41 111.5t-66 124.5h43q41 -47 72 -107t45.5 -111.5t23 -96t10.5 -70.5zM2123 640q0 -11 -0.5 -29t-8 -71.5t-21.5 -102t-45 -108t-74 -102.5h-51q38 45 66.5 104.5t41.5 112t21 98t9 72.5l1 27q0 8 -0.5 22.5t-7.5 60t-19.5 91.5t-40.5 111.5t-66 124.5 h43q41 -47 72 -107t45.5 -111.5t23 -96t10.5 -70.5zM2304 640q0 -11 -0.5 -29t-8 -71.5t-21.5 -102t-44.5 -108t-73.5 -102.5h-51q38 45 66 104.5t41 112t21 98t9 72.5l1 27q0 8 -0.5 22.5t-7.5 60t-19.5 91.5t-40.5 111.5t-66 124.5h43q41 -47 72 -107t45.5 -111.5t23 -96 t9.5 -70.5z" /> +<glyph unicode="" horiz-adv-x="1408" d="M617 -153q0 11 -13 58t-31 107t-20 69q-1 4 -5 26.5t-8.5 36t-13.5 21.5q-15 14 -51 14q-23 0 -70 -5.5t-71 -5.5q-34 0 -47 11q-6 5 -11 15.5t-7.5 20t-6.5 24t-5 18.5q-37 128 -37 255t37 255q1 4 5 18.5t6.5 24t7.5 20t11 15.5q13 11 47 11q24 0 71 -5.5t70 -5.5 q36 0 51 14q9 8 13.5 21.5t8.5 36t5 26.5q2 9 20 69t31 107t13 58q0 22 -43.5 52.5t-75.5 42.5q-20 8 -45 8q-34 0 -98 -18q-57 -17 -96.5 -40.5t-71 -66t-46 -70t-45.5 -94.5q-6 -12 -9 -19q-49 -107 -68 -216t-19 -244t19 -244t68 -216q56 -122 83 -161q63 -91 179 -127 l6 -2q64 -18 98 -18q25 0 45 8q32 12 75.5 42.5t43.5 52.5zM776 760q-26 0 -45 19t-19 45.5t19 45.5q37 37 37 90q0 52 -37 91q-19 19 -19 45t19 45t45 19t45 -19q75 -75 75 -181t-75 -181q-21 -19 -45 -19zM957 579q-27 0 -45 19q-19 19 -19 45t19 45q112 114 112 272 t-112 272q-19 19 -19 45t19 45t45 19t45 -19q150 -150 150 -362t-150 -362q-18 -19 -45 -19zM1138 398q-27 0 -45 19q-19 19 -19 45t19 45q90 91 138.5 208t48.5 245t-48.5 245t-138.5 208q-19 19 -19 45t19 45t45 19t45 -19q109 -109 167 -249t58 -294t-58 -294t-167 -249 q-18 -19 -45 -19z" /> +<glyph unicode="" horiz-adv-x="2176" d="M192 352q-66 0 -113 -47t-47 -113t47 -113t113 -47t113 47t47 113t-47 113t-113 47zM704 352q-66 0 -113 -47t-47 -113t47 -113t113 -47t113 47t47 113t-47 113t-113 47zM704 864q-66 0 -113 -47t-47 -113t47 -113t113 -47t113 47t47 113t-47 113t-113 47zM1472 352 q-66 0 -113 -47t-47 -113t47 -113t113 -47t113 47t47 113t-47 113t-113 47zM1984 352q-66 0 -113 -47t-47 -113t47 -113t113 -47t113 47t47 113t-47 113t-113 47zM1472 864q-66 0 -113 -47t-47 -113t47 -113t113 -47t113 47t47 113t-47 113t-113 47zM1984 864 q-66 0 -113 -47t-47 -113t47 -113t113 -47t113 47t47 113t-47 113t-113 47zM1984 1376q-66 0 -113 -47t-47 -113t47 -113t113 -47t113 47t47 113t-47 113t-113 47zM384 192q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM896 192q0 -80 -56 -136 t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM384 704q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM896 704q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM384 1216q0 -80 -56 -136t-136 -56 t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1664 192q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM896 1216q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM2176 192q0 -80 -56 -136t-136 -56t-136 56 t-56 136t56 136t136 56t136 -56t56 -136zM1664 704q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM2176 704q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136zM1664 1216q0 -80 -56 -136t-136 -56t-136 56t-56 136 t56 136t136 56t136 -56t56 -136zM2176 1216q0 -80 -56 -136t-136 -56t-136 56t-56 136t56 136t136 56t136 -56t56 -136z" /> +<glyph unicode="" horiz-adv-x="1792" d="M128 -192q0 -26 -19 -45t-45 -19t-45 19t-19 45t19 45t45 19t45 -19t19 -45zM320 0q0 -26 -19 -45t-45 -19t-45 19t-19 45t19 45t45 19t45 -19t19 -45zM365 365l256 -256l-90 -90l-256 256zM704 384q0 -26 -19 -45t-45 -19t-45 19t-19 45t19 45t45 19t45 -19t19 -45z M1411 704q0 -59 -11.5 -108.5t-37.5 -93.5t-44 -67.5t-53 -64.5q-31 -35 -45.5 -54t-33.5 -50t-26.5 -64t-7.5 -74q0 -159 -112.5 -271.5t-271.5 -112.5q-26 0 -45 19t-19 45t19 45t45 19q106 0 181 75t75 181q0 57 11.5 105.5t37 91t43.5 66.5t52 63q40 46 59.5 72 t37.5 74.5t18 103.5q0 185 -131.5 316.5t-316.5 131.5t-316.5 -131.5t-131.5 -316.5q0 -26 -19 -45t-45 -19t-45 19t-19 45q0 117 45.5 223.5t123 184t184 123t223.5 45.5t223.5 -45.5t184 -123t123 -184t45.5 -223.5zM896 576q0 -26 -19 -45t-45 -19t-45 19t-19 45t19 45 t45 19t45 -19t19 -45zM1184 704q0 -26 -19 -45t-45 -19t-45 19t-19 45q0 93 -65.5 158.5t-158.5 65.5q-92 0 -158 -65.5t-66 -158.5q0 -26 -19 -45t-45 -19t-45 19t-19 45q0 146 103 249t249 103t249 -103t103 -249zM1578 993q10 -25 -1 -49t-36 -34q-9 -4 -23 -4 q-19 0 -35.5 11t-23.5 30q-68 178 -224 295q-21 16 -25 42t12 47q17 21 43 25t47 -12q183 -137 266 -351zM1788 1074q9 -25 -1.5 -49t-35.5 -34q-11 -4 -23 -4q-44 0 -60 41q-92 238 -297 393q-22 16 -25.5 42t12.5 47q16 22 42 25.5t47 -12.5q235 -175 341 -449z" /> +<glyph unicode="" horiz-adv-x="2304" d="M1032 576q-59 2 -84 55q-17 34 -48 53.5t-68 19.5q-53 0 -90.5 -37.5t-37.5 -90.5q0 -56 36 -89l10 -8q34 -31 82 -31q37 0 68 19.5t48 53.5q25 53 84 55zM1600 704q0 56 -36 89l-10 8q-34 31 -82 31q-37 0 -68 -19.5t-48 -53.5q-25 -53 -84 -55q59 -2 84 -55 q17 -34 48 -53.5t68 -19.5q53 0 90.5 37.5t37.5 90.5zM1174 925q-17 -35 -55 -48t-73 4q-62 31 -134 31q-51 0 -99 -17q3 0 9.5 0.5t9.5 0.5q92 0 170.5 -50t118.5 -133q17 -36 3.5 -73.5t-49.5 -54.5q-18 -9 -39 -9q21 0 39 -9q36 -17 49.5 -54.5t-3.5 -73.5 q-40 -83 -118.5 -133t-170.5 -50h-6q-16 2 -44 4l-290 27l-239 -120q-14 -7 -29 -7q-40 0 -57 35l-160 320q-11 23 -4 47.5t29 37.5l209 119l148 267q17 155 91.5 291.5t195.5 236.5q31 25 70.5 21.5t64.5 -34.5t21.5 -70t-34.5 -65q-70 -59 -117 -128q123 84 267 101 q40 5 71.5 -19t35.5 -64q5 -40 -19 -71.5t-64 -35.5q-84 -10 -159 -55q46 10 99 10q115 0 218 -50q36 -18 49 -55.5t-5 -73.5zM2137 1085l160 -320q11 -23 4 -47.5t-29 -37.5l-209 -119l-148 -267q-17 -155 -91.5 -291.5t-195.5 -236.5q-26 -22 -61 -22q-45 0 -74 35 q-25 31 -21.5 70t34.5 65q70 59 117 128q-123 -84 -267 -101q-4 -1 -12 -1q-36 0 -63.5 24t-31.5 60q-5 40 19 71.5t64 35.5q84 10 159 55q-46 -10 -99 -10q-115 0 -218 50q-36 18 -49 55.5t5 73.5q17 35 55 48t73 -4q62 -31 134 -31q51 0 99 17q-3 0 -9.5 -0.5t-9.5 -0.5 q-92 0 -170.5 50t-118.5 133q-17 36 -3.5 73.5t49.5 54.5q18 9 39 9q-21 0 -39 9q-36 17 -49.5 54.5t3.5 73.5q40 83 118.5 133t170.5 50h6h1q14 -2 42 -4l291 -27l239 120q14 7 29 7q40 0 57 -35z" /> +<glyph unicode="" horiz-adv-x="1792" d="M1056 704q0 -26 19 -45t45 -19t45 19t19 45q0 146 -103 249t-249 103t-249 -103t-103 -249q0 -26 19 -45t45 -19t45 19t19 45q0 93 66 158.5t158 65.5t158 -65.5t66 -158.5zM835 1280q-117 0 -223.5 -45.5t-184 -123t-123 -184t-45.5 -223.5q0 -26 19 -45t45 -19t45 19 t19 45q0 185 131.5 316.5t316.5 131.5t316.5 -131.5t131.5 -316.5q0 -55 -18 -103.5t-37.5 -74.5t-59.5 -72q-34 -39 -52 -63t-43.5 -66.5t-37 -91t-11.5 -105.5q0 -106 -75 -181t-181 -75q-26 0 -45 -19t-19 -45t19 -45t45 -19q159 0 271.5 112.5t112.5 271.5q0 41 7.5 74 t26.5 64t33.5 50t45.5 54q35 41 53 64.5t44 67.5t37.5 93.5t11.5 108.5q0 117 -45.5 223.5t-123 184t-184 123t-223.5 45.5zM591 561l226 -226l-579 -579q-12 -12 -29 -12t-29 12l-168 168q-12 12 -12 29t12 29zM1612 1524l168 -168q12 -12 12 -29t-12 -30l-233 -233 l-26 -25l-71 -71q-66 153 -195 258l91 91l207 207q13 12 30 12t29 -12z" /> +<glyph unicode="" d="M866 1021q0 -27 -13 -94q-11 -50 -31.5 -150t-30.5 -150q-2 -11 -4.5 -12.5t-13.5 -2.5q-20 -2 -31 -2q-58 0 -84 49.5t-26 113.5q0 88 35 174t103 124q28 14 51 14q28 0 36.5 -16.5t8.5 -47.5zM1352 597q0 14 -39 75.5t-52 66.5q-21 8 -34 8q-91 0 -226 -77l-2 2 q3 22 27.5 135t24.5 178q0 233 -242 233q-24 0 -68 -6q-94 -17 -168.5 -89.5t-111.5 -166.5t-37 -189q0 -146 80.5 -225t227.5 -79q25 0 25 -3t-1 -5q-4 -34 -26 -117q-14 -52 -51.5 -101t-82.5 -49q-42 0 -42 47q0 24 10.5 47.5t25 39.5t29.5 28.5t26 20t11 8.5q0 3 -7 10 q-24 22 -58.5 36.5t-65.5 14.5q-35 0 -63.5 -34t-41 -75t-12.5 -75q0 -88 51.5 -142t138.5 -54q82 0 155 53t117.5 126t65.5 153q6 22 15.5 66.5t14.5 66.5q3 12 14 18q118 60 227 60q48 0 127 -18q1 -1 4 -1q5 0 9.5 4.5t4.5 8.5zM1536 1120v-960q0 -119 -84.5 -203.5 t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="1535" d="M744 1231q0 24 -2 38.5t-8.5 30t-21 23t-37.5 7.5q-39 0 -78 -23q-105 -58 -159 -190.5t-54 -269.5q0 -44 8.5 -85.5t26.5 -80.5t52.5 -62.5t81.5 -23.5q4 0 18 -0.5t20 0t16 3t15 8.5t7 16q16 77 48 231.5t48 231.5q19 91 19 146zM1498 575q0 -7 -7.5 -13.5t-15.5 -6.5 l-6 1q-22 3 -62 11t-72 12.5t-63 4.5q-167 0 -351 -93q-15 -8 -21 -27q-10 -36 -24.5 -105.5t-22.5 -100.5q-23 -91 -70 -179.5t-112.5 -164.5t-154.5 -123t-185 -47q-135 0 -214.5 83.5t-79.5 219.5q0 53 19.5 117t63 116.5t97.5 52.5q38 0 120 -33.5t83 -61.5 q0 -1 -16.5 -12.5t-39.5 -31t-46 -44.5t-39 -61t-16 -74q0 -33 16.5 -53t48.5 -20q45 0 85 31.5t66.5 78t48 105.5t32.5 107t16 90v9q0 2 -3.5 3.5t-8.5 1.5h-10t-10 -0.5t-6 -0.5q-227 0 -352 122.5t-125 348.5q0 108 34.5 221t96 210t156 167.5t204.5 89.5q52 9 106 9 q374 0 374 -360q0 -98 -38 -273t-43 -211l3 -3q101 57 182.5 88t167.5 31q22 0 53 -13q19 -7 80 -102.5t61 -116.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M831 863q32 0 59 -18l222 -148q61 -40 110 -97l146 -170q40 -46 29 -106l-72 -413q-6 -32 -29.5 -53.5t-55.5 -25.5l-527 -56l-352 -32h-9q-39 0 -67.5 28t-28.5 68q0 37 27 64t65 32l260 32h-448q-41 0 -69.5 30t-26.5 71q2 39 32 65t69 26l442 1l-521 64q-41 5 -66 37 t-19 73q6 35 34.5 57.5t65.5 22.5h10l481 -60l-351 94q-38 10 -62 41.5t-18 68.5q6 36 33 58.5t62 22.5q6 0 20 -2l448 -96l217 -37q1 0 3 -0.5t3 -0.5q23 0 30.5 23t-12.5 36l-186 125q-35 23 -42 63.5t18 73.5q27 38 76 38zM761 661l186 -125l-218 37l-5 2l-36 38 l-238 262q-1 1 -2.5 3.5t-2.5 3.5q-24 31 -18.5 70t37.5 64q31 23 68 17.5t64 -33.5l142 -147l-4 -4t-5 -4q-32 -45 -23 -99t55 -85zM1648 1115l15 -266q4 -73 -11 -147l-48 -219q-12 -59 -67 -87l-106 -54q2 62 -39 109l-146 170q-53 61 -117 103l-222 148q-34 23 -76 23 q-51 0 -88 -37l-235 312q-25 33 -18 73.5t41 63.5q33 22 71.5 14t62.5 -40l266 -352l-262 455q-21 35 -10.5 75t47.5 59q35 18 72.5 6t57.5 -46l241 -420l-136 337q-15 35 -4.5 74t44.5 56q37 19 76 6t56 -51l193 -415l101 -196q8 -15 23 -17.5t27 7.5t11 26l-12 224 q-2 41 26 71t69 31q39 0 67 -28.5t30 -67.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M335 180q-2 0 -6 2q-86 57 -168.5 145t-139.5 180q-21 30 -21 69q0 9 2 19t4 18t7 18t8.5 16t10.5 17t10 15t12 15.5t11 14.5q184 251 452 365q-110 198 -110 211q0 19 17 29q116 64 128 64q18 0 28 -16l124 -229q92 19 192 19q266 0 497.5 -137.5t378.5 -369.5 q20 -31 20 -69t-20 -69q-91 -142 -218.5 -253.5t-278.5 -175.5q110 -198 110 -211q0 -20 -17 -29q-116 -64 -127 -64q-19 0 -29 16l-124 229l-64 119l-444 820l7 7q-58 -24 -99 -47q3 -5 127 -234t243 -449t119 -223q0 -7 -9 -9q-13 -3 -72 -3q-57 0 -60 7l-456 841 q-39 -28 -82 -68q24 -43 214 -393.5t190 -354.5q0 -10 -11 -10q-14 0 -82.5 22t-72.5 28l-106 197l-224 413q-44 -53 -78 -106q2 -3 18 -25t23 -34l176 -327q0 -10 -10 -10zM1165 282l49 -91q273 111 450 385q-180 277 -459 389q67 -64 103 -148.5t36 -176.5 q0 -106 -47 -200.5t-132 -157.5zM848 896q0 -20 14 -34t34 -14q86 0 147 -61t61 -147q0 -20 14 -34t34 -14t34 14t14 34q0 126 -89 215t-215 89q-20 0 -34 -14t-14 -34zM1214 961l-9 4l7 -7z" /> +<glyph unicode="" horiz-adv-x="1280" d="M1050 430q0 -215 -147 -374q-148 -161 -378 -161q-232 0 -378 161q-147 159 -147 374q0 147 68 270.5t189 196.5t268 73q96 0 182 -31q-32 -62 -39 -126q-66 28 -143 28q-167 0 -280.5 -123t-113.5 -291q0 -170 112.5 -288.5t281.5 -118.5t281 118.5t112 288.5 q0 89 -32 166q66 13 123 49q41 -98 41 -212zM846 619q0 -192 -79.5 -345t-238.5 -253l-14 -1q-29 0 -62 5q83 32 146.5 102.5t99.5 154.5t58.5 189t30 192.5t7.5 178.5q0 69 -3 103q55 -160 55 -326zM791 947v-2q-73 214 -206 440q88 -59 142.5 -186.5t63.5 -251.5z M1035 744q-83 0 -160 75q218 120 290 247q19 37 21 56q-42 -94 -139.5 -166.5t-204.5 -97.5q-35 54 -35 113q0 37 17 79t43 68q46 44 157 74q59 16 106 58.5t74 100.5q74 -105 74 -253q0 -109 -24 -170q-32 -77 -88.5 -130.5t-130.5 -53.5z" /> +<glyph unicode="" d="M1050 495q0 78 -28 147q-41 -25 -85 -34q22 -50 22 -114q0 -117 -77 -198.5t-193 -81.5t-193.5 81.5t-77.5 198.5q0 115 78 199.5t193 84.5q53 0 98 -19q4 43 27 87q-60 21 -125 21q-154 0 -257.5 -108.5t-103.5 -263.5t103.5 -261t257.5 -106t257.5 106.5t103.5 260.5z M872 850q2 -24 2 -71q0 -63 -5 -123t-20.5 -132.5t-40.5 -130t-68.5 -106t-100.5 -70.5q21 -3 42 -3h10q219 139 219 411q0 116 -38 225zM872 850q-4 80 -44 171.5t-98 130.5q92 -156 142 -302zM1207 955q0 102 -51 174q-41 -86 -124 -109q-69 -19 -109 -53.5t-40 -99.5 q0 -40 24 -77q74 17 140.5 67t95.5 115q-4 -52 -74.5 -111.5t-138.5 -97.5q52 -52 110 -52q51 0 90 37t60 90q17 43 17 117zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960q119 0 203.5 -84.5 t84.5 -203.5z" /> +<glyph unicode="" d="M1279 388q0 22 -22 27q-67 15 -118 59t-80 108q-7 19 -7 25q0 15 19.5 26t43 17t43 20.5t19.5 36.5q0 19 -18.5 31.5t-38.5 12.5q-12 0 -32 -8t-31 -8q-4 0 -12 2q5 95 5 114q0 79 -17 114q-36 78 -103 121.5t-152 43.5q-199 0 -275 -165q-17 -35 -17 -114q0 -19 5 -114 q-4 -2 -14 -2q-12 0 -32 7.5t-30 7.5q-21 0 -38.5 -12t-17.5 -32q0 -21 19.5 -35.5t43 -20.5t43 -17t19.5 -26q0 -6 -7 -25q-64 -138 -198 -167q-22 -5 -22 -27q0 -46 137 -68q2 -5 6 -26t11.5 -30.5t23.5 -9.5q12 0 37.5 4.5t39.5 4.5q35 0 67 -15t54 -32.5t57.5 -32.5 t76.5 -15q43 0 79 15t57.5 32.5t53.5 32.5t67 15q14 0 39.5 -4t38.5 -4q16 0 23 10t11 30t6 25q137 22 137 68zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5 t103 -385.5z" /> +<glyph unicode="" horiz-adv-x="1664" d="M848 1408q134 1 240.5 -68.5t163.5 -192.5q27 -58 27 -179q0 -47 -9 -191q14 -7 28 -7q18 0 51 13.5t51 13.5q29 0 56 -18t27 -46q0 -32 -31.5 -54t-69 -31.5t-69 -29t-31.5 -47.5q0 -15 12 -43q37 -82 102.5 -150t144.5 -101q28 -12 80 -23q28 -6 28 -35 q0 -70 -219 -103q-7 -11 -11 -39t-14 -46.5t-33 -18.5q-20 0 -62 6.5t-64 6.5q-37 0 -62 -5q-32 -5 -63 -22.5t-58 -38t-58 -40.5t-76 -33.5t-99 -13.5q-52 0 -96.5 13.5t-75 33.5t-57.5 40.5t-58 38t-62 22.5q-26 5 -63 5q-24 0 -65.5 -7.5t-58.5 -7.5q-25 0 -35 18.5 t-14 47.5t-11 40q-219 33 -219 103q0 29 28 35q52 11 80 23q78 32 144.5 101t102.5 150q12 28 12 43q0 28 -31.5 47.5t-69.5 29.5t-69.5 31.5t-31.5 52.5q0 27 26 45.5t55 18.5q15 0 48 -13t53 -13q18 0 32 7q-9 142 -9 190q0 122 27 180q64 137 172 198t264 63z" /> +<glyph unicode="" d="M1280 388q0 22 -22 27q-67 14 -118 58t-80 109q-7 14 -7 25q0 15 19.5 26t42.5 17t42.5 20.5t19.5 36.5q0 19 -18.5 31.5t-38.5 12.5q-11 0 -31 -8t-32 -8q-4 0 -12 2q5 63 5 115q0 78 -17 114q-36 78 -102.5 121.5t-152.5 43.5q-198 0 -275 -165q-18 -38 -18 -115 q0 -38 6 -114q-10 -2 -15 -2q-11 0 -31.5 8t-30.5 8q-20 0 -37.5 -12.5t-17.5 -32.5q0 -21 19.5 -35.5t42.5 -20.5t42.5 -17t19.5 -26q0 -11 -7 -25q-64 -138 -198 -167q-22 -5 -22 -27q0 -47 138 -69q2 -5 6 -26t11 -30.5t23 -9.5q13 0 38.5 5t38.5 5q35 0 67.5 -15 t54.5 -32.5t57.5 -32.5t76.5 -15q43 0 79 15t57.5 32.5t54 32.5t67.5 15q13 0 39 -4.5t39 -4.5q15 0 22.5 9.5t11.5 31t5 24.5q138 22 138 69zM1536 1120v-960q0 -119 -84.5 -203.5t-203.5 -84.5h-960q-119 0 -203.5 84.5t-84.5 203.5v960q0 119 84.5 203.5t203.5 84.5h960 q119 0 203.5 -84.5t84.5 -203.5z" /> +<glyph unicode="" horiz-adv-x="2304" d="M2304 1536q-69 -46 -125 -92t-89 -81t-59.5 -71.5t-37.5 -57.5t-22 -44.5t-14 -29.5q-10 -18 -35.5 -136.5t-48.5 -164.5q-15 -29 -50 -60.5t-67.5 -50.5t-72.5 -41t-48 -28q-47 -31 -151 -231q-341 14 -630 -158q-92 -53 -303 -179q47 16 86 31t55 22l15 7 q71 27 163 64.5t133.5 53.5t108 34.5t142.5 31.5q186 31 465 -7q1 0 10 -3q11 -6 14 -17t-3 -22l-194 -345q-15 -29 -47 -22q-128 24 -354 24q-146 0 -402 -44.5t-392 -46.5q-82 -1 -149 13t-107 37t-61 40t-33 34l-1 1v2q0 6 6 6q138 0 371 55q192 366 374.5 524t383.5 158 q5 0 14.5 -0.5t38 -5t55 -12t61.5 -24.5t63 -39.5t54 -59t40 -82.5l102 177q2 4 21 42.5t44.5 86.5t61 109.5t84 133.5t100.5 137q66 82 128 141.5t121.5 96.5t92.5 53.5t88 39.5z" /> +<glyph unicode="" d="M1322 640q0 -45 -5 -76l-236 14l224 -78q-19 -73 -58 -141l-214 103l177 -158q-44 -61 -107 -108l-157 178l103 -215q-61 -37 -140 -59l-79 228l14 -240q-38 -6 -76 -6t-76 6l14 238l-78 -226q-74 19 -140 59l103 215l-157 -178q-59 43 -108 108l178 158l-214 -104 q-39 69 -58 141l224 79l-237 -14q-5 42 -5 76q0 35 5 77l238 -14l-225 79q19 73 58 140l214 -104l-177 159q46 61 107 108l158 -178l-103 215q67 39 140 58l77 -224l-13 236q36 6 75 6q38 0 76 -6l-14 -237l78 225q74 -19 140 -59l-103 -214l158 178q61 -47 107 -108 l-177 -159l213 104q37 -62 58 -141l-224 -78l237 14q5 -31 5 -77zM1352 640q0 160 -78.5 295.5t-213 214t-292.5 78.5q-119 0 -227 -46.5t-186.5 -125t-124.5 -187.5t-46 -229q0 -119 46 -228t124.5 -187.5t186.5 -125t227 -46.5q158 0 292.5 78.5t213 214t78.5 294.5z M1425 1023v-766l-657 -383l-657 383v766l657 383zM768 -183l708 412v823l-708 411l-708 -411v-823zM1536 1088v-896l-768 -448l-768 448v896l768 448z" /> +<glyph unicode="" horiz-adv-x="1664" d="M339 1318h691l-26 -72h-665q-110 0 -188.5 -79t-78.5 -189v-771q0 -95 60.5 -169.5t153.5 -93.5q23 -5 98 -5v-72h-45q-140 0 -239.5 100t-99.5 240v771q0 140 99.5 240t239.5 100zM1190 1536h247l-482 -1294q-23 -61 -40.5 -103.5t-45 -98t-54 -93.5t-64.5 -78.5 t-79.5 -65t-95.5 -41t-116 -18.5v195q163 26 220 182q20 52 20 105q0 54 -20 106l-285 733h228l187 -585zM1664 978v-1111h-795q37 55 45 73h678v1038q0 85 -49.5 155t-129.5 99l25 67q101 -34 163.5 -123.5t62.5 -197.5z" /> +<glyph unicode="" horiz-adv-x="1792" d="M852 1227q0 -29 -17 -52.5t-45 -23.5t-45 23.5t-17 52.5t17 52.5t45 23.5t45 -23.5t17 -52.5zM688 -149v114q0 30 -20.5 51.5t-50.5 21.5t-50 -21.5t-20 -51.5v-114q0 -30 20.5 -52t49.5 -22q30 0 50.5 22t20.5 52zM860 -149v114q0 30 -20 51.5t-50 21.5t-50.5 -21.5 t-20.5 -51.5v-114q0 -30 20.5 -52t50.5 -22q29 0 49.5 22t20.5 52zM1034 -149v114q0 30 -20.5 51.5t-50.5 21.5t-50.5 -21.5t-20.5 -51.5v-114q0 -30 20.5 -52t50.5 -22t50.5 22t20.5 52zM1208 -149v114q0 30 -20.5 51.5t-50.5 21.5t-50.5 -21.5t-20.5 -51.5v-114 q0 -30 20.5 -52t50.5 -22t50.5 22t20.5 52zM1476 535q-84 -160 -232 -259.5t-323 -99.5q-123 0 -229.5 51.5t-178.5 137t-113 197.5t-41 232q0 88 21 174q-104 -175 -104 -390q0 -162 65 -312t185 -251q30 57 91 57q56 0 86 -50q32 50 87 50q56 0 86 -50q32 50 87 50t87 -50 q30 50 86 50q28 0 52.5 -15.5t37.5 -40.5q112 94 177 231.5t73 287.5zM1326 564q0 75 -72 75q-17 0 -47 -6q-95 -19 -149 -19q-226 0 -226 243q0 86 30 204q-83 -127 -83 -275q0 -150 89 -260.5t235 -110.5q111 0 210 70q13 48 13 79zM884 1223q0 50 -32 89.5t-81 39.5 t-81 -39.5t-32 -89.5q0 -51 31.5 -90.5t81.5 -39.5t81.5 39.5t31.5 90.5zM1513 884q0 96 -37.5 179t-113 137t-173.5 54q-77 0 -149 -35t-127 -94q-48 -159 -48 -268q0 -104 45.5 -157t147.5 -53q53 0 142 19q36 6 53 6q51 0 77.5 -28t26.5 -80q0 -26 -4 -46 q75 68 117.5 165.5t42.5 200.5zM1792 667q0 -111 -33.5 -249.5t-93.5 -204.5q-58 -64 -195 -142.5t-228 -104.5l-4 -1v-114q0 -43 -29.5 -75t-72.5 -32q-56 0 -86 50q-32 -50 -87 -50t-87 50q-30 -50 -86 -50q-55 0 -87 50q-30 -50 -86 -50q-47 0 -75 33.5t-28 81.5 q-90 -68 -198 -68q-118 0 -211 80q54 1 106 20q-113 31 -182 127q32 -7 71 -7q89 0 164 46q-192 192 -240 306q-24 56 -24 160q0 57 9 125.5t31.5 146.5t55 141t86.5 105t120 42q59 0 81 -52q19 29 42 54q2 3 12 13t13 16q10 15 23 38t25 42t28 39q87 111 211.5 177 t260.5 66q35 0 62 -4q59 64 146 64q83 0 140 -57q5 -5 5 -12q0 -5 -6 -13.5t-12.5 -16t-16 -17l-10.5 -10.5q17 -6 36 -18t19 -24q0 -6 -16 -25q157 -138 197 -378q25 30 60 30q45 0 100 -49q90 -80 90 -279z" /> +<glyph unicode="" d="M917 631q0 33 -6 64h-362v-132h217q-12 -76 -74.5 -120.5t-142.5 -44.5q-99 0 -169 71.5t-70 170.5t70 170.5t169 71.5q93 0 153 -59l104 101q-108 100 -257 100q-160 0 -272 -112.5t-112 -271.5t112 -271.5t272 -112.5q165 0 266.5 105t101.5 270zM1262 585h109v110 h-109v110h-110v-110h-110v-110h110v-110h110v110zM1536 640q0 -209 -103 -385.5t-279.5 -279.5t-385.5 -103t-385.5 103t-279.5 279.5t-103 385.5t103 385.5t279.5 279.5t385.5 103t385.5 -103t279.5 -279.5t103 -385.5z" /> +<glyph unicode="" d="M1536 1024v-839q0 -48 -49 -62q-174 -52 -338 -52q-73 0 -215.5 29.5t-227.5 29.5q-164 0 -370 -48v-338h-160v1368q-63 25 -101 81t-38 124q0 91 64 155t155 64t155 -64t64 -155q0 -68 -38 -124t-101 -81v-68q190 44 343 44q99 0 198 -15q14 -2 111.5 -22.5t149.5 -20.5 q77 0 165 18q11 2 80 21t89 19q26 0 45 -19t19 -45z" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +<glyph unicode="" horiz-adv-x="1792" /> +</font> +</defs></svg> \ No newline at end of file diff --git a/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.ttf b/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.ttf new file mode 100644 index 000000000..f221e50a2 Binary files /dev/null and b/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.ttf differ diff --git a/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.woff b/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.woff new file mode 100644 index 000000000..6e7483cf6 Binary files /dev/null and b/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.woff differ diff --git a/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 b/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 new file mode 100644 index 000000000..7eb74fd12 Binary files /dev/null and b/gitbook/gitbook/fonts/fontawesome/fontawesome-webfont.woff2 differ diff --git a/gitbook/gitbook/gitbook-plugin-fontsettings/fontsettings.js b/gitbook/gitbook/gitbook-plugin-fontsettings/fontsettings.js new file mode 100644 index 000000000..ff7be7141 --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-fontsettings/fontsettings.js @@ -0,0 +1,240 @@ +require(['gitbook', 'jquery'], function(gitbook, $) { + // Configuration + var MAX_SIZE = 4, + MIN_SIZE = 0, + BUTTON_ID; + + // Current fontsettings state + var fontState; + + // Default themes + var THEMES = [ + { + config: 'white', + text: 'White', + id: 0 + }, + { + config: 'sepia', + text: 'Sepia', + id: 1 + }, + { + config: 'night', + text: 'Night', + id: 2 + } + ]; + + // Default font families + var FAMILIES = [ + { + config: 'serif', + text: 'Serif', + id: 0 + }, + { + config: 'sans', + text: 'Sans', + id: 1 + } + ]; + + // Return configured themes + function getThemes() { + return THEMES; + } + + // Modify configured themes + function setThemes(themes) { + THEMES = themes; + updateButtons(); + } + + // Return configured font families + function getFamilies() { + return FAMILIES; + } + + // Modify configured font families + function setFamilies(families) { + FAMILIES = families; + updateButtons(); + } + + // Save current font settings + function saveFontSettings() { + gitbook.storage.set('fontState', fontState); + update(); + } + + // Increase font size + function enlargeFontSize(e) { + e.preventDefault(); + if (fontState.size >= MAX_SIZE) return; + + fontState.size++; + saveFontSettings(); + } + + // Decrease font size + function reduceFontSize(e) { + e.preventDefault(); + if (fontState.size <= MIN_SIZE) return; + + fontState.size--; + saveFontSettings(); + } + + // Change font family + function changeFontFamily(configName, e) { + if (e && e instanceof Event) { + e.preventDefault(); + } + + var familyId = getFontFamilyId(configName); + fontState.family = familyId; + saveFontSettings(); + } + + // Change type of color theme + function changeColorTheme(configName, e) { + if (e && e instanceof Event) { + e.preventDefault(); + } + + var $book = gitbook.state.$book; + + // Remove currently applied color theme + if (fontState.theme !== 0) + $book.removeClass('color-theme-'+fontState.theme); + + // Set new color theme + var themeId = getThemeId(configName); + fontState.theme = themeId; + if (fontState.theme !== 0) + $book.addClass('color-theme-'+fontState.theme); + + saveFontSettings(); + } + + // Return the correct id for a font-family config key + // Default to first font-family + function getFontFamilyId(configName) { + // Search for plugin configured font family + var configFamily = $.grep(FAMILIES, function(family) { + return family.config == configName; + })[0]; + // Fallback to default font family + return (!!configFamily)? configFamily.id : 0; + } + + // Return the correct id for a theme config key + // Default to first theme + function getThemeId(configName) { + // Search for plugin configured theme + var configTheme = $.grep(THEMES, function(theme) { + return theme.config == configName; + })[0]; + // Fallback to default theme + return (!!configTheme)? configTheme.id : 0; + } + + function update() { + var $book = gitbook.state.$book; + + $('.font-settings .font-family-list li').removeClass('active'); + $('.font-settings .font-family-list li:nth-child('+(fontState.family+1)+')').addClass('active'); + + $book[0].className = $book[0].className.replace(/\bfont-\S+/g, ''); + $book.addClass('font-size-'+fontState.size); + $book.addClass('font-family-'+fontState.family); + + if(fontState.theme !== 0) { + $book[0].className = $book[0].className.replace(/\bcolor-theme-\S+/g, ''); + $book.addClass('color-theme-'+fontState.theme); + } + } + + function init(config) { + // Search for plugin configured font family + var configFamily = getFontFamilyId(config.family), + configTheme = getThemeId(config.theme); + + // Instantiate font state object + fontState = gitbook.storage.get('fontState', { + size: config.size || 2, + family: configFamily, + theme: configTheme + }); + + update(); + } + + function updateButtons() { + // Remove existing fontsettings buttons + if (!!BUTTON_ID) { + gitbook.toolbar.removeButton(BUTTON_ID); + } + + // Create buttons in toolbar + BUTTON_ID = gitbook.toolbar.createButton({ + icon: 'fa fa-font', + label: 'Font Settings', + className: 'font-settings', + dropdown: [ + [ + { + text: 'A', + className: 'font-reduce', + onClick: reduceFontSize + }, + { + text: 'A', + className: 'font-enlarge', + onClick: enlargeFontSize + } + ], + $.map(FAMILIES, function(family) { + family.onClick = function(e) { + return changeFontFamily(family.config, e); + }; + + return family; + }), + $.map(THEMES, function(theme) { + theme.onClick = function(e) { + return changeColorTheme(theme.config, e); + }; + + return theme; + }) + ] + }); + } + + // Init configuration at start + gitbook.events.bind('start', function(e, config) { + var opts = config.fontsettings; + + // Generate buttons at start + updateButtons(); + + // Init current settings + init(opts); + }); + + // Expose API + gitbook.fontsettings = { + enlargeFontSize: enlargeFontSize, + reduceFontSize: reduceFontSize, + setTheme: changeColorTheme, + setFamily: changeFontFamily, + getThemes: getThemes, + setThemes: setThemes, + getFamilies: getFamilies, + setFamilies: setFamilies + }; +}); + + diff --git a/gitbook/gitbook/gitbook-plugin-fontsettings/website.css b/gitbook/gitbook/gitbook-plugin-fontsettings/website.css new file mode 100644 index 000000000..26591fe81 --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-fontsettings/website.css @@ -0,0 +1,291 @@ +/* + * Theme 1 + */ +.color-theme-1 .dropdown-menu { + background-color: #111111; + border-color: #7e888b; +} +.color-theme-1 .dropdown-menu .dropdown-caret .caret-inner { + border-bottom: 9px solid #111111; +} +.color-theme-1 .dropdown-menu .buttons { + border-color: #7e888b; +} +.color-theme-1 .dropdown-menu .button { + color: #afa790; +} +.color-theme-1 .dropdown-menu .button:hover { + color: #73553c; +} +/* + * Theme 2 + */ +.color-theme-2 .dropdown-menu { + background-color: #2d3143; + border-color: #272a3a; +} +.color-theme-2 .dropdown-menu .dropdown-caret .caret-inner { + border-bottom: 9px solid #2d3143; +} +.color-theme-2 .dropdown-menu .buttons { + border-color: #272a3a; +} +.color-theme-2 .dropdown-menu .button { + color: #62677f; +} +.color-theme-2 .dropdown-menu .button:hover { + color: #f4f4f5; +} +.book .book-header .font-settings .font-enlarge { + line-height: 30px; + font-size: 1.4em; +} +.book .book-header .font-settings .font-reduce { + line-height: 30px; + font-size: 1em; +} +.book.color-theme-1 .book-body { + color: #704214; + background: #f3eacb; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section { + background: #f3eacb; +} +.book.color-theme-2 .book-body { + color: #bdcadb; + background: #1c1f2b; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section { + background: #1c1f2b; +} +.book.font-size-0 .book-body .page-inner section { + font-size: 1.2rem; +} +.book.font-size-1 .book-body .page-inner section { + font-size: 1.4rem; +} +.book.font-size-2 .book-body .page-inner section { + font-size: 1.6rem; +} +.book.font-size-3 .book-body .page-inner section { + font-size: 2.2rem; +} +.book.font-size-4 .book-body .page-inner section { + font-size: 4rem; +} +.book.font-family-0 { + font-family: Georgia, serif; +} +.book.font-family-1 { + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal { + color: #704214; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal a { + color: inherit; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h3, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h4, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h5, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { + color: inherit; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h1, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h2 { + border-color: inherit; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal h6 { + color: inherit; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal hr { + background-color: inherit; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal blockquote { + border-color: inherit; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code { + background: #fdf6e3; + color: #657b83; + border-color: #f8df9c; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal .highlight { + background-color: inherit; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table th, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table td { + border-color: #f5d06c; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr { + color: inherit; + background-color: #fdf6e3; + border-color: #444444; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { + background-color: #fbeecb; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal { + color: #bdcadb; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal a { + color: #3eb1d0; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h3, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h4, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h5, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { + color: #fffffa; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h1, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h2 { + border-color: #373b4e; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal h6 { + color: #373b4e; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal hr { + background-color: #373b4e; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal blockquote { + border-color: #373b4e; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code { + color: #9dbed8; + background: #2d3143; + border-color: #2d3143; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal .highlight { + background-color: #282a39; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table th, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table td { + border-color: #3b3f54; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr { + color: #b6c2d2; + background-color: #2d3143; + border-color: #3b3f54; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal table tr:nth-child(2n) { + background-color: #35394b; +} +.book.color-theme-1 .book-header { + color: #afa790; + background: transparent; +} +.book.color-theme-1 .book-header .btn { + color: #afa790; +} +.book.color-theme-1 .book-header .btn:hover { + color: #73553c; + background: none; +} +.book.color-theme-1 .book-header h1 { + color: #704214; +} +.book.color-theme-2 .book-header { + color: #7e888b; + background: transparent; +} +.book.color-theme-2 .book-header .btn { + color: #3b3f54; +} +.book.color-theme-2 .book-header .btn:hover { + color: #fffff5; + background: none; +} +.book.color-theme-2 .book-header h1 { + color: #bdcadb; +} +.book.color-theme-1 .book-body .navigation { + color: #afa790; +} +.book.color-theme-1 .book-body .navigation:hover { + color: #73553c; +} +.book.color-theme-2 .book-body .navigation { + color: #383f52; +} +.book.color-theme-2 .book-body .navigation:hover { + color: #fffff5; +} +/* + * Theme 1 + */ +.book.color-theme-1 .book-summary { + color: #afa790; + background: #111111; + border-right: 1px solid rgba(0, 0, 0, 0.07); +} +.book.color-theme-1 .book-summary .book-search { + background: transparent; +} +.book.color-theme-1 .book-summary .book-search input, +.book.color-theme-1 .book-summary .book-search input:focus { + border: 1px solid transparent; +} +.book.color-theme-1 .book-summary ul.summary li.divider { + background: #7e888b; + box-shadow: none; +} +.book.color-theme-1 .book-summary ul.summary li i.fa-check { + color: #33cc33; +} +.book.color-theme-1 .book-summary ul.summary li.done > a { + color: #877f6a; +} +.book.color-theme-1 .book-summary ul.summary li a, +.book.color-theme-1 .book-summary ul.summary li span { + color: #877f6a; + background: transparent; + font-weight: normal; +} +.book.color-theme-1 .book-summary ul.summary li.active > a, +.book.color-theme-1 .book-summary ul.summary li a:hover { + color: #704214; + background: transparent; + font-weight: normal; +} +/* + * Theme 2 + */ +.book.color-theme-2 .book-summary { + color: #bcc1d2; + background: #2d3143; + border-right: none; +} +.book.color-theme-2 .book-summary .book-search { + background: transparent; +} +.book.color-theme-2 .book-summary .book-search input, +.book.color-theme-2 .book-summary .book-search input:focus { + border: 1px solid transparent; +} +.book.color-theme-2 .book-summary ul.summary li.divider { + background: #272a3a; + box-shadow: none; +} +.book.color-theme-2 .book-summary ul.summary li i.fa-check { + color: #33cc33; +} +.book.color-theme-2 .book-summary ul.summary li.done > a { + color: #62687f; +} +.book.color-theme-2 .book-summary ul.summary li a, +.book.color-theme-2 .book-summary ul.summary li span { + color: #c1c6d7; + background: transparent; + font-weight: 600; +} +.book.color-theme-2 .book-summary ul.summary li.active > a, +.book.color-theme-2 .book-summary ul.summary li a:hover { + color: #f4f4f5; + background: #252737; + font-weight: 600; +} diff --git a/gitbook/gitbook/gitbook-plugin-highlight/ebook.css b/gitbook/gitbook/gitbook-plugin-highlight/ebook.css new file mode 100644 index 000000000..cecaaab5a --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-highlight/ebook.css @@ -0,0 +1,135 @@ +pre, +code { + /* http://jmblog.github.io/color-themes-for-highlightjs */ + /* Tomorrow Comment */ + /* Tomorrow Red */ + /* Tomorrow Orange */ + /* Tomorrow Yellow */ + /* Tomorrow Green */ + /* Tomorrow Aqua */ + /* Tomorrow Blue */ + /* Tomorrow Purple */ +} +pre .hljs-comment, +code .hljs-comment, +pre .hljs-title, +code .hljs-title { + color: #8e908c; +} +pre .hljs-variable, +code .hljs-variable, +pre .hljs-attribute, +code .hljs-attribute, +pre .hljs-tag, +code .hljs-tag, +pre .hljs-regexp, +code .hljs-regexp, +pre .hljs-deletion, +code .hljs-deletion, +pre .ruby .hljs-constant, +code .ruby .hljs-constant, +pre .xml .hljs-tag .hljs-title, +code .xml .hljs-tag .hljs-title, +pre .xml .hljs-pi, +code .xml .hljs-pi, +pre .xml .hljs-doctype, +code .xml .hljs-doctype, +pre .html .hljs-doctype, +code .html .hljs-doctype, +pre .css .hljs-id, +code .css .hljs-id, +pre .css .hljs-class, +code .css .hljs-class, +pre .css .hljs-pseudo, +code .css .hljs-pseudo { + color: #c82829; +} +pre .hljs-number, +code .hljs-number, +pre .hljs-preprocessor, +code .hljs-preprocessor, +pre .hljs-pragma, +code .hljs-pragma, +pre .hljs-built_in, +code .hljs-built_in, +pre .hljs-literal, +code .hljs-literal, +pre .hljs-params, +code .hljs-params, +pre .hljs-constant, +code .hljs-constant { + color: #f5871f; +} +pre .ruby .hljs-class .hljs-title, +code .ruby .hljs-class .hljs-title, +pre .css .hljs-rules .hljs-attribute, +code .css .hljs-rules .hljs-attribute { + color: #eab700; +} +pre .hljs-string, +code .hljs-string, +pre .hljs-value, +code .hljs-value, +pre .hljs-inheritance, +code .hljs-inheritance, +pre .hljs-header, +code .hljs-header, +pre .hljs-addition, +code .hljs-addition, +pre .ruby .hljs-symbol, +code .ruby .hljs-symbol, +pre .xml .hljs-cdata, +code .xml .hljs-cdata { + color: #718c00; +} +pre .css .hljs-hexcolor, +code .css .hljs-hexcolor { + color: #3e999f; +} +pre .hljs-function, +code .hljs-function, +pre .python .hljs-decorator, +code .python .hljs-decorator, +pre .python .hljs-title, +code .python .hljs-title, +pre .ruby .hljs-function .hljs-title, +code .ruby .hljs-function .hljs-title, +pre .ruby .hljs-title .hljs-keyword, +code .ruby .hljs-title .hljs-keyword, +pre .perl .hljs-sub, +code .perl .hljs-sub, +pre .javascript .hljs-title, +code .javascript .hljs-title, +pre .coffeescript .hljs-title, +code .coffeescript .hljs-title { + color: #4271ae; +} +pre .hljs-keyword, +code .hljs-keyword, +pre .javascript .hljs-function, +code .javascript .hljs-function { + color: #8959a8; +} +pre .hljs, +code .hljs { + display: block; + background: white; + color: #4d4d4c; + padding: 0.5em; +} +pre .coffeescript .javascript, +code .coffeescript .javascript, +pre .javascript .xml, +code .javascript .xml, +pre .tex .hljs-formula, +code .tex .hljs-formula, +pre .xml .javascript, +code .xml .javascript, +pre .xml .vbscript, +code .xml .vbscript, +pre .xml .css, +code .xml .css, +pre .xml .hljs-cdata, +code .xml .hljs-cdata { + opacity: 0.5; +} diff --git a/gitbook/gitbook/gitbook-plugin-highlight/website.css b/gitbook/gitbook/gitbook-plugin-highlight/website.css new file mode 100644 index 000000000..6674448f7 --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-highlight/website.css @@ -0,0 +1,434 @@ +.book .book-body .page-wrapper .page-inner section.normal pre, +.book .book-body .page-wrapper .page-inner section.normal code { + /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + /* Tomorrow Comment */ + /* Tomorrow Red */ + /* Tomorrow Orange */ + /* Tomorrow Yellow */ + /* Tomorrow Green */ + /* Tomorrow Aqua */ + /* Tomorrow Blue */ + /* Tomorrow Purple */ +} +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-comment, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-comment, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-title { + color: #8e908c; +} +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-variable, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-variable, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-attribute, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-tag, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-tag, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-regexp, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-deletion, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-deletion, +.book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-constant, +.book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-constant, +.book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-tag .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-tag .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-pi, +.book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-pi, +.book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-doctype, +.book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-doctype, +.book .book-body .page-wrapper .page-inner section.normal pre .html .hljs-doctype, +.book .book-body .page-wrapper .page-inner section.normal code .html .hljs-doctype, +.book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-id, +.book .book-body .page-wrapper .page-inner section.normal code .css .hljs-id, +.book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-class, +.book .book-body .page-wrapper .page-inner section.normal code .css .hljs-class, +.book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo, +.book .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo { + color: #c82829; +} +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-number, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-number, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-pragma, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-built_in, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-literal, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-literal, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-params, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-params, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-constant, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-constant { + color: #f5871f; +} +.book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-class .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-class .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-rules .hljs-attribute, +.book .book-body .page-wrapper .page-inner section.normal code .css .hljs-rules .hljs-attribute { + color: #eab700; +} +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-string, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-string, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-value, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-value, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-inheritance, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-inheritance, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-header, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-header, +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-addition, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-addition, +.book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-symbol, +.book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-symbol, +.book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, +.book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { + color: #718c00; +} +.book .book-body .page-wrapper .page-inner section.normal pre .css .hljs-hexcolor, +.book .book-body .page-wrapper .page-inner section.normal code .css .hljs-hexcolor { + color: #3e999f; +} +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-function, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-function, +.book .book-body .page-wrapper .page-inner section.normal pre .python .hljs-decorator, +.book .book-body .page-wrapper .page-inner section.normal code .python .hljs-decorator, +.book .book-body .page-wrapper .page-inner section.normal pre .python .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal code .python .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-function .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-function .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-title .hljs-keyword, +.book .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-title .hljs-keyword, +.book .book-body .page-wrapper .page-inner section.normal pre .perl .hljs-sub, +.book .book-body .page-wrapper .page-inner section.normal code .perl .hljs-sub, +.book .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal pre .coffeescript .hljs-title, +.book .book-body .page-wrapper .page-inner section.normal code .coffeescript .hljs-title { + color: #4271ae; +} +.book .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword, +.book .book-body .page-wrapper .page-inner section.normal code .hljs-keyword, +.book .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-function, +.book .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-function { + color: #8959a8; +} +.book .book-body .page-wrapper .page-inner section.normal pre .hljs, +.book .book-body .page-wrapper .page-inner section.normal code .hljs { + display: block; + background: white; + color: #4d4d4c; + padding: 0.5em; +} +.book .book-body .page-wrapper .page-inner section.normal pre .coffeescript .javascript, +.book .book-body .page-wrapper .page-inner section.normal code .coffeescript .javascript, +.book .book-body .page-wrapper .page-inner section.normal pre .javascript .xml, +.book .book-body .page-wrapper .page-inner section.normal code .javascript .xml, +.book .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, +.book .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula, +.book .book-body .page-wrapper .page-inner section.normal pre .xml .javascript, +.book .book-body .page-wrapper .page-inner section.normal code .xml .javascript, +.book .book-body .page-wrapper .page-inner section.normal pre .xml .vbscript, +.book .book-body .page-wrapper .page-inner section.normal code .xml .vbscript, +.book .book-body .page-wrapper .page-inner section.normal pre .xml .css, +.book .book-body .page-wrapper .page-inner section.normal code .xml .css, +.book .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, +.book .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { + opacity: 0.5; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code { + /* + +Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmail.com> + +*/ + /* Solarized Green */ + /* Solarized Cyan */ + /* Solarized Blue */ + /* Solarized Yellow */ + /* Solarized Orange */ + /* Solarized Red */ + /* Solarized Violet */ +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs { + display: block; + padding: 0.5em; + background: #fdf6e3; + color: #657b83; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-comment, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-comment, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-template_comment, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-template_comment, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .diff .hljs-header, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .diff .hljs-header, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-doctype, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-doctype, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-pi, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-pi, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .lisp .hljs-string, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .lisp .hljs-string, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-javadoc, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-javadoc { + color: #93a1a1; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-keyword, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-winutils, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-winutils, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .method, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .method, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-addition, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-addition, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-tag, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-tag, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-request, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-request, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-status, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-status, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .nginx .hljs-title, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .nginx .hljs-title { + color: #859900; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-number, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-number, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-command, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-command, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-string, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-string, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-tag .hljs-value, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-tag .hljs-value, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-rules .hljs-value, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-rules .hljs-value, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-phpdoc, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-phpdoc, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-regexp, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-hexcolor, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-hexcolor, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_url, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_url { + color: #2aa198; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-title, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-title, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-localvars, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-localvars, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-chunk, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-chunk, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-decorator, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-decorator, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-built_in, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-identifier, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-identifier, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .vhdl .hljs-literal, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .vhdl .hljs-literal, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-id, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-id, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-function, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-function { + color: #268bd2; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-attribute, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-variable, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-variable, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .lisp .hljs-body, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .lisp .hljs-body, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .smalltalk .hljs-number, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .smalltalk .hljs-number, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-constant, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-constant, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-class .hljs-title, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-class .hljs-title, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-parent, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-parent, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .haskell .hljs-type, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .haskell .hljs-type, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_reference, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_reference { + color: #b58900; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor .hljs-keyword, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor .hljs-keyword, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-pragma, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-shebang, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-shebang, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-symbol, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-symbol, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-symbol .hljs-string, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-symbol .hljs-string, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .diff .hljs-change, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .diff .hljs-change, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-special, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-special, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-attr_selector, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-attr_selector, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-subst, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-subst, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-cdata, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-cdata, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .clojure .hljs-title, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .clojure .hljs-title, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-header, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-header { + color: #cb4b16; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-deletion, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-deletion, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-important, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-important { + color: #dc322f; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .hljs-link_label, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .hljs-link_label { + color: #6c71c4; +} +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, +.book.color-theme-1 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula { + background: #eee8d5; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code { + /* Tomorrow Night Bright Theme */ + /* Original theme - https://github.com/chriskempson/tomorrow-theme */ + /* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + /* Tomorrow Comment */ + /* Tomorrow Red */ + /* Tomorrow Orange */ + /* Tomorrow Yellow */ + /* Tomorrow Green */ + /* Tomorrow Aqua */ + /* Tomorrow Blue */ + /* Tomorrow Purple */ +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-comment, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-comment, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-title { + color: #969896; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-variable, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-variable, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-attribute, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-attribute, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-tag, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-tag, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-regexp, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-regexp, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-deletion, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-deletion, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-constant, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-constant, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-tag .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-tag .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-pi, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-pi, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-doctype, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-doctype, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .html .hljs-doctype, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .html .hljs-doctype, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-id, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-id, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-class, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-class, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-pseudo, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-pseudo { + color: #d54e53; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-number, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-number, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-preprocessor, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-preprocessor, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-pragma, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-pragma, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-built_in, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-built_in, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-literal, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-literal, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-params, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-params, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-constant, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-constant { + color: #e78c45; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-class .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-class .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-rules .hljs-attribute, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-rules .hljs-attribute { + color: #e7c547; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-string, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-string, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-value, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-value, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-inheritance, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-inheritance, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-header, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-header, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-addition, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-addition, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-symbol, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-symbol, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { + color: #b9ca4a; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .css .hljs-hexcolor, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .css .hljs-hexcolor { + color: #70c0b1; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-function, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-function, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .python .hljs-decorator, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .python .hljs-decorator, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .python .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .python .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-function .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-function .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .ruby .hljs-title .hljs-keyword, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .ruby .hljs-title .hljs-keyword, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .perl .hljs-sub, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .perl .hljs-sub, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .coffeescript .hljs-title, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .coffeescript .hljs-title { + color: #7aa6da; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs-keyword, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs-keyword, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .hljs-function, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .hljs-function { + color: #c397d8; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .hljs, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .hljs { + display: block; + background: black; + color: #eaeaea; + padding: 0.5em; +} +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .coffeescript .javascript, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .coffeescript .javascript, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .javascript .xml, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .javascript .xml, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .tex .hljs-formula, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .tex .hljs-formula, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .javascript, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .javascript, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .vbscript, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .vbscript, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .css, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .css, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal pre .xml .hljs-cdata, +.book.color-theme-2 .book-body .page-wrapper .page-inner section.normal code .xml .hljs-cdata { + opacity: 0.5; +} diff --git a/gitbook/gitbook/gitbook-plugin-jsfiddle/plugin.js b/gitbook/gitbook/gitbook-plugin-jsfiddle/plugin.js new file mode 100644 index 000000000..c8bce1c8e --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-jsfiddle/plugin.js @@ -0,0 +1,102 @@ +require(["gitbook", "jquery"], function (gitbook, $) { + var matcher = /\/\/jsfiddle.net\/.+/; + var defaults = { + type: 'script', + tabs: ['js', 'html', 'css', 'result'], + theme: 'light' + }; + var localConfig = { + jsfiddle: {} + }; + var extractConfigFromURL = function (href) { + var match = /(#)(.+)$/ig.exec(href); + if (match && match[2]) { + return match[2].split('&').reduce(function (params, param) { + var splitParam = param.split('='); + if (splitParam[0] === 'tabs') { + splitParam[1] = splitParam[1].split(','); + } + params[splitParam[0]] = splitParam[1]; + return params; + }, {}); + } + return {}; + }; + var generateAdditionalParams = function (config) { + var params = '/'; + if (config.theme) { + params += config.theme + '/'; + } + var colors = Object.keys(config).reduce(function (colors, key) { + if (['href', 'type', 'theme', 'tabs', 'width', 'height'].indexOf(key) !== -1) { + return colors; + } + colors += key + '=' + config[key] + '&'; + return colors; + }, ''); + + colors = colors.replace(/&$/, ''); + if (colors) { + return params + '?' + colors; + } + return params; + }; + + var generateUrl = function (config) { + var additionalParam = generateAdditionalParams(config); + var type = config.type == 'frame' ? 'embedded' : 'embed'; + return config.href + type + '/' + config.tabs.join(',') + additionalParam; + }; + + var creator = { + script: function (config) { + var script = document.createElement('script'); + script.src = generateUrl(config); + script.async = true; + return script; + }, + frame: function (config) { + return $([ + '<iframe', + ' width=', + '"' + (config.width ? config.width : '100%') + '"', + ' height=', + '"' + (config.height ? config.height : '300') + '"', + ' src="' + generateUrl(config) + '"', + ' allowfullscreen="allowfullscreen" frameborder="0"', + '>', + '</iframe>' + ].join(''))[0]; + } + }; + + var createEmbedNode = function (href, config) { + var normalURL = href.replace(/#.+$/, ''); + var configFromUrl = extractConfigFromURL(href); + var mergedConfig = $.extend({href: normalURL}, config, configFromUrl); + return creator[mergedConfig.type](mergedConfig); + }; + + function embedAllLink(config) { + localConfig.jsfiddle = $.extend(localConfig.jsfiddle || {}, config.jsfiddle); + $(".book-body a").each(function (index, link) { + if (link.href && matcher.test(link.href)) { + link.parentNode.insertBefore(createEmbedNode(link.href, localConfig.jsfiddle), link.nextSibling); + link.parentNode.removeChild(link); + } + }); + } + + gitbook.events.bind("start", function (e, config) { + localConfig.jsfiddle = $.extend({}, defaults); + matcher = /(http|https):\/\/jsfiddle.net\/.+/; + embedAllLink(config); + }); + + gitbook.events.bind("page.change", function () { + if (matcher) { + embedAllLink(localConfig); + } + }); + +}); \ No newline at end of file diff --git a/gitbook/gitbook/gitbook-plugin-lunr/lunr.min.js b/gitbook/gitbook/gitbook-plugin-lunr/lunr.min.js new file mode 100644 index 000000000..6aa6bc7d6 --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-lunr/lunr.min.js @@ -0,0 +1,7 @@ +/** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12 + * Copyright (C) 2015 Oliver Nightingale + * MIT Licensed + * @license + */ +!function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.5.12",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(t){return arguments.length&&null!=t&&void 0!=t?Array.isArray(t)?t.map(function(t){return t.toLowerCase()}):t.toString().trim().toLowerCase().split(/[\s\-]+/):[]},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,o=0;n>o;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(e<i.idx)return this.list=new t.Vector.Node(e,n,i),this.length++;for(var o=i,r=i.next;void 0!=r;){if(e<r.idx)return o.next=new t.Vector.Node(e,n,r),this.length++;o=r,r=r.next}return o.next=new t.Vector.Node(e,n,r),this.length++},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var t,e=this.list,n=0;e;)t=e.val,n+=t*t,e=e.next;return this._magnitude=Math.sqrt(n)},t.Vector.prototype.dot=function(t){for(var e=this.list,n=t.list,i=0;e&&n;)e.idx<n.idx?e=e.next:e.idx>n.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t<arguments.length;t++)e=arguments[t],~this.indexOf(e)||this.elements.splice(this.locationFor(e),0,e);this.length=this.elements.length},t.SortedSet.prototype.toArray=function(){return this.elements.slice()},t.SortedSet.prototype.map=function(t,e){return this.elements.map(t,e)},t.SortedSet.prototype.forEach=function(t,e){return this.elements.forEach(t,e)},t.SortedSet.prototype.indexOf=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;){if(r===t)return o;t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o]}return r===t?o:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;)t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o];return r>t?o:t>r?o+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,o=0,r=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>r-1||o>s-1)break;a[i]!==h[o]?a[i]<h[o]?i++:a[i]>h[o]&&o++:(n.add(a[i]),i++,o++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;return this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone(),i.add.apply(i,n.toArray()),i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.add=function(e,n){var i={},o=new t.SortedSet,r=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var r=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=r,t.SortedSet.prototype.add.apply(o,r)},this),this.documentStore.set(r,o),t.SortedSet.prototype.add.apply(this.corpusTokens,o.toArray());for(var s=0;s<o.length;s++){var a=o.elements[s],h=this._fields.reduce(function(t,e){var n=i[e.name].length;if(!n)return t;var o=i[e.name].filter(function(t){return t===a}).length;return t+o/n*e.boost},0);this.tokenStore.add(a,{ref:r,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e?!0:e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e?!0:e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(t.tokenizer(e)),i=new t.Vector,o=[],r=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*r,h=this,l=this.tokenStore.expand(e).reduce(function(n,o){var r=h.corpusTokens.indexOf(o),s=h.idf(o),l=1,u=new t.SortedSet;if(o!==e){var c=Math.max(3,o.length-e.length);l=1/Math.log(c)}return r>-1&&i.insert(r,a*s*l),Object.keys(h.tokenStore.get(o)).forEach(function(t){u.add(t)}),n.union(u)},new t.SortedSet);o.push(l)},this);var a=o.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,o=new t.Vector,r=0;i>r;r++){var s=n.elements[r],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);o.insert(this.corpusTokens.indexOf(s),a*h)}return o},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,a="^("+o+")?"+r+o+"("+r+")?$",h="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(l),p=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,v=/^(.+?)eed$/,y=/^(.+?)(ed|ing)$/,g=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+o+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,O=/^(.+?)e$/,P=/ll$/,N=new RegExp("^"+o+i+"[^aeiouwxy]$"),T=function(n){var i,o,r,s,a,h,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,a=m,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=v,a=y,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=g,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=g,n=n.replace(s,"")):l.test(n)&&(n+="e"))}if(s=k,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+t[o])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+e[o])}if(s=_,a=F,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=O,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=N,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=P,a=c,s.test(n)&&a.test(n)&&(s=g,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==e?e:void 0},t.stopWordFilter.stopWords={a:"a",able:"able",about:"about",across:"across",after:"after",all:"all",almost:"almost",also:"also",am:"am",among:"among",an:"an",and:"and",any:"any",are:"are",as:"as",at:"at",be:"be",because:"because",been:"been",but:"but",by:"by",can:"can",cannot:"cannot",could:"could",dear:"dear",did:"did","do":"do",does:"does",either:"either","else":"else",ever:"ever",every:"every","for":"for",from:"from",get:"get",got:"got",had:"had",has:"has",have:"have",he:"he",her:"her",hers:"hers",him:"him",his:"his",how:"how",however:"however",i:"i","if":"if","in":"in",into:"into",is:"is",it:"it",its:"its",just:"just",least:"least",let:"let",like:"like",likely:"likely",may:"may",me:"me",might:"might",most:"most",must:"must",my:"my",neither:"neither",no:"no",nor:"nor",not:"not",of:"of",off:"off",often:"often",on:"on",only:"only",or:"or",other:"other",our:"our",own:"own",rather:"rather",said:"said",say:"say",says:"says",she:"she",should:"should",since:"since",so:"so",some:"some",than:"than",that:"that",the:"the",their:"their",them:"them",then:"then",there:"there",these:"these",they:"they","this":"this",tis:"tis",to:"to",too:"too",twas:"twas",us:"us",wants:"wants",was:"was",we:"we",were:"were",what:"what",when:"when",where:"where",which:"which","while":"while",who:"who",whom:"whom",why:"why",will:"will","with":"with",would:"would",yet:"yet",you:"you",your:"your"},t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){var e=t.replace(/^\W+/,"").replace(/\W+$/,"");return""===e?void 0:e},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t[0],o=t.slice(1);return i in n||(n[i]={docs:{}}),0===o.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(o,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n<t.length;n++){if(!e[t[n]])return!1;e=e[t[n]]}return!0},t.TokenStore.prototype.getNode=function(t){if(!t)return{};for(var e=this.root,n=0;n<t.length;n++){if(!e[t[n]])return{};e=e[t[n]]}return e},t.TokenStore.prototype.get=function(t,e){return this.getNode(t,e).docs||{}},t.TokenStore.prototype.count=function(t,e){return Object.keys(this.get(t,e)).length},t.TokenStore.prototype.remove=function(t,e){if(t){for(var n=this.root,i=0;i<t.length;i++){if(!(t[i]in n))return;n=n[t[i]]}delete n.docs[e]}},t.TokenStore.prototype.expand=function(t,e){var n=this.getNode(t),i=n.docs||{},e=e||[];return Object.keys(i).length&&e.push(t),Object.keys(n).forEach(function(n){"docs"!==n&&e.concat(this.expand(t+n,e))},this),e},t.TokenStore.prototype.toJSON=function(){return{root:this.root,length:this.length}},function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.lunr=e()}(this,function(){return t})}(); \ No newline at end of file diff --git a/gitbook/gitbook/gitbook-plugin-lunr/search-lunr.js b/gitbook/gitbook/gitbook-plugin-lunr/search-lunr.js new file mode 100644 index 000000000..d6ec76fbb --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-lunr/search-lunr.js @@ -0,0 +1,59 @@ +require([ + 'gitbook', + 'jquery' +], function(gitbook, $) { + // Define global search engine + function LunrSearchEngine() { + this.index = null; + this.store = {}; + this.name = 'LunrSearchEngine'; + } + + // Initialize lunr by fetching the search index + LunrSearchEngine.prototype.init = function() { + var that = this; + var d = $.Deferred(); + + $.getJSON(gitbook.state.basePath+'/search_index.json') + .then(function(data) { + // eslint-disable-next-line no-undef + that.index = lunr.Index.load(data.index); + that.store = data.store; + d.resolve(); + }); + + return d.promise(); + }; + + // Search for a term and return results + LunrSearchEngine.prototype.search = function(q, offset, length) { + var that = this; + var results = []; + + if (this.index) { + results = $.map(this.index.search(q), function(result) { + var doc = that.store[result.ref]; + + return { + title: doc.title, + url: doc.url, + body: doc.summary || doc.body + }; + }); + } + + return $.Deferred().resolve({ + query: q, + results: results.slice(0, length), + count: results.length + }).promise(); + }; + + // Set gitbook research + gitbook.events.bind('start', function(e, config) { + var engine = gitbook.search.getEngine(); + if (!engine) { + gitbook.search.setEngine(LunrSearchEngine, config); + } + }); +}); diff --git a/gitbook/gitbook/gitbook-plugin-search/lunr.min.js b/gitbook/gitbook/gitbook-plugin-search/lunr.min.js new file mode 100644 index 000000000..6aa6bc7d6 --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-search/lunr.min.js @@ -0,0 +1,7 @@ +/** + * lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.12 + * Copyright (C) 2015 Oliver Nightingale + * MIT Licensed + * @license + */ +!function(){var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.5.12",t.utils={},t.utils.warn=function(t){return function(e){t.console&&console.warn&&console.warn(e)}}(this),t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},t.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);this.events[t].splice(n,1),this.events[t].length||delete this.events[t]}},t.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)})}},t.EventEmitter.prototype.hasHandler=function(t){return t in this.events},t.tokenizer=function(t){return arguments.length&&null!=t&&void 0!=t?Array.isArray(t)?t.map(function(t){return t.toLowerCase()}):t.toString().trim().toLowerCase().split(/[\s\-]+/):[]},t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.registeredFunctions[e];if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");i+=1,this._stack.splice(i,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._stack.indexOf(e);if(-1==i)throw new Error("Cannot find existingFn");this._stack.splice(i,0,n)},t.Pipeline.prototype.remove=function(t){var e=this._stack.indexOf(t);-1!=e&&this._stack.splice(e,1)},t.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,i=this._stack.length,o=0;n>o;o++){for(var r=t[o],s=0;i>s&&(r=this._stack[s](r,o,t),void 0!==r);s++);void 0!==r&&e.push(r)}return e},t.Pipeline.prototype.reset=function(){this._stack=[]},t.Pipeline.prototype.toJSON=function(){return this._stack.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Vector=function(){this._magnitude=null,this.list=void 0,this.length=0},t.Vector.Node=function(t,e,n){this.idx=t,this.val=e,this.next=n},t.Vector.prototype.insert=function(e,n){this._magnitude=void 0;var i=this.list;if(!i)return this.list=new t.Vector.Node(e,n,i),this.length++;if(e<i.idx)return this.list=new t.Vector.Node(e,n,i),this.length++;for(var o=i,r=i.next;void 0!=r;){if(e<r.idx)return o.next=new t.Vector.Node(e,n,r),this.length++;o=r,r=r.next}return o.next=new t.Vector.Node(e,n,r),this.length++},t.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var t,e=this.list,n=0;e;)t=e.val,n+=t*t,e=e.next;return this._magnitude=Math.sqrt(n)},t.Vector.prototype.dot=function(t){for(var e=this.list,n=t.list,i=0;e&&n;)e.idx<n.idx?e=e.next:e.idx>n.idx?n=n.next:(i+=e.val*n.val,e=e.next,n=n.next);return i},t.Vector.prototype.similarity=function(t){return this.dot(t)/(this.magnitude()*t.magnitude())},t.SortedSet=function(){this.length=0,this.elements=[]},t.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},t.SortedSet.prototype.add=function(){var t,e;for(t=0;t<arguments.length;t++)e=arguments[t],~this.indexOf(e)||this.elements.splice(this.locationFor(e),0,e);this.length=this.elements.length},t.SortedSet.prototype.toArray=function(){return this.elements.slice()},t.SortedSet.prototype.map=function(t,e){return this.elements.map(t,e)},t.SortedSet.prototype.forEach=function(t,e){return this.elements.forEach(t,e)},t.SortedSet.prototype.indexOf=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;){if(r===t)return o;t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o]}return r===t?o:-1},t.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,i=n-e,o=e+Math.floor(i/2),r=this.elements[o];i>1;)t>r&&(e=o),r>t&&(n=o),i=n-e,o=e+Math.floor(i/2),r=this.elements[o];return r>t?o:t>r?o+1:void 0},t.SortedSet.prototype.intersect=function(e){for(var n=new t.SortedSet,i=0,o=0,r=this.length,s=e.length,a=this.elements,h=e.elements;;){if(i>r-1||o>s-1)break;a[i]!==h[o]?a[i]<h[o]?i++:a[i]>h[o]&&o++:(n.add(a[i]),i++,o++)}return n},t.SortedSet.prototype.clone=function(){var e=new t.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},t.SortedSet.prototype.union=function(t){var e,n,i;return this.length>=t.length?(e=this,n=t):(e=t,n=this),i=e.clone(),i.add.apply(i,n.toArray()),i},t.SortedSet.prototype.toJSON=function(){return this.toArray()},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.Store,this.tokenStore=new t.TokenStore,this.corpusTokens=new t.SortedSet,this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},t.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;return n._fields=e.fields,n._ref=e.ref,n.documentStore=t.Store.load(e.documentStore),n.tokenStore=t.TokenStore.load(e.tokenStore),n.corpusTokens=t.SortedSet.load(e.corpusTokens),n.pipeline=t.Pipeline.load(e.pipeline),n},t.Index.prototype.field=function(t,e){var e=e||{},n={name:t,boost:e.boost||1};return this._fields.push(n),this},t.Index.prototype.ref=function(t){return this._ref=t,this},t.Index.prototype.add=function(e,n){var i={},o=new t.SortedSet,r=e[this._ref],n=void 0===n?!0:n;this._fields.forEach(function(n){var r=this.pipeline.run(t.tokenizer(e[n.name]));i[n.name]=r,t.SortedSet.prototype.add.apply(o,r)},this),this.documentStore.set(r,o),t.SortedSet.prototype.add.apply(this.corpusTokens,o.toArray());for(var s=0;s<o.length;s++){var a=o.elements[s],h=this._fields.reduce(function(t,e){var n=i[e.name].length;if(!n)return t;var o=i[e.name].filter(function(t){return t===a}).length;return t+o/n*e.boost},0);this.tokenStore.add(a,{ref:r,tf:h})}n&&this.eventEmitter.emit("add",e,this)},t.Index.prototype.remove=function(t,e){var n=t[this._ref],e=void 0===e?!0:e;if(this.documentStore.has(n)){var i=this.documentStore.get(n);this.documentStore.remove(n),i.forEach(function(t){this.tokenStore.remove(t,n)},this),e&&this.eventEmitter.emit("remove",t,this)}},t.Index.prototype.update=function(t,e){var e=void 0===e?!0:e;this.remove(t,!1),this.add(t,!1),e&&this.eventEmitter.emit("update",t,this)},t.Index.prototype.idf=function(t){var e="@"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,e))return this._idfCache[e];var n=this.tokenStore.count(t),i=1;return n>0&&(i=1+Math.log(this.documentStore.length/n)),this._idfCache[e]=i},t.Index.prototype.search=function(e){var n=this.pipeline.run(t.tokenizer(e)),i=new t.Vector,o=[],r=this._fields.reduce(function(t,e){return t+e.boost},0),s=n.some(function(t){return this.tokenStore.has(t)},this);if(!s)return[];n.forEach(function(e,n,s){var a=1/s.length*this._fields.length*r,h=this,l=this.tokenStore.expand(e).reduce(function(n,o){var r=h.corpusTokens.indexOf(o),s=h.idf(o),l=1,u=new t.SortedSet;if(o!==e){var c=Math.max(3,o.length-e.length);l=1/Math.log(c)}return r>-1&&i.insert(r,a*s*l),Object.keys(h.tokenStore.get(o)).forEach(function(t){u.add(t)}),n.union(u)},new t.SortedSet);o.push(l)},this);var a=o.reduce(function(t,e){return t.intersect(e)});return a.map(function(t){return{ref:t,score:i.similarity(this.documentVector(t))}},this).sort(function(t,e){return e.score-t.score})},t.Index.prototype.documentVector=function(e){for(var n=this.documentStore.get(e),i=n.length,o=new t.Vector,r=0;i>r;r++){var s=n.elements[r],a=this.tokenStore.get(s)[e].tf,h=this.idf(s);o.insert(this.corpusTokens.indexOf(s),a*h)}return o},t.Index.prototype.toJSON=function(){return{version:t.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),tokenStore:this.tokenStore.toJSON(),corpusTokens:this.corpusTokens.toJSON(),pipeline:this.pipeline.toJSON()}},t.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},t.Store=function(){this.store={},this.length=0},t.Store.load=function(e){var n=new this;return n.length=e.length,n.store=Object.keys(e.store).reduce(function(n,i){return n[i]=t.SortedSet.load(e.store[i]),n},{}),n},t.Store.prototype.set=function(t,e){this.has(t)||this.length++,this.store[t]=e},t.Store.prototype.get=function(t){return this.store[t]},t.Store.prototype.has=function(t){return t in this.store},t.Store.prototype.remove=function(t){this.has(t)&&(delete this.store[t],this.length--)},t.Store.prototype.toJSON=function(){return{store:this.store,length:this.length}},t.stemmer=function(){var t={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},n="[^aeiou]",i="[aeiouy]",o=n+"[^aeiouy]*",r=i+"[aeiou]*",s="^("+o+")?"+r+o,a="^("+o+")?"+r+o+"("+r+")?$",h="^("+o+")?"+r+o+r+o,l="^("+o+")?"+i,u=new RegExp(s),c=new RegExp(h),f=new RegExp(a),d=new RegExp(l),p=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,v=/^(.+?)eed$/,y=/^(.+?)(ed|ing)$/,g=/.$/,S=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+o+i+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,F=/^(.+?)(s|t)(ion)$/,O=/^(.+?)e$/,P=/ll$/,N=new RegExp("^"+o+i+"[^aeiouwxy]$"),T=function(n){var i,o,r,s,a,h,l;if(n.length<3)return n;if(r=n.substr(0,1),"y"==r&&(n=r.toUpperCase()+n.substr(1)),s=p,a=m,s.test(n)?n=n.replace(s,"$1$2"):a.test(n)&&(n=n.replace(a,"$1$2")),s=v,a=y,s.test(n)){var T=s.exec(n);s=u,s.test(T[1])&&(s=g,n=n.replace(s,""))}else if(a.test(n)){var T=a.exec(n);i=T[1],a=d,a.test(i)&&(n=i,a=S,h=w,l=x,a.test(n)?n+="e":h.test(n)?(s=g,n=n.replace(s,"")):l.test(n)&&(n+="e"))}if(s=k,s.test(n)){var T=s.exec(n);i=T[1],n=i+"i"}if(s=b,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+t[o])}if(s=E,s.test(n)){var T=s.exec(n);i=T[1],o=T[2],s=u,s.test(i)&&(n=i+e[o])}if(s=_,a=F,s.test(n)){var T=s.exec(n);i=T[1],s=c,s.test(i)&&(n=i)}else if(a.test(n)){var T=a.exec(n);i=T[1]+T[2],a=c,a.test(i)&&(n=i)}if(s=O,s.test(n)){var T=s.exec(n);i=T[1],s=c,a=f,h=N,(s.test(i)||a.test(i)&&!h.test(i))&&(n=i)}return s=P,a=c,s.test(n)&&a.test(n)&&(s=g,n=n.replace(s,"")),"y"==r&&(n=r.toLowerCase()+n.substr(1)),n};return T}(),t.Pipeline.registerFunction(t.stemmer,"stemmer"),t.stopWordFilter=function(e){return e&&t.stopWordFilter.stopWords[e]!==e?e:void 0},t.stopWordFilter.stopWords={a:"a",able:"able",about:"about",across:"across",after:"after",all:"all",almost:"almost",also:"also",am:"am",among:"among",an:"an",and:"and",any:"any",are:"are",as:"as",at:"at",be:"be",because:"because",been:"been",but:"but",by:"by",can:"can",cannot:"cannot",could:"could",dear:"dear",did:"did","do":"do",does:"does",either:"either","else":"else",ever:"ever",every:"every","for":"for",from:"from",get:"get",got:"got",had:"had",has:"has",have:"have",he:"he",her:"her",hers:"hers",him:"him",his:"his",how:"how",however:"however",i:"i","if":"if","in":"in",into:"into",is:"is",it:"it",its:"its",just:"just",least:"least",let:"let",like:"like",likely:"likely",may:"may",me:"me",might:"might",most:"most",must:"must",my:"my",neither:"neither",no:"no",nor:"nor",not:"not",of:"of",off:"off",often:"often",on:"on",only:"only",or:"or",other:"other",our:"our",own:"own",rather:"rather",said:"said",say:"say",says:"says",she:"she",should:"should",since:"since",so:"so",some:"some",than:"than",that:"that",the:"the",their:"their",them:"them",then:"then",there:"there",these:"these",they:"they","this":"this",tis:"tis",to:"to",too:"too",twas:"twas",us:"us",wants:"wants",was:"was",we:"we",were:"were",what:"what",when:"when",where:"where",which:"which","while":"while",who:"who",whom:"whom",why:"why",will:"will","with":"with",would:"would",yet:"yet",you:"you",your:"your"},t.Pipeline.registerFunction(t.stopWordFilter,"stopWordFilter"),t.trimmer=function(t){var e=t.replace(/^\W+/,"").replace(/\W+$/,"");return""===e?void 0:e},t.Pipeline.registerFunction(t.trimmer,"trimmer"),t.TokenStore=function(){this.root={docs:{}},this.length=0},t.TokenStore.load=function(t){var e=new this;return e.root=t.root,e.length=t.length,e},t.TokenStore.prototype.add=function(t,e,n){var n=n||this.root,i=t[0],o=t.slice(1);return i in n||(n[i]={docs:{}}),0===o.length?(n[i].docs[e.ref]=e,void(this.length+=1)):this.add(o,e,n[i])},t.TokenStore.prototype.has=function(t){if(!t)return!1;for(var e=this.root,n=0;n<t.length;n++){if(!e[t[n]])return!1;e=e[t[n]]}return!0},t.TokenStore.prototype.getNode=function(t){if(!t)return{};for(var e=this.root,n=0;n<t.length;n++){if(!e[t[n]])return{};e=e[t[n]]}return e},t.TokenStore.prototype.get=function(t,e){return this.getNode(t,e).docs||{}},t.TokenStore.prototype.count=function(t,e){return Object.keys(this.get(t,e)).length},t.TokenStore.prototype.remove=function(t,e){if(t){for(var n=this.root,i=0;i<t.length;i++){if(!(t[i]in n))return;n=n[t[i]]}delete n.docs[e]}},t.TokenStore.prototype.expand=function(t,e){var n=this.getNode(t),i=n.docs||{},e=e||[];return Object.keys(i).length&&e.push(t),Object.keys(n).forEach(function(n){"docs"!==n&&e.concat(this.expand(t+n,e))},this),e},t.TokenStore.prototype.toJSON=function(){return{root:this.root,length:this.length}},function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e():t.lunr=e()}(this,function(){return t})}(); \ No newline at end of file diff --git a/gitbook/gitbook/gitbook-plugin-search/search-engine.js b/gitbook/gitbook/gitbook-plugin-search/search-engine.js new file mode 100644 index 000000000..50883464e --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-search/search-engine.js @@ -0,0 +1,50 @@ +require([ + 'gitbook', + 'jquery' +], function(gitbook, $) { + // Global search objects + var engine = null; + var initialized = false; + + // Set a new search engine + function setEngine(Engine, config) { + initialized = false; + engine = new Engine(config); + + init(config); + } + + // Initialize search engine with config + function init(config) { + if (!engine) throw new Error('No engine set for research. Set an engine using gitbook.research.setEngine(Engine).'); + + return engine.init(config) + .then(function() { + initialized = true; + gitbook.events.trigger('search.ready'); + }); + } + + // Launch search for query q + function query(q, offset, length) { + if (!initialized) throw new Error('Search has not been initialized'); + return engine.search(q, offset, length); + } + + // Get stats about search + function getEngine() { + return engine? engine.name : null; + } + + function isInitialized() { + return initialized; + } + + // Initialize gitbook.search + gitbook.search = { + setEngine: setEngine, + getEngine: getEngine, + query: query, + isInitialized: isInitialized + }; +}); \ No newline at end of file diff --git a/gitbook/gitbook/gitbook-plugin-search/search.css b/gitbook/gitbook/gitbook-plugin-search/search.css new file mode 100644 index 000000000..5d47a3ce9 --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-search/search.css @@ -0,0 +1,35 @@ +/* + This CSS only styled the search results section, not the search input + It defines the basic interraction to hide content when displaying results, etc +*/ +#book-search-results .search-results { + display: none; +} +#book-search-results .search-results ul.search-results-list { + list-style-type: none; + padding-left: 0; +} +#book-search-results .search-results ul.search-results-list li { + margin-bottom: 1.5rem; + padding-bottom: 0.5rem; + /* Highlight results */ +} +#book-search-results .search-results ul.search-results-list li p em { + background-color: rgba(255, 220, 0, 0.4); + font-style: normal; +} +#book-search-results .search-results .no-results { + display: none; +} +#book-search-results.open .search-results { + display: block; +} +#book-search-results.open .search-noresults { + display: none; +} +#book-search-results.no-results .search-results .has-results { + display: none; +} +#book-search-results.no-results .search-results .no-results { + display: block; +} diff --git a/gitbook/gitbook/gitbook-plugin-search/search.js b/gitbook/gitbook/gitbook-plugin-search/search.js new file mode 100644 index 000000000..7a0c2321c --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-search/search.js @@ -0,0 +1,213 @@ +require([ + 'gitbook', + 'jquery' +], function(gitbook, $) { + var MAX_RESULTS = 15; + var MAX_DESCRIPTION_SIZE = 500; + + var usePushState = (typeof history.pushState !== 'undefined'); + + // DOM Elements + var $body = $('body'); + var $bookSearchResults; + var $searchInput; + var $searchList; + var $searchTitle; + var $searchResultsCount; + var $searchQuery; + + // Throttle search + function throttle(fn, wait) { + var timeout; + + return function() { + var ctx = this, args = arguments; + if (!timeout) { + timeout = setTimeout(function() { + timeout = null; + fn.apply(ctx, args); + }, wait); + } + }; + } + + function displayResults(res) { + $bookSearchResults.addClass('open'); + + var noResults = res.count == 0; + $bookSearchResults.toggleClass('no-results', noResults); + + // Clear old results + $searchList.empty(); + + // Display title for research + $searchResultsCount.text(res.count); + $searchQuery.text(res.query); + + // Create an <li> element for each result + res.results.forEach(function(res) { + var $li = $('<li>', { + 'class': 'search-results-item' + }); + + var $title = $('<h3>'); + + var $link = $('<a>', { + 'href': gitbook.state.basePath + '/' + res.url, + 'text': res.title + }); + + var content = res.body.trim(); + if (content.length > MAX_DESCRIPTION_SIZE) { + content = content.slice(0, MAX_DESCRIPTION_SIZE).trim()+'...'; + } + var $content = $('<p>').html(content); + + $link.appendTo($title); + $title.appendTo($li); + $content.appendTo($li); + $li.appendTo($searchList); + }); + } + + function launchSearch(q) { + // Add class for loading + $body.addClass('with-search'); + $body.addClass('search-loading'); + + // Launch search query + throttle(gitbook.search.query(q, 0, MAX_RESULTS) + .then(function(results) { + displayResults(results); + }) + .always(function() { + $body.removeClass('search-loading'); + }), 1000); + } + + function closeSearch() { + $body.removeClass('with-search'); + $bookSearchResults.removeClass('open'); + } + + function launchSearchFromQueryString() { + var q = getParameterByName('q'); + if (q && q.length > 0) { + // Update search input + $searchInput.val(q); + + // Launch search + launchSearch(q); + } + } + + function bindSearch() { + // Bind DOM + $searchInput = $('#book-search-input input'); + $bookSearchResults = $('#book-search-results'); + $searchList = $bookSearchResults.find('.search-results-list'); + $searchTitle = $bookSearchResults.find('.search-results-title'); + $searchResultsCount = $searchTitle.find('.search-results-count'); + $searchQuery = $searchTitle.find('.search-query'); + + // Launch query based on input content + function handleUpdate() { + var q = $searchInput.val(); + + if (q.length == 0) { + closeSearch(); + } + else { + launchSearch(q); + } + } + + // Detect true content change in search input + // Workaround for IE < 9 + var propertyChangeUnbound = false; + $searchInput.on('propertychange', function(e) { + if (e.originalEvent.propertyName == 'value') { + handleUpdate(); + } + }); + + // HTML5 (IE9 & others) + $searchInput.on('input', function(e) { + // Unbind propertychange event for IE9+ + if (!propertyChangeUnbound) { + $(this).unbind('propertychange'); + propertyChangeUnbound = true; + } + + handleUpdate(); + }); + + // Push to history on blur + $searchInput.on('blur', function(e) { + // Update history state + if (usePushState) { + var uri = updateQueryString('q', $(this).val()); + history.pushState({ path: uri }, null, uri); + } + }); + } + + gitbook.events.on('page.change', function() { + bindSearch(); + closeSearch(); + + // Launch search based on query parameter + if (gitbook.search.isInitialized()) { + launchSearchFromQueryString(); + } + }); + + gitbook.events.on('search.ready', function() { + bindSearch(); + + // Launch search from query param at start + launchSearchFromQueryString(); + }); + + function getParameterByName(name) { + var url = window.location.href; + name = name.replace(/[\[\]]/g, '\\$&'); + var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)', 'i'), + results = regex.exec(url); + if (!results) return null; + if (!results[2]) return ''; + return decodeURIComponent(results[2].replace(/\+/g, ' ')); + } + + function updateQueryString(key, value) { + value = encodeURIComponent(value); + + var url = window.location.href; + var re = new RegExp('([?&])' + key + '=.*?(&|#|$)(.*)', 'gi'), + hash; + + if (re.test(url)) { + if (typeof value !== 'undefined' && value !== null) + return url.replace(re, '$1' + key + '=' + value + '$2$3'); + else { + hash = url.split('#'); + url = hash[0].replace(re, '$1$3').replace(/(&|\?)$/, ''); + if (typeof hash[1] !== 'undefined' && hash[1] !== null) + url += '#' + hash[1]; + return url; + } + } + else { + if (typeof value !== 'undefined' && value !== null) { + var separator = url.indexOf('?') !== -1 ? '&' : '?'; + hash = url.split('#'); + url = hash[0] + separator + key + '=' + value; + if (typeof hash[1] !== 'undefined' && hash[1] !== null) + url += '#' + hash[1]; + return url; + } + else + return url; + } + } +}); diff --git a/gitbook/gitbook/gitbook-plugin-sharing/buttons.js b/gitbook/gitbook/gitbook-plugin-sharing/buttons.js new file mode 100644 index 000000000..709a4e4c0 --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-sharing/buttons.js @@ -0,0 +1,90 @@ +require(['gitbook', 'jquery'], function(gitbook, $) { + var SITES = { + 'facebook': { + 'label': 'Facebook', + 'icon': 'fa fa-facebook', + 'onClick': function(e) { + e.preventDefault(); + window.open('http://www.facebook.com/sharer/sharer.php?s=100&p[url]='+encodeURIComponent(location.href)); + } + }, + 'twitter': { + 'label': 'Twitter', + 'icon': 'fa fa-twitter', + 'onClick': function(e) { + e.preventDefault(); + window.open('http://twitter.com/home?status='+encodeURIComponent(document.title+' '+location.href)); + } + }, + 'google': { + 'label': 'Google+', + 'icon': 'fa fa-google-plus', + 'onClick': function(e) { + e.preventDefault(); + window.open('https://plus.google.com/share?url='+encodeURIComponent(location.href)); + } + }, + 'weibo': { + 'label': 'Weibo', + 'icon': 'fa fa-weibo', + 'onClick': function(e) { + e.preventDefault(); + window.open('http://service.weibo.com/share/share.php?content=utf-8&url='+encodeURIComponent(location.href)+'&title='+encodeURIComponent(document.title)); + } + }, + 'instapaper': { + 'label': 'Instapaper', + 'icon': 'fa fa-instapaper', + 'onClick': function(e) { + e.preventDefault(); + window.open('http://www.instapaper.com/text?u='+encodeURIComponent(location.href)); + } + }, + 'vk': { + 'label': 'VK', + 'icon': 'fa fa-vk', + 'onClick': function(e) { + e.preventDefault(); + window.open('http://vkontakte.ru/share.php?url='+encodeURIComponent(location.href)); + } + } + }; + + + + gitbook.events.bind('start', function(e, config) { + var opts = config.sharing; + + // Create dropdown menu + var menu = $.map(opts.all, function(id) { + var site = SITES[id]; + + return { + text: site.label, + onClick: site.onClick + }; + }); + + // Create main button with dropdown + if (menu.length > 0) { + gitbook.toolbar.createButton({ + icon: 'fa fa-share-alt', + label: 'Share', + position: 'right', + dropdown: [menu] + }); + } + + // Direct actions to share + $.each(SITES, function(sideId, site) { + if (!opts[sideId]) return; + + gitbook.toolbar.createButton({ + icon: site.icon, + label: site.text, + position: 'right', + onClick: site.onClick + }); + }); + }); +}); diff --git a/gitbook/gitbook/gitbook-plugin-splitter/splitter.css b/gitbook/gitbook/gitbook-plugin-splitter/splitter.css new file mode 100644 index 000000000..4e84720bf --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-splitter/splitter.css @@ -0,0 +1,22 @@ +.divider-content-summary { + position: absolute; + top: 0; + right: 0; + height: 100%; + width: 5px; + display: table; + cursor: col-resize; + color: #ccc; + -webkit-transition: color 350ms ease; + -moz-transition: color 350ms ease; + -o-transition: color 350ms ease; + transition: color 350ms ease +} +.divider-content-summary:hover { + color: #444; +} + .divider-content-summary__icon { + display: table-cell; + vertical-align: middle; + text-align: center; + } diff --git a/gitbook/gitbook/gitbook-plugin-splitter/splitter.js b/gitbook/gitbook/gitbook-plugin-splitter/splitter.js new file mode 100644 index 000000000..5034e5b15 --- /dev/null +++ b/gitbook/gitbook/gitbook-plugin-splitter/splitter.js @@ -0,0 +1,128 @@ +require(['gitbook', 'jQuery'], function (gitbook, $) { + + // MEMO: + // Gitbook is calculated as "calc (100% - 60px)" in the horizontal width when the width of the screen size is 600px + // or less. + // In this case, since contradiction occurs in the implementation of this module, return. + if($(window).width() <= 600) { + return; + } + + gitbook.events.bind('start', function () { + }); + + gitbook.events.bind('page.change', function () { + + var KEY_SPLIT_STATE = 'plugin_gitbook_split'; + + var dividerWidth = null; + var isDraggable = false; + var dividerCenterOffsetLeft = null; + var splitState = null; + var grabPointWidth = null; + + var $body = $('body'); + var $book = $('.book'); + var $summary = $('.book-summary'); + var $bookBody = $('.book-body'); + var $divider = $('<div class="divider-content-summary">' + + '<div class="divider-content-summary__icon">' + + '<i class="fa fa-ellipsis-v"></i>' + + '</div>' + + '</div>'); + + $summary.append($divider); + + dividerWidth = $divider.outerWidth(); + dividerCenterOffsetLeft = $divider.outerWidth() / 2; + + // restore split state from sessionStorage + splitState = getSplitState(); + setSplitState( + splitState.summaryWidth, + splitState.summaryOffset, + splitState.bookBodyOffset + ); + + setTimeout(function() { + var isGreaterThanEqualGitbookV2_5 = !Boolean($('.toggle-summary').length); + + var $toggleSummary = isGreaterThanEqualGitbookV2_5 + ? $('.fa.fa-align-justify').parent() : $('.toggle-summary'); + + $toggleSummary.on('click', function () { + + var summaryOffset = null; + var bookBodyOffset = null; + + var isOpen = isGreaterThanEqualGitbookV2_5 + ? !gitbook.sidebar.isOpen() : $book.hasClass('with-summary'); + + if (isOpen) { + summaryOffset = -($summary.outerWidth()); + bookBodyOffset = 0; + } else { + summaryOffset = 0; + bookBodyOffset = $summary.outerWidth(); + } + + setSplitState($summary.outerWidth(), summaryOffset, bookBodyOffset); + saveSplitState($summary.outerWidth(), summaryOffset, bookBodyOffset); + }); + }, 1); + + $divider.on('mousedown', function (event) { + event.stopPropagation(); + isDraggable = true; + grabPointWidth = $summary.outerWidth() - event.pageX; + }); + + $body.on('mouseup', function (event) { + event.stopPropagation(); + isDraggable = false; + saveSplitState( + $summary.outerWidth(), + $summary.position().left, + $bookBody.position().left + ); + }); + + $body.on('mousemove', function (event) { + if (!isDraggable) { + return; + } + event.stopPropagation(); + event.preventDefault(); + $summary.outerWidth(event.pageX + grabPointWidth); + $bookBody.offset({ left: event.pageX + grabPointWidth }); + }); + + function getSplitState() { + var splitState = JSON.parse(sessionStorage.getItem(KEY_SPLIT_STATE)); + splitState || (splitState = {}); + splitState.summaryWidth || (splitState.summaryWidth = $summary.outerWidth()); + splitState.summaryOffset || (splitState.summaryOffset = $summary.position().left); + splitState.bookBodyOffset || (splitState.bookBodyOffset = $bookBody.position().left); + return splitState; + } + + function saveSplitState(summaryWidth, summaryWidthOffset, bookBodyOffset) { + sessionStorage.setItem(KEY_SPLIT_STATE, JSON.stringify({ + summaryWidth: summaryWidth, + summaryOffset: summaryWidthOffset, + bookBodyOffset: bookBodyOffset, + })); + } + + function setSplitState(summaryWidth, summaryOffset, bookBodyOffset) { + $summary.outerWidth(summaryWidth); + $summary.offset({ left: summaryOffset }); + $bookBody.offset({ left: bookBodyOffset }); + // improved broken layout in windows chrome. + // "$(x).offset" automatically add to "position:relative". + // but it cause layout broken.. + $summary.css({ position: 'absolute' }); + $bookBody.css({ position: 'absolute' }); + } + }); +}); diff --git a/gitbook/gitbook/gitbook.js b/gitbook/gitbook/gitbook.js new file mode 100644 index 000000000..13077b45c --- /dev/null +++ b/gitbook/gitbook/gitbook.js @@ -0,0 +1,4 @@ +!function e(t,n,r){function o(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return o(n?n:e)},l,l.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,t,n){!function(e,n){"use strict";"object"==typeof t&&"object"==typeof t.exports?t.exports=e.document?n(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";function n(e,t){t=t||te;var n=t.createElement("script");n.text=e,t.head.appendChild(n).parentNode.removeChild(n)}function r(e){var t=!!e&&"length"in e&&e.length,n=de.type(e);return"function"!==n&&!de.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function o(e,t,n){return de.isFunction(t)?de.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?de.grep(e,function(e){return e===t!==n}):"string"!=typeof t?de.grep(e,function(e){return se.call(t,e)>-1!==n}):je.test(t)?de.filter(t,e,n):(t=de.filter(t,e),de.grep(e,function(e){return se.call(t,e)>-1!==n&&1===e.nodeType}))}function i(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function s(e){var t={};return de.each(e.match(qe)||[],function(e,n){t[n]=!0}),t}function a(e){return e}function u(e){throw e}function c(e,t,n){var r;try{e&&de.isFunction(r=e.promise)?r.call(e).done(t).fail(n):e&&de.isFunction(r=e.then)?r.call(e,t,n):t.call(void 0,e)}catch(e){n.call(void 0,e)}}function l(){te.removeEventListener("DOMContentLoaded",l),e.removeEventListener("load",l),de.ready()}function f(){this.expando=de.expando+f.uid++}function p(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Ie.test(e)?JSON.parse(e):e)}function h(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(Pe,"-$&").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n=p(n)}catch(e){}Re.set(e,t,n)}else n=void 0;return n}function d(e,t,n,r){var o,i=1,s=20,a=r?function(){return r.cur()}:function(){return de.css(e,t,"")},u=a(),c=n&&n[3]||(de.cssNumber[t]?"":"px"),l=(de.cssNumber[t]||"px"!==c&&+u)&&$e.exec(de.css(e,t));if(l&&l[3]!==c){c=c||l[3],n=n||[],l=+u||1;do i=i||".5",l/=i,de.style(e,t,l+c);while(i!==(i=a()/u)&&1!==i&&--s)}return n&&(l=+l||+u||0,o=n[1]?l+(n[1]+1)*n[2]:+n[2],r&&(r.unit=c,r.start=l,r.end=o)),o}function g(e){var t,n=e.ownerDocument,r=e.nodeName,o=Ue[r];return o?o:(t=n.body.appendChild(n.createElement(r)),o=de.css(t,"display"),t.parentNode.removeChild(t),"none"===o&&(o="block"),Ue[r]=o,o)}function m(e,t){for(var n,r,o=[],i=0,s=e.length;i<s;i++)r=e[i],r.style&&(n=r.style.display,t?("none"===n&&(o[i]=Fe.get(r,"display")||null,o[i]||(r.style.display="")),""===r.style.display&&Be(r)&&(o[i]=g(r))):"none"!==n&&(o[i]="none",Fe.set(r,"display",n)));for(i=0;i<s;i++)null!=o[i]&&(e[i].style.display=o[i]);return e}function v(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&de.nodeName(e,t)?de.merge([e],n):n}function y(e,t){for(var n=0,r=e.length;n<r;n++)Fe.set(e[n],"globalEval",!t||Fe.get(t[n],"globalEval"))}function x(e,t,n,r,o){for(var i,s,a,u,c,l,f=t.createDocumentFragment(),p=[],h=0,d=e.length;h<d;h++)if(i=e[h],i||0===i)if("object"===de.type(i))de.merge(p,i.nodeType?[i]:i);else if(Ye.test(i)){for(s=s||f.appendChild(t.createElement("div")),a=(Xe.exec(i)||["",""])[1].toLowerCase(),u=Ge[a]||Ge._default,s.innerHTML=u[1]+de.htmlPrefilter(i)+u[2],l=u[0];l--;)s=s.lastChild;de.merge(p,s.childNodes),s=f.firstChild,s.textContent=""}else p.push(t.createTextNode(i));for(f.textContent="",h=0;i=p[h++];)if(r&&de.inArray(i,r)>-1)o&&o.push(i);else if(c=de.contains(i.ownerDocument,i),s=v(f.appendChild(i),"script"),c&&y(s),n)for(l=0;i=s[l++];)Ve.test(i.type||"")&&n.push(i);return f}function b(){return!0}function w(){return!1}function T(){try{return te.activeElement}catch(e){}}function C(e,t,n,r,o,i){var s,a;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(a in t)C(e,a,n,r,t[a],i);return e}if(null==r&&null==o?(o=n,r=n=void 0):null==o&&("string"==typeof n?(o=r,r=void 0):(o=r,r=n,n=void 0)),o===!1)o=w;else if(!o)return e;return 1===i&&(s=o,o=function(e){return de().off(e),s.apply(this,arguments)},o.guid=s.guid||(s.guid=de.guid++)),e.each(function(){de.event.add(this,t,o,r,n)})}function j(e,t){return de.nodeName(e,"table")&&de.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e:e}function k(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function E(e){var t=rt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function S(e,t){var n,r,o,i,s,a,u,c;if(1===t.nodeType){if(Fe.hasData(e)&&(i=Fe.access(e),s=Fe.set(t,i),c=i.events)){delete s.handle,s.events={};for(o in c)for(n=0,r=c[o].length;n<r;n++)de.event.add(t,o,c[o][n])}Re.hasData(e)&&(a=Re.access(e),u=de.extend({},a),Re.set(t,u))}}function N(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ze.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function A(e,t,r,o){t=oe.apply([],t);var i,s,a,u,c,l,f=0,p=e.length,h=p-1,d=t[0],g=de.isFunction(d);if(g||p>1&&"string"==typeof d&&!pe.checkClone&&nt.test(d))return e.each(function(n){var i=e.eq(n);g&&(t[0]=d.call(this,n,i.html())),A(i,t,r,o)});if(p&&(i=x(t,e[0].ownerDocument,!1,e,o),s=i.firstChild,1===i.childNodes.length&&(i=s),s||o)){for(a=de.map(v(i,"script"),k),u=a.length;f<p;f++)c=i,f!==h&&(c=de.clone(c,!0,!0),u&&de.merge(a,v(c,"script"))),r.call(e[f],c,f);if(u)for(l=a[a.length-1].ownerDocument,de.map(a,E),f=0;f<u;f++)c=a[f],Ve.test(c.type||"")&&!Fe.access(c,"globalEval")&&de.contains(l,c)&&(c.src?de._evalUrl&&de._evalUrl(c.src):n(c.textContent.replace(ot,""),l))}return e}function q(e,t,n){for(var r,o=t?de.filter(t,e):e,i=0;null!=(r=o[i]);i++)n||1!==r.nodeType||de.cleanData(v(r)),r.parentNode&&(n&&de.contains(r.ownerDocument,r)&&y(v(r,"script")),r.parentNode.removeChild(r));return e}function D(e,t,n){var r,o,i,s,a=e.style;return n=n||at(e),n&&(s=n.getPropertyValue(t)||n[t],""!==s||de.contains(e.ownerDocument,e)||(s=de.style(e,t)),!pe.pixelMarginRight()&&st.test(s)&&it.test(t)&&(r=a.width,o=a.minWidth,i=a.maxWidth,a.minWidth=a.maxWidth=a.width=s,s=n.width,a.width=r,a.minWidth=o,a.maxWidth=i)),void 0!==s?s+"":s}function O(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function L(e){if(e in pt)return e;for(var t=e[0].toUpperCase()+e.slice(1),n=ft.length;n--;)if(e=ft[n]+t,e in pt)return e}function H(e,t,n){var r=$e.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function F(e,t,n,r,o){var i,s=0;for(i=n===(r?"border":"content")?4:"width"===t?1:0;i<4;i+=2)"margin"===n&&(s+=de.css(e,n+We[i],!0,o)),r?("content"===n&&(s-=de.css(e,"padding"+We[i],!0,o)),"margin"!==n&&(s-=de.css(e,"border"+We[i]+"Width",!0,o))):(s+=de.css(e,"padding"+We[i],!0,o),"padding"!==n&&(s+=de.css(e,"border"+We[i]+"Width",!0,o)));return s}function R(e,t,n){var r,o=!0,i=at(e),s="border-box"===de.css(e,"boxSizing",!1,i);if(e.getClientRects().length&&(r=e.getBoundingClientRect()[t]),r<=0||null==r){if(r=D(e,t,i),(r<0||null==r)&&(r=e.style[t]),st.test(r))return r;o=s&&(pe.boxSizingReliable()||r===e.style[t]),r=parseFloat(r)||0}return r+F(e,t,n||(s?"border":"content"),o,i)+"px"}function I(e,t,n,r,o){return new I.prototype.init(e,t,n,r,o)}function P(){dt&&(e.requestAnimationFrame(P),de.fx.tick())}function M(){return e.setTimeout(function(){ht=void 0}),ht=de.now()}function $(e,t){var n,r=0,o={height:e};for(t=t?1:0;r<4;r+=2-t)n=We[r],o["margin"+n]=o["padding"+n]=e;return t&&(o.opacity=o.width=e),o}function W(e,t,n){for(var r,o=(U.tweeners[t]||[]).concat(U.tweeners["*"]),i=0,s=o.length;i<s;i++)if(r=o[i].call(n,t,e))return r}function B(e,t,n){var r,o,i,s,a,u,c,l,f="width"in t||"height"in t,p=this,h={},d=e.style,g=e.nodeType&&Be(e),v=Fe.get(e,"fxshow");n.queue||(s=de._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,a=s.empty.fire,s.empty.fire=function(){s.unqueued||a()}),s.unqueued++,p.always(function(){p.always(function(){s.unqueued--,de.queue(e,"fx").length||s.empty.fire()})}));for(r in t)if(o=t[r],gt.test(o)){if(delete t[r],i=i||"toggle"===o,o===(g?"hide":"show")){if("show"!==o||!v||void 0===v[r])continue;g=!0}h[r]=v&&v[r]||de.style(e,r)}if(u=!de.isEmptyObject(t),u||!de.isEmptyObject(h)){f&&1===e.nodeType&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],c=v&&v.display,null==c&&(c=Fe.get(e,"display")),l=de.css(e,"display"),"none"===l&&(c?l=c:(m([e],!0),c=e.style.display||c,l=de.css(e,"display"),m([e]))),("inline"===l||"inline-block"===l&&null!=c)&&"none"===de.css(e,"float")&&(u||(p.done(function(){d.display=c}),null==c&&(l=d.display,c="none"===l?"":l)),d.display="inline-block")),n.overflow&&(d.overflow="hidden",p.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]})),u=!1;for(r in h)u||(v?"hidden"in v&&(g=v.hidden):v=Fe.access(e,"fxshow",{display:c}),i&&(v.hidden=!g),g&&m([e],!0),p.done(function(){g||m([e]),Fe.remove(e,"fxshow");for(r in h)de.style(e,r,h[r])})),u=W(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}}function _(e,t){var n,r,o,i,s;for(n in e)if(r=de.camelCase(n),o=t[r],i=e[n],de.isArray(i)&&(o=i[1],i=e[n]=i[0]),n!==r&&(e[r]=i,delete e[n]),s=de.cssHooks[r],s&&"expand"in s){i=s.expand(i),delete e[r];for(n in i)n in e||(e[n]=i[n],t[n]=o)}else t[r]=o}function U(e,t,n){var r,o,i=0,s=U.prefilters.length,a=de.Deferred().always(function(){delete u.elem}),u=function(){if(o)return!1;for(var t=ht||M(),n=Math.max(0,c.startTime+c.duration-t),r=n/c.duration||0,i=1-r,s=0,u=c.tweens.length;s<u;s++)c.tweens[s].run(i);return a.notifyWith(e,[c,i,n]),i<1&&u?n:(a.resolveWith(e,[c]),!1)},c=a.promise({elem:e,props:de.extend({},t),opts:de.extend(!0,{specialEasing:{},easing:de.easing._default},n),originalProperties:t,originalOptions:n,startTime:ht||M(),duration:n.duration,tweens:[],createTween:function(t,n){var r=de.Tween(e,c.opts,t,n,c.opts.specialEasing[t]||c.opts.easing);return c.tweens.push(r),r},stop:function(t){var n=0,r=t?c.tweens.length:0;if(o)return this;for(o=!0;n<r;n++)c.tweens[n].run(1);return t?(a.notifyWith(e,[c,1,0]),a.resolveWith(e,[c,t])):a.rejectWith(e,[c,t]),this}}),l=c.props;for(_(l,c.opts.specialEasing);i<s;i++)if(r=U.prefilters[i].call(c,e,l,c.opts))return de.isFunction(r.stop)&&(de._queueHooks(c.elem,c.opts.queue).stop=de.proxy(r.stop,r)),r;return de.map(l,W,c),de.isFunction(c.opts.start)&&c.opts.start.call(e,c),de.fx.timer(de.extend(u,{elem:e,anim:c,queue:c.opts.queue})),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always)}function z(e){var t=e.match(qe)||[];return t.join(" ")}function X(e){return e.getAttribute&&e.getAttribute("class")||""}function V(e,t,n,r){var o;if(de.isArray(t))de.each(t,function(t,o){n||Et.test(e)?r(e,o):V(e+"["+("object"==typeof o&&null!=o?t:"")+"]",o,n,r)});else if(n||"object"!==de.type(t))r(e,t);else for(o in t)V(e+"["+o+"]",t[o],n,r)}function G(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o=0,i=t.toLowerCase().match(qe)||[];if(de.isFunction(n))for(;r=i[o++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function Y(e,t,n,r){function o(a){var u;return i[a]=!0,de.each(e[a]||[],function(e,a){var c=a(t,n,r);return"string"!=typeof c||s||i[c]?s?!(u=c):void 0:(t.dataTypes.unshift(c),o(c),!1)}),u}var i={},s=e===Pt;return o(t.dataTypes[0])||!i["*"]&&o("*")}function Q(e,t){var n,r,o=de.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((o[n]?e:r||(r={}))[n]=t[n]);return r&&de.extend(!0,e,r),e}function J(e,t,n){for(var r,o,i,s,a=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(o in a)if(a[o]&&a[o].test(r)){u.unshift(o);break}if(u[0]in n)i=u[0];else{for(o in n){if(!u[0]||e.converters[o+" "+u[0]]){i=o;break}s||(s=o)}i=i||s}if(i)return i!==u[0]&&u.unshift(i),n[i]}function K(e,t,n,r){var o,i,s,a,u,c={},l=e.dataTypes.slice();if(l[1])for(s in e.converters)c[s.toLowerCase()]=e.converters[s];for(i=l.shift();i;)if(e.responseFields[i]&&(n[e.responseFields[i]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=i,i=l.shift())if("*"===i)i=u;else if("*"!==u&&u!==i){if(s=c[u+" "+i]||c["* "+i],!s)for(o in c)if(a=o.split(" "),a[1]===i&&(s=c[u+" "+a[0]]||c["* "+a[0]])){s===!0?s=c[o]:c[o]!==!0&&(i=a[0],l.unshift(a[1]));break}if(s!==!0)if(s&&e.throws)t=s(t);else try{t=s(t)}catch(e){return{state:"parsererror",error:s?e:"No conversion from "+u+" to "+i}}}return{state:"success",data:t}}function Z(e){return de.isWindow(e)?e:9===e.nodeType&&e.defaultView}var ee=[],te=e.document,ne=Object.getPrototypeOf,re=ee.slice,oe=ee.concat,ie=ee.push,se=ee.indexOf,ae={},ue=ae.toString,ce=ae.hasOwnProperty,le=ce.toString,fe=le.call(Object),pe={},he="3.1.1",de=function(e,t){return new de.fn.init(e,t)},ge=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,me=/^-ms-/,ve=/-([a-z])/g,ye=function(e,t){return t.toUpperCase()};de.fn=de.prototype={jquery:he,constructor:de,length:0,toArray:function(){return re.call(this)},get:function(e){return null==e?re.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=de.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return de.each(this,e)},map:function(e){return this.pushStack(de.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(re.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:ie,sort:ee.sort,splice:ee.splice},de.extend=de.fn.extend=function(){var e,t,n,r,o,i,s=arguments[0]||{},a=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[a]||{},a++),"object"==typeof s||de.isFunction(s)||(s={}),a===u&&(s=this,a--);a<u;a++)if(null!=(e=arguments[a]))for(t in e)n=s[t],r=e[t],s!==r&&(c&&r&&(de.isPlainObject(r)||(o=de.isArray(r)))?(o?(o=!1,i=n&&de.isArray(n)?n:[]):i=n&&de.isPlainObject(n)?n:{},s[t]=de.extend(c,i,r)):void 0!==r&&(s[t]=r));return s},de.extend({expando:"jQuery"+(he+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===de.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){var t=de.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==ue.call(e))&&(!(t=ne(e))||(n=ce.call(t,"constructor")&&t.constructor,"function"==typeof n&&le.call(n)===fe))},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?ae[ue.call(e)]||"object":typeof e},globalEval:function(e){n(e)},camelCase:function(e){return e.replace(me,"ms-").replace(ve,ye)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var n,o=0;if(r(e))for(n=e.length;o<n&&t.call(e[o],o,e[o])!==!1;o++);else for(o in e)if(t.call(e[o],o,e[o])===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(ge,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(r(Object(e))?de.merge(n,"string"==typeof e?[e]:e):ie.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:se.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,o=e.length;r<n;r++)e[o++]=t[r];return e.length=o,e},grep:function(e,t,n){for(var r,o=[],i=0,s=e.length,a=!n;i<s;i++)r=!t(e[i],i),r!==a&&o.push(e[i]);return o},map:function(e,t,n){var o,i,s=0,a=[];if(r(e))for(o=e.length;s<o;s++)i=t(e[s],s,n),null!=i&&a.push(i);else for(s in e)i=t(e[s],s,n),null!=i&&a.push(i);return oe.apply([],a)},guid:1,proxy:function(e,t){var n,r,o;if("string"==typeof t&&(n=e[t],t=e,e=n),de.isFunction(e))return r=re.call(arguments,2),o=function(){return e.apply(t||this,r.concat(re.call(arguments)))},o.guid=e.guid=e.guid||de.guid++,o},now:Date.now,support:pe}),"function"==typeof Symbol&&(de.fn[Symbol.iterator]=ee[Symbol.iterator]),de.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){ae["[object "+t+"]"]=t.toLowerCase()});var xe=function(e){function t(e,t,n,r){var o,i,s,a,u,c,l,p=t&&t.ownerDocument,d=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==d&&9!==d&&11!==d)return n;if(!r&&((t?t.ownerDocument||t:W)!==L&&O(t),t=t||L,F)){if(11!==d&&(u=ve.exec(e)))if(o=u[1]){if(9===d){if(!(s=t.getElementById(o)))return n;if(s.id===o)return n.push(s),n}else if(p&&(s=p.getElementById(o))&&M(t,s)&&s.id===o)return n.push(s),n}else{if(u[2])return K.apply(n,t.getElementsByTagName(e)),n;if((o=u[3])&&T.getElementsByClassName&&t.getElementsByClassName)return K.apply(n,t.getElementsByClassName(o)),n}if(T.qsa&&!X[e+" "]&&(!R||!R.test(e))){if(1!==d)p=t,l=e;else if("object"!==t.nodeName.toLowerCase()){for((a=t.getAttribute("id"))?a=a.replace(we,Te):t.setAttribute("id",a=$),c=E(e),i=c.length;i--;)c[i]="#"+a+" "+h(c[i]);l=c.join(","),p=ye.test(e)&&f(t.parentNode)||t}if(l)try{return K.apply(n,p.querySelectorAll(l)),n}catch(e){}finally{a===$&&t.removeAttribute("id")}}}return N(e.replace(ae,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>C.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[$]=!0,e}function o(e){var t=L.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function i(e,t){for(var n=e.split("|"),r=n.length;r--;)C.attrHandle[n[r]]=t}function s(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function a(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function c(e){return function(t){return"form"in t?t.parentNode&&t.disabled===!1?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&je(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function l(e){return r(function(t){return t=+t,r(function(n,r){for(var o,i=e([],n.length,t),s=i.length;s--;)n[o=i[s]]&&(n[o]=!(r[o]=n[o]))})})}function f(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function p(){}function h(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function d(e,t,n){var r=t.dir,o=t.next,i=o||r,s=n&&"parentNode"===i,a=_++;return t.first?function(t,n,o){for(;t=t[r];)if(1===t.nodeType||s)return e(t,n,o);return!1}:function(t,n,u){var c,l,f,p=[B,a];if(u){for(;t=t[r];)if((1===t.nodeType||s)&&e(t,n,u))return!0}else for(;t=t[r];)if(1===t.nodeType||s)if(f=t[$]||(t[$]={}),l=f[t.uniqueID]||(f[t.uniqueID]={}),o&&o===t.nodeName.toLowerCase())t=t[r]||t;else{if((c=l[i])&&c[0]===B&&c[1]===a)return p[2]=c[2];if(l[i]=p,p[2]=e(t,n,u))return!0}return!1}}function g(e){return e.length>1?function(t,n,r){for(var o=e.length;o--;)if(!e[o](t,n,r))return!1;return!0}:e[0]}function m(e,n,r){for(var o=0,i=n.length;o<i;o++)t(e,n[o],r);return r}function v(e,t,n,r,o){for(var i,s=[],a=0,u=e.length,c=null!=t;a<u;a++)(i=e[a])&&(n&&!n(i,r,o)||(s.push(i),c&&t.push(a)));return s}function y(e,t,n,o,i,s){return o&&!o[$]&&(o=y(o)),i&&!i[$]&&(i=y(i,s)),r(function(r,s,a,u){var c,l,f,p=[],h=[],d=s.length,g=r||m(t||"*",a.nodeType?[a]:a,[]),y=!e||!r&&t?g:v(g,p,e,a,u),x=n?i||(r?e:d||o)?[]:s:y;if(n&&n(y,x,a,u),o)for(c=v(x,h),o(c,[],a,u),l=c.length;l--;)(f=c[l])&&(x[h[l]]=!(y[h[l]]=f));if(r){if(i||e){if(i){for(c=[],l=x.length;l--;)(f=x[l])&&c.push(y[l]=f);i(null,x=[],c,u)}for(l=x.length;l--;)(f=x[l])&&(c=i?ee(r,f):p[l])>-1&&(r[c]=!(s[c]=f))}}else x=v(x===s?x.splice(d,x.length):x),i?i(null,s,x,u):K.apply(s,x)})}function x(e){for(var t,n,r,o=e.length,i=C.relative[e[0].type],s=i||C.relative[" "],a=i?1:0,u=d(function(e){return e===t},s,!0),c=d(function(e){return ee(t,e)>-1},s,!0),l=[function(e,n,r){var o=!i&&(r||n!==A)||((t=n).nodeType?u(e,n,r):c(e,n,r));return t=null,o}];a<o;a++)if(n=C.relative[e[a].type])l=[d(g(l),n)];else{if(n=C.filter[e[a].type].apply(null,e[a].matches),n[$]){for(r=++a;r<o&&!C.relative[e[r].type];r++);return y(a>1&&g(l),a>1&&h(e.slice(0,a-1).concat({value:" "===e[a-2].type?"*":""})).replace(ae,"$1"),n,a<r&&x(e.slice(a,r)),r<o&&x(e=e.slice(r)),r<o&&h(e))}l.push(n)}return g(l)}function b(e,n){var o=n.length>0,i=e.length>0,s=function(r,s,a,u,c){var l,f,p,h=0,d="0",g=r&&[],m=[],y=A,x=r||i&&C.find.TAG("*",c),b=B+=null==y?1:Math.random()||.1,w=x.length;for(c&&(A=s===L||s||c);d!==w&&null!=(l=x[d]);d++){if(i&&l){for(f=0,s||l.ownerDocument===L||(O(l),a=!F);p=e[f++];)if(p(l,s||L,a)){u.push(l);break}c&&(B=b)}o&&((l=!p&&l)&&h--,r&&g.push(l))}if(h+=d,o&&d!==h){for(f=0;p=n[f++];)p(g,m,s,a);if(r){if(h>0)for(;d--;)g[d]||m[d]||(m[d]=Q.call(u));m=v(m)}K.apply(u,m),c&&!r&&m.length>0&&h+n.length>1&&t.uniqueSort(u)}return c&&(B=b,A=y),g};return o?r(s):s}var w,T,C,j,k,E,S,N,A,q,D,O,L,H,F,R,I,P,M,$="sizzle"+1*new Date,W=e.document,B=0,_=0,U=n(),z=n(),X=n(),V=function(e,t){return e===t&&(D=!0),0},G={}.hasOwnProperty,Y=[],Q=Y.pop,J=Y.push,K=Y.push,Z=Y.slice,ee=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},te="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",re="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",oe="\\["+ne+"*("+re+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+re+"))|)"+ne+"*\\]",ie=":("+re+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+oe+")*)|.*)\\)|)",se=new RegExp(ne+"+","g"),ae=new RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),ue=new RegExp("^"+ne+"*,"+ne+"*"),ce=new RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),le=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(ie),pe=new RegExp("^"+re+"$"),he={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+oe),PSEUDO:new RegExp("^"+ie),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},de=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,ve=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ye=/[+~]/,xe=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),be=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},we=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,Te=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},Ce=function(){O()},je=d(function(e){return e.disabled===!0&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{K.apply(Y=Z.call(W.childNodes),W.childNodes),Y[W.childNodes.length].nodeType}catch(e){K={apply:Y.length?function(e,t){J.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}T=t.support={},k=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},O=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:W;return r!==L&&9===r.nodeType&&r.documentElement?(L=r,H=L.documentElement,F=!k(L),W!==L&&(n=L.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Ce,!1):n.attachEvent&&n.attachEvent("onunload",Ce)),T.attributes=o(function(e){return e.className="i",!e.getAttribute("className")}),T.getElementsByTagName=o(function(e){return e.appendChild(L.createComment("")),!e.getElementsByTagName("*").length}),T.getElementsByClassName=me.test(L.getElementsByClassName),T.getById=o(function(e){return H.appendChild(e).id=$,!L.getElementsByName||!L.getElementsByName($).length}),T.getById?(C.filter.ID=function(e){var t=e.replace(xe,be);return function(e){return e.getAttribute("id")===t}},C.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&F){var n=t.getElementById(e);return n?[n]:[]}}):(C.filter.ID=function(e){var t=e.replace(xe,be);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},C.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&F){var n,r,o,i=t.getElementById(e);if(i){if(n=i.getAttributeNode("id"),n&&n.value===e)return[i];for(o=t.getElementsByName(e),r=0;i=o[r++];)if(n=i.getAttributeNode("id"),n&&n.value===e)return[i]}return[]}}),C.find.TAG=T.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):T.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],o=0,i=t.getElementsByTagName(e);if("*"===e){for(;n=i[o++];)1===n.nodeType&&r.push(n);return r}return i},C.find.CLASS=T.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&F)return t.getElementsByClassName(e)},I=[],R=[],(T.qsa=me.test(L.querySelectorAll))&&(o(function(e){H.appendChild(e).innerHTML="<a id='"+$+"'></a><select id='"+$+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&R.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||R.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+$+"-]").length||R.push("~="),e.querySelectorAll(":checked").length||R.push(":checked"),e.querySelectorAll("a#"+$+"+*").length||R.push(".#.+[+~]")}),o(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=L.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&R.push("name"+ne+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&R.push(":enabled",":disabled"),H.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&R.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),R.push(",.*:")})),(T.matchesSelector=me.test(P=H.matches||H.webkitMatchesSelector||H.mozMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&o(function(e){T.disconnectedMatch=P.call(e,"*"),P.call(e,"[s!='']:x"),I.push("!=",ie)}),R=R.length&&new RegExp(R.join("|")),I=I.length&&new RegExp(I.join("|")),t=me.test(H.compareDocumentPosition),M=t||me.test(H.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},V=t?function(e,t){if(e===t)return D=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!T.sortDetached&&t.compareDocumentPosition(e)===n?e===L||e.ownerDocument===W&&M(W,e)?-1:t===L||t.ownerDocument===W&&M(W,t)?1:q?ee(q,e)-ee(q,t):0:4&n?-1:1)}:function(e,t){if(e===t)return D=!0,0;var n,r=0,o=e.parentNode,i=t.parentNode,a=[e],u=[t];if(!o||!i)return e===L?-1:t===L?1:o?-1:i?1:q?ee(q,e)-ee(q,t):0;if(o===i)return s(e,t);for(n=e;n=n.parentNode;)a.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;a[r]===u[r];)r++;return r?s(a[r],u[r]):a[r]===W?-1:u[r]===W?1:0},L):L},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==L&&O(e),n=n.replace(le,"='$1']"),T.matchesSelector&&F&&!X[n+" "]&&(!I||!I.test(n))&&(!R||!R.test(n)))try{var r=P.call(e,n);if(r||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return t(n,L,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==L&&O(e),M(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==L&&O(e);var n=C.attrHandle[t.toLowerCase()],r=n&&G.call(C.attrHandle,t.toLowerCase())?n(e,t,!F):void 0;return void 0!==r?r:T.attributes||!F?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.escape=function(e){return(e+"").replace(we,Te)},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,o=0;if(D=!T.detectDuplicates,q=!T.sortStable&&e.slice(0),e.sort(V),D){for(;t=e[o++];)t===e[o]&&(r=n.push(o));for(;r--;)e.splice(n[r],1)}return q=null,e},j=t.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=j(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r++];)n+=j(t);return n},C=t.selectors={cacheLength:50,createPseudo:r,match:he,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(xe,be),e[3]=(e[3]||e[4]||e[5]||"").replace(xe,be),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return he.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&fe.test(n)&&(t=E(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(xe,be).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=U[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&U(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(o){var i=t.attr(o,e);return null==i?"!="===n:!n||(i+="","="===n?i===r:"!="===n?i!==r:"^="===n?r&&0===i.indexOf(r):"*="===n?r&&i.indexOf(r)>-1:"$="===n?r&&i.slice(-r.length)===r:"~="===n?(" "+i.replace(se," ")+" ").indexOf(r)>-1:"|="===n&&(i===r||i.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,o){var i="nth"!==e.slice(0,3),s="last"!==e.slice(-4),a="of-type"===t;return 1===r&&0===o?function(e){return!!e.parentNode}:function(t,n,u){var c,l,f,p,h,d,g=i!==s?"nextSibling":"previousSibling",m=t.parentNode,v=a&&t.nodeName.toLowerCase(),y=!u&&!a,x=!1;if(m){if(i){for(;g;){for(p=t;p=p[g];)if(a?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[s?m.firstChild:m.lastChild],s&&y){for(p=m,f=p[$]||(p[$]={}),l=f[p.uniqueID]||(f[p.uniqueID]={}),c=l[e]||[],h=c[0]===B&&c[1],x=h&&c[2],p=h&&m.childNodes[h];p=++h&&p&&p[g]||(x=h=0)||d.pop();)if(1===p.nodeType&&++x&&p===t){l[e]=[B,h,x];break}}else if(y&&(p=t,f=p[$]||(p[$]={}),l=f[p.uniqueID]||(f[p.uniqueID]={}),c=l[e]||[],h=c[0]===B&&c[1],x=h),x===!1)for(;(p=++h&&p&&p[g]||(x=h=0)||d.pop())&&((a?p.nodeName.toLowerCase()!==v:1!==p.nodeType)||!++x||(y&&(f=p[$]||(p[$]={}),l=f[p.uniqueID]||(f[p.uniqueID]={}),l[e]=[B,x]),p!==t)););return x-=o,x===r||x%r===0&&x/r>=0}}},PSEUDO:function(e,n){var o,i=C.pseudos[e]||C.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return i[$]?i(n):i.length>1?(o=[e,e,"",n],C.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,o=i(e,n),s=o.length;s--;)r=ee(e,o[s]),e[r]=!(t[r]=o[s])}):function(e){return i(e,0,o)}):i}},pseudos:{not:r(function(e){var t=[],n=[],o=S(e.replace(ae,"$1"));return o[$]?r(function(e,t,n,r){for(var i,s=o(e,null,r,[]),a=e.length;a--;)(i=s[a])&&(e[a]=!(t[a]=i))}):function(e,r,i){return t[0]=e,o(t,null,i,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){ +return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(xe,be),function(t){return(t.textContent||t.innerText||j(t)).indexOf(e)>-1}}),lang:r(function(e){return pe.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(xe,be).toLowerCase(),function(t){var n;do if(n=F?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===H},focus:function(e){return e===L.activeElement&&(!L.hasFocus||L.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:c(!1),disabled:c(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!C.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return de.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:l(function(){return[0]}),last:l(function(e,t){return[t-1]}),eq:l(function(e,t,n){return[n<0?n+t:n]}),even:l(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:l(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:l(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:l(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},C.pseudos.nth=C.pseudos.eq;for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})C.pseudos[w]=a(w);for(w in{submit:!0,reset:!0})C.pseudos[w]=u(w);return p.prototype=C.filters=C.pseudos,C.setFilters=new p,E=t.tokenize=function(e,n){var r,o,i,s,a,u,c,l=z[e+" "];if(l)return n?0:l.slice(0);for(a=e,u=[],c=C.preFilter;a;){r&&!(o=ue.exec(a))||(o&&(a=a.slice(o[0].length)||a),u.push(i=[])),r=!1,(o=ce.exec(a))&&(r=o.shift(),i.push({value:r,type:o[0].replace(ae," ")}),a=a.slice(r.length));for(s in C.filter)!(o=he[s].exec(a))||c[s]&&!(o=c[s](o))||(r=o.shift(),i.push({value:r,type:s,matches:o}),a=a.slice(r.length));if(!r)break}return n?a.length:a?t.error(e):z(e,u).slice(0)},S=t.compile=function(e,t){var n,r=[],o=[],i=X[e+" "];if(!i){for(t||(t=E(e)),n=t.length;n--;)i=x(t[n]),i[$]?r.push(i):o.push(i);i=X(e,b(o,r)),i.selector=e}return i},N=t.select=function(e,t,n,r){var o,i,s,a,u,c="function"==typeof e&&e,l=!r&&E(e=c.selector||e);if(n=n||[],1===l.length){if(i=l[0]=l[0].slice(0),i.length>2&&"ID"===(s=i[0]).type&&9===t.nodeType&&F&&C.relative[i[1].type]){if(t=(C.find.ID(s.matches[0].replace(xe,be),t)||[])[0],!t)return n;c&&(t=t.parentNode),e=e.slice(i.shift().value.length)}for(o=he.needsContext.test(e)?0:i.length;o--&&(s=i[o],!C.relative[a=s.type]);)if((u=C.find[a])&&(r=u(s.matches[0].replace(xe,be),ye.test(i[0].type)&&f(t.parentNode)||t))){if(i.splice(o,1),e=r.length&&h(i),!e)return K.apply(n,r),n;break}}return(c||S(e,l))(r,t,!F,n,!t||ye.test(e)&&f(t.parentNode)||t),n},T.sortStable=$.split("").sort(V).join("")===$,T.detectDuplicates=!!D,O(),T.sortDetached=o(function(e){return 1&e.compareDocumentPosition(L.createElement("fieldset"))}),o(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||i("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),T.attributes&&o(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||i("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),o(function(e){return null==e.getAttribute("disabled")})||i(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);de.find=xe,de.expr=xe.selectors,de.expr[":"]=de.expr.pseudos,de.uniqueSort=de.unique=xe.uniqueSort,de.text=xe.getText,de.isXMLDoc=xe.isXML,de.contains=xe.contains,de.escapeSelector=xe.escape;var be=function(e,t,n){for(var r=[],o=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(o&&de(e).is(n))break;r.push(e)}return r},we=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},Te=de.expr.match.needsContext,Ce=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,je=/^.[^:#\[\.,]*$/;de.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?de.find.matchesSelector(r,e)?[r]:[]:de.find.matches(e,de.grep(t,function(e){return 1===e.nodeType}))},de.fn.extend({find:function(e){var t,n,r=this.length,o=this;if("string"!=typeof e)return this.pushStack(de(e).filter(function(){for(t=0;t<r;t++)if(de.contains(o[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)de.find(e,o[t],n);return r>1?de.uniqueSort(n):n},filter:function(e){return this.pushStack(o(this,e||[],!1))},not:function(e){return this.pushStack(o(this,e||[],!0))},is:function(e){return!!o(this,"string"==typeof e&&Te.test(e)?de(e):e||[],!1).length}});var ke,Ee=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,Se=de.fn.init=function(e,t,n){var r,o;if(!e)return this;if(n=n||ke,"string"==typeof e){if(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:Ee.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof de?t[0]:t,de.merge(this,de.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:te,!0)),Ce.test(r[1])&&de.isPlainObject(t))for(r in t)de.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return o=te.getElementById(r[2]),o&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):de.isFunction(e)?void 0!==n.ready?n.ready(e):e(de):de.makeArray(e,this)};Se.prototype=de.fn,ke=de(te);var Ne=/^(?:parents|prev(?:Until|All))/,Ae={children:!0,contents:!0,next:!0,prev:!0};de.fn.extend({has:function(e){var t=de(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(de.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,o=this.length,i=[],s="string"!=typeof e&&de(e);if(!Te.test(e))for(;r<o;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(s?s.index(n)>-1:1===n.nodeType&&de.find.matchesSelector(n,e))){i.push(n);break}return this.pushStack(i.length>1?de.uniqueSort(i):i)},index:function(e){return e?"string"==typeof e?se.call(de(e),this[0]):se.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(de.uniqueSort(de.merge(this.get(),de(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),de.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return be(e,"parentNode")},parentsUntil:function(e,t,n){return be(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return be(e,"nextSibling")},prevAll:function(e){return be(e,"previousSibling")},nextUntil:function(e,t,n){return be(e,"nextSibling",n)},prevUntil:function(e,t,n){return be(e,"previousSibling",n)},siblings:function(e){return we((e.parentNode||{}).firstChild,e)},children:function(e){return we(e.firstChild)},contents:function(e){return e.contentDocument||de.merge([],e.childNodes)}},function(e,t){de.fn[e]=function(n,r){var o=de.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(o=de.filter(r,o)),this.length>1&&(Ae[e]||de.uniqueSort(o),Ne.test(e)&&o.reverse()),this.pushStack(o)}});var qe=/[^\x20\t\r\n\f]+/g;de.Callbacks=function(e){e="string"==typeof e?s(e):de.extend({},e);var t,n,r,o,i=[],a=[],u=-1,c=function(){for(o=e.once,r=t=!0;a.length;u=-1)for(n=a.shift();++u<i.length;)i[u].apply(n[0],n[1])===!1&&e.stopOnFalse&&(u=i.length,n=!1);e.memory||(n=!1),t=!1,o&&(i=n?[]:"")},l={add:function(){return i&&(n&&!t&&(u=i.length-1,a.push(n)),function t(n){de.each(n,function(n,r){de.isFunction(r)?e.unique&&l.has(r)||i.push(r):r&&r.length&&"string"!==de.type(r)&&t(r)})}(arguments),n&&!t&&c()),this},remove:function(){return de.each(arguments,function(e,t){for(var n;(n=de.inArray(t,i,n))>-1;)i.splice(n,1),n<=u&&u--}),this},has:function(e){return e?de.inArray(e,i)>-1:i.length>0},empty:function(){return i&&(i=[]),this},disable:function(){return o=a=[],i=n="",this},disabled:function(){return!i},lock:function(){return o=a=[],n||t||(i=n=""),this},locked:function(){return!!o},fireWith:function(e,n){return o||(n=n||[],n=[e,n.slice?n.slice():n],a.push(n),t||c()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l},de.extend({Deferred:function(t){var n=[["notify","progress",de.Callbacks("memory"),de.Callbacks("memory"),2],["resolve","done",de.Callbacks("once memory"),de.Callbacks("once memory"),0,"resolved"],["reject","fail",de.Callbacks("once memory"),de.Callbacks("once memory"),1,"rejected"]],r="pending",o={state:function(){return r},always:function(){return i.done(arguments).fail(arguments),this},catch:function(e){return o.then(null,e)},pipe:function(){var e=arguments;return de.Deferred(function(t){de.each(n,function(n,r){var o=de.isFunction(e[r[4]])&&e[r[4]];i[r[1]](function(){var e=o&&o.apply(this,arguments);e&&de.isFunction(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,o?[e]:arguments)})}),e=null}).promise()},then:function(t,r,o){function i(t,n,r,o){return function(){var c=this,l=arguments,f=function(){var e,f;if(!(t<s)){if(e=r.apply(c,l),e===n.promise())throw new TypeError("Thenable self-resolution");f=e&&("object"==typeof e||"function"==typeof e)&&e.then,de.isFunction(f)?o?f.call(e,i(s,n,a,o),i(s,n,u,o)):(s++,f.call(e,i(s,n,a,o),i(s,n,u,o),i(s,n,a,n.notifyWith))):(r!==a&&(c=void 0,l=[e]),(o||n.resolveWith)(c,l))}},p=o?f:function(){try{f()}catch(e){de.Deferred.exceptionHook&&de.Deferred.exceptionHook(e,p.stackTrace),t+1>=s&&(r!==u&&(c=void 0,l=[e]),n.rejectWith(c,l))}};t?p():(de.Deferred.getStackHook&&(p.stackTrace=de.Deferred.getStackHook()),e.setTimeout(p))}}var s=0;return de.Deferred(function(e){n[0][3].add(i(0,e,de.isFunction(o)?o:a,e.notifyWith)),n[1][3].add(i(0,e,de.isFunction(t)?t:a)),n[2][3].add(i(0,e,de.isFunction(r)?r:u))}).promise()},promise:function(e){return null!=e?de.extend(e,o):o}},i={};return de.each(n,function(e,t){var s=t[2],a=t[5];o[t[1]]=s.add,a&&s.add(function(){r=a},n[3-e][2].disable,n[0][2].lock),s.add(t[3].fire),i[t[0]]=function(){return i[t[0]+"With"](this===i?void 0:this,arguments),this},i[t[0]+"With"]=s.fireWith}),o.promise(i),t&&t.call(i,i),i},when:function(e){var t=arguments.length,n=t,r=Array(n),o=re.call(arguments),i=de.Deferred(),s=function(e){return function(n){r[e]=this,o[e]=arguments.length>1?re.call(arguments):n,--t||i.resolveWith(r,o)}};if(t<=1&&(c(e,i.done(s(n)).resolve,i.reject),"pending"===i.state()||de.isFunction(o[n]&&o[n].then)))return i.then();for(;n--;)c(o[n],s(n),i.reject);return i.promise()}});var De=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;de.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&De.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},de.readyException=function(t){e.setTimeout(function(){throw t})};var Oe=de.Deferred();de.fn.ready=function(e){return Oe.then(e).catch(function(e){de.readyException(e)}),this},de.extend({isReady:!1,readyWait:1,holdReady:function(e){e?de.readyWait++:de.ready(!0)},ready:function(e){(e===!0?--de.readyWait:de.isReady)||(de.isReady=!0,e!==!0&&--de.readyWait>0||Oe.resolveWith(te,[de]))}}),de.ready.then=Oe.then,"complete"===te.readyState||"loading"!==te.readyState&&!te.documentElement.doScroll?e.setTimeout(de.ready):(te.addEventListener("DOMContentLoaded",l),e.addEventListener("load",l));var Le=function(e,t,n,r,o,i,s){var a=0,u=e.length,c=null==n;if("object"===de.type(n)){o=!0;for(a in n)Le(e,t,a,n[a],!0,i,s)}else if(void 0!==r&&(o=!0,de.isFunction(r)||(s=!0),c&&(s?(t.call(e,r),t=null):(c=t,t=function(e,t,n){return c.call(de(e),n)})),t))for(;a<u;a++)t(e[a],n,s?r:r.call(e[a],a,t(e[a],n)));return o?e:c?t.call(e):u?t(e[0],n):i},He=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};f.uid=1,f.prototype={cache:function(e){var t=e[this.expando];return t||(t={},He(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,o=this.cache(e);if("string"==typeof t)o[de.camelCase(t)]=n;else for(r in t)o[de.camelCase(r)]=t[r];return o},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][de.camelCase(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){de.isArray(t)?t=t.map(de.camelCase):(t=de.camelCase(t),t=t in r?[t]:t.match(qe)||[]),n=t.length;for(;n--;)delete r[t[n]]}(void 0===t||de.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!de.isEmptyObject(t)}};var Fe=new f,Re=new f,Ie=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Pe=/[A-Z]/g;de.extend({hasData:function(e){return Re.hasData(e)||Fe.hasData(e)},data:function(e,t,n){return Re.access(e,t,n)},removeData:function(e,t){Re.remove(e,t)},_data:function(e,t,n){return Fe.access(e,t,n)},_removeData:function(e,t){Fe.remove(e,t)}}),de.fn.extend({data:function(e,t){var n,r,o,i=this[0],s=i&&i.attributes;if(void 0===e){if(this.length&&(o=Re.get(i),1===i.nodeType&&!Fe.get(i,"hasDataAttrs"))){for(n=s.length;n--;)s[n]&&(r=s[n].name,0===r.indexOf("data-")&&(r=de.camelCase(r.slice(5)),h(i,r,o[r])));Fe.set(i,"hasDataAttrs",!0)}return o}return"object"==typeof e?this.each(function(){Re.set(this,e)}):Le(this,function(t){var n;if(i&&void 0===t){if(n=Re.get(i,e),void 0!==n)return n;if(n=h(i,e),void 0!==n)return n}else this.each(function(){Re.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){Re.remove(this,e)})}}),de.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Fe.get(e,t),n&&(!r||de.isArray(n)?r=Fe.access(e,t,de.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=de.queue(e,t),r=n.length,o=n.shift(),i=de._queueHooks(e,t),s=function(){de.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,s,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Fe.get(e,n)||Fe.access(e,n,{empty:de.Callbacks("once memory").add(function(){Fe.remove(e,[t+"queue",n])})})}}),de.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?de.queue(this[0],e):void 0===t?this:this.each(function(){var n=de.queue(this,e,t);de._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&de.dequeue(this,e)})},dequeue:function(e){return this.each(function(){de.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,o=de.Deferred(),i=this,s=this.length,a=function(){--r||o.resolveWith(i,[i])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";s--;)n=Fe.get(i[s],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(a));return a(),o.promise(t)}});var Me=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,$e=new RegExp("^(?:([+-])=|)("+Me+")([a-z%]*)$","i"),We=["Top","Right","Bottom","Left"],Be=function(e,t){return e=t||e,"none"===e.style.display||""===e.style.display&&de.contains(e.ownerDocument,e)&&"none"===de.css(e,"display")},_e=function(e,t,n,r){var o,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];o=n.apply(e,r||[]);for(i in t)e.style[i]=s[i];return o},Ue={};de.fn.extend({show:function(){return m(this,!0)},hide:function(){return m(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Be(this)?de(this).show():de(this).hide()})}});var ze=/^(?:checkbox|radio)$/i,Xe=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,Ve=/^$|\/(?:java|ecma)script/i,Ge={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Ge.optgroup=Ge.option,Ge.tbody=Ge.tfoot=Ge.colgroup=Ge.caption=Ge.thead,Ge.th=Ge.td;var Ye=/<|&#?\w+;/;!function(){var e=te.createDocumentFragment(),t=e.appendChild(te.createElement("div")),n=te.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),pe.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",pe.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var Qe=te.documentElement,Je=/^key/,Ke=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ze=/^([^.]*)(?:\.(.+)|)/;de.event={global:{},add:function(e,t,n,r,o){var i,s,a,u,c,l,f,p,h,d,g,m=Fe.get(e);if(m)for(n.handler&&(i=n,n=i.handler,o=i.selector),o&&de.find.matchesSelector(Qe,o),n.guid||(n.guid=de.guid++),(u=m.events)||(u=m.events={}),(s=m.handle)||(s=m.handle=function(t){return"undefined"!=typeof de&&de.event.triggered!==t.type?de.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(qe)||[""],c=t.length;c--;)a=Ze.exec(t[c])||[],h=g=a[1],d=(a[2]||"").split(".").sort(),h&&(f=de.event.special[h]||{},h=(o?f.delegateType:f.bindType)||h,f=de.event.special[h]||{},l=de.extend({type:h,origType:g,data:r,handler:n,guid:n.guid,selector:o,needsContext:o&&de.expr.match.needsContext.test(o),namespace:d.join(".")},i),(p=u[h])||(p=u[h]=[],p.delegateCount=0,f.setup&&f.setup.call(e,r,d,s)!==!1||e.addEventListener&&e.addEventListener(h,s)),f.add&&(f.add.call(e,l),l.handler.guid||(l.handler.guid=n.guid)),o?p.splice(p.delegateCount++,0,l):p.push(l),de.event.global[h]=!0)},remove:function(e,t,n,r,o){var i,s,a,u,c,l,f,p,h,d,g,m=Fe.hasData(e)&&Fe.get(e);if(m&&(u=m.events)){for(t=(t||"").match(qe)||[""],c=t.length;c--;)if(a=Ze.exec(t[c])||[],h=g=a[1],d=(a[2]||"").split(".").sort(),h){for(f=de.event.special[h]||{},h=(r?f.delegateType:f.bindType)||h,p=u[h]||[],a=a[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),s=i=p.length;i--;)l=p[i],!o&&g!==l.origType||n&&n.guid!==l.guid||a&&!a.test(l.namespace)||r&&r!==l.selector&&("**"!==r||!l.selector)||(p.splice(i,1),l.selector&&p.delegateCount--,f.remove&&f.remove.call(e,l));s&&!p.length&&(f.teardown&&f.teardown.call(e,d,m.handle)!==!1||de.removeEvent(e,h,m.handle),delete u[h])}else for(h in u)de.event.remove(e,h+t[c],n,r,!0);de.isEmptyObject(u)&&Fe.remove(e,"handle events")}},dispatch:function(e){var t,n,r,o,i,s,a=de.event.fix(e),u=new Array(arguments.length),c=(Fe.get(this,"events")||{})[a.type]||[],l=de.event.special[a.type]||{};for(u[0]=a,t=1;t<arguments.length;t++)u[t]=arguments[t];if(a.delegateTarget=this,!l.preDispatch||l.preDispatch.call(this,a)!==!1){for(s=de.event.handlers.call(this,a,c),t=0;(o=s[t++])&&!a.isPropagationStopped();)for(a.currentTarget=o.elem,n=0;(i=o.handlers[n++])&&!a.isImmediatePropagationStopped();)a.rnamespace&&!a.rnamespace.test(i.namespace)||(a.handleObj=i,a.data=i.data,r=((de.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),void 0!==r&&(a.result=r)===!1&&(a.preventDefault(),a.stopPropagation()));return l.postDispatch&&l.postDispatch.call(this,a),a.result}},handlers:function(e,t){var n,r,o,i,s,a=[],u=t.delegateCount,c=e.target;if(u&&c.nodeType&&!("click"===e.type&&e.button>=1))for(;c!==this;c=c.parentNode||this)if(1===c.nodeType&&("click"!==e.type||c.disabled!==!0)){for(i=[],s={},n=0;n<u;n++)r=t[n],o=r.selector+" ",void 0===s[o]&&(s[o]=r.needsContext?de(o,this).index(c)>-1:de.find(o,this,null,[c]).length),s[o]&&i.push(r);i.length&&a.push({elem:c,handlers:i})}return c=this,u<t.length&&a.push({elem:c,handlers:t.slice(u)}),a},addProp:function(e,t){Object.defineProperty(de.Event.prototype,e,{enumerable:!0,configurable:!0,get:de.isFunction(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[de.expando]?e:new de.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==T()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===T()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&de.nodeName(this,"input"))return this.click(),!1},_default:function(e){return de.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},de.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},de.Event=function(e,t){return this instanceof de.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?b:w,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&de.extend(this,t),this.timeStamp=e&&e.timeStamp||de.now(),void(this[de.expando]=!0)):new de.Event(e,t)},de.Event.prototype={constructor:de.Event,isDefaultPrevented:w,isPropagationStopped:w,isImmediatePropagationStopped:w,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=b,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=b,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=b,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},de.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&Je.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Ke.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},de.event.addProp),de.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){de.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,o=e.relatedTarget,i=e.handleObj;return o&&(o===r||de.contains(r,o))||(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}}),de.fn.extend({on:function(e,t,n,r){return C(this,e,t,n,r)},one:function(e,t,n,r){return C(this,e,t,n,r,1)},off:function(e,t,n){var r,o;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,de(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(o in e)this.off(o,t,e[o]);return this}return t!==!1&&"function"!=typeof t||(n=t,t=void 0),n===!1&&(n=w),this.each(function(){de.event.remove(this,e,n,t)})}});var et=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,tt=/<script|<style|<link/i,nt=/checked\s*(?:[^=]|=\s*.checked.)/i,rt=/^true\/(.*)/,ot=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;de.extend({htmlPrefilter:function(e){return e.replace(et,"<$1></$2>")},clone:function(e,t,n){var r,o,i,s,a=e.cloneNode(!0),u=de.contains(e.ownerDocument,e);if(!(pe.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||de.isXMLDoc(e)))for(s=v(a),i=v(e),r=0,o=i.length;r<o;r++)N(i[r],s[r]);if(t)if(n)for(i=i||v(e),s=s||v(a),r=0,o=i.length;r<o;r++)S(i[r],s[r]);else S(e,a);return s=v(a,"script"),s.length>0&&y(s,!u&&v(e,"script")),a},cleanData:function(e){for(var t,n,r,o=de.event.special,i=0;void 0!==(n=e[i]);i++)if(He(n)){if(t=n[Fe.expando]){if(t.events)for(r in t.events)o[r]?de.event.remove(n,r):de.removeEvent(n,r,t.handle);n[Fe.expando]=void 0}n[Re.expando]&&(n[Re.expando]=void 0)}}}),de.fn.extend({detach:function(e){return q(this,e,!0)},remove:function(e){return q(this,e)},text:function(e){return Le(this,function(e){return void 0===e?de.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return A(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=j(this,e);t.appendChild(e)}})},prepend:function(){return A(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=j(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return A(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return A(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(de.cleanData(v(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return de.clone(this,e,t)})},html:function(e){return Le(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!tt.test(e)&&!Ge[(Xe.exec(e)||["",""])[1].toLowerCase()]){e=de.htmlPrefilter(e);try{for(;n<r;n++)t=this[n]||{},1===t.nodeType&&(de.cleanData(v(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return A(this,arguments,function(t){var n=this.parentNode;de.inArray(this,e)<0&&(de.cleanData(v(this)),n&&n.replaceChild(t,this))},e)}}),de.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){de.fn[e]=function(e){for(var n,r=[],o=de(e),i=o.length-1,s=0;s<=i;s++)n=s===i?this:this.clone(!0),de(o[s])[t](n),ie.apply(r,n.get());return this.pushStack(r)}});var it=/^margin/,st=new RegExp("^("+Me+")(?!px)[a-z%]+$","i"),at=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)};!function(){function t(){if(a){a.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",a.innerHTML="",Qe.appendChild(s);var t=e.getComputedStyle(a);n="1%"!==t.top,i="2px"===t.marginLeft,r="4px"===t.width,a.style.marginRight="50%",o="4px"===t.marginRight,Qe.removeChild(s),a=null}}var n,r,o,i,s=te.createElement("div"),a=te.createElement("div");a.style&&(a.style.backgroundClip="content-box",a.cloneNode(!0).style.backgroundClip="",pe.clearCloneStyle="content-box"===a.style.backgroundClip,s.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",s.appendChild(a),de.extend(pe,{pixelPosition:function(){return t(),n},boxSizingReliable:function(){return t(),r},pixelMarginRight:function(){return t(),o},reliableMarginLeft:function(){return t(),i}}))}();var ut=/^(none|table(?!-c[ea]).+)/,ct={position:"absolute",visibility:"hidden",display:"block"},lt={letterSpacing:"0",fontWeight:"400"},ft=["Webkit","Moz","ms"],pt=te.createElement("div").style;de.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=D(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,i,s,a=de.camelCase(t),u=e.style;return t=de.cssProps[a]||(de.cssProps[a]=L(a)||a),s=de.cssHooks[t]||de.cssHooks[a],void 0===n?s&&"get"in s&&void 0!==(o=s.get(e,!1,r))?o:u[t]:(i=typeof n,"string"===i&&(o=$e.exec(n))&&o[1]&&(n=d(e,t,o),i="number"),null!=n&&n===n&&("number"===i&&(n+=o&&o[3]||(de.cssNumber[a]?"":"px")),pe.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),s&&"set"in s&&void 0===(n=s.set(e,n,r))||(u[t]=n)),void 0)}},css:function(e,t,n,r){var o,i,s,a=de.camelCase(t);return t=de.cssProps[a]||(de.cssProps[a]=L(a)||a),s=de.cssHooks[t]||de.cssHooks[a],s&&"get"in s&&(o=s.get(e,!0,n)),void 0===o&&(o=D(e,t,r)),"normal"===o&&t in lt&&(o=lt[t]),""===n||n?(i=parseFloat(o),n===!0||isFinite(i)?i||0:o):o}}),de.each(["height","width"],function(e,t){de.cssHooks[t]={get:function(e,n,r){if(n)return!ut.test(de.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?R(e,t,r):_e(e,ct,function(){return R(e,t,r)})},set:function(e,n,r){var o,i=r&&at(e),s=r&&F(e,t,r,"border-box"===de.css(e,"boxSizing",!1,i),i);return s&&(o=$e.exec(n))&&"px"!==(o[3]||"px")&&(e.style[t]=n,n=de.css(e,t)),H(e,n,s)}}}),de.cssHooks.marginLeft=O(pe.reliableMarginLeft,function(e,t){if(t)return(parseFloat(D(e,"marginLeft"))||e.getBoundingClientRect().left-_e(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),de.each({margin:"",padding:"",border:"Width"},function(e,t){de.cssHooks[e+t]={expand:function(n){for(var r=0,o={},i="string"==typeof n?n.split(" "):[n];r<4;r++)o[e+We[r]+t]=i[r]||i[r-2]||i[0];return o}},it.test(e)||(de.cssHooks[e+t].set=H)}),de.fn.extend({css:function(e,t){return Le(this,function(e,t,n){var r,o,i={},s=0;if(de.isArray(t)){for(r=at(e),o=t.length;s<o;s++)i[t[s]]=de.css(e,t[s],!1,r);return i}return void 0!==n?de.style(e,t,n):de.css(e,t)},e,t,arguments.length>1)}}),de.Tween=I,I.prototype={constructor:I,init:function(e,t,n,r,o,i){this.elem=e,this.prop=n,this.easing=o||de.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=i||(de.cssNumber[n]?"":"px")},cur:function(){var e=I.propHooks[this.prop];return e&&e.get?e.get(this):I.propHooks._default.get(this)},run:function(e){var t,n=I.propHooks[this.prop];return this.options.duration?this.pos=t=de.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):I.propHooks._default.set(this),this}},I.prototype.init.prototype=I.prototype,I.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=de.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){de.fx.step[e.prop]?de.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[de.cssProps[e.prop]]&&!de.cssHooks[e.prop]?e.elem[e.prop]=e.now:de.style(e.elem,e.prop,e.now+e.unit)}}},I.propHooks.scrollTop=I.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},de.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},de.fx=I.prototype.init,de.fx.step={};var ht,dt,gt=/^(?:toggle|show|hide)$/,mt=/queueHooks$/;de.Animation=de.extend(U,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return d(n.elem,e,$e.exec(t),n),n}]},tweener:function(e,t){de.isFunction(e)?(t=e,e=["*"]):e=e.match(qe);for(var n,r=0,o=e.length;r<o;r++)n=e[r],U.tweeners[n]=U.tweeners[n]||[],U.tweeners[n].unshift(t)},prefilters:[B],prefilter:function(e,t){t?U.prefilters.unshift(e):U.prefilters.push(e)}}),de.speed=function(e,t,n){var r=e&&"object"==typeof e?de.extend({},e):{complete:n||!n&&t||de.isFunction(e)&&e,duration:e,easing:n&&t||t&&!de.isFunction(t)&&t};return de.fx.off||te.hidden?r.duration=0:"number"!=typeof r.duration&&(r.duration in de.fx.speeds?r.duration=de.fx.speeds[r.duration]:r.duration=de.fx.speeds._default),null!=r.queue&&r.queue!==!0||(r.queue="fx"),r.old=r.complete,r.complete=function(){de.isFunction(r.old)&&r.old.call(this),r.queue&&de.dequeue(this,r.queue)},r},de.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Be).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){ +var o=de.isEmptyObject(e),i=de.speed(t,n,r),s=function(){var t=U(this,de.extend({},e),i);(o||Fe.get(this,"finish"))&&t.stop(!0)};return s.finish=s,o||i.queue===!1?this.each(s):this.queue(i.queue,s)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,o=null!=e&&e+"queueHooks",i=de.timers,s=Fe.get(this);if(o)s[o]&&s[o].stop&&r(s[o]);else for(o in s)s[o]&&s[o].stop&&mt.test(o)&&r(s[o]);for(o=i.length;o--;)i[o].elem!==this||null!=e&&i[o].queue!==e||(i[o].anim.stop(n),t=!1,i.splice(o,1));!t&&n||de.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=Fe.get(this),r=n[e+"queue"],o=n[e+"queueHooks"],i=de.timers,s=r?r.length:0;for(n.finish=!0,de.queue(this,e,[]),o&&o.stop&&o.stop.call(this,!0),t=i.length;t--;)i[t].elem===this&&i[t].queue===e&&(i[t].anim.stop(!0),i.splice(t,1));for(t=0;t<s;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),de.each(["toggle","show","hide"],function(e,t){var n=de.fn[t];de.fn[t]=function(e,r,o){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate($(t,!0),e,r,o)}}),de.each({slideDown:$("show"),slideUp:$("hide"),slideToggle:$("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){de.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),de.timers=[],de.fx.tick=function(){var e,t=0,n=de.timers;for(ht=de.now();t<n.length;t++)e=n[t],e()||n[t]!==e||n.splice(t--,1);n.length||de.fx.stop(),ht=void 0},de.fx.timer=function(e){de.timers.push(e),e()?de.fx.start():de.timers.pop()},de.fx.interval=13,de.fx.start=function(){dt||(dt=e.requestAnimationFrame?e.requestAnimationFrame(P):e.setInterval(de.fx.tick,de.fx.interval))},de.fx.stop=function(){e.cancelAnimationFrame?e.cancelAnimationFrame(dt):e.clearInterval(dt),dt=null},de.fx.speeds={slow:600,fast:200,_default:400},de.fn.delay=function(t,n){return t=de.fx?de.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var o=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(o)}})},function(){var e=te.createElement("input"),t=te.createElement("select"),n=t.appendChild(te.createElement("option"));e.type="checkbox",pe.checkOn=""!==e.value,pe.optSelected=n.selected,e=te.createElement("input"),e.value="t",e.type="radio",pe.radioValue="t"===e.value}();var vt,yt=de.expr.attrHandle;de.fn.extend({attr:function(e,t){return Le(this,de.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){de.removeAttr(this,e)})}}),de.extend({attr:function(e,t,n){var r,o,i=e.nodeType;if(3!==i&&8!==i&&2!==i)return"undefined"==typeof e.getAttribute?de.prop(e,t,n):(1===i&&de.isXMLDoc(e)||(o=de.attrHooks[t.toLowerCase()]||(de.expr.match.bool.test(t)?vt:void 0)),void 0!==n?null===n?void de.removeAttr(e,t):o&&"set"in o&&void 0!==(r=o.set(e,n,t))?r:(e.setAttribute(t,n+""),n):o&&"get"in o&&null!==(r=o.get(e,t))?r:(r=de.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!pe.radioValue&&"radio"===t&&de.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,o=t&&t.match(qe);if(o&&1===e.nodeType)for(;n=o[r++];)e.removeAttribute(n)}}),vt={set:function(e,t,n){return t===!1?de.removeAttr(e,n):e.setAttribute(n,n),n}},de.each(de.expr.match.bool.source.match(/\w+/g),function(e,t){var n=yt[t]||de.find.attr;yt[t]=function(e,t,r){var o,i,s=t.toLowerCase();return r||(i=yt[s],yt[s]=o,o=null!=n(e,t,r)?s:null,yt[s]=i),o}});var xt=/^(?:input|select|textarea|button)$/i,bt=/^(?:a|area)$/i;de.fn.extend({prop:function(e,t){return Le(this,de.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[de.propFix[e]||e]})}}),de.extend({prop:function(e,t,n){var r,o,i=e.nodeType;if(3!==i&&8!==i&&2!==i)return 1===i&&de.isXMLDoc(e)||(t=de.propFix[t]||t,o=de.propHooks[t]),void 0!==n?o&&"set"in o&&void 0!==(r=o.set(e,n,t))?r:e[t]=n:o&&"get"in o&&null!==(r=o.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=de.find.attr(e,"tabindex");return t?parseInt(t,10):xt.test(e.nodeName)||bt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),pe.optSelected||(de.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),de.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){de.propFix[this.toLowerCase()]=this}),de.fn.extend({addClass:function(e){var t,n,r,o,i,s,a,u=0;if(de.isFunction(e))return this.each(function(t){de(this).addClass(e.call(this,t,X(this)))});if("string"==typeof e&&e)for(t=e.match(qe)||[];n=this[u++];)if(o=X(n),r=1===n.nodeType&&" "+z(o)+" "){for(s=0;i=t[s++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");a=z(r),o!==a&&n.setAttribute("class",a)}return this},removeClass:function(e){var t,n,r,o,i,s,a,u=0;if(de.isFunction(e))return this.each(function(t){de(this).removeClass(e.call(this,t,X(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(qe)||[];n=this[u++];)if(o=X(n),r=1===n.nodeType&&" "+z(o)+" "){for(s=0;i=t[s++];)for(;r.indexOf(" "+i+" ")>-1;)r=r.replace(" "+i+" "," ");a=z(r),o!==a&&n.setAttribute("class",a)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):de.isFunction(e)?this.each(function(n){de(this).toggleClass(e.call(this,n,X(this),t),t)}):this.each(function(){var t,r,o,i;if("string"===n)for(r=0,o=de(this),i=e.match(qe)||[];t=i[r++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&"boolean"!==n||(t=X(this),t&&Fe.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||e===!1?"":Fe.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+z(X(n))+" ").indexOf(t)>-1)return!0;return!1}});var wt=/\r/g;de.fn.extend({val:function(e){var t,n,r,o=this[0];{if(arguments.length)return r=de.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=r?e.call(this,n,de(this).val()):e,null==o?o="":"number"==typeof o?o+="":de.isArray(o)&&(o=de.map(o,function(e){return null==e?"":e+""})),t=de.valHooks[this.type]||de.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,o,"value")||(this.value=o))});if(o)return t=de.valHooks[o.type]||de.valHooks[o.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(o,"value"))?n:(n=o.value,"string"==typeof n?n.replace(wt,""):null==n?"":n)}}}),de.extend({valHooks:{option:{get:function(e){var t=de.find.attr(e,"value");return null!=t?t:z(de.text(e))}},select:{get:function(e){var t,n,r,o=e.options,i=e.selectedIndex,s="select-one"===e.type,a=s?null:[],u=s?i+1:o.length;for(r=i<0?u:s?i:0;r<u;r++)if(n=o[r],(n.selected||r===i)&&!n.disabled&&(!n.parentNode.disabled||!de.nodeName(n.parentNode,"optgroup"))){if(t=de(n).val(),s)return t;a.push(t)}return a},set:function(e,t){for(var n,r,o=e.options,i=de.makeArray(t),s=o.length;s--;)r=o[s],(r.selected=de.inArray(de.valHooks.option.get(r),i)>-1)&&(n=!0);return n||(e.selectedIndex=-1),i}}}}),de.each(["radio","checkbox"],function(){de.valHooks[this]={set:function(e,t){if(de.isArray(t))return e.checked=de.inArray(de(e).val(),t)>-1}},pe.checkOn||(de.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Tt=/^(?:focusinfocus|focusoutblur)$/;de.extend(de.event,{trigger:function(t,n,r,o){var i,s,a,u,c,l,f,p=[r||te],h=ce.call(t,"type")?t.type:t,d=ce.call(t,"namespace")?t.namespace.split("."):[];if(s=a=r=r||te,3!==r.nodeType&&8!==r.nodeType&&!Tt.test(h+de.event.triggered)&&(h.indexOf(".")>-1&&(d=h.split("."),h=d.shift(),d.sort()),c=h.indexOf(":")<0&&"on"+h,t=t[de.expando]?t:new de.Event(h,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=d.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:de.makeArray(n,[t]),f=de.event.special[h]||{},o||!f.trigger||f.trigger.apply(r,n)!==!1)){if(!o&&!f.noBubble&&!de.isWindow(r)){for(u=f.delegateType||h,Tt.test(u+h)||(s=s.parentNode);s;s=s.parentNode)p.push(s),a=s;a===(r.ownerDocument||te)&&p.push(a.defaultView||a.parentWindow||e)}for(i=0;(s=p[i++])&&!t.isPropagationStopped();)t.type=i>1?u:f.bindType||h,l=(Fe.get(s,"events")||{})[t.type]&&Fe.get(s,"handle"),l&&l.apply(s,n),l=c&&s[c],l&&l.apply&&He(s)&&(t.result=l.apply(s,n),t.result===!1&&t.preventDefault());return t.type=h,o||t.isDefaultPrevented()||f._default&&f._default.apply(p.pop(),n)!==!1||!He(r)||c&&de.isFunction(r[h])&&!de.isWindow(r)&&(a=r[c],a&&(r[c]=null),de.event.triggered=h,r[h](),de.event.triggered=void 0,a&&(r[c]=a)),t.result}},simulate:function(e,t,n){var r=de.extend(new de.Event,n,{type:e,isSimulated:!0});de.event.trigger(r,null,t)}}),de.fn.extend({trigger:function(e,t){return this.each(function(){de.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return de.event.trigger(e,t,n,!0)}}),de.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){de.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),de.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),pe.focusin="onfocusin"in e,pe.focusin||de.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){de.event.simulate(t,e.target,de.event.fix(e))};de.event.special[t]={setup:function(){var r=this.ownerDocument||this,o=Fe.access(r,t);o||r.addEventListener(e,n,!0),Fe.access(r,t,(o||0)+1)},teardown:function(){var r=this.ownerDocument||this,o=Fe.access(r,t)-1;o?Fe.access(r,t,o):(r.removeEventListener(e,n,!0),Fe.remove(r,t))}}});var Ct=e.location,jt=de.now(),kt=/\?/;de.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||de.error("Invalid XML: "+t),n};var Et=/\[\]$/,St=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;de.param=function(e,t){var n,r=[],o=function(e,t){var n=de.isFunction(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(de.isArray(e)||e.jquery&&!de.isPlainObject(e))de.each(e,function(){o(this.name,this.value)});else for(n in e)V(n,e[n],t,o);return r.join("&")},de.fn.extend({serialize:function(){return de.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=de.prop(this,"elements");return e?de.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!de(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!ze.test(e))}).map(function(e,t){var n=de(this).val();return null==n?null:de.isArray(n)?de.map(n,function(e){return{name:t.name,value:e.replace(St,"\r\n")}}):{name:t.name,value:n.replace(St,"\r\n")}}).get()}});var qt=/%20/g,Dt=/#.*$/,Ot=/([?&])_=[^&]*/,Lt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ht=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ft=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Pt={},Mt="*/".concat("*"),$t=te.createElement("a");$t.href=Ct.href,de.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Ht.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Mt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":de.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Q(Q(e,de.ajaxSettings),t):Q(de.ajaxSettings,e)},ajaxPrefilter:G(It),ajaxTransport:G(Pt),ajax:function(t,n){function r(t,n,r,a){var c,p,h,b,w,T=n;l||(l=!0,u&&e.clearTimeout(u),o=void 0,s=a||"",C.readyState=t>0?4:0,c=t>=200&&t<300||304===t,r&&(b=J(d,C,r)),b=K(d,b,C,c),c?(d.ifModified&&(w=C.getResponseHeader("Last-Modified"),w&&(de.lastModified[i]=w),w=C.getResponseHeader("etag"),w&&(de.etag[i]=w)),204===t||"HEAD"===d.type?T="nocontent":304===t?T="notmodified":(T=b.state,p=b.data,h=b.error,c=!h)):(h=T,!t&&T||(T="error",t<0&&(t=0))),C.status=t,C.statusText=(n||T)+"",c?v.resolveWith(g,[p,T,C]):v.rejectWith(g,[C,T,h]),C.statusCode(x),x=void 0,f&&m.trigger(c?"ajaxSuccess":"ajaxError",[C,d,c?p:h]),y.fireWith(g,[C,T]),f&&(m.trigger("ajaxComplete",[C,d]),--de.active||de.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var o,i,s,a,u,c,l,f,p,h,d=de.ajaxSetup({},n),g=d.context||d,m=d.context&&(g.nodeType||g.jquery)?de(g):de.event,v=de.Deferred(),y=de.Callbacks("once memory"),x=d.statusCode||{},b={},w={},T="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(l){if(!a)for(a={};t=Lt.exec(s);)a[t[1].toLowerCase()]=t[2];t=a[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return l?s:null},setRequestHeader:function(e,t){return null==l&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==l&&(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(l)C.always(e[C.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||T;return o&&o.abort(t),r(0,t),this}};if(v.promise(C),d.url=((t||d.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=(d.dataType||"*").toLowerCase().match(qe)||[""],null==d.crossDomain){c=te.createElement("a");try{c.href=d.url,c.href=c.href,d.crossDomain=$t.protocol+"//"+$t.host!=c.protocol+"//"+c.host}catch(e){d.crossDomain=!0}}if(d.data&&d.processData&&"string"!=typeof d.data&&(d.data=de.param(d.data,d.traditional)),Y(It,d,n,C),l)return C;f=de.event&&d.global,f&&0===de.active++&&de.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Ft.test(d.type),i=d.url.replace(Dt,""),d.hasContent?d.data&&d.processData&&0===(d.contentType||"").indexOf("application/x-www-form-urlencoded")&&(d.data=d.data.replace(qt,"+")):(h=d.url.slice(i.length),d.data&&(i+=(kt.test(i)?"&":"?")+d.data,delete d.data),d.cache===!1&&(i=i.replace(Ot,"$1"),h=(kt.test(i)?"&":"?")+"_="+jt++ +h),d.url=i+h),d.ifModified&&(de.lastModified[i]&&C.setRequestHeader("If-Modified-Since",de.lastModified[i]),de.etag[i]&&C.setRequestHeader("If-None-Match",de.etag[i])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",d.contentType),C.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Mt+"; q=0.01":""):d.accepts["*"]);for(p in d.headers)C.setRequestHeader(p,d.headers[p]);if(d.beforeSend&&(d.beforeSend.call(g,C,d)===!1||l))return C.abort();if(T="abort",y.add(d.complete),C.done(d.success),C.fail(d.error),o=Y(Pt,d,n,C)){if(C.readyState=1,f&&m.trigger("ajaxSend",[C,d]),l)return C;d.async&&d.timeout>0&&(u=e.setTimeout(function(){C.abort("timeout")},d.timeout));try{l=!1,o.send(b,r)}catch(e){if(l)throw e;r(-1,e)}}else r(-1,"No Transport");return C},getJSON:function(e,t,n){return de.get(e,t,n,"json")},getScript:function(e,t){return de.get(e,void 0,t,"script")}}),de.each(["get","post"],function(e,t){de[t]=function(e,n,r,o){return de.isFunction(n)&&(o=o||r,r=n,n=void 0),de.ajax(de.extend({url:e,type:t,dataType:o,data:n,success:r},de.isPlainObject(e)&&e))}}),de._evalUrl=function(e){return de.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},de.fn.extend({wrapAll:function(e){var t;return this[0]&&(de.isFunction(e)&&(e=e.call(this[0])),t=de(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return de.isFunction(e)?this.each(function(t){de(this).wrapInner(e.call(this,t))}):this.each(function(){var t=de(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=de.isFunction(e);return this.each(function(n){de(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){de(this).replaceWith(this.childNodes)}),this}}),de.expr.pseudos.hidden=function(e){return!de.expr.pseudos.visible(e)},de.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},de.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Wt={0:200,1223:204},Bt=de.ajaxSettings.xhr();pe.cors=!!Bt&&"withCredentials"in Bt,pe.ajax=Bt=!!Bt,de.ajaxTransport(function(t){var n,r;if(pe.cors||Bt&&!t.crossDomain)return{send:function(o,i){var s,a=t.xhr();if(a.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(s in t.xhrFields)a[s]=t.xhrFields[s];t.mimeType&&a.overrideMimeType&&a.overrideMimeType(t.mimeType),t.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");for(s in o)a.setRequestHeader(s,o[s]);n=function(e){return function(){n&&(n=r=a.onload=a.onerror=a.onabort=a.onreadystatechange=null,"abort"===e?a.abort():"error"===e?"number"!=typeof a.status?i(0,"error"):i(a.status,a.statusText):i(Wt[a.status]||a.status,a.statusText,"text"!==(a.responseType||"text")||"string"!=typeof a.responseText?{binary:a.response}:{text:a.responseText},a.getAllResponseHeaders()))}},a.onload=n(),r=a.onerror=n("error"),void 0!==a.onabort?a.onabort=r:a.onreadystatechange=function(){4===a.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{a.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),de.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),de.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return de.globalEval(e),e}}}),de.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),de.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,o){t=de("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),te.head.appendChild(t[0])},abort:function(){n&&n()}}}});var _t=[],Ut=/(=)\?(?=&|$)|\?\?/;de.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=_t.pop()||de.expando+"_"+jt++;return this[e]=!0,e}}),de.ajaxPrefilter("json jsonp",function(t,n,r){var o,i,s,a=t.jsonp!==!1&&(Ut.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(t.data)&&"data");if(a||"jsonp"===t.dataTypes[0])return o=t.jsonpCallback=de.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,a?t[a]=t[a].replace(Ut,"$1"+o):t.jsonp!==!1&&(t.url+=(kt.test(t.url)?"&":"?")+t.jsonp+"="+o),t.converters["script json"]=function(){return s||de.error(o+" was not called"),s[0]},t.dataTypes[0]="json",i=e[o],e[o]=function(){s=arguments},r.always(function(){void 0===i?de(e).removeProp(o):e[o]=i,t[o]&&(t.jsonpCallback=n.jsonpCallback,_t.push(o)),s&&de.isFunction(i)&&i(s[0]),s=i=void 0}),"script"}),pe.createHTMLDocument=function(){var e=te.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),de.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var r,o,i;return t||(pe.createHTMLDocument?(t=te.implementation.createHTMLDocument(""),r=t.createElement("base"),r.href=te.location.href,t.head.appendChild(r)):t=te),o=Ce.exec(e),i=!n&&[],o?[t.createElement(o[1])]:(o=x([e],t,i),i&&i.length&&de(i).remove(),de.merge([],o.childNodes))},de.fn.load=function(e,t,n){var r,o,i,s=this,a=e.indexOf(" ");return a>-1&&(r=z(e.slice(a)),e=e.slice(0,a)),de.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(o="POST"),s.length>0&&de.ajax({url:e,type:o||"GET",dataType:"html",data:t}).done(function(e){i=arguments,s.html(r?de("<div>").append(de.parseHTML(e)).find(r):e)}).always(n&&function(e,t){s.each(function(){n.apply(this,i||[e.responseText,t,e])})}),this},de.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){de.fn[t]=function(e){return this.on(t,e)}}),de.expr.pseudos.animated=function(e){return de.grep(de.timers,function(t){return e===t.elem}).length},de.offset={setOffset:function(e,t,n){var r,o,i,s,a,u,c,l=de.css(e,"position"),f=de(e),p={};"static"===l&&(e.style.position="relative"),a=f.offset(),i=de.css(e,"top"),u=de.css(e,"left"),c=("absolute"===l||"fixed"===l)&&(i+u).indexOf("auto")>-1,c?(r=f.position(),s=r.top,o=r.left):(s=parseFloat(i)||0,o=parseFloat(u)||0),de.isFunction(t)&&(t=t.call(e,n,de.extend({},a))),null!=t.top&&(p.top=t.top-a.top+s),null!=t.left&&(p.left=t.left-a.left+o),"using"in t?t.using.call(e,p):f.css(p)}},de.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){de.offset.setOffset(this,e,t)});var t,n,r,o,i=this[0];if(i)return i.getClientRects().length?(r=i.getBoundingClientRect(),r.width||r.height?(o=i.ownerDocument,n=Z(o),t=o.documentElement,{top:r.top+n.pageYOffset-t.clientTop,left:r.left+n.pageXOffset-t.clientLeft}):r):{top:0,left:0}},position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===de.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),de.nodeName(e[0],"html")||(r=e.offset()),r={top:r.top+de.css(e[0],"borderTopWidth",!0),left:r.left+de.css(e[0],"borderLeftWidth",!0)}),{top:t.top-r.top-de.css(n,"marginTop",!0),left:t.left-r.left-de.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===de.css(e,"position");)e=e.offsetParent;return e||Qe})}}),de.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;de.fn[e]=function(r){return Le(this,function(e,r,o){var i=Z(e);return void 0===o?i?i[t]:e[r]:void(i?i.scrollTo(n?i.pageXOffset:o,n?o:i.pageYOffset):e[r]=o)},e,r,arguments.length)}}),de.each(["top","left"],function(e,t){de.cssHooks[t]=O(pe.pixelPosition,function(e,n){if(n)return n=D(e,t),st.test(n)?de(e).position()[t]+"px":n})}),de.each({Height:"height",Width:"width"},function(e,t){de.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){de.fn[r]=function(o,i){var s=arguments.length&&(n||"boolean"!=typeof o),a=n||(o===!0||i===!0?"margin":"border");return Le(this,function(t,n,o){var i;return de.isWindow(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===o?de.css(t,n,a):de.style(t,n,o,a)},t,s?o:void 0,s)}})}),de.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),de.parseJSON=JSON.parse,"function"==typeof define&&define.amd&&define("jquery",[],function(){return de});var zt=e.jQuery,Xt=e.$;return de.noConflict=function(t){return e.$===de&&(e.$=Xt),t&&e.jQuery===de&&(e.jQuery=zt),de},t||(e.jQuery=e.$=de),de})},{}],2:[function(e,t,n){(function(e){function t(e,t){for(var n=0,r=e.length-1;r>=0;r--){var o=e[r];"."===o?e.splice(r,1):".."===o?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n--;n)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var n=[],r=0;r<e.length;r++)t(e[r],r,e)&&n.push(e[r]);return n}var o=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,i=function(e){return o.exec(e).slice(1)};n.resolve=function(){for(var n="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var s=i>=0?arguments[i]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(n=s+"/"+n,o="/"===s.charAt(0))}return n=t(r(n.split("/"),function(e){return!!e}),!o).join("/"),(o?"/":"")+n||"."},n.normalize=function(e){var o=n.isAbsolute(e),i="/"===s(e,-1);return e=t(r(e.split("/"),function(e){return!!e}),!o).join("/"),e||o||(e="."),e&&i&&(e+="/"),(o?"/":"")+e},n.isAbsolute=function(e){return"/"===e.charAt(0)},n.join=function(){var e=Array.prototype.slice.call(arguments,0);return n.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},n.relative=function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var n=e.length-1;n>=0&&""===e[n];n--);return t>n?[]:e.slice(t,n-t+1)}e=n.resolve(e).substr(1),t=n.resolve(t).substr(1);for(var o=r(e.split("/")),i=r(t.split("/")),s=Math.min(o.length,i.length),a=s,u=0;u<s;u++)if(o[u]!==i[u]){a=u;break}for(var c=[],u=a;u<o.length;u++)c.push("..");return c=c.concat(i.slice(a)),c.join("/")},n.sep="/",n.delimiter=":",n.dirname=function(e){var t=i(e),n=t[0],r=t[1];return n||r?(r&&(r=r.substr(0,r.length-1)),n+r):"."},n.basename=function(e,t){var n=i(e)[2];return t&&n.substr(-1*t.length)===t&&(n=n.substr(0,n.length-t.length)),n},n.extname=function(e){return i(e)[3]};var s="b"==="ab".substr(-1)?function(e,t,n){return e.substr(t,n)}:function(e,t,n){return t<0&&(t=e.length+t),e.substr(t,n)}}).call(this,e("_process"))},{_process:3}],3:[function(e,t,n){function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(f===setTimeout)return setTimeout(e,0);if((f===r||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function s(e){if(p===clearTimeout)return clearTimeout(e);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{return p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}function a(){m&&d&&(m=!1,d.length?g=d.concat(g):v=-1,g.length&&u())}function u(){if(!m){var e=i(a);m=!0;for(var t=g.length;t;){for(d=g,g=[];++v<t;)d&&d[v].run();v=-1,t=g.length}d=null,m=!1,s(e)}}function c(e,t){this.fun=e,this.array=t}function l(){}var f,p,h=t.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:r}catch(e){f=r}try{p="function"==typeof clearTimeout?clearTimeout:o}catch(e){p=o}}();var d,g=[],m=!1,v=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];g.push(new c(e,t)),1!==g.length||m||i(u)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=l,h.addListener=l,h.once=l,h.off=l,h.removeListener=l,h.removeAllListeners=l,h.emit=l,h.prependListener=l,h.prependOnceListener=l,h.listeners=function(e){return[]},h.binding=function(e){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(e){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],4:[function(e,t,n){(function(e){!function(r){function o(e){throw new RangeError(L[e])}function i(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function s(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(O,".");var o=e.split("."),s=i(o,t).join(".");return r+s}function a(e){for(var t,n,r=[],o=0,i=e.length;o<i;)t=e.charCodeAt(o++),t>=55296&&t<=56319&&o<i?(n=e.charCodeAt(o++),56320==(64512&n)?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),o--)):r.push(t);return r}function u(e){return i(e,function(e){var t="";return e>65535&&(e-=65536,t+=R(e>>>10&1023|55296),e=56320|1023&e),t+=R(e)}).join("")}function c(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:T}function l(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function f(e,t,n){var r=0;for(e=n?F(e/E):e>>1,e+=F(e/t);e>H*j>>1;r+=T)e=F(e/H);return F(r+(H+1)*e/(e+k))}function p(e){var t,n,r,i,s,a,l,p,h,d,g=[],m=e.length,v=0,y=N,x=S;for(n=e.lastIndexOf(A),n<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&o("not-basic"),g.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<m;){for(s=v,a=1,l=T;i>=m&&o("invalid-input"),p=c(e.charCodeAt(i++)),(p>=T||p>F((w-v)/a))&&o("overflow"),v+=p*a,h=l<=x?C:l>=x+j?j:l-x,!(p<h);l+=T)d=T-h,a>F(w/d)&&o("overflow"),a*=d;t=g.length+1,x=f(v-s,t,0==s),F(v/t)>w-y&&o("overflow"),y+=F(v/t),v%=t,g.splice(v++,0,y)}return u(g)}function h(e){var t,n,r,i,s,u,c,p,h,d,g,m,v,y,x,b=[];for(e=a(e),m=e.length,t=N,n=0,s=S,u=0;u<m;++u)g=e[u],g<128&&b.push(R(g));for(r=i=b.length,i&&b.push(A);r<m;){for(c=w,u=0;u<m;++u)g=e[u],g>=t&&g<c&&(c=g);for(v=r+1,c-t>F((w-n)/v)&&o("overflow"),n+=(c-t)*v,t=c,u=0;u<m;++u)if(g=e[u],g<t&&++n>w&&o("overflow"),g==t){for(p=n,h=T;d=h<=s?C:h>=s+j?j:h-s,!(p<d);h+=T)x=p-d,y=T-d,b.push(R(l(d+x%y,0))),p=F(x/y);b.push(R(l(p,0))),s=f(n,v,r==i),n=0,++r}++n,++t}return b.join("")}function d(e){return s(e,function(e){return q.test(e)?p(e.slice(4).toLowerCase()):e})}function g(e){return s(e,function(e){return D.test(e)?"xn--"+h(e):e})}var m="object"==typeof n&&n&&!n.nodeType&&n,v="object"==typeof t&&t&&!t.nodeType&&t,y="object"==typeof e&&e;y.global!==y&&y.window!==y&&y.self!==y||(r=y);var x,b,w=2147483647,T=36,C=1,j=26,k=38,E=700,S=72,N=128,A="-",q=/^xn--/,D=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,L={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},H=T-C,F=Math.floor,R=String.fromCharCode;if(x={version:"1.4.1",ucs2:{decode:a,encode:u},decode:p,encode:h,toASCII:g,toUnicode:d},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return x});else if(m&&v)if(t.exports==m)v.exports=x;else for(b in x)x.hasOwnProperty(b)&&(m[b]=x[b]);else r.punycode=x}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],5:[function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,n,i){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var a=/\+/g;e=e.split(t);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var c=e.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,p,h,d,g=e[l].replace(a,"%20"),m=g.indexOf(n);m>=0?(f=g.substr(0,m),p=g.substr(m+1)):(f=g,p=""),h=decodeURIComponent(f),d=decodeURIComponent(p),r(s,h)?o(s[h])?s[h].push(d):s[h]=[s[h],d]:s[h]=d}return s};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],6:[function(e,t,n){"use strict";function r(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var o=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,n,a){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?r(s(e),function(s){var a=encodeURIComponent(o(s))+n;return i(e[s])?r(e[s],function(e){return a+encodeURIComponent(o(e))}).join(t):a+encodeURIComponent(o(e[s]))}).join(t):a?encodeURIComponent(o(a))+n+encodeURIComponent(o(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},s=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},{}],7:[function(e,t,n){"use strict";n.decode=n.parse=e("./decode"),n.encode=n.stringify=e("./encode")},{"./decode":5,"./encode":6}],8:[function(e,t,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(e,t,n){ +if(e&&c.isObject(e)&&e instanceof r)return e;var o=new r;return o.parse(e,t,n),o}function i(e){return c.isString(e)&&(e=o(e)),e instanceof r?e.format():r.prototype.format.call(e)}function s(e,t){return o(e,!1,!0).resolve(t)}function a(e,t){return e?o(e,!1,!0).resolveObject(t):t}var u=e("punycode"),c=e("./util");n.parse=o,n.resolve=s,n.resolveObject=a,n.format=i,n.Url=r;var l=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,h=["<",">",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(h),g=["'"].concat(d),m=["%","/","?",";","#"].concat(g),v=["/","?","#"],y=255,x=/^[+a-z0-9A-Z_-]{0,63}$/,b=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,w={javascript:!0,"javascript:":!0},T={javascript:!0,"javascript:":!0},C={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},j=e("querystring");r.prototype.parse=function(e,t,n){if(!c.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),o=r!==-1&&r<e.indexOf("#")?"?":"#",i=e.split(o),s=/\\/g;i[0]=i[0].replace(s,"/"),e=i.join(o);var a=e;if(a=a.trim(),!n&&1===e.split("#").length){var f=p.exec(a);if(f)return this.path=a,this.href=a,this.pathname=f[1],f[2]?(this.search=f[2],t?this.query=j.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=l.exec(a);if(h){h=h[0];var d=h.toLowerCase();this.protocol=d,a=a.substr(h.length)}if(n||h||a.match(/^\/\/[^@\/]+@[^@\/]+/)){var k="//"===a.substr(0,2);!k||h&&T[h]||(a=a.substr(2),this.slashes=!0)}if(!T[h]&&(k||h&&!C[h])){for(var E=-1,S=0;S<v.length;S++){var N=a.indexOf(v[S]);N!==-1&&(E===-1||N<E)&&(E=N)}var A,q;q=E===-1?a.lastIndexOf("@"):a.lastIndexOf("@",E),q!==-1&&(A=a.slice(0,q),a=a.slice(q+1),this.auth=decodeURIComponent(A)),E=-1;for(var S=0;S<m.length;S++){var N=a.indexOf(m[S]);N!==-1&&(E===-1||N<E)&&(E=N)}E===-1&&(E=a.length),this.host=a.slice(0,E),a=a.slice(E),this.parseHost(),this.hostname=this.hostname||"";var D="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!D)for(var O=this.hostname.split(/\./),S=0,L=O.length;S<L;S++){var H=O[S];if(H&&!H.match(x)){for(var F="",R=0,I=H.length;R<I;R++)F+=H.charCodeAt(R)>127?"x":H[R];if(!F.match(x)){var P=O.slice(0,S),M=O.slice(S+1),$=H.match(b);$&&(P.push($[1]),M.unshift($[2])),M.length&&(a="/"+M.join(".")+a),this.hostname=P.join(".");break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),D||(this.hostname=u.toASCII(this.hostname));var W=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+W,this.href+=this.host,D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!w[d])for(var S=0,L=g.length;S<L;S++){var _=g[S];if(a.indexOf(_)!==-1){var U=encodeURIComponent(_);U===_&&(U=escape(_)),a=a.split(_).join(U)}}var z=a.indexOf("#");z!==-1&&(this.hash=a.substr(z),a=a.slice(0,z));var X=a.indexOf("?");if(X!==-1?(this.search=a.substr(X),this.query=a.substr(X+1),t&&(this.query=j.parse(this.query)),a=a.slice(0,X)):t&&(this.search="",this.query={}),a&&(this.pathname=a),C[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var W=this.pathname||"",V=this.search||"";this.path=W+V}return this.href=this.format(),this},r.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,i="";this.host?o=e+this.host:this.hostname&&(o=e+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&c.isObject(this.query)&&Object.keys(this.query).length&&(i=j.stringify(this.query));var s=this.search||i&&"?"+i||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||C[t])&&o!==!1?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),s&&"?"!==s.charAt(0)&&(s="?"+s),n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),s=s.replace("#","%23"),t+o+n+s+r},r.prototype.resolve=function(e){return this.resolveObject(o(e,!1,!0)).format()},r.prototype.resolveObject=function(e){if(c.isString(e)){var t=new r;t.parse(e,!1,!0),e=t}for(var n=new r,o=Object.keys(this),i=0;i<o.length;i++){var s=o[i];n[s]=this[s]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var a=Object.keys(e),u=0;u<a.length;u++){var l=a[u];"protocol"!==l&&(n[l]=e[l])}return C[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!C[e.protocol]){for(var f=Object.keys(e),p=0;p<f.length;p++){var h=f[p];n[h]=e[h]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||T[e.protocol])n.pathname=e.pathname;else{for(var d=(e.pathname||"").split("/");d.length&&!(e.host=d.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var g=n.pathname||"",m=n.search||"";n.path=g+m}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var v=n.pathname&&"/"===n.pathname.charAt(0),y=e.host||e.pathname&&"/"===e.pathname.charAt(0),x=y||v||n.host&&e.pathname,b=x,w=n.pathname&&n.pathname.split("/")||[],d=e.pathname&&e.pathname.split("/")||[],j=n.protocol&&!C[n.protocol];if(j&&(n.hostname="",n.port=null,n.host&&(""===w[0]?w[0]=n.host:w.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host=null),x=x&&(""===d[0]||""===w[0])),y)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,w=d;else if(d.length)w||(w=[]),w.pop(),w=w.concat(d),n.search=e.search,n.query=e.query;else if(!c.isNullOrUndefined(e.search)){if(j){n.hostname=n.host=w.shift();var k=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");k&&(n.auth=k.shift(),n.host=n.hostname=k.shift())}return n.search=e.search,n.query=e.query,c.isNull(n.pathname)&&c.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var E=w.slice(-1)[0],S=(n.host||e.host||w.length>1)&&("."===E||".."===E)||""===E,N=0,A=w.length;A>=0;A--)E=w[A],"."===E?w.splice(A,1):".."===E?(w.splice(A,1),N++):N&&(w.splice(A,1),N--);if(!x&&!b)for(;N--;N)w.unshift("..");!x||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),S&&"/"!==w.join("/").substr(-1)&&w.push("");var q=""===w[0]||w[0]&&"/"===w[0].charAt(0);if(j){n.hostname=n.host=q?"":w.length?w.shift():"";var k=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");k&&(n.auth=k.shift(),n.host=n.hostname=k.shift())}return x=x||n.host&&w.length,x&&!q&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),c.isNull(n.pathname)&&c.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var e=this.host,t=f.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":9,punycode:4,querystring:7}],9:[function(e,t,n){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],10:[function(e,t,n){var r=e("jquery");t.exports=r({})},{jquery:1}],11:[function(e,t,n){var r=e("jquery"),o=e("./events"),i=e("./storage"),s=e("./page"),a=!1,u=window.gitbook||[],c={events:o,page:s,state:s.getState(),storage:i,push:function(e){a?e():u.push(e)}},l={gitbook:c,jquery:r};window.gitbook=c,window.$=r,window.jQuery=r,window.require=function(e,t){e=e.map(function(e){if(e=e.toLowerCase(),!l[e])throw new Error("GitBook module "+e+" doesn't exist");return l[e]}),t.apply(null,e)},r(document).ready(function(){a=!0,r.each(u,function(e,t){t()})})},{"./events":10,"./page":12,"./storage":13,jquery:1}],12:[function(e,t,n){function r(e){console.log("page has changed",e),o(e),l||(l=!0,c.trigger("start",e.config.pluginsConfig)),c.trigger("page.change")}function o(e){f.page=e.page,f.file=e.file,f.gitbook=e.gitbook,f.config=e.config,f.basePath=e.basePath,f.book=e.book,f.$book=s(".book"),f.revision=f.gitbook.time,f.level=f.page.level,f.filepath=f.file.path,f.chapterTitle=f.page.title,f.innerLanguage=f.book.language||"",f.root=a.resolve(location.protocol+"//"+location.host,u.dirname(u.resolve(location.pathname.replace(/\/$/,"/index.html"),f.basePath))).replace(/\/?$/,"/"),f.bookRoot=f.innerLanguage?a.resolve(f.root,".."):f.root}function i(){return f}var s=e("jquery"),a=e("url"),u=e("path"),c=e("./events"),l=!1,f={};t.exports={hasChanged:r,setState:o,getState:i}},{"./events":10,jquery:1,path:2,url:8}],13:[function(e,t,n){var r="";t.exports={setBaseKey:function(e){r=e},set:function(e,t){e=r+":"+e;try{localStorage[e]=JSON.stringify(t)}catch(e){}},get:function(e,t){var n;e=r+":"+e;try{n=localStorage[e]}catch(e){}if(void 0===n)return t;try{var o=JSON.parse(n);return null==o?t:o}catch(e){return n||t}},remove:function(e){e=r+":"+e;try{localStorage.removeItem(e)}catch(e){}}}},{}]},{},[11]); diff --git a/gitbook/gitbook/images/apple-touch-icon-precomposed-152.png b/gitbook/gitbook/images/apple-touch-icon-precomposed-152.png new file mode 100644 index 000000000..f0adcfd0b Binary files /dev/null and b/gitbook/gitbook/images/apple-touch-icon-precomposed-152.png differ diff --git a/gitbook/gitbook/images/favicon.ico b/gitbook/gitbook/images/favicon.ico new file mode 100644 index 000000000..9ee99fa21 Binary files /dev/null and b/gitbook/gitbook/images/favicon.ico differ diff --git a/gitbook/gitbook/style.css b/gitbook/gitbook/style.css new file mode 100644 index 000000000..9dbba3d0a --- /dev/null +++ b/gitbook/gitbook/style.css @@ -0,0 +1,9 @@ +/*! normalize.css v2.1.0 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}.link-inherit{color:inherit}.link-inherit:focus,.link-inherit:hover{color:inherit}.hidden{display:none}.alert{padding:15px;margin-bottom:20px;color:#444;background:#eee;border-bottom:5px solid #ddd}.alert-success{background:#dff0d8;border-color:#d6e9c6;color:#3c763d}.alert-info{background:#d9edf7;border-color:#bce8f1;color:#31708f}.alert-danger{background:#f2dede;border-color:#ebccd1;color:#a94442}.alert-warning{background:#fcf8e3;border-color:#faebcc;color:#8a6d3b}/*! + * Font Awesome 4.6.3 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:FontAwesome;src:url(fonts/fontawesome/fontawesome-webfont.eot?v=4.6.3);src:url(fonts/fontawesome/fontawesome-webfont.eot?#iefix&v=4.6.3) format('embedded-opentype'),url(fonts/fontawesome/fontawesome-webfont.woff2?v=4.6.3) format('woff2'),url(fonts/fontawesome/fontawesome-webfont.woff?v=4.6.3) format('woff'),url(fonts/fontawesome/fontawesome-webfont.ttf?v=4.6.3) format('truetype'),url(fonts/fontawesome/fontawesome-webfont.svg?v=4.6.3#fontawesomeregular) format('svg');font-weight:400;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1,1);-ms-transform:scale(-1,1);transform:scale(-1,1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1,-1);-ms-transform:scale(1,-1);transform:scale(1,-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-rotate-90{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-close:before,.fa-remove:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-cog:before,.fa-gear:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-repeat:before,.fa-rotate-right:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-image:before,.fa-photo:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-exclamation-triangle:before,.fa-warning:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-cogs:before,.fa-gears:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-floppy-o:before,.fa-save:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-bars:before,.fa-navicon:before,.fa-reorder:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-sort:before,.fa-unsorted:before{content:"\f0dc"}.fa-sort-desc:before,.fa-sort-down:before{content:"\f0dd"}.fa-sort-asc:before,.fa-sort-up:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-gavel:before,.fa-legal:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-bolt:before,.fa-flash:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-clipboard:before,.fa-paste:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-chain-broken:before,.fa-unlink:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-caret-square-o-down:before,.fa-toggle-down:before{content:"\f150"}.fa-caret-square-o-up:before,.fa-toggle-up:before{content:"\f151"}.fa-caret-square-o-right:before,.fa-toggle-right:before{content:"\f152"}.fa-eur:before,.fa-euro:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-inr:before,.fa-rupee:before{content:"\f156"}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen:before{content:"\f157"}.fa-rouble:before,.fa-rub:before,.fa-ruble:before{content:"\f158"}.fa-krw:before,.fa-won:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-caret-square-o-left:before,.fa-toggle-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-try:before,.fa-turkish-lira:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-bank:before,.fa-institution:before,.fa-university:before{content:"\f19c"}.fa-graduation-cap:before,.fa-mortar-board:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-image-o:before,.fa-file-photo-o:before,.fa-file-picture-o:before{content:"\f1c5"}.fa-file-archive-o:before,.fa-file-zip-o:before{content:"\f1c6"}.fa-file-audio-o:before,.fa-file-sound-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-ring:before,.fa-life-saver:before,.fa-support:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-rebel:before,.fa-resistance:before{content:"\f1d0"}.fa-empire:before,.fa-ge:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-hacker-news:before,.fa-y-combinator-square:before,.fa-yc-square:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-paper-plane:before,.fa-send:before{content:"\f1d8"}.fa-paper-plane-o:before,.fa-send-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-futbol-o:before,.fa-soccer-ball-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-ils:before,.fa-shekel:before,.fa-sheqel:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-bed:before,.fa-hotel:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-y-combinator:before,.fa-yc:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-paper-o:before,.fa-hand-stop-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-television:before,.fa-tv:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-american-sign-language-interpreting:before,.fa-asl-interpreting:before{content:"\f2a3"}.fa-deaf:before,.fa-deafness:before,.fa-hard-of-hearing:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-sign-language:before,.fa-signing:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}/*! + * Preboot v2 + * + * Open sourced under MIT license by @mdo. + * Some variables and mixins from Bootstrap (Apache 2 license). + */.book-langs-index{width:100%;height:100%;padding:40px 0;margin:0;overflow:auto}@media (max-width:600px){.book-langs-index{padding:0}}.book-langs-index .inner{max-width:600px;width:100%;margin:0 auto;padding:30px;background:#fff;border-radius:3px}.book-langs-index .inner h3{margin:0}.book-langs-index .inner .languages{list-style:none;padding:20px 30px;margin-top:20px;border-top:1px solid #eee}.book-langs-index .inner .languages:after,.book-langs-index .inner .languages:before{content:" ";display:table;line-height:0}.book-langs-index .inner .languages:after{clear:both}.book-langs-index .inner .languages li{width:50%;float:left;padding:10px 5px;font-size:16px}@media (max-width:600px){.book-langs-index .inner .languages li{width:100%;max-width:100%}}.book-header{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;overflow:visible;height:50px;padding:0 8px;z-index:2;font-size:.85em;color:#7e888b;background:0 0}.book-header .btn{display:block;height:50px;padding:0 15px;border-bottom:none;color:#ccc;text-transform:uppercase;line-height:50px;-webkit-box-shadow:none!important;box-shadow:none!important;position:relative;font-size:14px}.book-header .btn:hover{position:relative;text-decoration:none;color:#444;background:0 0}.book-header .btn:focus{outline:0}.book-header h1{margin:0;font-size:20px;font-weight:200;text-align:center;line-height:50px;opacity:0;-webkit-transition:opacity ease .4s;-moz-transition:opacity ease .4s;-o-transition:opacity ease .4s;transition:opacity ease .4s;padding-left:200px;padding-right:200px;-webkit-transition:opacity .2s ease;-moz-transition:opacity .2s ease;-o-transition:opacity .2s ease;transition:opacity .2s ease;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.book-header h1 a,.book-header h1 a:hover{color:inherit;text-decoration:none}@media (max-width:1000px){.book-header h1{display:none}}.book-header h1 i{display:none}.book-header:hover h1{opacity:1}.book.is-loading .book-header h1 i{display:inline-block}.book.is-loading .book-header h1 a{display:none}.dropdown{position:relative}.dropdown-menu{position:absolute;top:100%;left:0;z-index:100;display:none;float:left;min-width:160px;padding:0;margin:2px 0 0;list-style:none;font-size:14px;background-color:#fafafa;border:1px solid rgba(0,0,0,.07);border-radius:1px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175);background-clip:padding-box}.dropdown-menu.open{display:block}.dropdown-menu.dropdown-left{left:auto;right:4%}.dropdown-menu.dropdown-left .dropdown-caret{right:14px;left:auto}.dropdown-menu .dropdown-caret{position:absolute;top:-8px;left:14px;width:18px;height:10px;float:left;overflow:hidden}.dropdown-menu .dropdown-caret .caret-outer{position:absolute;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:9px solid rgba(0,0,0,.1);height:auto;left:0;top:0;width:auto;display:inline-block;margin-left:-1px}.dropdown-menu .dropdown-caret .caret-inner{position:absolute;display:inline-block;margin-top:-1px;top:0;top:1px;border-left:9px solid transparent;border-right:9px solid transparent;border-bottom:9px solid #fafafa}.dropdown-menu .buttons{border-bottom:1px solid rgba(0,0,0,.07)}.dropdown-menu .buttons:after,.dropdown-menu .buttons:before{content:" ";display:table;line-height:0}.dropdown-menu .buttons:after{clear:both}.dropdown-menu .buttons:last-child{border-bottom:none}.dropdown-menu .buttons .button{border:0;background-color:transparent;color:#a6a6a6;width:100%;text-align:center;float:left;line-height:1.42857143;padding:8px 4px}.dropdown-menu .buttons .button:hover{color:#444}.dropdown-menu .buttons .button:focus,.dropdown-menu .buttons .button:hover{outline:0}.dropdown-menu .buttons .button.size-2{width:50%}.dropdown-menu .buttons .button.size-3{width:33%}.book-summary{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;position:absolute;top:0;left:-300px;bottom:0;z-index:1;overflow-y:auto;width:300px;color:#364149;background:#fafafa;border-right:1px solid rgba(0,0,0,.07);-webkit-transition:left 250ms ease;-moz-transition:left 250ms ease;-o-transition:left 250ms ease;transition:left 250ms ease}.book-summary ul.summary{list-style:none;margin:0;padding:0;-webkit-transition:top .5s ease;-moz-transition:top .5s ease;-o-transition:top .5s ease;transition:top .5s ease}.book-summary ul.summary li{list-style:none}.book-summary ul.summary li.header{padding:10px 15px;padding-top:20px;text-transform:uppercase;color:#939da3}.book-summary ul.summary li.divider{height:1px;margin:7px 0;overflow:hidden;background:rgba(0,0,0,.07)}.book-summary ul.summary li i.fa-check{display:none;position:absolute;right:9px;top:16px;font-size:9px;color:#3c3}.book-summary ul.summary li.done>a{color:#364149;font-weight:400}.book-summary ul.summary li.done>a i{display:inline}.book-summary ul.summary li a,.book-summary ul.summary li span{display:block;padding:10px 15px;border-bottom:none;color:#364149;background:0 0;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;position:relative}.book-summary ul.summary li a:hover{text-decoration:underline}.book-summary ul.summary li a:focus{outline:0}.book-summary ul.summary li.active>a{color:#008cff;background:0 0;text-decoration:none}.book-summary ul.summary li ul{padding-left:20px}@media (max-width:600px){.book-summary{width:calc(100% - 60px);bottom:0;left:-100%}}.book.with-summary .book-summary{left:0}.book.without-animation .book-summary{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;transition:none!important}.book{position:relative;width:100%;height:100%}@media (min-width:600px){.book.with-summary .book-body{left:300px}}@media (max-width:600px){.book.with-summary{overflow:hidden}.book.with-summary .book-body{-webkit-transform:translate(calc(100% - 60px),0);-moz-transform:translate(calc(100% - 60px),0);-ms-transform:translate(calc(100% - 60px),0);-o-transform:translate(calc(100% - 60px),0);transform:translate(calc(100% - 60px),0)}}.book.without-animation .book-body{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;transition:none!important}.book-body{position:absolute;top:0;right:0;left:0;bottom:0;overflow-y:auto;color:#000;background:#fff;-webkit-transition:left 250ms ease;-moz-transition:left 250ms ease;-o-transition:left 250ms ease;transition:left 250ms ease}.book-body .body-inner{position:absolute;top:0;right:0;left:0;bottom:0;overflow-y:auto}@media (max-width:1240px){.book-body{-webkit-transition:-webkit-transform 250ms ease;-moz-transition:-moz-transform 250ms ease;-o-transition:-o-transform 250ms ease;transition:transform 250ms ease;padding-bottom:20px}.book-body .body-inner{position:static;min-height:calc(100% - 50px)}}.page-wrapper{position:relative;outline:0}.page-inner{position:relative;max-width:800px;margin:0 auto;padding:20px 15px 40px 15px}.page-inner .btn-group .btn{border-radius:0;background:#eee;border:0}.buttons:after,.buttons:before{content:" ";display:table;line-height:0}.buttons:after{clear:both}.button{border:0;background-color:transparent;background:#eee;color:#666;width:100%;text-align:center;float:left;line-height:1.42857143;padding:8px 4px}.button:hover{color:#444}.button:focus,.button:hover{outline:0}.button.size-2{width:50%}.button.size-3{width:33%}.markdown-section{display:block;word-wrap:break-word;overflow:hidden;color:#333;line-height:1.7;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%}.markdown-section *{box-sizing:border-box;-webkit-box-sizing:border-box;font-size:inherit}.markdown-section>:first-child{margin-top:0!important}.markdown-section>:last-child{margin-bottom:0!important}.markdown-section blockquote,.markdown-section code,.markdown-section figure,.markdown-section img,.markdown-section pre,.markdown-section table,.markdown-section tr{page-break-inside:avoid}.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section h5,.markdown-section p{orphans:3;widows:3}.markdown-section h1,.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section h5{page-break-after:avoid}.markdown-section b,.markdown-section strong{font-weight:700}.markdown-section em{font-style:italic}.markdown-section blockquote,.markdown-section dl,.markdown-section ol,.markdown-section p,.markdown-section table,.markdown-section ul{margin-top:0;margin-bottom:.85em}.markdown-section a{color:#4183c4;text-decoration:none;background:0 0}.markdown-section a:active,.markdown-section a:focus,.markdown-section a:hover{outline:0;text-decoration:underline}.markdown-section img{border:0;max-width:100%}.markdown-section hr{height:4px;padding:0;margin:1.7em 0;overflow:hidden;background-color:#e7e7e7;border:none}.markdown-section hr:after,.markdown-section hr:before{display:table;content:" "}.markdown-section hr:after{clear:both}.markdown-section h1,.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section h5,.markdown-section h6{margin-top:1.275em;margin-bottom:.85em;font-weight:700}.markdown-section h1{font-size:2em}.markdown-section h2{font-size:1.75em}.markdown-section h3{font-size:1.5em}.markdown-section h4{font-size:1.25em}.markdown-section h5{font-size:1em}.markdown-section h6{font-size:1em;color:#777}.markdown-section code,.markdown-section pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;margin:0;padding:0;border:none;color:inherit}.markdown-section pre{overflow:auto;word-wrap:normal;margin:0;padding:.85em 1em;margin-bottom:1.275em;background:#f7f7f7}.markdown-section pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}.markdown-section pre>code:after,.markdown-section pre>code:before{content:normal}.markdown-section code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}.markdown-section code:after,.markdown-section code:before{letter-spacing:-.2em;content:"\00a0"}.markdown-section table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}.markdown-section table td,.markdown-section table th{padding:6px 13px;border:1px solid #ddd}.markdown-section table tr{background-color:#fff;border-top:1px solid #ccc}.markdown-section table tr:nth-child(2n){background-color:#f8f8f8}.markdown-section table th{font-weight:700}.markdown-section ol,.markdown-section ul{padding:0;margin:0;margin-bottom:.85em;padding-left:2em}.markdown-section ol ol,.markdown-section ol ul,.markdown-section ul ol,.markdown-section ul ul{margin-top:0;margin-bottom:0}.markdown-section ol ol{list-style-type:lower-roman}.markdown-section blockquote{margin:0;margin-bottom:.85em;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}.markdown-section blockquote:first-child{margin-top:0}.markdown-section blockquote:last-child{margin-bottom:0}.markdown-section dl{padding:0}.markdown-section dl dt{padding:0;margin-top:.85em;font-style:italic;font-weight:700}.markdown-section dl dd{padding:0 .85em;margin-bottom:.85em}.markdown-section dd{margin-left:0}.markdown-section .glossary-term{cursor:help;text-decoration:underline}.navigation{position:absolute;top:50px;bottom:0;margin:0;max-width:150px;min-width:90px;display:flex;justify-content:center;align-content:center;flex-direction:column;font-size:40px;color:#ccc;text-align:center;-webkit-transition:all 350ms ease;-moz-transition:all 350ms ease;-o-transition:all 350ms ease;transition:all 350ms ease}.navigation:hover{text-decoration:none;color:#444}.navigation.navigation-next{right:0}.navigation.navigation-prev{left:0}@media (max-width:1240px){.navigation{position:static;top:auto;max-width:50%;width:50%;display:inline-block;float:left}.navigation.navigation-unique{max-width:100%;width:100%}}#book-search-input{padding:6px;background:0 0;transition:top .5s ease;background:#fff;border-bottom:1px solid rgba(0,0,0,.07);border-top:1px solid rgba(0,0,0,.07);margin-bottom:10px;margin-top:-1px}#book-search-input input,#book-search-input input:focus,#book-search-input input:hover{width:100%;background:0 0;border:1px solid transparent;box-shadow:none;outline:0;line-height:22px;padding:7px 7px;color:inherit}#book-search-results{opacity:1}#book-search-results .search-results .search-results-title{text-transform:uppercase;text-align:center;font-weight:200;margin-bottom:35px;opacity:.6}#book-search-results .search-results .has-results .search-results-item{display:block;word-wrap:break-word;overflow:hidden;color:#333;line-height:1.7;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%}#book-search-results .search-results .has-results .search-results-item *{box-sizing:border-box;-webkit-box-sizing:border-box;font-size:inherit}#book-search-results .search-results .has-results .search-results-item>:first-child{margin-top:0!important}#book-search-results .search-results .has-results .search-results-item>:last-child{margin-bottom:0!important}#book-search-results .search-results .has-results .search-results-item blockquote,#book-search-results .search-results .has-results .search-results-item code,#book-search-results .search-results .has-results .search-results-item figure,#book-search-results .search-results .has-results .search-results-item img,#book-search-results .search-results .has-results .search-results-item pre,#book-search-results .search-results .has-results .search-results-item table,#book-search-results .search-results .has-results .search-results-item tr{page-break-inside:avoid}#book-search-results .search-results .has-results .search-results-item h2,#book-search-results .search-results .has-results .search-results-item h3,#book-search-results .search-results .has-results .search-results-item h4,#book-search-results .search-results .has-results .search-results-item h5,#book-search-results .search-results .has-results .search-results-item p{orphans:3;widows:3}#book-search-results .search-results .has-results .search-results-item h1,#book-search-results .search-results .has-results .search-results-item h2,#book-search-results .search-results .has-results .search-results-item h3,#book-search-results .search-results .has-results .search-results-item h4,#book-search-results .search-results .has-results .search-results-item h5{page-break-after:avoid}#book-search-results .search-results .has-results .search-results-item b,#book-search-results .search-results .has-results .search-results-item strong{font-weight:700}#book-search-results .search-results .has-results .search-results-item em{font-style:italic}#book-search-results .search-results .has-results .search-results-item blockquote,#book-search-results .search-results .has-results .search-results-item dl,#book-search-results .search-results .has-results .search-results-item ol,#book-search-results .search-results .has-results .search-results-item p,#book-search-results .search-results .has-results .search-results-item table,#book-search-results .search-results .has-results .search-results-item ul{margin-top:0;margin-bottom:.85em}#book-search-results .search-results .has-results .search-results-item a{color:#4183c4;text-decoration:none;background:0 0}#book-search-results .search-results .has-results .search-results-item a:active,#book-search-results .search-results .has-results .search-results-item a:focus,#book-search-results .search-results .has-results .search-results-item a:hover{outline:0;text-decoration:underline}#book-search-results .search-results .has-results .search-results-item img{border:0;max-width:100%}#book-search-results .search-results .has-results .search-results-item hr{height:4px;padding:0;margin:1.7em 0;overflow:hidden;background-color:#e7e7e7;border:none}#book-search-results .search-results .has-results .search-results-item hr:after,#book-search-results .search-results .has-results .search-results-item hr:before{display:table;content:" "}#book-search-results .search-results .has-results .search-results-item hr:after{clear:both}#book-search-results .search-results .has-results .search-results-item h1,#book-search-results .search-results .has-results .search-results-item h2,#book-search-results .search-results .has-results .search-results-item h3,#book-search-results .search-results .has-results .search-results-item h4,#book-search-results .search-results .has-results .search-results-item h5,#book-search-results .search-results .has-results .search-results-item h6{margin-top:1.275em;margin-bottom:.85em;font-weight:700}#book-search-results .search-results .has-results .search-results-item h1{font-size:2em}#book-search-results .search-results .has-results .search-results-item h2{font-size:1.75em}#book-search-results .search-results .has-results .search-results-item h3{font-size:1.5em}#book-search-results .search-results .has-results .search-results-item h4{font-size:1.25em}#book-search-results .search-results .has-results .search-results-item h5{font-size:1em}#book-search-results .search-results .has-results .search-results-item h6{font-size:1em;color:#777}#book-search-results .search-results .has-results .search-results-item code,#book-search-results .search-results .has-results .search-results-item pre{font-family:Consolas,"Liberation Mono",Menlo,Courier,monospace;direction:ltr;margin:0;padding:0;border:none;color:inherit}#book-search-results .search-results .has-results .search-results-item pre{overflow:auto;word-wrap:normal;margin:0;padding:.85em 1em;margin-bottom:1.275em;background:#f7f7f7}#book-search-results .search-results .has-results .search-results-item pre>code{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;font-size:.85em;white-space:pre;background:0 0}#book-search-results .search-results .has-results .search-results-item pre>code:after,#book-search-results .search-results .has-results .search-results-item pre>code:before{content:normal}#book-search-results .search-results .has-results .search-results-item code{padding:.2em;margin:0;font-size:.85em;background-color:#f7f7f7}#book-search-results .search-results .has-results .search-results-item code:after,#book-search-results .search-results .has-results .search-results-item code:before{letter-spacing:-.2em;content:"\00a0"}#book-search-results .search-results .has-results .search-results-item table{display:table;width:100%;border-collapse:collapse;border-spacing:0;overflow:auto}#book-search-results .search-results .has-results .search-results-item table td,#book-search-results .search-results .has-results .search-results-item table th{padding:6px 13px;border:1px solid #ddd}#book-search-results .search-results .has-results .search-results-item table tr{background-color:#fff;border-top:1px solid #ccc}#book-search-results .search-results .has-results .search-results-item table tr:nth-child(2n){background-color:#f8f8f8}#book-search-results .search-results .has-results .search-results-item table th{font-weight:700}#book-search-results .search-results .has-results .search-results-item ol,#book-search-results .search-results .has-results .search-results-item ul{padding:0;margin:0;margin-bottom:.85em;padding-left:2em}#book-search-results .search-results .has-results .search-results-item ol ol,#book-search-results .search-results .has-results .search-results-item ol ul,#book-search-results .search-results .has-results .search-results-item ul ol,#book-search-results .search-results .has-results .search-results-item ul ul{margin-top:0;margin-bottom:0}#book-search-results .search-results .has-results .search-results-item ol ol{list-style-type:lower-roman}#book-search-results .search-results .has-results .search-results-item blockquote{margin:0;margin-bottom:.85em;padding:0 15px;color:#858585;border-left:4px solid #e5e5e5}#book-search-results .search-results .has-results .search-results-item blockquote:first-child{margin-top:0}#book-search-results .search-results .has-results .search-results-item blockquote:last-child{margin-bottom:0}#book-search-results .search-results .has-results .search-results-item dl{padding:0}#book-search-results .search-results .has-results .search-results-item dl dt{padding:0;margin-top:.85em;font-style:italic;font-weight:700}#book-search-results .search-results .has-results .search-results-item dl dd{padding:0 .85em;margin-bottom:.85em}#book-search-results .search-results .has-results .search-results-item dd{margin-left:0}#book-search-results .search-results .has-results .search-results-item h3{margin-top:0;margin-bottom:0}#book-search-results .search-results .no-results{padding:40px 0}body.search-loading #book-search-results{opacity:.3}body.with-search .navigation{display:none}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:transparent;-webkit-text-size-adjust:none;-webkit-touch-callout:none;-webkit-font-smoothing:antialiased}a{text-decoration:none}body,html{height:100%}html{font-size:62.5%}body{text-rendering:optimizeLegibility;font-smoothing:antialiased;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;letter-spacing:.2px;text-size-adjust:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%} \ No newline at end of file diff --git a/gitbook/gitbook/theme.js b/gitbook/gitbook/theme.js new file mode 100644 index 000000000..268002aff --- /dev/null +++ b/gitbook/gitbook/theme.js @@ -0,0 +1,4 @@ +!function e(t,n,r){function o(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return o(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(e,t,n){!function(e,n){"use strict";"object"==typeof t&&"object"==typeof t.exports?t.exports=e.document?n(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";function n(e,t){t=t||te;var n=t.createElement("script");n.text=e,t.head.appendChild(n).parentNode.removeChild(n)}function r(e){var t=!!e&&"length"in e&&e.length,n=de.type(e);return"function"!==n&&!de.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function o(e,t,n){return de.isFunction(t)?de.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?de.grep(e,function(e){return e===t!==n}):"string"!=typeof t?de.grep(e,function(e){return ae.call(t,e)>-1!==n}):ke.test(t)?de.filter(t,e,n):(t=de.filter(t,e),de.grep(e,function(e){return ae.call(t,e)>-1!==n&&1===e.nodeType}))}function i(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function a(e){var t={};return de.each(e.match(qe)||[],function(e,n){t[n]=!0}),t}function s(e){return e}function u(e){throw e}function l(e,t,n){var r;try{e&&de.isFunction(r=e.promise)?r.call(e).done(t).fail(n):e&&de.isFunction(r=e.then)?r.call(e,t,n):t.call(void 0,e)}catch(e){n.call(void 0,e)}}function c(){te.removeEventListener("DOMContentLoaded",c),e.removeEventListener("load",c),de.ready()}function f(){this.expando=de.expando+f.uid++}function p(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Ie.test(e)?JSON.parse(e):e)}function h(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(Re,"-$&").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n=p(n)}catch(e){}Pe.set(e,t,n)}else n=void 0;return n}function d(e,t,n,r){var o,i=1,a=20,s=r?function(){return r.cur()}:function(){return de.css(e,t,"")},u=s(),l=n&&n[3]||(de.cssNumber[t]?"":"px"),c=(de.cssNumber[t]||"px"!==l&&+u)&&$e.exec(de.css(e,t));if(c&&c[3]!==l){l=l||c[3],n=n||[],c=+u||1;do i=i||".5",c/=i,de.style(e,t,c+l);while(i!==(i=s()/u)&&1!==i&&--a)}return n&&(c=+c||+u||0,o=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=o)),o}function g(e){var t,n=e.ownerDocument,r=e.nodeName,o=Ue[r];return o?o:(t=n.body.appendChild(n.createElement(r)),o=de.css(t,"display"),t.parentNode.removeChild(t),"none"===o&&(o="block"),Ue[r]=o,o)}function m(e,t){for(var n,r,o=[],i=0,a=e.length;i<a;i++)r=e[i],r.style&&(n=r.style.display,t?("none"===n&&(o[i]=Fe.get(r,"display")||null,o[i]||(r.style.display="")),""===r.style.display&&We(r)&&(o[i]=g(r))):"none"!==n&&(o[i]="none",Fe.set(r,"display",n)));for(i=0;i<a;i++)null!=o[i]&&(e[i].style.display=o[i]);return e}function v(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&de.nodeName(e,t)?de.merge([e],n):n}function y(e,t){for(var n=0,r=e.length;n<r;n++)Fe.set(e[n],"globalEval",!t||Fe.get(t[n],"globalEval"))}function b(e,t,n,r,o){for(var i,a,s,u,l,c,f=t.createDocumentFragment(),p=[],h=0,d=e.length;h<d;h++)if(i=e[h],i||0===i)if("object"===de.type(i))de.merge(p,i.nodeType?[i]:i);else if(Ge.test(i)){for(a=a||f.appendChild(t.createElement("div")),s=(Xe.exec(i)||["",""])[1].toLowerCase(),u=Ve[s]||Ve._default,a.innerHTML=u[1]+de.htmlPrefilter(i)+u[2],c=u[0];c--;)a=a.lastChild;de.merge(p,a.childNodes),a=f.firstChild,a.textContent=""}else p.push(t.createTextNode(i));for(f.textContent="",h=0;i=p[h++];)if(r&&de.inArray(i,r)>-1)o&&o.push(i);else if(l=de.contains(i.ownerDocument,i),a=v(f.appendChild(i),"script"),l&&y(a),n)for(c=0;i=a[c++];)Ke.test(i.type||"")&&n.push(i);return f}function x(){return!0}function w(){return!1}function C(){try{return te.activeElement}catch(e){}}function T(e,t,n,r,o,i){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)T(e,s,n,r,t[s],i);return e}if(null==r&&null==o?(o=n,r=n=void 0):null==o&&("string"==typeof n?(o=r,r=void 0):(o=r,r=n,n=void 0)),o===!1)o=w;else if(!o)return e;return 1===i&&(a=o,o=function(e){return de().off(e),a.apply(this,arguments)},o.guid=a.guid||(a.guid=de.guid++)),e.each(function(){de.event.add(this,t,o,r,n)})}function k(e,t){return de.nodeName(e,"table")&&de.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e:e}function j(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function E(e){var t=rt.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function N(e,t){var n,r,o,i,a,s,u,l;if(1===t.nodeType){if(Fe.hasData(e)&&(i=Fe.access(e),a=Fe.set(t,i),l=i.events)){delete a.handle,a.events={};for(o in l)for(n=0,r=l[o].length;n<r;n++)de.event.add(t,o,l[o][n])}Pe.hasData(e)&&(s=Pe.access(e),u=de.extend({},s),Pe.set(t,u))}}function S(e,t){var n=t.nodeName.toLowerCase();"input"===n&&ze.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function A(e,t,r,o){t=oe.apply([],t);var i,a,s,u,l,c,f=0,p=e.length,h=p-1,d=t[0],g=de.isFunction(d);if(g||p>1&&"string"==typeof d&&!pe.checkClone&&nt.test(d))return e.each(function(n){var i=e.eq(n);g&&(t[0]=d.call(this,n,i.html())),A(i,t,r,o)});if(p&&(i=b(t,e[0].ownerDocument,!1,e,o),a=i.firstChild,1===i.childNodes.length&&(i=a),a||o)){for(s=de.map(v(i,"script"),j),u=s.length;f<p;f++)l=i,f!==h&&(l=de.clone(l,!0,!0),u&&de.merge(s,v(l,"script"))),r.call(e[f],l,f);if(u)for(c=s[s.length-1].ownerDocument,de.map(s,E),f=0;f<u;f++)l=s[f],Ke.test(l.type||"")&&!Fe.access(l,"globalEval")&&de.contains(c,l)&&(l.src?de._evalUrl&&de._evalUrl(l.src):n(l.textContent.replace(ot,""),c))}return e}function q(e,t,n){for(var r,o=t?de.filter(t,e):e,i=0;null!=(r=o[i]);i++)n||1!==r.nodeType||de.cleanData(v(r)),r.parentNode&&(n&&de.contains(r.ownerDocument,r)&&y(v(r,"script")),r.parentNode.removeChild(r));return e}function D(e,t,n){var r,o,i,a,s=e.style;return n=n||st(e),n&&(a=n.getPropertyValue(t)||n[t],""!==a||de.contains(e.ownerDocument,e)||(a=de.style(e,t)),!pe.pixelMarginRight()&&at.test(a)&&it.test(t)&&(r=s.width,o=s.minWidth,i=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=o,s.maxWidth=i)),void 0!==a?a+"":a}function O(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function L(e){if(e in pt)return e;for(var t=e[0].toUpperCase()+e.slice(1),n=ft.length;n--;)if(e=ft[n]+t,e in pt)return e}function H(e,t,n){var r=$e.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function F(e,t,n,r,o){var i,a=0;for(i=n===(r?"border":"content")?4:"width"===t?1:0;i<4;i+=2)"margin"===n&&(a+=de.css(e,n+_e[i],!0,o)),r?("content"===n&&(a-=de.css(e,"padding"+_e[i],!0,o)),"margin"!==n&&(a-=de.css(e,"border"+_e[i]+"Width",!0,o))):(a+=de.css(e,"padding"+_e[i],!0,o),"padding"!==n&&(a+=de.css(e,"border"+_e[i]+"Width",!0,o)));return a}function P(e,t,n){var r,o=!0,i=st(e),a="border-box"===de.css(e,"boxSizing",!1,i);if(e.getClientRects().length&&(r=e.getBoundingClientRect()[t]),r<=0||null==r){if(r=D(e,t,i),(r<0||null==r)&&(r=e.style[t]),at.test(r))return r;o=a&&(pe.boxSizingReliable()||r===e.style[t]),r=parseFloat(r)||0}return r+F(e,t,n||(a?"border":"content"),o,i)+"px"}function I(e,t,n,r,o){return new I.prototype.init(e,t,n,r,o)}function R(){dt&&(e.requestAnimationFrame(R),de.fx.tick())}function M(){return e.setTimeout(function(){ht=void 0}),ht=de.now()}function $(e,t){var n,r=0,o={height:e};for(t=t?1:0;r<4;r+=2-t)n=_e[r],o["margin"+n]=o["padding"+n]=e;return t&&(o.opacity=o.width=e),o}function _(e,t,n){for(var r,o=(U.tweeners[t]||[]).concat(U.tweeners["*"]),i=0,a=o.length;i<a;i++)if(r=o[i].call(n,t,e))return r}function W(e,t,n){var r,o,i,a,s,u,l,c,f="width"in t||"height"in t,p=this,h={},d=e.style,g=e.nodeType&&We(e),v=Fe.get(e,"fxshow");n.queue||(a=de._queueHooks(e,"fx"),null==a.unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,de.queue(e,"fx").length||a.empty.fire()})}));for(r in t)if(o=t[r],gt.test(o)){if(delete t[r],i=i||"toggle"===o,o===(g?"hide":"show")){if("show"!==o||!v||void 0===v[r])continue;g=!0}h[r]=v&&v[r]||de.style(e,r)}if(u=!de.isEmptyObject(t),u||!de.isEmptyObject(h)){f&&1===e.nodeType&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],l=v&&v.display,null==l&&(l=Fe.get(e,"display")),c=de.css(e,"display"),"none"===c&&(l?c=l:(m([e],!0),l=e.style.display||l,c=de.css(e,"display"),m([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===de.css(e,"float")&&(u||(p.done(function(){d.display=l}),null==l&&(c=d.display,l="none"===c?"":c)),d.display="inline-block")),n.overflow&&(d.overflow="hidden",p.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]})),u=!1;for(r in h)u||(v?"hidden"in v&&(g=v.hidden):v=Fe.access(e,"fxshow",{display:l}),i&&(v.hidden=!g),g&&m([e],!0),p.done(function(){g||m([e]),Fe.remove(e,"fxshow");for(r in h)de.style(e,r,h[r])})),u=_(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}}function B(e,t){var n,r,o,i,a;for(n in e)if(r=de.camelCase(n),o=t[r],i=e[n],de.isArray(i)&&(o=i[1],i=e[n]=i[0]),n!==r&&(e[r]=i,delete e[n]),a=de.cssHooks[r],a&&"expand"in a){i=a.expand(i),delete e[r];for(n in i)n in e||(e[n]=i[n],t[n]=o)}else t[r]=o}function U(e,t,n){var r,o,i=0,a=U.prefilters.length,s=de.Deferred().always(function(){delete u.elem}),u=function(){if(o)return!1;for(var t=ht||M(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,i=1-r,a=0,u=l.tweens.length;a<u;a++)l.tweens[a].run(i);return s.notifyWith(e,[l,i,n]),i<1&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:de.extend({},t),opts:de.extend(!0,{specialEasing:{},easing:de.easing._default},n),originalProperties:t,originalOptions:n,startTime:ht||M(),duration:n.duration,tweens:[],createTween:function(t,n){var r=de.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(o)return this;for(o=!0;n<r;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(B(c,l.opts.specialEasing);i<a;i++)if(r=U.prefilters[i].call(l,e,c,l.opts))return de.isFunction(r.stop)&&(de._queueHooks(l.elem,l.opts.queue).stop=de.proxy(r.stop,r)),r;return de.map(c,_,l),de.isFunction(l.opts.start)&&l.opts.start.call(e,l),de.fx.timer(de.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function z(e){var t=e.match(qe)||[];return t.join(" ")}function X(e){return e.getAttribute&&e.getAttribute("class")||""}function K(e,t,n,r){var o;if(de.isArray(t))de.each(t,function(t,o){n||Et.test(e)?r(e,o):K(e+"["+("object"==typeof o&&null!=o?t:"")+"]",o,n,r)});else if(n||"object"!==de.type(t))r(e,t);else for(o in t)K(e+"["+o+"]",t[o],n,r)}function V(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o=0,i=t.toLowerCase().match(qe)||[];if(de.isFunction(n))for(;r=i[o++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function G(e,t,n,r){function o(s){var u;return i[s]=!0,de.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||a||i[l]?a?!(u=l):void 0:(t.dataTypes.unshift(l),o(l),!1)}),u}var i={},a=e===Rt;return o(t.dataTypes[0])||!i["*"]&&o("*")}function Y(e,t){var n,r,o=de.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((o[n]?e:r||(r={}))[n]=t[n]);return r&&de.extend(!0,e,r),e}function Q(e,t,n){for(var r,o,i,a,s=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(o in s)if(s[o]&&s[o].test(r)){u.unshift(o);break}if(u[0]in n)i=u[0];else{for(o in n){if(!u[0]||e.converters[o+" "+u[0]]){i=o;break}a||(a=o)}i=i||a}if(i)return i!==u[0]&&u.unshift(i),n[i]}function J(e,t,n,r){var o,i,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];for(i=c.shift();i;)if(e.responseFields[i]&&(n[e.responseFields[i]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=i,i=c.shift())if("*"===i)i=u;else if("*"!==u&&u!==i){if(a=l[u+" "+i]||l["* "+i],!a)for(o in l)if(s=o.split(" "),s[1]===i&&(a=l[u+" "+s[0]]||l["* "+s[0]])){a===!0?a=l[o]:l[o]!==!0&&(i=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+i}}}return{state:"success",data:t}}function Z(e){return de.isWindow(e)?e:9===e.nodeType&&e.defaultView}var ee=[],te=e.document,ne=Object.getPrototypeOf,re=ee.slice,oe=ee.concat,ie=ee.push,ae=ee.indexOf,se={},ue=se.toString,le=se.hasOwnProperty,ce=le.toString,fe=ce.call(Object),pe={},he="3.1.1",de=function(e,t){return new de.fn.init(e,t)},ge=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,me=/^-ms-/,ve=/-([a-z])/g,ye=function(e,t){return t.toUpperCase()};de.fn=de.prototype={jquery:he,constructor:de,length:0,toArray:function(){return re.call(this)},get:function(e){return null==e?re.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=de.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return de.each(this,e)},map:function(e){return this.pushStack(de.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(re.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:ie,sort:ee.sort,splice:ee.splice},de.extend=de.fn.extend=function(){var e,t,n,r,o,i,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||de.isFunction(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)n=a[t],r=e[t],a!==r&&(l&&r&&(de.isPlainObject(r)||(o=de.isArray(r)))?(o?(o=!1,i=n&&de.isArray(n)?n:[]):i=n&&de.isPlainObject(n)?n:{},a[t]=de.extend(l,i,r)):void 0!==r&&(a[t]=r));return a},de.extend({expando:"jQuery"+(he+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===de.type(e)},isArray:Array.isArray,isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){var t=de.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==ue.call(e))&&(!(t=ne(e))||(n=le.call(t,"constructor")&&t.constructor,"function"==typeof n&&ce.call(n)===fe))},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?se[ue.call(e)]||"object":typeof e},globalEval:function(e){n(e)},camelCase:function(e){return e.replace(me,"ms-").replace(ve,ye)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var n,o=0;if(r(e))for(n=e.length;o<n&&t.call(e[o],o,e[o])!==!1;o++);else for(o in e)if(t.call(e[o],o,e[o])===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(ge,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(r(Object(e))?de.merge(n,"string"==typeof e?[e]:e):ie.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:ae.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,o=e.length;r<n;r++)e[o++]=t[r];return e.length=o,e},grep:function(e,t,n){for(var r,o=[],i=0,a=e.length,s=!n;i<a;i++)r=!t(e[i],i),r!==s&&o.push(e[i]);return o},map:function(e,t,n){var o,i,a=0,s=[];if(r(e))for(o=e.length;a<o;a++)i=t(e[a],a,n),null!=i&&s.push(i);else for(a in e)i=t(e[a],a,n),null!=i&&s.push(i);return oe.apply([],s)},guid:1,proxy:function(e,t){var n,r,o;if("string"==typeof t&&(n=e[t],t=e,e=n),de.isFunction(e))return r=re.call(arguments,2),o=function(){return e.apply(t||this,r.concat(re.call(arguments)))},o.guid=e.guid=e.guid||de.guid++,o},now:Date.now,support:pe}),"function"==typeof Symbol&&(de.fn[Symbol.iterator]=ee[Symbol.iterator]),de.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){se["[object "+t+"]"]=t.toLowerCase()});var be=function(e){function t(e,t,n,r){var o,i,a,s,u,l,c,p=t&&t.ownerDocument,d=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==d&&9!==d&&11!==d)return n;if(!r&&((t?t.ownerDocument||t:_)!==L&&O(t),t=t||L,F)){if(11!==d&&(u=ve.exec(e)))if(o=u[1]){if(9===d){if(!(a=t.getElementById(o)))return n;if(a.id===o)return n.push(a),n}else if(p&&(a=p.getElementById(o))&&M(t,a)&&a.id===o)return n.push(a),n}else{if(u[2])return J.apply(n,t.getElementsByTagName(e)),n;if((o=u[3])&&C.getElementsByClassName&&t.getElementsByClassName)return J.apply(n,t.getElementsByClassName(o)),n}if(C.qsa&&!X[e+" "]&&(!P||!P.test(e))){if(1!==d)p=t,c=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(we,Ce):t.setAttribute("id",s=$),l=E(e),i=l.length;i--;)l[i]="#"+s+" "+h(l[i]);c=l.join(","),p=ye.test(e)&&f(t.parentNode)||t}if(c)try{return J.apply(n,p.querySelectorAll(c)),n}catch(e){}finally{s===$&&t.removeAttribute("id")}}}return S(e.replace(se,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>T.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[$]=!0,e}function o(e){var t=L.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function i(e,t){for(var n=e.split("|"),r=n.length;r--;)T.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return function(t){return"form"in t?t.parentNode&&t.disabled===!1?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ke(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function c(e){return r(function(t){return t=+t,r(function(n,r){for(var o,i=e([],n.length,t),a=i.length;a--;)n[o=i[a]]&&(n[o]=!(r[o]=n[o]))})})}function f(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function p(){}function h(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function d(e,t,n){var r=t.dir,o=t.next,i=o||r,a=n&&"parentNode"===i,s=B++;return t.first?function(t,n,o){for(;t=t[r];)if(1===t.nodeType||a)return e(t,n,o);return!1}:function(t,n,u){var l,c,f,p=[W,s];if(u){for(;t=t[r];)if((1===t.nodeType||a)&&e(t,n,u))return!0}else for(;t=t[r];)if(1===t.nodeType||a)if(f=t[$]||(t[$]={}),c=f[t.uniqueID]||(f[t.uniqueID]={}),o&&o===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[i])&&l[0]===W&&l[1]===s)return p[2]=l[2];if(c[i]=p,p[2]=e(t,n,u))return!0}return!1}}function g(e){return e.length>1?function(t,n,r){for(var o=e.length;o--;)if(!e[o](t,n,r))return!1;return!0}:e[0]}function m(e,n,r){for(var o=0,i=n.length;o<i;o++)t(e,n[o],r);return r}function v(e,t,n,r,o){for(var i,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(i=e[s])&&(n&&!n(i,r,o)||(a.push(i),l&&t.push(s)));return a}function y(e,t,n,o,i,a){return o&&!o[$]&&(o=y(o)),i&&!i[$]&&(i=y(i,a)),r(function(r,a,s,u){var l,c,f,p=[],h=[],d=a.length,g=r||m(t||"*",s.nodeType?[s]:s,[]),y=!e||!r&&t?g:v(g,p,e,s,u),b=n?i||(r?e:d||o)?[]:a:y;if(n&&n(y,b,s,u),o)for(l=v(b,h),o(l,[],s,u),c=l.length;c--;)(f=l[c])&&(b[h[c]]=!(y[h[c]]=f));if(r){if(i||e){if(i){for(l=[],c=b.length;c--;)(f=b[c])&&l.push(y[c]=f);i(null,b=[],l,u)}for(c=b.length;c--;)(f=b[c])&&(l=i?ee(r,f):p[c])>-1&&(r[l]=!(a[l]=f))}}else b=v(b===a?b.splice(d,b.length):b),i?i(null,a,b,u):J.apply(a,b)})}function b(e){for(var t,n,r,o=e.length,i=T.relative[e[0].type],a=i||T.relative[" "],s=i?1:0,u=d(function(e){return e===t},a,!0),l=d(function(e){return ee(t,e)>-1},a,!0),c=[function(e,n,r){var o=!i&&(r||n!==A)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,o}];s<o;s++)if(n=T.relative[e[s].type])c=[d(g(c),n)];else{if(n=T.filter[e[s].type].apply(null,e[s].matches),n[$]){for(r=++s;r<o&&!T.relative[e[r].type];r++);return y(s>1&&g(c),s>1&&h(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,s<r&&b(e.slice(s,r)),r<o&&b(e=e.slice(r)),r<o&&h(e))}c.push(n)}return g(c)}function x(e,n){var o=n.length>0,i=e.length>0,a=function(r,a,s,u,l){var c,f,p,h=0,d="0",g=r&&[],m=[],y=A,b=r||i&&T.find.TAG("*",l),x=W+=null==y?1:Math.random()||.1,w=b.length;for(l&&(A=a===L||a||l);d!==w&&null!=(c=b[d]);d++){if(i&&c){for(f=0,a||c.ownerDocument===L||(O(c),s=!F);p=e[f++];)if(p(c,a||L,s)){u.push(c);break}l&&(W=x)}o&&((c=!p&&c)&&h--,r&&g.push(c))}if(h+=d,o&&d!==h){for(f=0;p=n[f++];)p(g,m,a,s);if(r){if(h>0)for(;d--;)g[d]||m[d]||(m[d]=Y.call(u));m=v(m)}J.apply(u,m),l&&!r&&m.length>0&&h+n.length>1&&t.uniqueSort(u)}return l&&(W=x,A=y),g};return o?r(a):a}var w,C,T,k,j,E,N,S,A,q,D,O,L,H,F,P,I,R,M,$="sizzle"+1*new Date,_=e.document,W=0,B=0,U=n(),z=n(),X=n(),K=function(e,t){return e===t&&(D=!0),0},V={}.hasOwnProperty,G=[],Y=G.pop,Q=G.push,J=G.push,Z=G.slice,ee=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},te="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",re="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",oe="\\["+ne+"*("+re+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+re+"))|)"+ne+"*\\]",ie=":("+re+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+oe+")*)|.*)\\)|)",ae=new RegExp(ne+"+","g"),se=new RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),ue=new RegExp("^"+ne+"*,"+ne+"*"),le=new RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),ce=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(ie),pe=new RegExp("^"+re+"$"),he={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+oe),PSEUDO:new RegExp("^"+ie),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},de=/^(?:input|select|textarea|button)$/i,ge=/^h\d$/i,me=/^[^{]+\{\s*\[native \w/,ve=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ye=/[+~]/,be=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),xe=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},we=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,Ce=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},Te=function(){O()},ke=d(function(e){return e.disabled===!0&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{J.apply(G=Z.call(_.childNodes),_.childNodes),G[_.childNodes.length].nodeType}catch(e){J={apply:G.length?function(e,t){Q.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}C=t.support={},j=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},O=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:_;return r!==L&&9===r.nodeType&&r.documentElement?(L=r,H=L.documentElement,F=!j(L),_!==L&&(n=L.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",Te,!1):n.attachEvent&&n.attachEvent("onunload",Te)),C.attributes=o(function(e){return e.className="i",!e.getAttribute("className")}),C.getElementsByTagName=o(function(e){return e.appendChild(L.createComment("")),!e.getElementsByTagName("*").length}),C.getElementsByClassName=me.test(L.getElementsByClassName),C.getById=o(function(e){return H.appendChild(e).id=$,!L.getElementsByName||!L.getElementsByName($).length}),C.getById?(T.filter.ID=function(e){var t=e.replace(be,xe);return function(e){return e.getAttribute("id")===t}},T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&F){var n=t.getElementById(e);return n?[n]:[]}}):(T.filter.ID=function(e){var t=e.replace(be,xe);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},T.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&F){var n,r,o,i=t.getElementById(e);if(i){if(n=i.getAttributeNode("id"),n&&n.value===e)return[i];for(o=t.getElementsByName(e),r=0;i=o[r++];)if(n=i.getAttributeNode("id"),n&&n.value===e)return[i]}return[]}}),T.find.TAG=C.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):C.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],o=0,i=t.getElementsByTagName(e);if("*"===e){for(;n=i[o++];)1===n.nodeType&&r.push(n);return r}return i},T.find.CLASS=C.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&F)return t.getElementsByClassName(e)},I=[],P=[],(C.qsa=me.test(L.querySelectorAll))&&(o(function(e){H.appendChild(e).innerHTML="<a id='"+$+"'></a><select id='"+$+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&P.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||P.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+$+"-]").length||P.push("~="),e.querySelectorAll(":checked").length||P.push(":checked"),e.querySelectorAll("a#"+$+"+*").length||P.push(".#.+[+~]")}),o(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=L.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&P.push("name"+ne+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&P.push(":enabled",":disabled"),H.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&P.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),P.push(",.*:")})),(C.matchesSelector=me.test(R=H.matches||H.webkitMatchesSelector||H.mozMatchesSelector||H.oMatchesSelector||H.msMatchesSelector))&&o(function(e){C.disconnectedMatch=R.call(e,"*"),R.call(e,"[s!='']:x"),I.push("!=",ie)}),P=P.length&&new RegExp(P.join("|")),I=I.length&&new RegExp(I.join("|")),t=me.test(H.compareDocumentPosition),M=t||me.test(H.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},K=t?function(e,t){if(e===t)return D=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!C.sortDetached&&t.compareDocumentPosition(e)===n?e===L||e.ownerDocument===_&&M(_,e)?-1:t===L||t.ownerDocument===_&&M(_,t)?1:q?ee(q,e)-ee(q,t):0:4&n?-1:1)}:function(e,t){if(e===t)return D=!0,0;var n,r=0,o=e.parentNode,i=t.parentNode,s=[e],u=[t];if(!o||!i)return e===L?-1:t===L?1:o?-1:i?1:q?ee(q,e)-ee(q,t):0;if(o===i)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?a(s[r],u[r]):s[r]===_?-1:u[r]===_?1:0},L):L},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==L&&O(e),n=n.replace(ce,"='$1']"),C.matchesSelector&&F&&!X[n+" "]&&(!I||!I.test(n))&&(!P||!P.test(n)))try{var r=R.call(e,n);if(r||C.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return t(n,L,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==L&&O(e),M(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==L&&O(e);var n=T.attrHandle[t.toLowerCase()],r=n&&V.call(T.attrHandle,t.toLowerCase())?n(e,t,!F):void 0;return void 0!==r?r:C.attributes||!F?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.escape=function(e){return(e+"").replace(we,Ce)},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,o=0;if(D=!C.detectDuplicates,q=!C.sortStable&&e.slice(0),e.sort(K),D){for(;t=e[o++];)t===e[o]&&(r=n.push(o));for(;r--;)e.splice(n[r],1)}return q=null,e},k=t.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=k(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r++];)n+=k(t);return n},T=t.selectors={cacheLength:50,createPseudo:r,match:he,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(be,xe),e[3]=(e[3]||e[4]||e[5]||"").replace(be,xe),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return he.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&fe.test(n)&&(t=E(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(be,xe).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=U[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&U(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(o){var i=t.attr(o,e);return null==i?"!="===n:!n||(i+="","="===n?i===r:"!="===n?i!==r:"^="===n?r&&0===i.indexOf(r):"*="===n?r&&i.indexOf(r)>-1:"$="===n?r&&i.slice(-r.length)===r:"~="===n?(" "+i.replace(ae," ")+" ").indexOf(r)>-1:"|="===n&&(i===r||i.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,o){var i="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===o?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,h,d,g=i!==a?"nextSibling":"previousSibling",m=t.parentNode,v=s&&t.nodeName.toLowerCase(),y=!u&&!s,b=!1;if(m){if(i){for(;g;){for(p=t;p=p[g];)if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;d=g="only"===e&&!d&&"nextSibling"}return!0}if(d=[a?m.firstChild:m.lastChild],a&&y){for(p=m,f=p[$]||(p[$]={}),c=f[p.uniqueID]||(f[p.uniqueID]={}),l=c[e]||[],h=l[0]===W&&l[1],b=h&&l[2],p=h&&m.childNodes[h];p=++h&&p&&p[g]||(b=h=0)||d.pop();)if(1===p.nodeType&&++b&&p===t){c[e]=[W,h,b];break}}else if(y&&(p=t,f=p[$]||(p[$]={}),c=f[p.uniqueID]||(f[p.uniqueID]={}),l=c[e]||[],h=l[0]===W&&l[1],b=h),b===!1)for(;(p=++h&&p&&p[g]||(b=h=0)||d.pop())&&((s?p.nodeName.toLowerCase()!==v:1!==p.nodeType)||!++b||(y&&(f=p[$]||(p[$]={}),c=f[p.uniqueID]||(f[p.uniqueID]={}),c[e]=[W,b]),p!==t)););return b-=o,b===r||b%r===0&&b/r>=0}}},PSEUDO:function(e,n){var o,i=T.pseudos[e]||T.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return i[$]?i(n):i.length>1?(o=[e,e,"",n],T.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,o=i(e,n),a=o.length;a--;)r=ee(e,o[a]),e[r]=!(t[r]=o[a])}):function(e){return i(e,0,o)}):i}},pseudos:{not:r(function(e){var t=[],n=[],o=N(e.replace(se,"$1"));return o[$]?r(function(e,t,n,r){for(var i,a=o(e,null,r,[]),s=e.length;s--;)(i=a[s])&&(e[s]=!(t[s]=i))}):function(e,r,i){return t[0]=e,o(t,null,i,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){ +return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(be,xe),function(t){return(t.textContent||t.innerText||k(t)).indexOf(e)>-1}}),lang:r(function(e){return pe.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(be,xe).toLowerCase(),function(t){var n;do if(n=F?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===H},focus:function(e){return e===L.activeElement&&(!L.hasFocus||L.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:l(!1),disabled:l(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!T.pseudos.empty(e)},header:function(e){return ge.test(e.nodeName)},input:function(e){return de.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:c(function(){return[0]}),last:c(function(e,t){return[t-1]}),eq:c(function(e,t,n){return[n<0?n+t:n]}),even:c(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:c(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:c(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:c(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},T.pseudos.nth=T.pseudos.eq;for(w in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})T.pseudos[w]=s(w);for(w in{submit:!0,reset:!0})T.pseudos[w]=u(w);return p.prototype=T.filters=T.pseudos,T.setFilters=new p,E=t.tokenize=function(e,n){var r,o,i,a,s,u,l,c=z[e+" "];if(c)return n?0:c.slice(0);for(s=e,u=[],l=T.preFilter;s;){r&&!(o=ue.exec(s))||(o&&(s=s.slice(o[0].length)||s),u.push(i=[])),r=!1,(o=le.exec(s))&&(r=o.shift(),i.push({value:r,type:o[0].replace(se," ")}),s=s.slice(r.length));for(a in T.filter)!(o=he[a].exec(s))||l[a]&&!(o=l[a](o))||(r=o.shift(),i.push({value:r,type:a,matches:o}),s=s.slice(r.length));if(!r)break}return n?s.length:s?t.error(e):z(e,u).slice(0)},N=t.compile=function(e,t){var n,r=[],o=[],i=X[e+" "];if(!i){for(t||(t=E(e)),n=t.length;n--;)i=b(t[n]),i[$]?r.push(i):o.push(i);i=X(e,x(o,r)),i.selector=e}return i},S=t.select=function(e,t,n,r){var o,i,a,s,u,l="function"==typeof e&&e,c=!r&&E(e=l.selector||e);if(n=n||[],1===c.length){if(i=c[0]=c[0].slice(0),i.length>2&&"ID"===(a=i[0]).type&&9===t.nodeType&&F&&T.relative[i[1].type]){if(t=(T.find.ID(a.matches[0].replace(be,xe),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(i.shift().value.length)}for(o=he.needsContext.test(e)?0:i.length;o--&&(a=i[o],!T.relative[s=a.type]);)if((u=T.find[s])&&(r=u(a.matches[0].replace(be,xe),ye.test(i[0].type)&&f(t.parentNode)||t))){if(i.splice(o,1),e=r.length&&h(i),!e)return J.apply(n,r),n;break}}return(l||N(e,c))(r,t,!F,n,!t||ye.test(e)&&f(t.parentNode)||t),n},C.sortStable=$.split("").sort(K).join("")===$,C.detectDuplicates=!!D,O(),C.sortDetached=o(function(e){return 1&e.compareDocumentPosition(L.createElement("fieldset"))}),o(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||i("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),C.attributes&&o(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||i("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),o(function(e){return null==e.getAttribute("disabled")})||i(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(e);de.find=be,de.expr=be.selectors,de.expr[":"]=de.expr.pseudos,de.uniqueSort=de.unique=be.uniqueSort,de.text=be.getText,de.isXMLDoc=be.isXML,de.contains=be.contains,de.escapeSelector=be.escape;var xe=function(e,t,n){for(var r=[],o=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(o&&de(e).is(n))break;r.push(e)}return r},we=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},Ce=de.expr.match.needsContext,Te=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,ke=/^.[^:#\[\.,]*$/;de.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?de.find.matchesSelector(r,e)?[r]:[]:de.find.matches(e,de.grep(t,function(e){return 1===e.nodeType}))},de.fn.extend({find:function(e){var t,n,r=this.length,o=this;if("string"!=typeof e)return this.pushStack(de(e).filter(function(){for(t=0;t<r;t++)if(de.contains(o[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)de.find(e,o[t],n);return r>1?de.uniqueSort(n):n},filter:function(e){return this.pushStack(o(this,e||[],!1))},not:function(e){return this.pushStack(o(this,e||[],!0))},is:function(e){return!!o(this,"string"==typeof e&&Ce.test(e)?de(e):e||[],!1).length}});var je,Ee=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,Ne=de.fn.init=function(e,t,n){var r,o;if(!e)return this;if(n=n||je,"string"==typeof e){if(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:Ee.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof de?t[0]:t,de.merge(this,de.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:te,!0)),Te.test(r[1])&&de.isPlainObject(t))for(r in t)de.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return o=te.getElementById(r[2]),o&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):de.isFunction(e)?void 0!==n.ready?n.ready(e):e(de):de.makeArray(e,this)};Ne.prototype=de.fn,je=de(te);var Se=/^(?:parents|prev(?:Until|All))/,Ae={children:!0,contents:!0,next:!0,prev:!0};de.fn.extend({has:function(e){var t=de(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(de.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,o=this.length,i=[],a="string"!=typeof e&&de(e);if(!Ce.test(e))for(;r<o;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&de.find.matchesSelector(n,e))){i.push(n);break}return this.pushStack(i.length>1?de.uniqueSort(i):i)},index:function(e){return e?"string"==typeof e?ae.call(de(e),this[0]):ae.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(de.uniqueSort(de.merge(this.get(),de(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),de.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return xe(e,"parentNode")},parentsUntil:function(e,t,n){return xe(e,"parentNode",n)},next:function(e){return i(e,"nextSibling")},prev:function(e){return i(e,"previousSibling")},nextAll:function(e){return xe(e,"nextSibling")},prevAll:function(e){return xe(e,"previousSibling")},nextUntil:function(e,t,n){return xe(e,"nextSibling",n)},prevUntil:function(e,t,n){return xe(e,"previousSibling",n)},siblings:function(e){return we((e.parentNode||{}).firstChild,e)},children:function(e){return we(e.firstChild)},contents:function(e){return e.contentDocument||de.merge([],e.childNodes)}},function(e,t){de.fn[e]=function(n,r){var o=de.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(o=de.filter(r,o)),this.length>1&&(Ae[e]||de.uniqueSort(o),Se.test(e)&&o.reverse()),this.pushStack(o)}});var qe=/[^\x20\t\r\n\f]+/g;de.Callbacks=function(e){e="string"==typeof e?a(e):de.extend({},e);var t,n,r,o,i=[],s=[],u=-1,l=function(){for(o=e.once,r=t=!0;s.length;u=-1)for(n=s.shift();++u<i.length;)i[u].apply(n[0],n[1])===!1&&e.stopOnFalse&&(u=i.length,n=!1);e.memory||(n=!1),t=!1,o&&(i=n?[]:"")},c={add:function(){return i&&(n&&!t&&(u=i.length-1,s.push(n)),function t(n){de.each(n,function(n,r){de.isFunction(r)?e.unique&&c.has(r)||i.push(r):r&&r.length&&"string"!==de.type(r)&&t(r)})}(arguments),n&&!t&&l()),this},remove:function(){return de.each(arguments,function(e,t){for(var n;(n=de.inArray(t,i,n))>-1;)i.splice(n,1),n<=u&&u--}),this},has:function(e){return e?de.inArray(e,i)>-1:i.length>0},empty:function(){return i&&(i=[]),this},disable:function(){return o=s=[],i=n="",this},disabled:function(){return!i},lock:function(){return o=s=[],n||t||(i=n=""),this},locked:function(){return!!o},fireWith:function(e,n){return o||(n=n||[],n=[e,n.slice?n.slice():n],s.push(n),t||l()),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},de.extend({Deferred:function(t){var n=[["notify","progress",de.Callbacks("memory"),de.Callbacks("memory"),2],["resolve","done",de.Callbacks("once memory"),de.Callbacks("once memory"),0,"resolved"],["reject","fail",de.Callbacks("once memory"),de.Callbacks("once memory"),1,"rejected"]],r="pending",o={state:function(){return r},always:function(){return i.done(arguments).fail(arguments),this},catch:function(e){return o.then(null,e)},pipe:function(){var e=arguments;return de.Deferred(function(t){de.each(n,function(n,r){var o=de.isFunction(e[r[4]])&&e[r[4]];i[r[1]](function(){var e=o&&o.apply(this,arguments);e&&de.isFunction(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,o?[e]:arguments)})}),e=null}).promise()},then:function(t,r,o){function i(t,n,r,o){return function(){var l=this,c=arguments,f=function(){var e,f;if(!(t<a)){if(e=r.apply(l,c),e===n.promise())throw new TypeError("Thenable self-resolution");f=e&&("object"==typeof e||"function"==typeof e)&&e.then,de.isFunction(f)?o?f.call(e,i(a,n,s,o),i(a,n,u,o)):(a++,f.call(e,i(a,n,s,o),i(a,n,u,o),i(a,n,s,n.notifyWith))):(r!==s&&(l=void 0,c=[e]),(o||n.resolveWith)(l,c))}},p=o?f:function(){try{f()}catch(e){de.Deferred.exceptionHook&&de.Deferred.exceptionHook(e,p.stackTrace),t+1>=a&&(r!==u&&(l=void 0,c=[e]),n.rejectWith(l,c))}};t?p():(de.Deferred.getStackHook&&(p.stackTrace=de.Deferred.getStackHook()),e.setTimeout(p))}}var a=0;return de.Deferred(function(e){n[0][3].add(i(0,e,de.isFunction(o)?o:s,e.notifyWith)),n[1][3].add(i(0,e,de.isFunction(t)?t:s)),n[2][3].add(i(0,e,de.isFunction(r)?r:u))}).promise()},promise:function(e){return null!=e?de.extend(e,o):o}},i={};return de.each(n,function(e,t){var a=t[2],s=t[5];o[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[0][2].lock),a.add(t[3].fire),i[t[0]]=function(){return i[t[0]+"With"](this===i?void 0:this,arguments),this},i[t[0]+"With"]=a.fireWith}),o.promise(i),t&&t.call(i,i),i},when:function(e){var t=arguments.length,n=t,r=Array(n),o=re.call(arguments),i=de.Deferred(),a=function(e){return function(n){r[e]=this,o[e]=arguments.length>1?re.call(arguments):n,--t||i.resolveWith(r,o)}};if(t<=1&&(l(e,i.done(a(n)).resolve,i.reject),"pending"===i.state()||de.isFunction(o[n]&&o[n].then)))return i.then();for(;n--;)l(o[n],a(n),i.reject);return i.promise()}});var De=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;de.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&De.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},de.readyException=function(t){e.setTimeout(function(){throw t})};var Oe=de.Deferred();de.fn.ready=function(e){return Oe.then(e).catch(function(e){de.readyException(e)}),this},de.extend({isReady:!1,readyWait:1,holdReady:function(e){e?de.readyWait++:de.ready(!0)},ready:function(e){(e===!0?--de.readyWait:de.isReady)||(de.isReady=!0,e!==!0&&--de.readyWait>0||Oe.resolveWith(te,[de]))}}),de.ready.then=Oe.then,"complete"===te.readyState||"loading"!==te.readyState&&!te.documentElement.doScroll?e.setTimeout(de.ready):(te.addEventListener("DOMContentLoaded",c),e.addEventListener("load",c));var Le=function(e,t,n,r,o,i,a){var s=0,u=e.length,l=null==n;if("object"===de.type(n)){o=!0;for(s in n)Le(e,t,s,n[s],!0,i,a)}else if(void 0!==r&&(o=!0,de.isFunction(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(de(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return o?e:l?t.call(e):u?t(e[0],n):i},He=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};f.uid=1,f.prototype={cache:function(e){var t=e[this.expando];return t||(t={},He(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,o=this.cache(e);if("string"==typeof t)o[de.camelCase(t)]=n;else for(r in t)o[de.camelCase(r)]=t[r];return o},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][de.camelCase(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){de.isArray(t)?t=t.map(de.camelCase):(t=de.camelCase(t),t=t in r?[t]:t.match(qe)||[]),n=t.length;for(;n--;)delete r[t[n]]}(void 0===t||de.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!de.isEmptyObject(t)}};var Fe=new f,Pe=new f,Ie=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Re=/[A-Z]/g;de.extend({hasData:function(e){return Pe.hasData(e)||Fe.hasData(e)},data:function(e,t,n){return Pe.access(e,t,n)},removeData:function(e,t){Pe.remove(e,t)},_data:function(e,t,n){return Fe.access(e,t,n)},_removeData:function(e,t){Fe.remove(e,t)}}),de.fn.extend({data:function(e,t){var n,r,o,i=this[0],a=i&&i.attributes;if(void 0===e){if(this.length&&(o=Pe.get(i),1===i.nodeType&&!Fe.get(i,"hasDataAttrs"))){for(n=a.length;n--;)a[n]&&(r=a[n].name,0===r.indexOf("data-")&&(r=de.camelCase(r.slice(5)),h(i,r,o[r])));Fe.set(i,"hasDataAttrs",!0)}return o}return"object"==typeof e?this.each(function(){Pe.set(this,e)}):Le(this,function(t){var n;if(i&&void 0===t){if(n=Pe.get(i,e),void 0!==n)return n;if(n=h(i,e),void 0!==n)return n}else this.each(function(){Pe.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){Pe.remove(this,e)})}}),de.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Fe.get(e,t),n&&(!r||de.isArray(n)?r=Fe.access(e,t,de.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=de.queue(e,t),r=n.length,o=n.shift(),i=de._queueHooks(e,t),a=function(){de.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete i.stop,o.call(e,a,i)),!r&&i&&i.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Fe.get(e,n)||Fe.access(e,n,{empty:de.Callbacks("once memory").add(function(){Fe.remove(e,[t+"queue",n])})})}}),de.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?de.queue(this[0],e):void 0===t?this:this.each(function(){var n=de.queue(this,e,t);de._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&de.dequeue(this,e)})},dequeue:function(e){return this.each(function(){de.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,o=de.Deferred(),i=this,a=this.length,s=function(){--r||o.resolveWith(i,[i])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";a--;)n=Fe.get(i[a],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(s));return s(),o.promise(t)}});var Me=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,$e=new RegExp("^(?:([+-])=|)("+Me+")([a-z%]*)$","i"),_e=["Top","Right","Bottom","Left"],We=function(e,t){return e=t||e,"none"===e.style.display||""===e.style.display&&de.contains(e.ownerDocument,e)&&"none"===de.css(e,"display")},Be=function(e,t,n,r){var o,i,a={};for(i in t)a[i]=e.style[i],e.style[i]=t[i];o=n.apply(e,r||[]);for(i in t)e.style[i]=a[i];return o},Ue={};de.fn.extend({show:function(){return m(this,!0)},hide:function(){return m(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){We(this)?de(this).show():de(this).hide()})}});var ze=/^(?:checkbox|radio)$/i,Xe=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,Ke=/^$|\/(?:java|ecma)script/i,Ve={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};Ve.optgroup=Ve.option,Ve.tbody=Ve.tfoot=Ve.colgroup=Ve.caption=Ve.thead,Ve.th=Ve.td;var Ge=/<|&#?\w+;/;!function(){var e=te.createDocumentFragment(),t=e.appendChild(te.createElement("div")),n=te.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),pe.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="<textarea>x</textarea>",pe.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var Ye=te.documentElement,Qe=/^key/,Je=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ze=/^([^.]*)(?:\.(.+)|)/;de.event={global:{},add:function(e,t,n,r,o){var i,a,s,u,l,c,f,p,h,d,g,m=Fe.get(e);if(m)for(n.handler&&(i=n,n=i.handler,o=i.selector),o&&de.find.matchesSelector(Ye,o),n.guid||(n.guid=de.guid++),(u=m.events)||(u=m.events={}),(a=m.handle)||(a=m.handle=function(t){return"undefined"!=typeof de&&de.event.triggered!==t.type?de.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(qe)||[""],l=t.length;l--;)s=Ze.exec(t[l])||[],h=g=s[1],d=(s[2]||"").split(".").sort(),h&&(f=de.event.special[h]||{},h=(o?f.delegateType:f.bindType)||h,f=de.event.special[h]||{},c=de.extend({type:h,origType:g,data:r,handler:n,guid:n.guid,selector:o,needsContext:o&&de.expr.match.needsContext.test(o),namespace:d.join(".")},i),(p=u[h])||(p=u[h]=[],p.delegateCount=0,f.setup&&f.setup.call(e,r,d,a)!==!1||e.addEventListener&&e.addEventListener(h,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),o?p.splice(p.delegateCount++,0,c):p.push(c),de.event.global[h]=!0)},remove:function(e,t,n,r,o){var i,a,s,u,l,c,f,p,h,d,g,m=Fe.hasData(e)&&Fe.get(e);if(m&&(u=m.events)){for(t=(t||"").match(qe)||[""],l=t.length;l--;)if(s=Ze.exec(t[l])||[],h=g=s[1],d=(s[2]||"").split(".").sort(),h){for(f=de.event.special[h]||{},h=(r?f.delegateType:f.bindType)||h,p=u[h]||[],s=s[2]&&new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=i=p.length;i--;)c=p[i],!o&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(i,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&f.teardown.call(e,d,m.handle)!==!1||de.removeEvent(e,h,m.handle),delete u[h])}else for(h in u)de.event.remove(e,h+t[l],n,r,!0);de.isEmptyObject(u)&&Fe.remove(e,"handle events")}},dispatch:function(e){var t,n,r,o,i,a,s=de.event.fix(e),u=new Array(arguments.length),l=(Fe.get(this,"events")||{})[s.type]||[],c=de.event.special[s.type]||{};for(u[0]=s,t=1;t<arguments.length;t++)u[t]=arguments[t];if(s.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,s)!==!1){for(a=de.event.handlers.call(this,s,l),t=0;(o=a[t++])&&!s.isPropagationStopped();)for(s.currentTarget=o.elem,n=0;(i=o.handlers[n++])&&!s.isImmediatePropagationStopped();)s.rnamespace&&!s.rnamespace.test(i.namespace)||(s.handleObj=i,s.data=i.data,r=((de.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),void 0!==r&&(s.result=r)===!1&&(s.preventDefault(),s.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,s),s.result}},handlers:function(e,t){var n,r,o,i,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&e.button>=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||l.disabled!==!0)){for(i=[],a={},n=0;n<u;n++)r=t[n],o=r.selector+" ",void 0===a[o]&&(a[o]=r.needsContext?de(o,this).index(l)>-1:de.find(o,this,null,[l]).length),a[o]&&i.push(r);i.length&&s.push({elem:l,handlers:i})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(de.Event.prototype,e,{enumerable:!0,configurable:!0,get:de.isFunction(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[de.expando]?e:new de.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==C()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===C()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&de.nodeName(this,"input"))return this.click(),!1},_default:function(e){return de.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},de.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},de.Event=function(e,t){return this instanceof de.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?x:w,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&de.extend(this,t),this.timeStamp=e&&e.timeStamp||de.now(),void(this[de.expando]=!0)):new de.Event(e,t)},de.Event.prototype={constructor:de.Event,isDefaultPrevented:w,isPropagationStopped:w,isImmediatePropagationStopped:w,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=x,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=x,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=x,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},de.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,char:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&Qe.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&Je.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},de.event.addProp),de.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){de.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,o=e.relatedTarget,i=e.handleObj;return o&&(o===r||de.contains(r,o))||(e.type=i.origType,n=i.handler.apply(this,arguments),e.type=t),n}}}),de.fn.extend({on:function(e,t,n,r){return T(this,e,t,n,r)},one:function(e,t,n,r){return T(this,e,t,n,r,1)},off:function(e,t,n){var r,o;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,de(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(o in e)this.off(o,t,e[o]);return this}return t!==!1&&"function"!=typeof t||(n=t,t=void 0),n===!1&&(n=w),this.each(function(){de.event.remove(this,e,n,t)})}});var et=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,tt=/<script|<style|<link/i,nt=/checked\s*(?:[^=]|=\s*.checked.)/i,rt=/^true\/(.*)/,ot=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;de.extend({htmlPrefilter:function(e){return e.replace(et,"<$1></$2>")},clone:function(e,t,n){var r,o,i,a,s=e.cloneNode(!0),u=de.contains(e.ownerDocument,e);if(!(pe.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||de.isXMLDoc(e)))for(a=v(s),i=v(e),r=0,o=i.length;r<o;r++)S(i[r],a[r]);if(t)if(n)for(i=i||v(e),a=a||v(s),r=0,o=i.length;r<o;r++)N(i[r],a[r]);else N(e,s);return a=v(s,"script"),a.length>0&&y(a,!u&&v(e,"script")),s},cleanData:function(e){for(var t,n,r,o=de.event.special,i=0;void 0!==(n=e[i]);i++)if(He(n)){if(t=n[Fe.expando]){if(t.events)for(r in t.events)o[r]?de.event.remove(n,r):de.removeEvent(n,r,t.handle);n[Fe.expando]=void 0}n[Pe.expando]&&(n[Pe.expando]=void 0)}}}),de.fn.extend({detach:function(e){return q(this,e,!0)},remove:function(e){return q(this,e)},text:function(e){return Le(this,function(e){return void 0===e?de.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return A(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=k(this,e);t.appendChild(e)}})},prepend:function(){return A(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=k(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return A(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return A(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(de.cleanData(v(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return de.clone(this,e,t)})},html:function(e){return Le(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!tt.test(e)&&!Ve[(Xe.exec(e)||["",""])[1].toLowerCase()]){e=de.htmlPrefilter(e);try{for(;n<r;n++)t=this[n]||{},1===t.nodeType&&(de.cleanData(v(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return A(this,arguments,function(t){var n=this.parentNode;de.inArray(this,e)<0&&(de.cleanData(v(this)),n&&n.replaceChild(t,this))},e)}}),de.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){de.fn[e]=function(e){for(var n,r=[],o=de(e),i=o.length-1,a=0;a<=i;a++)n=a===i?this:this.clone(!0),de(o[a])[t](n),ie.apply(r,n.get());return this.pushStack(r)}});var it=/^margin/,at=new RegExp("^("+Me+")(?!px)[a-z%]+$","i"),st=function(t){var n=t.ownerDocument.defaultView;return n&&n.opener||(n=e),n.getComputedStyle(t)};!function(){function t(){if(s){s.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",s.innerHTML="",Ye.appendChild(a);var t=e.getComputedStyle(s);n="1%"!==t.top,i="2px"===t.marginLeft,r="4px"===t.width,s.style.marginRight="50%",o="4px"===t.marginRight,Ye.removeChild(a),s=null}}var n,r,o,i,a=te.createElement("div"),s=te.createElement("div");s.style&&(s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",pe.clearCloneStyle="content-box"===s.style.backgroundClip,a.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",a.appendChild(s),de.extend(pe,{pixelPosition:function(){return t(),n},boxSizingReliable:function(){return t(),r},pixelMarginRight:function(){return t(),o},reliableMarginLeft:function(){return t(),i}}))}();var ut=/^(none|table(?!-c[ea]).+)/,lt={position:"absolute",visibility:"hidden",display:"block"},ct={letterSpacing:"0",fontWeight:"400"},ft=["Webkit","Moz","ms"],pt=te.createElement("div").style;de.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=D(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{float:"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,i,a,s=de.camelCase(t),u=e.style;return t=de.cssProps[s]||(de.cssProps[s]=L(s)||s),a=de.cssHooks[t]||de.cssHooks[s],void 0===n?a&&"get"in a&&void 0!==(o=a.get(e,!1,r))?o:u[t]:(i=typeof n,"string"===i&&(o=$e.exec(n))&&o[1]&&(n=d(e,t,o),i="number"),null!=n&&n===n&&("number"===i&&(n+=o&&o[3]||(de.cssNumber[s]?"":"px")),pe.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u[t]=n)),void 0)}},css:function(e,t,n,r){var o,i,a,s=de.camelCase(t);return t=de.cssProps[s]||(de.cssProps[s]=L(s)||s),a=de.cssHooks[t]||de.cssHooks[s],a&&"get"in a&&(o=a.get(e,!0,n)),void 0===o&&(o=D(e,t,r)),"normal"===o&&t in ct&&(o=ct[t]),""===n||n?(i=parseFloat(o),n===!0||isFinite(i)?i||0:o):o}}),de.each(["height","width"],function(e,t){de.cssHooks[t]={get:function(e,n,r){if(n)return!ut.test(de.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?P(e,t,r):Be(e,lt,function(){return P(e,t,r)})},set:function(e,n,r){var o,i=r&&st(e),a=r&&F(e,t,r,"border-box"===de.css(e,"boxSizing",!1,i),i);return a&&(o=$e.exec(n))&&"px"!==(o[3]||"px")&&(e.style[t]=n,n=de.css(e,t)),H(e,n,a)}}}),de.cssHooks.marginLeft=O(pe.reliableMarginLeft,function(e,t){if(t)return(parseFloat(D(e,"marginLeft"))||e.getBoundingClientRect().left-Be(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),de.each({margin:"",padding:"",border:"Width"},function(e,t){de.cssHooks[e+t]={expand:function(n){for(var r=0,o={},i="string"==typeof n?n.split(" "):[n];r<4;r++)o[e+_e[r]+t]=i[r]||i[r-2]||i[0];return o}},it.test(e)||(de.cssHooks[e+t].set=H)}),de.fn.extend({css:function(e,t){return Le(this,function(e,t,n){var r,o,i={},a=0;if(de.isArray(t)){for(r=st(e),o=t.length;a<o;a++)i[t[a]]=de.css(e,t[a],!1,r);return i}return void 0!==n?de.style(e,t,n):de.css(e,t)},e,t,arguments.length>1)}}),de.Tween=I,I.prototype={constructor:I,init:function(e,t,n,r,o,i){this.elem=e,this.prop=n,this.easing=o||de.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=i||(de.cssNumber[n]?"":"px")},cur:function(){var e=I.propHooks[this.prop];return e&&e.get?e.get(this):I.propHooks._default.get(this)},run:function(e){var t,n=I.propHooks[this.prop];return this.options.duration?this.pos=t=de.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):I.propHooks._default.set(this),this}},I.prototype.init.prototype=I.prototype,I.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=de.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){de.fx.step[e.prop]?de.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[de.cssProps[e.prop]]&&!de.cssHooks[e.prop]?e.elem[e.prop]=e.now:de.style(e.elem,e.prop,e.now+e.unit)}}},I.propHooks.scrollTop=I.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},de.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},de.fx=I.prototype.init,de.fx.step={};var ht,dt,gt=/^(?:toggle|show|hide)$/,mt=/queueHooks$/;de.Animation=de.extend(U,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return d(n.elem,e,$e.exec(t),n),n}]},tweener:function(e,t){de.isFunction(e)?(t=e,e=["*"]):e=e.match(qe);for(var n,r=0,o=e.length;r<o;r++)n=e[r],U.tweeners[n]=U.tweeners[n]||[],U.tweeners[n].unshift(t)},prefilters:[W],prefilter:function(e,t){t?U.prefilters.unshift(e):U.prefilters.push(e)}}),de.speed=function(e,t,n){var r=e&&"object"==typeof e?de.extend({},e):{complete:n||!n&&t||de.isFunction(e)&&e,duration:e,easing:n&&t||t&&!de.isFunction(t)&&t};return de.fx.off||te.hidden?r.duration=0:"number"!=typeof r.duration&&(r.duration in de.fx.speeds?r.duration=de.fx.speeds[r.duration]:r.duration=de.fx.speeds._default),null!=r.queue&&r.queue!==!0||(r.queue="fx"),r.old=r.complete,r.complete=function(){de.isFunction(r.old)&&r.old.call(this),r.queue&&de.dequeue(this,r.queue)},r},de.fn.extend({fadeTo:function(e,t,n,r){return this.filter(We).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){ +var o=de.isEmptyObject(e),i=de.speed(t,n,r),a=function(){var t=U(this,de.extend({},e),i);(o||Fe.get(this,"finish"))&&t.stop(!0)};return a.finish=a,o||i.queue===!1?this.each(a):this.queue(i.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,o=null!=e&&e+"queueHooks",i=de.timers,a=Fe.get(this);if(o)a[o]&&a[o].stop&&r(a[o]);else for(o in a)a[o]&&a[o].stop&&mt.test(o)&&r(a[o]);for(o=i.length;o--;)i[o].elem!==this||null!=e&&i[o].queue!==e||(i[o].anim.stop(n),t=!1,i.splice(o,1));!t&&n||de.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=Fe.get(this),r=n[e+"queue"],o=n[e+"queueHooks"],i=de.timers,a=r?r.length:0;for(n.finish=!0,de.queue(this,e,[]),o&&o.stop&&o.stop.call(this,!0),t=i.length;t--;)i[t].elem===this&&i[t].queue===e&&(i[t].anim.stop(!0),i.splice(t,1));for(t=0;t<a;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),de.each(["toggle","show","hide"],function(e,t){var n=de.fn[t];de.fn[t]=function(e,r,o){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate($(t,!0),e,r,o)}}),de.each({slideDown:$("show"),slideUp:$("hide"),slideToggle:$("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){de.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),de.timers=[],de.fx.tick=function(){var e,t=0,n=de.timers;for(ht=de.now();t<n.length;t++)e=n[t],e()||n[t]!==e||n.splice(t--,1);n.length||de.fx.stop(),ht=void 0},de.fx.timer=function(e){de.timers.push(e),e()?de.fx.start():de.timers.pop()},de.fx.interval=13,de.fx.start=function(){dt||(dt=e.requestAnimationFrame?e.requestAnimationFrame(R):e.setInterval(de.fx.tick,de.fx.interval))},de.fx.stop=function(){e.cancelAnimationFrame?e.cancelAnimationFrame(dt):e.clearInterval(dt),dt=null},de.fx.speeds={slow:600,fast:200,_default:400},de.fn.delay=function(t,n){return t=de.fx?de.fx.speeds[t]||t:t,n=n||"fx",this.queue(n,function(n,r){var o=e.setTimeout(n,t);r.stop=function(){e.clearTimeout(o)}})},function(){var e=te.createElement("input"),t=te.createElement("select"),n=t.appendChild(te.createElement("option"));e.type="checkbox",pe.checkOn=""!==e.value,pe.optSelected=n.selected,e=te.createElement("input"),e.value="t",e.type="radio",pe.radioValue="t"===e.value}();var vt,yt=de.expr.attrHandle;de.fn.extend({attr:function(e,t){return Le(this,de.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){de.removeAttr(this,e)})}}),de.extend({attr:function(e,t,n){var r,o,i=e.nodeType;if(3!==i&&8!==i&&2!==i)return"undefined"==typeof e.getAttribute?de.prop(e,t,n):(1===i&&de.isXMLDoc(e)||(o=de.attrHooks[t.toLowerCase()]||(de.expr.match.bool.test(t)?vt:void 0)),void 0!==n?null===n?void de.removeAttr(e,t):o&&"set"in o&&void 0!==(r=o.set(e,n,t))?r:(e.setAttribute(t,n+""),n):o&&"get"in o&&null!==(r=o.get(e,t))?r:(r=de.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!pe.radioValue&&"radio"===t&&de.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,o=t&&t.match(qe);if(o&&1===e.nodeType)for(;n=o[r++];)e.removeAttribute(n)}}),vt={set:function(e,t,n){return t===!1?de.removeAttr(e,n):e.setAttribute(n,n),n}},de.each(de.expr.match.bool.source.match(/\w+/g),function(e,t){var n=yt[t]||de.find.attr;yt[t]=function(e,t,r){var o,i,a=t.toLowerCase();return r||(i=yt[a],yt[a]=o,o=null!=n(e,t,r)?a:null,yt[a]=i),o}});var bt=/^(?:input|select|textarea|button)$/i,xt=/^(?:a|area)$/i;de.fn.extend({prop:function(e,t){return Le(this,de.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[de.propFix[e]||e]})}}),de.extend({prop:function(e,t,n){var r,o,i=e.nodeType;if(3!==i&&8!==i&&2!==i)return 1===i&&de.isXMLDoc(e)||(t=de.propFix[t]||t,o=de.propHooks[t]),void 0!==n?o&&"set"in o&&void 0!==(r=o.set(e,n,t))?r:e[t]=n:o&&"get"in o&&null!==(r=o.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=de.find.attr(e,"tabindex");return t?parseInt(t,10):bt.test(e.nodeName)||xt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),pe.optSelected||(de.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),de.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){de.propFix[this.toLowerCase()]=this}),de.fn.extend({addClass:function(e){var t,n,r,o,i,a,s,u=0;if(de.isFunction(e))return this.each(function(t){de(this).addClass(e.call(this,t,X(this)))});if("string"==typeof e&&e)for(t=e.match(qe)||[];n=this[u++];)if(o=X(n),r=1===n.nodeType&&" "+z(o)+" "){for(a=0;i=t[a++];)r.indexOf(" "+i+" ")<0&&(r+=i+" ");s=z(r),o!==s&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,o,i,a,s,u=0;if(de.isFunction(e))return this.each(function(t){de(this).removeClass(e.call(this,t,X(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(qe)||[];n=this[u++];)if(o=X(n),r=1===n.nodeType&&" "+z(o)+" "){for(a=0;i=t[a++];)for(;r.indexOf(" "+i+" ")>-1;)r=r.replace(" "+i+" "," ");s=z(r),o!==s&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):de.isFunction(e)?this.each(function(n){de(this).toggleClass(e.call(this,n,X(this),t),t)}):this.each(function(){var t,r,o,i;if("string"===n)for(r=0,o=de(this),i=e.match(qe)||[];t=i[r++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&"boolean"!==n||(t=X(this),t&&Fe.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||e===!1?"":Fe.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+z(X(n))+" ").indexOf(t)>-1)return!0;return!1}});var wt=/\r/g;de.fn.extend({val:function(e){var t,n,r,o=this[0];{if(arguments.length)return r=de.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=r?e.call(this,n,de(this).val()):e,null==o?o="":"number"==typeof o?o+="":de.isArray(o)&&(o=de.map(o,function(e){return null==e?"":e+""})),t=de.valHooks[this.type]||de.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,o,"value")||(this.value=o))});if(o)return t=de.valHooks[o.type]||de.valHooks[o.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(o,"value"))?n:(n=o.value,"string"==typeof n?n.replace(wt,""):null==n?"":n)}}}),de.extend({valHooks:{option:{get:function(e){var t=de.find.attr(e,"value");return null!=t?t:z(de.text(e))}},select:{get:function(e){var t,n,r,o=e.options,i=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?i+1:o.length;for(r=i<0?u:a?i:0;r<u;r++)if(n=o[r],(n.selected||r===i)&&!n.disabled&&(!n.parentNode.disabled||!de.nodeName(n.parentNode,"optgroup"))){if(t=de(n).val(),a)return t;s.push(t)}return s},set:function(e,t){for(var n,r,o=e.options,i=de.makeArray(t),a=o.length;a--;)r=o[a],(r.selected=de.inArray(de.valHooks.option.get(r),i)>-1)&&(n=!0);return n||(e.selectedIndex=-1),i}}}}),de.each(["radio","checkbox"],function(){de.valHooks[this]={set:function(e,t){if(de.isArray(t))return e.checked=de.inArray(de(e).val(),t)>-1}},pe.checkOn||(de.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Ct=/^(?:focusinfocus|focusoutblur)$/;de.extend(de.event,{trigger:function(t,n,r,o){var i,a,s,u,l,c,f,p=[r||te],h=le.call(t,"type")?t.type:t,d=le.call(t,"namespace")?t.namespace.split("."):[];if(a=s=r=r||te,3!==r.nodeType&&8!==r.nodeType&&!Ct.test(h+de.event.triggered)&&(h.indexOf(".")>-1&&(d=h.split("."),h=d.shift(),d.sort()),l=h.indexOf(":")<0&&"on"+h,t=t[de.expando]?t:new de.Event(h,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=d.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+d.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=r),n=null==n?[t]:de.makeArray(n,[t]),f=de.event.special[h]||{},o||!f.trigger||f.trigger.apply(r,n)!==!1)){if(!o&&!f.noBubble&&!de.isWindow(r)){for(u=f.delegateType||h,Ct.test(u+h)||(a=a.parentNode);a;a=a.parentNode)p.push(a),s=a;s===(r.ownerDocument||te)&&p.push(s.defaultView||s.parentWindow||e)}for(i=0;(a=p[i++])&&!t.isPropagationStopped();)t.type=i>1?u:f.bindType||h,c=(Fe.get(a,"events")||{})[t.type]&&Fe.get(a,"handle"),c&&c.apply(a,n),c=l&&a[l],c&&c.apply&&He(a)&&(t.result=c.apply(a,n),t.result===!1&&t.preventDefault());return t.type=h,o||t.isDefaultPrevented()||f._default&&f._default.apply(p.pop(),n)!==!1||!He(r)||l&&de.isFunction(r[h])&&!de.isWindow(r)&&(s=r[l],s&&(r[l]=null),de.event.triggered=h,r[h](),de.event.triggered=void 0,s&&(r[l]=s)),t.result}},simulate:function(e,t,n){var r=de.extend(new de.Event,n,{type:e,isSimulated:!0});de.event.trigger(r,null,t)}}),de.fn.extend({trigger:function(e,t){return this.each(function(){de.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return de.event.trigger(e,t,n,!0)}}),de.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){de.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),de.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),pe.focusin="onfocusin"in e,pe.focusin||de.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){de.event.simulate(t,e.target,de.event.fix(e))};de.event.special[t]={setup:function(){var r=this.ownerDocument||this,o=Fe.access(r,t);o||r.addEventListener(e,n,!0),Fe.access(r,t,(o||0)+1)},teardown:function(){var r=this.ownerDocument||this,o=Fe.access(r,t)-1;o?Fe.access(r,t,o):(r.removeEventListener(e,n,!0),Fe.remove(r,t))}}});var Tt=e.location,kt=de.now(),jt=/\?/;de.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||de.error("Invalid XML: "+t),n};var Et=/\[\]$/,Nt=/\r?\n/g,St=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;de.param=function(e,t){var n,r=[],o=function(e,t){var n=de.isFunction(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(de.isArray(e)||e.jquery&&!de.isPlainObject(e))de.each(e,function(){o(this.name,this.value)});else for(n in e)K(n,e[n],t,o);return r.join("&")},de.fn.extend({serialize:function(){return de.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=de.prop(this,"elements");return e?de.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!de(this).is(":disabled")&&At.test(this.nodeName)&&!St.test(e)&&(this.checked||!ze.test(e))}).map(function(e,t){var n=de(this).val();return null==n?null:de.isArray(n)?de.map(n,function(e){return{name:t.name,value:e.replace(Nt,"\r\n")}}):{name:t.name,value:n.replace(Nt,"\r\n")}}).get()}});var qt=/%20/g,Dt=/#.*$/,Ot=/([?&])_=[^&]*/,Lt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ht=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ft=/^(?:GET|HEAD)$/,Pt=/^\/\//,It={},Rt={},Mt="*/".concat("*"),$t=te.createElement("a");$t.href=Tt.href,de.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Tt.href,type:"GET",isLocal:Ht.test(Tt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Mt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":de.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Y(Y(e,de.ajaxSettings),t):Y(de.ajaxSettings,e)},ajaxPrefilter:V(It),ajaxTransport:V(Rt),ajax:function(t,n){function r(t,n,r,s){var l,p,h,x,w,C=n;c||(c=!0,u&&e.clearTimeout(u),o=void 0,a=s||"",T.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(x=Q(d,T,r)),x=J(d,x,T,l),l?(d.ifModified&&(w=T.getResponseHeader("Last-Modified"),w&&(de.lastModified[i]=w),w=T.getResponseHeader("etag"),w&&(de.etag[i]=w)),204===t||"HEAD"===d.type?C="nocontent":304===t?C="notmodified":(C=x.state,p=x.data,h=x.error,l=!h)):(h=C,!t&&C||(C="error",t<0&&(t=0))),T.status=t,T.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,T]):v.rejectWith(g,[T,C,h]),T.statusCode(b),b=void 0,f&&m.trigger(l?"ajaxSuccess":"ajaxError",[T,d,l?p:h]),y.fireWith(g,[T,C]),f&&(m.trigger("ajaxComplete",[T,d]),--de.active||de.event.trigger("ajaxStop")))}"object"==typeof t&&(n=t,t=void 0),n=n||{};var o,i,a,s,u,l,c,f,p,h,d=de.ajaxSetup({},n),g=d.context||d,m=d.context&&(g.nodeType||g.jquery)?de(g):de.event,v=de.Deferred(),y=de.Callbacks("once memory"),b=d.statusCode||{},x={},w={},C="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s)for(s={};t=Lt.exec(a);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,x[e]=t),this},overrideMimeType:function(e){return null==c&&(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)T.always(e[T.status]);else for(t in e)b[t]=[b[t],e[t]];return this},abort:function(e){var t=e||C;return o&&o.abort(t),r(0,t),this}};if(v.promise(T),d.url=((t||d.url||Tt.href)+"").replace(Pt,Tt.protocol+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=(d.dataType||"*").toLowerCase().match(qe)||[""],null==d.crossDomain){l=te.createElement("a");try{l.href=d.url,l.href=l.href,d.crossDomain=$t.protocol+"//"+$t.host!=l.protocol+"//"+l.host}catch(e){d.crossDomain=!0}}if(d.data&&d.processData&&"string"!=typeof d.data&&(d.data=de.param(d.data,d.traditional)),G(It,d,n,T),c)return T;f=de.event&&d.global,f&&0===de.active++&&de.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Ft.test(d.type),i=d.url.replace(Dt,""),d.hasContent?d.data&&d.processData&&0===(d.contentType||"").indexOf("application/x-www-form-urlencoded")&&(d.data=d.data.replace(qt,"+")):(h=d.url.slice(i.length),d.data&&(i+=(jt.test(i)?"&":"?")+d.data,delete d.data),d.cache===!1&&(i=i.replace(Ot,"$1"),h=(jt.test(i)?"&":"?")+"_="+kt++ +h),d.url=i+h),d.ifModified&&(de.lastModified[i]&&T.setRequestHeader("If-Modified-Since",de.lastModified[i]),de.etag[i]&&T.setRequestHeader("If-None-Match",de.etag[i])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&T.setRequestHeader("Content-Type",d.contentType),T.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Mt+"; q=0.01":""):d.accepts["*"]);for(p in d.headers)T.setRequestHeader(p,d.headers[p]);if(d.beforeSend&&(d.beforeSend.call(g,T,d)===!1||c))return T.abort();if(C="abort",y.add(d.complete),T.done(d.success),T.fail(d.error),o=G(Rt,d,n,T)){if(T.readyState=1,f&&m.trigger("ajaxSend",[T,d]),c)return T;d.async&&d.timeout>0&&(u=e.setTimeout(function(){T.abort("timeout")},d.timeout));try{c=!1,o.send(x,r)}catch(e){if(c)throw e;r(-1,e)}}else r(-1,"No Transport");return T},getJSON:function(e,t,n){return de.get(e,t,n,"json")},getScript:function(e,t){return de.get(e,void 0,t,"script")}}),de.each(["get","post"],function(e,t){de[t]=function(e,n,r,o){return de.isFunction(n)&&(o=o||r,r=n,n=void 0),de.ajax(de.extend({url:e,type:t,dataType:o,data:n,success:r},de.isPlainObject(e)&&e))}}),de._evalUrl=function(e){return de.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,throws:!0})},de.fn.extend({wrapAll:function(e){var t;return this[0]&&(de.isFunction(e)&&(e=e.call(this[0])),t=de(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return de.isFunction(e)?this.each(function(t){de(this).wrapInner(e.call(this,t))}):this.each(function(){var t=de(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=de.isFunction(e);return this.each(function(n){de(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){de(this).replaceWith(this.childNodes)}),this}}),de.expr.pseudos.hidden=function(e){return!de.expr.pseudos.visible(e)},de.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},de.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var _t={0:200,1223:204},Wt=de.ajaxSettings.xhr();pe.cors=!!Wt&&"withCredentials"in Wt,pe.ajax=Wt=!!Wt,de.ajaxTransport(function(t){var n,r;if(pe.cors||Wt&&!t.crossDomain)return{send:function(o,i){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");for(a in o)s.setRequestHeader(a,o[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?i(0,"error"):i(s.status,s.statusText):i(_t[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),de.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),de.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return de.globalEval(e),e}}}),de.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),de.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,o){t=de("<script>").prop({charset:e.scriptCharset,src:e.url}).on("load error",n=function(e){t.remove(),n=null,e&&o("error"===e.type?404:200,e.type)}),te.head.appendChild(t[0])},abort:function(){n&&n()}}}});var Bt=[],Ut=/(=)\?(?=&|$)|\?\?/;de.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Bt.pop()||de.expando+"_"+kt++;return this[e]=!0,e}}),de.ajaxPrefilter("json jsonp",function(t,n,r){var o,i,a,s=t.jsonp!==!1&&(Ut.test(t.url)?"url":"string"==typeof t.data&&0===(t.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(t.data)&&"data");if(s||"jsonp"===t.dataTypes[0])return o=t.jsonpCallback=de.isFunction(t.jsonpCallback)?t.jsonpCallback():t.jsonpCallback,s?t[s]=t[s].replace(Ut,"$1"+o):t.jsonp!==!1&&(t.url+=(jt.test(t.url)?"&":"?")+t.jsonp+"="+o),t.converters["script json"]=function(){return a||de.error(o+" was not called"),a[0]},t.dataTypes[0]="json",i=e[o],e[o]=function(){a=arguments},r.always(function(){void 0===i?de(e).removeProp(o):e[o]=i,t[o]&&(t.jsonpCallback=n.jsonpCallback,Bt.push(o)),a&&de.isFunction(i)&&i(a[0]),a=i=void 0}),"script"}),pe.createHTMLDocument=function(){var e=te.implementation.createHTMLDocument("").body;return e.innerHTML="<form></form><form></form>",2===e.childNodes.length}(),de.parseHTML=function(e,t,n){if("string"!=typeof e)return[];"boolean"==typeof t&&(n=t,t=!1);var r,o,i;return t||(pe.createHTMLDocument?(t=te.implementation.createHTMLDocument(""),r=t.createElement("base"),r.href=te.location.href,t.head.appendChild(r)):t=te),o=Te.exec(e),i=!n&&[],o?[t.createElement(o[1])]:(o=b([e],t,i),i&&i.length&&de(i).remove(),de.merge([],o.childNodes))},de.fn.load=function(e,t,n){var r,o,i,a=this,s=e.indexOf(" ");return s>-1&&(r=z(e.slice(s)),e=e.slice(0,s)),de.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(o="POST"),a.length>0&&de.ajax({url:e,type:o||"GET",dataType:"html",data:t}).done(function(e){i=arguments,a.html(r?de("<div>").append(de.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,i||[e.responseText,t,e])})}),this},de.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){de.fn[t]=function(e){return this.on(t,e)}}),de.expr.pseudos.animated=function(e){return de.grep(de.timers,function(t){return e===t.elem}).length},de.offset={setOffset:function(e,t,n){var r,o,i,a,s,u,l,c=de.css(e,"position"),f=de(e),p={};"static"===c&&(e.style.position="relative"),s=f.offset(),i=de.css(e,"top"),u=de.css(e,"left"),l=("absolute"===c||"fixed"===c)&&(i+u).indexOf("auto")>-1,l?(r=f.position(),a=r.top,o=r.left):(a=parseFloat(i)||0,o=parseFloat(u)||0),de.isFunction(t)&&(t=t.call(e,n,de.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+o),"using"in t?t.using.call(e,p):f.css(p)}},de.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){de.offset.setOffset(this,e,t)});var t,n,r,o,i=this[0];if(i)return i.getClientRects().length?(r=i.getBoundingClientRect(),r.width||r.height?(o=i.ownerDocument,n=Z(o),t=o.documentElement,{top:r.top+n.pageYOffset-t.clientTop,left:r.left+n.pageXOffset-t.clientLeft}):r):{top:0,left:0}},position:function(){if(this[0]){var e,t,n=this[0],r={top:0,left:0};return"fixed"===de.css(n,"position")?t=n.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),de.nodeName(e[0],"html")||(r=e.offset()),r={top:r.top+de.css(e[0],"borderTopWidth",!0),left:r.left+de.css(e[0],"borderLeftWidth",!0)}),{top:t.top-r.top-de.css(n,"marginTop",!0),left:t.left-r.left-de.css(n,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&"static"===de.css(e,"position");)e=e.offsetParent;return e||Ye})}}),de.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n="pageYOffset"===t;de.fn[e]=function(r){return Le(this,function(e,r,o){var i=Z(e);return void 0===o?i?i[t]:e[r]:void(i?i.scrollTo(n?i.pageXOffset:o,n?o:i.pageYOffset):e[r]=o)},e,r,arguments.length)}}),de.each(["top","left"],function(e,t){de.cssHooks[t]=O(pe.pixelPosition,function(e,n){if(n)return n=D(e,t),at.test(n)?de(e).position()[t]+"px":n})}),de.each({Height:"height",Width:"width"},function(e,t){de.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){de.fn[r]=function(o,i){var a=arguments.length&&(n||"boolean"!=typeof o),s=n||(o===!0||i===!0?"margin":"border");return Le(this,function(t,n,o){var i;return de.isWindow(t)?0===r.indexOf("outer")?t["inner"+e]:t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===o?de.css(t,n,s):de.style(t,n,o,s)},t,a?o:void 0,a)}})}),de.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),de.parseJSON=JSON.parse,"function"==typeof define&&define.amd&&define("jquery",[],function(){return de});var zt=e.jQuery,Xt=e.$;return de.noConflict=function(t){return e.$===de&&(e.$=Xt),t&&e.jQuery===de&&(e.jQuery=zt),de},t||(e.jQuery=e.$=de),de})},{}],2:[function(e,t,n){!function(e,n,r){function o(e,t,n){return e.addEventListener?void e.addEventListener(t,n,!1):void e.attachEvent("on"+t,n)}function i(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return y[e.which]?y[e.which]:b[e.which]?b[e.which]:String.fromCharCode(e.which).toLowerCase()}function a(e,t){return e.sort().join(",")===t.sort().join(",")}function s(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}function u(e){return e.preventDefault?void e.preventDefault():void(e.returnValue=!1)}function l(e){return e.stopPropagation?void e.stopPropagation():void(e.cancelBubble=!0)}function c(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function f(){if(!v){v={};for(var e in y)e>95&&e<112||y.hasOwnProperty(e)&&(v[y[e]]=e)}return v}function p(e,t,n){return n||(n=f()[e]?"keydown":"keypress"),"keypress"==n&&t.length&&(n="keydown"),n}function h(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus"),e.split("+"))}function d(e,t){var n,r,o,i=[];for(n=h(e),o=0;o<n.length;++o)r=n[o],w[r]&&(r=w[r]),t&&"keypress"!=t&&x[r]&&(r=x[r],i.push("shift")),c(r)&&i.push(r);return t=p(r,i,t),{key:r,modifiers:i,action:t}}function g(e,t){return null!==e&&e!==n&&(e===t||g(e.parentNode,t))}function m(e){function t(e){e=e||{};var t,n=!1;for(t in x)e[t]?n=!0:x[t]=0;n||(T=!1)}function r(e,t,n,r,o,i){var s,u,l=[],f=n.type;if(!y._callbacks[e])return[];for("keyup"==f&&c(e)&&(t=[e]),s=0;s<y._callbacks[e].length;++s)if(u=y._callbacks[e][s],(r||!u.seq||x[u.seq]==u.level)&&f==u.action&&("keypress"==f&&!n.metaKey&&!n.ctrlKey||a(t,u.modifiers))){var p=!r&&u.combo==o,h=r&&u.seq==r&&u.level==i;(p||h)&&y._callbacks[e].splice(s,1),l.push(u)}return l}function f(e,t,n,r){y.stopCallback(t,t.target||t.srcElement,n,r)||e(t,n)===!1&&(u(t),l(t))}function p(e){"number"!=typeof e.which&&(e.which=e.keyCode);var t=i(e);if(t)return"keyup"==e.type&&w===t?void(w=!1):void y.handleKey(t,s(e),e)}function h(){clearTimeout(b),b=setTimeout(t,1e3)}function g(e,n,r,o){function a(t){return function(){T=t,++x[e],h()}}function s(n){f(r,n,e),"keyup"!==o&&(w=i(n)),setTimeout(t,10)}x[e]=0;for(var u=0;u<n.length;++u){var l=u+1===n.length,c=l?s:a(o||d(n[u+1]).action);v(n[u],c,o,e,u)}}function v(e,t,n,o,i){y._directMap[e+":"+n]=t,e=e.replace(/\s+/g," ");var a,s=e.split(" ");return s.length>1?void g(e,s,t,n):(a=d(e,n),y._callbacks[a.key]=y._callbacks[a.key]||[],r(a.key,a.modifiers,{type:a.action},o,e,i),void y._callbacks[a.key][o?"unshift":"push"]({callback:t,modifiers:a.modifiers,action:a.action,seq:o,level:i,combo:e}))}var y=this;if(e=e||n,!(y instanceof m))return new m(e);y.target=e,y._callbacks={},y._directMap={};var b,x={},w=!1,C=!1,T=!1;y._handleKey=function(e,n,o){var i,a=r(e,n,o),s={},u=0,l=!1;for(i=0;i<a.length;++i)a[i].seq&&(u=Math.max(u,a[i].level));for(i=0;i<a.length;++i)if(a[i].seq){if(a[i].level!=u)continue;l=!0,s[a[i].seq]=1,f(a[i].callback,o,a[i].combo,a[i].seq)}else l||f(a[i].callback,o,a[i].combo);var p="keypress"==o.type&&C;o.type!=T||c(e)||p||t(s),C=l&&"keydown"==o.type},y._bindMultiple=function(e,t,n){for(var r=0;r<e.length;++r)v(e[r],t,n)},o(e,"keypress",p),o(e,"keydown",p),o(e,"keyup",p)}if(e){for(var v,y={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},b={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},x={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},w={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},C=1;C<20;++C)y[111+C]="f"+C;for(C=0;C<=9;++C)y[C+96]=C;m.prototype.bind=function(e,t,n){var r=this;return e=e instanceof Array?e:[e],r._bindMultiple.call(r,e,t,n),r},m.prototype.unbind=function(e,t){var n=this;return n.bind.call(n,e,function(){},t)},m.prototype.trigger=function(e,t){var n=this;return n._directMap[e+":"+t]&&n._directMap[e+":"+t]({},e),n},m.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},m.prototype.stopCallback=function(e,t){var n=this;return!((" "+t.className+" ").indexOf(" mousetrap ")>-1)&&(!g(t,n.target)&&("INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable))},m.prototype.handleKey=function(){var e=this;return e._handleKey.apply(e,arguments)},m.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(y[t]=e[t]);v=null},m.init=function(){var e=m(n);for(var t in e)"_"!==t.charAt(0)&&(m[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},m.init(),e.Mousetrap=m,"undefined"!=typeof t&&t.exports&&(t.exports=m),"function"==typeof define&&define.amd&&define(function(){return m})}}("undefined"!=typeof window?window:null,"undefined"!=typeof window?document:null)},{}],3:[function(e,t,n){(function(e){!function(r){function o(e){throw new RangeError(L[e])}function i(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function a(e,t){var n=e.split("@"),r="";n.length>1&&(r=n[0]+"@",e=n[1]),e=e.replace(O,".");var o=e.split("."),a=i(o,t).join(".");return r+a}function s(e){for(var t,n,r=[],o=0,i=e.length;o<i;)t=e.charCodeAt(o++),t>=55296&&t<=56319&&o<i?(n=e.charCodeAt(o++),56320==(64512&n)?r.push(((1023&t)<<10)+(1023&n)+65536):(r.push(t),o--)):r.push(t);return r}function u(e){return i(e,function(e){var t="";return e>65535&&(e-=65536,t+=P(e>>>10&1023|55296),e=56320|1023&e),t+=P(e)}).join("")}function l(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:C}function c(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function f(e,t,n){var r=0;for(e=n?F(e/E):e>>1,e+=F(e/t);e>H*k>>1;r+=C)e=F(e/H);return F(r+(H+1)*e/(e+j))}function p(e){var t,n,r,i,a,s,c,p,h,d,g=[],m=e.length,v=0,y=S,b=N;for(n=e.lastIndexOf(A),n<0&&(n=0),r=0;r<n;++r)e.charCodeAt(r)>=128&&o("not-basic"),g.push(e.charCodeAt(r));for(i=n>0?n+1:0;i<m;){for(a=v,s=1,c=C;i>=m&&o("invalid-input"),p=l(e.charCodeAt(i++)),(p>=C||p>F((w-v)/s))&&o("overflow"),v+=p*s,h=c<=b?T:c>=b+k?k:c-b,!(p<h);c+=C)d=C-h,s>F(w/d)&&o("overflow"),s*=d;t=g.length+1,b=f(v-a,t,0==a),F(v/t)>w-y&&o("overflow"),y+=F(v/t),v%=t,g.splice(v++,0,y)}return u(g)}function h(e){var t,n,r,i,a,u,l,p,h,d,g,m,v,y,b,x=[];for(e=s(e),m=e.length,t=S,n=0,a=N,u=0;u<m;++u)g=e[u],g<128&&x.push(P(g));for(r=i=x.length,i&&x.push(A);r<m;){for(l=w,u=0;u<m;++u)g=e[u],g>=t&&g<l&&(l=g);for(v=r+1,l-t>F((w-n)/v)&&o("overflow"),n+=(l-t)*v,t=l,u=0;u<m;++u)if(g=e[u],g<t&&++n>w&&o("overflow"),g==t){for(p=n,h=C;d=h<=a?T:h>=a+k?k:h-a,!(p<d);h+=C)b=p-d,y=C-d,x.push(P(c(d+b%y,0))),p=F(b/y);x.push(P(c(p,0))),a=f(n,v,r==i),n=0,++r}++n,++t}return x.join("")}function d(e){return a(e,function(e){return q.test(e)?p(e.slice(4).toLowerCase()):e})}function g(e){return a(e,function(e){return D.test(e)?"xn--"+h(e):e})}var m="object"==typeof n&&n&&!n.nodeType&&n,v="object"==typeof t&&t&&!t.nodeType&&t,y="object"==typeof e&&e;y.global!==y&&y.window!==y&&y.self!==y||(r=y);var b,x,w=2147483647,C=36,T=1,k=26,j=38,E=700,N=72,S=128,A="-",q=/^xn--/,D=/[^\x20-\x7E]/,O=/[\x2E\u3002\uFF0E\uFF61]/g,L={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},H=C-T,F=Math.floor,P=String.fromCharCode;if(b={version:"1.4.1",ucs2:{decode:s,encode:u},decode:p,encode:h,toASCII:g,toUnicode:d},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return b});else if(m&&v)if(t.exports==m)v.exports=b;else for(x in b)b.hasOwnProperty(x)&&(m[x]=b[x]);else r.punycode=b}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],4:[function(e,t,n){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,n,i){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var s=/\+/g;e=e.split(t);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var l=e.length;u>0&&l>u&&(l=u);for(var c=0;c<l;++c){var f,p,h,d,g=e[c].replace(s,"%20"),m=g.indexOf(n);m>=0?(f=g.substr(0,m),p=g.substr(m+1)):(f=g,p=""),h=decodeURIComponent(f),d=decodeURIComponent(p), +r(a,h)?o(a[h])?a[h].push(d):a[h]=[a[h],d]:a[h]=d}return a};var o=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],5:[function(e,t,n){"use strict";function r(e,t){if(e.map)return e.map(t);for(var n=[],r=0;r<e.length;r++)n.push(t(e[r],r));return n}var o=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,n,s){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?r(a(e),function(a){var s=encodeURIComponent(o(a))+n;return i(e[a])?r(e[a],function(e){return s+encodeURIComponent(o(e))}).join(t):s+encodeURIComponent(o(e[a]))}).join(t):s?encodeURIComponent(o(s))+n+encodeURIComponent(o(e)):""};var i=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},a=Object.keys||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}},{}],6:[function(e,t,n){"use strict";n.decode=n.parse=e("./decode"),n.encode=n.stringify=e("./encode")},{"./decode":4,"./encode":5}],7:[function(e,t,n){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function o(e,t,n){if(e&&l.isObject(e)&&e instanceof r)return e;var o=new r;return o.parse(e,t,n),o}function i(e){return l.isString(e)&&(e=o(e)),e instanceof r?e.format():r.prototype.format.call(e)}function a(e,t){return o(e,!1,!0).resolve(t)}function s(e,t){return e?o(e,!1,!0).resolveObject(t):t}var u=e("punycode"),l=e("./util");n.parse=o,n.resolve=a,n.resolveObject=s,n.format=i,n.Url=r;var c=/^([a-z0-9.+-]+:)/i,f=/:[0-9]*$/,p=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,h=["<",">",'"',"`"," ","\r","\n","\t"],d=["{","}","|","\\","^","`"].concat(h),g=["'"].concat(d),m=["%","/","?",";","#"].concat(g),v=["/","?","#"],y=255,b=/^[+a-z0-9A-Z_-]{0,63}$/,x=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,w={javascript:!0,"javascript:":!0},C={javascript:!0,"javascript:":!0},T={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},k=e("querystring");r.prototype.parse=function(e,t,n){if(!l.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),o=r!==-1&&r<e.indexOf("#")?"?":"#",i=e.split(o),a=/\\/g;i[0]=i[0].replace(a,"/"),e=i.join(o);var s=e;if(s=s.trim(),!n&&1===e.split("#").length){var f=p.exec(s);if(f)return this.path=s,this.href=s,this.pathname=f[1],f[2]?(this.search=f[2],t?this.query=k.parse(this.search.substr(1)):this.query=this.search.substr(1)):t&&(this.search="",this.query={}),this}var h=c.exec(s);if(h){h=h[0];var d=h.toLowerCase();this.protocol=d,s=s.substr(h.length)}if(n||h||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var j="//"===s.substr(0,2);!j||h&&C[h]||(s=s.substr(2),this.slashes=!0)}if(!C[h]&&(j||h&&!T[h])){for(var E=-1,N=0;N<v.length;N++){var S=s.indexOf(v[N]);S!==-1&&(E===-1||S<E)&&(E=S)}var A,q;q=E===-1?s.lastIndexOf("@"):s.lastIndexOf("@",E),q!==-1&&(A=s.slice(0,q),s=s.slice(q+1),this.auth=decodeURIComponent(A)),E=-1;for(var N=0;N<m.length;N++){var S=s.indexOf(m[N]);S!==-1&&(E===-1||S<E)&&(E=S)}E===-1&&(E=s.length),this.host=s.slice(0,E),s=s.slice(E),this.parseHost(),this.hostname=this.hostname||"";var D="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!D)for(var O=this.hostname.split(/\./),N=0,L=O.length;N<L;N++){var H=O[N];if(H&&!H.match(b)){for(var F="",P=0,I=H.length;P<I;P++)F+=H.charCodeAt(P)>127?"x":H[P];if(!F.match(b)){var R=O.slice(0,N),M=O.slice(N+1),$=H.match(x);$&&(R.push($[1]),M.unshift($[2])),M.length&&(s="/"+M.join(".")+s),this.hostname=R.join(".");break}}}this.hostname.length>y?this.hostname="":this.hostname=this.hostname.toLowerCase(),D||(this.hostname=u.toASCII(this.hostname));var _=this.port?":"+this.port:"",W=this.hostname||"";this.host=W+_,this.href+=this.host,D&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!w[d])for(var N=0,L=g.length;N<L;N++){var B=g[N];if(s.indexOf(B)!==-1){var U=encodeURIComponent(B);U===B&&(U=escape(B)),s=s.split(B).join(U)}}var z=s.indexOf("#");z!==-1&&(this.hash=s.substr(z),s=s.slice(0,z));var X=s.indexOf("?");if(X!==-1?(this.search=s.substr(X),this.query=s.substr(X+1),t&&(this.query=k.parse(this.query)),s=s.slice(0,X)):t&&(this.search="",this.query={}),s&&(this.pathname=s),T[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var _=this.pathname||"",K=this.search||"";this.path=_+K}return this.href=this.format(),this},r.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var t=this.protocol||"",n=this.pathname||"",r=this.hash||"",o=!1,i="";this.host?o=e+this.host:this.hostname&&(o=e+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(o+=":"+this.port)),this.query&&l.isObject(this.query)&&Object.keys(this.query).length&&(i=k.stringify(this.query));var a=this.search||i&&"?"+i||"";return t&&":"!==t.substr(-1)&&(t+=":"),this.slashes||(!t||T[t])&&o!==!1?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),a=a.replace("#","%23"),t+o+n+a+r},r.prototype.resolve=function(e){return this.resolveObject(o(e,!1,!0)).format()},r.prototype.resolveObject=function(e){if(l.isString(e)){var t=new r;t.parse(e,!1,!0),e=t}for(var n=new r,o=Object.keys(this),i=0;i<o.length;i++){var a=o[i];n[a]=this[a]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),u=0;u<s.length;u++){var c=s[u];"protocol"!==c&&(n[c]=e[c])}return T[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!T[e.protocol]){for(var f=Object.keys(e),p=0;p<f.length;p++){var h=f[p];n[h]=e[h]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||C[e.protocol])n.pathname=e.pathname;else{for(var d=(e.pathname||"").split("/");d.length&&!(e.host=d.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var g=n.pathname||"",m=n.search||"";n.path=g+m}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var v=n.pathname&&"/"===n.pathname.charAt(0),y=e.host||e.pathname&&"/"===e.pathname.charAt(0),b=y||v||n.host&&e.pathname,x=b,w=n.pathname&&n.pathname.split("/")||[],d=e.pathname&&e.pathname.split("/")||[],k=n.protocol&&!T[n.protocol];if(k&&(n.hostname="",n.port=null,n.host&&(""===w[0]?w[0]=n.host:w.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===d[0]?d[0]=e.host:d.unshift(e.host)),e.host=null),b=b&&(""===d[0]||""===w[0])),y)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,w=d;else if(d.length)w||(w=[]),w.pop(),w=w.concat(d),n.search=e.search,n.query=e.query;else if(!l.isNullOrUndefined(e.search)){if(k){n.hostname=n.host=w.shift();var j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");j&&(n.auth=j.shift(),n.host=n.hostname=j.shift())}return n.search=e.search,n.query=e.query,l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!w.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var E=w.slice(-1)[0],N=(n.host||e.host||w.length>1)&&("."===E||".."===E)||""===E,S=0,A=w.length;A>=0;A--)E=w[A],"."===E?w.splice(A,1):".."===E?(w.splice(A,1),S++):S&&(w.splice(A,1),S--);if(!b&&!x)for(;S--;S)w.unshift("..");!b||""===w[0]||w[0]&&"/"===w[0].charAt(0)||w.unshift(""),N&&"/"!==w.join("/").substr(-1)&&w.push("");var q=""===w[0]||w[0]&&"/"===w[0].charAt(0);if(k){n.hostname=n.host=q?"":w.length?w.shift():"";var j=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@");j&&(n.auth=j.shift(),n.host=n.hostname=j.shift())}return b=b||n.host&&w.length,b&&!q&&w.unshift(""),w.length?n.pathname=w.join("/"):(n.pathname=null,n.path=null),l.isNull(n.pathname)&&l.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},r.prototype.parseHost=function(){var e=this.host,t=f.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},{"./util":8,punycode:3,querystring:6}],8:[function(e,t,n){"use strict";t.exports={isString:function(e){return"string"==typeof e},isObject:function(e){return"object"==typeof e&&null!==e},isNull:function(e){return null===e},isNullOrUndefined:function(e){return null==e}}},{}],9:[function(e,t,n){function r(e){var t=a(e.currentTarget).parent().find(".dropdown-menu");t.toggleClass("open"),e.stopPropagation(),e.preventDefault()}function o(e){a(".dropdown-menu").removeClass("open")}function i(){a(document).on("click",".toggle-dropdown",r),a(document).on("click",".dropdown-menu",function(e){e.stopPropagation()}),a(document).on("click",o)}var a=e("jquery");t.exports={init:i}},{jquery:1}],10:[function(e,t,n){function r(){s.init(),i.init(),o.init(),a.init(),u.createButton({index:0,icon:"fa fa-align-justify",onClick:function(e){e.preventDefault(),s.toggle()}})}var o=e("./dropdown"),i=e("./keyboard"),a=e("./navigation"),s=e("./sidebar"),u=e("./toolbar"),l=window.gitbook;l.events.on("start",r),l.keyboard=i,l.navigation=a,l.sidebar=s,l.toolbar=u},{"./dropdown":9,"./keyboard":11,"./navigation":13,"./sidebar":15,"./toolbar":16}],11:[function(e,t,n){function r(e,t){i.bind(e,function(e){return t(),!1})}function o(){r(["right"],function(e){a.goNext()}),r(["left"],function(e){a.goPrev()}),r(["s"],function(e){s.toggle()})}var i=e("mousetrap"),a=e("./navigation"),s=e("./sidebar");t.exports={init:o,bind:r}},{"./navigation":13,"./sidebar":15,mousetrap:2}],12:[function(e,t,n){function r(e){return o.state.$book.addClass("is-loading"),e.always(function(){o.state.$book.removeClass("is-loading")}),e}var o=window.gitbook;t.exports={show:r}},{}],13:[function(e,t,n){function r(){return T(E.isSmallScreen()?".book-body":".body-inner")}function o(e){var t=r(),n=0;i(e)&&(e&&(n=u(e)),t.unbind("scroll"),t.animate({scrollTop:n},800,"swing",function(){t.scroll(f)}),l(null,e))}function i(e){var t=r(),n=t.find(e);return!!n.length}function a(e){return 0===e.length}function s(e,t){return e.length>0&&e.filter(t).length>0}function u(e){var t=r(),n=t.find(".page-inner"),o=t.find(e),i=o.offsetParent(),u=0;if(s([t,n,o,i],a))return 0;u=o.position().top;for(var l=10,c=0;c<l&&(!i.is(n)&&!i.is(i.offsetParent()));c++)o=i,u+=o.position().top,i=o.offsetParent();return Math.floor(u)}function l(e,t){if(e||t||(e=w.first()),t&&(e=w.length>1?w.filter(function(){var e=c(T(this));return e==t}).first():w.first()),!e.is(C)){C=e,w.removeClass("active"),e.addClass("active"),t=c(e);var n=window.location.pathname+window.location.hash,r=window.location.pathname+t;r!=n&&history.replaceState({path:r},null,r)}}function c(e){var t=e.children("a"),n=t.attr("href").split("#")[1];return n&&(n="#"+n),n?n:""}function f(){var e=r(),t=e.scrollTop(),n=e.prop("scrollHeight"),o=e.prop("clientHeight"),i=w.length,a=null;T(w.get().reverse()).each(function(e){var n,r=c(T(this));r&&!a&&(n=u(r),t>=n&&(a=T(this))),e!=i-1||a||(a=T(this))}),a||t||(a=w.first()),t&&n-t==o&&(a=w.last()),l(a)}function p(e,t){var n=k.parse(A),r=k.resolve(window.location.pathname,e),i=k.parse(r),a=i.hash,s=i.pathname!==n.pathname,u=Boolean(i.hostname);if(!S||u)return void(location.href=e);if(!s)return t&&history.pushState({path:r},null,r),o(a);A=r;var l=T.Deferred(function(e){T.ajax({type:"GET",url:r,cache:!0,headers:{"Access-Control-Expose-Headers":"X-Current-Location"},success:function(n,i,s){var u=s.getResponseHeader("X-Current-Location")||r;n=n.replace(/<(\/?)(html|head|body)([^>]*)>/gi,function(e,t,n,r){return"<"+t+"div"+(t?"":' data-element="'+n+'"')+r+">"});var l,c=T(n),f=c.find(".book");if(0===f.length){var p=new Error("Invalid gitbook page, redirecting...");return e.reject(p)}t&&history.pushState({path:u},null,u),c=T(n),l=c.find("[data-element=head]"),f=c.find(".book"),document.title=l.find("title").text();var h=T("head");h.find("link[rel=prev]").remove(),h.find("link[rel=next]").remove(),h.append(l.find("link[rel=prev]")),h.append(l.find("link[rel=next]"));var g=T(".book").attr("class"),m=T(".book-summary").scrollTop();f.toggleClass("with-summary",T(".book").hasClass("with-summary")),T(".book").replaceWith(f),T(".book").attr("class",g),T(".book-summary").scrollTop(m),N.state.$book=T(".book"),d(!a),a&&o(a),e.resolve()}})}).promise();return j.show(l.fail(function(e){console.log(e)}))}function h(){var e,t;e=parseInt(T(".body-inner").css("width"),10),t=parseInt(T(".page-wrapper").css("width"),10),T(".navigation-next").css("margin-right",e-t+"px");var n=r();n.unbind("scroll"),n.scroll(f)}function d(e){var t=T(".book-body"),n=t.find(".body-inner"),o=n.find(".page-wrapper");h(),o.focus();var i=r();e!==!1&&i.scrollTop(0),w=T(".book-summary .summary .chapter").filter(function(){var e=T(this).children("a"),t=null;if(!e.length)return!1;t=e.attr("href").split("#")[0];var n=k.resolve(window.location.pathname,t);return window.location.pathname==n}),w.length>1?i.scroll(f):C=w.first()}function g(e){return 0===e.button}function m(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function v(e){var t=T(this),n=t.attr("target");if(!m(e)&&g(e)&&!n){e.stopPropagation(),e.preventDefault();var r=t.attr("href");r&&p(r,!0)}}function y(){var e=T(".navigation-next").attr("href");e&&p(e,!0)}function b(){var e=T(".navigation-prev").attr("href");e&&p(e,!0)}function x(){T.ajaxSetup({cache:!1}),history.replaceState({path:window.location.href},""),window.onpopstate=function(e){if(null!==e.state)return p(e.state.path,!1)},T(document).on("click",".navigation-prev",v),T(document).on("click",".navigation-next",v),T(document).on("click",".summary [data-path] a",v),T(document).on("click",".page-inner a",v),T(window).resize(h),d(!1)}var w,C,T=e("jquery"),k=e("url"),j=e("./loading"),E=e("./platform"),N=window.gitbook,S="undefined"!=typeof history.pushState,A=location.href;t.exports={init:x,goNext:y,goPrev:b}},{"./loading":12,"./platform":14,jquery:1,url:7}],14:[function(e,t,n){var r=e("jquery");t.exports={isMobile:function(){return r(document).width()<=600},isSmallScreen:function(){return r(document).width()<=1240}}},{jquery:1}],15:[function(e,t,n){function r(e,t){null!=l.state&&o()==e||(null==t&&(t=!0),l.state.$book.toggleClass("without-animation",!t),l.state.$book.toggleClass("with-summary",e),l.storage.set("sidebar",o()))}function o(){return l.state.$book.hasClass("with-summary")}function i(){u.isMobile()||r(l.storage.get("sidebar",!0),!1),s(document).on("click",".book-summary li.chapter a",function(e){u.isMobile()&&r(!1,!1)})}function a(e){var t=s(".book-summary");t.find("li").each(function(){var t=s(this).data("path"),n=null==e||e.indexOf(t)!==-1;s(this).toggle(n),n&&s(this).parents("li").show()})}var s=e("jquery"),u=e("./platform"),l=window.gitbook;t.exports={init:i,isOpen:o,toggle:r,filter:a}},{"./platform":14,jquery:1}],16:[function(e,t,n){function r(){return"btn-"+g++}function o(e,t,n,r){var o=e.children(t).length;n<0&&(n=Math.max(0,o+1+n)),e.append(r),n<o&&e.children(t).eq(n).before(e.children(t).last())}function i(e){e.preventDefault()}function a(e){var t=p("<div>",{class:"dropdown-menu",html:'<div class="dropdown-caret"><span class="caret-outer"></span><span class="caret-inner"></span></div>'});if("string"==typeof e)t.append(e);else{var n=e.map(function(e){return p.isArray(e)?e:[e]});n.forEach(function(e){var n=p("<div>",{class:"buttons"}),r="size-"+e.length;e.forEach(function(e){e=p.extend({text:"",className:"",onClick:i},e||{});var t=p("<button>",{class:"button "+r+" "+e.className,text:e.text});t.click(e.onClick),n.append(t)}),t.append(n)})}return t}function s(e){return e=p.extend({label:"",icon:"",text:"",position:"left",className:"",onClick:i,dropdown:null,index:null,id:r()},e||{}),d.push(e),u(e),e.id}function u(e){var t,n=p(".book-header"),r=n.find("h1"),i="pull-"+e.position,s=p("<a>",{class:"btn",text:e.text?" "+e.text:"","aria-label":e.label,href:"#"});if(s.click(e.onClick),e.icon&&p("<i>",{class:e.icon}).prependTo(s),e.dropdown){var u=p("<div>",{class:"dropdown "+i+" "+e.className});s.addClass("toggle-dropdown"),u.append(s);var l=a(e.dropdown);l.addClass("dropdown-"+("right"==e.position?"left":"right")),u.append(l),t=u}else s.addClass(i),s.addClass(e.className),t=s;t.addClass("js-toolbar-action"),p.isNumeric(e.index)&&e.index>=0?o(n,".btn, .dropdown, h1",e.index,t):t.insertBefore(r)}function l(){p(".js-toolbar-action").remove(),d.forEach(u)}function c(e){d=p.grep(d,function(t){return t.id!=e}),l()}function f(e){d=p.grep(d,function(t){return e.indexOf(t.id)==-1}),l()}var p=e("jquery"),h=window.gitbook,d=[],g=0;h.events.on("page.change",function(){l()}),t.exports={createButton:s,removeButton:c,removeButtons:f}},{jquery:1}]},{},[10]); diff --git a/gitbook/index.html b/gitbook/index.html new file mode 100644 index 000000000..ce8b21fa8 --- /dev/null +++ b/gitbook/index.html @@ -0,0 +1,329 @@ + +<!DOCTYPE HTML> +<html lang="" > + <head> + <meta charset="UTF-8"> + <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> + <title>文档规范 · GitBook + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + +
+ +
+ +
+ + + + + + + + +
+
+ +
+
+ +
+ +

FineUIdocs

+

FineUI的交互、前端以及视觉文档规范

+ + +
+ +
+
+
+ +

results matching ""

+
    + +
    +
    + +

    No results matching ""

    + +
    +
    +
    + +
    +
    + +
    + + + + + + + + + + +
    + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gitbook/interaction/controls/input.html b/gitbook/interaction/controls/input.html new file mode 100644 index 000000000..9662f1063 --- /dev/null +++ b/gitbook/interaction/controls/input.html @@ -0,0 +1,350 @@ + + + + + + + 输入框 · GitBook + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + +
    + +
    + +
    + + + + + + + + +
    +
    + +
    +
    + +
    + +

    输入框

    +

    不可为空输入框A

    +
      +
    • 目前组件暂不支持此交互
    • +
    +

    不可为空输入框B

    +

    source

    +

    不可为空输入框C

    +
      +
    • 目前组件暂不支持此交互
    • +
    +

    可为空输入框A

    +

    source

    +

    可为空输入框B

    +

    source

    +

    搜索框

    +

    source

    + + +
    + +
    +
    +
    + +

    results matching ""

    +
      + +
      +
      + +

      No results matching ""

      + +
      +
      +
      + +
      +
      + +
      + + + + + + + + + + + + + + +
      + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gitbook/interaction/controls/input/readme.md b/gitbook/interaction/controls/input/readme.md new file mode 100644 index 000000000..44a83de89 --- /dev/null +++ b/gitbook/interaction/controls/input/readme.md @@ -0,0 +1 @@ +## 输入框 \ No newline at end of file diff --git a/gitbook/interaction/controls/readme.html b/gitbook/interaction/controls/readme.html new file mode 100644 index 000000000..71abff099 --- /dev/null +++ b/gitbook/interaction/controls/readme.html @@ -0,0 +1,334 @@ + + + + + + + 控件类 · GitBook + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + + + + + + + + +
      + +
      + +
      + + + + + + + + +
      +
      + +
      +
      + +
      + +

      controls

      + + +
      + +
      +
      +
      + +

      results matching ""

      +
        + +
        +
        + +

        No results matching ""

        + +
        +
        +
        + +
        +
        + +
        + + + + + + + + + + + + + + +
        + + +
        + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gitbook/interaction/modules/readme.html b/gitbook/interaction/modules/readme.html new file mode 100644 index 000000000..4fd243ec0 --- /dev/null +++ b/gitbook/interaction/modules/readme.html @@ -0,0 +1,334 @@ + + + + + + + 模块类 · GitBook + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
        +
        + + + + + + + + +
        + +
        + +
        + + + + + + + + +
        +
        + +
        +
        + +
        + +

        modules

        + + +
        + +
        +
        +
        + +

        results matching ""

        +
          + +
          +
          + +

          No results matching ""

          + +
          +
          +
          + +
          +
          + +
          + + + + + + + + + + + + + + +
          + + +
          + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gitbook/interaction/readme.html b/gitbook/interaction/readme.html new file mode 100644 index 000000000..1541d7528 --- /dev/null +++ b/gitbook/interaction/readme.html @@ -0,0 +1,334 @@ + + + + + + + 交互规范 · GitBook + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          +
          + + + + + + + + +
          + +
          + +
          + + + + + + + + +
          +
          + +
          +
          + +
          + +

          interaction rules

          + + +
          + +
          +
          +
          + +

          results matching ""

          +
            + +
            +
            + +

            No results matching ""

            + +
            +
            +
            + +
            +
            + +
            + + + + + + + + + + + + + + +
            + + +
            + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gitbook/interaction/rules/readme.html b/gitbook/interaction/rules/readme.html new file mode 100644 index 000000000..241d30730 --- /dev/null +++ b/gitbook/interaction/rules/readme.html @@ -0,0 +1,328 @@ + + + + + + + 规则类 · GitBook + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
            +
            + + + + + + + + +
            + +
            + +
            + + + + + + + + +
            +
            + +
            +
            + +
            + +

            rules

            + + +
            + +
            +
            +
            + +

            results matching ""

            +
              + +
              +
              + +

              No results matching ""

              + +
              +
              +
              + +
              +
              + +
              + + + + + + + + + + +
              + + +
              + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/gitbook/package.json b/gitbook/package.json new file mode 100644 index 000000000..7da4dac42 --- /dev/null +++ b/gitbook/package.json @@ -0,0 +1,26 @@ +{ + "name": "fineuidocs", + "version": "1.0.0", + "description": "FineUI的交互、前端以及视觉文档规范", + "main": "index.js", + "scripts": { + "init": "gitbook init", + "serve": "gitbook serve", + "build": "gitbook build" + }, + "repository": { + "type": "git", + "url": "git+https://gittz@github.com/gittz/FineUIdocs.git" + }, + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/gittz/FineUIdocs/issues" + }, + "homepage": "https://github.com/gittz/FineUIdocs#readme", + "devDependencies": { + "gitbook-cli": "^2.3.2", + "gitbook-plugin-jsfiddle": "^1.0.0", + "gitbook-plugin-splitter": "0.0.8" + } +} diff --git a/gitbook/search_index.json b/gitbook/search_index.json new file mode 100644 index 000000000..c0ef32275 --- /dev/null +++ b/gitbook/search_index.json @@ -0,0 +1 @@ +{"index":{"version":"0.5.12","fields":[{"name":"title","boost":10},{"name":"keywords","boost":15},{"name":"body","boost":1}],"ref":"url","documentStore":{"store":{"./":["fineuidoc","fineui的交互、前端以及视觉文档规范","文档规范"],"interaction/readme.html":["interact","rule","交互规范"],"interaction/controls/readme.html":["control","控件类"],"interaction/controls/input.html":["sourc","不可为空输入框a","不可为空输入框b","不可为空输入框c","可为空输入框a","可为空输入框b","搜索框","目前组件暂不支持此交互","输入框"],"interaction/modules/readme.html":["modul","模块类"],"interaction/rules/readme.html":["rule","规则类"]},"length":6},"tokenStore":{"root":{"docs":{},"f":{"docs":{},"i":{"docs":{},"n":{"docs":{},"e":{"docs":{},"u":{"docs":{},"i":{"docs":{},"d":{"docs":{},"o":{"docs":{},"c":{"docs":{"./":{"ref":"./","tf":0.5}}}}},"的":{"docs":{},"交":{"docs":{},"互":{"docs":{},"、":{"docs":{},"前":{"docs":{},"端":{"docs":{},"以":{"docs":{},"及":{"docs":{},"视":{"docs":{},"觉":{"docs":{},"文":{"docs":{},"档":{"docs":{},"规":{"docs":{},"范":{"docs":{"./":{"ref":"./","tf":0.5}}}}}}}}}}}}}}}}}}}}}},"文":{"docs":{},"档":{"docs":{},"规":{"docs":{},"范":{"docs":{"./":{"ref":"./","tf":10}}}}}},"i":{"docs":{},"n":{"docs":{},"t":{"docs":{},"e":{"docs":{},"r":{"docs":{},"a":{"docs":{},"c":{"docs":{},"t":{"docs":{"interaction/readme.html":{"ref":"interaction/readme.html","tf":0.5}}}}}}}}}},"r":{"docs":{},"u":{"docs":{},"l":{"docs":{},"e":{"docs":{"interaction/readme.html":{"ref":"interaction/readme.html","tf":0.5},"interaction/rules/readme.html":{"ref":"interaction/rules/readme.html","tf":1}}}}}},"交":{"docs":{},"互":{"docs":{},"规":{"docs":{},"范":{"docs":{"interaction/readme.html":{"ref":"interaction/readme.html","tf":10}}}}}},"c":{"docs":{},"o":{"docs":{},"n":{"docs":{},"t":{"docs":{},"r":{"docs":{},"o":{"docs":{},"l":{"docs":{"interaction/controls/readme.html":{"ref":"interaction/controls/readme.html","tf":1}}}}}}}}},"控":{"docs":{},"件":{"docs":{},"类":{"docs":{"interaction/controls/readme.html":{"ref":"interaction/controls/readme.html","tf":10}}}}},"s":{"docs":{},"o":{"docs":{},"u":{"docs":{},"r":{"docs":{},"c":{"docs":{"interaction/controls/input.html":{"ref":"interaction/controls/input.html","tf":0.3076923076923077}}}}}}},"不":{"docs":{},"可":{"docs":{},"为":{"docs":{},"空":{"docs":{},"输":{"docs":{},"入":{"docs":{},"框":{"docs":{},"a":{"docs":{"interaction/controls/input.html":{"ref":"interaction/controls/input.html","tf":0.07692307692307693}}},"b":{"docs":{"interaction/controls/input.html":{"ref":"interaction/controls/input.html","tf":0.07692307692307693}}},"c":{"docs":{"interaction/controls/input.html":{"ref":"interaction/controls/input.html","tf":0.07692307692307693}}}}}}}}}},"可":{"docs":{},"为":{"docs":{},"空":{"docs":{},"输":{"docs":{},"入":{"docs":{},"框":{"docs":{},"a":{"docs":{"interaction/controls/input.html":{"ref":"interaction/controls/input.html","tf":0.07692307692307693}}},"b":{"docs":{"interaction/controls/input.html":{"ref":"interaction/controls/input.html","tf":0.07692307692307693}}}}}}}}},"搜":{"docs":{},"索":{"docs":{},"框":{"docs":{"interaction/controls/input.html":{"ref":"interaction/controls/input.html","tf":0.07692307692307693}}}}},"目":{"docs":{},"前":{"docs":{},"组":{"docs":{},"件":{"docs":{},"暂":{"docs":{},"不":{"docs":{},"支":{"docs":{},"持":{"docs":{},"此":{"docs":{},"交":{"docs":{},"互":{"docs":{"interaction/controls/input.html":{"ref":"interaction/controls/input.html","tf":0.15384615384615385}}}}}}}}}}}}},"输":{"docs":{},"入":{"docs":{},"框":{"docs":{"interaction/controls/input.html":{"ref":"interaction/controls/input.html","tf":10.076923076923077}}}}},"m":{"docs":{},"o":{"docs":{},"d":{"docs":{},"u":{"docs":{},"l":{"docs":{"interaction/modules/readme.html":{"ref":"interaction/modules/readme.html","tf":1}}}}}}},"模":{"docs":{},"块":{"docs":{},"类":{"docs":{"interaction/modules/readme.html":{"ref":"interaction/modules/readme.html","tf":10}}}}},"规":{"docs":{},"则":{"docs":{},"类":{"docs":{"interaction/rules/readme.html":{"ref":"interaction/rules/readme.html","tf":10}}}}}},"length":21},"corpusTokens":["control","fineuidoc","fineui的交互、前端以及视觉文档规范","interact","modul","rule","sourc","不可为空输入框a","不可为空输入框b","不可为空输入框c","交互规范","可为空输入框a","可为空输入框b","控件类","搜索框","文档规范","模块类","目前组件暂不支持此交互","规则类","输入框"],"pipeline":["stopWordFilter","stemmer"]},"store":{"./":{"url":"./","title":"文档规范","keywords":"","body":"FineUIdocs\nFineUI的交互、前端以及视觉文档规范\n"},"interaction/readme.html":{"url":"interaction/readme.html","title":"交互规范","keywords":"","body":"interaction rules\n"},"interaction/controls/readme.html":{"url":"interaction/controls/readme.html","title":"控件类","keywords":"","body":"controls\n"},"interaction/controls/input.html":{"url":"interaction/controls/input.html","title":"输入框","keywords":"","body":"输入框\n不可为空输入框A\n\n目前组件暂不支持此交互\n\n不可为空输入框B\nsource\n不可为空输入框C\n\n目前组件暂不支持此交互\n\n可为空输入框A\nsource\n可为空输入框B\nsource\n搜索框\nsource\n"},"interaction/modules/readme.html":{"url":"interaction/modules/readme.html","title":"模块类","keywords":"","body":"modules\n"},"interaction/rules/readme.html":{"url":"interaction/rules/readme.html","title":"规则类","keywords":"","body":"rules\n"}}} \ No newline at end of file diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index 919325d51..3d62b80f0 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -220,6 +220,9 @@ BI.BasicButton = BI.inherit(BI.Single, { _trigger: function () { var o = this.options; + if(!this.isEnabled()){ + return; + } if (!this.isDisableSelected()) { this.isForceSelected() ? this.setSelected(true) : (this.isForceNotSelected() ? this.setSelected(false) : diff --git a/src/base/single/button/buttons/button.js b/src/base/single/button/buttons/button.js index 9e02af048..f5450b38f 100644 --- a/src/base/single/button/buttons/button.js +++ b/src/base/single/button/buttons/button.js @@ -40,9 +40,9 @@ BI.Button.superclass._init.apply(this, arguments); var o = this.options, self = this; if (BI.isNumber(o.height) && !o.clear && !o.block) { - this.element.css({height: o.height - 2, lineHeight: (o.height - 2) + 'px'}); + this.element.css({height: o.height + "px", lineHeight: o.height + "px"}); } else { - this.element.css({lineHeight: o.height + 'px'}); + this.element.css({lineHeight: o.height + "px"}); } if (BI.isKey(o.iconClass)) { this.icon = BI.createWidget({ @@ -95,8 +95,8 @@ if (o.clear === true) { this.element.addClass("clear"); } - if (o.minWidth > 2) { - this.element.css({"min-width": o.minWidth - 2 + "px"}); + if (o.minWidth > 0) { + this.element.css({"min-width": o.minWidth + "px"}); } }, diff --git a/src/base/single/text.js b/src/base/single/text.js index 12efd184a..4efe5143b 100644 --- a/src/base/single/text.js +++ b/src/base/single/text.js @@ -11,6 +11,7 @@ BI.Text = BI.inherit(BI.Single, { textAlign: "left", whiteSpace: "normal", lineHeight: null, + handler: null,//如果传入handler,表示处理文字的点击事件,不是区域的 hgap: 0, vgap: 0, lgap: 0, @@ -24,39 +25,25 @@ BI.Text = BI.inherit(BI.Single, { _init: function () { BI.Text.superclass._init.apply(this, arguments); - var o = this.options; - this.text = BI.createWidget({ - type: "bi.layout", - cls: "bi-text" - }); - BI.createWidget({ - type: "bi.default", - element: this, - items: [this.text] - }); - if (BI.isKey(o.text)) { - this.setText(o.text); - } else if (BI.isKey(o.value)) { - this.setText(o.value); - } + var self = this, o = this.options; if (o.hgap + o.lgap > 0) { - this.text.element.css({ - "margin-left": o.hgap + o.lgap + "px" + this.element.css({ + "padding-left": o.hgap + o.lgap + "px" }) } if (o.hgap + o.rgap > 0) { - this.text.element.css({ - "margin-right": o.hgap + o.rgap + "px" + this.element.css({ + "padding-right": o.hgap + o.rgap + "px" }) } if (o.vgap + o.tgap > 0) { - this.text.element.css({ - "margin-top": o.vgap + o.tgap + "px" + this.element.css({ + "padding-top": o.vgap + o.tgap + "px" }) } if (o.vgap + o.bgap > 0) { - this.text.element.css({ - "margin-bottom": o.vgap + o.bgap + "px" + this.element.css({ + "padding-bottom": o.vgap + o.bgap + "px" }) } if (BI.isNumber(o.height)) { @@ -65,14 +52,31 @@ BI.Text = BI.inherit(BI.Single, { if (BI.isNumber(o.lineHeight)) { this.element.css({"lineHeight": o.lineHeight + "px"}); } - this.text.element.css({ - "textAlign": o.textAlign, - "whiteSpace": o.whiteSpace - }); this.element.css({ "textAlign": o.textAlign, "whiteSpace": o.whiteSpace }); + if (o.handler) { + this.text = BI.createWidget({ + type: "bi.layout", + tagName: 'span' + }); + this.text.element.click(function () { + o.handler(self.getValue()); + }); + BI.createWidget({ + type: "bi.default", + element: this, + items: [this.text] + }); + } else { + this.text = this; + } + if (BI.isKey(o.text)) { + this.setText(o.text); + } else if (BI.isKey(o.value)) { + this.setText(o.value); + } if (BI.isKey(o.keyword)) { this.text.element.__textKeywordMarked__(o.text, o.keyword, o.py); } diff --git a/src/base/tree/treeview.js b/src/base/tree/treeview.js index 6ada95083..118a65088 100644 --- a/src/base/tree/treeview.js +++ b/src/base/tree/treeview.js @@ -15,7 +15,6 @@ BI.TreeView = BI.inherit(BI.Pane, { _init: function () { BI.TreeView.superclass._init.apply(this, arguments); this._stop = false; - this.container = BI.createWidget(); this._createTree(); this.tip = BI.createWidget({ @@ -28,7 +27,7 @@ BI.TreeView = BI.inherit(BI.Pane, { scrollable: true, scrolly: false, element: this, - items: [this.container, this.tip] + items: [this.tip] }); }, @@ -47,7 +46,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }); BI.createWidget({ type: "bi.default", - element: this.container, + element: this.element, items: [this.tree] }); }, @@ -442,6 +441,7 @@ BI.TreeView = BI.inherit(BI.Pane, { setNode(child.children); }); } + BI.each(this.nodes.getNodes(), function (i, node) { node.halfCheck = false; setNode(node.children); diff --git a/src/core/alias.js b/src/core/alias.js index cc3aa3a9b..ae6d0f9be 100644 --- a/src/core/alias.js +++ b/src/core/alias.js @@ -75,6 +75,11 @@ } else { return _numberFormat((-text) + "", format.substr(numMod + 1)); } + } else { + //兼容格式处理负数的情况(copy:fr-jquery.format.js) + if (+text < 0 && format.charAt(0) !== '-') { + return _numberFormat((-text) + "", '-' + format); + } } var tp = text.split('.'), fp = format.split('.'), tleft = tp[0] || '', fleft = fp[0] || '', diff --git a/src/core/shortcut.js b/src/core/shortcut.js index bd8841c9c..646a4dbc6 100644 --- a/src/core/shortcut.js +++ b/src/core/shortcut.js @@ -1,14 +1,10 @@ (function () { - - var kv = {}; // alex:键(编辑器简称,如text)值(也是一个字符串,如FR.TextEditor)对 + var kv = {}; BI.shortcut = function (xtype, cls) { if (kv[xtype] != null) { throw ("shortcut:[" + xtype + "] has been registed"); } kv[xtype] = cls; - _.extend(cls.prototype, { - xtype: xtype - }) }; // 根据配置属性生成widget @@ -17,9 +13,6 @@ return new (new Function('return ' + config['classType'] + ';')())(config); } - if (!config.type) { - - } var xtype = config.type.toLowerCase(); var cls = kv[xtype]; return new cls(config); diff --git a/src/core/utils/lru.js b/src/core/utils/lru.js index dac7016d9..028a35adb 100644 --- a/src/core/utils/lru.js +++ b/src/core/utils/lru.js @@ -79,4 +79,8 @@ ? entry : entry.value }; + + p.has = function (key) { + return this._keymap[key] != null; + } })(); \ No newline at end of file diff --git a/src/core/utils/xml.js b/src/core/utils/xml.js index a8e9397ed..771a06a94 100644 --- a/src/core/utils/xml.js +++ b/src/core/utils/xml.js @@ -1,353 +1,353 @@ -; -!(function (BI) { - - if (BI.isIE()) { - XMLSerializer = null; - DOMParser = null; - } - - - var XML = { - Document: { - NodeType: { - ELEMENT: 1, - ATTRIBUTE: 2, - TEXT: 3, - CDATA_SECTION: 4, - ENTITY_REFERENCE: 5, - ENTITY: 6, - PROCESSING_INSTRUCTION: 7, - COMMENT: 8, - DOCUMENT: 9, - DOCUMENT_TYPE: 10, - DOCUMENT_FRAGMENT: 11, - NOTATION: 12 - } - } - }; - - XML.ResultType = { - single: 'single', - array: 'array' - }; - - XML.fromString = function (xmlStr) { - try { - var parser = new DOMParser(); - return parser.parseFromString(xmlStr, "text/xml"); - } catch (e) { - var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; - for (var i = 0; i < arrMSXML.length; i++) { - try { - var xmlDoc = new ActiveXObject(arrMSXML[i]); - xmlDoc.setProperty("SelectionLanguage", "XPath"); - xmlDoc.async = false; - xmlDoc.loadXML(xmlStr); - return xmlDoc; - } catch (xmlError) { - } - } - } - }; - - XML.toString = function (xmlNode) { - if (!BI.isIE()) { - var xmlSerializer = new XMLSerializer(); - return xmlSerializer.serializeToString(xmlNode); - } else - return xmlNode.xml; - }; - - XML.getNSResolver = function (str) { - if (!str) { - return null; - } - var list = str.split(' '); - var namespaces = {}; - for (var i = 0; i < list.length; i++) { - var pair = list[i].split('='); - var fix = BI.trim(pair[0]).replace("xmlns:", ""); - namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); - } - return function (prefix) { - return namespaces[prefix]; - }; - }; - - XML.eval = function (context, xpathExp, resultType, namespaces) { - if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { - return XML.eval2(context, xpathExp, resultType, namespaces); - } else { - if (BI.isIE()) { - namespaces = namespaces ? namespaces : ""; - var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; - doc.setProperty("SelectionNamespaces", namespaces); - var result; - if (resultType == this.ResultType.single) { - result = context.selectSingleNode(xpathExp); - } else { - result = context.selectNodes(xpathExp) || []; - } - doc.setProperty("SelectionNamespaces", ""); - return result; - } else { - var node = context; - var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; - var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; - var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); - - if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { - return col.singleNodeValue; - } else { - var thisColMemb = col.iterateNext(); - var rowsCol = []; - while (thisColMemb) { - rowsCol[rowsCol.length] = thisColMemb; - thisColMemb = col.iterateNext(); - } - return rowsCol; - } - } - } - }; - - XML.eval2 = function (context, xpathExp, resultType, namespaces) { - if (resultType !== "single" && resultType !== undefined && resultType !== null) { - throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); - } - - if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { - return context; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs, i; - if (xpathExp.indexOf("/") != -1) { - var items = xpathExp.split("/"); - var isAbs = xpathExp.substring(0, 1) == "/"; - for (i = 0; i < items.length; i++) { - var item = items[i]; - if (item === "") { - continue; - } else { - var next = null; - var ii = i + 1; - for (; ii < items.length; ii++) { - if (next === null) { - next = items[ii]; - } else { - next = next + "/" + items[ii]; - } - } - - if (item == ".") { - return this.eval(context, next, resultType); - - } else if (item == "..") { - return this.eval2(context.parentNode, next, resultType); - - } else if (item == "*") { - if (isAbs) { - return this.eval2(context, next, resultType); - - } else { - childs = context.childNodes; - for (var j = 0; j < childs.length; j++) { - var tmp = this.eval2(childs[j], next, resultType); - if (tmp !== null) { - return tmp; - } - } - return null; - } - - } else { - if (isAbs) { - if (context.nodeName == item) { - return this.eval2(context, next, resultType); - } else { - return null; - } - } else { - var child = this.getChildByName(context, item); - if (child !== null) { - return this.eval2(child, next, resultType); - } else { - return null; - } - - } - } - - } - } - - return null; - - } else { - if ("text()" == xpathExp) { - childs = context.childNodes; - for (i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.TEXT) { - return childs[i]; - } - } - return null; - } else { - return this.getChildByName(context, xpathExp); - } - } - }; - - XML.getChildByName = function (context, name) { - if (context === null || context === undefined || name === null || name === undefined) { - return null; - } - - if (context.nodeType == XML.Document.NodeType.DOCUMENT) { - context = context.documentElement; - } - - var childs = context.childNodes; - for (var i = 0; i < childs.length; i++) { - if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { - return childs[i]; - } - } - - return null; - }; - - XML.appendChildren = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - if (isBefore && finded[i].firstNode) { - this._insertBefore(finded[i], nodes, finded[i].firstNode); - } else { - for (var j = 0; j < nodes.length; j++) { - finded[i].appendChild(nodes[j]); - } - } - } - return count; - }; - - XML.removeNodes = function (context, xpathExp) { - var nodes = this.eval(context, xpathExp); - for (var i = 0; i < nodes.length; i++) { - nodes[i].parentNode.removeChild(nodes[i]); - } - }; - - XML._insertBefore = function (parent, newchildren, refchild) { - for (var i = 0; i < newchildren.length; i++) { - parent.insertBefore(newchildren[i], refchild); - } - }; - - XML.insertNodes = function (context, xpathExp, nodes, isBefore) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; - this._insertBefore(finded[i].parentNode, nodes, refnode); - } - return count; - }; - - XML.replaceNodes = function (context, xpathExp, nodes) { - nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; - var finded = this.eval(context, xpathExp); - var count = finded.length; - for (var i = 0; i < count; i++) { - var refnode = finded[i]; - var parent = refnode.parentNode; - this._insertBefore(parent, nodes, refnode); - parent.removeChild(refnode); - } - return count; - }; - - XML.setNodeText = function (context, xpathExp, text) { - var finded = this.eval(context, xpathExp, this.ResultType.single); - if (finded === null) { - return; - } - if (finded.nodeType == XML.Document.NodeType.ELEMENT) { - var textNode = this.eval(finded, "./text()", this.ResultType.single); - if (!textNode) { - textNode = finded.ownerDocument.createTextNode(""); - finded.appendChild(textNode); - } - textNode.nodeValue = text; - } else { - finded.nodeValue = text; - } - return; - }; - - XML.getNodeText = function (context, xpathExp, defaultValue) { - var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; - if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { - finded = this.eval(finded, "./text()", this.ResultType.single); - } - return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; - }; - - XML.Namespaces = { - XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", - XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", - XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", - XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', - XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', - XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', - XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', - XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', - XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', - XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', - XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', - XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', - JUSTEPSCHEMA: "http://www.justep.com/xbiz#", - RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", - JUSTEP: "http://www.justep.com/x5#", - 'get': function (type) { - type = type ? type.toLowerCase() : "string"; - if ("string" == type) { - return XML.Namespaces.XMLSCHEMA_STRING; - } - else if ("integer" == type) { - return XML.Namespaces.XMLSCHEMA_INTEGER; - } - else if ("long" == type) { - return XML.Namespaces.XMLSCHEMA_LONG; - } - else if ("float" == type) { - return XML.Namespaces.XMLSCHEMA_FLOAT; - } - else if ("double" == type) { - return XML.Namespaces.XMLSCHEMA_DOUBLE; - } - else if ("decimal" == type) { - return XML.Namespaces.XMLSCHEMA_DECIMAL; - } - else if ("date" == type) { - return XML.Namespaces.XMLSCHEMA_DATE; - } - else if ("time" == type) { - return XML.Namespaces.XMLSCHEMA_TIME; - } - else if ("datetime" == type) { - return XML.Namespaces.XMLSCHEMA_DATETIME; - } - else if ("boolean" == type) { - return XML.Namespaces.XMLSCHEMA_BOOLEAN; - } - } - }; -})(BI); \ No newline at end of file +// ; +// !(function (BI) { +// +// if (BI.isIE()) { +// XMLSerializer = null; +// DOMParser = null; +// } +// +// +// var XML = { +// Document: { +// NodeType: { +// ELEMENT: 1, +// ATTRIBUTE: 2, +// TEXT: 3, +// CDATA_SECTION: 4, +// ENTITY_REFERENCE: 5, +// ENTITY: 6, +// PROCESSING_INSTRUCTION: 7, +// COMMENT: 8, +// DOCUMENT: 9, +// DOCUMENT_TYPE: 10, +// DOCUMENT_FRAGMENT: 11, +// NOTATION: 12 +// } +// } +// }; +// +// XML.ResultType = { +// single: 'single', +// array: 'array' +// }; +// +// XML.fromString = function (xmlStr) { +// try { +// var parser = new DOMParser(); +// return parser.parseFromString(xmlStr, "text/xml"); +// } catch (e) { +// var arrMSXML = ["MSXML2.DOMDocument.6.0", "MSXML2.DOMDocument.3.0"]; +// for (var i = 0; i < arrMSXML.length; i++) { +// try { +// var xmlDoc = new ActiveXObject(arrMSXML[i]); +// xmlDoc.setProperty("SelectionLanguage", "XPath"); +// xmlDoc.async = false; +// xmlDoc.loadXML(xmlStr); +// return xmlDoc; +// } catch (xmlError) { +// } +// } +// } +// }; +// +// XML.toString = function (xmlNode) { +// if (!BI.isIE()) { +// var xmlSerializer = new XMLSerializer(); +// return xmlSerializer.serializeToString(xmlNode); +// } else +// return xmlNode.xml; +// }; +// +// XML.getNSResolver = function (str) { +// if (!str) { +// return null; +// } +// var list = str.split(' '); +// var namespaces = {}; +// for (var i = 0; i < list.length; i++) { +// var pair = list[i].split('='); +// var fix = BI.trim(pair[0]).replace("xmlns:", ""); +// namespaces[fix] = BI.trim(pair[1]).replace(/"/g, "").replace(/'/g, ""); +// } +// return function (prefix) { +// return namespaces[prefix]; +// }; +// }; +// +// XML.eval = function (context, xpathExp, resultType, namespaces) { +// if ((BI.isIE() && ('undefined' === typeof(context.selectSingleNode) || 'undefined' === typeof(context.selectNodes)))) { +// return XML.eval2(context, xpathExp, resultType, namespaces); +// } else { +// if (BI.isIE()) { +// namespaces = namespaces ? namespaces : ""; +// var doc = (context.nodeType == XML.Document.NodeType.DOCUMENT) ? context : context.ownerDocument; +// doc.setProperty("SelectionNamespaces", namespaces); +// var result; +// if (resultType == this.ResultType.single) { +// result = context.selectSingleNode(xpathExp); +// } else { +// result = context.selectNodes(xpathExp) || []; +// } +// doc.setProperty("SelectionNamespaces", ""); +// return result; +// } else { +// var node = context; +// var xmlDoc = (context.nodeName.indexOf("document") == -1) ? context.ownerDocument : context; +// var retType = (resultType == this.ResultType.single) ? XPathResult.FIRST_ORDERED_NODE_TYPE : XPathResult.ANY_TYPE; +// var col = xmlDoc.evaluate(xpathExp, node, XML.getNSResolver(namespaces), retType, null); +// +// if (retType == XPathResult.FIRST_ORDERED_NODE_TYPE) { +// return col.singleNodeValue; +// } else { +// var thisColMemb = col.iterateNext(); +// var rowsCol = []; +// while (thisColMemb) { +// rowsCol[rowsCol.length] = thisColMemb; +// thisColMemb = col.iterateNext(); +// } +// return rowsCol; +// } +// } +// } +// }; +// +// XML.eval2 = function (context, xpathExp, resultType, namespaces) { +// if (resultType !== "single" && resultType !== undefined && resultType !== null) { +// throw new Error("justep.SimpleXML.eval only be resultType='single', not" + resultType); +// } +// +// if (context === null || context === undefined || xpathExp === null || xpathExp === undefined) { +// return context; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs, i; +// if (xpathExp.indexOf("/") != -1) { +// var items = xpathExp.split("/"); +// var isAbs = xpathExp.substring(0, 1) == "/"; +// for (i = 0; i < items.length; i++) { +// var item = items[i]; +// if (item === "") { +// continue; +// } else { +// var next = null; +// var ii = i + 1; +// for (; ii < items.length; ii++) { +// if (next === null) { +// next = items[ii]; +// } else { +// next = next + "/" + items[ii]; +// } +// } +// +// if (item == ".") { +// return this.eval(context, next, resultType); +// +// } else if (item == "..") { +// return this.eval2(context.parentNode, next, resultType); +// +// } else if (item == "*") { +// if (isAbs) { +// return this.eval2(context, next, resultType); +// +// } else { +// childs = context.childNodes; +// for (var j = 0; j < childs.length; j++) { +// var tmp = this.eval2(childs[j], next, resultType); +// if (tmp !== null) { +// return tmp; +// } +// } +// return null; +// } +// +// } else { +// if (isAbs) { +// if (context.nodeName == item) { +// return this.eval2(context, next, resultType); +// } else { +// return null; +// } +// } else { +// var child = this.getChildByName(context, item); +// if (child !== null) { +// return this.eval2(child, next, resultType); +// } else { +// return null; +// } +// +// } +// } +// +// } +// } +// +// return null; +// +// } else { +// if ("text()" == xpathExp) { +// childs = context.childNodes; +// for (i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.TEXT) { +// return childs[i]; +// } +// } +// return null; +// } else { +// return this.getChildByName(context, xpathExp); +// } +// } +// }; +// +// XML.getChildByName = function (context, name) { +// if (context === null || context === undefined || name === null || name === undefined) { +// return null; +// } +// +// if (context.nodeType == XML.Document.NodeType.DOCUMENT) { +// context = context.documentElement; +// } +// +// var childs = context.childNodes; +// for (var i = 0; i < childs.length; i++) { +// if (childs[i].nodeType == XML.Document.NodeType.ELEMENT && (childs[i].nodeName == name || name == "*")) { +// return childs[i]; +// } +// } +// +// return null; +// }; +// +// XML.appendChildren = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// if (isBefore && finded[i].firstNode) { +// this._insertBefore(finded[i], nodes, finded[i].firstNode); +// } else { +// for (var j = 0; j < nodes.length; j++) { +// finded[i].appendChild(nodes[j]); +// } +// } +// } +// return count; +// }; +// +// XML.removeNodes = function (context, xpathExp) { +// var nodes = this.eval(context, xpathExp); +// for (var i = 0; i < nodes.length; i++) { +// nodes[i].parentNode.removeChild(nodes[i]); +// } +// }; +// +// XML._insertBefore = function (parent, newchildren, refchild) { +// for (var i = 0; i < newchildren.length; i++) { +// parent.insertBefore(newchildren[i], refchild); +// } +// }; +// +// XML.insertNodes = function (context, xpathExp, nodes, isBefore) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = (isBefore) ? finded[i] : finded[i].nextSibling; +// this._insertBefore(finded[i].parentNode, nodes, refnode); +// } +// return count; +// }; +// +// XML.replaceNodes = function (context, xpathExp, nodes) { +// nodes = (typeof nodes.length != "undefined") ? nodes : [nodes]; +// var finded = this.eval(context, xpathExp); +// var count = finded.length; +// for (var i = 0; i < count; i++) { +// var refnode = finded[i]; +// var parent = refnode.parentNode; +// this._insertBefore(parent, nodes, refnode); +// parent.removeChild(refnode); +// } +// return count; +// }; +// +// XML.setNodeText = function (context, xpathExp, text) { +// var finded = this.eval(context, xpathExp, this.ResultType.single); +// if (finded === null) { +// return; +// } +// if (finded.nodeType == XML.Document.NodeType.ELEMENT) { +// var textNode = this.eval(finded, "./text()", this.ResultType.single); +// if (!textNode) { +// textNode = finded.ownerDocument.createTextNode(""); +// finded.appendChild(textNode); +// } +// textNode.nodeValue = text; +// } else { +// finded.nodeValue = text; +// } +// return; +// }; +// +// XML.getNodeText = function (context, xpathExp, defaultValue) { +// var finded = xpathExp ? this.eval(context, xpathExp, this.ResultType.single) : context; +// if (finded && (finded.nodeType == XML.Document.NodeType.ELEMENT)) { +// finded = this.eval(finded, "./text()", this.ResultType.single); +// } +// return (finded && finded.nodeValue) ? "" + finded.nodeValue : (defaultValue !== undefined) ? defaultValue : null; +// }; +// +// XML.Namespaces = { +// XMLSCHEMA: "http://www.w3.org/2001/XMLSchema#", +// XMLSCHEMA_STRING: "http://www.w3.org/2001/XMLSchema#String", +// XMLSCHEMA_LONG: "http://www.w3.org/2001/XMLSchema#Long", +// XMLSCHEMA_INTEGER: 'http://www.w3.org/2001/XMLSchema#Integer', +// XMLSCHEMA_FLOAT: 'http://www.w3.org/2001/XMLSchema#Float', +// XMLSCHEMA_DOUBLE: 'http://www.w3.org/2001/XMLSchema#Double', +// XMLSCHEMA_DECIMAL: 'http://www.w3.org/2001/XMLSchema#Decimal', +// XMLSCHEMA_DATE: 'http://www.w3.org/2001/XMLSchema#Date', +// XMLSCHEMA_TIME: 'http://www.w3.org/2001/XMLSchema#Time', +// XMLSCHEMA_DATETIME: 'http://www.w3.org/2001/XMLSchema#DateTime', +// XMLSCHEMA_BOOLEAN: 'http://www.w3.org/2001/XMLSchema#Boolean', +// XMLSCHEMA_SYMBOL: 'http://www.w3.org/2001/XMLSchema#Symbol', +// JUSTEPSCHEMA: "http://www.justep.com/xbiz#", +// RDF: "http://www.w3.org/1999/02/22-rdf-syntax-ns#", +// JUSTEP: "http://www.justep.com/x5#", +// 'get': function (type) { +// type = type ? type.toLowerCase() : "string"; +// if ("string" == type) { +// return XML.Namespaces.XMLSCHEMA_STRING; +// } +// else if ("integer" == type) { +// return XML.Namespaces.XMLSCHEMA_INTEGER; +// } +// else if ("long" == type) { +// return XML.Namespaces.XMLSCHEMA_LONG; +// } +// else if ("float" == type) { +// return XML.Namespaces.XMLSCHEMA_FLOAT; +// } +// else if ("double" == type) { +// return XML.Namespaces.XMLSCHEMA_DOUBLE; +// } +// else if ("decimal" == type) { +// return XML.Namespaces.XMLSCHEMA_DECIMAL; +// } +// else if ("date" == type) { +// return XML.Namespaces.XMLSCHEMA_DATE; +// } +// else if ("time" == type) { +// return XML.Namespaces.XMLSCHEMA_TIME; +// } +// else if ("datetime" == type) { +// return XML.Namespaces.XMLSCHEMA_DATETIME; +// } +// else if ("boolean" == type) { +// return XML.Namespaces.XMLSCHEMA_BOOLEAN; +// } +// } +// }; +// })(BI); diff --git a/src/css/base/single/text.css b/src/css/base/single/text.css index 69603a5a6..b8bc83e73 100644 --- a/src/css/base/single/text.css +++ b/src/css/base/single/text.css @@ -3,5 +3,13 @@ overflow-x: hidden; overflow-y: hidden; white-space: nowrap; + -webkit-box-sizing: border-box; + /*Safari3.2+*/ + -moz-box-sizing: border-box; + /*Firefox3.5+*/ + -ms-box-sizing: border-box; + /*IE8*/ + box-sizing: border-box; + /*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/ word-break: break-word; } diff --git a/src/less/base/single/text.less b/src/less/base/single/text.less index a6f1d83cd..fa6594810 100644 --- a/src/less/base/single/text.less +++ b/src/less/base/single/text.less @@ -1,6 +1,7 @@ @import "../../bibase"; -.bi-text{ +.bi-text { .overflow-dot(); + .box-sizing(border-box); word-break: break-word; } \ No newline at end of file diff --git a/src/polyfill/array.js b/src/polyfill/array.js index 5dadd1588..266f7b3f8 100644 --- a/src/polyfill/array.js +++ b/src/polyfill/array.js @@ -1,31 +1,97 @@ -if(![].indexOf){ - /** - * 检查指定的值是否在数组中 - * @param {Object} o 要检查的值 - * @return {Number} o在数组中的索引(如果不在数组中则返回-1) - */ - Array.prototype.indexOf = function (o) { - for (var i = 0, len = this.length; i < len; i++) { - if (_.isEqual(o, this[i])) { - return i; +// Production steps of ECMA-262, Edition 5, 15.4.4.14 +// Reference: http://es5.github.io/#x15.4.4.14 +if (!Array.prototype.indexOf) { + Array.prototype.indexOf = function (searchElement, fromIndex) { + + var k; + + // 1. Let o be the result of calling ToObject passing + // the this value as the argument. + if (this == null) { + throw new TypeError('"this" is null or not defined'); + } + + var o = Object(this); + + // 2. Let lenValue be the result of calling the Get + // internal method of o with the argument "length". + // 3. Let len be ToUint32(lenValue). + var len = o.length >>> 0; + + // 4. If len is 0, return -1. + if (len === 0) { + return -1; + } + + // 5. If argument fromIndex was passed let n be + // ToInteger(fromIndex); else let n be 0. + var n = fromIndex | 0; + + // 6. If n >= len, return -1. + if (n >= len) { + return -1; + } + + // 7. If n >= 0, then Let k be n. + // 8. Else, n<0, Let k be len - abs(n). + // If k is less than 0, then let k be 0. + k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); + + // 9. Repeat, while k < len + while (k < len) { + // a. Let Pk be ToString(k). + // This is implicit for LHS operands of the in operator + // b. Let kPresent be the result of calling the + // HasProperty internal method of o with argument Pk. + // This step can be combined with c + // c. If kPresent is true, then + // i. Let elementK be the result of calling the Get + // internal method of o with the argument ToString(k). + // ii. Let same be the result of applying the + // Strict Equality Comparison Algorithm to + // searchElement and elementK. + // iii. If same is true, return k. + if (k in o && o[k] === searchElement) { + return k; } + k++; } return -1; - } + }; } -if(![].lastIndexOf){ - /** - * 检查指定的值是否在数组中 - * ie67不支持数组的这个方法 - * @param {Object} o 要检查的值 - * @return {Number} o在数组中的索引(如果不在数组中则返回-1) - */ - Array.prototype.lastIndexOf = function (o) { - for (var len = this.length, i = len - 1; i >= 0; i--) { - if (_.isEqual(o, this[i])) { - return i; +if (!Array.prototype.lastIndexOf) { + Array.prototype.lastIndexOf = function (searchElement /*, fromIndex*/) { + 'use strict'; + + if (this === void 0 || this === null) { + throw new TypeError(); + } + + var n, k, + t = Object(this), + len = t.length >>> 0; + if (len === 0) { + return -1; + } + + n = len - 1; + if (arguments.length > 1) { + n = Number(arguments[1]); + if (n != n) { + n = 0; + } + else if (n != 0 && n != (1 / 0) && n != -(1 / 0)) { + n = (n > 0 || -1) * Math.floor(Math.abs(n)); + } + } + + for (k = n >= 0 + ? Math.min(n, len - 1) + : len - Math.abs(n); k >= 0; k--) { + if (k in t && t[k] === searchElement) { + return k; } } return -1; - } -} \ No newline at end of file + }; +} diff --git a/src/core/utils/set.js b/src/polyfill/set.js similarity index 100% rename from src/core/utils/set.js rename to src/polyfill/set.js diff --git a/src/polyfill/sort.js b/src/polyfill/sort.js index 6ad73ba9c..c2581f68a 100644 --- a/src/polyfill/sort.js +++ b/src/polyfill/sort.js @@ -1,5 +1,5 @@ //修复ie9下sort方法的bug -!function (window) { +;!function (window) { var ua = window.navigator.userAgent.toLowerCase(), reg = /msie|applewebkit.+safari/; if (reg.test(ua)) { diff --git a/src/widget/finetuningnumbereditor/finetuning.number.editor.js b/src/widget/finetuningnumbereditor/finetuning.number.editor.js index f1832685d..af8502371 100644 --- a/src/widget/finetuningnumbereditor/finetuning.number.editor.js +++ b/src/widget/finetuningnumbereditor/finetuning.number.editor.js @@ -15,6 +15,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { var self = this, o = this.options; this.editor = BI.createWidget({ type: "bi.sign_editor", + height: o.height, value: this._alertInEditorValue(o.value), errorText: BI.i18nText("BI-Please_Input_Natural_Number"), validationChecker: function(v){ @@ -62,7 +63,7 @@ BI.FineTuningNumberEditor = BI.inherit(BI.Widget, { el: this.bottomBtn }] }, - width: 30 + width: 23 }] }); }, diff --git a/src/widget/sequencetable/sequencetable.js b/src/widget/sequencetable/sequencetable.js index 52adfdd93..1b6380042 100644 --- a/src/widget/sequencetable/sequencetable.js +++ b/src/widget/sequencetable/sequencetable.js @@ -141,12 +141,6 @@ BI.SequenceTable = BI.inherit(BI.Widget, { _populate: function () { var o = this.options; - this.sequence.attr({ - items: o.items, - header: o.header, - crossItems: o.crossItems, - crossHeader: o.crossHeader - }); if (o.showSequence === true) { this.sequence.setVisible(true); this.table.element.css("left", "60px");