From f90069409ff6627cbff53b72a2ec80afc88c3a6b Mon Sep 17 00:00:00 2001 From: Ray Cromwell Date: Thu, 29 May 2008 20:33:46 +0000 Subject: [PATCH] First release of GwtQuery alpha 0.1 --- README.txt | 28 + src/gquery/GQuery.gwt.xml | 95 + src/gquery/GQueryBench.gwt.xml | 5 + src/gquery/GQueryDemo.gwt.xml | 5 + src/gquery/GQuerySample.gwt.xml | 5 + src/gquery/client/DeferredGQuery.java | 14 + src/gquery/client/Effects.java | 83 + src/gquery/client/Function.java | 22 + src/gquery/client/GQuery.java | 629 +++ src/gquery/client/GQueryBenchModule.java | 210 + src/gquery/client/GQueryDemoModule.java | 82 + src/gquery/client/GQuerySampleModule.java | 31 + src/gquery/client/JSArray.java | 72 + src/gquery/client/MySelectors.java | 130 + src/gquery/client/Plugin.java | 8 + src/gquery/client/Properties.java | 35 + src/gquery/client/Regexp.java | 55 + src/gquery/client/Selector.java | 20 + src/gquery/client/SelectorEngine.java | 97 + src/gquery/client/Selectors.java | 7 + .../client/impl/SelectorEngineImpl.java | 104 + src/gquery/client/impl/SelectorEngineJS.java | 698 ++++ .../client/impl/SelectorEngineJSIE.java | 20 + .../client/impl/SelectorEngineNative.java | 16 + .../client/impl/SelectorEngineXPath.java | 237 ++ src/gquery/public/DOMAssistantComplete-2.7.js | 1347 +++++++ src/gquery/public/GQueryBench.html | 2895 ++++++++++++++ src/gquery/public/GQueryDemo.html | 34 + src/gquery/public/GQuerySample.html | 10 + src/gquery/public/ext-all.js | 157 + src/gquery/public/ext-base.js | 10 + src/gquery/public/ext-core.js | 19 + src/gquery/public/jquery-1.2.3.js | 3408 +++++++++++++++++ src/gquery/rebind/SelectorGeneratorBase.java | 186 + src/gquery/rebind/SelectorGeneratorJS.java | 174 + .../rebind/SelectorGeneratorNative.java | 32 + src/gquery/rebind/SelectorGeneratorXPath.java | 317 ++ .../gebcn/SelectorGeneratorJSGEBCN.java | 12 + .../gebcn/SelectorGeneratorNativeGEBCN.java | 13 + .../gebcn/SelectorGeneratorXPathGEBCN.java | 12 + 40 files changed, 11334 insertions(+) create mode 100644 README.txt create mode 100644 src/gquery/GQuery.gwt.xml create mode 100644 src/gquery/GQueryBench.gwt.xml create mode 100644 src/gquery/GQueryDemo.gwt.xml create mode 100644 src/gquery/GQuerySample.gwt.xml create mode 100644 src/gquery/client/DeferredGQuery.java create mode 100644 src/gquery/client/Effects.java create mode 100644 src/gquery/client/Function.java create mode 100644 src/gquery/client/GQuery.java create mode 100644 src/gquery/client/GQueryBenchModule.java create mode 100644 src/gquery/client/GQueryDemoModule.java create mode 100644 src/gquery/client/GQuerySampleModule.java create mode 100644 src/gquery/client/JSArray.java create mode 100644 src/gquery/client/MySelectors.java create mode 100644 src/gquery/client/Plugin.java create mode 100644 src/gquery/client/Properties.java create mode 100644 src/gquery/client/Regexp.java create mode 100644 src/gquery/client/Selector.java create mode 100644 src/gquery/client/SelectorEngine.java create mode 100644 src/gquery/client/Selectors.java create mode 100644 src/gquery/client/impl/SelectorEngineImpl.java create mode 100644 src/gquery/client/impl/SelectorEngineJS.java create mode 100644 src/gquery/client/impl/SelectorEngineJSIE.java create mode 100644 src/gquery/client/impl/SelectorEngineNative.java create mode 100644 src/gquery/client/impl/SelectorEngineXPath.java create mode 100644 src/gquery/public/DOMAssistantComplete-2.7.js create mode 100644 src/gquery/public/GQueryBench.html create mode 100644 src/gquery/public/GQueryDemo.html create mode 100644 src/gquery/public/GQuerySample.html create mode 100644 src/gquery/public/ext-all.js create mode 100644 src/gquery/public/ext-base.js create mode 100644 src/gquery/public/ext-core.js create mode 100644 src/gquery/public/jquery-1.2.3.js create mode 100644 src/gquery/rebind/SelectorGeneratorBase.java create mode 100644 src/gquery/rebind/SelectorGeneratorJS.java create mode 100644 src/gquery/rebind/SelectorGeneratorNative.java create mode 100644 src/gquery/rebind/SelectorGeneratorXPath.java create mode 100644 src/gquery/rebind/gebcn/SelectorGeneratorJSGEBCN.java create mode 100644 src/gquery/rebind/gebcn/SelectorGeneratorNativeGEBCN.java create mode 100644 src/gquery/rebind/gebcn/SelectorGeneratorXPathGEBCN.java diff --git a/README.txt b/README.txt new file mode 100644 index 00000000..77a47eb4 --- /dev/null +++ b/README.txt @@ -0,0 +1,28 @@ + +Introduction +------------ + +GwtQuery is a jQuery-like API written in GWT, which allows GWT to be used in +progressive enhancement scenarios where perhaps GWT widgets are too +heavyweight. + +Currently, only a part of the jQuery API is written. Most CSS3 selectors are +supported. People feel free to contribute patches to bring the API more in +line with jQuery. + +This code is alpha, so expect it to break, and expect the API to change +in the future. + +I would like the thank John Resig for writing jQuery, a kick ass library, +that is a pleasure to use, and I hope to capture that feeling in GWT. Also, +thanks to Robery Nyman for writing the fastest CSS Selector API +implementation (DOMAssistant), which I used as a guide for the GWT +impementation. GwtQuery is in large part, a port of DOMAssistant. + +I am releasing this under the MIT License in the spirit for Robert Nyman's +choice, since the performance of this library wouldn't have been possible +without him. + +Thanks, +Ray Cromwell +CTO, TimeFire diff --git a/src/gquery/GQuery.gwt.xml b/src/gquery/GQuery.gwt.xml new file mode 100644 index 00000000..27ea989d --- /dev/null +++ b/src/gquery/GQuery.gwt.xml @@ -0,0 +1,95 @@ + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/gquery/GQueryBench.gwt.xml b/src/gquery/GQueryBench.gwt.xml new file mode 100644 index 00000000..4b3f4d69 --- /dev/null +++ b/src/gquery/GQueryBench.gwt.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/gquery/GQueryDemo.gwt.xml b/src/gquery/GQueryDemo.gwt.xml new file mode 100644 index 00000000..41dfe995 --- /dev/null +++ b/src/gquery/GQueryDemo.gwt.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/gquery/GQuerySample.gwt.xml b/src/gquery/GQuerySample.gwt.xml new file mode 100644 index 00000000..7be01766 --- /dev/null +++ b/src/gquery/GQuerySample.gwt.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/gquery/client/DeferredGQuery.java b/src/gquery/client/DeferredGQuery.java new file mode 100644 index 00000000..ac6e05e3 --- /dev/null +++ b/src/gquery/client/DeferredGQuery.java @@ -0,0 +1,14 @@ +package gquery.client; + +import com.google.gwt.dom.client.Node; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.NodeList; + +/** + * A compiled selector that can be lazily turned into a GQuery + */ +public interface DeferredGQuery { + String getSelector(); + GQuery eval(Node ctx); + NodeList array(Node ctx); +} diff --git a/src/gquery/client/Effects.java b/src/gquery/client/Effects.java new file mode 100644 index 00000000..8e7fff23 --- /dev/null +++ b/src/gquery/client/Effects.java @@ -0,0 +1,83 @@ +package gquery.client; + +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.NodeList; +import com.google.gwt.user.client.animation.Animation; + +public class Effects extends GQuery { + + static { + GQuery.registerPlugin(Effects.class, new EffectsPlugin()); + } + + public static final Class Effects = Effects.class; + + public Effects(Element element) { + super(element); + } + + public Effects(JSArray elements) { + super(elements); + } + + public Effects(NodeList list) { + super(list); + } + + public Effects fadeOut() { + Animation a = new Animation() { + + public void onCancel() { + } + + public void onComplete() { + for (int i = 0; i < elements.getLength(); i++) { + elements.getItem(i).getStyle().setProperty("opacity", "0"); + elements.getItem(i).getStyle().setProperty("display", "none"); + } + } + + public void onStart() { + } + + public void onUpdate(double progress) { + for (int i = 0; i < elements.getLength(); i++) { + elements.getItem(i).getStyle() + .setProperty("opacity", String.valueOf(1.0 - progress)); + } + } + }; + a.run(1000); + return this; + } + + public Effects fadeIn() { + Animation a = new Animation() { + + public void onCancel() { + } + + public void onComplete() { + } + + public void onStart() { + } + + public void onUpdate(double progress) { + for (int i = 0; i < elements.getLength(); i++) { + elements.getItem(i).getStyle() + .setProperty("opacity", String.valueOf(progress)); + } + } + }; + a.run(1000); + return this; + } + + public static class EffectsPlugin implements Plugin { + + public Effects init(GQuery gq) { + return new Effects(gq.get()); + } + } +} diff --git a/src/gquery/client/Function.java b/src/gquery/client/Function.java new file mode 100644 index 00000000..d42207f6 --- /dev/null +++ b/src/gquery/client/Function.java @@ -0,0 +1,22 @@ +package gquery.client; + +import com.google.gwt.dom.client.Element; +import com.google.gwt.user.client.Event; + +/** + * Extend this class to implement functions. + */ +public abstract class Function { + + public void f(Element e) { + } + + public boolean f(Event e, Object data) { + return f(e); + } + + public boolean f(Event e) { + f(e.getCurrentTarget()); + return true; + } +} diff --git a/src/gquery/client/GQuery.java b/src/gquery/client/GQuery.java new file mode 100644 index 00000000..388ff81a --- /dev/null +++ b/src/gquery/client/GQuery.java @@ -0,0 +1,629 @@ +package gquery.client; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.ButtonElement; +import com.google.gwt.dom.client.Document; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.InputElement; +import com.google.gwt.dom.client.Node; +import com.google.gwt.dom.client.NodeList; +import com.google.gwt.dom.client.OptionElement; +import com.google.gwt.dom.client.SelectElement; +import com.google.gwt.dom.client.TextAreaElement; +import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.Event; +import com.google.gwt.user.client.EventListener; + +import java.util.HashMap; +import java.util.Map; + +/** + * + */ +public class GQuery { + + public static class Offset { + + public int top; + + public int left; + + Offset(int left, int top) { + this.left = left; + this.top = top; + } + } + + private static Map, Plugin> plugins; + + /** + * This function accepts a string containing a CSS selector which is then used + * to match a set of elements, or it accepts raw HTML creating a GQuery + * element containing those elements. + */ + public static GQuery $(String selectorOrHtml) { + if (selectorOrHtml.trim().charAt(0) == '<') { + return innerHtml(selectorOrHtml); + } + return $(selectorOrHtml, Document.get()); + } + + public static T $(T gq) { + return gq; + } + + /** + * This function accepts a string containing a CSS selector which is then used + * to match a set of elements, or it accepts raw HTML creating a GQuery + * element containing those elements. The second parameter is is a class + * reference to a plugin to be used. + */ + public static T $(String selector, Class plugin) { + try { + if (plugins != null) { + T gquery = (T) plugins.get(plugin).init($(selector, Document.get())); + return gquery; + } + throw new RuntimeException("No plugin for class " + plugin); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * This function accepts a string containing a CSS selector which is then used + * to match a set of elements, or it accepts raw HTML creating a GQuery + * element containing those elements. The second parameter is the context to + * use for the selector. + */ + public static GQuery $(String selector, Node context) { + return new GQuery(select(selector, context)); + } + + /** + * This function accepts a string containing a CSS selector which is then used + * to match a set of elements, or it accepts raw HTML creating a GQuery + * element containing those elements. The second parameter is the context to + * use for the selector. The third parameter is the class plugin to use. + */ + public static GQuery $(String selector, Node context, + Class plugin) { + try { + if (plugins != null) { + T gquery = (T) plugins.get(plugin) + .init(new GQuery(select(selector, context))); + return gquery; + } + throw new RuntimeException("No plugin for class " + plugin); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * Wrap a GQuery around existing Elements. + */ + public static GQuery $(NodeList elements) { + return new GQuery(elements); + } + + public static GQuery $(Element element) { + JSArray a = JSArray.create(); + a.addNode(element); + return new GQuery(a); + } + + /** + * Wrap a JSON object + */ + public static Properties $$(String properties) { + return Properties.create(properties); + } + + public static T[] asArray(NodeList nl) { + if (GWT.isScript()) { + return reinterpretCast(nl); + } else { + Node[] elts = new Node[nl.getLength()]; + for (int i = 0; i < elts.length; i++) { + elts[i] = nl.getItem(i); + } + return (T[]) elts; + } + } + + public static void registerPlugin(Class plugin, + Plugin pluginFactory) { + if (plugins == null) { + plugins = new HashMap(); + } + plugins.put(plugin, pluginFactory); + } + + /** + * Copied from UIObject * + */ + protected static void setStyleName(Element elem, String style, boolean add) { + + style = style.trim(); + + // Get the current style string. + String oldStyle = elem.getClassName(); + int idx = oldStyle.indexOf(style); + + // Calculate matching index. + while (idx != -1) { + if (idx == 0 || oldStyle.charAt(idx - 1) == ' ') { + int last = idx + style.length(); + int lastPos = oldStyle.length(); + if ((last == lastPos) || ((last < lastPos) && (oldStyle.charAt(last) + == ' '))) { + break; + } + } + idx = oldStyle.indexOf(style, idx + 1); + } + + if (add) { + // Only add the style if it's not already present. + if (idx == -1) { + if (oldStyle.length() > 0) { + oldStyle += " "; + } + DOM.setElementProperty(elem.cast(), + "className", oldStyle + style); + } + } else { + // Don't try to remove the style if it's not there. + if (idx != -1) { + // Get the leading and trailing parts, without the removed name. + String begin = oldStyle.substring(0, idx).trim(); + String end = oldStyle.substring(idx + style.length()).trim(); + + // Some contortions to make sure we don't leave extra spaces. + String newClassName; + if (begin.length() == 0) { + newClassName = end; + } else if (end.length() == 0) { + newClassName = begin; + } else { + newClassName = begin + " " + end; + } + + DOM.setElementProperty(elem.cast(), + "className", newClassName); + } + } + } + + private static boolean hasClass(Element e, String clz) { + return e.getClassName().matches("\\s" + clz + "\\s"); + } + + private static GQuery innerHtml(String html) { + Element div = DOM.createDiv(); + div.setInnerHTML(html); + return new GQuery((NodeList) (NodeList) div.getChildNodes()); + } + + private static native T[] reinterpretCast(NodeList nl) /*-{ + return nl; + }-*/; + + private static NodeList select(String selector, Node context) { + return new SelectorEngine().select(selector, context); + } + + protected NodeList elements = null; + + public GQuery(NodeList list) { + elements = list; + } + + public GQuery(JSArray elements) { + this.elements = elements; + } + + public GQuery(Element element) { + elements = JSArray.create(element); + } + + /** + * Adds the specified classes to each matched element. + */ + public GQuery addClass(String... classes) { + for (Element e : elements()) { + for (String clz : classes) { + setStyleName(e, clz, true); + } + } + return this; + } + + /** + * Convert to Plugin interface provided by Class literal. + */ + public T as(Class plugin) { + if (plugins != null) { + return (T) plugins.get(plugin).init(this); + } + throw new RuntimeException("No plugin registered for class " + plugin); + } + + public String attr(String name) { + return elements.getItem(0).getAttribute(name); + } + + public GQuery attr(String key, String value) { + for (Element e : elements()) { + e.setAttribute(key, value); + } + return this; + } + + public GQuery attr(Properties properties) { + for (Element e : elements()) { + for (String name : properties.keys()) { + e.setAttribute(name, properties.get(name)); + } + } + return this; + } + + public GQuery bind(int eventbits, final Object data, final Function f) { + EventListener listener = new EventListener() { + public void onBrowserEvent(Event event) { + if (!f.f(event, data)) { + event.cancelBubble(true); + event.preventDefault(); + } + } + }; + for (Element e : elements()) { + DOM.sinkEvents((com.google.gwt.user.client.Element) e, eventbits); + DOM.setEventListener((com.google.gwt.user.client.Element) e, listener); + } + return this; + } + + public GQuery blur(Function f) { + return bind(Event.ONBLUR, null, f); + } + + public GQuery change(Function f) { + return bind(Event.ONCHANGE, null, f); + } + + public GQuery click(final Function f) { + return bind(Event.ONCLICK, null, f); + } + + public String css(String name) { + return elements.getItem(0).getStyle().getProperty(name); + } + + public GQuery css(Properties properties) { + for (String property : properties.keys()) { + css(property, properties.get(property)); + } + return this; + } + + public GQuery css(String prop, String val) { + for (Element e : elements()) { + e.getStyle().setProperty(prop, val); + } + return this; + } + + public GQuery dblclick(Function f) { + return bind(Event.ONDBLCLICK, null, f); + } + + /** + * Run one or more Functions over each element of the GQuery. + */ + public GQuery each(Function... f) { + for (Function f1 : f) { + for (Element e : elements()) { + f1.f(e); + } + } + return this; + } + + /** + * Returns the working set of nodes as a Java array. Do NOT get() { + return elements; + } + + /** + * Return the ith element matched. + */ + public Element get(int i) { + return elements.getItem(i); + } + + /** + * Returns true any of the specified classes are present on any of the matched + * elements. + */ + public boolean hasClass(String... classes) { + for (Element e : elements()) { + for (String clz : classes) { + if (hasClass(e, clz)) { + return true; + } + } + } + return false; + } + + /** + * Set the height of every element in the matched set. + */ + public GQuery height(int height) { + for (Element e : elements()) { + e.getStyle().setPropertyPx("height", height); + } + return this; + } + + /** + * Get the innerHTML of the first matched element. + */ + public String html() { + return get(0).getInnerHTML(); + } + + /** + * Set the innerHTML of every matched element. + */ + public GQuery html(String html) { + for (Element e : elements()) { + e.setInnerHTML(html); + } + return this; + } + + /** + * Find the index of the specified Element + */ + public int index(Element element) { + for (int i = 0; i < elements.getLength(); i++) { + if (elements.getItem(i) == element) { + return i; + } + } + return -1; + } + + public GQuery keydown(Function f) { + return bind(Event.ONKEYDOWN, null, f); + } + + public GQuery keypressed(Function f) { + return bind(Event.ONKEYPRESS, null, f); + } + + public GQuery keyup(Function f) { + return bind(Event.ONKEYUP, null, f); + } + + public GQuery load(Function f) { + return bind(Event.ONLOAD, null, f); + } + + public GQuery mousedown(Function f) { + return bind(Event.ONMOUSEDOWN, null, f); + } + + public GQuery mousemove(Function f) { + return bind(Event.ONMOUSEMOVE, null, f); + } + + public GQuery mouseout(Function f) { + return bind(Event.ONMOUSEOUT, null, f); + } + + public GQuery mouseover(Function f) { + return bind(Event.ONMOUSEOVER, null, f); + } + + public GQuery mouseup(Function f) { + return bind(Event.ONMOUSEUP, null, f); + } + + public Offset offset() { + return new Offset(get(0).getOffsetLeft(), get(0).getOffsetTop()); + } + + /** + * Remove the named attribute from every element in the matched set. + */ + public GQuery removeAttr(String key) { + for (Element e : elements()) { + e.removeAttribute(key); + } + return this; + } + + /** + * Removes the specified classes to each matched element. + */ + public GQuery removeClass(String... classes) { + for (Element e : elements()) { + for (String clz : classes) { + setStyleName(e, clz, false); + } + } + return this; + } + + public GQuery scroll(Function f) { + return bind(Event.ONSCROLL, null, f); + } + + /** + * Return the number of elements in the matched set. + */ + public int size() { + return elements.getLength(); + } + + public GQuery slice(int start, int end) { + JSArray slice = JSArray.create(); + if (end == -1 || end > elements.getLength()) { + end = elements.getLength(); + } + for (int i = start; i < elements.getLength(); i++) { + slice.addNode(elements.getItem(i)); + } + return new GQuery(slice); + } + + /** + * Return the text contained in the first matched element. + */ + public String text() { + return elements.getItem(0).getInnerText(); + } + + /** + * Set the innerText of every matched element. + */ + public GQuery text(String txt) { + for (Element e : asArray(elements)) { + e.setInnerText(txt); + } + return this; + } + + /** + * Adds or removes the specified classes to each matched element. + */ + public GQuery toggleClass(String... classes) { + for (Element e : elements()) { + for (String clz : classes) { + if (hasClass(e, clz)) { + setStyleName(e, clz, false); + } else { + setStyleName(e, clz, true); + } + } + } + return this; + } + + /** + * Get the content of the value attribute of the first matched element, + * returns more than one value if it is a multiple select. + */ + public String[] val() { + if (size() > 0) { + Element e = get(0); + if (e.getNodeName().equals("select")) { + SelectElement se = SelectElement.as(e); + if (se.getMultiple() != null) { + NodeList oel = se.getOptions(); + int count = 0; + for (OptionElement oe : asArray(oel)) { + if (oe.isSelected()) { + count++; + } + } + String result[] = new String[count]; + count = 0; + for (OptionElement oe : asArray(oel)) { + if (oe.isSelected()) { + result[count++] = oe.getValue(); + } + } + + return result; + } else { + int index = se.getSelectedIndex(); + if (index != -1) { + return new String[]{se.getOptions().getItem(index).getValue()}; + } + } + } else if (e.getNodeName().equals("input")) { + InputElement ie = InputElement.as(e); + return new String[]{ie.getValue()}; + } + } + return new String[0]; + } + + public GQuery val(String... values) { + for (Element e : elements()) { + String name = e.getNodeName(); + if ("select".equals(name)) { + + } else if ("input".equals(name)) { + InputElement ie = InputElement.as(e); + String type = ie.getType(); + if ("radio".equals((type)) || "checkbox".equals(type)) { + if ("checkbox".equals(type)) { + for (String val : values) { + if (ie.getValue().equals(val)) { + ie.setChecked(true); + } else if (ie.getValue().equals(val)) { + ie.setChecked(true); + } + } + } + } else { + ie.setValue(values[0]); + } + } else if ("textarea".equals(name)) { + TextAreaElement.as(e).setValue(values[0]); + } else if ("button".equals(name)) { + ButtonElement.as(e).setValue(values[0]); + } + } + return this; + } + + /** + * Set the width of every matched element. + */ + public GQuery width(int width) { + for (Element e : elements()) { + e.getStyle().setPropertyPx("width", width); + } + return this; + } + + private void init(GQuery gQuery) { + this.elements = gQuery.elements; + } + + +} diff --git a/src/gquery/client/GQueryBenchModule.java b/src/gquery/client/GQueryBenchModule.java new file mode 100644 index 00000000..b7b73560 --- /dev/null +++ b/src/gquery/client/GQueryBenchModule.java @@ -0,0 +1,210 @@ +package gquery.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Document; +import com.google.gwt.dom.client.Element; +import com.google.gwt.user.client.DeferredCommand; +import com.google.gwt.user.client.IncrementalCommand; +import static gquery.client.GQuery.$; + +public class GQueryBenchModule implements EntryPoint { + + private StringBuffer log = new StringBuffer(); + + private static final int MIN_TIME = 200; + + private static final String GCOMPILED = "gcompiled"; + + private static final String DOMASSISTANT = "dresult"; + + private static final String GDYNAMIC = "gresult"; + + public void onModuleLoad() { + final MySelectors m = GWT.create(MySelectors.class); + + final DeferredGQuery dg[] = m.getAllSelectors(); + initResultsTable(dg, "Compiled GQuery", GCOMPILED, "DOMAssistant-2.7" /*"DOMAssistant 2.7" */, + DOMASSISTANT, "Dynamic GQuery", GDYNAMIC); + runBenchmarks(dg, new GQueryCompiledBenchmark(), + new DomAssistantBenchmark(), new GQueryDynamicBenchmark()); + } + + public interface Benchmark { + + public int runSelector(DeferredGQuery dq, String selector); + + String getId(); + } + + + public void runBenchmarks(final DeferredGQuery[] dg, + final Benchmark... benchmark) { + DeferredCommand.addCommand(new IncrementalCommand() { + int selectorNumber = 0; + int numCalls = 0; + int benchMarkNumber = 0; + double totalTimes[] = new double[benchmark.length]; + long cumTime = 0; + + int numRuns = 0; + int winner = -1; + double winTime = Double.MAX_VALUE; + public boolean execute() { + if (benchMarkNumber >= benchmark.length) { + benchMarkNumber = 0; + numCalls = 0; + cumTime = 0; + numRuns = 0; + setResultClass(benchmark[winner].getId(), selectorNumber, "win"); + for (int i = 0; i < benchmark.length; i++) { + if (i != winner) + setResultClass(benchmark[i].getId(), selectorNumber, "lose"); + } + selectorNumber++; + winner = -1; + winTime = Double.MAX_VALUE; + if (selectorNumber >= dg.length) { + double min = Double.MAX_VALUE; + for (int i = 0; i < totalTimes.length; i++) { + if (totalTimes[i] < min) min = totalTimes[i]; + } + for (int i = 0; i < totalTimes.length; i++) { + d(benchmark[i].getId(), dg.length, (((int) (totalTimes[i] * 100)) / 100.0) + " ms"); + setResultClass(benchmark[i].getId(), + dg.length, totalTimes[i] <= min ? "win" : "lose"); + } + return false; + } + } + DeferredGQuery d = dg[selectorNumber]; + long start = System.currentTimeMillis(); + int num = 0; + long end = start; + Benchmark m = benchmark[benchMarkNumber]; + String selector = d.getSelector(); + + do { + num += m.runSelector(d, selector); + end = System.currentTimeMillis(); + numCalls++; + } while (end - start < MIN_TIME); + double runtime = (double) (end - start) / numCalls; + if (runtime < winTime) { + winTime = runtime; + winner = benchMarkNumber; + } + d(m.getId(), selectorNumber, runtime, (num / numCalls)); + totalTimes[benchMarkNumber] += runtime; + numCalls = 0; + benchMarkNumber++; + return true; + } + }); + } + + private void setResultClass(String id, int i, String clz) { + Element td = Document.get().getElementById(id + i); + td.setClassName(clz); + } + + private void d(String type, int i, String text) { + Element td = Document.get().getElementById(type + i); + td.setInnerHTML(text); + } + + private void d(String type, int i, double v, int i1) { + + Element td = Document.get().getElementById(type + i); + td.setInnerHTML( + "" + (((int) (v * 100)) / 100.0) + " ms, found " + i1 + " nodes"); + } + + private void initResultsTable(DeferredGQuery[] dg, String... options) { + int numRows = dg.length; + Document doc = Document.get(); + Element table = doc.getElementById("resultstable"); + Element thead = doc.createTHeadElement(); + table.appendChild(thead); + Element selectorHeader = doc.createTHElement(); + Element theadtr = doc.createTRElement(); + selectorHeader.setInnerHTML("Selector"); + theadtr.appendChild(selectorHeader); + thead.appendChild(theadtr); + + Element tbody = doc.createTBodyElement(); + table.appendChild(tbody); + + for (int i = 0; i < options.length; i += 2) { + Element th = doc.createTHElement(); + th.setInnerHTML(options[i]); + theadtr.appendChild(th); + } + for (int i = 0; i < numRows; i++) { + Element tr = doc.createTRElement(); + Element lab = doc.createTHElement(); + lab.setInnerHTML(dg[i].getSelector()); + tr.appendChild(lab); + for (int j = 0; j < options.length; j += 2) { + Element placeholder = doc.createTDElement(); + placeholder.setInnerHTML("Not Tested"); + placeholder.setId(options[j + 1] + i); + tr.appendChild(placeholder); + } + tbody.appendChild(tr); + } + Element totalRow = doc.createTRElement(); + Element totalLab = doc.createTHElement(); + totalLab.setInnerHTML("Total"); + totalRow.appendChild(totalLab); + for (int j = 0; j < options.length; j += 2) { + Element placeholder = doc.createTDElement(); + placeholder.setInnerHTML("0"); + placeholder.setId(options[j + 1] + numRows); + totalRow.appendChild(placeholder); + } + tbody.appendChild(totalRow); + } + + private void d(String s) { + log.append(s + "
"); + } + + private static class GQueryCompiledBenchmark implements Benchmark { + + public int runSelector(DeferredGQuery dq, String selector) { + return dq.array(null).getLength(); + } + + public String getId() { + return GCOMPILED; + } + } + + private static class DomAssistantBenchmark implements Benchmark { + + public native int runSelector(DeferredGQuery dq, String selector) /*-{ + return $wnd.$(selector).length; + }-*/; + + public String getId() { + return DOMASSISTANT; + } + } + + private static class GQueryDynamicBenchmark implements Benchmark { + private SelectorEngine engine; + + private GQueryDynamicBenchmark() { + engine = new SelectorEngine(); + } + + public int runSelector(DeferredGQuery dq, String selector) { + return engine.select(selector, Document.get()).getLength(); + } + + public String getId() { + return GDYNAMIC; + } + } +} diff --git a/src/gquery/client/GQueryDemoModule.java b/src/gquery/client/GQueryDemoModule.java new file mode 100644 index 00000000..5190c21d --- /dev/null +++ b/src/gquery/client/GQueryDemoModule.java @@ -0,0 +1,82 @@ +package gquery.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.NodeList; +import com.google.gwt.dom.client.Document; +import com.google.gwt.dom.client.Node; +import com.google.gwt.user.client.Event; + +import static gquery.client.GQuery.$; +import static gquery.client.Effects.Effects; + +/** + * + */ +public class GQueryDemoModule implements EntryPoint { + // Compile-time Selectors! + interface Slide extends Selectors { + // find all LI elements in DIV.slide elements + @Selector("div.slide li") + NodeList allSlideBullets(); + + // find all LI elements rooted at ctx + @Selector("li") + NodeList slideBulletsCtx(Node ctx); + + // Find all DIV elements with class 'slide' + @Selector("div.slide") + NodeList allSlides(); + + } + + public void onModuleLoad() { + // Ask GWT compiler to generate our interface + final Slide s = GWT.create(Slide.class); + + // Find all slides, set css to display: none + // change first slide to display: block + $(s.allSlides()).css("display", "none") + .eq(0).css("display", "block"); + + + // we initially hide all bullets by setting opacity to 0 + $(s.allSlideBullets()).css("opacity", "0"); + + // add onclick handler to body element + $(Document.get().getBody()).click(new Function() { + // two state variables to note current slide being shown + // and current bullet + int curSlide = 0; + int curBullets = 0; + + // query and store all slides, and bullets of current slide + GQuery slides = $(s.allSlides()); + GQuery bullets = $(s.slideBulletsCtx(slides.get(curSlide))); + + public boolean f(Event e) { + // onclick, if not all bullets shown, show a bullet and increment + if (curBullets < bullets.size()) { + bullets.eq(curBullets++).as(Effects).fadeIn(); + } else { + // all bullets shown, hide them and current slide + bullets.css("opacity","0"); + slides.eq(curSlide).css("display", "none"); + // move to next slide, checking for wrap around + curSlide++; + if(curSlide == slides.size()) { + curSlide = 0; + } + curBullets = 0; + // query for new set of bullets, and show next slide + // by changing opacity to 1 and display to block + bullets = $(s.slideBulletsCtx(slides.get(curSlide))); + slides.eq(curSlide).css("display", "block").as(Effects).fadeIn(); + } + return true; + } + }); + + } +} diff --git a/src/gquery/client/GQuerySampleModule.java b/src/gquery/client/GQuerySampleModule.java new file mode 100644 index 00000000..2382070f --- /dev/null +++ b/src/gquery/client/GQuerySampleModule.java @@ -0,0 +1,31 @@ +package gquery.client; + +import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Element; +import com.google.gwt.user.client.Window; + +/** + * Copyright 2007 Timepedia.org + * 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. + * + * @author Ray Cromwell + */ +public class GQuerySampleModule implements EntryPoint { + interface Sample extends Selectors { + @Selector(".note") + GQuery allNotes(); + } + public void onModuleLoad() { + Sample s = GWT.create(Sample.class); + s.allNotes().html("This was a note"); + } +} diff --git a/src/gquery/client/JSArray.java b/src/gquery/client/JSArray.java new file mode 100644 index 00000000..f28b3c2c --- /dev/null +++ b/src/gquery/client/JSArray.java @@ -0,0 +1,72 @@ +package gquery.client; + +import com.google.gwt.core.client.JavaScriptObject; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.Node; +import com.google.gwt.dom.client.NodeList; + +/** + */ +public class JSArray extends NodeList { + + public static JSArray create() { + return (JSArray) JavaScriptObject.createArray(); + } + + public static native JSArray create(Node node) /*-{ + return [node]; + }-*/; + + public static native JSArray create(NodeList nl) /*-{ + var r = [], len=nl.length; + for(var i=0; i titleAndh1Title(); + + @Selector("body") + NodeList body(); + + @Selector("body div") + NodeList bodyDiv(); + + @Selector("div p") + NodeList divP(); + + @Selector("div > div") + NodeList divGtP(); + + @Selector("div + p") + NodeList divPlusP(); + + @Selector("div ~ p") + NodeList divTildeP(); + + @Selector("div[class^=exa][class$=mple]") + NodeList divPrefixExaSuffixMple(); + + @Selector("div p a") + NodeList divPA(); + +// @Selector("div, p a") +// NodeList divCommaPA(); + + @Selector(".note") + NodeList note(); + + @Selector("div .example") + NodeList divExample(); + + @Selector("ul .tocline2") + NodeList ulTocline2(); + + @Selector("#title") + NodeList title(); + + @Selector("h1#title") + NodeList h1Title(); + + @Selector("div #title") + NodeList divSpaceTitle(); + + @Selector("ui.toc li.tocline2") + NodeList ulTocLiTocLine2(); + + @Selector("h1#title + div > p") + NodeList h1TitlePlusDivGtP(); + +// @Selector("h1[id]:contains(Selectors)") +// NodeList h1IdContainsSelectors(); +// + @Selector("a[href][lang][class]") + NodeList aHrefLangClass(); + + @Selector("div[class]") + NodeList divWithClass(); + + @Selector("div[class=example]") + NodeList divWithClassExample(); + + @Selector("div[class^=exa]") + NodeList divWithClassPrefixExa(); + + @Selector("div[class$=mple]") + NodeList divWithClassSuffixMple(); + + @Selector("div[class~=dialog]") + NodeList divWithClassContainsDialog(); + + @Selector("div[class*=e]") + NodeList divWithClassContainsE(); + +// @Selector("div[class!=madeup]") +// NodeList divWithClassNotContainsMadeup(); +// + + @Selector("div[class~=dialog]") + NodeList divWithClassListContainsDialog(); + + @Selector("*:checked") + NodeList allChecked(); + +// @Selector("*:first") +// NodeList allFirst(); +// + @Selector("div:not(.example)") + NodeList divNotExample(); + +// @Selector("p:contains(selectors)") +// NodeList pContainsSelectors(); + + @Selector("p:nth-child(even)") + NodeList nThChildEven(); + + @Selector("p:nth-child(2n)") + NodeList nThChild2n(); + + @Selector("p:nth-child(odd)") + NodeList nThChildOdd(); + + @Selector("p:nth-child(2n+1)") + NodeList nThChild2nPlus1(); + + @Selector("p:nth-child(n)") + NodeList nthChild(); + + @Selector("p:only-child") + NodeList onlyChild(); + + @Selector("p:last-child") + NodeList lastChild(); + + @Selector("p:first-child") + NodeList firstChild(); +} diff --git a/src/gquery/client/Plugin.java b/src/gquery/client/Plugin.java new file mode 100644 index 00000000..cc8adfbc --- /dev/null +++ b/src/gquery/client/Plugin.java @@ -0,0 +1,8 @@ +package gquery.client; + +/** + * A GQuery plugin + */ +public interface Plugin { + T init(GQuery gq); +} diff --git a/src/gquery/client/Properties.java b/src/gquery/client/Properties.java new file mode 100644 index 00000000..cc558a5d --- /dev/null +++ b/src/gquery/client/Properties.java @@ -0,0 +1,35 @@ +package gquery.client; + +import com.google.gwt.core.client.JavaScriptObject; + +/** + * + */ +public class Properties extends JavaScriptObject { + + protected Properties() { } + public native static Properties create(String properties) /*-{ + return eval(properties); + }-*/; + + public final native String get(String name) /*-{ + return this[name]; + }-*/; + + public final native int getInt(String name) /*-{ + return this[name]; + }-*/; + + public final native float getFloat(String name) /*-{ + return this[name]; + }-*/; + + public final native String[] keys() /*-{ + var key, keys=[]; + + for(key in this) { + keys.push(key); + } + return keys; + }-*/; +} diff --git a/src/gquery/client/Regexp.java b/src/gquery/client/Regexp.java new file mode 100644 index 00000000..3856fdde --- /dev/null +++ b/src/gquery/client/Regexp.java @@ -0,0 +1,55 @@ +package gquery.client; + +import com.google.gwt.core.client.JavaScriptObject; + +/** + */ +public class Regexp { + + private final JavaScriptObject regexp; + + public Regexp(String pattern) { + this.regexp = compile(pattern); + } + + public Regexp(String pat, String flags) { + this.regexp = compileFlags(pat, flags); + } + + public static native JavaScriptObject compile(String pat) /*-{ + return new RegExp(pat); + }-*/; + + public static native JavaScriptObject compileFlags(String pat, String flags) /*-{ + return new RegExp(pat, flags); + }-*/; + + public JSArray exec(String str) { + return exec0(regexp, str); + } + + + private static native JSArray exec0(JavaScriptObject regexp, String str) /*-{ + return regexp.exec(str); + }-*/; + + public JSArray match(String currentRule) { + return match0(regexp, currentRule); + } + + private native JSArray match0(JavaScriptObject regexp, String currentRule)/*-{ + return currentRule.match(regexp); + }-*/; + + public boolean test(String rule) { + return test0(regexp, rule); + } + + private native boolean test0(JavaScriptObject regexp, String rule) /*-{ + return regexp.test(rule); + }-*/; + + public static JSArray match(String regexp, String flags, String string) { + return new Regexp(regexp, flags).match(string); + } +} diff --git a/src/gquery/client/Selector.java b/src/gquery/client/Selector.java new file mode 100644 index 00000000..3c6f3ed3 --- /dev/null +++ b/src/gquery/client/Selector.java @@ -0,0 +1,20 @@ +package gquery.client; + +import java.lang.annotation.Target; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.CONSTRUCTOR; +import static java.lang.annotation.ElementType.LOCAL_VARIABLE; + +/** + * Used to pass a CSS Selector to a generator at compile time + */ +@Target({METHOD}) +@Retention(RetentionPolicy.SOURCE) +public @interface Selector { + String value(); +} diff --git a/src/gquery/client/SelectorEngine.java b/src/gquery/client/SelectorEngine.java new file mode 100644 index 00000000..fcf994d7 --- /dev/null +++ b/src/gquery/client/SelectorEngine.java @@ -0,0 +1,97 @@ +package gquery.client; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.core.client.JavaScriptObject; +import com.google.gwt.dom.client.Document; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.Node; +import com.google.gwt.dom.client.NodeList; + +import gquery.client.impl.SelectorEngineImpl; + +/** + * + */ +public class SelectorEngine { + private SelectorEngineImpl impl; + + + public SelectorEngine() { + impl = (SelectorEngineImpl) GWT + .create(SelectorEngineImpl.class); + } + + public static native boolean eq(String s1, String s2) /*-{ + return s1 == s2; + }-*/; + + public static native NodeList getElementsByClassName(String clazz, + Node ctx) /*-{ + return ctx.getElementsByClassName(clazz); + }-*/; + + public static native String or(String s1, String s2) /*-{ + return s1 || s2; + }-*/; + + public static native NodeList querySelectorAll(String selector) /*-{ + return $doc.querySelectorAll(selector); + }-*/; + + public static native NodeList querySelectorAll(String selector, + Node ctx) /*-{ + return ctx.querySelectorAll(selector); + }-*/; + + public NodeList select(String selector, Node ctx) { + return impl.select(selector, ctx); + } + public static boolean truth(String a) { + return GWT.isScript() ? truth0(a) : a != null && !"".equals(a); + } + + public static boolean truth(JavaScriptObject a) { + return GWT.isScript() ? truth0(a) : a != null; + } + + public static NodeList xpathEvaluate(String selector, Node ctx) { + return xpathEvaluate(selector, ctx, JSArray.create()); + } + + public static native NodeList xpathEvaluate(String selector, + Node ctx, JSArray r) /*-{ + var node; + var result = $doc.evaluate(selector, ctx, null, 0, null); + while ((node = result.iterateNext())) { + r.push(node); + } + return r; + }-*/; + + private static native boolean truth0(String a) /*-{ + return a; + }-*/; + + private static native boolean truth0(JavaScriptObject a) /*-{ + return a; + }-*/; + + protected JSArray veryQuickId(Node context, String id) { + JSArray r = JSArray.create(); + if (context.getNodeType() == Node.DOCUMENT_NODE) { + r.addNode(((Document) context).getElementById(id)); + return r; + } else { + r.addNode(context.getOwnerDocument().getElementById(id)); + return r; + } + } + + public static native Node getNextSibling(Node n) /*-{ + return n.nextSibling || null; + }-*/; + + public static native Node getPreviousSibling(Node n) /*-{ + return n.previousSibling || null; + }-*/; +} diff --git a/src/gquery/client/Selectors.java b/src/gquery/client/Selectors.java new file mode 100644 index 00000000..8a697a6c --- /dev/null +++ b/src/gquery/client/Selectors.java @@ -0,0 +1,7 @@ +package gquery.client; + +/** + */ +public interface Selectors { + DeferredGQuery[] getAllSelectors(); +} diff --git a/src/gquery/client/impl/SelectorEngineImpl.java b/src/gquery/client/impl/SelectorEngineImpl.java new file mode 100644 index 00000000..674072ef --- /dev/null +++ b/src/gquery/client/impl/SelectorEngineImpl.java @@ -0,0 +1,104 @@ +package gquery.client.impl; + +import gquery.client.Regexp; +import gquery.client.JSArray; +import gquery.client.SelectorEngine; +import com.google.gwt.dom.client.*; + +/** + * Copyright 2007 Timepedia.org + * 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. + * + * @author Ray Cromwell + */ +public abstract class SelectorEngineImpl { + + public abstract NodeList select(String selector, Node ctx); + + protected static Sequence getSequence(String expression) { + int start = 0, add = 2, max = -1, modVal = -1; + Regexp expressionRegExp = new Regexp( + "^((odd|even)|([1-9]\\d*)|((([1-9]\\d*)?)n((\\+|\\-)(\\d+))?)|(\\-(([1-9]\\d*)?)n\\+(\\d+)))$"); + JSArray pseudoValue = expressionRegExp.exec(expression); + if (!SelectorEngine.truth(pseudoValue)) { + return null; + } else { + if (SelectorEngine.truth(pseudoValue.getStr(2))) { // odd or even + start = (SelectorEngine.eq(pseudoValue.getStr(2), "odd")) ? 1 : 2; + modVal = (start == 1) ? 1 : 0; + } else if (SelectorEngine.truth(pseudoValue.getStr(3))) { // single digit + start = Integer.parseInt(pseudoValue.getStr(3), 10); + add = 0; + max = start; + } else if (SelectorEngine.truth(pseudoValue.getStr(4))) { // an+b + add = SelectorEngine.truth(pseudoValue.getStr(6)) ? Integer + .parseInt(pseudoValue.getStr(6), 10) : 1; + start = SelectorEngine.truth(pseudoValue.getStr(7)) ? Integer + .parseInt((pseudoValue.getStr(8).charAt(0) == '+' ? "" : pseudoValue.getStr(8)) + pseudoValue.getStr(9), 10) : 0; + while (start < 1) { + start += add; + } + modVal = (start > add) ? (start - add) % add + : ((start == add) ? 0 : start); + } else if (SelectorEngine.truth(pseudoValue.getStr(10))) { // -an+b + add = SelectorEngine.truth(pseudoValue.getStr(12)) ? Integer + .parseInt(pseudoValue.getStr(12), 10) : 1; + start = max = Integer.parseInt(pseudoValue.getStr(13), 10); + while (start > add) { + start -= add; + } + modVal = (max > add) ? (max - add) % add : ((max == add) ? 0 : max); + } + } + Sequence s = new Sequence(); + s.start = start; + s.add = add; + s.max = max; + s.modVal = modVal; + return s; + } + + public static class Sequence { + public int start; + public int max; + public int add; + public int modVal; + } + + public static class SplitRule { + + public String tag; + public String id; + public String allClasses; + public String allAttr; + public String allPseudos; + public String tagRelation; + + public SplitRule(String tag, String id, String allClasses, String allAttr, + String allPseudos) { + this.tag = tag; + this.id = id; + this.allClasses = allClasses; + this.allAttr = allAttr; + this.allPseudos = allPseudos; + } + + public SplitRule(String tag, String id, String allClasses, String allAttr, + String allPseudos, String tagRelation) { + this.tag = tag; + this.id = id; + this.allClasses = allClasses; + this.allAttr = allAttr; + this.allPseudos = allPseudos; + this.tagRelation = tagRelation; + } + } +} diff --git a/src/gquery/client/impl/SelectorEngineJS.java b/src/gquery/client/impl/SelectorEngineJS.java new file mode 100644 index 00000000..d854c4ac --- /dev/null +++ b/src/gquery/client/impl/SelectorEngineJS.java @@ -0,0 +1,698 @@ +package gquery.client.impl; + +import com.google.gwt.dom.client.Document; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.Node; +import com.google.gwt.dom.client.NodeList; + +import gquery.client.JSArray; +import gquery.client.Regexp; +import gquery.client.SelectorEngine; + +/** + * Copyright 2007 Timepedia.org 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. + * + * @author Ray Cromwell + */ +public class SelectorEngineJS extends SelectorEngineImpl { + private Regexp cssSelectorRegExp; + private Regexp selectorSplitRegExp; + private Regexp childOrSiblingRefRegExp; + + + public SelectorEngineJS() { + selectorSplitRegExp = new Regexp("[^\\s]+", "g"); + childOrSiblingRefRegExp = new Regexp("^(>|\\+|~)$"); + cssSelectorRegExp = new Regexp( + "^(\\w+)?(#[\\w\\u00C0-\\uFFFF\\-\\_]+|(\\*))?((\\.[\\w\\u00C0-\\uFFFF\\-_]+)*)?((\\[\\w+(\\^|\\$|\\*|\\||~)?(=[\\w\\u00C0-\\uFFFF\\s\\-\\_\\.]+)?\\]+)*)?(((:\\w+[\\w\\-]*)(\\((odd|even|\\-?\\d*n?((\\+|\\-)\\d+)?|[\\w\\u00C0-\\uFFFF\\-_]+|((\\w*\\.[\\w\\u00C0-\\uFFFF\\-_]+)*)?|(\\[#?\\w+(\\^|\\$|\\*|\\||~)?=?[\\w\\u00C0-\\uFFFF\\s\\-\\_\\.]+\\]+)|(:\\w+[\\w\\-]*))\\))?)*)?"); + } + + public static void clearAdded(JSArray a) { + for (int i = 0, len = a.size(); i < len; i++) { + clearAdded(a.getNode(i)); + } + } + + public static native void clearAdded(Node node) /*-{ + node.added = null; + }-*/; + + public static native NodeList getElementsByClassName(String clazz, + Node ctx) /*-{ + return ctx.getElementsByClassName(clazz); + }-*/; + + public static native boolean isAdded(Node prevRef) /*-{ + return prevRef.added || false; + }-*/; + + public static native void setAdded(Node prevRef, boolean added) /*-{ + prevRef.added = added; + }-*/; + + public static native void setSkipTag(JSArray prevElem, boolean skip) /*-{ + prevElem.skipTag = skip; + }-*/; + + private static String attrToRegExp(String attrVal, String op) { + if (SelectorEngine.eq("^", op)) { + return "^" + attrVal; + } + if (SelectorEngine.eq("$", op)) { + return attrVal + "$"; + } + if (SelectorEngine.eq("*", op)) { + return attrVal; + } + if (SelectorEngine.eq("|", op)) { + return "(^" + attrVal + "(\\-\\w+)*$)"; + } + if (SelectorEngine.eq("~", op)) { + return "\\b" + attrVal + "\\b"; + } + return SelectorEngine.truth(attrVal) ? "^" + attrVal + "$" : null; + } + + private static void clearChildElms(JSArray prevParents) { + for (int n = 0, nl = prevParents.size(); n < nl; n++) { + setHasChildElms(prevParents.getNode(n), false); + } + } + + protected String getAttr(Element current, String name) { + return current.getAttribute(name); + } + + private static void getDescendantNodes(JSArray matchingElms, + String nextTagStr, Node prevRef) { + NodeList children = getElementsByTagName(nextTagStr, prevRef); + for (int k = 0, klen = children.getLength(); k < klen; k++) { + Node child = children.getItem(k); + if (child.getParentNode() == prevRef) { + matchingElms.addNode(child); + } + } + } + + private JSArray getElementsByPseudo(JSArray previousMatch, String pseudoClass, + String pseudoValue) { + JSArray prevParents = JSArray.create(); + boolean previousDir = pseudoClass.startsWith("first") ? true : false; + JSArray matchingElms = JSArray.create(); + Node prev, next, previous; + if (SelectorEngine.eq("first-child", pseudoClass) || SelectorEngine + .eq("last-child", pseudoClass)) { + getFirstChildPseudo(previousMatch, previousDir, matchingElms); + } else if (SelectorEngine.eq("only-child", pseudoClass)) { + getOnlyChildPseudo(previousMatch, matchingElms); + } else if (SelectorEngine.eq("nth-child", pseudoClass)) { + matchingElms = getNthChildPseudo(previousMatch, pseudoValue, prevParents, + matchingElms); + } else if (SelectorEngine.eq("first-of-type", pseudoClass) || SelectorEngine + .eq("last-of-type", pseudoClass)) { + getFirstOfTypePseudo(previousMatch, previousDir, matchingElms); + } else if (SelectorEngine.eq("only-of-type", pseudoClass)) { + getOnlyOfTypePseudo(previousMatch, matchingElms); + } else if (SelectorEngine.eq("nth-of-type", pseudoClass)) { + matchingElms = getNthOfTypePseudo(previousMatch, pseudoValue, prevParents, + matchingElms); + } else if (SelectorEngine.eq("empty", pseudoClass)) { + getEmptyPseudo(previousMatch, matchingElms); + } else if (SelectorEngine.eq("enabled", pseudoClass)) { + getEnabledPseudo(previousMatch, matchingElms); + } else if (SelectorEngine.eq("disabled", pseudoClass)) { + getDisabledPseudo(previousMatch, matchingElms); + } else if (SelectorEngine.eq("checked", pseudoClass)) { + getCheckedPseudo(previousMatch, matchingElms); + } else if (SelectorEngine.eq("contains", pseudoClass)) { + getContainsPseudo(previousMatch, pseudoValue, matchingElms); + } else if (SelectorEngine.eq("not", pseudoClass)) { + matchingElms = getNotPseudo(previousMatch, pseudoValue, matchingElms); + } else { + getDefaultPseudo(previousMatch, pseudoClass, pseudoValue, matchingElms); + } + return matchingElms; + } + + private void getDefaultPseudo(JSArray previousMatch, String pseudoClass, + String pseudoValue, JSArray matchingElms) { + Node previous; + for (int w = 0, wlen = previousMatch.size(); w < wlen; w++) { + previous = previousMatch.getElement(w); + if (SelectorEngine + .eq(((Element) previous).getAttribute(pseudoClass), pseudoValue)) { + matchingElms.addNode(previous); + } + } + } + + private JSArray getNotPseudo(JSArray previousMatch, String pseudoValue, + JSArray matchingElms) { + if (new Regexp("(:\\w+[\\w\\-]*)$").test(pseudoValue)) { + matchingElms = subtractArray(previousMatch, + getElementsByPseudo(previousMatch, pseudoValue.substring(1), "")); + } else { + pseudoValue = pseudoValue + .replace("^\\[#([\\w\\u00C0-\\uFFFF\\-\\_]+)\\]$", "[id=$1]"); + JSArray notTag = new Regexp("^(\\w+)").exec(pseudoValue); + JSArray notClass = new Regexp("^\\.([\\w\u00C0-\uFFFF\\-_]+)") + .exec(pseudoValue); + JSArray notAttr = new Regexp( + "\\[(\\w+)(\\^|\\$|\\*|\\||~)?=?([\\w\\u00C0-\\uFFFF\\s\\-_\\.]+)?\\]") + .exec(pseudoValue); + Regexp notRegExp = new Regexp( + "(^|\\s)" + (SelectorEngine.truth(notTag) ? notTag + .getStr(1) + : SelectorEngine.truth(notClass) ? notClass.getStr(1) : "") + + "(\\s|$)", "i"); + if (SelectorEngine.truth(notAttr)) { + String notAttribute = SelectorEngine.truth(notAttr.getStr(3)) ? notAttr + .getStr(3) + .replace("\\.", "\\.") : null; + String notMatchingAttrVal = attrToRegExp(notAttribute, + notAttr.getStr(2)); + notRegExp = new Regexp(notMatchingAttrVal, "i"); + } + for (int v = 0, vlen = previousMatch.size(); v < vlen; v++) { + Element notElm = previousMatch.getElement(v); + Element addElm = null; + if (SelectorEngine.truth(notTag) && !notRegExp + .test(notElm.getNodeName())) { + addElm = notElm; + } else if (SelectorEngine.truth(notClass) && !notRegExp + .test(notElm.getClassName())) { + addElm = notElm; + } else if (SelectorEngine.truth(notAttr)) { + String att = getAttr(notElm, notAttr.getStr(1)); + if (!SelectorEngine.truth(att) || !notRegExp.test(att)) { + addElm = notElm; + } + } + if (SelectorEngine.truth(addElm) && !isAdded(addElm)) { + setAdded(addElm, true); + matchingElms.addNode(addElm); + } + } + } + return matchingElms; + } + + private void getContainsPseudo(JSArray previousMatch, String pseudoValue, + JSArray matchingElms) { + Node previous; + for (int q = 0, qlen = previousMatch.size(); q < qlen; q++) { + previous = previousMatch.getNode(q); + if (!isAdded(previous)) { + if (((Element) previous).getInnerText().indexOf(pseudoValue) != -1) { + setAdded(previous, true); + matchingElms.addNode(previous); + } + } + } + } + + private void getCheckedPseudo(JSArray previousMatch, JSArray matchingElms) { + Node previous; + for (int q = 0, qlen = previousMatch.size(); q < qlen; q++) { + previous = previousMatch.getNode(q); + if (checked(previous)) { + matchingElms.addNode(previous); + } + } + } + + private void getDisabledPseudo(JSArray previousMatch, JSArray matchingElms) { + Node previous; + for (int q = 0, qlen = previousMatch.size(); q < qlen; q++) { + previous = previousMatch.getNode(q); + if (!enabled(previous)) { + matchingElms.addNode(previous); + } + } + } + + private void getEnabledPseudo(JSArray previousMatch, JSArray matchingElms) { + Node previous; + for (int q = 0, qlen = previousMatch.size(); q < qlen; q++) { + previous = previousMatch.getNode(q); + if (enabled(previous)) { + matchingElms.addNode(previous); + } + } + } + + private void getEmptyPseudo(JSArray previousMatch, JSArray matchingElms) { + Node previous; + for (int q = 0, qlen = previousMatch.size(); q < qlen; q++) { + previous = previousMatch.getNode(q); + if (!previous.hasChildNodes()) { + matchingElms.addNode(previous); + } + } + } + + private JSArray getNthOfTypePseudo(JSArray previousMatch, String pseudoValue, + JSArray prevParents, JSArray matchingElms) { + Node previous; + if (pseudoValue.startsWith("n")) { + matchingElms = previousMatch; + } else { + Sequence sequence = getSequence(pseudoValue); + if (sequence != null) { + for (int p = 0, plen = previousMatch.size(); p < plen; p++) { + previous = previousMatch.getNode(p); + Node prevParent = previous.getParentNode(); + if (!hasChildElms(prevParent)) { + int iteratorNext = sequence.start; + int childCount = 0; + Node childElm = prevParent.getFirstChild(); + while (SelectorEngine.truth(childElm) && (sequence.max < 0 + || iteratorNext <= sequence.max)) { + if (SelectorEngine + .eq(childElm.getNodeName(), previous.getNodeName())) { + if (++childCount == iteratorNext) { + matchingElms.addNode(childElm); + iteratorNext += sequence.add; + } + } + childElm = SelectorEngine.getNextSibling(childElm); + } + setHasChildElms(prevParent, true); + prevParents.addNode(prevParent); + } + } + clearChildElms(prevParents); + } + } + return matchingElms; + } + + private void getOnlyOfTypePseudo(JSArray previousMatch, + JSArray matchingElms) { + Node previous; + Node next; + Node prev; + Node oParent = null; + for (int o = 0, olen = previousMatch.size(); o < olen; o++) { + prev = next = previous = previousMatch.getNode(o); + Node prevParent = previous.getParentNode(); + if (prevParent != oParent) { + while ( + SelectorEngine.truth(prev = SelectorEngine.getPreviousSibling(prev)) + && !SelectorEngine + .eq(prev.getNodeName(), previous.getNodeName())) { + } + while (SelectorEngine.truth(next = SelectorEngine.getNextSibling(next)) + && !SelectorEngine.eq(next.getNodeName(), previous.getNodeName())) { + } + if (!SelectorEngine.truth(prev) && !SelectorEngine.truth(next)) { + matchingElms.addNode(previous); + } + oParent = prevParent; + } + } + } + + private void getFirstOfTypePseudo(JSArray previousMatch, boolean previousDir, + JSArray matchingElms) { + Node previous; + Node next; + for (int n = 0, nlen = previousMatch.size(); n < nlen; n++) { + next = previous = previousMatch.getNode(n); + + if (previousDir) { + while ( + SelectorEngine.truth(next = SelectorEngine.getPreviousSibling(next)) + && !SelectorEngine + .eq(next.getNodeName(), previous.getNodeName())) { + } + } else { + while (SelectorEngine.truth(next = SelectorEngine.getNextSibling(next)) + && !SelectorEngine.eq(next.getNodeName(), previous.getNodeName())) { + } + } + + if (!SelectorEngine.truth(next)) { + matchingElms.addNode(previous); + } + } + } + + private JSArray getNthChildPseudo(JSArray previousMatch, String pseudoValue, + JSArray prevParents, JSArray matchingElms) { + Node previous; + if (SelectorEngine.eq(pseudoValue, "n")) { + matchingElms = previousMatch; + } else { + Sequence sequence = getSequence(pseudoValue); + if (sequence != null) { + for (int l = 0, llen = previousMatch.size(); l < llen; l++) { + previous = previousMatch.getNode(l); + Node prevParent = previous.getParentNode(); + if (!hasChildElms(prevParent)) { + int iteratorNext = sequence.start; + int childCount = 0; + Node childElm = prevParent.getFirstChild(); + while (childElm != null && (sequence.max < 0 + || iteratorNext <= sequence.max)) { + if (childElm.getNodeType() == Node.ELEMENT_NODE) { + if (++childCount == iteratorNext) { + if (SelectorEngine + .eq(childElm.getNodeName(), previous.getNodeName())) { + matchingElms.addNode(childElm); + } + iteratorNext += sequence.add; + } + } + childElm = SelectorEngine.getNextSibling(childElm); + } + setHasChildElms(prevParent, true); + prevParents.addNode(prevParent); + } + } + clearChildElms(prevParents); + } + } + return matchingElms; + } + + private void getOnlyChildPseudo(JSArray previousMatch, JSArray matchingElms) { + Node previous; + Node next; + Node prev; + Node kParent = null; + for (int k = 0, klen = previousMatch.size(); k < klen; k++) { + prev = next = previous = previousMatch.getNode(k); + Node prevParent = previous.getParentNode(); + if (prevParent != kParent) { + while ( + SelectorEngine.truth(prev = SelectorEngine.getPreviousSibling(prev)) + && prev.getNodeType() != Node.ELEMENT_NODE) { + } + while (SelectorEngine.truth(next = SelectorEngine.getNextSibling(next)) + && next.getNodeType() != Node.ELEMENT_NODE) { + } + if (!SelectorEngine.truth(prev) && !SelectorEngine.truth(next)) { + matchingElms.addNode(previous); + } + kParent = prevParent; + } + } + } + + private void getFirstChildPseudo(JSArray previousMatch, boolean previousDir, + JSArray matchingElms) { + Node next; + Node previous; + for (int j = 0, jlen = previousMatch.size(); j < jlen; j++) { + previous = next = previousMatch.getElement(j); + if (previousDir) { + while (SelectorEngine + .truth((next = SelectorEngine.getPreviousSibling(next))) + && next.getNodeType() != Node.ELEMENT_NODE) { + } + } else { + while ( + SelectorEngine.truth((next = SelectorEngine.getNextSibling(next))) + && next.getNodeType() != Node.ELEMENT_NODE) { + } + } + if (!SelectorEngine.truth(next)) { + matchingElms.addNode(previous); + } + } + } + + private static native boolean checked(Node previous) /*-{ + return previous.checked || false; + }-*/; + + private static native boolean enabled(Node node) /*-{ + return !node.disabled; + }-*/; + + private static NodeList getElementsByTagName(String tag, Node ctx) { + return ((Element) ctx).getElementsByTagName(tag); + } + + private static void getGeneralSiblingNodes(JSArray matchingElms, + JSArray nextTag, Regexp nextRegExp, Node prevRef) { + while ( + SelectorEngine.truth((prevRef = SelectorEngine.getNextSibling(prevRef))) + && !isAdded(prevRef)) { + if (!SelectorEngine.truth(nextTag) || nextRegExp + .test(prevRef.getNodeName())) { + setAdded(prevRef, true); + matchingElms.addNode(prevRef); + } + } + } + + private static void getSiblingNodes(JSArray matchingElms, JSArray nextTag, + Regexp nextRegExp, Node prevRef) { + while ( + SelectorEngine.truth(prevRef = SelectorEngine.getNextSibling(prevRef)) + && prevRef.getNodeType() != Node.ELEMENT_NODE) { + } + if (SelectorEngine.truth(prevRef)) { + if (!SelectorEngine.truth(nextTag) || nextRegExp + .test(prevRef.getNodeName())) { + matchingElms.addNode(prevRef); + } + } + } + + private static native boolean hasChildElms(Node prevParent) /*-{ + return prevParent.childElms || false; + }-*/; + + private static native boolean isSkipped(JSArray prevElem) /*-{ + return prevElem.skipTag || false; + }-*/; + + private static native void setHasChildElms(Node prevParent, boolean bool) /*-{ + prevParent.childElms = bool ? bool : null; + }-*/; + + private static native JSArray subtractArray(JSArray previousMatch, + JSArray elementsByPseudo) /*-{ + for (var i=0, src1; (src1=arr1[i]); i++) { + var found = false; + for (var j=0, src2; (src2=arr2[j]); j++) { + if (src2 === src1) { + found = true; + break; + } + } + if (found) { + arr1.splice(i--, 1); + } + } + return arr; + }-*/; + + public NodeList select(String sel, Node ctx) { + String selectors[] = sel.replace("\\s*(,)\\s*", "$1").split(","); + boolean identical = false; + JSArray elm = JSArray.create(); + for (int a = 0, len = selectors.length; a < len; a++) { + if (a > 0) { + identical = false; + for (int b = 0, bl = a; b < bl; b++) { + if (SelectorEngine.eq(selectors[a], selectors[b])) { + identical = true; + break; + } + } + if (identical) { + continue; + } + } + String currentRule = selectors[a]; + JSArray cssSelectors = selectorSplitRegExp.match(currentRule); + JSArray prevElem = JSArray.create(ctx); + for (int i = 0, slen = cssSelectors.size(); i < slen; i++) { + JSArray matchingElms = JSArray.create(); + String rule = cssSelectors.getStr(i); + if (i > 0 && childOrSiblingRefRegExp.test(rule)) { + JSArray childOrSiblingRef = childOrSiblingRefRegExp.exec(rule); + if (SelectorEngine.truth(childOrSiblingRef)) { + JSArray nextTag = new Regexp("^\\w+") + .exec(cssSelectors.getStr(i + 1)); + Regexp nextRegExp = null; + String nextTagStr = null; + if (SelectorEngine.truth(nextTag)) { + nextTagStr = nextTag.getStr(0); + nextRegExp = new Regexp("(^|\\s)" + nextTagStr + "(\\s|$)", "i"); + } + for (int j = 0, jlen = prevElem.size(); j < jlen; j++) { + Node prevRef = prevElem.getNode(j); + String ref = childOrSiblingRef.getStr(0); + if (SelectorEngine.eq(">", ref)) { + getDescendantNodes(matchingElms, nextTagStr, prevRef); + } else if (SelectorEngine.eq("+", ref)) { + getSiblingNodes(matchingElms, nextTag, nextRegExp, prevRef); + } else if (SelectorEngine.eq("~", ref)) { + getGeneralSiblingNodes(matchingElms, nextTag, nextRegExp, + prevRef); + } + } + prevElem = matchingElms; + clearAdded(prevElem); + rule = cssSelectors.getStr(++i); + if (new Regexp("^\\w+$").test(rule)) { + continue; + } + setSkipTag(prevElem, true); + } + } + JSArray cssSelector = cssSelectorRegExp.exec(rule); + SplitRule splitRule = new SplitRule( + !SelectorEngine.truth(cssSelector.getStr(1)) || SelectorEngine + .eq(cssSelector.getStr(3), "*") ? "*" : cssSelector.getStr(1), + !SelectorEngine.eq(cssSelector.getStr(3), "*") ? cssSelector + .getStr(2) : null, cssSelector.getStr(4), cssSelector.getStr(6), + cssSelector.getStr(10)); + if (SelectorEngine.truth(splitRule.id)) { + Element domelem = Document.get() + .getElementById(splitRule.id.substring(1)); + if (SelectorEngine.truth(domelem)) { + matchingElms = JSArray.create(domelem); + } + prevElem = matchingElms; + } else if (SelectorEngine.truth(splitRule.tag) && !isSkipped(prevElem)) { + if (i == 0 && matchingElms.size() == 0 && prevElem.size() == 1) { + prevElem = matchingElms = JSArray.create( + getElementsByTagName(splitRule.tag, prevElem.getNode(0))); + } else { + NodeList tagCollectionMatches; + for (int l = 0, ll = prevElem.size(); l < ll; l++) { + tagCollectionMatches = getElementsByTagName(splitRule.tag, + prevElem.getNode(l)); + for (int m = 0, mlen = tagCollectionMatches.getLength(); m < mlen; + m++) { + Node tagMatch = tagCollectionMatches.getItem(m); + + if (!isAdded(tagMatch)) { + setAdded(tagMatch, true); + matchingElms.addNode(tagMatch); + } + } + } + prevElem = matchingElms; + clearAdded(prevElem); + } + if (matchingElms.size() == 0) { + break; + } + setSkipTag(prevElem, false); + if (SelectorEngine.truth(splitRule.allClasses)) { + String[] allClasses = splitRule.allClasses.replaceFirst("^\\.", "") + .split("\\."); + Regexp[] regExpClassNames = new Regexp[allClasses.length]; + for (int n = 0, nl = allClasses.length; n < nl; n++) { + regExpClassNames[n] = new Regexp( + "(^|\\s)" + allClasses[n] + "(\\s|$)"); + } + JSArray matchingClassElms = JSArray.create(); + for (int o = 0, olen = prevElem.size(); o < olen; o++) { + Element current = prevElem.getElement(o); + String elmClass = current.getClassName(); + boolean addElm = false; + if (SelectorEngine.truth(elmClass) && !isAdded(current)) { + for (int p = 0, pl = regExpClassNames.length; p < pl; p++) { + addElm = regExpClassNames[p].test(elmClass); + if (!addElm) { + break; + } + } + if (addElm) { + setAdded(current, true); + matchingClassElms.addNode(current); + } + } + } + clearAdded(prevElem); + prevElem = matchingElms = matchingClassElms; + } + if (SelectorEngine.truth(splitRule.allAttr)) { + JSArray allAttr = Regexp + .match("\\[[^\\]]+\\]", "g", splitRule.allAttr); + Regexp[] regExpAttributes = new Regexp[allAttr.size()]; + String[] regExpAttributesStr = new String[allAttr.size()]; + Regexp attributeMatchRegExp = new Regexp( + "(\\w+)(\\^|\\$|\\*|\\||~)?=?([\\w\u00C0-\uFFFF\\s\\-_\\.]+)?"); + for (int q = 0, ql = allAttr.size(); q < ql; q++) { + JSArray attributeMatch = attributeMatchRegExp + .exec(allAttr.getStr(q)); + String attributeValue = + SelectorEngine.truth(attributeMatch.getStr(3)) + ? attributeMatch.getStr(3).replaceAll("\\.", "\\.") + : null; + String attrVal = attrToRegExp(attributeValue, + (SelectorEngine.or(attributeMatch.getStr(2), null))); + regExpAttributes[q] = (SelectorEngine.truth(attrVal) ? new Regexp( + attrVal) : null); + regExpAttributesStr[q] = attributeMatch.getStr(1); + } + JSArray matchingAttributeElms = JSArray.create(); + + for (int r = 0, rlen = matchingElms.size(); r < rlen; r++) { + Element current = matchingElms.getElement(r); + boolean addElm = false; + for (int s = 0, sl = regExpAttributes.length, attributeRegExp; + s < sl; s++) { + addElm = false; + Regexp attributeRegExp2 = regExpAttributes[s]; + String currentAttr = getAttr(current, regExpAttributesStr[s]); + if (SelectorEngine.truth(currentAttr) + && currentAttr.length() != 0) { + if (attributeRegExp2 == null || attributeRegExp2 + .test(currentAttr)) { + addElm = true; + } + } + if (!addElm) { + break; + } + } + if (addElm) { + matchingAttributeElms.addNode(current); + } + } + prevElem = matchingElms = matchingAttributeElms; + } + if (SelectorEngine.truth(splitRule.allPseudos)) { + Regexp pseudoSplitRegExp = new Regexp( + ":(\\w[\\w\\-]*)(\\(([^\\)]+)\\))?"); + + JSArray allPseudos = Regexp.match( + "(:\\w+[\\w\\-]*)(\\([^\\)]+\\))?", "g", splitRule.allPseudos); + for (int t = 0, tl = allPseudos.size(); t < tl; t++) { + JSArray pseudo = pseudoSplitRegExp.match(allPseudos.getStr(t)); + String pseudoClass = SelectorEngine.truth(pseudo.getStr(1)) + ? pseudo.getStr(1) + .toLowerCase() : null; + String pseudoValue = SelectorEngine.truth(pseudo.getStr(3)) + ? pseudo.getStr(3) : null; + matchingElms = getElementsByPseudo(matchingElms, pseudoClass, + pseudoValue); + clearAdded(matchingElms); + } + prevElem = matchingElms; + } + } + } + elm.pushAll(prevElem); + } + + return elm; + } +} diff --git a/src/gquery/client/impl/SelectorEngineJSIE.java b/src/gquery/client/impl/SelectorEngineJSIE.java new file mode 100644 index 00000000..f680c7f9 --- /dev/null +++ b/src/gquery/client/impl/SelectorEngineJSIE.java @@ -0,0 +1,20 @@ +package gquery.client.impl; + +import com.google.gwt.dom.client.Element; + +/** + * Fix some DOM ops for IE + */ +public class SelectorEngineJSIE extends SelectorEngineJS { + public native String getAttr(Element elm, String attr) /*-{ + switch (attr) { + case "id": + return elm.id; + case "for": + return elm.htmlFor; + case "class": + return elm.className; + } + return elm.getAttribute(attr, 2); + }-*/; +} diff --git a/src/gquery/client/impl/SelectorEngineNative.java b/src/gquery/client/impl/SelectorEngineNative.java new file mode 100644 index 00000000..aaa7635c --- /dev/null +++ b/src/gquery/client/impl/SelectorEngineNative.java @@ -0,0 +1,16 @@ +package gquery.client.impl; + +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.NodeList; +import com.google.gwt.dom.client.Node; + +import gquery.client.SelectorEngine; + +/** + * + */ +public class SelectorEngineNative extends SelectorEngineImpl { + public NodeList select(String selector, Node ctx) { + return SelectorEngine.querySelectorAll(selector, ctx); + } +} diff --git a/src/gquery/client/impl/SelectorEngineXPath.java b/src/gquery/client/impl/SelectorEngineXPath.java new file mode 100644 index 00000000..1eed30ee --- /dev/null +++ b/src/gquery/client/impl/SelectorEngineXPath.java @@ -0,0 +1,237 @@ +package gquery.client.impl; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.dom.client.Element; +import com.google.gwt.dom.client.Node; +import com.google.gwt.dom.client.NodeList; + +import gquery.client.JSArray; +import gquery.client.Regexp; +import gquery.client.SelectorEngine; +import static gquery.client.SelectorEngine.eq; +import static gquery.client.SelectorEngine.truth; + +/** + * Copyright 2007 Timepedia.org 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. + * + * @author Ray Cromwell + */ +public class SelectorEngineXPath extends SelectorEngineImpl { + private Regexp cssSelectorRegExp; + private Regexp selectorSplitRegExp; + private Regexp COMBINATOR; + + public SelectorEngineXPath() { + } + + private void init() { + if (cssSelectorRegExp == null) { + cssSelectorRegExp = new Regexp( + "^(\\w+)?(#[\\w\\u00C0-\\uFFFF\\-\\_]+|(\\*))?((\\.[\\w\\u00C0-\\uFFFF\\-_]+)*)?((\\[\\w+(\\^|\\$|\\*|\\||~)?(=[\\w\\u00C0-\\uFFFF\\s\\-\\_\\.]+)?\\]+)*)?(((:\\w+[\\w\\-]*)(\\((odd|even|\\-?\\d*n?((\\+|\\-)\\d+)?|[\\w\\u00C0-\\uFFFF\\-_]+|((\\w*\\.[\\w\\u00C0-\\uFFFF\\-_]+)*)?|(\\[#?\\w+(\\^|\\$|\\*|\\||~)?=?[\\w\\u00C0-\\uFFFF\\s\\-\\_\\.]+\\]+)|(:\\w+[\\w\\-]*))\\))?)*)?(>|\\+|~)?"); + selectorSplitRegExp = new Regexp("[^\\s]+", "g"); + COMBINATOR = new Regexp("(>|\\+|~)"); + } + } + + + public NodeList select(String sel, Node ctx) { + init(); + String selectors[] = sel.replaceAll("\\s*(,)\\s*", "$1").split(","); + boolean identical = false; + JSArray elm = JSArray.create(); + for (int a = 0, len = selectors.length; a < len; a++) { + if (a > 0) { + identical = false; + for (int b = 0, bl = a; b < bl; b++) { + if (eq(selectors[a], selectors[b])) { + identical = true; + break; + } + } + if (identical) { + continue; + } + } + String currentRule = selectors[a]; + JSArray cssSelectors = selectorSplitRegExp.match(currentRule); + String xPathExpression = "."; + for (int i = 0, slen = cssSelectors.size(); i < slen; i++) { + String rule = cssSelectors.getStr(i); + JSArray cssSelector = cssSelectorRegExp.exec(rule); + SplitRule splitRule = new SplitRule(!truth(cssSelector.getStr(1)) || eq( + cssSelector.getStr(3), "*") ? "*" : cssSelector.getStr(1), + !eq(cssSelector.getStr(3), "*") ? cssSelector.getStr(2) : null, + cssSelector.getStr(4), cssSelector.getStr(6), + cssSelector.getStr(10), cssSelector.getStr(22)); + if (truth(splitRule.tagRelation)) { + if (eq(">", splitRule.tagRelation)) { + xPathExpression += "/child::"; + } else if (eq("+", splitRule.tagRelation)) { + xPathExpression += "/following-sibling::*[1]/self::"; + } else if (eq("~", splitRule.tagRelation)) { + xPathExpression += "/following-sibling::"; + } + } else { + xPathExpression += + (i > 0 && COMBINATOR.test(cssSelectors.getStr(i - 1))) + ? splitRule.tag : ("/descendant::" + splitRule.tag); + } + if (truth(splitRule.id)) { + xPathExpression += "[@id = '" + splitRule.id.replaceAll("^#", "") + + "']"; + } + if (truth(splitRule.allClasses)) { + xPathExpression += splitRule.allClasses.replaceAll( + "\\.([\\w\\u00C0-\\uFFFF\\-_]+)", + "[contains(concat(' ', @class, ' '), ' $1 ')]"); + } + if (truth(splitRule.allAttr)) { + GWT.log("AllAttr is " + splitRule.allAttr, null); + xPathExpression += replaceAttr( + SelectorEngine.or(splitRule.allAttr, "")); + } + if (truth(splitRule.allPseudos)) { + Regexp pseudoSplitRegExp = new Regexp( + ":(\\w[\\w\\-]*)(\\(([^\\)]+)\\))?"); + Regexp pseudoMatchRegExp = new Regexp( + "(:\\w+[\\w\\-]*)(\\([^\\)]+\\))?", "g"); + JSArray allPseudos = pseudoMatchRegExp.match(splitRule.allPseudos); + for (int k = 0, kl = allPseudos.size(); k < kl; k++) { + JSArray pseudo = pseudoSplitRegExp.match(allPseudos.getStr(k)); + String pseudoClass = truth(pseudo.getStr(1)) ? pseudo.getStr(1) + .toLowerCase() : null; + String pseudoValue = truth(pseudo.getStr(3)) ? pseudo.getStr(3) + : null; + String xpath = pseudoToXPath(splitRule.tag, pseudoClass, + pseudoValue); + if (xpath.length() > 0) { + xPathExpression += "[" + xpath + "]"; + } + } + } + } + SelectorEngine.xpathEvaluate(xPathExpression, ctx, elm); + } + return elm; + } + + private String pseudoToXPath(String tag, String pseudoClass, + String pseudoValue) { + String xpath = ""; + if (eq("first-child", pseudoClass)) { + xpath = "not(preceding-sibling::*)"; + } else if (eq("first-of-type", pseudoClass)) { + xpath = "not(preceding-sibling::" + tag + ")"; + } else if (eq("last-child", pseudoClass)) { + xpath = "not(following-sibling::*)"; + } else if (eq("last-of-type", pseudoClass)) { + xpath = "not(following-sibling::" + tag + ")"; + } else if (eq("only-child", pseudoClass)) { + xpath = "not(preceding-sibling::* or following-sibling::*)"; + } else if (eq("only-of-type", pseudoClass)) { + xpath = "not(preceding-sibling::" + tag + " or following-sibling::" + tag + + ")"; + } else if (eq("nth-child", pseudoClass)) { + if (!eq("n", pseudoClass)) { + Sequence sequence = getSequence(pseudoValue); + if (sequence != null) { + if (sequence.start == sequence.max) { + xpath = "count(preceding-sibling::*) = " + (sequence.start - 1); + } else { + xpath = "(count(preceding-sibling::*) + 1) mod " + sequence.add + + " = " + sequence.modVal + ((sequence.start > 1) ? + " and count(preceding-sibling::*) >= " + (sequence.start - 1) + : "") + ((sequence.max > 0) ? + " and count(preceding-sibling::*) <= " + (sequence.max - 1) + : ""); + } + } + } + } else if (eq("nth-of-type", pseudoClass)) { + if (!pseudoValue.startsWith("n")) { + Sequence sequence = getSequence(pseudoValue); + if (sequence != null) { + if (sequence.start == sequence.max) { + xpath = pseudoValue; + } else { + xpath = "position() mod " + sequence.add + " = " + sequence.modVal + + ((sequence.start > 1) ? " and position() >= " + sequence + .start : "") + ((sequence.max > 0) ? " and position() <= " + + sequence.max : ""); + } + } + } + } else if (eq("empty", pseudoClass)) { + xpath = "count(child::*) = 0 and string-length(text()) = 0"; + } else if (eq("contains", pseudoClass)) { + xpath = "contains(., '" + pseudoValue + "')"; + } else if (eq("enabled", pseudoClass)) { + xpath = "not(@disabled)"; + } else if (eq("disabled", pseudoClass)) { + xpath = "@disabled"; + } else if (eq("checked", pseudoClass)) { + xpath = "@checked='checked'"; // Doesn't work in Opera 9.24 + } else if (eq("not", pseudoClass)) { + if (new Regexp("^(:\\w+[\\w\\-]*)$").test(pseudoValue)) { + xpath = "not(" + pseudoToXPath(tag, pseudoValue.substring(1), "") + ")"; + } else { + + pseudoValue = pseudoValue + .replaceFirst("^\\[#([\\w\\u00C0-\\uFFFF\\-\\_]+)\\]$", "[id=$1]"); + String notSelector = pseudoValue + .replaceFirst("^(\\w+)", "self::$1"); + notSelector = notSelector.replaceAll("^\\.([\\w\\u00C0-\\uFFFF\\-_]+)", + "contains(concat(' ', @class, ' '), ' $1 ')"); + notSelector = replaceAttr2(notSelector); + xpath = "not(" + notSelector + ")"; + } + } else { + xpath = "@" + pseudoClass + "='" + pseudoValue + "'"; + } + + return xpath; + } + + private static String attrToXPath(String match, String p1, String p2, + String p3) { + if (eq("^", p2)) { + return "starts-with(@" + p1 + ", '" + p3 + "')"; + } + if (eq("$", p2)) { + return "substring(@" + p1 + ", (string-length(@" + p1 + ") - " + + (p3.length() - 1) + "), " + p3.length() + ") = '" + p3 + "'"; + } + if (eq("*", p2)) { + return "contains(concat(' ', @" + p1 + ", ' '), '" + p3 + "')"; + } + if (eq("|", p2)) { + return "(@" + p1 + "='" + p3 + "' or starts-with(@" + p1 + ", '" + p3 + + "-'))"; + } + if (eq("~", p2)) { + return "contains(concat(' ', @" + p1 + ", ' '), ' " + p3 + " ')"; + } + return "@" + p1 + (truth(p3) ? "='" + p3 + "'" : ""); + } + + private native String replaceAttr(String allAttr) /*-{ + if(!allAttr) return ""; + return allAttr.replace(/(\w+)(\^|\$|\*|\||~)?=?([\w\u00C0-\uFFFF\s\-_\.]+)?/g, + function(a,b,c,d) { + return @gquery.client.impl.SelectorEngineXPath::attrToXPath(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)(a,b || "",c || "",d || ""); + }); + + }-*/; + + private native String replaceAttr2(String allAttr) /*-{ + if(!allAttr) return ""; + return allAttr.replace(/\[(\w+)(\^|\$|\*|\||~)?=?([\w\u00C0-\uFFFF\s\-_\.]+)?\]/g, @gquery.client.impl.SelectorEngineXPath::attrToXPath(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)); + }-*/; +} \ No newline at end of file diff --git a/src/gquery/public/DOMAssistantComplete-2.7.js b/src/gquery/public/DOMAssistantComplete-2.7.js new file mode 100644 index 00000000..4f3683a7 --- /dev/null +++ b/src/gquery/public/DOMAssistantComplete-2.7.js @@ -0,0 +1,1347 @@ +// Developed by Robert Nyman/DOMAssistant team, code/licensing: http://code.google.com/p/domassistant/, documentation: http://www.domassistant.com/documentation, version 2.7 +var DOMAssistant = function () { + var HTMLArray = function () { + // Constructor + }; + var isIE = /*@cc_on!@*/false; + var cachedElms = []; + var pushAll = function (set1, set2) { + for (var j=0, jL=set2.length; j add)? (start - add) % add : ((start === add)? 0 : start); + } + else if (pseudoValue[10]) { // -an+b + add = pseudoValue[12]? parseInt(pseudoValue[12], 10) : 1; + start = max = parseInt(pseudoValue[13], 10); + while (start > add) { + start -= add; + } + modVal = (max > add)? (max - add) % add : ((max === add)? 0 : max); + } + } + return { start: start, add: add, max: max, modVal: modVal }; + }, + + $ : function () { + var elm = new HTMLArray(); + if (document.getElementById) { + var arg = arguments[0]; + if (typeof arg === "string") { + arg = arg.replace(/^[^#]*(#)/, "$1"); + if (/^#[\w\u00C0-\uFFFF\-\_]+$/.test(arg)) { + var idMatch = DOMAssistant.$$(arg.substr(1), false); + if (idMatch) { + elm.push(idMatch); + } + } + else { + elm = DOMAssistant.cssSelection.call(document, arg); + } + } + else if (typeof arg === "object") { + elm = (arguments.length === 1)? DOMAssistant.$$(arg) : pushAll(elm, arguments); + } + } + return elm; + }, + + $$ : function (id, addMethods) { + var elm = (typeof id === "object")? id : document.getElementById(id); + var applyMethods = addMethods || true; + if (typeof id === "string" && elm && elm.id !== id) { + elm = null; + for (var i=0, item; (item=document.all[i]); i++) { + if (item.id === id) { + elm = item; + break; + } + } + } + if (elm && applyMethods) { + DOMAssistant.addMethodsToElm(elm); + } + return elm; + }, + + cssSelection : function (cssRule) { + if (document.evaluate) { + DOMAssistant.cssSelection = function (cssRule) { + var cssRules = cssRule.replace(/\s*(,)\s*/g, "$1").split(","); + var elm = new HTMLArray(); + var currentRule, identical, cssSelectors, xPathExpression, cssSelector, splitRule, sequence; + var cssSelectorRegExp = /^(\w+)?(#[\w\u00C0-\uFFFF\-\_]+|(\*))?((\.[\w\u00C0-\uFFFF\-_]+)*)?((\[\w+(\^|\$|\*|\||~)?(=[\w\u00C0-\uFFFF\s\-\_\.]+)?\]+)*)?(((:\w+[\w\-]*)(\((odd|even|\-?\d*n?((\+|\-)\d+)?|[\w\u00C0-\uFFFF\-_]+|((\w*\.[\w\u00C0-\uFFFF\-_]+)*)?|(\[#?\w+(\^|\$|\*|\||~)?=?[\w\u00C0-\uFFFF\s\-\_\.]+\]+)|(:\w+[\w\-]*))\))?)*)?(>|\+|~)?/; + var selectorSplitRegExp = new RegExp("(?:\\[[^\\[]*\\]|\\(.*\\)|[^\\s\\+>~\\[\\(])+|[\\+>~]", "g"); + function attrToXPath (match, p1, p2, p3) { + switch (p2) { + case "^": return "starts-with(@" + p1 + ", '" + p3 + "')"; + case "$": return "substring(@" + p1 + ", (string-length(@" + p1 + ") - " + (p3.length - 1) + "), " + p3.length + ") = '" + p3 + "'"; + case "*": return "contains(concat(' ', @" + p1 + ", ' '), '" + p3 + "')"; + case "|": return "(@" + p1 + "='" + p3 + "' or starts-with(@" + p1 + ", '" + p3 + "-'))"; + case "~": return "contains(concat(' ', @" + p1 + ", ' '), ' " + p3 + " ')"; + default: return "@" + p1 + (p3? "='" + p3 + "'" : ""); + } + } + function pseudoToXPath (tag, pseudoClass, pseudoValue) { + var xpath = ""; + switch (pseudoClass) { + case "first-child": + xpath = "not(preceding-sibling::*)"; + break; + case "first-of-type": + xpath = "not(preceding-sibling::" + tag + ")"; + break; + case "last-child": + xpath = "not(following-sibling::*)"; + break; + case "last-of-type": + xpath = "not(following-sibling::" + tag + ")"; + break; + case "only-child": + xpath = "not(preceding-sibling::* or following-sibling::*)"; + break; + case "only-of-type": + xpath = "not(preceding-sibling::" + tag + " or following-sibling::" + tag + ")"; + break; + case "nth-child": + if (!/^n$/.test(pseudoValue)) { + sequence = DOMAssistant.getSequence(pseudoValue); + if (sequence) { + if (sequence.start === sequence.max) { + xpath = "count(preceding-sibling::*) = " + (sequence.start - 1); + } + else { + xpath = "(count(preceding-sibling::*) + 1) mod " + sequence.add + " = " + sequence.modVal + ((sequence.start > 1)? " and count(preceding-sibling::*) >= " + (sequence.start - 1) : "") + ((sequence.max > 0)? " and count(preceding-sibling::*) <= " + (sequence.max - 1): ""); + } + } + } + break; + case "nth-of-type": + if (!/^n$/.test(pseudoValue)) { + sequence = DOMAssistant.getSequence(pseudoValue); + if (sequence) { + if (sequence.start === sequence.max) { + xpath = pseudoValue; + } + else { + xpath = "position() mod " + sequence.add + " = " + sequence.modVal + ((sequence.start > 1)? " and position() >= " + sequence.start : "") + ((sequence.max > 0)? " and position() <= " + sequence.max : ""); + } + } + } + break; + case "empty": + xpath = "count(child::*) = 0 and string-length(text()) = 0"; + break; + case "contains": + xpath = "contains(., '" + pseudoValue + "')"; + break; + case "enabled": + xpath = "not(@disabled)"; + break; + case "disabled": + xpath = "@disabled"; + break; + case "checked": + xpath = "@checked='checked'"; // Doesn't work in Opera 9.24 + break; + case "not": + if (/^(:\w+[\w\-]*)$/.test(pseudoValue)) { + xpath = "not(" + pseudoToXPath(tag, pseudoValue.slice(1)) + ")"; + } + else { + pseudoValue = pseudoValue.replace(/^\[#([\w\u00C0-\uFFFF\-\_]+)\]$/, "[id=$1]"); + var notSelector = pseudoValue.replace(/^(\w+)/, "self::$1"); + notSelector = notSelector.replace(/^\.([\w\u00C0-\uFFFF\-_]+)/g, "contains(concat(' ', @class, ' '), ' $1 ')"); + notSelector = notSelector.replace(/\[(\w+)(\^|\$|\*|\||~)?=?([\w\u00C0-\uFFFF\s\-_\.]+)?\]/g, attrToXPath); + xpath = "not(" + notSelector + ")"; + } + break; + default: + xpath = "@" + pseudoClass + "='" + pseudoValue + "'"; + break; + } + return xpath; + } + for (var i=0; (currentRule=cssRules[i]); i++) { + if (i > 0) { + identical = false; + for (var x=0, xl=i; x": + xPathExpression += "/child::"; + break; + case "+": + xPathExpression += "/following-sibling::*[1]/self::"; + break; + case "~": + xPathExpression += "/following-sibling::"; + break; + } + } + else { + xPathExpression += (j > 0 && /(>|\+|~)/.test(cssSelectors[j-1]))? splitRule.tag : ("/descendant::" + splitRule.tag); + } + if (splitRule.id) { + xPathExpression += "[@id = '" + splitRule.id.replace(/^#/, "") + "']"; + } + if (splitRule.allClasses) { + xPathExpression += splitRule.allClasses.replace(/\.([\w\u00C0-\uFFFF\-_]+)/g, "[contains(concat(' ', @class, ' '), ' $1 ')]"); + } + if (splitRule.allAttr) { + xPathExpression += splitRule.allAttr.replace(/(\w+)(\^|\$|\*|\||~)?=?([\w\u00C0-\uFFFF\s\-_\.]+)?/g, attrToXPath); + } + if (splitRule.allPseudos) { + var pseudoSplitRegExp = /:(\w[\w\-]*)(\(([^\)]+)\))?/; + splitRule.allPseudos = splitRule.allPseudos.match(/(:\w+[\w\-]*)(\([^\)]+\))?/g); + for (var k=0, kl=splitRule.allPseudos.length; k|\+|~)$/; + var cssSelectorRegExp = /^(\w+)?(#[\w\u00C0-\uFFFF\-\_]+|(\*))?((\.[\w\u00C0-\uFFFF\-_]+)*)?((\[\w+(\^|\$|\*|\||~)?(=[\w\u00C0-\uFFFF\s\-\_\.]+)?\]+)*)?(((:\w+[\w\-]*)(\((odd|even|\-?\d*n?((\+|\-)\d+)?|[\w\u00C0-\uFFFF\-_]+|((\w*\.[\w\u00C0-\uFFFF\-_]+)*)?|(\[#?\w+(\^|\$|\*|\||~)?=?[\w\u00C0-\uFFFF\s\-\_\.]+\]+)|(:\w+[\w\-]*))\))?)*)?/; + var selectorSplitRegExp; + try { + selectorSplitRegExp = new RegExp("(?:\\[[^\\[]*\\]|\\(.*\\)|[^\\s\\+>~\\[\\(])+|[\\+>~]", "g"); + } + catch (e) { + selectorSplitRegExp = /[^\s]+/g; + } + function clearAdded (elm) { + elm = elm || prevElm; + for (var n=0, nl=elm.length; n 0) { + identical = false; + for (var b=0, bl=a; b 0 && childOrSiblingRefRegExp.test(rule)) { + childOrSiblingRef = childOrSiblingRefRegExp.exec(rule); + if (childOrSiblingRef) { + nextTag = /^\w+/.exec(cssSelectors[i+1]); + if (nextTag) { + nextTag = nextTag[0]; + nextRegExp = new RegExp("(^|\\s)" + nextTag + "(\\s|$)", "i"); + } + for (var j=0, prevRef; (prevRef=prevElm[j]); j++) { + switch (childOrSiblingRef[0]) { + case ">": + var children = getElementsByTagName(nextTag, prevRef); + for (var k=0, child; (child=children[k]); k++) { + if (child.parentNode === prevRef) { + matchingElms[matchingElms.length] = child; + } + } + break; + case "+": + while ((prevRef = prevRef.nextSibling) && prevRef.nodeType !== 1) {} + if (prevRef) { + if (!nextTag || nextRegExp.test(prevRef.nodeName)) { + matchingElms[matchingElms.length] = prevRef; + } + } + break; + case "~": + while ((prevRef = prevRef.nextSibling) && !prevRef.added) { + if (!nextTag || nextRegExp.test(prevRef.nodeName)) { + prevRef.added = true; + matchingElms[matchingElms.length] = prevRef; + } + } + break; + } + } + prevElm = matchingElms; + clearAdded(); + rule = cssSelectors[++i]; + if (/^\w+$/.test(rule)) { + continue; + } + prevElm.skipTag = true; + } + } + var cssSelector = cssSelectorRegExp.exec(rule); + var splitRule = { + tag : (!cssSelector[1] || cssSelector[3] === "*")? "*" : cssSelector[1], + id : (cssSelector[3] !== "*")? cssSelector[2] : null, + allClasses : cssSelector[4], + allAttr : cssSelector[6], + allPseudos : cssSelector[10] + }; + if (splitRule.id) { + var DOMElm = document.getElementById(splitRule.id.replace(/#/, "")); + if (DOMElm) { + matchingElms = [DOMElm]; + } + prevElm = matchingElms; + } + else if (splitRule.tag && !prevElm.skipTag) { + if (i===0 && !matchingElms.length && prevElm.length === 1) { + prevElm = matchingElms = pushAll([], getElementsByTagName(splitRule.tag, prevElm[0])); + } + else { + for (var l=0, ll=prevElm.length, tagCollectionMatches, tagMatch; l 0 && ajaxObj.params)? ("&" + ajaxObj.params) : ""); + } + return DOMAssistant.AJAX.makeCall.call(this, ajaxObj); + }, + + get : function (url, callback, addToContent) { + var ajaxObj = createAjaxObj(url, "GET", callback, addToContent); + return DOMAssistant.AJAX.makeCall.call(this, ajaxObj); + }, + + post : function (url, callback) { + var ajaxObj = createAjaxObj(url, "POST", callback); + return DOMAssistant.AJAX.makeCall.call(this, ajaxObj); + }, + + load : function (url, addToContent) { + DOMAssistant.AJAX.get.call(this, url, DOMAssistant.AJAX.replaceWithAJAXContent, addToContent); + }, + + makeCall : function (ajaxObj) { + var XMLHttp = DOMAssistant.AJAX.initRequest(); + if (XMLHttp) { + globalXMLHttp = XMLHttp; + var ajaxCall = function (elm) { + var url = ajaxObj.url; + var method = ajaxObj.method || "GET"; + var callback = ajaxObj.callback; + var params = ajaxObj.params; + var headers = ajaxObj.headers; + var responseType = ajaxObj.responseType || "text"; + var addToContent = ajaxObj.addToContent; + XMLHttp.open(method, url, true); + XMLHttp.setRequestHeader("AJAX", "true"); + XMLHttp.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + if (method === "POST") { + var contentLength = params? params.length : 0; + XMLHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + XMLHttp.setRequestHeader("Content-length", contentLength); + if (XMLHttp.overrideMimeType) { + XMLHttp.setRequestHeader("Connection", "close"); + } + } + for (var i in headers){ + if (typeof i === "string") { + XMLHttp.setRequestHeader(i, headers[i]); + } + } + if (typeof callback === "function") { + XMLHttp.onreadystatechange = function () { + if (XMLHttp.readyState === 4) { + var response = (/xml/i.test(responseType))? XMLHttp.responseXML : XMLHttp.responseText; + callback.call(elm, response, addToContent); + readyState = 4; + status = XMLHttp.status; + statusText = XMLHttp.statusText; + globalXMLHttp = null; + XMLHttp = null; + } + }; + } + XMLHttp.send(params); + }(this); + } + return this; + }, + + replaceWithAJAXContent : function (content, add) { + if (add) { + this.innerHTML += content; + } + else { + var elms = this.elmsByTag("*"); + for (var i=0, elm, attr; (elm=elms[i]); i++) { + attr = elm.attributes; + if (attr) { + for (var j=0, jl=attr.length; j=0; i--) { + child = this.childNodes[i]; + attr = child.attributes; + if (attr) { + for (var j=0, jl=attr.length; j<\/script>"); + document.getElementById("ieScriptLoad").onreadystatechange = function() { + if (this.readyState === "complete") { + DOMHasLoaded(); + } + }; + } + @end @*/ + /* Mozilla/Opera 9 */ + if (document.addEventListener) { + document.addEventListener("DOMContentLoaded", DOMHasLoaded, false); + } + /* Safari, iCab, Konqueror */ + if (/KHTML|WebKit|iCab/i.test(navigator.userAgent)) { + DOMLoadTimer = setInterval(function () { + if (/loaded|complete/i.test(document.readyState)) { + DOMHasLoaded(); + clearInterval(DOMLoadTimer); + } + }, 10); + } + /* Other web browsers */ + window.onload = DOMHasLoaded; + + return { + DOMReady : function () { + for (var i=0, il=arguments.length, funcRef; i + + GQuery + + + + + + + + + + + + + + +

GWTSpeed - GWTQuery benchmarks

+ + +
+ + +

Abstract

+ +

Selectors are patterns that match against elements in a + tree. Selectors have been optimized for use with HTML and XML, and + are designed to be usable in performance-critical code.

+ +

CSS (Cascading + Style Sheets) is a language for describing the rendering of HTML and XML documents on + screen, on paper, in speech, etc. CSS uses Selectors for binding + style properties to elements in the document. This document + describes extensions to the selectors defined in CSS level 2. These + extended selectors will be used by CSS level 3. + +

Selectors define the following function:

+ +
expression ∗ element → boolean
+ +

That is, given an element and a selector, this specification + defines whether that element matches the selector.

+ +

These expressions can also be used, for instance, to select a set + of elements, or a single element from a set of elements, by + evaluating the expression across all the elements in a + subtree. STTS (Simple Tree Transformation Sheets), a + language for transforming XML trees, uses this mechanism. [STTS]

+ +

Status of this document

+ +

This section describes the status of this document at the + time of its publication. Other documents may supersede this + document. A list of current W3C publications and the latest revision + of this technical report can be found in the W3C technical reports index at + http://www.w3.org/TR/.

+ +

This document describes the selectors that already exist in CSS1 and CSS2, and + also proposes new selectors for CSS3 and other languages that may need them.

+ +

The CSS Working Group doesn't expect that all implementations of + CSS3 will have to implement all selectors. Instead, there will + probably be a small number of variants of CSS3, called profiles. For + example, it may be that only a profile for interactive user agents + will include all of the selectors.

+ +

This specification is a last call working draft for the the CSS Working Group + (Style Activity). This + document is a revision of the Candidate + Recommendation dated 2001 November 13, and has incorporated + implementation feedback received in the past few years. It is + expected that this last call will proceed straight to Proposed + Recommendation stage since it is believed that interoperability will + be demonstrable.

+ +

All persons are encouraged to review and implement this + specification and return comments to the (archived) + public mailing list www-style + (see instructions). W3C + Members can also send comments directly to the CSS Working + Group. + The deadline for comments is 14 January 2006.

+ +

This is still a draft document and may be updated, replaced, or + obsoleted by other documents at any time. It is inappropriate to + cite a W3C Working Draft as other than "work in progress". + +

This document may be available in translation. + The English version of this specification is the only normative + version. + +

+ +

Table of contents

+ + + +
+ +

1. Introduction

+ +

1.1. Dependencies

+ +

Some features of this specification are specific to CSS, or have + particular limitations or rules specific to CSS. In this + specification, these have been described in terms of CSS2.1. [CSS21]

+ +

1.2. Terminology

+ +

All of the text of this specification is normative except + examples, notes, and sections explicitly marked as + non-normative.

+ +

1.3. Changes from CSS2

+ +

This section is non-normative.

+ +

The main differences between the selectors in CSS2 and those in + Selectors are: + +

    + +
  • the list of basic definitions (selector, group of selectors, + simple selector, etc.) has been changed; in particular, what was + referred to in CSS2 as a simple selector is now called a sequence + of simple selectors, and the term "simple selector" is now used for + the components of this sequence
  • + +
  • an optional namespace component is now allowed in type element + selectors, the universal selector and attribute selectors
  • + +
  • a new combinator has been introduced
  • + +
  • new simple selectors including substring matching attribute + selectors, and new pseudo-classes
  • + +
  • new pseudo-elements, and introduction of the "::" convention + for pseudo-elements
  • + +
  • the grammar has been rewritten
  • + +
  • profiles to be added to specifications integrating Selectors + and defining the set of selectors which is actually supported by + each specification
  • + +
  • Selectors are now a CSS3 Module and an independent + specification; other specifications can now refer to this document + independently of CSS
  • + +
  • the specification now has its own test suite
  • + +
+ +

2. Selectors

+ +

This section is non-normative, as it merely summarizes the +following sections.

+ +

A Selector represents a structure. This structure can be used as a +condition (e.g. in a CSS rule) that determines which elements a +selector matches in the document tree, or as a flat description of the +HTML or XML fragment corresponding to that structure.

+ +

Selectors may range from simple element names to rich contextual +representations.

+ +

The following table summarizes the Selector syntax:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PatternMeaningDescribed in sectionFirst defined in CSS level
*any elementUniversal + selector2
Ean element of type EType selector1
E[foo]an E element with a "foo" attributeAttribute + selectors2
E[foo="bar"]an E element whose "foo" attribute value is exactly + equal to "bar"Attribute + selectors2
E[foo~="bar"]an E element whose "foo" attribute value is a list of + space-separated values, one of which is exactly equal to "bar"Attribute + selectors2
E[foo^="bar"]an E element whose "foo" attribute value begins exactly + with the string "bar"Attribute + selectors3
E[foo$="bar"]an E element whose "foo" attribute value ends exactly + with the string "bar"Attribute + selectors3
E[foo*="bar"]an E element whose "foo" attribute value contains the + substring "bar"Attribute + selectors3
E[hreflang|="en"]an E element whose "hreflang" attribute has a hyphen-separated + list of values beginning (from the left) with "en"Attribute + selectors2
E:rootan E element, root of the documentStructural + pseudo-classes3
E:nth-child(n)an E element, the n-th child of its parentStructural + pseudo-classes3
E:nth-last-child(n)an E element, the n-th child of its parent, counting + from the last oneStructural + pseudo-classes3
E:nth-of-type(n)an E element, the n-th sibling of its typeStructural + pseudo-classes3
E:nth-last-of-type(n)an E element, the n-th sibling of its type, counting + from the last oneStructural + pseudo-classes3
E:first-childan E element, first child of its parentStructural + pseudo-classes2
E:last-childan E element, last child of its parentStructural + pseudo-classes3
E:first-of-typean E element, first sibling of its typeStructural + pseudo-classes3
E:last-of-typean E element, last sibling of its typeStructural + pseudo-classes3
E:only-childan E element, only child of its parentStructural + pseudo-classes3
E:only-of-typean E element, only sibling of its typeStructural + pseudo-classes3
E:emptyan E element that has no children (including text + nodes)Structural + pseudo-classes3
E:link
E:visited
an E element being the source anchor of a hyperlink of + which the target is not yet visited (:link) or already visited + (:visited)The link + pseudo-classes1
E:active
E:hover
E:focus
an E element during certain user actionsThe user + action pseudo-classes1 and 2
E:targetan E element being the target of the referring URIThe target + pseudo-class3
E:lang(fr)an element of type E in language "fr" (the document + language specifies how language is determined)The :lang() + pseudo-class2
E:enabled
E:disabled
a user interface element E which is enabled or + disabledThe UI element states + pseudo-classes3
E:checkeda user interface element E which is checked (for instance a radio-button or checkbox)The UI element states + pseudo-classes3
E::first-linethe first formatted line of an E elementThe ::first-line + pseudo-element1
E::first-letterthe first formatted letter of an E elementThe ::first-letter + pseudo-element1
E::selectionthe portion of an E element that is currently + selected/highlighted by the userThe UI element + fragments pseudo-elements3
E::beforegenerated content before an E elementThe ::before + pseudo-element2
E::aftergenerated content after an E elementThe ::after + pseudo-element2
E.warningan E element whose class is +"warning" (the document language specifies how class is determined).Class + selectors1
E#myidan E element with ID equal to "myid".ID + selectors1
E:not(s)an E element that does not match simple selector sNegation + pseudo-class3
E Fan F element descendant of an E elementDescendant + combinator1
E > Fan F element child of an E elementChild + combinator2
E + Fan F element immediately preceded by an E elementAdjacent sibling combinator2
E ~ Fan F element preceded by an E elementGeneral sibling combinator3
+ +

The meaning of each selector is derived from the table above by +prepending "matches" to the contents of each cell in the "Meaning" +column.

+ +

3. Case sensitivity

+ +

The case sensitivity of document language element names, attribute +names, and attribute values in selectors depends on the document +language. For example, in HTML, element names are case-insensitive, +but in XML, they are case-sensitive.

+ +

4. Selector syntax

+ +

A selector is a chain of one +or more sequences of simple selectors +separated by combinators.

+ +

A sequence of simple selectors +is a chain of simple selectors +that are not separated by a combinator. It +always begins with a type selector or a +universal selector. No other type +selector or universal selector is allowed in the sequence.

+ +

A simple selector is either a type selector, universal selector, attribute selector, class selector, ID selector, content selector, or pseudo-class. One pseudo-element may be appended to the last +sequence of simple selectors.

+ +

Combinators are: white space, "greater-than +sign" (U+003E, >), "plus sign" (U+002B, ++) and "tilde" (U+007E, ~). White +space may appear between a combinator and the simple selectors around +it. Only the characters "space" (U+0020), "tab" +(U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form +feed" (U+000C) can occur in white space. Other space-like characters, +such as "em-space" (U+2003) and "ideographic space" (U+3000), are +never part of white space.

+ +

The elements of a document tree that are represented by a selector +are the subjects of the selector. A +selector consisting of a single sequence of simple selectors +represents any element satisfying its requirements. Prepending another +sequence of simple selectors and a combinator to a sequence imposes +additional matching constraints, so the subjects of a selector are +always a subset of the elements represented by the last sequence of +simple selectors.

+ +

An empty selector, containing no sequence of simple selectors and +no pseudo-element, is an invalid +selector.

+ +

5. Groups of selectors

+ +

When several selectors share the same declarations, they may be +grouped into a comma-separated list. (A comma is U+002C.)

+ +
+

CSS examples:

+

In this example, we condense three rules with identical +declarations into one. Thus,

+
h1 { font-family: sans-serif }
+h2 { font-family: sans-serif }
+h3 { font-family: sans-serif }
+

is equivalent to:

+
h1, h2, h3 { font-family: sans-serif }
+
+ +

Warning: the equivalence is true in this example +because all the selectors are valid selectors. If just one of these +selectors were invalid, the entire group of selectors would be +invalid. This would invalidate the rule for all three heading +elements, whereas in the former case only one of the three individual +heading rules would be invalidated.

+ + +

6. Simple selectors

+ +

6.1. Type selector

+ +

A type selector is the name of a document language +element type. A type selector represents an instance of the element +type in the document tree.

+ +
+

Example:

+

The following selector represents an h1 element in the document tree:

+
h1
+
+ + +

6.1.1. Type selectors and namespaces

+ +

Type selectors allow an optional namespace ([XMLNAMES]) component. A namespace prefix +that has been previously declared may be prepended to the element name +separated by the namespace separator "vertical bar" +(U+007C, |).

+ +

The namespace component may be left empty to indicate that the +selector is only to represent elements with no declared namespace.

+ +

An asterisk may be used for the namespace prefix, indicating that +the selector represents elements in any namespace (including elements +with no namespace).

+ +

Element type selectors that have no namespace component (no +namespace separator), represent elements without regard to the +element's namespace (equivalent to "*|") unless a default +namespace has been declared. If a default namespace has been declared, +the selector will represent only elements in the default +namespace.

+ +

A type selector containing a namespace prefix that has not been +previously declared is an invalid selector. +The mechanism for declaring a namespace prefix is left up to the +language implementing Selectors. In CSS, such a mechanism is defined +in the General Syntax module.

+ +

In a namespace-aware client, element type selectors will only match +against the local part +of the element's qualified +name. See below for notes about matching +behaviors in down-level clients.

+ +

In summary:

+ +
+
ns|E
+
elements with name E in namespace ns
+
*|E
+
elements with name E in any namespace, including those without any + declared namespace
+
|E
+
elements with name E without any declared namespace
+
E
+
if no default namespace has been specified, this is equivalent to *|E. + Otherwise it is equivalent to ns|E where ns is the default namespace.
+
+ +
+

CSS examples:

+ +
@namespace foo url(http://www.example.com);
+ foo|h1 { color: blue }
+ foo|* { color: yellow }
+ |h1 { color: red }
+ *|h1 { color: green }
+ h1 { color: green }
+ +

The first rule will match only h1 elements in the + "http://www.example.com" namespace.

+ +

The second rule will match all elements in the + "http://www.example.com" namespace.

+ +

The third rule will match only h1 elements without + any declared namespace.

+ +

The fourth rule will match h1 elements in any + namespace (including those without any declared namespace).

+ +

The last rule is equivalent to the fourth rule because no default + namespace has been defined.

+ +
+ +

6.2. Universal selector

+ +

The universal selector, written "asterisk" +(*), represents the qualified name of any element +type. It represents any single element in the document tree in any +namespace (including those without any declared namespace) if no +default namespace has been specified. If a default namespace has been +specified, see Universal selector and +Namespaces below.

+ +

If the universal selector is not the only component of a sequence +of simple selectors, the * may be omitted.

+ +
+

Examples:

+
    +
  • *[hreflang|=en] and [hreflang|=en] are equivalent,
  • +
  • *.warning and .warning are equivalent,
  • +
  • *#myid and #myid are equivalent.
  • +
+
+ +

Note: it is recommended that the +*, representing the universal selector, not be +omitted.

+ +

6.2.1. Universal selector and namespaces

+ +

The universal selector allows an optional namespace component. It +is used as follows:

+ +
+
ns|*
+
all elements in namespace ns
+
*|*
+
all elements
+
|*
+
all elements without any declared namespace
+
*
+
if no default namespace has been specified, this is equivalent to *|*. + Otherwise it is equivalent to ns|* where ns is the default namespace.
+
+ +

A universal selector containing a namespace prefix that has not +been previously declared is an invalid +selector. The mechanism for declaring a namespace prefix is left up +to the language implementing Selectors. In CSS, such a mechanism is +defined in the General Syntax module.

+ + +

6.3. Attribute selectors

+ +

Selectors allow the representation of an element's attributes. When +a selector is used as an expression to match against an element, +attribute selectors must be considered to match an element if that +element has an attribute that matches the attribute represented by the +attribute selector.

+ +

6.3.1. Attribute presence and values +selectors

+ +

CSS2 introduced four attribute selectors:

+ +
+
[att] +
Represents an element with the att attribute, whatever the value of + the attribute.
+
[att=val]
+
Represents an element with the att attribute whose value is exactly + "val".
+
[att~=val]
+
Represents an element with the att attribute whose value is a whitespace-separated list of words, one of + which is exactly "val". If "val" contains whitespace, it will never + represent anything (since the words are separated by + spaces).
+
[att|=val] +
Represents an element with the att attribute, its value either + being exactly "val" or beginning with "val" immediately followed by + "-" (U+002D). This is primarily intended to allow language subcode + matches (e.g., the hreflang attribute on the + link element in HTML) as described in RFC 3066 ([RFC3066]). For lang (or + xml:lang) language subcode matching, please see the :lang pseudo-class.
+
+ +

Attribute values must be identifiers or strings. The +case-sensitivity of attribute names and values in selectors depends on +the document language.

+ +
+ +

Examples:

+ +

The following attribute selector represents an h1 + element that carries the title attribute, whatever its + value:

+ +
h1[title]
+ +

In the following example, the selector represents a + span element whose class attribute has + exactly the value "example":

+ +
span[class="example"]
+ +

Multiple attribute selectors can be used to represent several + attributes of an element, or several conditions on the same + attribute. Here, the selector represents a span element + whose hello attribute has exactly the value "Cleveland" + and whose goodbye attribute has exactly the value + "Columbus":

+ +
span[hello="Cleveland"][goodbye="Columbus"]
+ +

The following selectors illustrate the differences between "=" + and "~=". The first selector will represent, for example, the value + "copyright copyleft copyeditor" on a rel attribute. The + second selector will only represent an a element with + an href attribute having the exact value + "http://www.w3.org/".

+ +
a[rel~="copyright"]
+a[href="http://www.w3.org/"]
+ +

The following selector represents a link element + whose hreflang attribute is exactly "fr".

+ +
link[hreflang=fr]
+ +

The following selector represents a link element for + which the values of the hreflang attribute begins with + "en", including "en", "en-US", and "en-cockney":

+ +
link[hreflang|="en"]
+ +

Similarly, the following selectors represents a + DIALOGUE element whenever it has one of two different + values for an attribute character:

+ +
DIALOGUE[character=romeo]
+DIALOGUE[character=juliet]
+ +
+ +

6.3.2. Substring matching attribute +selectors

+ +

Three additional attribute selectors are provided for matching +substrings in the value of an attribute:

+ +
+
[att^=val]
+
Represents an element with the att attribute whose value begins + with the prefix "val".
+
[att$=val] +
Represents an element with the att attribute whose value ends with + the suffix "val".
+
[att*=val] +
Represents an element with the att attribute whose value contains + at least one instance of the substring "val".
+
+ +

Attribute values must be identifiers or strings. The +case-sensitivity of attribute names in selectors depends on the +document language.

+ +
+

Examples:

+

The following selector represents an HTML object, referencing an + image:

+
object[type^="image/"]
+

The following selector represents an HTML anchor a with an + href attribute whose value ends with ".html".

+
a[href$=".html"]
+

The following selector represents an HTML paragraph with a title + attribute whose value contains the substring "hello"

+
p[title*="hello"]
+
+ +

6.3.3. Attribute selectors and namespaces

+ +

Attribute selectors allow an optional namespace component to the +attribute name. A namespace prefix that has been previously declared +may be prepended to the attribute name separated by the namespace +separator "vertical bar" (|). In keeping with +the Namespaces in the XML recommendation, default namespaces do not +apply to attributes, therefore attribute selectors without a namespace +component apply only to attributes that have no declared namespace +(equivalent to "|attr"). An asterisk may be used for the +namespace prefix indicating that the selector is to match all +attribute names without regard to the attribute's namespace. + +

An attribute selector with an attribute name containing a namespace +prefix that has not been previously declared is an invalid selector. The mechanism for declaring +a namespace prefix is left up to the language implementing Selectors. +In CSS, such a mechanism is defined in the General Syntax module. + +

+

CSS examples:

+
@namespace foo "http://www.example.com";
+[foo|att=val] { color: blue }
+[*|att] { color: yellow }
+[|att] { color: green }
+[att] { color: green }
+ +

The first rule will match only elements with the attribute + att in the "http://www.example.com" namespace with the + value "val".

+ +

The second rule will match only elements with the attribute + att regardless of the namespace of the attribute + (including no declared namespace).

+ +

The last two rules are equivalent and will match only elements + with the attribute att where the attribute is not + declared to be in a namespace.

+ +
+ +

6.3.4. Default attribute values in DTDs

+ +

Attribute selectors represent explicitly set attribute values in +the document tree. Default attribute values may be defined in a DTD or +elsewhere, but cannot always be selected by attribute +selectors. Selectors should be designed so that they work even if the +default values are not included in the document tree.

+ +

More precisely, a UA is not required to read an "external +subset" of the DTD but is required to look for default +attribute values in the document's "internal subset." (See [XML10] for definitions of these subsets.)

+ +

A UA that recognizes an XML namespace [XMLNAMES] is not required to use its +knowledge of that namespace to treat default attribute values as if +they were present in the document. (For example, an XHTML UA is not +required to use its built-in knowledge of the XHTML DTD.)

+ +

Note: Typically, implementations +choose to ignore external subsets.

+ +
+

Example:

+ +

Consider an element EXAMPLE with an attribute "notation" that has a +default value of "decimal". The DTD fragment might be

+ +
<!ATTLIST EXAMPLE notation (decimal,octal) "decimal">
+ +

If the style sheet contains the rules

+ +
EXAMPLE[notation=decimal] { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }
+ +

the first rule will not match elements whose "notation" attribute +is set by default, i.e. not set explicitly. To catch all cases, the +attribute selector for the default value must be dropped:

+ +
EXAMPLE                   { /*... default property settings ...*/ }
+EXAMPLE[notation=octal]   { /*... other settings...*/ }
+ +

Here, because the selector EXAMPLE[notation=octal] is +more specific than the tag +selector alone, the style declarations in the second rule will override +those in the first for elements that have a "notation" attribute value +of "octal". Care has to be taken that all property declarations that +are to apply only to the default case are overridden in the non-default +cases' style rules.

+ +
+ +

6.4. Class selectors

+ +

Working with HTML, authors may use the period (U+002E, +.) notation as an alternative to the ~= +notation when representing the class attribute. Thus, for +HTML, div.value and div[class~=value] have +the same meaning. The attribute value must immediately follow the +"period" (.).

+ +

UAs may apply selectors using the period (.) notation in XML +documents if the UA has namespace-specific knowledge that allows it to +determine which attribute is the "class" attribute for the +respective namespace. One such example of namespace-specific knowledge +is the prose in the specification for a particular namespace (e.g. SVG +1.0 [SVG] describes the SVG +"class" attribute and how a UA should interpret it, and +similarly MathML 1.01 [MATH] describes the MathML +"class" attribute.)

+ +
+

CSS examples:

+ +

We can assign style information to all elements with + class~="pastoral" as follows:

+ +
*.pastoral { color: green }  /* all elements with class~=pastoral */
+ +

or just

+ +
.pastoral { color: green }  /* all elements with class~=pastoral */
+ +

The following assigns style only to H1 elements with + class~="pastoral":

+ +
H1.pastoral { color: green }  /* H1 elements with class~=pastoral */
+ +

Given these rules, the first H1 instance below would not have + green text, while the second would:

+ +
<H1>Not green</H1>
+<H1 class="pastoral">Very green</H1>
+ +
+ +

To represent a subset of "class" values, each value must be preceded +by a ".", in any order.

+ +
+ +

CSS example:

+ +

The following rule matches any P element whose "class" attribute + has been assigned a list of whitespace-separated values that includes + "pastoral" and "marine":

+ +
p.pastoral.marine { color: green }
+ +

This rule matches when class="pastoral blue aqua + marine" but does not match for class="pastoral + blue".

+ +
+ +

Note: Because CSS gives considerable +power to the "class" attribute, authors could conceivably design their +own "document language" based on elements with almost no associated +presentation (such as DIV and SPAN in HTML) and assigning style +information through the "class" attribute. Authors should avoid this +practice since the structural elements of a document language often +have recognized and accepted meanings and author-defined classes may +not.

+ +

Note: If an element has multiple +class attributes, their values must be concatenated with spaces +between the values before searching for the class. As of this time the +working group is not aware of any manner in which this situation can +be reached, however, so this behavior is explicitly non-normative in +this specification.

+ +

6.5. ID selectors

+ +

Document languages may contain attributes that are declared to be +of type ID. What makes attributes of type ID special is that no two +such attributes can have the same value in a document, regardless of +the type of the elements that carry them; whatever the document +language, an ID typed attribute can be used to uniquely identify its +element. In HTML all ID attributes are named "id"; XML applications +may name ID attributes differently, but the same restriction +applies.

+ +

An ID-typed attribute of a document language allows authors to +assign an identifier to one element instance in the document tree. W3C +ID selectors represent an element instance based on its identifier. An +ID selector contains a "number sign" (U+0023, +#) immediately followed by the ID value, which must be an +identifier.

+ +

Selectors does not specify how a UA knows the ID-typed attribute of +an element. The UA may, e.g., read a document's DTD, have the +information hard-coded or ask the user. + +

+

Examples:

+

The following ID selector represents an h1 element + whose ID-typed attribute has the value "chapter1":

+
h1#chapter1
+

The following ID selector represents any element whose ID-typed + attribute has the value "chapter1":

+
#chapter1
+

The following selector represents any element whose ID-typed + attribute has the value "z98y".

+
*#z98y
+
+ +

Note. In XML 1.0 [XML10], the information about which attribute +contains an element's IDs is contained in a DTD or a schema. When +parsing XML, UAs do not always read the DTD, and thus may not know +what the ID of an element is (though a UA may have namespace-specific +knowledge that allows it to determine which attribute is the ID +attribute for that namespace). If a style sheet designer knows or +suspects that a UA may not know what the ID of an element is, he +should use normal attribute selectors instead: +[name=p371] instead of #p371. Elements in +XML 1.0 documents without a DTD do not have IDs at all.

+ +

If an element has multiple ID attributes, all of them must be +treated as IDs for that element for the purposes of the ID +selector. Such a situation could be reached using mixtures of xml:id, +DOM3 Core, XML DTDs, and namespace-specific knowledge.

+ +

6.6. Pseudo-classes

+ +

The pseudo-class concept is introduced to permit selection based on +information that lies outside of the document tree or that cannot be +expressed using the other simple selectors.

+ +

A pseudo-class always consists of a "colon" +(:) followed by the name of the pseudo-class and +optionally by a value between parentheses.

+ +

Pseudo-classes are allowed in all sequences of simple selectors +contained in a selector. Pseudo-classes are allowed anywhere in +sequences of simple selectors, after the leading type selector or +universal selector (possibly omitted). Pseudo-class names are +case-insensitive. Some pseudo-classes are mutually exclusive, while +others can be applied simultaneously to the same +element. Pseudo-classes may be dynamic, in the sense that an element +may acquire or lose a pseudo-class while a user interacts with the +document.

+ + +

6.6.1. Dynamic pseudo-classes

+ +

Dynamic pseudo-classes classify elements on characteristics other +than their name, attributes, or content, in principle characteristics +that cannot be deduced from the document tree.

+ +

Dynamic pseudo-classes do not appear in the document source or +document tree.

+ + +
The link pseudo-classes: :link and :visited
+ +

User agents commonly display unvisited links differently from +previously visited ones. Selectors +provides the pseudo-classes :link and +:visited to distinguish them:

+ +
    +
  • The :link pseudo-class applies to links that have + not yet been visited.
  • +
  • The :visited pseudo-class applies once the link has + been visited by the user.
  • +
+ +

After some amount of time, user agents may choose to return a +visited link to the (unvisited) ':link' state.

+ +

The two states are mutually exclusive.

+ +
+ +

Example:

+ +

The following selector represents links carrying class + external and already visited:

+ +
a.external:visited
+ +
+ +

Note: It is possible for style sheet +authors to abuse the :link and :visited pseudo-classes to determine +which sites a user has visited without the user's consent. + +

UAs may therefore treat all links as unvisited links, or implement +other measures to preserve the user's privacy while rendering visited +and unvisited links differently.

+ +
The user action pseudo-classes +:hover, :active, and :focus
+ +

Interactive user agents sometimes change the rendering in response +to user actions. Selectors provides +three pseudo-classes for the selection of an element the user is +acting on.

+ +
    + +
  • The :hover pseudo-class applies while the user + designates an element with a pointing device, but does not activate + it. For example, a visual user agent could apply this pseudo-class + when the cursor (mouse pointer) hovers over a box generated by the + element. User agents not that do not support interactive + media do not have to support this pseudo-class. Some conforming + user agents that support interactive + media may not be able to support this pseudo-class (e.g., a pen + device that does not detect hovering).
  • + +
  • The :active pseudo-class applies while an element + is being activated by the user. For example, between the times the + user presses the mouse button and releases it.
  • + +
  • The :focus pseudo-class applies while an element + has the focus (accepts keyboard or mouse events, or other forms of + input).
  • + +
+ +

There may be document language or implementation specific limits on +which elements can become :active or acquire +:focus.

+ +

These pseudo-classes are not mutually exclusive. An element may +match several pseudo-classes at the same time.

+ +

Selectors doesn't define if the parent of an element that is +':active' or ':hover' is also in that state.

+ +
+

Examples:

+
a:link    /* unvisited links */
+a:visited /* visited links */
+a:hover   /* user hovers */
+a:active  /* active links */
+

An example of combining dynamic pseudo-classes:

+
a:focus
+a:focus:hover
+

The last selector matches a elements that are in + the pseudo-class :focus and in the pseudo-class :hover.

+
+ +

Note: An element can be both ':visited' +and ':active' (or ':link' and ':active').

+ +

6.6.2. The target pseudo-class :target

+ +

Some URIs refer to a location within a resource. This kind of URI +ends with a "number sign" (#) followed by an anchor +identifier (called the fragment identifier).

+ +

URIs with fragment identifiers link to a certain element within the +document, known as the target element. For instance, here is a URI +pointing to an anchor named section_2 in an HTML +document:

+ +
http://example.com/html/top.html#section_2
+ +

A target element can be represented by the :target +pseudo-class. If the document's URI has no fragment identifier, then +the document has no target element.

+ +
+

Example:

+
p.note:target
+

This selector represents a p element of class + note that is the target element of the referring + URI.

+
+ +
+

CSS example:

+

Here, the :target pseudo-class is used to make the + target element red and place an image before it, if there is one:

+
*:target { color : red }
+*:target::before { content : url(target.png) }
+
+ +

6.6.3. The language pseudo-class :lang

+ +

If the document language specifies how the human language of an +element is determined, it is possible to write selectors that +represent an element based on its language. For example, in HTML [HTML4], the language is determined by a +combination of the lang attribute, the meta +element, and possibly by information from the protocol (such as HTTP +headers). XML uses an attribute called xml:lang, and +there may be other document language-specific methods for determining +the language.

+ +

The pseudo-class :lang(C) represents an element that +is in language C. Whether an element is represented by a +:lang() selector is based solely on the identifier C +being either equal to, or a hyphen-separated substring of, the +element's language value, in the same way as if performed by the '|=' operator in attribute +selectors. The identifier C does not have to be a valid language +name.

+ +

C must not be empty. (If it is, the selector is invalid.)

+ +

Note: It is recommended that +documents and protocols indicate language using codes from RFC 3066 [RFC3066] or its successor, and by means of +"xml:lang" attributes in the case of XML-based documents [XML10]. See +"FAQ: Two-letter or three-letter language codes."

+ +
+

Examples:

+

The two following selectors represent an HTML document that is in + Belgian, French, or German. The two next selectors represent + q quotations in an arbitrary element in Belgian, French, + or German.

+
html:lang(fr-be)
+html:lang(de)
+:lang(fr-be) > q
+:lang(de) > q
+
+ +

6.6.4. The UI element states pseudo-classes

+ +
The :enabled and :disabled pseudo-classes
+ +

The :enabled pseudo-class allows authors to customize +the look of user interface elements that are enabled — which the +user can select or activate in some fashion (e.g. clicking on a button +with a mouse). There is a need for such a pseudo-class because there +is no way to programmatically specify the default appearance of say, +an enabled input element without also specifying what it +would look like when it was disabled.

+ +

Similar to :enabled, :disabled allows the +author to specify precisely how a disabled or inactive user interface +element should look.

+ +

Most elements will be neither enabled nor disabled. An element is +enabled if the user can either activate it or transfer the focus to +it. An element is disabled if it could be enabled, but the user cannot +presently activate it or transfer focus to it.

+ + +
The :checked pseudo-class
+ +

Radio and checkbox elements can be toggled by the user. Some menu +items are "checked" when the user selects them. When such elements are +toggled "on" the :checked pseudo-class applies. The +:checked pseudo-class initially applies to such elements +that have the HTML4 selected and checked +attributes as described in Section +17.2.1 of HTML4, but of course the user can toggle "off" such +elements in which case the :checked pseudo-class would no +longer apply. While the :checked pseudo-class is dynamic +in nature, and is altered by user action, since it can also be based +on the presence of the semantic HTML4 selected and +checked attributes, it applies to all media. + + +

The :indeterminate pseudo-class
+ +
+ +

Radio and checkbox elements can be toggled by the user, but are +sometimes in an indeterminate state, neither checked nor unchecked. +This can be due to an element attribute, or DOM manipulation.

+ +

A future version of this specification may introduce an +:indeterminate pseudo-class that applies to such elements. +

+ +
+ + +

6.6.5. Structural pseudo-classes

+ +

Selectors introduces the concept of structural +pseudo-classes to permit selection based on extra information that lies in +the document tree but cannot be represented by other simple selectors or +combinators. + +

Note that standalone pieces of PCDATA (text nodes in the DOM) are +not counted when calculating the position of an element in the list of +children of its parent. When calculating the position of an element in +the list of children of its parent, the index numbering starts at 1. + + +

:root pseudo-class
+ +

The :root pseudo-class represents an element that is +the root of the document. In HTML 4, this is always the +HTML element. + + +

:nth-child() pseudo-class
+ +

The +:nth-child(an+b) +pseudo-class notation represents an element that has +an+b-1 siblings +before it in the document tree, for a given positive +integer or zero value of n, and has a parent element. In +other words, this matches the bth child of an element after +all the children have been split into groups of a elements +each. For example, this allows the selectors to address every other +row in a table, and could be used to alternate the color +of paragraph text in a cycle of four. The a and +b values must be zero, negative integers or positive +integers. The index of the first child of an element is 1. + +

In addition to this, :nth-child() can take +'odd' and 'even' as arguments instead. +'odd' has the same signification as 2n+1, +and 'even' has the same signification as 2n. + + +

+

Examples:

+
tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+tr:nth-child(odd)  /* same */
+tr:nth-child(2n)   /* represents every even row of an HTML table */
+tr:nth-child(even) /* same */
+
+/* Alternate paragraph colours in CSS */
+p:nth-child(4n+1) { color: navy; }
+p:nth-child(4n+2) { color: green; }
+p:nth-child(4n+3) { color: maroon; }
+p:nth-child(4n+4) { color: purple; }
+
+ +

When a=0, no repeating is used, so for example +:nth-child(0n+5) matches only the fifth child. When +a=0, the an part need not be +included, so the syntax simplifies to +:nth-child(b) and the last example simplifies +to :nth-child(5). + +

+

Examples:

+
foo:nth-child(0n+1)   /* represents an element foo, first child of its parent element */
+foo:nth-child(1)      /* same */
+
+ +

When a=1, the number may be omitted from the rule. + +

+

Examples:

+

The following selectors are therefore equivalent:

+
bar:nth-child(1n+0)   /* represents all bar elements, specificity (0,1,1) */
+bar:nth-child(n+0)    /* same */
+bar:nth-child(n)      /* same */
+bar                   /* same but lower specificity (0,0,1) */
+
+ +

If b=0, then every ath element is picked. In +such a case, the b part may be omitted. + +

+

Examples:

+
tr:nth-child(2n+0) /* represents every even row of an HTML table */
+tr:nth-child(2n) /* same */
+
+ +

If both a and b are equal to zero, the +pseudo-class represents no element in the document tree.

+ +

The value a can be negative, but only the positive +values of an+b, for +n≥0, may represent an element in the document +tree.

+ +
+

Example:

+
html|tr:nth-child(-n+6)  /* represents the 6 first rows of XHTML tables */
+
+ +

When the value b is negative, the "+" character in the +expression must be removed (it is effectively replaced by the "-" +character indicating the negative value of b).

+ +
+

Examples:

+
:nth-child(10n-1)  /* represents the 9th, 19th, 29th, etc, element */
+:nth-child(10n+9)  /* Same */
+:nth-child(10n+-1) /* Syntactically invalid, and would be ignored */
+
+ + +
:nth-last-child() pseudo-class
+ +

The :nth-last-child(an+b) +pseudo-class notation represents an element that has +an+b-1 siblings +after it in the document tree, for a given positive +integer or zero value of n, and has a parent element. See +:nth-child() pseudo-class for the syntax of its argument. +It also accepts the 'even' and 'odd' values +as arguments. + + +

+

Examples:

+
tr:nth-last-child(-n+2)    /* represents the two last rows of an HTML table */
+
+foo:nth-last-child(odd)    /* represents all odd foo elements in their parent element,
+                              counting from the last one */
+
+ + +
:nth-of-type() pseudo-class
+ +

The :nth-of-type(an+b) +pseudo-class notation represents an element that has +an+b-1 siblings with the same +element name before it in the document tree, for a +given zero or positive integer value of n, and has a +parent element. In other words, this matches the bth child +of that type after all the children of that type have been split into +groups of a elements each. See :nth-child() pseudo-class +for the syntax of its argument. It also accepts the +'even' and 'odd' values. + + +

+

CSS example:

+

This allows an author to alternate the position of floated images:

+
img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }
+
+ + +
:nth-last-of-type() pseudo-class
+ +

The :nth-last-of-type(an+b) +pseudo-class notation represents an element that has +an+b-1 siblings with the same +element name after it in the document tree, for a +given zero or positive integer value of n, and has a +parent element. See :nth-child() pseudo-class for the +syntax of its argument. It also accepts the 'even' and 'odd' values. + + +

+

Example:

+

To represent all h2 children of an XHTML + body except the first and last, one could use the + following selector:

+
body > h2:nth-of-type(n+2):nth-last-of-type(n+2)
+

In this case, one could also use :not(), although the + selector ends up being just as long:

+
body > h2:not(:first-of-type):not(:last-of-type)
+
+ + +
:first-child pseudo-class
+ +

Same as :nth-child(1). The :first-child pseudo-class +represents an element that is the first child of some other element. + + +

+

Examples:

+

The following selector represents a p element that is + the first child of a div element:

+
div > p:first-child
+

This selector can represent the p inside the + div of the following fragment:

+
<p> The last P before the note.</p>
+<div class="note">
+   <p> The first P inside the note.</p>
+</div>
but cannot represent the second p in the following +fragment: +
<p> The last P before the note.</p>
+<div class="note">
+   <h2> Note </h2>
+   <p> The first P inside the note.</p>
+</div>
+

The following two selectors are usually equivalent:

+
* > a:first-child /* a is first child of any element */
+a:first-child /* Same (assuming a is not the root element) */
+
+ +
:last-child pseudo-class
+ +

Same as :nth-last-child(1). The :last-child pseudo-class +represents an element that is the last child of some other element. + +

+

Example:

+

The following selector represents a list item li that + is the last child of an ordered list ol. +

ol > li:last-child
+
+ +
:first-of-type pseudo-class
+ +

Same as :nth-of-type(1). The :first-of-type pseudo-class +represents an element that is the first sibling of its type in the list of +children of its parent element. + +

+

Example:

+

The following selector represents a definition title +dt inside a definition list dl, this +dt being the first of its type in the list of children of +its parent element.

+
dl dt:first-of-type
+

It is a valid description for the first two dt +elements in the following example but not for the third one:

+
<dl>
+ <dt>gigogne</dt>
+ <dd>
+  <dl>
+   <dt>fusée</dt>
+   <dd>multistage rocket</dd>
+   <dt>table</dt>
+   <dd>nest of tables</dd>
+  </dl>
+ </dd>
+</dl>
+
+ +
:last-of-type pseudo-class
+ +

Same as :nth-last-of-type(1). The +:last-of-type pseudo-class represents an element that is +the last sibling of its type in the list of children of its parent +element.

+ +
+

Example:

+

The following selector represents the last data cell + td of a table row.

+
tr > td:last-of-type
+
+ +
:only-child pseudo-class
+ +

Represents an element that has a parent element and whose parent +element has no other element children. Same as +:first-child:last-child or +:nth-child(1):nth-last-child(1), but with a lower +specificity.

+ +
:only-of-type pseudo-class
+ +

Represents an element that has a parent element and whose parent +element has no other element children with the same element name. Same +as :first-of-type:last-of-type or +:nth-of-type(1):nth-last-of-type(1), but with a lower +specificity.

+ + +
:empty pseudo-class
+ +

The :empty pseudo-class represents an element that has +no children at all. In terms of the DOM, only element nodes and text +nodes (including CDATA nodes and entity references) whose data has a +non-zero length must be considered as affecting emptiness; comments, +PIs, and other nodes must not affect whether an element is considered +empty or not.

+ +
+

Examples:

+

p:empty is a valid representation of the following fragment:

+
<p></p>
+

foo:empty is not a valid representation for the + following fragments:

+
<foo>bar</foo>
+
<foo><bar>bla</bar></foo>
+
<foo>this is not <bar>:empty</bar></foo>
+
+ +

6.6.6. Blank

+ +

This section intentionally left blank.

+ + +

6.6.7. The negation pseudo-class

+ +

The negation pseudo-class, :not(X), is a +functional notation taking a simple +selector (excluding the negation pseudo-class itself and +pseudo-elements) as an argument. It represents an element that is not +represented by the argument. + + + +

+

Examples:

+

The following CSS selector matches all button + elements in an HTML document that are not disabled.

+
button:not([DISABLED])
+

The following selector represents all but FOO + elements.

+
*:not(FOO)
+

The following group of selectors represents all HTML elements + except links.

+
html|*:not(:link):not(:visited)
+
+ +

Default namespace declarations do not affect the argument of the +negation pseudo-class unless the argument is a universal selector or a +type selector.

+ +
+

Examples:

+

Assuming that the default namespace is bound to + "http://example.com/", the following selector represents all + elements that are not in that namespace:

+
*|*:not(*)
+

The following CSS selector matches any element being hovered, + regardless of its namespace. In particular, it is not limited to + only matching elements in the default namespace that are not being + hovered, and elements not in the default namespace don't match the + rule when they are being hovered.

+
*|*:not(:hover)
+
+ +

Note: the :not() pseudo allows +useless selectors to be written. For instance :not(*|*), +which represents no element at all, or foo:not(bar), +which is equivalent to foo but with a higher +specificity.

+ +

7. Pseudo-elements

+ +

Pseudo-elements create abstractions about the document tree beyond +those specified by the document language. For instance, document +languages do not offer mechanisms to access the first letter or first +line of an element's content. Pseudo-elements allow designers to refer +to this otherwise inaccessible information. Pseudo-elements may also +provide designers a way to refer to content that does not exist in the +source document (e.g., the ::before and +::after pseudo-elements give access to generated +content).

+ +

A pseudo-element is made of two colons (::) followed +by the name of the pseudo-element.

+ +

This :: notation is introduced by the current document +in order to establish a discrimination between pseudo-classes and +pseudo-elements. For compatibility with existing style sheets, user +agents must also accept the previous one-colon notation for +pseudo-elements introduced in CSS levels 1 and 2 (namely, +:first-line, :first-letter, +:before and :after). This compatibility is +not allowed for the new pseudo-elements introduced in CSS level 3.

+ +

Only one pseudo-element may appear per selector, and if present it +must appear after the sequence of simple selectors that represents the +subjects of the selector. A +future version of this specification may allow multiple +pesudo-elements per selector.

+ +

7.1. The ::first-line pseudo-element

+ +

The ::first-line pseudo-element describes the contents +of the first formatted line of an element. + +

+

CSS example:

+
p::first-line { text-transform: uppercase }
+

The above rule means "change the letters of the first line of every +paragraph to uppercase".

+
+ +

The selector p::first-line does not match any real +HTML element. It does match a pseudo-element that conforming user +agents will insert at the beginning of every paragraph.

+ +

Note that the length of the first line depends on a number of +factors, including the width of the page, the font size, etc. Thus, +an ordinary HTML paragraph such as:

+ +
+<P>This is a somewhat long HTML 
+paragraph that will be broken into several 
+lines. The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.</P>
+
+ +

the lines of which happen to be broken as follows: + +

+THIS IS A SOMEWHAT LONG HTML PARAGRAPH THAT
+will be broken into several lines. The first
+line will be identified by a fictional tag 
+sequence. The other lines will be treated as 
+ordinary lines in the paragraph.
+
+ +

This paragraph might be "rewritten" by user agents to include the +fictional tag sequence for ::first-line. This +fictional tag sequence helps to show how properties are inherited.

+ +
+<P><P::first-line> This is a somewhat long HTML 
+paragraph that </P::first-line> will be broken into several
+lines. The first line will be identified 
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.</P>
+
+ +

If a pseudo-element breaks up a real element, the desired effect +can often be described by a fictional tag sequence that closes and +then re-opens the element. Thus, if we mark up the previous paragraph +with a span element:

+ +
+<P><SPAN class="test"> This is a somewhat long HTML
+paragraph that will be broken into several
+lines.</SPAN> The first line will be identified
+by a fictional tag sequence. The other lines 
+will be treated as ordinary lines in the 
+paragraph.</P>
+
+ +

the user agent could simulate start and end tags for +span when inserting the fictional tag sequence for +::first-line. + +

+<P><P::first-line><SPAN class="test"> This is a
+somewhat long HTML
+paragraph that will </SPAN></P::first-line><SPAN class="test"> be
+broken into several
+lines.</SPAN> The first line will be identified
+by a fictional tag sequence. The other lines
+will be treated as ordinary lines in the 
+paragraph.</P>
+
+ +

In CSS, the ::first-line pseudo-element can only be +attached to a block-level element, an inline-block, a table-caption, +or a table-cell.

+ +

The "first formatted line" of an +element may occur inside a +block-level descendant in the same flow (i.e., a block-level +descendant that is not positioned and not a float). E.g., the first +line of the div in <DIV><P>This +line...</P></DIV> is the first line of the p (assuming +that both p and div are block-level). + +

The first line of a table-cell or inline-block cannot be the first +formatted line of an ancestor element. Thus, in <DIV><P +STYLE="display: inline-block">Hello<BR>Goodbye</P> +etcetera</DIV> the first formatted line of the +div is not the line "Hello". + +

Note that the first line of the p in this +fragment: <p><br>First... doesn't contain any +letters (assuming the default style for br in HTML +4). The word "First" is not on the first formatted line. + +

A UA should act as if the fictional start tags of the +::first-line pseudo-elements were nested just inside the +innermost enclosing block-level element. (Since CSS1 and CSS2 were +silent on this case, authors should not rely on this behavior.) Here +is an example. The fictional tag sequence for

+ +
+<DIV>
+  <P>First paragraph</P>
+  <P>Second paragraph</P>
+</DIV>
+
+ +

is

+ +
+<DIV>
+  <P><DIV::first-line><P::first-line>First paragraph</P::first-line></DIV::first-line></P>
+  <P><P::first-line>Second paragraph</P::first-line></P>
+</DIV>
+
+ +

The ::first-line pseudo-element is similar to an +inline-level element, but with certain restrictions. In CSS, the +following properties apply to a ::first-line +pseudo-element: font properties, color property, background +properties, 'word-spacing', 'letter-spacing', 'text-decoration', +'vertical-align', 'text-transform', 'line-height'. UAs may apply other +properties as well.

+ + +

7.2. The ::first-letter pseudo-element

+ +

The ::first-letter pseudo-element represents the first +letter of the first line of a block, if it is not preceded by any +other content (such as images or inline tables) on its line. The +::first-letter pseudo-element may be used for "initial caps" and "drop +caps", which are common typographical effects. This type of initial +letter is similar to an inline-level element if its 'float' property +is 'none'; otherwise, it is similar to a floated element.

+ +

In CSS, these are the properties that apply to ::first-letter +pseudo-elements: font properties, 'text-decoration', 'text-transform', +'letter-spacing', 'word-spacing' (when appropriate), 'line-height', +'float', 'vertical-align' (only if 'float' is 'none'), margin +properties, padding properties, border properties, color property, +background properties. UAs may apply other properties as well. To +allow UAs to render a typographically correct drop cap or initial cap, +the UA may choose a line-height, width and height based on the shape +of the letter, unlike for normal elements.

+ +
+

Example:

+

This example shows a possible rendering of an initial cap. Note +that the 'line-height' that is inherited by the ::first-letter +pseudo-element is 1.1, but the UA in this example has computed the +height of the first letter differently, so that it doesn't cause any +unnecessary space between the first two lines. Also note that the +fictional start tag of the first letter is inside the span, and thus +the font weight of the first letter is normal, not bold as the span: +

+p { line-height: 1.1 }
+p::first-letter { font-size: 3em; font-weight: normal }
+span { font-weight: bold }
+...
+<p><span>Het hemelsche</span> gerecht heeft zich ten lange lesten<br>
+Erbarremt over my en mijn benaeuwde vesten<br>
+En arme burgery, en op mijn volcx gebed<br>
+En dagelix geschrey de bange stad ontzet.
+
+
+

Image illustrating the ::first-letter pseudo-element +

+
+ +
+

The following CSS will make a drop cap initial letter span about two lines:

+ +
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
+<HTML>
+ <HEAD>
+  <TITLE>Drop cap initial letter</TITLE>
+  <STYLE type="text/css">
+   P               { font-size: 12pt; line-height: 1.2 }
+   P::first-letter { font-size: 200%; font-weight: bold; float: left }
+   SPAN            { text-transform: uppercase }
+  </STYLE>
+ </HEAD>
+ <BODY>
+  <P><SPAN>The first</SPAN> few words of an article
+    in The Economist.</P>
+ </BODY>
+</HTML>
+
+ +

This example might be formatted as follows:

+ +
+

Image illustrating the combined effect of the ::first-letter and ::first-line pseudo-elements

+
+ +

The fictional tag sequence is:

+ +
+<P>
+<SPAN>
+<P::first-letter>
+T
+</P::first-letter>he first
+</SPAN> 
+few words of an article in the Economist.
+</P>
+
+ +

Note that the ::first-letter pseudo-element tags abut +the content (i.e., the initial character), while the ::first-line +pseudo-element start tag is inserted right after the start tag of the +block element.

+ +

In order to achieve traditional drop caps formatting, user agents +may approximate font sizes, for example to align baselines. Also, the +glyph outline may be taken into account when formatting.

+ +

Punctuation (i.e, characters defined in Unicode in the "open" (Ps), +"close" (Pe), "initial" (Pi). "final" (Pf) and "other" (Po) +punctuation classes), that precedes or follows the first letter should +be included. [UNICODE]

+ +
+

Quotes that precede the
+first letter should be included.

+
+ +

The ::first-letter also applies if the first letter is +in fact a digit, e.g., the "6" in "67 million dollars is a lot of +money."

+ +

In CSS, the ::first-letter pseudo-element applies to +block, list-item, table-cell, table-caption, and inline-block +elements. A future version of this specification +may allow this pesudo-element to apply to more element +types.

+ +

The ::first-letter pseudo-element can be used with all +such elements that contain text, or that have a descendant in the same +flow that contains text. A UA should act as if the fictional start tag +of the ::first-letter pseudo-element is just before the first text of +the element, even if that first text is in a descendant.

+ +
+

Example:

+

The fictional tag sequence for this HTMLfragment: +

<div>
+<p>The first text.
+

is: +

<div>
+<p><div::first-letter><p::first-letter>T</...></...>he first text.
+
+ +

The first letter of a table-cell or inline-block cannot be the +first letter of an ancestor element. Thus, in <DIV><P +STYLE="display: inline-block">Hello<BR>Goodbye</P> +etcetera</DIV> the first letter of the div is not the +letter "H". In fact, the div doesn't have a first letter. + +

The first letter must occur on the first formatted line. For example, in +this fragment: <p><br>First... the first line +doesn't contain any letters and ::first-letter doesn't +match anything (assuming the default style for br in HTML +4). In particular, it does not match the "F" of "First." + +

In CSS, if an element is a list item ('display: list-item'), the +::first-letter applies to the first letter in the +principal box after the marker. UAs may ignore +::first-letter on list items with 'list-style-position: +inside'. If an element has ::before or +::after content, the ::first-letter applies +to the first letter of the element including that content. + +

+

Example:

+

After the rule 'p::before {content: "Note: "}', the selector +'p::first-letter' matches the "N" of "Note".

+
+ +

Some languages may have specific rules about how to treat certain +letter combinations. In Dutch, for example, if the letter combination +"ij" appears at the beginning of a word, both letters should be +considered within the ::first-letter pseudo-element. + +

If the letters that would form the ::first-letter are not in the +same element, such as "'T" in <p>'<em>T..., the UA +may create a ::first-letter pseudo-element from one of the elements, +both elements, or simply not create a pseudo-element.

+ +

Similarly, if the first letter(s) of the block are not at the start +of the line (for example due to bidirectional reordering), then the UA +need not create the pseudo-element(s). + +

+

Example:

+

The following example illustrates +how overlapping pseudo-elements may interact. The first letter of +each P element will be green with a font size of '24pt'. The rest of +the first formatted line will be 'blue' while the rest of the +paragraph will be 'red'.

+ +
p { color: red; font-size: 12pt }
+p::first-letter { color: green; font-size: 200% }
+p::first-line { color: blue }
+
+<P>Some text that ends up on two lines</P>
+ +

Assuming that a line break will occur before the word "ends", the +fictional tag +sequence for this fragment might be:

+ +
<P>
+<P::first-line>
+<P::first-letter> 
+S 
+</P::first-letter>ome text that 
+</P::first-line> 
+ends up on two lines 
+</P>
+ +

Note that the ::first-letter element is inside the ::first-line +element. Properties set on ::first-line are inherited by +::first-letter, but are overridden if the same property is set on +::first-letter.

+
+ + +

7.3. The ::selection pseudo-element

+ +

The ::selection pseudo-element applies to the portion +of a document that has been highlighted by the user. This also +applies, for example, to selected text within an editable text +field. This pseudo-element should not be confused with the :checked pseudo-class (which used to be +named :selected) + +

Although the ::selection pseudo-element is dynamic in +nature, and is altered by user action, it is reasonable to expect that +when a UA re-renders to a static medium (such as a printed page, see +[CSS21]) which was originally rendered to a +dynamic medium (like screen), the UA may wish to transfer the current +::selection state to that other medium, and have all the +appropriate formatting and rendering take effect as well. This is not +required — UAs may omit the ::selection +pseudo-element for static media. + +

These are the CSS properties that apply to ::selection +pseudo-elements: color, background, cursor (optional), outline +(optional). The computed value of the 'background-image' property on +::selection may be ignored. + + +

7.4. The ::before and ::after pseudo-elements

+ +

The ::before and ::after pseudo-elements +can be used to describe generated content before or after an element's +content. They are explained in CSS 2.1 [CSS21].

+ +

When the ::first-letter and ::first-line +pseudo-elements are combined with ::before and +::after, they apply to the first letter or line of the +element including the inserted text.

+ +

8. Combinators

+ +

8.1. Descendant combinator

+ +

At times, authors may want selectors to describe an element that is +the descendant of another element in the document tree (e.g., "an +EM element that is contained within an H1 +element"). Descendant combinators express such a relationship. A +descendant combinator is white space that +separates two sequences of simple selectors. A selector of the form +"A B" represents an element B that is an +arbitrary descendant of some ancestor element A. + +

+

Examples:

+

For example, consider the following selector:

+
h1 em
+

It represents an em element being the descendant of + an h1 element. It is a correct and valid, but partial, + description of the following fragment:

+
<h1>This <span class="myclass">headline
+is <em>very</em> important</span></h1>
+

The following selector:

+
div * p
+

represents a p element that is a grandchild or later + descendant of a div element. Note the whitespace on + either side of the "*" is not part of the universal selector; the + whitespace is a combinator indicating that the DIV must be the + ancestor of some element, and that that element must be an ancestor + of the P.

+

The following selector, which combines descendant combinators and + attribute selectors, represents an + element that (1) has the href attribute set and (2) is + inside a p that is itself inside a div:

+
div p *[href]
+
+ +

8.2. Child combinators

+ +

A child combinator describes a childhood relationship +between two elements. A child combinator is made of the +"greater-than sign" (>) character and +separates two sequences of simple selectors. + + +

+

Examples:

+

The following selector represents a p element that is + child of body:

+
body > p
+

The following example combines descendant combinators and child + combinators.

+
div ol>li p
+

It represents a p element that is a descendant of an + li element; the li element must be the + child of an ol element; the ol element must + be a descendant of a div. Notice that the optional white + space around the ">" combinator has been left out.

+
+ +

For information on selecting the first child of an element, please +see the section on the :first-child pseudo-class +above.

+ +

8.3. Sibling combinators

+ +

There are two different sibling combinators: the adjacent sibling +combinator and the general sibling combinator. In both cases, +non-element nodes (e.g. text between elements) are ignored when +considering adjacency of elements.

+ +

8.3.1. Adjacent sibling combinator

+ +

The adjacent sibling combinator is made of the "plus +sign" (U+002B, +) character that separates two +sequences of simple selectors. The elements represented by the two +sequences share the same parent in the document tree and the element +represented by the first sequence immediately precedes the element +represented by the second one.

+ +
+

Examples:

+

The following selector represents a p element + immediately following a math element:

+
math + p
+

The following selector is conceptually similar to the one in the + previous example, except that it adds an attribute selector — it + adds a constraint to the h1 element, that it must have + class="opener":

+
h1.opener + h2
+
+ + +

8.3.2. General sibling combinator

+ +

The general sibling combinator is made of the "tilde" +(U+007E, ~) character that separates two sequences of +simple selectors. The elements represented by the two sequences share +the same parent in the document tree and the element represented by +the first sequence precedes (not necessarily immediately) the element +represented by the second one.

+ +
+

Example:

+
h1 ~ pre
+

represents a pre element following an h1. It + is a correct and valid, but partial, description of:

+
<h1>Definition of the function a</h1>
+<p>Function a(x) has to be applied to all figures in the table.</p>
+<pre>function a(x) = 12x/13.5</pre>
+
+ +

9. Calculating a selector's specificity

+ +

A selector's specificity is calculated as follows:

+ +
    +
  • count the number of ID selectors in the selector (= a)
  • +
  • count the number of class selectors, attributes selectors, and pseudo-classes in the selector (= b)
  • +
  • count the number of element names in the selector (= c)
  • +
  • ignore pseudo-elements
  • +
+ +

Selectors inside the negation pseudo-class +are counted like any other, but the negation itself does not count as +a pseudo-class.

+ +

Concatenating the three numbers a-b-c (in a number system with a +large base) gives the specificity.

+ +
+

Examples:

+
*               /* a=0 b=0 c=0 -> specificity =   0 */
+LI              /* a=0 b=0 c=1 -> specificity =   1 */
+UL LI           /* a=0 b=0 c=2 -> specificity =   2 */
+UL OL+LI        /* a=0 b=0 c=3 -> specificity =   3 */
+H1 + *[REL=up]  /* a=0 b=1 c=1 -> specificity =  11 */
+UL OL LI.red    /* a=0 b=1 c=3 -> specificity =  13 */
+LI.red.level    /* a=0 b=2 c=1 -> specificity =  21 */
+#x34y           /* a=1 b=0 c=0 -> specificity = 100 */
+#s12:not(FOO)   /* a=1 b=0 c=1 -> specificity = 101 */
+
+
+ +

Note: the specificity of the styles +specified in an HTML style attribute is described in CSS +2.1. [CSS21].

+ +

10. The grammar of Selectors

+ +

10.1. Grammar

+ +

The grammar below defines the syntax of Selectors. It is globally +LL(1) and can be locally LL(2) (but note that most UA's should not use +it directly, since it doesn't express the parsing conventions). The +format of the productions is optimized for human consumption and some +shorthand notations beyond Yacc (see [YACC]) +are used:

+ +
    +
  • *: 0 or more +
  • +: 1 or more +
  • ?: 0 or 1 +
  • |: separates alternatives +
  • [ ]: grouping
  • +
+ +

The productions are:

+ +
selectors_group
+  : selector [ COMMA S* selector ]*
+  ;
+
+selector
+  : simple_selector_sequence [ combinator simple_selector_sequence ]*
+  ;
+
+combinator
+  /* combinators can be surrounded by white space */
+  : PLUS S* | GREATER S* | TILDE S* | S+
+  ;
+
+simple_selector_sequence
+  : [ type_selector | universal ]
+    [ HASH | class | attrib | pseudo | negation ]*
+  | [ HASH | class | attrib | pseudo | negation ]+
+  ;
+
+type_selector
+  : [ namespace_prefix ]? element_name
+  ;
+
+namespace_prefix
+  : [ IDENT | '*' ]? '|'
+  ;
+
+element_name
+  : IDENT
+  ;
+
+universal
+  : [ namespace_prefix ]? '*'
+  ;
+
+class
+  : '.' IDENT
+  ;
+
+attrib
+  : '[' S* [ namespace_prefix ]? IDENT S*
+        [ [ PREFIXMATCH |
+            SUFFIXMATCH |
+            SUBSTRINGMATCH |
+            '=' |
+            INCLUDES |
+            DASHMATCH ] S* [ IDENT | STRING ] S*
+        ]? ']'
+  ;
+
+pseudo
+  /* '::' starts a pseudo-element, ':' a pseudo-class */
+  /* Exceptions: :first-line, :first-letter, :before and :after. */
+  /* Note that pseudo-elements are restricted to one per selector and */
+  /* occur only in the last simple_selector_sequence. */
+  : ':' ':'? [ IDENT | functional_pseudo ]
+  ;
+
+functional_pseudo
+  : FUNCTION S* expression ')'
+  ;
+
+expression
+  /* In CSS3, the expressions are identifiers, strings, */
+  /* or of the form "an+b" */
+  : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+
+  ;
+
+negation
+  : NOT S* negation_arg S* ')'
+  ;
+
+negation_arg
+  : type_selector | universal | HASH | class | attrib | pseudo
+  ;
+ + +

10.2. Lexical scanner

+ +

The following is the tokenizer, written in Flex (see +[FLEX]) notation. The tokenizer is +case-insensitive.

+ +

The two occurrences of "\377" represent the highest character +number that current versions of Flex can deal with (decimal 255). They +should be read as "\4177777" (decimal 1114111), which is the highest +possible code point in Unicode/ISO-10646. [UNICODE]

+ +
%option case-insensitive
+
+ident     [-]?{nmstart}{nmchar}*
+name      {nmchar}+
+nmstart   [_a-z]|{nonascii}|{escape}
+nonascii  [^\0-\177]
+unicode   \\[0-9a-f]{1,6}(\r\n|[ \n\r\t\f])?
+escape    {unicode}|\\[^\n\r\f0-9a-f]
+nmchar    [_a-z0-9-]|{nonascii}|{escape}
+num       [0-9]+|[0-9]*\.[0-9]+
+string    {string1}|{string2}
+string1   \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*\"
+string2   \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*\'
+invalid   {invalid1}|{invalid2}
+invalid1  \"([^\n\r\f\\"]|\\{nl}|{nonascii}|{escape})*
+invalid2  \'([^\n\r\f\\']|\\{nl}|{nonascii}|{escape})*
+nl        \n|\r\n|\r|\f
+w         [ \t\r\n\f]*
+
+%%
+
+[ \t\r\n\f]+     return S;
+
+"~="             return INCLUDES;
+"|="             return DASHMATCH;
+"^="             return PREFIXMATCH;
+"$="             return SUFFIXMATCH;
+"*="             return SUBSTRINGMATCH;
+{ident}          return IDENT;
+{string}         return STRING;
+{ident}"("       return FUNCTION;
+{num}            return NUMBER;
+"#"{name}        return HASH;
+{w}"+"           return PLUS;
+{w}">"           return GREATER;
+{w}","           return COMMA;
+{w}"~"           return TILDE;
+":not("          return NOT;
+@{ident}         return ATKEYWORD;
+{invalid}        return INVALID;
+{num}%           return PERCENTAGE;
+{num}{ident}     return DIMENSION;
+"<!--"           return CDO;
+"-->"            return CDC;
+
+"url("{w}{string}{w}")"                           return URI;
+"url("{w}([!#$%&*-~]|{nonascii}|{escape})*{w}")"  return URI;
+U\+[0-9a-f?]{1,6}(-[0-9a-f]{1,6})?                return UNICODE_RANGE;
+
+\/\*[^*]*\*+([^/*][^*]*\*+)*\/                    /* ignore comments */
+
+.                return *yytext;
+ + + +

11. Namespaces and down-level clients

+ +

An important issue is the interaction of CSS selectors with XML +documents in web clients that were produced prior to this +document. Unfortunately, due to the fact that namespaces must be +matched based on the URI which identifies the namespace, not the +namespace prefix, some mechanism is required to identify namespaces in +CSS by their URI as well. Without such a mechanism, it is impossible +to construct a CSS style sheet which will properly match selectors in +all cases against a random set of XML documents. However, given +complete knowledge of the XML document to which a style sheet is to be +applied, and a limited use of namespaces within the XML document, it +is possible to construct a style sheet in which selectors would match +elements and attributes correctly.

+ +

It should be noted that a down-level CSS client will (if it +properly conforms to CSS forward compatible parsing rules) ignore all +@namespace at-rules, as well as all style rules that make +use of namespace qualified element type or attribute selectors. The +syntax of delimiting namespace prefixes in CSS was deliberately chosen +so that down-level CSS clients would ignore the style rules rather +than possibly match them incorrectly.

+ +

The use of default namespaces in CSS makes it possible to write +element type selectors that will function in both namespace aware CSS +clients as well as down-level clients. It should be noted that +down-level clients may incorrectly match selectors against XML +elements in other namespaces.

+ +

The following are scenarios and examples in which it is possible to +construct style sheets which would function properly in web clients +that do not implement this proposal.

+ +
    +
  1. + +

    The XML document does not use namespaces.

    + +
      + +
    • In this case, it is obviously not necessary to declare or use + namespaces in the style sheet. Standard CSS element type and + attribute selectors will function adequately in a down-level + client.
    • + +
    • In a CSS namespace aware client, the default behavior of + element selectors matching without regard to namespace will + function properly against all elements, since no namespaces are + present. However, the use of specific element type selectors that + match only elements that have no namespace ("|name") + will guarantee that selectors will match only XML elements that do + not have a declared namespace.
    • + +
    + +
  2. + +
  3. + +

    The XML document defines a single, default namespace used + throughout the document. No namespace prefixes are used in element + names.

    + +
      + +
    • In this case, a down-level client will function as if + namespaces were not used in the XML document at all. Standard CSS + element type and attribute selectors will match against all + elements.
    • + +
    + +
  4. + +
  5. + +

    The XML document does not use a default namespace, all + namespace prefixes used are known to the style sheet author, and + there is a direct mapping between namespace prefixes and namespace + URIs. (A given prefix may only be mapped to one namespace URI + throughout the XML document; there may be multiple prefixes mapped + to the same URI).

    + +
      + +
    • In this case, the down-level client will view and match + element type and attribute selectors based on their fully + qualified name, not the local part as outlined in the Type selectors and Namespaces section. CSS + selectors may be declared using an escaped colon "\:" + to describe the fully qualified names, e.g. + "html\:h1" will match + <html:h1>. Selectors using the qualified name + will only match XML elements that use the same prefix. Other + namespace prefixes used in the XML that are mapped to the same URI + will not match as expected unless additional CSS style rules are + declared for them.
    • + +
    • Note that selectors declared in this fashion will + only match in down-level clients. A CSS namespace aware + client will match element type and attribute selectors based on + the name's local part. Selectors declared with the fully + qualified name will not match (unless there is no namespace prefix + in the fully qualified name).
    • + +
    + +
  6. + +
+ +

In other scenarios: when the namespace prefixes used in the XML are +not known in advance by the style sheet author; or a combination of +elements with no namespace are used in conjunction with elements using +a default namespace; or the same namespace prefix is mapped to +different namespace URIs within the same document, or in +different documents; it is impossible to construct a CSS style sheet +that will function properly against all elements in those documents, +unless, the style sheet is written using a namespace URI syntax (as +outlined in this document or similar) and the document is processed by +a CSS and XML namespace aware client.

+ +

12. Profiles

+ +

Each specification using Selectors must define the subset of W3C +Selectors it allows and excludes, and describe the local meaning of +all the components of that subset.

+ +

Non normative examples: + +

+ + + + + + + + + + + + + + + +
Selectors profile
SpecificationCSS level 1
Acceptstype selectors
class selectors
ID selectors
:link, + :visited and :active pseudo-classes
descendant combinator +
::first-line and ::first-letter pseudo-elements
Excludes + +

universal selector
attribute selectors
:hover and :focus + pseudo-classes
:target pseudo-class
:lang() pseudo-class
all UI + element states pseudo-classes
all structural + pseudo-classes
negation pseudo-class
all + UI element fragments pseudo-elements
::before and ::after + pseudo-elements
child combinators
sibling combinators + +

namespaces

Extra constraintsonly one class selector allowed per sequence of simple + selectors


+ + + + + + + + + + + + + + + +
Selectors profile
SpecificationCSS level 2
Acceptstype selectors
universal selector
attribute presence and + values selectors
class selectors
ID selectors
:link, :visited, + :active, :hover, :focus, :lang() and :first-child pseudo-classes +
descendant combinator
child combinator
adjacent sibling + combinator
::first-line and ::first-letter pseudo-elements
::before + and ::after pseudo-elements
Excludes + +

content selectors
substring matching attribute + selectors
:target pseudo-classes
all UI element + states pseudo-classes
all structural pseudo-classes other + than :first-child
negation pseudo-class
all UI element + fragments pseudo-elements
general sibling combinators + +

namespaces

Extra constraintsmore than one class selector per sequence of simple selectors (CSS1 + constraint) allowed
+ +

In CSS, selectors express pattern matching rules that determine which style +rules apply to elements in the document tree. + +

The following selector (CSS level 2) will match all anchors a +with attribute name set inside a section 1 header h1: +

h1 a[name]
+ +

All CSS declarations attached to such a selector are applied to elements +matching it.

+ +
+ + + + + + + + + + + + + + + + +
Selectors profile
SpecificationSTTS 3
Accepts + +

type selectors
universal selectors
attribute selectors
class + selectors
ID selectors
all structural pseudo-classes
+ all combinators + +

namespaces

Excludesnon-accepted pseudo-classes
pseudo-elements
Extra constraintssome selectors and combinators are not allowed in fragment + descriptions on the right side of STTS declarations.
+ +

Selectors can be used in STTS 3 in two different + manners: +

    +
  1. a selection mechanism equivalent to CSS selection mechanism: declarations + attached to a given selector are applied to elements matching that selector, +
  2. fragment descriptions that appear on the right side of declarations. +
+ +

13. Conformance and requirements

+ +

This section defines conformance with the present specification only. + +

The inability of a user agent to implement part of this specification due to +the limitations of a particular device (e.g., non interactive user agents will +probably not implement dynamic pseudo-classes because they make no sense without +interactivity) does not imply non-conformance. + +

All specifications reusing Selectors must contain a Profile listing the +subset of Selectors it accepts or excludes, and describing the constraints +it adds to the current specification. + +

Invalidity is caused by a parsing error, e.g. an unrecognized token or a token +which is not allowed at the current parsing point. + +

User agents must observe the rules for handling parsing errors: +

    +
  • a simple selector containing an undeclared namespace prefix is invalid
  • +
  • a selector containing an invalid simple selector, an invalid combinator + or an invalid token is invalid.
  • +
  • a group of selectors containing an invalid selector is invalid.
  • +
+ +

Specifications reusing Selectors must define how to handle parsing +errors. (In the case of CSS, the entire rule in which the selector is +used is dropped.)

+ + + +

14. Tests

+ +

This specification has a test +suite allowing user agents to verify their basic conformance to +the specification. This test suite does not pretend to be exhaustive +and does not cover all possible combined cases of Selectors.

+ +

15. Acknowledgements

+ +

The CSS working group would like to thank everyone who has sent +comments on this specification over the years.

+ +

The working group would like to extend special thanks to Donna +McManus, Justin Baker, Joel Sklar, and Molly Ives Brower who perfermed +the final editorial review.

+ +

16. References

+ +
+ +
[CSS1] +
Bert Bos, Håkon Wium Lie; "Cascading Style Sheets, level 1", W3C Recommendation, 17 Dec 1996, revised 11 Jan 1999 +
(http://www.w3.org/TR/REC-CSS1) + +
[CSS21] +
Bert Bos, Tantek Çelik, Ian Hickson, Håkon Wium Lie, editors; "Cascading Style Sheets, level 2 revision 1", W3C Working Draft, 13 June 2005 +
(http://www.w3.org/TR/CSS21) + +
[CWWW] +
Martin J. Dürst, François Yergeau, Misha Wolf, Asmus Freytag, Tex Texin, editors; "Character Model for the World Wide Web", W3C Recommendation, 15 February 2005 +
(http://www.w3.org/TR/charmod/) + +
[FLEX] +
"Flex: The Lexical Scanner Generator", Version 2.3.7, ISBN 1882114213 + +
[HTML4] +
Dave Ragget, Arnaud Le Hors, Ian Jacobs, editors; "HTML 4.01 Specification", W3C Recommendation, 24 December 1999 +
(http://www.w3.org/TR/html4/) + +
[MATH] +
Patrick Ion, Robert Miner, editors; "Mathematical Markup Language (MathML) 1.01", W3C Recommendation, revision of 7 July 1999 +
(http://www.w3.org/TR/REC-MathML/) + +
[RFC3066] +
H. Alvestrand; "Tags for the Identification of Languages", Request for Comments 3066, January 2001 +
(http://www.ietf.org/rfc/rfc3066.txt) + +
[STTS] +
Daniel Glazman; "Simple Tree Transformation Sheets 3", Electricité de France, submission to the W3C, 11 November 1998 +
(http://www.w3.org/TR/NOTE-STTS3) + +
[SVG] +
Jon Ferraiolo, 藤沢 淳, Dean Jackson, editors; "Scalable Vector Graphics (SVG) 1.1 Specification", W3C Recommendation, 14 January 2003 +
(http://www.w3.org/TR/SVG/) + +
[UNICODE]
+
The Unicode Standard, Version 4.1, The Unicode Consortium. Boston, MA, Addison-Wesley, March 2005. ISBN 0-321-18578-1, as amended by Unicode 4.0.1 and Unicode 4.1.0. +
(http://www.unicode.org/versions/)
+ +
[XML10] +
Tim Bray, Jean Paoli, C. M. Sperberg-McQueen, Eve Maler, François Yergeau, editors; "Extensible Markup Language (XML) 1.0 (Third Edition)", W3C Recommendation, 4 February 2004 +
(http://www.w3.org/TR/REC-xml/) + +
[XMLNAMES] +
Tim Bray, Dave Hollander, Andrew Layman, editors; "Namespaces in XML", W3C Recommendation, 14 January 1999 +
(http://www.w3.org/TR/REC-xml-names/) + +
[YACC] +
S. C. Johnson; "YACC — Yet another compiler compiler", Technical Report, Murray Hill, 1975 + +
+ + + diff --git a/src/gquery/public/GQueryDemo.html b/src/gquery/public/GQueryDemo.html new file mode 100644 index 00000000..03323360 --- /dev/null +++ b/src/gquery/public/GQueryDemo.html @@ -0,0 +1,34 @@ + + + GQuery Demo + + + + +

+ Short example of how to do animated powerpoint-like slides with GQuery Effects + module. +

+
+ Slide 1 +
    +
  • jQuery is
  • +
  • such a
  • +
  • Cool Library
  • +
+
+
+ Slide 2 +
    +
  • Now GWT
  • +
  • has a
  • +
  • jQuery-like API Too!
  • +
  • GwtQuery Rocks!
  • +
+
+ + + \ No newline at end of file diff --git a/src/gquery/public/GQuerySample.html b/src/gquery/public/GQuerySample.html new file mode 100644 index 00000000..32e9772a --- /dev/null +++ b/src/gquery/public/GQuerySample.html @@ -0,0 +1,10 @@ + + + GQuery Demo + + + +
Foo bar baz
+ + + \ No newline at end of file diff --git a/src/gquery/public/ext-all.js b/src/gquery/public/ext-all.js new file mode 100644 index 00000000..862e75f3 --- /dev/null +++ b/src/gquery/public/ext-all.js @@ -0,0 +1,157 @@ +/* + * Ext JS Library 2.0.2 + * Copyright(c) 2006-2008, Ext JS, LLC. + * licensing@extjs.com + * + * http://extjs.com/license + */ + +Ext.DomHelper=function(){var L=null;var F=/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;var B=/^table|tbody|tr|td$/i;var A=function(T){if(typeof T=="string"){return T}var O="";if(Ext.isArray(T)){for(var R=0,P=T.length;R"}else{O+=">";var U=T.children||T.cn;if(U){O+=A(U)}else{if(T.html){O+=T.html}}O+=""}return O};var M=function(T,O){var S;if(Ext.isArray(T)){S=document.createDocumentFragment();for(var R=0,P=T.length;R",K=""+E,H=C+"",D=""+K;var G=function(N,O,Q,P){if(!L){L=document.createElement("div")}var R;var S=null;if(N=="td"){if(O=="afterbegin"||O=="beforeend"){return }if(O=="beforebegin"){S=Q;Q=Q.parentNode}else{S=Q.nextSibling;Q=Q.parentNode}R=I(4,H,P,D)}else{if(N=="tr"){if(O=="beforebegin"){S=Q;Q=Q.parentNode;R=I(3,C,P,K)}else{if(O=="afterend"){S=Q.nextSibling;Q=Q.parentNode;R=I(3,C,P,K)}else{if(O=="afterbegin"){S=Q.firstChild}R=I(4,H,P,D)}}}else{if(N=="tbody"){if(O=="beforebegin"){S=Q;Q=Q.parentNode;R=I(2,J,P,E)}else{if(O=="afterend"){S=Q.nextSibling;Q=Q.parentNode;R=I(2,J,P,E)}else{if(O=="afterbegin"){S=Q.firstChild}R=I(3,C,P,K)}}}else{if(O=="beforebegin"||O=="afterend"){return }if(O=="afterbegin"){S=Q.firstChild}R=I(2,J,P,E)}}}Q.insertBefore(R,S);return R};return{useDom:false,markup:function(N){return A(N)},applyStyles:function(P,Q){if(Q){P=Ext.fly(P);if(typeof Q=="string"){var O=/\s?([a-z\-]*)\:\s?([^;]*);?/gi;var R;while((R=O.exec(Q))!=null){P.setStyle(R[1],R[2])}}else{if(typeof Q=="object"){for(var N in Q){P.setStyle(N,Q[N])}}else{if(typeof Q=="function"){Ext.DomHelper.applyStyles(P,Q.call())}}}}},insertHtml:function(P,R,Q){P=P.toLowerCase();if(R.insertAdjacentHTML){if(B.test(R.tagName)){var O;if(O=G(R.tagName.toLowerCase(),P,R,Q)){return O}}switch(P){case"beforebegin":R.insertAdjacentHTML("BeforeBegin",Q);return R.previousSibling;case"afterbegin":R.insertAdjacentHTML("AfterBegin",Q);return R.firstChild;case"beforeend":R.insertAdjacentHTML("BeforeEnd",Q);return R.lastChild;case"afterend":R.insertAdjacentHTML("AfterEnd",Q);return R.nextSibling}throw"Illegal insertion point -> \""+P+"\""}var N=R.ownerDocument.createRange();var S;switch(P){case"beforebegin":N.setStartBefore(R);S=N.createContextualFragment(Q);R.parentNode.insertBefore(S,R);return R.previousSibling;case"afterbegin":if(R.firstChild){N.setStartBefore(R.firstChild);S=N.createContextualFragment(Q);R.insertBefore(S,R.firstChild);return R.firstChild}else{R.innerHTML=Q;return R.firstChild}case"beforeend":if(R.lastChild){N.setStartAfter(R.lastChild);S=N.createContextualFragment(Q);R.appendChild(S);return R.lastChild}else{R.innerHTML=Q;return R.lastChild}case"afterend":N.setStartAfter(R);S=N.createContextualFragment(Q);R.parentNode.insertBefore(S,R.nextSibling);return R.nextSibling}throw"Illegal insertion point -> \""+P+"\""},insertBefore:function(N,P,O){return this.doInsert(N,P,O,"beforeBegin")},insertAfter:function(N,P,O){return this.doInsert(N,P,O,"afterEnd","nextSibling")},insertFirst:function(N,P,O){return this.doInsert(N,P,O,"afterBegin","firstChild")},doInsert:function(Q,S,R,T,P){Q=Ext.getDom(Q);var O;if(this.useDom){O=M(S,null);(P==="firstChild"?Q:Q.parentNode).insertBefore(O,P?Q[P]:Q)}else{var N=A(S);O=this.insertHtml(T,Q,N)}return R?Ext.get(O,true):O},append:function(P,R,Q){P=Ext.getDom(P);var O;if(this.useDom){O=M(R,null);P.appendChild(O)}else{var N=A(R);O=this.insertHtml("beforeEnd",P,N)}return Q?Ext.get(O,true):O},overwrite:function(N,P,O){N=Ext.getDom(N);N.innerHTML=A(P);return O?Ext.get(N.firstChild,true):N.firstChild},createTemplate:function(O){var N=A(O);return new Ext.Template(N)}}}(); +Ext.Template=function(E){var B=arguments;if(Ext.isArray(E)){E=E.join("")}else{if(B.length>1){var C=[];for(var D=0,A=B.length;D+~]\s?|\s|$)/;var tagTokenRe=/^(#)?([\w-\*]+)/;var nthRe=/(\d*)n\+?(\d*)/,nthRe2=/\D/;function child(p,index){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==index){return n}}n=n.nextSibling}return null}function next(n){while((n=n.nextSibling)&&n.nodeType!=1){}return n}function prev(n){while((n=n.previousSibling)&&n.nodeType!=1){}return n}function children(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!nonSpace.test(n.nodeValue)){d.removeChild(n)}else{n.nodeIndex=++ni}n=nx}return this}function byClassName(c,a,v){if(!v){return c}var r=[],ri=-1,cn;for(var i=0,ci;ci=c[i];i++){if((" "+ci.className+" ").indexOf(v)!=-1){r[++ri]=ci}}return r}function attrValue(n,attr){if(!n.tagName&&typeof n.length!="undefined"){n=n[0]}if(!n){return null}if(attr=="for"){return n.htmlFor}if(attr=="class"||attr=="className"){return n.className}return n.getAttribute(attr)||n[attr]}function getNodes(ns,mode,tagName){var result=[],ri=-1,cs;if(!ns){return result}tagName=tagName||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns]}if(!mode){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(tagName);for(var j=0,ci;ci=cs[j];j++){result[++ri]=ci}}}else{if(mode=="/"||mode==">"){var utag=tagName.toUpperCase();for(var i=0,ni,cn;ni=ns[i];i++){cn=ni.children||ni.childNodes;for(var j=0,cj;cj=cn[j];j++){if(cj.nodeName==utag||cj.nodeName==tagName||tagName=="*"){result[++ri]=cj}}}}else{if(mode=="+"){var utag=tagName.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(n&&(n.nodeName==utag||n.nodeName==tagName||tagName=="*")){result[++ri]=n}}}else{if(mode=="~"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&(n.nodeType!=1||(tagName=="*"||n.tagName.toLowerCase()!=tagName))){}if(n){result[++ri]=n}}}}}}return result}function concat(a,b){if(b.slice){return a.concat(b)}for(var i=0,l=b.length;i1){return nodup(results)}return results},selectNode:function(path,root){return Ext.DomQuery.select(path,root)[0]},selectValue:function(path,root,defaultValue){path=path.replace(trimRe,"");if(!valueCache[path]){valueCache[path]=Ext.DomQuery.compile(path,"select")}var n=valueCache[path](root);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return((v===null||v===undefined||v==="")?defaultValue:v)},selectNumber:function(path,root,defaultValue){var v=Ext.DomQuery.selectValue(path,root,defaultValue||0);return parseFloat(v)},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el)}var isArray=Ext.isArray(el);var result=Ext.DomQuery.filter(isArray?el:[el],ss);return isArray?(result.length==el.length):(result.length>0)},filter:function(els,ss,nonMatches){ss=ss.replace(trimRe,"");if(!simpleCache[ss]){simpleCache[ss]=Ext.DomQuery.compile(ss,"simple")}var result=simpleCache[ss](els);return nonMatches?quickDiff(result,els):result},matchers:[{re:/^\.([\w-]+)/,select:"n = byClassName(n, null, \" {1} \");"},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:"n = byPseudo(n, \"{1}\", \"{2}\");"},{re:/^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,select:"n = byAttribute(n, \"{2}\", \"{4}\", \"{3}\", \"{1}\");"},{re:/^#([\w-]+)/,select:"n = byId(n, null, \"{1}\");"},{re:/^@([\w-]+)/,select:"return {firstChild:{nodeValue:attrValue(n, \"{1}\")}};"}],operators:{"=":function(a,v){return a==v},"!=":function(a,v){return a!=v},"^=":function(a,v){return a&&a.substr(0,v.length)==v},"$=":function(a,v){return a&&a.substr(a.length-v.length)==v},"*=":function(a,v){return a&&a.indexOf(v)!==-1},"%=":function(a,v){return(a%v)==0},"|=":function(a,v){return a&&(a==v||a.substr(0,v.length+1)==v+"-")},"~=":function(a,v){return a&&(" "+a+" ").indexOf(" "+v+" ")!=-1}},pseudos:{"first-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.previousSibling)&&n.nodeType!=1){}if(!n){r[++ri]=ci}}return r},"last-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(!n){r[++ri]=ci}}return r},"nth-child":function(c,a){var r=[],ri=-1;var m=nthRe.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!nthRe2.test(a)&&"n+"+a||a);var f=(m[1]||1)-0,l=m[2]-0;for(var i=0,n;n=c[i];i++){var pn=n.parentNode;if(batch!=pn._batch){var j=0;for(var cn=pn.firstChild;cn;cn=cn.nextSibling){if(cn.nodeType==1){cn.nodeIndex=++j}}pn._batch=batch}if(f==1){if(l==0||n.nodeIndex==l){r[++ri]=n}}else{if((n.nodeIndex+l)%f==0){r[++ri]=n}}}return r},"only-child":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(!prev(ci)&&!next(ci)){r[++ri]=ci}}return r},"empty":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var cns=ci.childNodes,j=0,cn,empty=true;while(cn=cns[j]){++j;if(cn.nodeType==1||cn.nodeType==3){empty=false;break}}if(empty){r[++ri]=ci}}return r},"contains":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if((ci.textContent||ci.innerText||"").indexOf(v)!=-1){r[++ri]=ci}}return r},"nodeValue":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.firstChild&&ci.firstChild.nodeValue==v){r[++ri]=ci}}return r},"checked":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.checked==true){r[++ri]=ci}}return r},"not":function(c,ss){return Ext.DomQuery.filter(c,ss,true)},"any":function(c,selectors){var ss=selectors.split("|");var r=[],ri=-1,s;for(var i=0,ci;ci=c[i];i++){for(var j=0;s=ss[j];j++){if(Ext.DomQuery.is(ci,s)){r[++ri]=ci;break}}}return r},"odd":function(c){return this["nth-child"](c,"odd")},"even":function(c){return this["nth-child"](c,"even")},"nth":function(c,a){return c[a-1]||[]},"first":function(c){return c[0]||[]},"last":function(c){return c[c.length-1]||[]},"has":function(c,ss){var s=Ext.DomQuery.select;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(s(ss,ci).length>0){r[++ri]=ci}}return r},"next":function(c,ss){var is=Ext.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=next(ci);if(n&&is(n,ss)){r[++ri]=ci}}return r},"prev":function(c,ss){var is=Ext.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=prev(ci);if(n&&is(n,ss)){r[++ri]=ci}}return r}}}}();Ext.query=Ext.DomQuery.select; +Ext.util.Observable=function(){if(this.listeners){this.on(this.listeners);delete this.listeners}};Ext.util.Observable.prototype={fireEvent:function(){if(this.eventsSuspended!==true){var A=this.events[arguments[0].toLowerCase()];if(typeof A=="object"){return A.fire.apply(A,Array.prototype.slice.call(arguments,1))}}return true},filterOptRe:/^(?:scope|delay|buffer|single)$/,addListener:function(A,C,B,F){if(typeof A=="object"){F=A;for(var E in F){if(this.filterOptRe.test(E)){continue}if(typeof F[E]=="function"){this.addListener(E,F[E],F.scope,F)}else{this.addListener(E,F[E].fn,F[E].scope,F[E])}}return }F=(!F||typeof F=="boolean")?{}:F;A=A.toLowerCase();var D=this.events[A]||true;if(typeof D=="boolean"){D=new Ext.util.Event(this,A);this.events[A]=D}D.addListener(C,B,F)},removeListener:function(A,C,B){var D=this.events[A.toLowerCase()];if(typeof D=="object"){D.removeListener(C,B)}},purgeListeners:function(){for(var A in this.events){if(typeof this.events[A]=="object"){this.events[A].clearListeners()}}},relayEvents:function(F,D){var E=function(G){return function(){return this.fireEvent.apply(this,Ext.combine(G,Array.prototype.slice.call(arguments,0)))}};for(var C=0,A=D.length;C0},suspendEvents:function(){this.eventsSuspended=true},resumeEvents:function(){this.eventsSuspended=false},getMethodEvent:function(G){if(!this.methodEvents){this.methodEvents={}}var F=this.methodEvents[G];if(!F){F={};this.methodEvents[G]=F;F.originalFn=this[G];F.methodName=G;F.before=[];F.after=[];var C,B,D;var E=this;var A=function(J,I,H){if((B=J.apply(I||E,H))!==undefined){if(typeof B==="object"){if(B.returnValue!==undefined){C=B.returnValue}else{C=B}if(B.cancel===true){D=true}}else{if(B===false){D=true}else{C=B}}}};this[G]=function(){C=B=undefined;D=false;var I=Array.prototype.slice.call(arguments,0);for(var J=0,H=F.before.length;J0){this.firing=true;var G=Array.prototype.slice.call(arguments,0);for(var H=0;H");var D=document.getElementById("ie-deferred-loader");D.onreadystatechange=function(){if(this.readyState=="complete"){B()}}}else{if(Ext.isSafari){M=setInterval(function(){var E=document.readyState;if(E=="complete"){B()}},10)}}}L.on(window,"load",B)};var R=function(E,U){var D=new Ext.util.DelayedTask(E);return function(V){V=new Ext.EventObjectImpl(V);D.delay(U.buffer,E,null,[V])}};var P=function(V,U,D,E){return function(W){Ext.EventManager.removeListener(U,D,E);V(W)}};var F=function(D,E){return function(U){U=new Ext.EventObjectImpl(U);setTimeout(function(){D(U)},E.delay||10)}};var J=function(U,E,D,Y,X){var Z=(!D||typeof D=="boolean")?{}:D;Y=Y||Z.fn;X=X||Z.scope;var W=Ext.getDom(U);if(!W){throw"Error listening for \""+E+"\". Element \""+U+"\" doesn't exist."}var V=function(b){b=Ext.EventObject.setEvent(b);var a;if(Z.delegate){a=b.getTarget(Z.delegate,W);if(!a){return }}else{a=b.target}if(Z.stopEvent===true){b.stopEvent()}if(Z.preventDefault===true){b.preventDefault()}if(Z.stopPropagation===true){b.stopPropagation()}if(Z.normalized===false){b=b.browserEvent}Y.call(X||W,b,a,Z)};if(Z.delay){V=F(V,Z)}if(Z.single){V=P(V,W,E,Y)}if(Z.buffer){V=R(V,Z)}Y._handlers=Y._handlers||[];Y._handlers.push([Ext.id(W),E,V]);L.on(W,E,V);if(E=="mousewheel"&&W.addEventListener){W.addEventListener("DOMMouseScroll",V,false);L.on(window,"unload",function(){W.removeEventListener("DOMMouseScroll",V,false)})}if(E=="mousedown"&&W==document){Ext.EventManager.stoppedMouseDownEvent.addListener(V)}return V};var G=function(E,U,Z){var D=Ext.id(E),a=Z._handlers,X=Z;if(a){for(var V=0,Y=a.length;V=33&&D<=40)||D==this.RETURN||D==this.TAB||D==this.ESC},isSpecialKey:function(){var D=this.keyCode;return(this.type=="keypress"&&this.ctrlKey)||D==9||D==13||D==40||D==27||(D==16)||(D==17)||(D>=18&&D<=20)||(D>=33&&D<=35)||(D>=36&&D<=39)||(D>=44&&D<=45)},stopPropagation:function(){if(this.browserEvent){if(this.browserEvent.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(this)}B.stopPropagation(this.browserEvent)}},getCharCode:function(){return this.charCode||this.keyCode},getKey:function(){var D=this.keyCode||this.charCode;return Ext.isSafari?(A[D]||D):D},getPageX:function(){return this.xy[0]},getPageY:function(){return this.xy[1]},getTime:function(){if(this.browserEvent){return B.getTime(this.browserEvent)}return null},getXY:function(){return this.xy},getTarget:function(E,G,D){var F=Ext.get(this.target);return E?F.findParent(E,G,D):(D?F:this.target)},getRelatedTarget:function(){if(this.browserEvent){return B.getRelatedTarget(this.browserEvent)}return null},getWheelDelta:function(){var D=this.browserEvent;var E=0;if(D.wheelDelta){E=D.wheelDelta/120}else{if(D.detail){E=-D.detail/3}}return E},hasModifier:function(){return((this.ctrlKey||this.altKey)||this.shiftKey)?true:false},within:function(E,F){var D=this[F?"getRelatedTarget":"getTarget"]();return D&&Ext.fly(E).contains(D)},getPoint:function(){return new Ext.lib.Point(this.xy[0],this.xy[1])}};return new Ext.EventObjectImpl()}(); +(function(){var D=Ext.lib.Dom;var E=Ext.lib.Event;var A=Ext.lib.Anim;var propCache={};var camelRe=/(-[a-z])/gi;var camelFn=function(m,a){return a.charAt(1).toUpperCase()};var view=document.defaultView;Ext.Element=function(element,forceNew){var dom=typeof element=="string"?document.getElementById(element):element;if(!dom){return null}var id=dom.id;if(forceNew!==true&&id&&Ext.Element.cache[id]){return Ext.Element.cache[id]}this.dom=dom;this.id=id||Ext.id(dom)};var El=Ext.Element;El.prototype={originalDisplay:"",visibilityMode:1,defaultUnit:"px",setVisibilityMode:function(visMode){this.visibilityMode=visMode;return this},enableDisplayMode:function(display){this.setVisibilityMode(El.DISPLAY);if(typeof display!="undefined"){this.originalDisplay=display}return this},findParent:function(simpleSelector,maxDepth,returnEl){var p=this.dom,b=document.body,depth=0,dq=Ext.DomQuery,stopEl;maxDepth=maxDepth||50;if(typeof maxDepth!="number"){stopEl=Ext.getDom(maxDepth);maxDepth=10}while(p&&p.nodeType==1&&depthch||tcb){c.scrollTop=b-ch}}c.scrollTop=c.scrollTop;if(hscroll!==false){if(el.offsetWidth>c.clientWidth||lcr){c.scrollLeft=r-c.clientWidth}}c.scrollLeft=c.scrollLeft}return this},scrollChildIntoView:function(child,hscroll){Ext.fly(child,"_scrollChildIntoView").scrollIntoView(this,hscroll)},autoHeight:function(animate,duration,onComplete,easing){var oldHeight=this.getHeight();this.clip();this.setHeight(1);setTimeout(function(){var height=parseInt(this.dom.scrollHeight,10);if(!animate){this.setHeight(height);this.unclip();if(typeof onComplete=="function"){onComplete()}}else{this.setHeight(oldHeight);this.setHeight(height,animate,duration,function(){this.unclip();if(typeof onComplete=="function"){onComplete()}}.createDelegate(this),easing)}}.createDelegate(this),0);return this},contains:function(el){if(!el){return false}return D.isAncestor(this.dom,el.dom?el.dom:el)},isVisible:function(deep){var vis=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none");if(deep!==true||!vis){return vis}var p=this.dom.parentNode;while(p&&p.tagName.toLowerCase()!="body"){if(!Ext.fly(p,"_isVisible").isVisible()){return false}p=p.parentNode}return true},select:function(selector,unique){return El.select(selector,unique,this.dom)},query:function(selector,unique){return Ext.DomQuery.select(selector,this.dom)},child:function(selector,returnDom){var n=Ext.DomQuery.selectNode(selector,this.dom);return returnDom?n:Ext.get(n)},down:function(selector,returnDom){var n=Ext.DomQuery.selectNode(" > "+selector,this.dom);return returnDom?n:Ext.get(n)},initDD:function(group,config,overrides){var dd=new Ext.dd.DD(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides)},initDDProxy:function(group,config,overrides){var dd=new Ext.dd.DDProxy(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides)},initDDTarget:function(group,config,overrides){var dd=new Ext.dd.DDTarget(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides)},setVisible:function(visible,animate){if(!animate||!A){if(this.visibilityMode==El.DISPLAY){this.setDisplayed(visible)}else{this.fixDisplay();this.dom.style.visibility=visible?"visible":"hidden"}}else{var dom=this.dom;var visMode=this.visibilityMode;if(visible){this.setOpacity(0.01);this.setVisible(true)}this.anim({opacity:{to:(visible?1:0)}},this.preanim(arguments,1),null,0.35,"easeIn",function(){if(!visible){if(visMode==El.DISPLAY){dom.style.display="none"}else{dom.style.visibility="hidden"}Ext.get(dom).setOpacity(1)}})}return this},isDisplayed:function(){return this.getStyle("display")!="none"},toggle:function(animate){this.setVisible(!this.isVisible(),this.preanim(arguments,0));return this},setDisplayed:function(value){if(typeof value=="boolean"){value=value?this.originalDisplay:"none"}this.setStyle("display",value);return this},focus:function(){try{this.dom.focus()}catch(e){}return this},blur:function(){try{this.dom.blur()}catch(e){}return this},addClass:function(className){if(Ext.isArray(className)){for(var i=0,len=className.length;idw+scrollX){x=swapX?r.left-w:dw+scrollX-w}if(xdh+scrollY){y=swapY?r.top-h:dh+scrollY-h}if(yvr){x=vr-w;moved=true}if((y+h)>vb){y=vb-h;moved=true}if(x";E.onAvailable(id,function(){var hd=document.getElementsByTagName("head")[0];var re=/(?:]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;var srcRe=/\ssrc=([\'\"])(.*?)\1/i;var typeRe=/\stype=([\'\"])(.*?)\1/i;var match;while(match=re.exec(html)){var attrs=match[1];var srcMatch=attrs?attrs.match(srcRe):false;if(srcMatch&&srcMatch[2]){var s=document.createElement("script");s.src=srcMatch[2];var typeMatch=attrs.match(typeRe);if(typeMatch&&typeMatch[2]){s.type=typeMatch[2]}hd.appendChild(s)}else{if(match[2]&&match[2].length>0){if(window.execScript){window.execScript(match[2])}else{window.eval(match[2])}}}}var el=document.getElementById(id);if(el){Ext.removeNode(el)}if(typeof callback=="function"){callback()}});dom.innerHTML=html.replace(/(?:)((\n|\r|.)*?)(?:<\/script>)/ig,"");return this},load:function(){var um=this.getUpdater();um.update.apply(um,arguments);return this},getUpdater:function(){if(!this.updateManager){this.updateManager=new Ext.Updater(this)}return this.updateManager},unselectable:function(){this.dom.unselectable="on";this.swallowEvent("selectstart",true);this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");this.addClass("x-unselectable");return this},getCenterXY:function(){return this.getAlignToXY(document,"c-c")},center:function(centerIn){this.alignTo(centerIn||document,"c-c");return this},isBorderBox:function(){return noBoxAdjust[this.dom.tagName.toLowerCase()]||Ext.isBorderBox},getBox:function(contentBox,local){var xy;if(!local){xy=this.getXY()}else{var left=parseInt(this.getStyle("left"),10)||0;var top=parseInt(this.getStyle("top"),10)||0;xy=[left,top]}var el=this.dom,w=el.offsetWidth,h=el.offsetHeight,bx;if(!contentBox){bx={x:xy[0],y:xy[1],0:xy[0],1:xy[1],width:w,height:h}}else{var l=this.getBorderWidth("l")+this.getPadding("l");var r=this.getBorderWidth("r")+this.getPadding("r");var t=this.getBorderWidth("t")+this.getPadding("t");var b=this.getBorderWidth("b")+this.getPadding("b");bx={x:xy[0]+l,y:xy[1]+t,0:xy[0]+l,1:xy[1]+t,width:w-(l+r),height:h-(t+b)}}bx.right=bx.x+bx.width;bx.bottom=bx.y+bx.height;return bx},getFrameWidth:function(sides,onlyContentBox){return onlyContentBox&&Ext.isBorderBox?0:(this.getPadding(sides)+this.getBorderWidth(sides))},setBox:function(box,adjust,animate){var w=box.width,h=box.height;if((adjust&&!this.autoBoxAdjust)&&!this.isBorderBox()){w-=(this.getBorderWidth("lr")+this.getPadding("lr"));h-=(this.getBorderWidth("tb")+this.getPadding("tb"))}this.setBounds(box.x,box.y,w,h,this.preanim(arguments,2));return this},repaint:function(){var dom=this.dom;this.addClass("x-repaint");setTimeout(function(){Ext.get(dom).removeClass("x-repaint")},1);return this},getMargins:function(side){if(!side){return{top:parseInt(this.getStyle("margin-top"),10)||0,left:parseInt(this.getStyle("margin-left"),10)||0,bottom:parseInt(this.getStyle("margin-bottom"),10)||0,right:parseInt(this.getStyle("margin-right"),10)||0}}else{return this.addStyles(side,El.margins)}},addStyles:function(sides,styles){var val=0,v,w;for(var i=0,len=sides.length;i=0?w:-1*w)}}}return val},createProxy:function(config,renderTo,matchBox){config=typeof config=="object"?config:{tag:"div",cls:config};var proxy;if(renderTo){proxy=Ext.DomHelper.append(renderTo,config,true)}else{proxy=Ext.DomHelper.insertBefore(this.dom,config,true)}if(matchBox){proxy.setBox(this.getBox())}return proxy},mask:function(msg,msgCls){if(this.getStyle("position")=="static"){this.setStyle("position","relative")}if(this._maskMsg){this._maskMsg.remove()}if(this._mask){this._mask.remove()}this._mask=Ext.DomHelper.append(this.dom,{cls:"ext-el-mask"},true);this.addClass("x-masked");this._mask.setDisplayed(true);if(typeof msg=="string"){this._maskMsg=Ext.DomHelper.append(this.dom,{cls:"ext-el-mask-msg",cn:{tag:"div"}},true);var mm=this._maskMsg;mm.dom.className=msgCls?"ext-el-mask-msg "+msgCls:"ext-el-mask-msg";mm.dom.firstChild.innerHTML=msg;mm.setDisplayed(true);mm.center(this)}if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this.getStyle("height")=="auto"){this._mask.setSize(this.dom.clientWidth,this.getHeight())}return this._mask},unmask:function(){if(this._mask){if(this._maskMsg){this._maskMsg.remove();delete this._maskMsg}this._mask.remove();delete this._mask}this.removeClass("x-masked")},isMasked:function(){return this._mask&&this._mask.isVisible()},createShim:function(){var el=document.createElement("iframe");el.frameBorder="no";el.className="ext-shim";if(Ext.isIE&&Ext.isSecure){el.src=Ext.SSL_SECURE_URL}var shim=Ext.get(this.dom.parentNode.insertBefore(el,this.dom));shim.autoBoxAdjust=false;return shim},remove:function(){Ext.removeNode(this.dom);delete El.cache[this.dom.id]},hover:function(overFn,outFn,scope){var preOverFn=function(e){if(!e.within(this,true)){overFn.apply(scope||this,arguments)}};var preOutFn=function(e){if(!e.within(this,true)){outFn.apply(scope||this,arguments)}};this.on("mouseover",preOverFn,this.dom);this.on("mouseout",preOutFn,this.dom);return this},addClassOnOver:function(className,preventFlicker){this.hover(function(){Ext.fly(this,"_internal").addClass(className)},function(){Ext.fly(this,"_internal").removeClass(className)});return this},addClassOnFocus:function(className){this.on("focus",function(){Ext.fly(this,"_internal").addClass(className)},this.dom);this.on("blur",function(){Ext.fly(this,"_internal").removeClass(className)},this.dom);return this},addClassOnClick:function(className){var dom=this.dom;this.on("mousedown",function(){Ext.fly(dom,"_internal").addClass(className);var d=Ext.getDoc();var fn=function(){Ext.fly(dom,"_internal").removeClass(className);d.removeListener("mouseup",fn)};d.on("mouseup",fn)});return this},swallowEvent:function(eventName,preventDefault){var fn=function(e){e.stopPropagation();if(preventDefault){e.preventDefault()}};if(Ext.isArray(eventName)){for(var i=0,len=eventName.length;idom.clientHeight||dom.scrollWidth>dom.clientWidth},scrollTo:function(side,value,animate){var prop=side.toLowerCase()=="left"?"scrollLeft":"scrollTop";if(!animate||!A){this.dom[prop]=value}else{var to=prop=="scrollLeft"?[value,this.dom.scrollTop]:[this.dom.scrollLeft,value];this.anim({scroll:{"to":to}},this.preanim(arguments,2),"scroll")}return this},scroll:function(direction,distance,animate){if(!this.isScrollable()){return }var el=this.dom;var l=el.scrollLeft,t=el.scrollTop;var w=el.scrollWidth,h=el.scrollHeight;var cw=el.clientWidth,ch=el.clientHeight;direction=direction.toLowerCase();var scrolled=false;var a=this.preanim(arguments,2);switch(direction){case"l":case"left":if(w-l>cw){var v=Math.min(l+distance,w-cw);this.scrollTo("left",v,a);scrolled=true}break;case"r":case"right":if(l>0){var v=Math.max(l-distance,0);this.scrollTo("left",v,a);scrolled=true}break;case"t":case"top":case"up":if(t>0){var v=Math.max(t-distance,0);this.scrollTo("top",v,a);scrolled=true}break;case"b":case"bottom":case"down":if(h-t>ch){var v=Math.min(t+distance,h-ch);this.scrollTo("top",v,a);scrolled=true}break}return scrolled},translatePoints:function(x,y){if(typeof x=="object"||Ext.isArray(x)){y=x[1];x=x[0]}var p=this.getStyle("position");var o=this.getXY();var l=parseInt(this.getStyle("left"),10);var t=parseInt(this.getStyle("top"),10);if(isNaN(l)){l=(p=="relative")?0:this.dom.offsetLeft}if(isNaN(t)){t=(p=="relative")?0:this.dom.offsetTop}return{left:(x-o[0]+l),top:(y-o[1]+t)}},getScroll:function(){var d=this.dom,doc=document;if(d==doc||d==doc.body){var l,t;if(Ext.isIE&&Ext.isStrict){l=doc.documentElement.scrollLeft||(doc.body.scrollLeft||0);t=doc.documentElement.scrollTop||(doc.body.scrollTop||0)}else{l=window.pageXOffset||(doc.body.scrollLeft||0);t=window.pageYOffset||(doc.body.scrollTop||0)}return{left:l,top:t}}else{return{left:d.scrollLeft,top:d.scrollTop}}},getColor:function(attr,defaultValue,prefix){var v=this.getStyle(attr);if(!v||v=="transparent"||v=="inherit"){return defaultValue}var color=typeof prefix=="undefined"?"#":prefix;if(v.substr(0,4)=="rgb("){var rvs=v.slice(4,v.length-1).split(",");for(var i=0;i<3;i++){var h=parseInt(rvs[i]);var s=h.toString(16);if(h<16){s="0"+s}color+=s}}else{if(v.substr(0,1)=="#"){if(v.length==4){for(var i=1;i<4;i++){var c=v.charAt(i);color+=c+c}}else{if(v.length==7){color+=v.substr(1)}}}}return(color.length>5?color.toLowerCase():defaultValue)},boxWrap:function(cls){cls=cls||"x-box";var el=Ext.get(this.insertHtml("beforeBegin",String.format("
"+El.boxMarkup+"
",cls)));el.child("."+cls+"-mc").dom.appendChild(this.dom);return el},getAttributeNS:Ext.isIE?function(ns,name){var d=this.dom;var type=typeof d[ns+":"+name];if(type!="undefined"&&type!="unknown"){return d[ns+":"+name]}return d[name]}:function(ns,name){var d=this.dom;return d.getAttributeNS(ns,name)||d.getAttribute(ns+":"+name)||d.getAttribute(name)||d[name]},getTextWidth:function(text,min,max){return(Ext.util.TextMetrics.measure(this.dom,Ext.value(text,this.dom.innerHTML,true)).width).constrain(min||0,max||1000000)}};var ep=El.prototype;ep.on=ep.addListener;ep.mon=ep.addListener;ep.getUpdateManager=ep.getUpdater;ep.un=ep.removeListener;ep.autoBoxAdjust=true;El.unitPattern=/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;El.addUnits=function(v,defaultUnit){if(v===""||v=="auto"){return v}if(v===undefined){return""}if(typeof v=="number"||!El.unitPattern.test(v)){return v+(defaultUnit||"px")}return v};El.boxMarkup="
";El.VISIBILITY=1;El.DISPLAY=2;El.borders={l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"};El.paddings={l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"};El.margins={l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"};El.cache={};var docEl;El.get=function(el){var ex,elm,id;if(!el){return null}if(typeof el=="string"){if(!(elm=document.getElementById(el))){return null}if(ex=El.cache[el]){ex.dom=elm}else{ex=El.cache[el]=new El(elm)}return ex}else{if(el.tagName){if(!(id=el.id)){id=Ext.id(el)}if(ex=El.cache[id]){ex.dom=el}else{ex=El.cache[id]=new El(el)}return ex}else{if(el instanceof El){if(el!=docEl){el.dom=document.getElementById(el.id)||el.dom;El.cache[el.id]=el}return el}else{if(el.isComposite){return el}else{if(Ext.isArray(el)){return El.select(el)}else{if(el==document){if(!docEl){var f=function(){};f.prototype=El.prototype;docEl=new f();docEl.dom=document}return docEl}}}}}}return null};El.uncache=function(el){for(var i=0,a=arguments,len=a.length;i0){F()}else{B.afterFx(D)}})};F.call(this)});return this},pause:function(C){var A=this.getFxEl();var B={};A.queueFx(B,function(){setTimeout(function(){A.afterFx(B)},C*1000)});return this},fadeIn:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){this.setOpacity(0);this.fixDisplay();this.dom.style.visibility="visible";var C=B.endOpacity||1;arguments.callee.anim=this.fxanim({opacity:{to:C}},B,null,0.5,"easeOut",function(){if(C==1){this.clearOpacity()}A.afterFx(B)})});return this},fadeOut:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){arguments.callee.anim=this.fxanim({opacity:{to:B.endOpacity||0}},B,null,0.5,"easeOut",function(){if(this.visibilityMode==Ext.Element.DISPLAY||B.useDisplay){this.dom.style.display="none"}else{this.dom.style.visibility="hidden"}this.clearOpacity();A.afterFx(B)})});return this},scale:function(A,B,C){this.shift(Ext.apply({},C,{width:A,height:B}));return this},shift:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){var E={},D=B.width,F=B.height,C=B.x,H=B.y,G=B.opacity;if(D!==undefined){E.width={to:this.adjustWidth(D)}}if(F!==undefined){E.height={to:this.adjustHeight(F)}}if(C!==undefined||H!==undefined){E.points={to:[C!==undefined?C:this.getX(),H!==undefined?H:this.getY()]}}if(G!==undefined){E.opacity={to:G}}if(B.xy!==undefined){E.points={to:B.xy}}arguments.callee.anim=this.fxanim(E,B,"motion",0.35,"easeOut",function(){A.afterFx(B)})});return this},ghost:function(A,C){var B=this.getFxEl();C=C||{};B.queueFx(C,function(){A=A||"b";var H=this.getFxRestore();var E=this.getWidth(),G=this.getHeight();var F=this.dom.style;var J=function(){if(C.useDisplay){B.setDisplayed(false)}else{B.hide()}B.clearOpacity();B.setPositioning(H.pos);F.width=H.width;F.height=H.height;B.afterFx(C)};var D={opacity:{to:0},points:{}},I=D.points;switch(A.toLowerCase()){case"t":I.by=[0,-G];break;case"l":I.by=[-E,0];break;case"r":I.by=[E,0];break;case"b":I.by=[0,G];break;case"tl":I.by=[-E,-G];break;case"bl":I.by=[-E,G];break;case"br":I.by=[E,G];break;case"tr":I.by=[E,-G];break}arguments.callee.anim=this.fxanim(D,C,"motion",0.5,"easeOut",J)});return this},syncFx:function(){this.fxDefaults=Ext.apply(this.fxDefaults||{},{block:false,concurrent:true,stopFx:false});return this},sequenceFx:function(){this.fxDefaults=Ext.apply(this.fxDefaults||{},{block:false,concurrent:false,stopFx:false});return this},nextFx:function(){var A=this.fxQueue[0];if(A){A.call(this)}},hasActiveFx:function(){return this.fxQueue&&this.fxQueue[0]},stopFx:function(){if(this.hasActiveFx()){var A=this.fxQueue[0];if(A&&A.anim&&A.anim.isAnimated()){this.fxQueue=[A];A.anim.stop(true)}}return this},beforeFx:function(A){if(this.hasActiveFx()&&!A.concurrent){if(A.stopFx){this.stopFx();return true}return false}return true},hasFxBlock:function(){var A=this.fxQueue;return A&&A[0]&&A[0].block},queueFx:function(C,A){if(!this.fxQueue){this.fxQueue=[]}if(!this.hasFxBlock()){Ext.applyIf(C,this.fxDefaults);if(!C.concurrent){var B=this.beforeFx(C);A.block=C.block;this.fxQueue.push(A);if(B){this.nextFx()}}else{A.call(this)}}return this},fxWrap:function(F,D,C){var B;if(!D.wrap||!(B=Ext.get(D.wrap))){var A;if(D.fixPosition){A=this.getXY()}var E=document.createElement("div");E.style.visibility=C;B=Ext.get(this.dom.parentNode.insertBefore(E,this.dom));B.setPositioning(F);if(B.getStyle("position")=="static"){B.position("relative")}this.clearPositioning("auto");B.clip();B.dom.appendChild(this.dom);if(A){B.setXY(A)}}return B},fxUnwrap:function(A,C,B){this.clearPositioning();this.setPositioning(C);if(!B.wrap){A.dom.parentNode.insertBefore(this.dom,A.dom);A.remove()}},getFxRestore:function(){var A=this.dom.style;return{pos:this.getPositioning(),width:A.width,height:A.height}},afterFx:function(A){if(A.afterStyle){this.applyStyles(A.afterStyle)}if(A.afterCls){this.addClass(A.afterCls)}if(A.remove===true){this.remove()}Ext.callback(A.callback,A.scope,[this]);if(!A.concurrent){this.fxQueue.shift();this.nextFx()}},getFxEl:function(){return Ext.get(this.dom)},fxanim:function(D,E,B,F,C,A){B=B||"run";E=E||{};var G=Ext.lib.Anim[B](this.dom,D,(E.duration||F)||0.35,(E.easing||C)||"easeOut",function(){Ext.callback(A,this)},this);E.anim=G;return G}};Ext.Fx.resize=Ext.Fx.scale;Ext.apply(Ext.Element.prototype,Ext.Fx); +Ext.CompositeElement=function(A){this.elements=[];this.addElements(A)};Ext.CompositeElement.prototype={isComposite:true,addElements:function(E){if(!E){return this}if(typeof E=="string"){E=Ext.Element.selectorFunction(E)}var D=this.elements;var B=D.length-1;for(var C=0,A=E.length;C"+A.text+""}if(typeof A.scripts!="undefined"){this.loadScripts=A.scripts}if(typeof A.timeout!="undefined"){this.timeout=A.timeout}}this.showLoading();if(!D){this.defaultUrl=B}if(typeof B=="function"){B=B.call(this)}G=G||(F?"POST":"GET");if(G=="GET"){B=this.prepareUrl(B)}var E=Ext.apply(A||{},{url:B,params:(typeof F=="function"&&C)?F.createDelegate(C):F,success:this.processSuccess,failure:this.processFailure,scope:this,callback:undefined,timeout:(this.timeout*1000),argument:{"options":A,"url":B,"form":null,"callback":H,"scope":C||window,"params":F}});this.transaction=Ext.Ajax.request(E)}},formUpdate:function(C,A,B,D){if(this.fireEvent("beforeupdate",this.el,C,A)!==false){if(typeof A=="function"){A=A.call(this)}C=Ext.getDom(C);this.transaction=Ext.Ajax.request({form:C,url:A,success:this.processSuccess,failure:this.processFailure,scope:this,timeout:(this.timeout*1000),argument:{"url":A,"form":C,"callback":D,"reset":B}});this.showLoading.defer(1,this)}},refresh:function(A){if(this.defaultUrl==null){return }this.update(this.defaultUrl,null,A,true)},startAutoRefresh:function(B,C,D,E,A){if(A){this.update(C||this.defaultUrl,D,E,true)}if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId)}this.autoRefreshProcId=setInterval(this.update.createDelegate(this,[C||this.defaultUrl,D,E,true]),B*1000)},stopAutoRefresh:function(){if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);delete this.autoRefreshProcId}},isAutoRefreshing:function(){return this.autoRefreshProcId?true:false},showLoading:function(){if(this.showLoadIndicator){this.el.update(this.indicatorText)}},prepareUrl:function(B){if(this.disableCaching){var A="_dc="+(new Date().getTime());if(B.indexOf("?")!==-1){B+="&"+A}else{B+="?"+A}}return B},processSuccess:function(A){this.transaction=null;if(A.argument.form&&A.argument.reset){try{A.argument.form.reset()}catch(B){}}if(this.loadScripts){this.renderer.render(this.el,A,this,this.updateComplete.createDelegate(this,[A]))}else{this.renderer.render(this.el,A,this);this.updateComplete(A)}},updateComplete:function(A){this.fireEvent("update",this.el,A);if(typeof A.argument.callback=="function"){A.argument.callback.call(A.argument.scope,this.el,true,A,A.argument.options)}},processFailure:function(A){this.transaction=null;this.fireEvent("failure",this.el,A);if(typeof A.argument.callback=="function"){A.argument.callback.call(A.argument.scope,this.el,false,A,A.argument.options)}},setRenderer:function(A){this.renderer=A},getRenderer:function(){return this.renderer},setDefaultUrl:function(A){this.defaultUrl=A},abort:function(){if(this.transaction){Ext.Ajax.abort(this.transaction)}},isUpdating:function(){if(this.transaction){return Ext.Ajax.isLoading(this.transaction)}return false}});Ext.Updater.defaults={timeout:30,loadScripts:false,sslBlankUrl:(Ext.SSL_SECURE_URL||"javascript:false"),disableCaching:false,showLoadIndicator:true,indicatorText:"
Loading...
"};Ext.Updater.updateElement=function(D,C,E,B){var A=Ext.get(D).getUpdater();Ext.apply(A,B);A.update(C,E,B?B.callback:null)};Ext.Updater.update=Ext.Updater.updateElement;Ext.Updater.BasicRenderer=function(){};Ext.Updater.BasicRenderer.prototype={render:function(C,A,B,D){C.update(A.responseText,B.loadScripts,D)}};Ext.UpdateManager=Ext.Updater; +Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(B){if(Date.formatFunctions[B]==null){Date.createNewFormat(B)}var A=Date.formatFunctions[B];return this[A]()};Date.prototype.format=Date.prototype.dateFormat;Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function(){return ";var special=false;var ch="";for(var i=0;i 0 ? +1 : (this.getWeekOfYear() >= 52 && this.getMonth() < 11 ? -1 : 0))) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() % 12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() % 12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"u":return"String.leftPad(this.getMilliseconds(), 3, '0') + ";case"O":return"this.getGMTOffset() + ";case"P":return"this.getGMTOffset(true) + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";case"c":for(var F=Date.getFormatCode,G="Y-m-dTH:i:sP",C="",B=0,A=G.length;B 0) {";var regex="";var special=false;var ch="";for(var i=0;i= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0 && ms >= 0)\n"+"{v = new Date(y, m, d, h, i, s, ms);}\n"+"else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n"+"{v = new Date(y, m, d, h, i, s);}\n"+"else if (y >= 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n"+"{v = new Date(y, m, d, h, i);}\n"+"else if (y >= 0 && m >= 0 && d > 0 && h >= 0)\n"+"{v = new Date(y, m, d, h);}\n"+"else if (y >= 0 && m >= 0 && d > 0)\n"+"{v = new Date(y, m, d);}\n"+"else if (y >= 0 && m >= 0)\n"+"{v = new Date(y, m);}\n"+"else if (y >= 0)\n"+"{v = new Date(y);}\n"+"}return (v && (z || o))?\n"+" (z ? v.add(Date.SECOND, (v.getTimezoneOffset() * 60) + (z*1)) :\n"+" v.add(Date.HOUR, (v.getGMTOffset() / 100) + (o / -100))) : v\n"+";}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$","i");eval(code)};Date.formatCodeToRegex=function(G,F){switch(G){case"d":return{g:1,c:"d = parseInt(results["+F+"], 10);\n",s:"(\\d{2})"};case"D":for(var C=[],E=0;E<7;C.push(Date.getShortDayName(E)),++E){}return{g:0,c:null,s:"(?:"+C.join("|")+")"};case"j":return{g:1,c:"d = parseInt(results["+F+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"N":return{g:0,c:null,s:"[1-7]"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"[0-6]"};case"z":return{g:0,c:null,s:"(?:\\d{1,3}"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.getMonthNumber(results["+F+"]), 10);\n",s:"("+Date.monthNames.join("|")+")"};case"m":return{g:1,c:"m = parseInt(results["+F+"], 10) - 1;\n",s:"(\\d{2})"};case"M":for(var C=[],E=0;E<12;C.push(Date.getShortMonthName(E)),++E){}return{g:1,c:"m = parseInt(Date.getMonthNumber(results["+F+"]), 10);\n",s:"("+C.join("|")+")"};case"n":return{g:1,c:"m = parseInt(results["+F+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"(?:\\d{2})"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"o":case"Y":return{g:1,c:"y = parseInt(results["+F+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+F+"], 10);\n"+"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+F+"] == 'am') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+F+"] == 'AM') {\n"+"if (h == 12) { h = 0; }\n"+"} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":return{g:1,c:"h = parseInt(results["+F+"], 10);\n",s:"(\\d{1,2})"};case"h":case"H":return{g:1,c:"h = parseInt(results["+F+"], 10);\n",s:"(\\d{2})"};case"i":return{g:1,c:"i = parseInt(results["+F+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+F+"], 10);\n",s:"(\\d{2})"};case"u":return{g:1,c:"ms = parseInt(results["+F+"], 10);\n",s:"(\\d{3})"};case"O":return{g:1,c:["o = results[",F,"];\n","var sn = o.substring(0,1);\n","var hr = o.substring(1,3)*1 + Math.floor(o.substring(3,5) / 60);\n","var mn = o.substring(3,5) % 60;\n","o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n"," (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"].join(""),s:"([+-]\\d{4})"};case"P":return{g:1,c:["o = results[",F,"];\n","var sn = o.substring(0,1);\n","var hr = o.substring(1,3)*1 + Math.floor(o.substring(4,6) / 60);\n","var mn = o.substring(4,6) % 60;\n","o = ((-12 <= (hr*60 + mn)/60) && ((hr*60 + mn)/60 <= 14))?\n"," (sn + String.leftPad(hr, 2, '0') + String.leftPad(mn, 2, '0')) : null;\n"].join(""),s:"([+-]\\d{2}:\\d{2})"};case"T":return{g:0,c:null,s:"[A-Z]{1,4}"};case"Z":return{g:1,c:"z = results["+F+"] * 1;\n"+"z = (-43200 <= z && z <= 50400)? z : null;\n",s:"([+-]?\\d{1,5})"};case"c":var H=Date.formatCodeToRegex,D=[];var A=[H("Y",1),H("m",2),H("d",3),H("h",4),H("i",5),H("s",6),H("P",7)];for(var E=0,B=A.length;E0?"-":"+")+String.leftPad(Math.abs(Math.floor(this.getTimezoneOffset()/60)),2,"0")+(A?":":"")+String.leftPad(this.getTimezoneOffset()%60,2,"0")};Date.prototype.getDayOfYear=function(){var A=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var B=0;B28){A=Math.min(A,this.getFirstDateOfMonth().add("mo",C).getLastDateOfMonth().getDate())}D.setDate(A);D.setMonth(this.getMonth()+C);break;case Date.YEAR:D.setFullYear(this.getFullYear()+C);break}return D};Date.prototype.between=function(C,A){var B=this.getTime();return C.getTime()<=B&&B<=A.getTime()}; +Ext.util.DelayedTask=function(E,D,A){var G=null,F,B;var C=function(){var H=new Date().getTime();if(H-B>=F){clearInterval(G);G=null;E.apply(D,A||[])}};this.delay=function(I,K,J,H){if(G&&I!=F){this.cancel()}F=I;B=new Date().getTime();E=K||E;D=J||D;A=H||A;if(!G){G=setInterval(C,F)}};this.cancel=function(){if(G){clearInterval(G);G=null}}}; +Ext.util.TaskRunner=function(E){E=E||10;var F=[],A=[];var B=0;var G=false;var D=function(){G=false;clearInterval(B);B=0};var H=function(){if(!G){G=true;B=setInterval(I,E)}};var C=function(J){A.push(J);if(J.onStop){J.onStop.apply(J.scope||J)}};var I=function(){if(A.length>0){for(var O=0,K=A.length;O1||Ext.isArray(E)){var B=arguments.length>1?arguments:E;for(var D=0,A=B.length;D=this.length){return this.add(B,C)}this.length++;this.items.splice(A,0,C);if(typeof B!="undefined"&&B!=null){this.map[B]=C}this.keys.splice(A,0,B);this.fireEvent("add",A,C,B);return C},remove:function(A){return this.removeAt(this.indexOf(A))},removeAt:function(A){if(A=0){this.length--;var C=this.items[A];this.items.splice(A,1);var B=this.keys[A];if(typeof B!="undefined"){delete this.map[B]}this.keys.splice(A,1);this.fireEvent("remove",C,B);return C}return false},removeKey:function(A){return this.removeAt(this.indexOfKey(A))},getCount:function(){return this.length},indexOf:function(A){return this.items.indexOf(A)},indexOfKey:function(A){return this.keys.indexOf(A)},item:function(A){var B=typeof this.map[A]!="undefined"?this.map[A]:this.items[A];return typeof B!="function"||this.allowFunctions?B:null},itemAt:function(A){return this.items[A]},key:function(A){return this.map[A]},contains:function(A){return this.indexOf(A)!=-1},containsKey:function(A){return typeof this.map[A]!="undefined"},clear:function(){this.length=0;this.items=[];this.keys=[];this.map={};this.fireEvent("clear")},first:function(){return this.items[0]},last:function(){return this.items[this.length-1]},_sort:function(I,A,H){var C=String(A).toUpperCase()=="DESC"?-1:1;H=H||function(K,J){return K-J};var G=[],B=this.keys,F=this.items;for(var D=0,E=F.length;D=A;C--){D[D.length]=B[C]}}return D},filter:function(C,B,D,A){if(Ext.isEmpty(B,false)){return this.clone()}B=this.createValueMatcher(B,D,A);return this.filterBy(function(E){return E&&B.test(E[C])})},filterBy:function(F,E){var G=new Ext.util.MixedCollection();G.getKey=this.getKey;var B=this.keys,D=this.items;for(var C=0,A=D.length;C0){for(var C=0;Clen){return value.substr(0,len-3)+"..."}return value},undef:function(value){return value!==undefined?value:""},defaultValue:function(value,defaultValue){return value!==undefined&&value!==""?value:defaultValue},htmlEncode:function(value){return !value?value:String(value).replace(/&/g,"&").replace(/>/g,">").replace(/").replace(/</g,"<").replace(/"/g,"\"")},trim:function(value){return String(value).replace(trimRe,"")},substr:function(value,start,length){return String(value).substr(start,length)},lowercase:function(value){return String(value).toLowerCase()},uppercase:function(value){return String(value).toUpperCase()},capitalize:function(value){return !value?value:value.charAt(0).toUpperCase()+value.substr(1).toLowerCase()},call:function(value,fn){if(arguments.length>2){var args=Array.prototype.slice.call(arguments,2);args.unshift(value);return eval(fn).apply(window,args)}else{return eval(fn).call(window,value)}},usMoney:function(v){v=(Math.round((v-0)*100))/100;v=(v==Math.floor(v))?v+".00":((v*10==Math.floor(v*10))?v+"0":v);v=String(v);var ps=v.split(".");var whole=ps[0];var sub=ps[1]?"."+ps[1]:".00";var r=/(\d+)(\d{3})/;while(r.test(whole)){whole=whole.replace(r,"$1"+","+"$2")}v=whole+sub;if(v.charAt(0)=="-"){return"-$"+v.substr(1)}return"$"+v},date:function(v,format){if(!v){return""}if(!Ext.isDate(v)){v=new Date(Date.parse(v))}return v.dateFormat(format||"m/d/Y")},dateRenderer:function(format){return function(v){return Ext.util.Format.date(v,format)}},stripTagsRE:/<\/?[^>]+>/gi,stripTags:function(v){return !v?v:String(v).replace(this.stripTagsRE,"")},stripScriptsRe:/(?:)((\n|\r|.)*?)(?:<\/script>)/ig,stripScripts:function(v){return !v?v:String(v).replace(this.stripScriptsRe,"")},fileSize:function(size){if(size<1024){return size+" bytes"}else{if(size<1048576){return(Math.round(((size*10)/1024))/10)+" KB"}else{return(Math.round(((size*10)/1048576))/10)+" MB"}}},math:function(){var fns={};return function(v,a){if(!fns[a]){fns[a]=new Function("v","return v "+a+";")}return fns[a](v)}}()}}(); +Ext.XTemplate=function(){Ext.XTemplate.superclass.constructor.apply(this,arguments);var P=this.html;P=["",P,""].join("");var O=/]*>((?:(?=([^<]+))\2|<(?!tpl\b[^>]*>))*?)<\/tpl>/;var N=/^]*?for="(.*?)"/;var L=/^]*?if="(.*?)"/;var J=/^]*?exec="(.*?)"/;var C,B=0;var G=[];while(C=P.match(O)){var M=C[0].match(N);var K=C[0].match(L);var I=C[0].match(J);var E=null,H=null,D=null;var A=M&&M[1]?M[1]:"";if(K){E=K&&K[1]?K[1]:null;if(E){H=new Function("values","parent","xindex","xcount","with(values){ return "+(Ext.util.Format.htmlDecode(E))+"; }")}}if(I){E=I&&I[1]?I[1]:null;if(E){D=new Function("values","parent","xindex","xcount","with(values){ "+(Ext.util.Format.htmlDecode(E))+"; }")}}if(A){switch(A){case".":A=new Function("values","parent","with(values){ return values; }");break;case"..":A=new Function("values","parent","with(values){ return parent; }");break;default:A=new Function("values","parent","with(values){ return "+A+"; }")}}G.push({id:B,target:A,exec:D,test:H,body:C[1]||""});P=P.replace(C[0],"{xtpl"+B+"}");++B}for(var F=G.length-1;F>=0;--F){this.compileTpl(G[F])}this.master=G[G.length-1];this.tpls=G};Ext.extend(Ext.XTemplate,Ext.Template,{re:/\{([\w-\.\#]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\s?[\+\-\*\\]\s?[\d\.\+\-\*\\\(\)]+)?\}/g,codeRe:/\{\[((?:\\\]|.|\n)*?)\]\}/g,applySubTemplate:function(A,H,G,D,C){var J=this.tpls[A];if(J.test&&!J.test.call(this,H,G,D,C)){return""}if(J.exec&&J.exec.call(this,H,G,D,C)){return""}var I=J.target?J.target.call(this,H,G):H;G=J.target?H:G;if(J.target&&Ext.isArray(I)){var B=[];for(var E=0,F=I.length;E=0;--E){D[H[E].selectorText]=H[E]}}catch(G){}},getRules:function(F){if(D==null||F){D={};var H=C.styleSheets;for(var G=0,E=H.length;G=37&&A<=40){C.stopEvent()}},relay:function(C){var A=C.getKey();var B=this.keyToHandler[A];if(B&&this[B]){if(this.doRelay(C,this[B],B)!==true){C[this.defaultEventAction]()}}},doRelay:function(C,B,A){return B.call(this.scope||this,C)},enter:false,left:false,right:false,up:false,down:false,tab:false,esc:false,pageUp:false,pageDown:false,del:false,home:false,end:false,keyToHandler:{37:"left",39:"right",38:"up",40:"down",33:"pageUp",34:"pageDown",46:"del",36:"home",35:"end",13:"enter",27:"esc",9:"tab"},enable:function(){if(this.disabled){if(this.forceKeyDown||Ext.isIE||Ext.isAir){this.el.on("keydown",this.relay,this)}else{this.el.on("keydown",this.prepareEvent,this);this.el.on("keypress",this.relay,this)}this.disabled=false}},disable:function(){if(!this.disabled){if(this.forceKeyDown||Ext.isIE||Ext.isAir){this.el.un("keydown",this.relay)}else{this.el.un("keydown",this.prepareEvent);this.el.un("keypress",this.relay)}this.disabled=true}}}; +Ext.KeyMap=function(C,B,A){this.el=Ext.get(C);this.eventName=A||"keydown";this.bindings=[];if(B){this.addBinding(B)}this.enable()};Ext.KeyMap.prototype={stopEvent:false,addBinding:function(D){if(Ext.isArray(D)){for(var F=0,H=D.length;F=this.minX;D=D-C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true}}for(D=this.initPageX;D<=this.maxX;D=D+C){if(!E[D]){this.xTicks[this.xTicks.length]=D;E[D]=true}}this.xTicks.sort(this.DDM.numericSort)},setYTicks:function(F,C){this.yTicks=[];this.yTickSize=C;var E={};for(var D=this.initPageY;D>=this.minY;D=D-C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true}}for(D=this.initPageY;D<=this.maxY;D=D+C){if(!E[D]){this.yTicks[this.yTicks.length]=D;E[D]=true}}this.yTicks.sort(this.DDM.numericSort)},setXConstraint:function(E,D,C){this.leftConstraint=E;this.rightConstraint=D;this.minX=this.initPageX-E;this.maxX=this.initPageX+D;if(C){this.setXTicks(this.initPageX,C)}this.constrainX=true},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks()},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0},setYConstraint:function(C,E,D){this.topConstraint=C;this.bottomConstraint=E;this.minY=this.initPageY-C;this.maxY=this.initPageY+E;if(D){this.setYTicks(this.initPageY,D)}this.constrainY=true},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var D=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var C=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(D,C)}else{this.setInitPosition()}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize)}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize)}},getTick:function(I,F){if(!F){return I}else{if(F[0]>=I){return F[0]}else{for(var D=0,C=F.length;D=I){var H=I-F[D];var G=F[E]-I;return(G>H)?F[D]:F[E]}}return F[F.length-1]}}},toString:function(){return("DragDrop "+this.id)}}})();if(!Ext.dd.DragDropMgr){Ext.dd.DragDropMgr=function(){var A=Ext.EventManager;return{ids:{},handleIds:{},dragCurrent:null,dragOvers:{},deltaX:0,deltaY:0,preventDefault:true,stopPropagation:true,initalized:false,locked:false,init:function(){this.initialized=true},POINT:0,INTERSECT:1,mode:0,_execOnAll:function(D,C){for(var E in this.ids){for(var B in this.ids[E]){var F=this.ids[E][B];if(!this.isTypeOfDD(F)){continue}F[D].apply(F,C)}}},_onLoad:function(){this.init();A.on(document,"mouseup",this.handleMouseUp,this,true);A.on(document,"mousemove",this.handleMouseMove,this,true);A.on(window,"unload",this._onUnload,this,true);A.on(window,"resize",this._onResize,this,true)},_onResize:function(B){this._execOnAll("resetConstraints",[])},lock:function(){this.locked=true},unlock:function(){this.locked=false},isLocked:function(){return this.locked},locationCache:{},useCache:true,clickPixelThresh:3,clickTimeThresh:350,dragThreshMet:false,clickTimeout:null,startX:0,startY:0,regDragDrop:function(C,B){if(!this.initialized){this.init()}if(!this.ids[B]){this.ids[B]={}}this.ids[B][C.id]=C},removeDDFromGroup:function(D,B){if(!this.ids[B]){this.ids[B]={}}var C=this.ids[B];if(C&&C[D.id]){delete C[D.id]}},_remove:function(C){for(var B in C.groups){if(B&&this.ids[B][C.id]){delete this.ids[B][C.id]}}delete this.handleIds[C.id]},regHandle:function(C,B){if(!this.handleIds[C]){this.handleIds[C]={}}this.handleIds[C][B]=B},isDragDrop:function(B){return(this.getDDById(B))?true:false},getRelated:function(F,C){var E=[];for(var D in F.groups){for(j in this.ids[D]){var B=this.ids[D][j];if(!this.isTypeOfDD(B)){continue}if(!C||B.isTarget){E[E.length]=B}}}return E},isLegalTarget:function(F,E){var C=this.getRelated(F,true);for(var D=0,B=C.length;Dthis.clickPixelThresh||B>this.clickPixelThresh){this.startDrag(this.startX,this.startY)}}if(this.dragThreshMet){this.dragCurrent.b4Drag(D);this.dragCurrent.onDrag(D);if(!this.dragCurrent.moveOnly){this.fireEvents(D,false)}}this.stopEvent(D);return true},fireEvents:function(K,L){var N=this.dragCurrent;if(!N||N.isLocked()){return }var O=K.getPoint();var B=[];var E=[];var I=[];var G=[];var D=[];for(var F in this.dragOvers){var C=this.dragOvers[F];if(!this.isTypeOfDD(C)){continue}if(!this.isOverTarget(O,C,this.mode)){E.push(C)}B[F]=true;delete this.dragOvers[F]}for(var M in N.groups){if("string"!=typeof M){continue}for(F in this.ids[M]){var H=this.ids[M][F];if(!this.isTypeOfDD(H)){continue}if(H.isTarget&&!H.isLocked()&&H!=N){if(this.isOverTarget(O,H,this.mode)){if(L){G.push(H)}else{if(!B[H.id]){D.push(H)}else{I.push(H)}this.dragOvers[H.id]=H}}}}}if(this.mode){if(E.length){N.b4DragOut(K,E);N.onDragOut(K,E)}if(D.length){N.onDragEnter(K,D)}if(I.length){N.b4DragOver(K,I);N.onDragOver(K,I)}if(G.length){N.b4DragDrop(K,G);N.onDragDrop(K,G)}}else{var J=0;for(F=0,J=E.length;F2000){}else{setTimeout(B._addListeners,10);if(document&&document.body){B._timeoutCount+=1}}}},handleWasClicked:function(B,D){if(this.isHandle(D,B.id)){return true}else{var C=B.parentNode;while(C){if(this.isHandle(D,C.id)){return true}else{C=C.parentNode}}}return false}}}();Ext.dd.DDM=Ext.dd.DragDropMgr;Ext.dd.DDM._addListeners()}Ext.dd.DD=function(C,A,B){if(C){this.init(C,A,B)}};Ext.extend(Ext.dd.DD,Ext.dd.DragDrop,{scroll:true,autoOffset:function(C,B){var A=C-this.startPageX;var D=B-this.startPageY;this.setDelta(A,D)},setDelta:function(B,A){this.deltaX=B;this.deltaY=A},setDragElPos:function(C,B){var A=this.getDragEl();this.alignElWithMouse(A,C,B)},alignElWithMouse:function(C,G,F){var E=this.getTargetCoord(G,F);var B=C.dom?C:Ext.fly(C,"_dd");if(!this.deltaSetXY){var H=[E.x,E.y];B.setXY(H);var D=B.getLeft(true);var A=B.getTop(true);this.deltaSetXY=[D-E.x,A-E.y]}else{B.setLeftTop(E.x+this.deltaSetXY[0],E.y+this.deltaSetXY[1])}this.cachePosition(E.x,E.y);this.autoScroll(E.x,E.y,C.offsetHeight,C.offsetWidth);return E},cachePosition:function(B,A){if(B){this.lastPageX=B;this.lastPageY=A}else{var C=Ext.lib.Dom.getXY(this.getEl());this.lastPageX=C[0];this.lastPageY=C[1]}},autoScroll:function(J,I,E,K){if(this.scroll){var L=Ext.lib.Dom.getViewHeight();var B=Ext.lib.Dom.getViewWidth();var N=this.DDM.getScrollTop();var D=this.DDM.getScrollLeft();var H=E+I;var M=K+J;var G=(L+N-I-this.deltaY);var F=(B+D-J-this.deltaX);var C=40;var A=(document.all)?80:30;if(H>L&&G0&&I-NB&&F0&&J-Dthis.maxX){A=this.maxX}}if(this.constrainY){if(Dthis.maxY){D=this.maxY}}A=this.getTick(A,this.xTicks);D=this.getTick(D,this.yTicks);return{x:A,y:D}},applyConfig:function(){Ext.dd.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false)},b4MouseDown:function(A){this.autoOffset(A.getPageX(),A.getPageY())},b4Drag:function(A){this.setDragElPos(A.getPageX(),A.getPageY())},toString:function(){return("DD "+this.id)}});Ext.dd.DDProxy=function(C,A,B){if(C){this.init(C,A,B);this.initFrame()}};Ext.dd.DDProxy.dragElId="ygddfdiv";Ext.extend(Ext.dd.DDProxy,Ext.dd.DD,{resizeFrame:true,centerFrame:false,createFrame:function(){var B=this;var A=document.body;if(!A||!A.firstChild){setTimeout(function(){B.createFrame()},50);return }var D=this.getDragEl();if(!D){D=document.createElement("div");D.id=this.dragElId;var C=D.style;C.position="absolute";C.visibility="hidden";C.cursor="move";C.border="2px solid #aaa";C.zIndex=999;A.insertBefore(D,A.firstChild)}},initFrame:function(){this.createFrame()},applyConfig:function(){Ext.dd.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||Ext.dd.DDProxy.dragElId)},showFrame:function(E,D){var C=this.getEl();var A=this.getDragEl();var B=A.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(B.width,10)/2),Math.round(parseInt(B.height,10)/2))}this.setDragElPos(E,D);Ext.fly(A).show()},_resizeProxy:function(){if(this.resizeFrame){var A=this.getEl();Ext.fly(this.getDragEl()).setSize(A.offsetWidth,A.offsetHeight)}},b4MouseDown:function(B){var A=B.getPageX();var C=B.getPageY();this.autoOffset(A,C);this.setDragElPos(A,C)},b4StartDrag:function(A,B){this.showFrame(A,B)},b4EndDrag:function(A){Ext.fly(this.getDragEl()).hide()},endDrag:function(C){var B=this.getEl();var A=this.getDragEl();A.style.visibility="";this.beforeMove();B.style.visibility="hidden";Ext.dd.DDM.moveToEl(B,A);A.style.visibility="hidden";B.style.visibility="";this.afterDrag()},beforeMove:function(){},afterDrag:function(){},toString:function(){return("DDProxy "+this.id)}});Ext.dd.DDTarget=function(C,A,B){if(C){this.initTarget(C,A,B)}};Ext.extend(Ext.dd.DDTarget,Ext.dd.DragDrop,{toString:function(){return("DDTarget "+this.id)}}); +Ext.dd.DragTracker=function(A){Ext.apply(this,A);this.addEvents("mousedown","mouseup","mousemove","dragstart","dragend","drag");this.dragRegion=new Ext.lib.Region(0,0,0,0);if(this.el){this.initEl(this.el)}};Ext.extend(Ext.dd.DragTracker,Ext.util.Observable,{active:false,tolerance:5,autoStart:false,initEl:function(A){this.el=Ext.get(A);A.on("mousedown",this.onMouseDown,this,this.delegate?{delegate:this.delegate}:undefined)},destroy:function(){this.el.un("mousedown",this.onMouseDown,this)},onMouseDown:function(C,B){if(this.fireEvent("mousedown",this,C)!==false&&this.onBeforeStart(C)!==false){this.startXY=this.lastXY=C.getXY();this.dragTarget=this.delegate?B:this.el.dom;C.preventDefault();var A=Ext.getDoc();A.on("mouseup",this.onMouseUp,this);A.on("mousemove",this.onMouseMove,this);A.on("selectstart",this.stopSelect,this);if(this.autoStart){this.timer=this.triggerStart.defer(this.autoStart===true?1000:this.autoStart,this)}}},onMouseMove:function(D,C){D.preventDefault();var B=D.getXY(),A=this.startXY;this.lastXY=B;if(!this.active){if(Math.abs(A[0]-B[0])>this.tolerance||Math.abs(A[1]-B[1])>this.tolerance){this.triggerStart()}else{return }}this.fireEvent("mousemove",this,D);this.onDrag(D);this.fireEvent("drag",this,D)},onMouseUp:function(B){var A=Ext.getDoc();A.un("mousemove",this.onMouseMove,this);A.un("mouseup",this.onMouseUp,this);A.un("selectstart",this.stopSelect,this);B.preventDefault();this.clearStart();this.active=false;delete this.elRegion;this.fireEvent("mouseup",this,B);this.onEnd(B);this.fireEvent("dragend",this,B)},triggerStart:function(A){this.clearStart();this.active=true;this.onStart(this.startXY);this.fireEvent("dragstart",this,this.startXY)},clearStart:function(){if(this.timer){clearTimeout(this.timer);delete this.timer}},stopSelect:function(A){A.stopEvent();return false},onBeforeStart:function(A){},onStart:function(A){},onDrag:function(A){},onEnd:function(A){},getDragTarget:function(){return this.dragTarget},getDragCt:function(){return this.el},getXY:function(A){return A?this.constrainModes[A].call(this,this.lastXY):this.lastXY},getOffset:function(C){var B=this.getXY(C);var A=this.startXY;return[A[0]-B[0],A[1]-B[1]]},constrainModes:{"point":function(B){if(!this.elRegion){this.elRegion=this.getDragCt().getRegion()}var A=this.dragRegion;A.left=B[0];A.top=B[1];A.right=B[0];A.bottom=B[1];A.constrainTo(this.elRegion);return[A.left,A.top]}}}); +Ext.dd.ScrollManager=function(){var C=Ext.dd.DragDropMgr;var E={};var B=null;var H={};var G=function(K){B=null;A()};var I=function(){if(C.dragCurrent){C.refreshCache(C.dragCurrent.groups)}};var D=function(){if(C.dragCurrent){var K=Ext.dd.ScrollManager;var L=H.el.ddScrollConfig?H.el.ddScrollConfig.increment:K.increment;if(!K.animate){if(H.el.scroll(H.dir,L)){I()}}else{H.el.scroll(H.dir,L,true,K.animDuration,I)}}};var A=function(){if(H.id){clearInterval(H.id)}H.id=0;H.el=null;H.dir=""};var F=function(L,K){A();H.el=L;H.dir=K;H.id=setInterval(D,Ext.dd.ScrollManager.frequency)};var J=function(N,P){if(P||!C.dragCurrent){return }var Q=Ext.dd.ScrollManager;if(!B||B!=C.dragCurrent){B=C.dragCurrent;Q.refreshCache()}var R=Ext.lib.Event.getXY(N);var S=new Ext.lib.Point(R[0],R[1]);for(var L in E){var M=E[L],K=M._region;var O=M.ddScrollConfig?M.ddScrollConfig:Q;if(K&&K.contains(S)&&M.isScrollable()){if(K.bottom-S.y<=O.vthresh){if(H.el!=M){F(M,"down")}return }else{if(K.right-S.x<=O.hthresh){if(H.el!=M){F(M,"left")}return }else{if(S.y-K.top<=O.vthresh){if(H.el!=M){F(M,"up")}return }else{if(S.x-K.left<=O.hthresh){if(H.el!=M){F(M,"right")}return }}}}}}A()};C.fireEvents=C.fireEvents.createSequence(J,C);C.stopDrag=C.stopDrag.createSequence(G,C);return{register:function(M){if(Ext.isArray(M)){for(var L=0,K=M.length;L]+>/gi,asText:function(A){return String(A).replace(this.stripTagsRE,"")},asUCText:function(A){return String(A).toUpperCase().replace(this.stripTagsRE,"")},asUCString:function(A){return String(A).toUpperCase()},asDate:function(A){if(!A){return 0}if(Ext.isDate(A)){return A.getTime()}return Date.parse(String(A))},asFloat:function(A){var B=parseFloat(String(A).replace(/,/g,""));if(isNaN(B)){B=0}return B},asInt:function(A){var B=parseInt(String(A).replace(/,/g,""));if(isNaN(B)){B=0}return B}}; +Ext.data.Record=function(A,B){this.id=(B||B===0)?B:++Ext.data.Record.AUTO_ID;this.data=A};Ext.data.Record.create=function(E){var C=Ext.extend(Ext.data.Record,{});var D=C.prototype;D.fields=new Ext.util.MixedCollection(false,function(F){return F.name});for(var B=0,A=E.length;BG?1:(H0},appendChild:function(E){var F=false;if(Ext.isArray(E)){F=E}else{if(arguments.length>1){F=arguments}}if(F){for(var D=0,A=F.length;D0){var F=D?function(){E.apply(D,arguments)}:E;C.sort(F);for(var B=0;BG+L.left){H=G-I-this.shadowOffset;E=true}if((F+D)>C+L.top){F=C-D-this.shadowOffset;E=true}if(H=J){F=J-D-5}}K=[H,F];this.storeXY(K);A.setXY.call(this,K);this.sync()}}},isVisible:function(){return this.visible},showAction:function(){this.visible=true;if(this.useDisplay===true){this.setDisplayed("")}else{if(this.lastXY){A.setXY.call(this,this.lastXY)}else{if(this.lastLT){A.setLeftTop.call(this,this.lastLT[0],this.lastLT[1])}}}},hideAction:function(){this.visible=false;if(this.useDisplay===true){this.setDisplayed(false)}else{this.setLeftTop(-10000,-10000)}},setVisible:function(E,D,G,H,F){if(E){this.showAction()}if(D&&E){var C=function(){this.sync(true);if(H){H()}}.createDelegate(this);A.setVisible.call(this,true,true,G,C,F)}else{if(!E){this.hideUnders(true)}var C=H;if(D){C=function(){this.hideAction();if(H){H()}}.createDelegate(this)}A.setVisible.call(this,E,D,G,C,F);if(E){this.sync(true)}else{if(!D){this.hideAction()}}}},storeXY:function(C){delete this.lastLT;this.lastXY=C},storeLeftTop:function(D,C){delete this.lastXY;this.lastLT=[D,C]},beforeFx:function(){this.beforeAction();return Ext.Layer.superclass.beforeFx.apply(this,arguments)},afterFx:function(){Ext.Layer.superclass.afterFx.apply(this,arguments);this.sync(this.isVisible())},beforeAction:function(){if(!this.updating&&this.shadow){this.shadow.hide()}},setLeft:function(C){this.storeLeftTop(C,this.getTop(true));A.setLeft.apply(this,arguments);this.sync()},setTop:function(C){this.storeLeftTop(this.getLeft(true),C);A.setTop.apply(this,arguments);this.sync()},setLeftTop:function(D,C){this.storeLeftTop(D,C);A.setLeftTop.apply(this,arguments);this.sync()},setXY:function(F,D,G,H,E){this.fixDisplay();this.beforeAction();this.storeXY(F);var C=this.createCB(H);A.setXY.call(this,F,D,G,C,E);if(!D){C()}},createCB:function(D){var C=this;return function(){C.constrainXY();C.sync(true);if(D){D()}}},setX:function(C,D,F,G,E){this.setXY([C,this.getY()],D,F,G,E)},setY:function(G,C,E,F,D){this.setXY([this.getX(),G],C,E,F,D)},setSize:function(E,F,D,H,I,G){this.beforeAction();var C=this.createCB(I);A.setSize.call(this,E,F,D,H,C,G);if(!D){C()}},setWidth:function(E,D,G,H,F){this.beforeAction();var C=this.createCB(H);A.setWidth.call(this,E,D,G,C,F);if(!D){C()}},setHeight:function(E,D,G,H,F){this.beforeAction();var C=this.createCB(H);A.setHeight.call(this,E,D,G,C,F);if(!D){C()}},setBounds:function(J,H,K,D,I,F,G,E){this.beforeAction();var C=this.createCB(G);if(!I){this.storeXY([J,H]);A.setXY.call(this,[J,H]);A.setSize.call(this,K,D,I,F,C,E);C()}else{A.setBounds.call(this,J,H,K,D,I,F,C,E)}return this},setZIndex:function(C){this.zindex=C;this.setStyle("z-index",C+2);if(this.shadow){this.shadow.setZIndex(C+1)}if(this.shim){this.shim.setStyle("z-index",C)}}})})(); +Ext.Shadow=function(C){Ext.apply(this,C);if(typeof this.mode!="string"){this.mode=this.defaultMode}var D=this.offset,B={h:0};var A=Math.floor(this.offset/2);switch(this.mode.toLowerCase()){case"drop":B.w=0;B.l=B.t=D;B.t-=1;if(Ext.isIE){B.l-=this.offset+A;B.t-=this.offset+A;B.w-=A;B.h-=A;B.t+=1}break;case"sides":B.w=(D*2);B.l=-D;B.t=D-1;if(Ext.isIE){B.l-=(this.offset-A);B.t-=this.offset+A;B.l+=1;B.w-=(this.offset-A)*2;B.w-=A+1;B.h-=1}break;case"frame":B.w=B.h=(D*2);B.l=B.t=-D;B.t+=1;B.h-=2;if(Ext.isIE){B.l-=(this.offset-A);B.t-=(this.offset-A);B.l+=1;B.w-=(this.offset+A+1);B.h-=(this.offset+A);B.h+=1}break}this.adjusts=B};Ext.Shadow.prototype={offset:4,defaultMode:"drop",show:function(A){A=Ext.get(A);if(!this.el){this.el=Ext.Shadow.Pool.pull();if(this.el.dom.nextSibling!=A.dom){this.el.insertBefore(A)}}this.el.setStyle("z-index",this.zIndex||parseInt(A.getStyle("z-index"),10)-1);if(Ext.isIE){this.el.dom.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity=50) progid:DXImageTransform.Microsoft.Blur(pixelradius="+(this.offset)+")"}this.realign(A.getLeft(true),A.getTop(true),A.getWidth(),A.getHeight());this.el.dom.style.display="block"},isVisible:function(){return this.el?true:false},realign:function(A,M,L,D){if(!this.el){return }var I=this.adjusts,G=this.el.dom,N=G.style;var E=0;N.left=(A+I.l)+"px";N.top=(M+I.t)+"px";var K=(L+I.w),C=(D+I.h),F=K+"px",J=C+"px";if(N.width!=F||N.height!=J){N.width=F;N.height=J;if(!Ext.isIE){var H=G.childNodes;var B=Math.max(0,(K-12))+"px";H[0].childNodes[1].style.width=B;H[1].childNodes[1].style.width=B;H[2].childNodes[1].style.width=B;H[1].style.height=Math.max(0,(C-12))+"px"}}},hide:function(){if(this.el){this.el.dom.style.display="none";Ext.Shadow.Pool.push(this.el);delete this.el}},setZIndex:function(A){this.zIndex=A;if(this.el){this.el.setStyle("z-index",A)}}};Ext.Shadow.Pool=function(){var B=[];var A=Ext.isIE?"
":"
";return{pull:function(){var C=B.shift();if(!C){C=Ext.get(Ext.DomHelper.insertHtml("beforeBegin",document.body.firstChild,A));C.autoBoxAdjust=false}return C},push:function(C){B.push(C)}}}(); +Ext.BoxComponent=Ext.extend(Ext.Component,{initComponent:function(){Ext.BoxComponent.superclass.initComponent.call(this);this.addEvents("resize","move")},boxReady:false,deferHeight:false,setSize:function(B,D){if(typeof B=="object"){D=B.height;B=B.width}if(!this.boxReady){this.width=B;this.height=D;return this}if(this.lastSize&&this.lastSize.width==B&&this.lastSize.height==D){return this}this.lastSize={width:B,height:D};var C=this.adjustSize(B,D);var F=C.width,A=C.height;if(F!==undefined||A!==undefined){var E=this.getResizeEl();if(!this.deferHeight&&F!==undefined&&A!==undefined){E.setSize(F,A)}else{if(!this.deferHeight&&A!==undefined){E.setHeight(A)}else{if(F!==undefined){E.setWidth(F)}}}this.onResize(F,A,B,D);this.fireEvent("resize",this,F,A,B,D)}return this},setWidth:function(A){return this.setSize(A)},setHeight:function(A){return this.setSize(undefined,A)},getSize:function(){return this.el.getSize()},getPosition:function(A){if(A===true){return[this.el.getLeft(true),this.el.getTop(true)]}return this.xy||this.el.getXY()},getBox:function(A){var B=this.el.getSize();if(A===true){B.x=this.el.getLeft(true);B.y=this.el.getTop(true)}else{var C=this.xy||this.el.getXY();B.x=C[0];B.y=C[1]}return B},updateBox:function(A){this.setSize(A.width,A.height);this.setPagePosition(A.x,A.y);return this},getResizeEl:function(){return this.resizeEl||this.el},getPositionEl:function(){return this.positionEl||this.el},setPosition:function(A,F){if(A&&typeof A[1]=="number"){F=A[1];A=A[0]}this.x=A;this.y=F;if(!this.boxReady){return this}var B=this.adjustPosition(A,F);var E=B.x,D=B.y;var C=this.getPositionEl();if(E!==undefined||D!==undefined){if(E!==undefined&&D!==undefined){C.setLeftTop(E,D)}else{if(E!==undefined){C.setLeft(E)}else{if(D!==undefined){C.setTop(D)}}}this.onPosition(E,D);this.fireEvent("move",this,E,D)}return this},setPagePosition:function(A,C){if(A&&typeof A[1]=="number"){C=A[1];A=A[0]}this.pageX=A;this.pageY=C;if(!this.boxReady){return }if(A===undefined||C===undefined){return }var B=this.el.translatePoints(A,C);this.setPosition(B.left,B.top);return this},onRender:function(B,A){Ext.BoxComponent.superclass.onRender.call(this,B,A);if(this.resizeEl){this.resizeEl=Ext.get(this.resizeEl)}if(this.positionEl){this.positionEl=Ext.get(this.positionEl)}},afterRender:function(){Ext.BoxComponent.superclass.afterRender.call(this);this.boxReady=true;this.setSize(this.width,this.height);if(this.x||this.y){this.setPosition(this.x,this.y)}else{if(this.pageX||this.pageY){this.setPagePosition(this.pageX,this.pageY)}}},syncSize:function(){delete this.lastSize;this.setSize(this.autoWidth?undefined:this.el.getWidth(),this.autoHeight?undefined:this.el.getHeight());return this},onResize:function(D,B,A,C){},onPosition:function(A,B){},adjustSize:function(A,B){if(this.autoWidth){A="auto"}if(this.autoHeight){B="auto"}return{width:A,height:B}},adjustPosition:function(A,B){return{x:A,y:B}}});Ext.reg("box",Ext.BoxComponent); +Ext.SplitBar=function(C,E,B,D,A){this.el=Ext.get(C,true);this.el.dom.unselectable="on";this.resizingEl=Ext.get(E,true);this.orientation=B||Ext.SplitBar.HORIZONTAL;this.minSize=0;this.maxSize=2000;this.animate=false;this.useShim=false;this.shim=null;if(!A){this.proxy=Ext.SplitBar.createProxy(this.orientation)}else{this.proxy=Ext.get(A).dom}this.dd=new Ext.dd.DDProxy(this.el.dom.id,"XSplitBars",{dragElId:this.proxy.id});this.dd.b4StartDrag=this.onStartProxyDrag.createDelegate(this);this.dd.endDrag=this.onEndProxyDrag.createDelegate(this);this.dragSpecs={};this.adapter=new Ext.SplitBar.BasicLayoutAdapter();this.adapter.init(this);if(this.orientation==Ext.SplitBar.HORIZONTAL){this.placement=D||(this.el.getX()>this.resizingEl.getX()?Ext.SplitBar.LEFT:Ext.SplitBar.RIGHT);this.el.addClass("x-splitbar-h")}else{this.placement=D||(this.el.getY()>this.resizingEl.getY()?Ext.SplitBar.TOP:Ext.SplitBar.BOTTOM);this.el.addClass("x-splitbar-v")}this.addEvents("resize","moved","beforeresize","beforeapply");Ext.SplitBar.superclass.constructor.call(this)};Ext.extend(Ext.SplitBar,Ext.util.Observable,{onStartProxyDrag:function(A,E){this.fireEvent("beforeresize",this);this.overlay=Ext.DomHelper.append(document.body,{cls:"x-drag-overlay",html:" "},true);this.overlay.unselectable();this.overlay.setSize(Ext.lib.Dom.getViewWidth(true),Ext.lib.Dom.getViewHeight(true));this.overlay.show();Ext.get(this.proxy).setDisplayed("block");var C=this.adapter.getElementSize(this);this.activeMinSize=this.getMinimumSize();this.activeMaxSize=this.getMaximumSize();var D=C-this.activeMinSize;var B=Math.max(this.activeMaxSize-C,0);if(this.orientation==Ext.SplitBar.HORIZONTAL){this.dd.resetConstraints();this.dd.setXConstraint(this.placement==Ext.SplitBar.LEFT?D:B,this.placement==Ext.SplitBar.LEFT?B:D);this.dd.setYConstraint(0,0)}else{this.dd.resetConstraints();this.dd.setXConstraint(0,0);this.dd.setYConstraint(this.placement==Ext.SplitBar.TOP?D:B,this.placement==Ext.SplitBar.TOP?B:D)}this.dragSpecs.startSize=C;this.dragSpecs.startPoint=[A,E];Ext.dd.DDProxy.prototype.b4StartDrag.call(this.dd,A,E)},onEndProxyDrag:function(C){Ext.get(this.proxy).setDisplayed(false);var B=Ext.lib.Event.getXY(C);if(this.overlay){this.overlay.remove();delete this.overlay}var A;if(this.orientation==Ext.SplitBar.HORIZONTAL){A=this.dragSpecs.startSize+(this.placement==Ext.SplitBar.LEFT?B[0]-this.dragSpecs.startPoint[0]:this.dragSpecs.startPoint[0]-B[0])}else{A=this.dragSpecs.startSize+(this.placement==Ext.SplitBar.TOP?B[1]-this.dragSpecs.startPoint[1]:this.dragSpecs.startPoint[1]-B[1])}A=Math.min(Math.max(A,this.activeMinSize),this.activeMaxSize);if(A!=this.dragSpecs.startSize){if(this.fireEvent("beforeapply",this,A)!==false){this.adapter.setElementSize(this,A);this.fireEvent("moved",this,A);this.fireEvent("resize",this,A)}}},getAdapter:function(){return this.adapter},setAdapter:function(A){this.adapter=A;this.adapter.init(this)},getMinimumSize:function(){return this.minSize},setMinimumSize:function(A){this.minSize=A},getMaximumSize:function(){return this.maxSize},setMaximumSize:function(A){this.maxSize=A},setCurrentSize:function(B){var A=this.animate;this.animate=false;this.adapter.setElementSize(this,B);this.animate=A},destroy:function(A){if(this.shim){this.shim.remove()}this.dd.unreg();Ext.removeNode(this.proxy);if(A){this.el.remove()}}});Ext.SplitBar.createProxy=function(B){var C=new Ext.Element(document.createElement("div"));C.unselectable();var A="x-splitbar-proxy";C.addClass(A+" "+(B==Ext.SplitBar.HORIZONTAL?A+"-h":A+"-v"));document.body.appendChild(C.dom);return C.dom};Ext.SplitBar.BasicLayoutAdapter=function(){};Ext.SplitBar.BasicLayoutAdapter.prototype={init:function(A){},getElementSize:function(A){if(A.orientation==Ext.SplitBar.HORIZONTAL){return A.resizingEl.getWidth()}else{return A.resizingEl.getHeight()}},setElementSize:function(B,A,C){if(B.orientation==Ext.SplitBar.HORIZONTAL){if(!B.animate){B.resizingEl.setWidth(A);if(C){C(B,A)}}else{B.resizingEl.setWidth(A,true,0.1,C,"easeOut")}}else{if(!B.animate){B.resizingEl.setHeight(A);if(C){C(B,A)}}else{B.resizingEl.setHeight(A,true,0.1,C,"easeOut")}}}};Ext.SplitBar.AbsoluteLayoutAdapter=function(A){this.basic=new Ext.SplitBar.BasicLayoutAdapter();this.container=Ext.get(A)};Ext.SplitBar.AbsoluteLayoutAdapter.prototype={init:function(A){this.basic.init(A)},getElementSize:function(A){return this.basic.getElementSize(A)},setElementSize:function(B,A,C){this.basic.setElementSize(B,A,this.moveSplitter.createDelegate(this,[B]))},moveSplitter:function(A){var B=Ext.SplitBar;switch(A.placement){case B.LEFT:A.el.setX(A.resizingEl.getRight());break;case B.RIGHT:A.el.setStyle("right",(this.container.getWidth()-A.resizingEl.getLeft())+"px");break;case B.TOP:A.el.setY(A.resizingEl.getBottom());break;case B.BOTTOM:A.el.setY(A.resizingEl.getTop()-A.el.getHeight());break}}};Ext.SplitBar.VERTICAL=1;Ext.SplitBar.HORIZONTAL=2;Ext.SplitBar.LEFT=1;Ext.SplitBar.RIGHT=2;Ext.SplitBar.TOP=3;Ext.SplitBar.BOTTOM=4; +Ext.Container=Ext.extend(Ext.BoxComponent,{autoDestroy:true,defaultType:"panel",initComponent:function(){Ext.Container.superclass.initComponent.call(this);this.addEvents("afterlayout","beforeadd","beforeremove","add","remove");var A=this.items;if(A){delete this.items;if(Ext.isArray(A)){this.add.apply(this,A)}else{this.add(A)}}},initItems:function(){if(!this.items){this.items=new Ext.util.MixedCollection(false,this.getComponentId);this.getLayout()}},setLayout:function(A){if(this.layout&&this.layout!=A){this.layout.setContainer(null)}this.initItems();this.layout=A;A.setContainer(this)},render:function(){Ext.Container.superclass.render.apply(this,arguments);if(this.layout){if(typeof this.layout=="string"){this.layout=new Ext.Container.LAYOUTS[this.layout.toLowerCase()](this.layoutConfig)}this.setLayout(this.layout);if(this.activeItem!==undefined){var A=this.activeItem;delete this.activeItem;this.layout.setActiveItem(A);return }}if(!this.ownerCt){this.doLayout()}if(this.monitorResize===true){Ext.EventManager.onWindowResize(this.doLayout,this,[false])}},getLayoutTarget:function(){return this.el},getComponentId:function(A){return A.itemId||A.id},add:function(C){if(!this.items){this.initItems()}var B=arguments,A=B.length;if(A>1){for(var D=0;D2){for(var E=A-1;E>=1;--E){this.insert(D,B[E])}return }var F=this.lookupComponent(this.applyDefaults(C));if(F.ownerCt==this&&this.items.indexOf(F)0){B.setSize(A)}}});Ext.Container.LAYOUTS["fit"]=Ext.layout.FitLayout; +Ext.layout.CardLayout=Ext.extend(Ext.layout.FitLayout,{deferredRender:false,renderHidden:true,setActiveItem:function(A){A=this.container.getComponent(A);if(this.activeItem!=A){if(this.activeItem){this.activeItem.hide()}this.activeItem=A;A.show();this.layout()}},renderAll:function(A,B){if(this.deferredRender){this.renderItem(this.activeItem,undefined,B)}else{Ext.layout.CardLayout.superclass.renderAll.call(this,A,B)}}});Ext.Container.LAYOUTS["card"]=Ext.layout.CardLayout; +Ext.layout.AnchorLayout=Ext.extend(Ext.layout.ContainerLayout,{monitorResize:true,getAnchorViewSize:function(A,B){return B.dom==document.body?B.getViewSize():B.getStyleSize()},onLayout:function(F,I){Ext.layout.AnchorLayout.superclass.onLayout.call(this,F,I);var O=this.getAnchorViewSize(F,I);var M=O.width,E=O.height;if(M<20||E<20){return }var B,K;if(F.anchorSize){if(typeof F.anchorSize=="number"){B=F.anchorSize}else{B=F.anchorSize.width;K=F.anchorSize.height}}else{B=F.initialConfig.width;K=F.initialConfig.height}var H=F.items.items,G=H.length,D,J,L,C,A;for(D=0;D ");B.disableFormats=true;B.compile();Ext.layout.BorderLayout.Region.prototype.toolTemplate=B}this.collapsedEl=this.targetEl.createChild({cls:"x-layout-collapsed x-layout-collapsed-"+this.position,id:this.panel.id+"-xcollapsed"});this.collapsedEl.enableDisplayMode("block");if(this.collapseMode=="mini"){this.collapsedEl.addClass("x-layout-cmini-"+this.position);this.miniCollapsedEl=this.collapsedEl.createChild({cls:"x-layout-mini x-layout-mini-"+this.position,html:" "});this.miniCollapsedEl.addClassOnOver("x-layout-mini-over");this.collapsedEl.addClassOnOver("x-layout-collapsed-over");this.collapsedEl.on("click",this.onExpandClick,this,{stopEvent:true})}else{var A=this.toolTemplate.append(this.collapsedEl.dom,{id:"expand-"+this.position},true);A.addClassOnOver("x-tool-expand-"+this.position+"-over");A.on("click",this.onExpandClick,this,{stopEvent:true});if(this.floatable!==false){this.collapsedEl.addClassOnOver("x-layout-collapsed-over");this.collapsedEl.on("click",this.collapseClick,this)}}}return this.collapsedEl},onExpandClick:function(A){if(this.isSlid){this.afterSlideIn();this.panel.expand(false)}else{this.panel.expand()}},onCollapseClick:function(A){this.panel.collapse()},beforeCollapse:function(B,A){this.lastAnim=A;if(this.splitEl){this.splitEl.hide()}this.getCollapsedEl().show();this.panel.el.setStyle("z-index",100);this.isCollapsed=true;this.layout.layout()},onCollapse:function(A){this.panel.el.setStyle("z-index",1);if(this.lastAnim===false||this.panel.animCollapse===false){this.getCollapsedEl().dom.style.visibility="visible"}else{this.getCollapsedEl().slideIn(this.panel.slideAnchor,{duration:0.2})}this.state.collapsed=true;this.panel.saveState()},beforeExpand:function(A){var B=this.getCollapsedEl();this.el.show();if(this.position=="east"||this.position=="west"){this.panel.setSize(undefined,B.getHeight())}else{this.panel.setSize(B.getWidth(),undefined)}B.hide();B.dom.style.visibility="hidden";this.panel.el.setStyle("z-index",100)},onExpand:function(){this.isCollapsed=false;if(this.splitEl){this.splitEl.show()}this.layout.layout();this.panel.el.setStyle("z-index",1);this.state.collapsed=false;this.panel.saveState()},collapseClick:function(A){if(this.isSlid){A.stopPropagation();this.slideIn()}else{A.stopPropagation();this.slideOut()}},onHide:function(){if(this.isCollapsed){this.getCollapsedEl().hide()}else{if(this.splitEl){this.splitEl.hide()}}},onShow:function(){if(this.isCollapsed){this.getCollapsedEl().show()}else{if(this.splitEl){this.splitEl.show()}}},isVisible:function(){return !this.panel.hidden},getMargins:function(){return this.isCollapsed&&this.cmargins?this.cmargins:this.margins},getSize:function(){return this.isCollapsed?this.getCollapsedEl().getSize():this.panel.getSize()},setPanel:function(A){this.panel=A},getMinWidth:function(){return this.minWidth},getMinHeight:function(){return this.minHeight},applyLayoutCollapsed:function(A){var B=this.getCollapsedEl();B.setLeftTop(A.x,A.y);B.setSize(A.width,A.height)},applyLayout:function(A){if(this.isCollapsed){this.applyLayoutCollapsed(A)}else{this.panel.setPosition(A.x,A.y);this.panel.setSize(A.width,A.height)}},beforeSlide:function(){this.panel.beforeEffect()},afterSlide:function(){this.panel.afterEffect()},initAutoHide:function(){if(this.autoHide!==false){if(!this.autoHideHd){var A=new Ext.util.DelayedTask(this.slideIn,this);this.autoHideHd={"mouseout":function(B){if(!B.within(this.el,true)){A.delay(500)}},"mouseover":function(B){A.cancel()},scope:this}}this.el.on(this.autoHideHd)}},clearAutoHide:function(){if(this.autoHide!==false){this.el.un("mouseout",this.autoHideHd.mouseout);this.el.un("mouseover",this.autoHideHd.mouseover)}},clearMonitor:function(){Ext.getDoc().un("click",this.slideInIf,this)},slideOut:function(){if(this.isSlid||this.el.hasActiveFx()){return }this.isSlid=true;var A=this.panel.tools;if(A&&A.toggle){A.toggle.hide()}this.el.show();if(this.position=="east"||this.position=="west"){this.panel.setSize(undefined,this.collapsedEl.getHeight())}else{this.panel.setSize(this.collapsedEl.getWidth(),undefined)}this.restoreLT=[this.el.dom.style.left,this.el.dom.style.top];this.el.alignTo(this.collapsedEl,this.getCollapseAnchor());this.el.setStyle("z-index",102);if(this.animFloat!==false){this.beforeSlide();this.el.slideIn(this.getSlideAnchor(),{callback:function(){this.afterSlide();this.initAutoHide();Ext.getDoc().on("click",this.slideInIf,this)},scope:this,block:true})}else{this.initAutoHide();Ext.getDoc().on("click",this.slideInIf,this)}},afterSlideIn:function(){this.clearAutoHide();this.isSlid=false;this.clearMonitor();this.el.setStyle("z-index","");this.el.dom.style.left=this.restoreLT[0];this.el.dom.style.top=this.restoreLT[1];var A=this.panel.tools;if(A&&A.toggle){A.toggle.show()}},slideIn:function(A){if(!this.isSlid||this.el.hasActiveFx()){Ext.callback(A);return }this.isSlid=false;if(this.animFloat!==false){this.beforeSlide();this.el.slideOut(this.getSlideAnchor(),{callback:function(){this.el.hide();this.afterSlide();this.afterSlideIn();Ext.callback(A)},scope:this,block:true})}else{this.el.hide();this.afterSlideIn()}},slideInIf:function(A){if(!A.within(this.el)){this.slideIn()}},anchors:{"west":"left","east":"right","north":"top","south":"bottom"},sanchors:{"west":"l","east":"r","north":"t","south":"b"},canchors:{"west":"tl-tr","east":"tr-tl","north":"tl-bl","south":"bl-tl"},getAnchor:function(){return this.anchors[this.position]},getCollapseAnchor:function(){return this.canchors[this.position]},getSlideAnchor:function(){return this.sanchors[this.position]},getAlignAdj:function(){var A=this.cmargins;switch(this.position){case"west":return[0,0];break;case"east":return[0,0];break;case"north":return[0,0];break;case"south":return[0,0];break}},getExpandAdj:function(){var B=this.collapsedEl,A=this.cmargins;switch(this.position){case"west":return[-(A.right+B.getWidth()+A.left),0];break;case"east":return[A.right+B.getWidth()+A.left,0];break;case"north":return[0,-(A.top+A.bottom+B.getHeight())];break;case"south":return[0,A.top+A.bottom+B.getHeight()];break}}};Ext.layout.BorderLayout.SplitRegion=function(B,A,C){Ext.layout.BorderLayout.SplitRegion.superclass.constructor.call(this,B,A,C);this.applyLayout=this.applyFns[C]};Ext.extend(Ext.layout.BorderLayout.SplitRegion,Ext.layout.BorderLayout.Region,{splitTip:"Drag to resize.",collapsibleSplitTip:"Drag to resize. Double click to hide.",useSplitTips:false,splitSettings:{north:{orientation:Ext.SplitBar.VERTICAL,placement:Ext.SplitBar.TOP,maxFn:"getVMaxSize",minProp:"minHeight",maxProp:"maxHeight"},south:{orientation:Ext.SplitBar.VERTICAL,placement:Ext.SplitBar.BOTTOM,maxFn:"getVMaxSize",minProp:"minHeight",maxProp:"maxHeight"},east:{orientation:Ext.SplitBar.HORIZONTAL,placement:Ext.SplitBar.RIGHT,maxFn:"getHMaxSize",minProp:"minWidth",maxProp:"maxWidth"},west:{orientation:Ext.SplitBar.HORIZONTAL,placement:Ext.SplitBar.LEFT,maxFn:"getHMaxSize",minProp:"minWidth",maxProp:"maxWidth"}},applyFns:{west:function(C){if(this.isCollapsed){return this.applyLayoutCollapsed(C)}var D=this.splitEl.dom,B=D.style;this.panel.setPosition(C.x,C.y);var A=D.offsetWidth;B.left=(C.x+C.width-A)+"px";B.top=(C.y)+"px";B.height=Math.max(0,C.height)+"px";this.panel.setSize(C.width-A,C.height)},east:function(C){if(this.isCollapsed){return this.applyLayoutCollapsed(C)}var D=this.splitEl.dom,B=D.style;var A=D.offsetWidth;this.panel.setPosition(C.x+A,C.y);B.left=(C.x)+"px";B.top=(C.y)+"px";B.height=Math.max(0,C.height)+"px";this.panel.setSize(C.width-A,C.height)},north:function(C){if(this.isCollapsed){return this.applyLayoutCollapsed(C)}var D=this.splitEl.dom,B=D.style;var A=D.offsetHeight;this.panel.setPosition(C.x,C.y);B.left=(C.x)+"px";B.top=(C.y+C.height-A)+"px";B.width=Math.max(0,C.width)+"px";this.panel.setSize(C.width,C.height-A)},south:function(C){if(this.isCollapsed){return this.applyLayoutCollapsed(C)}var D=this.splitEl.dom,B=D.style;var A=D.offsetHeight;this.panel.setPosition(C.x,C.y+A);B.left=(C.x)+"px";B.top=(C.y)+"px";B.width=Math.max(0,C.width)+"px";this.panel.setSize(C.width,C.height-A)}},render:function(A,C){Ext.layout.BorderLayout.SplitRegion.superclass.render.call(this,A,C);var D=this.position;this.splitEl=A.createChild({cls:"x-layout-split x-layout-split-"+D,html:" ",id:this.panel.id+"-xsplit"});if(this.collapseMode=="mini"){this.miniSplitEl=this.splitEl.createChild({cls:"x-layout-mini x-layout-mini-"+D,html:" "});this.miniSplitEl.addClassOnOver("x-layout-mini-over");this.miniSplitEl.on("click",this.onCollapseClick,this,{stopEvent:true})}var B=this.splitSettings[D];this.split=new Ext.SplitBar(this.splitEl.dom,C.el,B.orientation);this.split.placement=B.placement;this.split.getMaximumSize=this[B.maxFn].createDelegate(this);this.split.minSize=this.minSize||this[B.minProp];this.split.on("beforeapply",this.onSplitMove,this);this.split.useShim=this.useShim===true;this.maxSize=this.maxSize||this[B.maxProp];if(C.hidden){this.splitEl.hide()}if(this.useSplitTips){this.splitEl.dom.title=this.collapsible?this.collapsibleSplitTip:this.splitTip}if(this.collapsible){this.splitEl.on("dblclick",this.onCollapseClick,this)}},getSize:function(){if(this.isCollapsed){return this.collapsedEl.getSize()}var A=this.panel.getSize();if(this.position=="north"||this.position=="south"){A.height+=this.splitEl.dom.offsetHeight}else{A.width+=this.splitEl.dom.offsetWidth}return A},getHMaxSize:function(){var B=this.maxSize||10000;var A=this.layout.center;return Math.min(B,(this.el.getWidth()+A.el.getWidth())-A.getMinWidth())},getVMaxSize:function(){var B=this.maxSize||10000;var A=this.layout.center;return Math.min(B,(this.el.getHeight()+A.el.getHeight())-A.getMinHeight())},onSplitMove:function(B,A){var C=this.panel.getSize();this.lastSplitSize=A;if(this.position=="north"||this.position=="south"){this.panel.setSize(C.width,A);this.state.height=A}else{this.panel.setSize(A,C.height);this.state.width=A}this.layout.layout();this.panel.saveState();return false},getSplitBar:function(){return this.split}});Ext.Container.LAYOUTS["border"]=Ext.layout.BorderLayout; +Ext.layout.FormLayout=Ext.extend(Ext.layout.AnchorLayout,{labelSeparator:":",getAnchorViewSize:function(A,B){return A.body.getStyleSize()},setContainer:function(B){Ext.layout.FormLayout.superclass.setContainer.call(this,B);if(B.labelAlign){B.addClass("x-form-label-"+B.labelAlign)}if(B.hideLabels){this.labelStyle="display:none";this.elementStyle="padding-left:0;";this.labelAdjust=0}else{this.labelSeparator=B.labelSeparator||this.labelSeparator;B.labelWidth=B.labelWidth||100;if(typeof B.labelWidth=="number"){var C=(typeof B.labelPad=="number"?B.labelPad:5);this.labelAdjust=B.labelWidth+C;this.labelStyle="width:"+B.labelWidth+"px;";this.elementStyle="padding-left:"+(B.labelWidth+C)+"px"}if(B.labelAlign=="top"){this.labelStyle="width:auto;";this.labelAdjust=0;this.elementStyle="padding-left:0;"}}if(!this.fieldTpl){var A=new Ext.Template("
","","
","
","
");A.disableFormats=true;A.compile();Ext.layout.FormLayout.prototype.fieldTpl=A}},renderItem:function(D,A,C){if(D&&!D.rendered&&D.isFormField&&D.inputType!="hidden"){var B=[D.id,D.fieldLabel,D.labelStyle||this.labelStyle||"",this.elementStyle||"",typeof D.labelSeparator=="undefined"?this.labelSeparator:D.labelSeparator,(D.itemCls||this.container.itemCls||"")+(D.hideLabel?" x-hide-label":""),D.clearCls||"x-form-clear-left"];if(typeof A=="number"){A=C.dom.childNodes[A]||null}if(A){this.fieldTpl.insertBefore(A,B)}else{this.fieldTpl.append(C,B)}D.render("x-form-el-"+D.id)}else{Ext.layout.FormLayout.superclass.renderItem.apply(this,arguments)}},adjustWidthAnchor:function(B,A){return B-(A.isFormField?(A.hideLabel?0:this.labelAdjust):0)},isValidParent:function(B,A){return true}});Ext.Container.LAYOUTS["form"]=Ext.layout.FormLayout; +Ext.layout.Accordion=Ext.extend(Ext.layout.FitLayout,{fill:true,autoWidth:true,titleCollapse:true,hideCollapseTool:false,collapseFirst:false,animate:false,sequence:false,activeOnTop:false,renderItem:function(A){if(this.animate===false){A.animCollapse=false}A.collapsible=true;if(this.autoWidth){A.autoWidth=true}if(this.titleCollapse){A.titleCollapse=true}if(this.hideCollapseTool){A.hideCollapseTool=true}if(this.collapseFirst!==undefined){A.collapseFirst=this.collapseFirst}if(!this.activeItem&&!A.collapsed){this.activeItem=A}else{if(this.activeItem){A.collapsed=true}}Ext.layout.Accordion.superclass.renderItem.apply(this,arguments);A.header.addClass("x-accordion-hd");A.on("beforeexpand",this.beforeExpand,this)},beforeExpand:function(C,B){var A=this.activeItem;if(A){if(this.sequence){delete this.activeItem;A.collapse({callback:function(){C.expand(B||true)},scope:this});return false}else{A.collapse(this.animate)}}this.activeItem=C;if(this.activeOnTop){C.el.dom.parentNode.insertBefore(C.el.dom,C.el.dom.parentNode.firstChild)}this.layout()},setItemSize:function(F,E){if(this.fill&&F){var B=this.container.items.items;var D=0;for(var C=0,A=B.length;C=B)||(this.cells[C]&&this.cells[C][A])){if(B&&A>=B){C++;A=0}else{A++}}return[A,C]},renderItem:function(C,A,B){if(C&&!C.rendered){C.render(this.getNextCell(C))}},isValidParent:function(B,A){return true}});Ext.Container.LAYOUTS["table"]=Ext.layout.TableLayout; +Ext.layout.AbsoluteLayout=Ext.extend(Ext.layout.AnchorLayout,{extraCls:"x-abs-layout-item",isForm:false,setContainer:function(A){Ext.layout.AbsoluteLayout.superclass.setContainer.call(this,A);if(A.isXType("form")){this.isForm=true}},onLayout:function(A,B){if(this.isForm){A.body.position()}else{B.position()}Ext.layout.AbsoluteLayout.superclass.onLayout.call(this,A,B)},getAnchorViewSize:function(A,B){return this.isForm?A.body.getStyleSize():Ext.layout.AbsoluteLayout.superclass.getAnchorViewSize.call(this,A,B)},isValidParent:function(B,A){return this.isForm?true:Ext.layout.AbsoluteLayout.superclass.isValidParent.call(this,B,A)},adjustWidthAnchor:function(B,A){return B?B-A.getPosition(true)[0]:B},adjustHeightAnchor:function(B,A){return B?B-A.getPosition(true)[1]:B}});Ext.Container.LAYOUTS["absolute"]=Ext.layout.AbsoluteLayout; +Ext.Viewport=Ext.extend(Ext.Container,{initComponent:function(){Ext.Viewport.superclass.initComponent.call(this);document.getElementsByTagName("html")[0].className+=" x-viewport";this.el=Ext.getBody();this.el.setHeight=Ext.emptyFn;this.el.setWidth=Ext.emptyFn;this.el.setSize=Ext.emptyFn;this.el.dom.scroll="no";this.allowDomMove=false;this.autoWidth=true;this.autoHeight=true;Ext.EventManager.onWindowResize(this.fireResize,this);this.renderTo=this.el},fireResize:function(A,B){this.fireEvent("resize",this,A,B,A,B)}});Ext.reg("viewport",Ext.Viewport); +Ext.Panel=Ext.extend(Ext.Container,{baseCls:"x-panel",collapsedCls:"x-panel-collapsed",maskDisabled:true,animCollapse:Ext.enableFx,headerAsText:true,buttonAlign:"right",collapsed:false,collapseFirst:true,minButtonWidth:75,elements:"body",toolTarget:"header",collapseEl:"bwrap",slideAnchor:"t",deferHeight:true,expandDefaults:{duration:0.25},collapseDefaults:{duration:0.25},initComponent:function(){Ext.Panel.superclass.initComponent.call(this);this.addEvents("bodyresize","titlechange","collapse","expand","beforecollapse","beforeexpand","beforeclose","close","activate","deactivate");if(this.tbar){this.elements+=",tbar";if(typeof this.tbar=="object"){this.topToolbar=this.tbar}delete this.tbar}if(this.bbar){this.elements+=",bbar";if(typeof this.bbar=="object"){this.bottomToolbar=this.bbar}delete this.bbar}if(this.header===true){this.elements+=",header";delete this.header}else{if(this.title&&this.header!==false){this.elements+=",header"}}if(this.footer===true){this.elements+=",footer";delete this.footer}if(this.buttons){var C=this.buttons;this.buttons=[];for(var B=0,A=C.length;B"+this.header.dom.innerHTML+"";if(this.iconCls){this.setIconClass(this.iconCls)}}}if(this.floating){this.makeFloating(this.floating)}if(this.collapsible){this.tools=this.tools?this.tools.slice(0):[];if(!this.hideCollapseTool){this.tools[this.collapseFirst?"unshift":"push"]({id:"toggle",handler:this.toggleCollapse,scope:this})}if(this.titleCollapse&&this.header){this.header.on("click",this.toggleCollapse,this);this.header.setStyle("cursor","pointer")}}if(this.tools){var J=this.tools;this.tools={};this.addTool.apply(this,J)}else{this.tools={}}if(this.buttons&&this.buttons.length>0){var D=this.footer.createChild({cls:"x-panel-btns-ct",cn:{cls:"x-panel-btns x-panel-btns-"+this.buttonAlign,html:"
"}},null,true);var L=D.getElementsByTagName("tr")[0];for(var F=0,I=this.buttons.length;F ");F.disableFormats=true;F.compile();Ext.Panel.prototype.toolTemplate=F}for(var E=0,C=arguments,B=C.length;E0){J.sort(C);var I=J[0].manager.zseed;for(var K=0;K=0;--H){if(!D[H].hidden){B(D[H]);return }}B(null)};return{zseed:9000,register:function(H){F[H.id]=H;D.push(H);H.on("hide",A)},unregister:function(H){delete F[H.id];H.un("hide",A);D.remove(H)},get:function(H){return typeof H=="object"?H:F[H]},bringToFront:function(H){H=this.get(H);if(H!=E){H._lastAccess=new Date().getTime();G();return true}return false},sendToBack:function(H){H=this.get(H);H._lastAccess=-(new Date().getTime());G();return H},hideAll:function(){for(var H in F){if(F[H]&&typeof F[H]!="function"&&F[H].isVisible()){F[H].hide()}}},getActive:function(){return E},getBy:function(J,I){var K=[];for(var H=D.length-1;H>=0;--H){var L=D[H];if(J.call(I||L,L)!==false){K.push(L)}}return K},each:function(I,H){for(var J in F){if(F[J]&&typeof F[J]!="function"){if(I.call(H||F[J],F[J])===false){return }}}}}};Ext.WindowMgr=new Ext.WindowGroup(); +Ext.dd.PanelProxy=function(A,B){this.panel=A;this.id=this.panel.id+"-ddproxy";Ext.apply(this,B)};Ext.dd.PanelProxy.prototype={insertProxy:true,setStatus:Ext.emptyFn,reset:Ext.emptyFn,update:Ext.emptyFn,stop:Ext.emptyFn,sync:Ext.emptyFn,getEl:function(){return this.ghost},getGhost:function(){return this.ghost},getProxy:function(){return this.proxy},hide:function(){if(this.ghost){if(this.proxy){this.proxy.remove();delete this.proxy}this.panel.el.dom.style.display="";this.ghost.remove();delete this.ghost}},show:function(){if(!this.ghost){this.ghost=this.panel.createGhost(undefined,undefined,Ext.getBody());this.ghost.setXY(this.panel.el.getXY());if(this.insertProxy){this.proxy=this.panel.el.insertSibling({cls:"x-panel-dd-spacer"});this.proxy.setSize(this.panel.getSize())}this.panel.el.dom.style.display="none"}},repair:function(B,C,A){this.hide();if(typeof C=="function"){C.call(A||this)}},moveProxy:function(A,B){if(this.proxy){A.insertBefore(this.proxy.dom,B)}}};Ext.Panel.DD=function(B,A){this.panel=B;this.dragData={panel:B};this.proxy=new Ext.dd.PanelProxy(B,A);Ext.Panel.DD.superclass.constructor.call(this,B.el,A);this.setHandleElId(B.header.id);B.header.setStyle("cursor","move");this.scroll=false};Ext.extend(Ext.Panel.DD,Ext.dd.DragSource,{showFrame:Ext.emptyFn,startDrag:Ext.emptyFn,b4StartDrag:function(A,B){this.proxy.show()},b4MouseDown:function(B){var A=B.getPageX();var C=B.getPageY();this.autoOffset(A,C)},onInitDrag:function(A,B){this.onStartDrag(A,B);return true},createFrame:Ext.emptyFn,getDragEl:function(A){return this.proxy.ghost.dom},endDrag:function(A){this.proxy.hide();this.panel.saveState()},autoOffset:function(A,B){A-=this.startPageX;B-=this.startPageY;this.setDelta(A,B)}}); +Ext.state.Provider=function(){this.addEvents("statechange");this.state={};Ext.state.Provider.superclass.constructor.call(this)};Ext.extend(Ext.state.Provider,Ext.util.Observable,{get:function(B,A){return typeof this.state[B]=="undefined"?A:this.state[B]},clear:function(A){delete this.state[A];this.fireEvent("statechange",this,A,null)},set:function(A,B){this.state[A]=B;this.fireEvent("statechange",this,A,B)},decodeValue:function(A){var J=/^(a|n|d|b|s|o)\:(.*)$/;var C=J.exec(unescape(A));if(!C||!C[1]){return }var F=C[1];var H=C[2];switch(F){case"n":return parseFloat(H);case"d":return new Date(Date.parse(H));case"b":return(H=="1");case"a":var G=[];var I=H.split("^");for(var B=0,D=I.length;B=A;C--){B.push(D[C])}}return B},indexOf:function(A){A=this.getNode(A);if(typeof A.viewIndex=="number"){return A.viewIndex}return this.all.indexOf(A)},onBeforeLoad:function(){if(this.loadingText){this.clearSelections(false,true);this.el.update("
"+this.loadingText+"
");this.all.clear()}}});Ext.reg("dataview",Ext.DataView); +Ext.ColorPalette=function(A){Ext.ColorPalette.superclass.constructor.call(this,A);this.addEvents("select");if(this.handler){this.on("select",this.handler,this.scope,true)}};Ext.extend(Ext.ColorPalette,Ext.Component,{itemCls:"x-color-palette",value:null,clickEvent:"click",ctype:"Ext.ColorPalette",allowReselect:false,colors:["000000","993300","333300","003300","003366","000080","333399","333333","800000","FF6600","808000","008000","008080","0000FF","666699","808080","FF0000","FF9900","99CC00","339966","33CCCC","3366FF","800080","969696","FF00FF","FFCC00","FFFF00","00FF00","00FFFF","00CCFF","993366","C0C0C0","FF99CC","FFCC99","FFFF99","CCFFCC","CCFFFF","99CCFF","CC99FF","FFFFFF"],onRender:function(B,A){var C=this.tpl||new Ext.XTemplate(" ");var D=document.createElement("div");D.className=this.itemCls;C.overwrite(D,this.colors);B.dom.insertBefore(D,A);this.el=Ext.get(D);this.el.on(this.clickEvent,this.handleClick,this,{delegate:"a"});if(this.clickEvent!="click"){this.el.on("click",Ext.emptyFn,this,{delegate:"a",preventDefault:true})}},afterRender:function(){Ext.ColorPalette.superclass.afterRender.call(this);if(this.value){var A=this.value;this.value=null;this.select(A)}},handleClick:function(B,A){B.preventDefault();if(!this.disabled){var C=A.className.match(/(?:^|\s)color-(.{6})(?:\s|$)/)[1];this.select(C.toUpperCase())}},select:function(A){A=A.replace("#","");if(A!=this.value||this.allowReselect){var B=this.el;if(this.value){B.child("a.color-"+this.value).removeClass("x-color-palette-sel")}B.child("a.color-"+A).addClass("x-color-palette-sel");this.value=A;this.fireEvent("select",this,A)}}});Ext.reg("colorpalette",Ext.ColorPalette); +Ext.DatePicker=Ext.extend(Ext.Component,{todayText:"Today",okText:" OK ",cancelText:"Cancel",todayTip:"{0} (Spacebar)",minDate:null,maxDate:null,minText:"This date is before the minimum date",maxText:"This date is after the maximum date",format:"m/d/y",disabledDays:null,disabledDaysText:"",disabledDatesRE:null,disabledDatesText:"",constrainToViewport:true,monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:"Next Month (Control+Right)",prevText:"Previous Month (Control+Left)",monthYearText:"Choose a month (Control+Up/Down to move years)",startDay:0,initComponent:function(){Ext.DatePicker.superclass.initComponent.call(this);this.value=this.value?this.value.clearTime():new Date().clearTime();this.addEvents("select");if(this.handler){this.on("select",this.handler,this.scope||this)}this.initDisabledDays()},initDisabledDays:function(){if(!this.disabledDatesRE&&this.disabledDates){var A=this.disabledDates;var C="(?:";for(var B=0;B","  ",""];var E=this.dayNames;for(var D=0;D<7;D++){var G=this.startDay+D;if(G>6){G=G-7}C.push("")}C[C.length]="";for(var D=0;D<42;D++){if(D%7==0&&D!=0){C[C.length]=""}C[C.length]=""}C[C.length]="
",E[G].substr(0,1),"
";var B=document.createElement("div");B.className="x-date-picker";B.innerHTML=C.join("");A.dom.insertBefore(B,F);this.el=Ext.get(B);this.eventEl=Ext.get(B.firstChild);new Ext.util.ClickRepeater(this.el.child("td.x-date-left a"),{handler:this.showPrevMonth,scope:this,preventDefault:true,stopDefault:true});new Ext.util.ClickRepeater(this.el.child("td.x-date-right a"),{handler:this.showNextMonth,scope:this,preventDefault:true,stopDefault:true});this.eventEl.on("mousewheel",this.handleMouseWheel,this);this.monthPicker=this.el.down("div.x-date-mp");this.monthPicker.enableDisplayMode("block");var I=new Ext.KeyNav(this.eventEl,{"left":function(J){J.ctrlKey?this.showPrevMonth():this.update(this.activeDate.add("d",-1))},"right":function(J){J.ctrlKey?this.showNextMonth():this.update(this.activeDate.add("d",1))},"up":function(J){J.ctrlKey?this.showNextYear():this.update(this.activeDate.add("d",-7))},"down":function(J){J.ctrlKey?this.showPrevYear():this.update(this.activeDate.add("d",7))},"pageUp":function(J){this.showNextMonth()},"pageDown":function(J){this.showPrevMonth()},"enter":function(J){J.stopPropagation();return true},scope:this});this.eventEl.on("click",this.handleDateClick,this,{delegate:"a.x-date-date"});this.eventEl.addKeyListener(Ext.EventObject.SPACE,this.selectToday,this);this.el.unselectable();this.cells=this.el.select("table.x-date-inner tbody td");this.textNodes=this.el.query("table.x-date-inner tbody span");this.mbtn=new Ext.Button({text:" ",tooltip:this.monthYearText,renderTo:this.el.child("td.x-date-middle",true)});this.mbtn.on("click",this.showMonthPicker,this);this.mbtn.el.child(this.mbtn.menuClassTarget).addClass("x-btn-with-menu");var H=(new Date()).dateFormat(this.format);this.todayBtn=new Ext.Button({renderTo:this.el.child("td.x-date-bottom",true),text:String.format(this.todayText,H),tooltip:String.format(this.todayTip,H),handler:this.selectToday,scope:this});if(Ext.isIE){this.el.repaint()}this.update(this.value)},createMonthPicker:function(){if(!this.monthPicker.dom.firstChild){var A=[""];for(var B=0;B<6;B++){A.push("","",B==0?"":"")}A.push("","
",this.monthNames[B].substr(0,3),"",this.monthNames[B+6].substr(0,3),"
");this.monthPicker.update(A.join(""));this.monthPicker.on("click",this.onMonthClick,this);this.monthPicker.on("dblclick",this.onMonthDblClick,this);this.mpMonths=this.monthPicker.select("td.x-date-mp-month");this.mpYears=this.monthPicker.select("td.x-date-mp-year");this.mpMonths.each(function(C,D,E){E+=1;if((E%2)==0){C.dom.xmonth=5+Math.round(E*0.5)}else{C.dom.xmonth=Math.round((E-1)*0.5)}})}},showMonthPicker:function(){this.createMonthPicker();var A=this.el.getSize();this.monthPicker.setSize(A);this.monthPicker.child("table").setSize(A);this.mpSelMonth=(this.activeDate||this.value).getMonth();this.updateMPMonth(this.mpSelMonth);this.mpSelYear=(this.activeDate||this.value).getFullYear();this.updateMPYear(this.mpSelYear);this.monthPicker.slideIn("t",{duration:0.2})},updateMPYear:function(E){this.mpyear=E;var C=this.mpYears.elements;for(var B=1;B<=10;B++){var D=C[B-1],A;if((B%2)==0){A=E+Math.round(B*0.5);D.firstChild.innerHTML=A;D.xyear=A}else{A=E-(5-Math.round(B*0.5));D.firstChild.innerHTML=A;D.xyear=A}this.mpYears.item(B-1)[A==this.mpSelYear?"addClass":"removeClass"]("x-date-mp-sel")}},updateMPMonth:function(A){this.mpMonths.each(function(B,C,D){B[B.dom.xmonth==A?"addClass":"removeClass"]("x-date-mp-sel")})},selectMPMonth:function(A){},onMonthClick:function(D,B){D.stopEvent();var C=new Ext.Element(B),A;if(C.is("button.x-date-mp-cancel")){this.hideMonthPicker()}else{if(C.is("button.x-date-mp-ok")){this.update(new Date(this.mpSelYear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker()}else{if(A=C.up("td.x-date-mp-month",2)){this.mpMonths.removeClass("x-date-mp-sel");A.addClass("x-date-mp-sel");this.mpSelMonth=A.dom.xmonth}else{if(A=C.up("td.x-date-mp-year",2)){this.mpYears.removeClass("x-date-mp-sel");A.addClass("x-date-mp-sel");this.mpSelYear=A.dom.xyear}else{if(C.is("a.x-date-mp-prev")){this.updateMPYear(this.mpyear-10)}else{if(C.is("a.x-date-mp-next")){this.updateMPYear(this.mpyear+10)}}}}}}},onMonthDblClick:function(D,B){D.stopEvent();var C=new Ext.Element(B),A;if(A=C.up("td.x-date-mp-month",2)){this.update(new Date(this.mpSelYear,A.dom.xmonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker()}else{if(A=C.up("td.x-date-mp-year",2)){this.update(new Date(A.dom.xyear,this.mpSelMonth,(this.activeDate||this.value).getDate()));this.hideMonthPicker()}}},hideMonthPicker:function(A){if(this.monthPicker){if(A===true){this.monthPicker.hide()}else{this.monthPicker.slideOut("t",{duration:0.2})}}},showPrevMonth:function(A){this.update(this.activeDate.add("mo",-1))},showNextMonth:function(A){this.update(this.activeDate.add("mo",1))},showPrevYear:function(){this.update(this.activeDate.add("y",-1))},showNextYear:function(){this.update(this.activeDate.add("y",1))},handleMouseWheel:function(A){var B=A.getWheelDelta();if(B>0){this.showPrevMonth();A.stopEvent()}else{if(B<0){this.showNextMonth();A.stopEvent()}}},handleDateClick:function(B,A){B.stopEvent();if(A.dateValue&&!Ext.fly(A.parentNode).hasClass("x-date-disabled")){this.setValue(new Date(A.dateValue));this.fireEvent("select",this,this.value)}},selectToday:function(){this.setValue(new Date().clearTime());this.fireEvent("select",this,this.value)},update:function(W){var A=this.activeDate;this.activeDate=W;if(A&&this.el){var I=W.getTime();if(A.getMonth()==W.getMonth()&&A.getFullYear()==W.getFullYear()){this.cells.removeClass("x-date-selected");this.cells.each(function(a){if(a.dom.firstChild.dateValue==I){a.addClass("x-date-selected");setTimeout(function(){try{a.dom.firstChild.focus()}catch(b){}},50);return false}});return }}var F=W.getDaysInMonth();var J=W.getFirstDateOfMonth();var C=J.getDay()-this.startDay;if(C<=this.startDay){C+=7}var S=W.add("mo",-1);var D=S.getDaysInMonth()-C;var B=this.cells.elements;var K=this.textNodes;F+=C;var P=86400000;var U=(new Date(S.getFullYear(),S.getMonth(),D)).clearTime();var T=new Date().clearTime().getTime();var N=W.clearTime().getTime();var M=this.minDate?this.minDate.clearTime():Number.NEGATIVE_INFINITY;var Q=this.maxDate?this.maxDate.clearTime():Number.POSITIVE_INFINITY;var X=this.disabledDatesRE;var L=this.disabledDatesText;var Z=this.disabledDays?this.disabledDays.join(""):false;var V=this.disabledDaysText;var R=this.format;var G=function(d,a){a.title="";var b=U.getTime();a.firstChild.dateValue=b;if(b==T){a.className+=" x-date-today";a.title=d.todayText}if(b==N){a.className+=" x-date-selected";setTimeout(function(){try{a.firstChild.focus()}catch(f){}},50)}if(bQ){a.className=" x-date-disabled";a.title=d.maxText;return }if(Z){if(Z.indexOf(U.getDay())!=-1){a.title=V;a.className=" x-date-disabled"}}if(X&&R){var c=U.dateFormat(R);if(X.test(c)){a.title=L.replace("%0",c);a.className=" x-date-disabled"}}};var O=0;for(;O","","{text}","");D.disableFormats=true;D.compile();Ext.TabPanel.prototype.itemTpl=D}this.items.each(this.initTab,this)},afterRender:function(){Ext.TabPanel.superclass.afterRender.call(this);if(this.autoTabs){this.readTabs(false)}},initEvents:function(){Ext.TabPanel.superclass.initEvents.call(this);this.on("add",this.onAdd,this);this.on("remove",this.onRemove,this);this.strip.on("mousedown",this.onStripMouseDown,this);this.strip.on("click",this.onStripClick,this);this.strip.on("contextmenu",this.onStripContextMenu,this);if(this.enableTabScroll){this.strip.on("mousewheel",this.onWheel,this)}},findTargets:function(C){var B=null;var A=C.getTarget("li",this.strip);if(A){B=this.getComponent(A.id.split(this.idDelimiter)[1]);if(B.disabled){return{close:null,item:null,el:null}}}return{close:C.getTarget(".x-tab-strip-close",this.strip),item:B,el:A}},onStripMouseDown:function(B){B.preventDefault();if(B.button!=0){return }var A=this.findTargets(B);if(A.close){this.remove(A.item);return }if(A.item&&A.item!=this.activeTab){this.setActiveTab(A.item)}},onStripClick:function(B){var A=this.findTargets(B);if(!A.close&&A.item&&A.item!=this.activeTab){this.setActiveTab(A.item)}},onStripContextMenu:function(B){B.preventDefault();var A=this.findTargets(B);if(A.item){this.fireEvent("contextmenu",this,A.item,B)}},readTabs:function(D){if(D===true){this.items.each(function(G){this.remove(G)},this)}var C=this.el.query(this.autoTabSelector);for(var B=0,A=C.length;B20?C:20);if(!this.scrolling){if(!this.scrollLeft){this.createScrollers()}else{this.scrollLeft.show();this.scrollRight.show()}}this.scrolling=true;if(H>(A-C)){E.scrollLeft=A-C}else{this.scrollToTab(this.activeTab,false)}this.updateScrollButtons()}},createScrollers:function(){var C=this.stripWrap.dom.offsetHeight;var A=this.header.insertFirst({cls:"x-tab-scroller-left"});A.setHeight(C);A.addClassOnOver("x-tab-scroller-left-over");this.leftRepeater=new Ext.util.ClickRepeater(A,{interval:this.scrollRepeatInterval,handler:this.onScrollLeft,scope:this});this.scrollLeft=A;var B=this.header.insertFirst({cls:"x-tab-scroller-right"});B.setHeight(C);B.addClassOnOver("x-tab-scroller-right-over");this.rightRepeater=new Ext.util.ClickRepeater(B,{interval:this.scrollRepeatInterval,handler:this.onScrollRight,scope:this});this.scrollRight=B},getScrollWidth:function(){return this.edge.getOffsetsTo(this.stripWrap)[0]+this.getScrollPos()},getScrollPos:function(){return parseInt(this.stripWrap.dom.scrollLeft,10)||0},getScrollArea:function(){return parseInt(this.stripWrap.dom.clientWidth,10)||0},getScrollAnim:function(){return{duration:this.scrollDuration,callback:this.updateScrollButtons,scope:this}},getScrollIncrement:function(){return this.scrollIncrement||(this.resizeTabs?this.lastTabWidth+2:100)},scrollToTab:function(E,A){if(!E){return }var C=this.getTabEl(E);var G=this.getScrollPos(),D=this.getScrollArea();var F=Ext.fly(C).getOffsetsTo(this.stripWrap)[0]+G;var B=F+C.offsetWidth;if(F(G+D)){this.scrollTo(B-D,A)}}},scrollTo:function(B,A){this.stripWrap.scrollTo("left",B,A?this.getScrollAnim():false);if(!A){this.updateScrollButtons()}},onWheel:function(D){var E=D.getWheelDelta()*this.wheelIncrement*-1;D.stopEvent();var F=this.getScrollPos();var C=F+E;var A=this.getScrollWidth()-this.getScrollArea();var B=Math.max(0,Math.min(A,C));if(B!=F){this.scrollTo(B,false)}},onScrollRight:function(){var A=this.getScrollWidth()-this.getScrollArea();var C=this.getScrollPos();var B=Math.min(A,C+this.getScrollIncrement());if(B!=C){this.scrollTo(B,this.animScroll)}},onScrollLeft:function(){var B=this.getScrollPos();var A=Math.max(0,B-this.getScrollIncrement());if(A!=B){this.scrollTo(A,this.animScroll)}},updateScrollButtons:function(){var A=this.getScrollPos();this.scrollLeft[A==0?"addClass":"removeClass"]("x-tab-scroller-left-disabled");this.scrollRight[A>=(this.getScrollWidth()-this.getScrollArea())?"addClass":"removeClass"]("x-tab-scroller-right-disabled")}});Ext.reg("tabpanel",Ext.TabPanel);Ext.TabPanel.prototype.activate=Ext.TabPanel.prototype.setActiveTab;Ext.TabPanel.AccessStack=function(){var A=[];return{add:function(B){A.push(B);if(A.length>10){A.shift()}},remove:function(E){var D=[];for(var C=0,B=A.length;C","  ","")}this.template=Ext.Button.buttonTemplate}var B,E=[this.text||" ",this.type];if(A){B=this.template.insertBefore(A,E,true)}else{B=this.template.append(C,E,true)}var D=B.child(this.buttonSelector);D.on("focus",this.onFocus,this);D.on("blur",this.onBlur,this);this.initButtonEl(B,D);if(this.menu){this.el.child(this.menuClassTarget).addClass("x-btn-with-menu")}Ext.ButtonToggleMgr.register(this)},initButtonEl:function(B,C){this.el=B;B.addClass("x-btn");if(this.icon){C.setStyle("background-image","url("+this.icon+")")}if(this.iconCls){C.addClass(this.iconCls);if(!this.cls){B.addClass(this.text?"x-btn-text-icon":"x-btn-icon")}}if(this.tabIndex!==undefined){C.dom.tabIndex=this.tabIndex}if(this.tooltip){if(typeof this.tooltip=="object"){Ext.QuickTips.register(Ext.apply({target:C.id},this.tooltip))}else{C.dom[this.tooltipType]=this.tooltip}}if(this.pressed){this.el.addClass("x-btn-pressed")}if(this.handleMouseEvents){B.on("mouseover",this.onMouseOver,this);B.on("mousedown",this.onMouseDown,this)}if(this.menu){this.menu.on("show",this.onMenuShow,this);this.menu.on("hide",this.onMenuHide,this)}if(this.id){this.el.dom.id=this.el.id=this.id}if(this.repeat){var A=new Ext.util.ClickRepeater(B,typeof this.repeat=="object"?this.repeat:{});A.on("click",this.onClick,this)}B.on(this.clickEvent,this.onClick,this)},afterRender:function(){Ext.Button.superclass.afterRender.call(this);if(Ext.isIE6){this.autoWidth.defer(1,this)}else{this.autoWidth()}},setIconClass:function(A){if(this.el){this.el.child(this.buttonSelector).replaceClass(this.iconCls,A)}this.iconCls=A},beforeDestroy:function(){if(this.rendered){var A=this.el.child(this.buttonSelector);if(A){A.removeAllListeners()}}if(this.menu){Ext.destroy(this.menu)}},onDestroy:function(){if(this.rendered){Ext.ButtonToggleMgr.unregister(this)}},autoWidth:function(){if(this.el){this.el.setWidth("auto");if(Ext.isIE7&&Ext.isStrict){var A=this.el.child(this.buttonSelector);if(A&&A.getWidth()>20){A.clip();A.setWidth(Ext.util.TextMetrics.measure(A,this.text).width+A.getFrameWidth("lr"))}}if(this.minWidth){if(this.el.getWidth()","","","
 
","","","
 
");var C,F=[this.text||" ",this.type];if(A){C=B.insertBefore(A,F,true)}else{C=B.append(D,F,true)}var E=C.child(this.buttonSelector);this.initButtonEl(C,E);this.arrowBtnTable=C.child("table:last");if(this.arrowTooltip){C.child(this.arrowSelector).dom[this.tooltipType]=this.arrowTooltip}},autoWidth:function(){if(this.el){var C=this.el.child("table:first");var B=this.el.child("table:last");this.el.setWidth("auto");C.setWidth("auto");if(Ext.isIE7&&Ext.isStrict){var A=this.el.child(this.buttonSelector);if(A&&A.getWidth()>20){A.clip();A.setWidth(Ext.util.TextMetrics.measure(A,this.text).width+A.getFrameWidth("lr"))}}if(this.minWidth){if((C.getWidth()+B.getWidth())"},onRender:function(C,B){this.el=C.createChild(Ext.apply({id:this.id},this.autoCreate),B);this.tr=this.el.child("tr",true)},afterRender:function(){A.superclass.afterRender.call(this);if(this.buttons){this.add.apply(this,this.buttons);delete this.buttons}},add:function(){var C=arguments,B=C.length;for(var D=0;D"){this.addFill()}else{this.addText(E)}}}}else{if(E.tagName){this.addElement(E)}else{if(typeof E=="object"){if(E.xtype){this.addField(Ext.ComponentMgr.create(E,"button"))}else{this.addButton(E)}}}}}}}},addSeparator:function(){return this.addItem(new A.Separator())},addSpacer:function(){return this.addItem(new A.Spacer())},addFill:function(){return this.addItem(new A.Fill())},addElement:function(B){return this.addItem(new A.Item(B))},addItem:function(B){var C=this.nextBlock();this.initMenuTracking(B);B.render(C);this.items.add(B);return B},addButton:function(D){if(Ext.isArray(D)){var F=[];for(var E=0,C=D.length;E=1&C<=E.pages){this.field.dom.value=C}}}}}},beforeLoad:function(){if(this.rendered&&this.loading){this.loading.disable()}},doLoad:function(C){var B={},A=this.paramNames;B[A.start]=C;B[A.limit]=this.pageSize;this.store.load({params:B})},onClick:function(E){var B=this.store;switch(E){case"first":this.doLoad(0);break;case"prev":this.doLoad(Math.max(0,this.cursor-this.pageSize));break;case"next":this.doLoad(this.cursor+this.pageSize);break;case"last":var D=B.getTotalCount();var A=D%this.pageSize;var C=A?(D-A):D-this.pageSize;this.doLoad(C);break;case"refresh":this.doLoad(this.cursor);break}},unbind:function(A){A=Ext.StoreMgr.lookup(A);A.un("beforeload",this.beforeLoad,this);A.un("load",this.onLoad,this);A.un("loadexception",this.onLoadError,this);this.store=undefined},bind:function(A){A=Ext.StoreMgr.lookup(A);A.on("beforeload",this.beforeLoad,this);A.on("load",this.onLoad,this);A.on("loadexception",this.onLoadError,this);this.store=A}});Ext.reg("paging",Ext.PagingToolbar); +Ext.Resizable=function(D,E){this.el=Ext.get(D);if(E&&E.wrap){E.resizeChild=this.el;this.el=this.el.wrap(typeof E.wrap=="object"?E.wrap:{cls:"xresizable-wrap"});this.el.id=this.el.dom.id=E.resizeChild.id+"-rzwrap";this.el.setStyle("overflow","hidden");this.el.setPositioning(E.resizeChild.getPositioning());E.resizeChild.clearPositioning();if(!E.width||!E.height){var F=E.resizeChild.getSize();this.el.setSize(F.width,F.height)}if(E.pinned&&!E.adjustments){E.adjustments="auto"}}this.proxy=this.el.createProxy({tag:"div",cls:"x-resizable-proxy",id:this.el.id+"-rzproxy"});this.proxy.unselectable();this.proxy.enableDisplayMode("block");Ext.apply(this,E);if(this.pinned){this.disableTrackOver=true;this.el.addClass("x-resizable-pinned")}var I=this.el.getStyle("position");if(I!="absolute"&&I!="fixed"){this.el.setStyle("position","relative")}if(!this.handles){this.handles="s,e,se";if(this.multiDirectional){this.handles+=",n,w"}}if(this.handles=="all"){this.handles="n s e w ne nw se sw"}var M=this.handles.split(/\s*?[,;]\s*?| /);var C=Ext.Resizable.positions;for(var H=0,J=M.length;H0){if(A>(E/2)){D=C+(E-A)}else{D=C-A}}return Math.max(B,D)},resizeElement:function(){var A=this.proxy.getBox();if(this.updateBox){this.el.setBox(A,false,this.animate,this.duration,null,this.easing)}else{this.el.setSize(A.width,A.height,this.animate,this.duration,null,this.easing)}this.updateChildSize();if(!this.dynamic){this.proxy.hide()}return A},constrain:function(B,C,A,D){if(B-CD){C=D-B}}return C},onMouseMove:function(S){if(this.enabled){try{if(this.resizeRegion&&!this.resizeRegion.contains(S.getPoint())){return }var Q=this.curSize||this.startBox;var I=this.startBox.x,H=this.startBox.y;var C=I,B=H;var J=Q.width,R=Q.height;var D=J,L=R;var K=this.minWidth,T=this.minHeight;var P=this.maxWidth,W=this.maxHeight;var F=this.widthIncrement;var A=this.heightIncrement;var U=S.getXY();var O=-(this.startPoint[0]-Math.max(this.minX,U[0]));var M=-(this.startPoint[1]-Math.max(this.minY,U[1]));var G=this.activeHandle.position;switch(G){case"east":J+=O;J=Math.min(Math.max(K,J),P);break;case"south":R+=M;R=Math.min(Math.max(T,R),W);break;case"southeast":J+=O;R+=M;J=Math.min(Math.max(K,J),P);R=Math.min(Math.max(T,R),W);break;case"north":M=this.constrain(R,M,T,W);H+=M;R-=M;break;case"west":O=this.constrain(J,O,K,P);I+=O;J-=O;break;case"northeast":J+=O;J=Math.min(Math.max(K,J),P);M=this.constrain(R,M,T,W);H+=M;R-=M;break;case"northwest":O=this.constrain(J,O,K,P);M=this.constrain(R,M,T,W);H+=M;R-=M;I+=O;J-=O;break;case"southwest":O=this.constrain(J,O,K,P);R+=M;R=Math.min(Math.max(T,R),W);I+=O;J-=O;break}var N=this.snap(J,F,K);var V=this.snap(R,A,T);if(N!=J||V!=R){switch(G){case"northeast":H-=V-R;break;case"north":H-=V-R;break;case"southwest":I-=N-J;break;case"west":I-=N-J;break;case"northwest":I-=N-J;H-=V-R;break}J=N;R=V}if(this.preserveRatio){switch(G){case"southeast":case"east":R=L*(J/D);R=Math.min(Math.max(T,R),W);J=D*(R/L);break;case"south":J=D*(R/L);J=Math.min(Math.max(K,J),P);R=L*(J/D);break;case"northeast":J=D*(R/L);J=Math.min(Math.max(K,J),P);R=L*(J/D);break;case"north":var X=J;J=D*(R/L);J=Math.min(Math.max(K,J),P);R=L*(J/D);I+=(X-J)/2;break;case"southwest":R=L*(J/D);R=Math.min(Math.max(T,R),W);var X=J;J=D*(R/L);I+=X-J;break;case"west":var E=R;R=L*(J/D);R=Math.min(Math.max(T,R),W);H+=(E-R)/2;var X=J;J=D*(R/L);I+=X-J;break;case"northwest":var X=J;var E=R;R=L*(J/D);R=Math.min(Math.max(T,R),W);J=D*(R/L);H+=E-R;I+=X-J;break}}this.proxy.setBounds(I,H,J,R);if(this.dynamic){this.resizeElement()}}catch(S){}}},handleOver:function(){if(this.enabled){this.el.addClass("x-resizable-over")}},handleOut:function(){if(!this.resizing){this.el.removeClass("x-resizable-over")}},getEl:function(){return this.el},getResizeChild:function(){return this.resizeChild},destroy:function(C){this.proxy.remove();if(this.overlay){this.overlay.removeAllListeners();this.overlay.remove()}var D=Ext.Resizable.positions;for(var A in D){if(typeof D[A]!="function"&&this[D[A]]){var B=this[D[A]];B.el.removeAllListeners();B.el.remove()}}if(C){this.el.update("");this.el.remove()}},syncHandleHeight:function(){var A=this.el.getHeight(true);if(this.west){this.west.el.setHeight(A)}if(this.east){this.east.el.setHeight(A)}}});Ext.Resizable.positions={n:"north",s:"south",e:"east",w:"west",se:"southeast",sw:"southwest",nw:"northwest",ne:"northeast"};Ext.Resizable.Handle=function(C,E,B,D){if(!this.tpl){var A=Ext.DomHelper.createTemplate({tag:"div",cls:"x-resizable-handle x-resizable-handle-{0}"});A.compile();Ext.Resizable.Handle.prototype.tpl=A}this.position=E;this.rz=C;this.el=this.tpl.append(C.el.dom,[this.position],true);this.el.unselectable();if(D){this.el.setOpacity(0)}this.el.on("mousedown",this.onMouseDown,this);if(!B){this.el.on("mouseover",this.onMouseOver,this);this.el.on("mouseout",this.onMouseOut,this)}};Ext.Resizable.Handle.prototype={afterResize:function(A){},onMouseDown:function(A){this.rz.onMouseDown(this,A)},onMouseOver:function(A){this.rz.handleOver(this,A)},onMouseOut:function(A){this.rz.handleOut(this,A)}}; +Ext.Editor=function(B,A){this.field=B;Ext.Editor.superclass.constructor.call(this,A)};Ext.extend(Ext.Editor,Ext.Component,{value:"",alignment:"c-c?",shadow:"frame",constrain:false,swallowKeys:true,completeOnEnter:false,cancelOnEsc:false,updateEl:false,initComponent:function(){Ext.Editor.superclass.initComponent.call(this);this.addEvents("beforestartedit","startedit","beforecomplete","complete","specialkey")},onRender:function(B,A){this.el=new Ext.Layer({shadow:this.shadow,cls:"x-editor",parentEl:B,shim:this.shim,shadowOffset:4,id:this.id,constrain:this.constrain});this.el.setStyle("overflow",Ext.isGecko?"auto":"hidden");if(this.field.msgTarget!="title"){this.field.msgTarget="qtip"}this.field.inEditor=true;this.field.render(this.el);if(Ext.isGecko){this.field.el.dom.setAttribute("autocomplete","off")}this.field.on("specialkey",this.onSpecialKey,this);if(this.swallowKeys){this.field.el.swallowEvent(["keydown","keypress"])}this.field.show();this.field.on("blur",this.onBlur,this);if(this.field.grow){this.field.on("autosize",this.el.sync,this.el,{delay:1})}},onSpecialKey:function(B,A){if(this.completeOnEnter&&A.getKey()==A.ENTER){A.stopEvent();this.completeEdit()}else{if(this.cancelOnEsc&&A.getKey()==A.ESC){this.cancelEdit()}else{this.fireEvent("specialkey",B,A)}}},startEdit:function(B,C){if(this.editing){this.completeEdit()}this.boundEl=Ext.get(B);var A=C!==undefined?C:this.boundEl.dom.innerHTML;if(!this.rendered){this.render(this.parentEl||document.body)}if(this.fireEvent("beforestartedit",this,this.boundEl,A)===false){return }this.startValue=A;this.field.setValue(A);this.doAutoSize();this.el.alignTo(this.boundEl,this.alignment);this.editing=true;this.show()},doAutoSize:function(){if(this.autoSize){var A=this.boundEl.getSize();switch(this.autoSize){case"width":this.setSize(A.width,"");break;case"height":this.setSize("",A.height);break;default:this.setSize(A.width,A.height)}}},setSize:function(A,B){delete this.field.lastSize;this.field.setSize(A,B);if(this.el){this.el.sync()}},realign:function(){this.el.alignTo(this.boundEl,this.alignment)},completeEdit:function(A){if(!this.editing){return }var B=this.getValue();if(this.revertInvalid!==false&&!this.field.isValid()){B=this.startValue;this.cancelEdit(true)}if(String(B)===String(this.startValue)&&this.ignoreNoChange){this.editing=false;this.hide();return }if(this.fireEvent("beforecomplete",this,B,this.startValue)!==false){this.editing=false;if(this.updateEl&&this.boundEl){this.boundEl.update(B)}if(A!==true){this.hide()}this.fireEvent("complete",this,B,this.startValue)}},onShow:function(){this.el.show();if(this.hideEl!==false){this.boundEl.hide()}this.field.show();if(Ext.isIE&&!this.fixIEFocus){this.fixIEFocus=true;this.deferredFocus.defer(50,this)}else{this.field.focus()}this.fireEvent("startedit",this.boundEl,this.startValue)},deferredFocus:function(){if(this.editing){this.field.focus()}},cancelEdit:function(A){if(this.editing){this.setValue(this.startValue);if(A!==true){this.hide()}}},onBlur:function(){if(this.allowBlur!==true&&this.editing){this.completeEdit()}},onHide:function(){if(this.editing){this.completeEdit();return }this.field.blur();if(this.field.collapse){this.field.collapse()}this.el.hide();if(this.hideEl!==false){this.boundEl.show()}},setValue:function(A){this.field.setValue(A)},getValue:function(){return this.field.getValue()},beforeDestroy:function(){this.field.destroy();this.field=null}});Ext.reg("editor",Ext.Editor); +Ext.MessageBox=function(){var R,B,N,Q;var G,J,P,A,K,M,H,F;var O,S,L,C="";var D=function(U){R.hide();Ext.callback(B.fn,B.scope||window,[U,S.dom.value],1)};var T=function(){if(B&&B.cls){R.el.removeClass(B.cls)}K.reset()};var E=function(W,U,V){if(B&&B.closable!==false){R.hide()}if(V){V.stopEvent()}};var I=function(U){var W=0;if(!U){O["ok"].hide();O["cancel"].hide();O["yes"].hide();O["no"].hide();return W}R.footer.dom.style.display="";for(var V in O){if(typeof O[V]!="function"){if(U[V]){O[V].show();O[V].setText(typeof U[V]=="string"?U[V]:Ext.MessageBox.buttonText[V]);W+=O[V].el.getWidth()+15}else{O[V].hide()}}}return W};return{getDialog:function(U){if(!R){R=new Ext.Window({autoCreate:true,title:U,resizable:false,constrain:true,constrainHeader:true,minimizable:false,maximizable:false,stateful:false,modal:true,shim:true,buttonAlign:"center",width:400,height:100,minHeight:80,plain:true,footer:true,closable:true,close:function(){if(B&&B.buttons&&B.buttons.no&&!B.buttons.cancel){D("no")}else{D("cancel")}}});O={};var V=this.buttonText;O["ok"]=R.addButton(V["ok"],D.createCallback("ok"));O["yes"]=R.addButton(V["yes"],D.createCallback("yes"));O["no"]=R.addButton(V["no"],D.createCallback("no"));O["cancel"]=R.addButton(V["cancel"],D.createCallback("cancel"));O["ok"].hideMode=O["yes"].hideMode=O["no"].hideMode=O["cancel"].hideMode="offsets";R.render(document.body);R.getEl().addClass("x-window-dlg");N=R.mask;G=R.body.createChild({html:"

"});H=Ext.get(G.dom.firstChild);var W=G.dom.childNodes[1];J=Ext.get(W.firstChild);P=Ext.get(W.childNodes[2]);P.enableDisplayMode();P.addKeyListener([10,13],function(){if(R.isVisible()&&B&&B.buttons){if(B.buttons.ok){D("ok")}else{if(B.buttons.yes){D("yes")}}}});A=Ext.get(W.childNodes[3]);A.enableDisplayMode();K=new Ext.ProgressBar({renderTo:G});G.createChild({cls:"x-clear"})}return R},updateText:function(X){if(!R.isVisible()&&!B.width){R.setSize(this.maxWidth,100)}J.update(X||" ");var V=C!=""?(H.getWidth()+H.getMargins("lr")):0;var Z=J.getWidth()+J.getMargins("lr");var W=R.getFrameWidth("lr");var Y=R.body.getFrameWidth("lr");if(Ext.isIE&&V>0){V+=3}var U=Math.max(Math.min(B.width||V+Z+W+Y,this.maxWidth),Math.max(B.minWidth||this.minWidth,L||0));if(B.prompt===true){S.setWidth(U-V-W-Y)}if(B.progress===true||B.wait===true){K.setSize(U-V-W-Y)}R.setSize(U,"auto").center();return this},updateProgress:function(V,U,W){K.updateProgress(V,U);if(W){this.updateText(W)}return this},isVisible:function(){return R&&R.isVisible()},hide:function(){if(this.isVisible()){R.hide();T()}return this},show:function(X){if(this.isVisible()){this.hide()}B=X;var Y=this.getDialog(B.title||" ");Y.setTitle(B.title||" ");var U=(B.closable!==false&&B.progress!==true&&B.wait!==true);Y.tools.close.setDisplayed(U);S=P;B.prompt=B.prompt||(B.multiline?true:false);if(B.prompt){if(B.multiline){P.hide();A.show();A.setHeight(typeof B.multiline=="number"?B.multiline:this.defaultTextHeight);S=A}else{P.show();A.hide()}}else{P.hide();A.hide()}S.dom.value=B.value||"";if(B.prompt){Y.focusEl=S}else{var W=B.buttons;var V=null;if(W&&W.ok){V=O["ok"]}else{if(W&&W.yes){V=O["yes"]}}if(V){Y.focusEl=V}}this.setIcon(B.icon);L=I(B.buttons);K.setVisible(B.progress===true||B.wait===true);this.updateProgress(0,B.progressText);this.updateText(B.msg);if(B.cls){Y.el.addClass(B.cls)}Y.proxyDrag=B.proxyDrag===true;Y.modal=B.modal!==false;Y.mask=B.modal!==false?N:false;if(!Y.isVisible()){document.body.appendChild(R.el.dom);Y.setAnimateTarget(B.animEl);Y.show(B.animEl)}Y.on("show",function(){if(U===true){Y.keyMap.enable()}else{Y.keyMap.disable()}},this,{single:true});if(B.wait===true){K.wait(B.waitConfig)}return this},setIcon:function(U){if(U&&U!=""){H.removeClass("x-hidden");H.replaceClass(C,U);C=U}else{H.replaceClass(C,"x-hidden");C=""}return this},progress:function(W,V,U){this.show({title:W,msg:V,buttons:false,progress:true,closable:false,minWidth:this.minProgressWidth,progressText:U});return this},wait:function(W,V,U){this.show({title:V,msg:W,buttons:false,closable:false,wait:true,modal:true,minWidth:this.minProgressWidth,waitConfig:U});return this},alert:function(X,W,V,U){this.show({title:X,msg:W,buttons:this.OK,fn:V,scope:U});return this},confirm:function(X,W,V,U){this.show({title:X,msg:W,buttons:this.YESNO,fn:V,scope:U,icon:this.QUESTION});return this},prompt:function(Y,X,W,V,U){this.show({title:Y,msg:X,buttons:this.OKCANCEL,fn:W,minWidth:250,scope:V,prompt:true,multiline:U});return this},OK:{ok:true},CANCEL:{cancel:true},OKCANCEL:{ok:true,cancel:true},YESNO:{yes:true,no:true},YESNOCANCEL:{yes:true,no:true,cancel:true},INFO:"ext-mb-info",WARNING:"ext-mb-warning",QUESTION:"ext-mb-question",ERROR:"ext-mb-error",defaultTextHeight:75,maxWidth:600,minWidth:100,minProgressWidth:250,buttonText:{ok:"OK",cancel:"Cancel",yes:"Yes",no:"No"}}}();Ext.Msg=Ext.MessageBox; +Ext.Tip=Ext.extend(Ext.Panel,{minWidth:40,maxWidth:300,shadow:"sides",defaultAlign:"tl-bl?",autoRender:true,quickShowInterval:250,frame:true,hidden:true,baseCls:"x-tip",floating:{shadow:true,shim:true,useDisplay:true,constrain:false},autoHeight:true,initComponent:function(){Ext.Tip.superclass.initComponent.call(this);if(this.closable&&!this.title){this.elements+=",header"}},afterRender:function(){Ext.Tip.superclass.afterRender.call(this);if(this.closable){this.addTool({id:"close",handler:this.hide,scope:this})}},showAt:function(A){Ext.Tip.superclass.show.call(this);if(this.measureWidth!==false&&(!this.initialConfig||typeof this.initialConfig.width!="number")){var B=this.body.getTextWidth();if(this.title){B=Math.max(B,this.header.child("span").getTextWidth(this.title))}B+=this.getFrameWidth()+(this.closable?20:0)+this.body.getPadding("lr");this.setWidth(B.constrain(this.minWidth,this.maxWidth))}if(this.constrainPosition){A=this.el.adjustForConstraints(A)}this.setPagePosition(A[0],A[1])},showBy:function(A,B){if(!this.rendered){this.render(Ext.getBody())}this.showAt(this.el.getAlignToXY(A,B||this.defaultAlign))},initDraggable:function(){this.dd=new Ext.Tip.DD(this,typeof this.draggable=="boolean"?null:this.draggable);this.header.addClass("x-tip-draggable")}});Ext.Tip.DD=function(B,A){Ext.apply(this,A);this.tip=B;Ext.Tip.DD.superclass.constructor.call(this,B.el.id,"WindowDD-"+B.id);this.setHandleElId(B.header.id);this.scroll=false};Ext.extend(Ext.Tip.DD,Ext.dd.DD,{moveOnly:true,scroll:false,headerOffsets:[100,25],startDrag:function(){this.tip.el.disableShadow()},endDrag:function(A){this.tip.el.enableShadow(true)}}); +Ext.ToolTip=Ext.extend(Ext.Tip,{showDelay:500,hideDelay:200,dismissDelay:5000,mouseOffset:[15,18],trackMouse:false,constrainPosition:true,initComponent:function(){Ext.ToolTip.superclass.initComponent.call(this);this.lastActive=new Date();this.initTarget()},initTarget:function(){if(this.target){this.target=Ext.get(this.target);this.target.on("mouseover",this.onTargetOver,this);this.target.on("mouseout",this.onTargetOut,this);this.target.on("mousemove",this.onMouseMove,this)}},onMouseMove:function(A){this.targetXY=A.getXY();if(!this.hidden&&this.trackMouse){this.setPagePosition(this.getTargetXY())}},getTargetXY:function(){return[this.targetXY[0]+this.mouseOffset[0],this.targetXY[1]+this.mouseOffset[1]]},onTargetOver:function(A){if(this.disabled||A.within(this.target.dom,true)){return }this.clearTimer("hide");this.targetXY=A.getXY();this.delayShow()},delayShow:function(){if(this.hidden&&!this.showTimer){if(this.lastActive.getElapsed()=C){D=C-B-5}return{x:A,y:D}},onDestroy:function(){Ext.ToolTip.superclass.onDestroy.call(this);if(this.target){this.target.un("mouseover",this.onTargetOver,this);this.target.un("mouseout",this.onTargetOut,this);this.target.un("mousemove",this.onMouseMove,this)}}}); +Ext.QuickTip=Ext.extend(Ext.ToolTip,{interceptTitles:false,tagConfig:{namespace:"ext",attribute:"qtip",width:"qwidth",target:"target",title:"qtitle",hide:"hide",cls:"qclass",align:"qalign"},initComponent:function(){this.target=this.target||Ext.getDoc();this.targets=this.targets||{};Ext.QuickTip.superclass.initComponent.call(this)},register:function(D){var F=Ext.isArray(D)?D:arguments;for(var E=0,A=F.length;E0){var D=function(H,G){if(H&&G){var I=G.findChild(A,B);if(I){I.select();if(F){F(true,I)}}else{if(F){F(false,I)}}}else{if(F){F(false,I)}}};this.expandPath(C.join(this.pathSeparator),A,D)}else{this.root.select();if(F){F(true,this.root)}}},getTreeEl:function(){return this.body},onRender:function(B,A){Ext.tree.TreePanel.superclass.onRender.call(this,B,A);this.el.addClass("x-tree");this.innerCt=this.body.createChild({tag:"ul",cls:"x-tree-root-ct "+(this.useArrows?"x-tree-arrows":this.lines?"x-tree-lines":"x-tree-no-lines")})},initEvents:function(){Ext.tree.TreePanel.superclass.initEvents.call(this);if(this.containerScroll){Ext.dd.ScrollManager.register(this.body)}if((this.enableDD||this.enableDrop)&&!this.dropZone){this.dropZone=new Ext.tree.TreeDropZone(this,this.dropConfig||{ddGroup:this.ddGroup||"TreeDD",appendOnly:this.ddAppendOnly===true})}if((this.enableDD||this.enableDrag)&&!this.dragZone){this.dragZone=new Ext.tree.TreeDragZone(this,this.dragConfig||{ddGroup:this.ddGroup||"TreeDD",scroll:this.ddScroll})}this.getSelectionModel().init(this)},afterRender:function(){Ext.tree.TreePanel.superclass.afterRender.call(this);this.root.render();if(!this.rootVisible){this.root.renderChildren()}},onDestroy:function(){if(this.rendered){this.body.removeAllListeners();Ext.dd.ScrollManager.unregister(this.body);if(this.dropZone){this.dropZone.unreg()}if(this.dragZone){this.dragZone.unreg()}}this.root.destroy();this.nodeHash=null;Ext.tree.TreePanel.superclass.onDestroy.call(this)}});Ext.reg("treepanel",Ext.tree.TreePanel); +Ext.tree.TreeEventModel=function(A){this.tree=A;this.tree.on("render",this.initEvents,this)};Ext.tree.TreeEventModel.prototype={initEvents:function(){var A=this.tree.getTreeEl();A.on("click",this.delegateClick,this);if(this.tree.trackMouseOver!==false){A.on("mouseover",this.delegateOver,this);A.on("mouseout",this.delegateOut,this)}A.on("dblclick",this.delegateDblClick,this);A.on("contextmenu",this.delegateContextMenu,this)},getNode:function(B){var A;if(A=B.getTarget(".x-tree-node-el",10)){var C=Ext.fly(A,"_treeEvents").getAttributeNS("ext","tree-node-id");if(C){return this.tree.getNodeById(C)}}return null},getNodeTarget:function(B){var A=B.getTarget(".x-tree-node-icon",1);if(!A){A=B.getTarget(".x-tree-node-el",6)}return A},delegateOut:function(B,A){if(!this.beforeEvent(B)){return }if(B.getTarget(".x-tree-ec-icon",1)){var C=this.getNode(B);this.onIconOut(B,C);if(C==this.lastEcOver){delete this.lastEcOver}}if((A=this.getNodeTarget(B))&&!B.within(A,true)){this.onNodeOut(B,this.getNode(B))}},delegateOver:function(B,A){if(!this.beforeEvent(B)){return }if(this.lastEcOver){this.onIconOut(B,this.lastEcOver);delete this.lastEcOver}if(B.getTarget(".x-tree-ec-icon",1)){this.lastEcOver=this.getNode(B);this.onIconOver(B,this.lastEcOver)}if(A=this.getNodeTarget(B)){this.onNodeOver(B,this.getNode(B))}},delegateClick:function(B,A){if(!this.beforeEvent(B)){return }if(B.getTarget("input[type=checkbox]",1)){this.onCheckboxClick(B,this.getNode(B))}else{if(B.getTarget(".x-tree-ec-icon",1)){this.onIconClick(B,this.getNode(B))}else{if(this.getNodeTarget(B)){this.onNodeClick(B,this.getNode(B))}}}},delegateDblClick:function(B,A){if(this.beforeEvent(B)&&this.getNodeTarget(B)){this.onNodeDblClick(B,this.getNode(B))}},delegateContextMenu:function(B,A){if(this.beforeEvent(B)&&this.getNodeTarget(B)){this.onNodeContextMenu(B,this.getNode(B))}},onNodeClick:function(B,A){A.ui.onClick(B)},onNodeOver:function(B,A){A.ui.onOver(B)},onNodeOut:function(B,A){A.ui.onOut(B)},onIconOver:function(B,A){A.ui.addClass("x-tree-ec-over")},onIconOut:function(B,A){A.ui.removeClass("x-tree-ec-over")},onIconClick:function(B,A){A.ui.ecClick(B)},onCheckboxClick:function(B,A){A.ui.onCheckChange(B)},onNodeDblClick:function(B,A){A.ui.onDblClick(B)},onNodeContextMenu:function(B,A){A.ui.onContextMenu(B)},beforeEvent:function(A){if(this.disabled){A.stopEvent();return false}return true},disable:function(){this.disabled=true},enable:function(){this.disabled=false}}; +Ext.tree.DefaultSelectionModel=function(A){this.selNode=null;this.addEvents("selectionchange","beforeselect");Ext.apply(this,A);Ext.tree.DefaultSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.tree.DefaultSelectionModel,Ext.util.Observable,{init:function(A){this.tree=A;A.getTreeEl().on("keydown",this.onKeyDown,this);A.on("click",this.onNodeClick,this)},onNodeClick:function(A,B){this.select(A)},select:function(B){var A=this.selNode;if(A!=B&&this.fireEvent("beforeselect",this,B,A)!==false){if(A){A.ui.onSelectedChange(false)}this.selNode=B;B.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,B,A)}return B},unselect:function(A){if(this.selNode==A){this.clearSelections()}},clearSelections:function(){var A=this.selNode;if(A){A.ui.onSelectedChange(false);this.selNode=null;this.fireEvent("selectionchange",this,null)}return A},getSelectedNode:function(){return this.selNode},isSelected:function(A){return this.selNode==A},selectPrevious:function(){var A=this.selNode||this.lastSelNode;if(!A){return null}var C=A.previousSibling;if(C){if(!C.isExpanded()||C.childNodes.length<1){return this.select(C)}else{var B=C.lastChild;while(B&&B.isExpanded()&&B.childNodes.length>0){B=B.lastChild}return this.select(B)}}else{if(A.parentNode&&(this.tree.rootVisible||!A.parentNode.isRoot)){return this.select(A.parentNode)}}return null},selectNext:function(){var B=this.selNode||this.lastSelNode;if(!B){return null}if(B.firstChild&&B.isExpanded()){return this.select(B.firstChild)}else{if(B.nextSibling){return this.select(B.nextSibling)}else{if(B.parentNode){var A=null;B.parentNode.bubble(function(){if(this.nextSibling){A=this.getOwnerTree().selModel.select(this.nextSibling);return false}});return A}}}return null},onKeyDown:function(C){var B=this.selNode||this.lastSelNode;var D=this;if(!B){return }var A=C.getKey();switch(A){case C.DOWN:C.stopEvent();this.selectNext();break;case C.UP:C.stopEvent();this.selectPrevious();break;case C.RIGHT:C.preventDefault();if(B.hasChildNodes()){if(!B.isExpanded()){B.expand()}else{if(B.firstChild){this.select(B.firstChild,C)}}}break;case C.LEFT:C.preventDefault();if(B.hasChildNodes()&&B.isExpanded()){B.collapse()}else{if(B.parentNode&&(this.tree.rootVisible||B.parentNode!=this.tree.getRootNode())){this.select(B.parentNode,C)}}break}}});Ext.tree.MultiSelectionModel=function(A){this.selNodes=[];this.selMap={};this.addEvents("selectionchange");Ext.apply(this,A);Ext.tree.MultiSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.tree.MultiSelectionModel,Ext.util.Observable,{init:function(A){this.tree=A;A.getTreeEl().on("keydown",this.onKeyDown,this);A.on("click",this.onNodeClick,this)},onNodeClick:function(A,B){this.select(A,B,B.ctrlKey)},select:function(A,C,B){if(B!==true){this.clearSelections(true)}if(this.isSelected(A)){this.lastSelNode=A;return A}this.selNodes.push(A);this.selMap[A.id]=A;this.lastSelNode=A;A.ui.onSelectedChange(true);this.fireEvent("selectionchange",this,this.selNodes);return A},unselect:function(B){if(this.selMap[B.id]){B.ui.onSelectedChange(false);var C=this.selNodes;var A=C.indexOf(B);if(A!=-1){this.selNodes.splice(A,1)}delete this.selMap[B.id];this.fireEvent("selectionchange",this,this.selNodes)}},clearSelections:function(B){var D=this.selNodes;if(D.length>0){for(var C=0,A=D.length;C
","",this.indentMarkup,"","","",E?("":"/>")):"","",D.text,"
","
    ",""].join("");var A;if(J!==true&&D.nextSibling&&(A=D.nextSibling.ui.getEl())){this.wrap=Ext.DomHelper.insertHtml("beforeBegin",A,C)}else{this.wrap=Ext.DomHelper.insertHtml("beforeEnd",H,C)}this.elNode=this.wrap.childNodes[0];this.ctNode=this.wrap.childNodes[1];var G=this.elNode.childNodes;this.indentNode=G[0];this.ecNode=G[1];this.iconNode=G[2];var F=3;if(E){this.checkbox=G[3];F++}this.anchor=G[F];this.textNode=G[F].firstChild},getAnchor:function(){return this.anchor},getTextEl:function(){return this.textNode},getIconEl:function(){return this.iconNode},isChecked:function(){return this.checkbox?this.checkbox.checked:false},updateExpandIcon:function(){if(this.rendered){var F=this.node,D,C;var A=F.isLast()?"x-tree-elbow-end":"x-tree-elbow";var E=F.hasChildNodes();if(E||F.attributes.expandable){if(F.expanded){A+="-minus";D="x-tree-node-collapsed";C="x-tree-node-expanded"}else{A+="-plus";D="x-tree-node-expanded";C="x-tree-node-collapsed"}if(this.wasLeaf){this.removeClass("x-tree-node-leaf");this.wasLeaf=false}if(this.c1!=D||this.c2!=C){Ext.fly(this.elNode).replaceClass(D,C);this.c1=D;this.c2=C}}else{if(!this.wasLeaf){Ext.fly(this.elNode).replaceClass("x-tree-node-expanded","x-tree-node-leaf");delete this.c1;delete this.c2;this.wasLeaf=true}}var B="x-tree-ec-icon "+A;if(this.ecc!=B){this.ecNode.className=B;this.ecc=B}}},getChildIndent:function(){if(!this.childIndent){var A=[];var B=this.node;while(B){if(!B.isRoot||(B.isRoot&&B.ownerTree.rootVisible)){if(!B.isLast()){A.unshift("")}else{A.unshift("")}}B=B.parentNode}this.childIndent=A.join("")}return this.childIndent},renderIndent:function(){if(this.rendered){var A="";var B=this.node.parentNode;if(B){A=B.ui.getChildIndent()}if(this.indentMarkup!=A){this.indentNode.innerHTML=A;this.indentMarkup=A}this.updateExpandIcon()}},destroy:function(){if(this.elNode){Ext.dd.Registry.unregister(this.elNode.id)}delete this.elNode;delete this.ctNode;delete this.indentNode;delete this.ecNode;delete this.iconNode;delete this.checkbox;delete this.anchor;delete this.textNode;Ext.removeNode(this.ctNode)}};Ext.tree.RootTreeNodeUI=Ext.extend(Ext.tree.TreeNodeUI,{render:function(){if(!this.rendered){var A=this.node.ownerTree.innerCt.dom;this.node.expanded=true;A.innerHTML="
    ";this.wrap=this.ctNode=A.firstChild}},collapse:Ext.emptyFn,expand:Ext.emptyFn}); +Ext.tree.TreeLoader=function(A){this.baseParams={};this.requestMethod="POST";Ext.apply(this,A);this.addEvents("beforeload","load","loadexception");Ext.tree.TreeLoader.superclass.constructor.call(this)};Ext.extend(Ext.tree.TreeLoader,Ext.util.Observable,{uiProviders:{},clearOnLoad:true,load:function(A,B){if(this.clearOnLoad){while(A.firstChild){A.removeChild(A.firstChild)}}if(this.doPreload(A)){if(typeof B=="function"){B()}}else{if(this.dataUrl||this.url){this.requestData(A,B)}}},doPreload:function(D){if(D.attributes.children){if(D.childNodes.length<1){var C=D.attributes.children;D.beginUpdate();for(var B=0,A=C.length;BK){return E?-1:+1}else{return 0}}}};Ext.tree.TreeSorter.prototype={doSort:function(A){A.sort(this.sortFn)},compareNodes:function(B,A){return(B.text.toUpperCase()>A.text.toUpperCase()?1:-1)},updateSort:function(A,B){if(B.childrenRendered){this.doSort.defer(1,this,[B])}},updateSortParent:function(A){var B=A.parentNode;if(B&&B.childrenRendered){this.doSort.defer(1,this,[B])}}}; +if(Ext.dd.DropZone){Ext.tree.TreeDropZone=function(A,B){this.allowParentInsert=false;this.allowContainerDrop=false;this.appendOnly=false;Ext.tree.TreeDropZone.superclass.constructor.call(this,A.innerCt,B);this.tree=A;this.dragOverData={};this.lastInsertClass="x-tree-no-status"};Ext.extend(Ext.tree.TreeDropZone,Ext.dd.DropZone,{ddGroup:"TreeDD",expandDelay:1000,expandNode:function(A){if(A.hasChildNodes()&&!A.isExpanded()){A.expand(false,null,this.triggerCacheRefresh.createDelegate(this))}},queueExpand:function(A){this.expandProcId=this.expandNode.defer(this.expandDelay,this,[A])},cancelExpand:function(){if(this.expandProcId){clearTimeout(this.expandProcId);this.expandProcId=false}},isValidDropPoint:function(A,I,G,D,C){if(!A||!C){return false}var E=A.node;var F=C.node;if(!(E&&E.isTarget&&I)){return false}if(I=="append"&&E.allowChildren===false){return false}if((I=="above"||I=="below")&&(E.parentNode&&E.parentNode.allowChildren===false)){return false}if(F&&(E==F||F.contains(E))){return false}var B=this.dragOverData;B.tree=this.tree;B.target=E;B.data=C;B.point=I;B.source=G;B.rawEvent=D;B.dropNode=F;B.cancel=false;var H=this.tree.fireEvent("nodedragover",B);return B.cancel===false&&H!==false},getDropPoint:function(E,D,I){var J=D.node;if(J.isRoot){return J.allowChildren!==false?"append":false}var B=D.ddel;var K=Ext.lib.Dom.getY(B),G=K+B.offsetHeight;var F=Ext.lib.Event.getPageY(E);var H=J.allowChildren===false||J.isLeaf();if(this.appendOnly||J.parentNode.allowChildren===false){return H?false:"append"}var C=false;if(!this.allowParentInsert){C=J.hasChildNodes()&&J.isExpanded()}var A=(G-K)/(H?2:3);if(F>=K&&F<(K+A)){return"above"}else{if(!C&&(H||F>=G-A&&F<=G)){return"below"}else{return"append"}}},onNodeEnter:function(D,A,C,B){this.cancelExpand()},onNodeOver:function(B,G,F,E){var I=this.getDropPoint(F,B,G);var C=B.node;if(!this.expandProcId&&I=="append"&&C.hasChildNodes()&&!B.node.isExpanded()){this.queueExpand(C)}else{if(I!="append"){this.cancelExpand()}}var D=this.dropNotAllowed;if(this.isValidDropPoint(B,I,G,F,E)){if(I){var A=B.ddel;var H;if(I=="above"){D=B.node.isFirst()?"x-tree-drop-ok-above":"x-tree-drop-ok-between";H="x-tree-drag-insert-above"}else{if(I=="below"){D=B.node.isLast()?"x-tree-drop-ok-below":"x-tree-drop-ok-between";H="x-tree-drag-insert-below"}else{D="x-tree-drop-ok-append";H="x-tree-drag-append"}}if(this.lastInsertClass!=H){Ext.fly(A).replaceClass(this.lastInsertClass,H);this.lastInsertClass=H}}}return D},onNodeOut:function(D,A,C,B){this.cancelExpand();this.removeDropIndicators(D)},onNodeDrop:function(C,I,E,D){var H=this.getDropPoint(E,C,I);var F=C.node;F.ui.startDrop();if(!this.isValidDropPoint(C,H,I,E,D)){F.ui.endDrop();return false}var G=D.node||(I.getTreeNode?I.getTreeNode(D,F,H,E):null);var B={tree:this.tree,target:F,data:D,point:H,source:I,rawEvent:E,dropNode:G,cancel:!G,dropStatus:false};var A=this.tree.fireEvent("beforenodedrop",B);if(A===false||B.cancel===true||!B.dropNode){F.ui.endDrop();return B.dropStatus}F=B.target;if(H=="append"&&!F.isExpanded()){F.expand(false,null,function(){this.completeDrop(B)}.createDelegate(this))}else{this.completeDrop(B)}return true},completeDrop:function(G){var D=G.dropNode,E=G.point,C=G.target;if(!Ext.isArray(D)){D=[D]}var F;for(var B=0,A=D.length;BD.offsetLeft){E.scrollLeft=D.offsetLeft}var A=Math.min(this.maxWidth,(E.clientWidth>20?E.clientWidth:E.offsetWidth)-Math.max(0,D.offsetLeft-E.scrollLeft)-5);this.setSize(A,"")},triggerEdit:function(A,B){this.completeEdit();if(A.attributes.editable!==false){this.editNode=A;this.autoEditTimer=this.startEdit.defer(this.editDelay,this,[A.ui.textNode,A.text]);return false}},bindScroll:function(){this.tree.getTreeEl().on("scroll",this.cancelEdit,this)},beforeNodeClick:function(A,B){clearTimeout(this.autoEditTimer);if(this.tree.getSelectionModel().isSelected(A)){B.stopEvent();return this.triggerEdit(A)}},onNodeDblClick:function(A,B){clearTimeout(this.autoEditTimer)},updateNode:function(A,B){this.tree.getTreeEl().un("scroll",this.cancelEdit,this);this.editNode.setText(B)},onHide:function(){Ext.tree.TreeEditor.superclass.onHide.call(this);if(this.editNode){this.editNode.ui.focus.defer(50,this.editNode.ui)}},onSpecialKey:function(C,B){var A=B.getKey();if(A==B.ESC){B.stopEvent();this.cancelEdit()}else{if(A==B.ENTER&&!B.hasModifier()){B.stopEvent();this.completeEdit()}}}}); +Ext.menu.Menu=function(A){if(Ext.isArray(A)){A={items:A}}Ext.apply(this,A);this.id=this.id||Ext.id();this.addEvents("beforeshow","beforehide","show","hide","click","mouseover","mouseout","itemclick");Ext.menu.MenuMgr.register(this);Ext.menu.Menu.superclass.constructor.call(this);var B=this.items;this.items=new Ext.util.MixedCollection();if(B){this.add.apply(this,B)}};Ext.extend(Ext.menu.Menu,Ext.util.Observable,{minWidth:120,shadow:"sides",subMenuAlign:"tl-tr?",defaultAlign:"tl-bl?",allowOtherMenus:false,hidden:true,createEl:function(){return new Ext.Layer({cls:"x-menu",shadow:this.shadow,constrain:false,parentEl:this.parentEl||document.body,zindex:15000})},render:function(){if(this.el){return }var B=this.el=this.createEl();if(!this.keyNav){this.keyNav=new Ext.menu.MenuNav(this)}if(this.plain){B.addClass("x-menu-plain")}if(this.cls){B.addClass(this.cls)}this.focusEl=B.createChild({tag:"a",cls:"x-menu-focus",href:"#",onclick:"return false;",tabIndex:"-1"});var A=B.createChild({tag:"ul",cls:"x-menu-list"});A.on("click",this.onClick,this);A.on("mouseover",this.onMouseOver,this);A.on("mouseout",this.onMouseOut,this);this.items.each(function(D){var C=document.createElement("li");C.className="x-menu-list-item";A.dom.appendChild(C);D.render(C,this)},this);this.ul=A;this.autoWidth()},autoWidth:function(){var D=this.el,C=this.ul;if(!D){return }var A=this.width;if(A){D.setWidth(A)}else{if(Ext.isIE){D.setWidth(this.minWidth);var B=D.dom.offsetWidth;D.setWidth(C.getWidth()+D.getFrameWidth("lr"))}}},delayAutoWidth:function(){if(this.el){if(!this.awTask){this.awTask=new Ext.util.DelayedTask(this.autoWidth,this)}this.awTask.delay(20)}},findTargetItem:function(B){var A=B.getTarget(".x-menu-list-item",this.ul,true);if(A&&A.menuItemId){return this.items.get(A.menuItemId)}},onClick:function(B){var A;if(A=this.findTargetItem(B)){A.onClick(B);this.fireEvent("click",this,A,B)}},setActiveItem:function(A,B){if(A!=this.activeItem){if(this.activeItem){this.activeItem.deactivate()}this.activeItem=A;A.activate(B)}else{if(B){A.expandMenu()}}},tryActivate:function(F,E){var B=this.items;for(var C=F,A=B.length;C>=0&&C0){H()}})}function H(){if(D&&D.length>0){var N=D.clone();N.each(function(O){O.hide()})}}function E(N){D.remove(N);if(D.length<1){Ext.getDoc().un("mousedown",L);A=false}}function J(N){var O=D.last();K=new Date();D.add(N);if(!A){Ext.getDoc().on("mousedown",L);A=true}if(N.parentMenu){N.getEl().setZIndex(parseInt(N.parentMenu.getEl().getStyle("z-index"),10)+3);N.parentMenu.activeChild=N}else{if(O&&O.isVisible()){N.getEl().setZIndex(parseInt(O.getEl().getStyle("z-index"),10)+3)}}}function B(N){if(N.activeChild){N.activeChild.hide()}if(N.autoHideTimer){clearTimeout(N.autoHideTimer);delete N.autoHideTimer}}function G(N){var O=N.parentMenu;if(!O&&!N.allowOtherMenus){H()}else{if(O&&O.activeChild){O.activeChild.hide()}}}function L(N){if(K.getElapsed()>50&&D.length>0&&!N.getTarget(".x-menu")){H()}}function I(O,R){if(R){var Q=C[O.group];for(var P=0,N=Q.length;P{1}",this.icon||Ext.BLANK_IMAGE_URL,this.itemText||this.text,this.iconCls||"");this.el=C;Ext.menu.Item.superclass.onRender.call(this,B,A)},setText:function(A){this.text=A;if(this.rendered){this.el.update(String.format("{1}",this.icon||Ext.BLANK_IMAGE_URL,this.text,this.iconCls||""));this.parentMenu.autoWidth()}},setIconClass:function(A){var B=this.iconCls;this.iconCls=A;if(this.rendered){this.el.child("img.x-menu-item-icon").replaceClass(B,this.iconCls)}},handleClick:function(A){if(!this.href){A.stopEvent()}Ext.menu.Item.superclass.handleClick.apply(this,arguments)},activate:function(A){if(Ext.menu.Item.superclass.activate.apply(this,arguments)){this.focus();if(A){this.expandMenu()}}return true},shouldDeactivate:function(A){if(Ext.menu.Item.superclass.shouldDeactivate.call(this,A)){if(this.menu&&this.menu.isVisible()){return !this.menu.getEl().getRegion().contains(A.getPoint())}return true}return false},deactivate:function(){Ext.menu.Item.superclass.deactivate.apply(this,arguments);this.hideMenu()},expandMenu:function(A){if(!this.disabled&&this.menu){clearTimeout(this.hideTimer);delete this.hideTimer;if(!this.menu.isVisible()&&!this.showTimer){this.showTimer=this.deferExpand.defer(this.showDelay,this,[A])}else{if(this.menu.isVisible()&&A){this.menu.tryActivate(0,1)}}}},deferExpand:function(A){delete this.showTimer;this.menu.show(this.container,this.parentMenu.subMenuAlign||"tl-tr?",this.parentMenu);if(A){this.menu.tryActivate(0,1)}},hideMenu:function(){clearTimeout(this.showTimer);delete this.showTimer;if(!this.hideTimer&&this.menu&&this.menu.isVisible()){this.hideTimer=this.deferHide.defer(this.hideDelay,this)}},deferHide:function(){delete this.hideTimer;this.menu.hide()}}); +Ext.menu.CheckItem=function(A){Ext.menu.CheckItem.superclass.constructor.call(this,A);this.addEvents("beforecheckchange","checkchange");if(this.checkHandler){this.on("checkchange",this.checkHandler,this.scope)}Ext.menu.MenuMgr.registerCheckable(this)};Ext.extend(Ext.menu.CheckItem,Ext.menu.Item,{itemCls:"x-menu-item x-menu-check-item",groupClass:"x-menu-group-item",checked:false,ctype:"Ext.menu.CheckItem",onRender:function(A){Ext.menu.CheckItem.superclass.onRender.apply(this,arguments);if(this.group){this.el.addClass(this.groupClass)}if(this.checked){this.checked=false;this.setChecked(true,true)}},destroy:function(){Ext.menu.MenuMgr.unregisterCheckable(this);Ext.menu.CheckItem.superclass.destroy.apply(this,arguments)},setChecked:function(B,A){if(this.checked!=B&&this.fireEvent("beforecheckchange",this,B)!==false){if(this.container){this.container[B?"addClass":"removeClass"]("x-menu-item-checked")}this.checked=B;if(A!==true){this.fireEvent("checkchange",this,B)}}},handleClick:function(A){if(!this.disabled&&!(this.checked&&this.group)){this.setChecked(!this.checked)}Ext.menu.CheckItem.superclass.handleClick.apply(this,arguments)}}); +Ext.menu.Adapter=function(B,A){Ext.menu.Adapter.superclass.constructor.call(this,A);this.component=B};Ext.extend(Ext.menu.Adapter,Ext.menu.BaseItem,{canActivate:true,onRender:function(B,A){this.component.render(B);this.el=this.component.getEl()},activate:function(){if(this.disabled){return false}this.component.focus();this.fireEvent("activate",this);return true},deactivate:function(){this.fireEvent("deactivate",this)},disable:function(){this.component.disable();Ext.menu.Adapter.superclass.disable.call(this)},enable:function(){this.component.enable();Ext.menu.Adapter.superclass.enable.call(this)}}); +Ext.menu.DateItem=function(A){Ext.menu.DateItem.superclass.constructor.call(this,new Ext.DatePicker(A),A);this.picker=this.component;this.addEvents("select");this.picker.on("render",function(B){B.getEl().swallowEvent("click");B.container.addClass("x-menu-date-item")});this.picker.on("select",this.onSelect,this)};Ext.extend(Ext.menu.DateItem,Ext.menu.Adapter,{onSelect:function(B,A){this.fireEvent("select",this,A,B);Ext.menu.DateItem.superclass.handleClick.call(this)}}); +Ext.menu.ColorItem=function(A){Ext.menu.ColorItem.superclass.constructor.call(this,new Ext.ColorPalette(A),A);this.palette=this.component;this.relayEvents(this.palette,["select"]);if(this.selectHandler){this.on("select",this.selectHandler,this.scope)}};Ext.extend(Ext.menu.ColorItem,Ext.menu.Adapter); +Ext.menu.DateMenu=function(A){Ext.menu.DateMenu.superclass.constructor.call(this,A);this.plain=true;var B=new Ext.menu.DateItem(A);this.add(B);this.picker=B.picker;this.relayEvents(B,["select"]);this.on("beforeshow",function(){if(this.picker){this.picker.hideMonthPicker(true)}},this)};Ext.extend(Ext.menu.DateMenu,Ext.menu.Menu,{cls:"x-date-menu",beforeDestroy:function(){this.picker.destroy()}}); +Ext.menu.ColorMenu=function(A){Ext.menu.ColorMenu.superclass.constructor.call(this,A);this.plain=true;var B=new Ext.menu.ColorItem(A);this.add(B);this.palette=B.palette;this.relayEvents(B,["select"])};Ext.extend(Ext.menu.ColorMenu,Ext.menu.Menu); +Ext.form.Field=Ext.extend(Ext.BoxComponent,{invalidClass:"x-form-invalid",invalidText:"The value in this field is invalid",focusClass:"x-form-focus",validationEvent:"keyup",validateOnBlur:true,validationDelay:250,defaultAutoCreate:{tag:"input",type:"text",size:"20",autocomplete:"off"},fieldClass:"x-form-field",msgTarget:"qtip",msgFx:"normal",readOnly:false,disabled:false,isFormField:true,hasFocus:false,initComponent:function(){Ext.form.Field.superclass.initComponent.call(this);this.addEvents("focus","blur","specialkey","change","invalid","valid")},getName:function(){return this.rendered&&this.el.dom.name?this.el.dom.name:(this.hiddenName||"")},onRender:function(C,A){Ext.form.Field.superclass.onRender.call(this,C,A);if(!this.el){var B=this.getAutoCreate();if(!B.name){B.name=this.name||this.id}if(this.inputType){B.type=this.inputType}this.el=C.createChild(B,A)}var D=this.el.dom.type;if(D){if(D=="password"){D="text"}this.el.addClass("x-form-"+D)}if(this.readOnly){this.el.dom.readOnly=true}if(this.tabIndex!==undefined){this.el.dom.setAttribute("tabIndex",this.tabIndex)}this.el.addClass([this.fieldClass,this.cls]);this.initValue()},initValue:function(){if(this.value!==undefined){this.setValue(this.value)}else{if(this.el.dom.value.length>0){this.setValue(this.el.dom.value)}}},isDirty:function(){if(this.disabled){return false}return String(this.getValue())!==String(this.originalValue)},afterRender:function(){Ext.form.Field.superclass.afterRender.call(this);this.initEvents()},fireKey:function(A){if(A.isSpecialKey()){this.fireEvent("specialkey",this,A)}},reset:function(){this.setValue(this.originalValue);this.clearInvalid()},initEvents:function(){this.el.on(Ext.isIE?"keydown":"keypress",this.fireKey,this);this.el.on("focus",this.onFocus,this);this.el.on("blur",this.onBlur,this);this.originalValue=this.getValue()},onFocus:function(){if(!Ext.isOpera&&this.focusClass){this.el.addClass(this.focusClass)}if(!this.hasFocus){this.hasFocus=true;this.startValue=this.getValue();this.fireEvent("focus",this)}},beforeBlur:Ext.emptyFn,onBlur:function(){this.beforeBlur();if(!Ext.isOpera&&this.focusClass){this.el.removeClass(this.focusClass)}this.hasFocus=false;if(this.validationEvent!==false&&this.validateOnBlur&&this.validationEvent!="blur"){this.validate()}var A=this.getValue();if(String(A)!==String(this.startValue)){this.fireEvent("change",this,A,this.startValue)}this.fireEvent("blur",this)},isValid:function(A){if(this.disabled){return true}var C=this.preventMark;this.preventMark=A===true;var B=this.validateValue(this.processValue(this.getRawValue()));this.preventMark=C;return B},validate:function(){if(this.disabled||this.validateValue(this.processValue(this.getRawValue()))){this.clearInvalid();return true}return false},processValue:function(A){return A},validateValue:function(A){return true},markInvalid:function(C){if(!this.rendered||this.preventMark){return }this.el.addClass(this.invalidClass);C=C||this.invalidText;switch(this.msgTarget){case"qtip":this.el.dom.qtip=C;this.el.dom.qclass="x-form-invalid-tip";if(Ext.QuickTips){Ext.QuickTips.enable()}break;case"title":this.el.dom.title=C;break;case"under":if(!this.errorEl){var B=this.el.findParent(".x-form-element",5,true);this.errorEl=B.createChild({cls:"x-form-invalid-msg"});this.errorEl.setWidth(B.getWidth(true)-20)}this.errorEl.update(C);Ext.form.Field.msgFx[this.msgFx].show(this.errorEl,this);break;case"side":if(!this.errorIcon){var B=this.el.findParent(".x-form-element",5,true);this.errorIcon=B.createChild({cls:"x-form-invalid-icon"})}this.alignErrorIcon();this.errorIcon.dom.qtip=C;this.errorIcon.dom.qclass="x-form-invalid-tip";this.errorIcon.show();this.on("resize",this.alignErrorIcon,this);break;default:var A=Ext.getDom(this.msgTarget);A.innerHTML=C;A.style.display=this.msgDisplay;break}this.fireEvent("invalid",this,C)},alignErrorIcon:function(){this.errorIcon.alignTo(this.el,"tl-tr",[2,0])},clearInvalid:function(){if(!this.rendered||this.preventMark){return }this.el.removeClass(this.invalidClass);switch(this.msgTarget){case"qtip":this.el.dom.qtip="";break;case"title":this.el.dom.title="";break;case"under":if(this.errorEl){Ext.form.Field.msgFx[this.msgFx].hide(this.errorEl,this)}break;case"side":if(this.errorIcon){this.errorIcon.dom.qtip="";this.errorIcon.hide();this.un("resize",this.alignErrorIcon,this)}break;default:var A=Ext.getDom(this.msgTarget);A.innerHTML="";A.style.display="none";break}this.fireEvent("valid",this)},getRawValue:function(){var A=this.rendered?this.el.getValue():Ext.value(this.value,"");if(A===this.emptyText){A=""}return A},getValue:function(){if(!this.rendered){return this.value}var A=this.el.getValue();if(A===this.emptyText||A===undefined){A=""}return A},setRawValue:function(A){return this.el.dom.value=(A===null||A===undefined?"":A)},setValue:function(A){this.value=A;if(this.rendered){this.el.dom.value=(A===null||A===undefined?"":A);this.validate()}},adjustSize:function(A,C){var B=Ext.form.Field.superclass.adjustSize.call(this,A,C);B.width=this.adjustWidth(this.el.dom.tagName,B.width);return B},adjustWidth:function(A,B){A=A.toLowerCase();if(typeof B=="number"&&!Ext.isSafari){if(Ext.isIE&&(A=="input"||A=="textarea")){if(A=="input"&&!Ext.isStrict){return this.inEditor?B:B-3}if(A=="input"&&Ext.isStrict){return B-(Ext.isIE6?4:1)}if(A="textarea"&&Ext.isStrict){return B-2}}else{if(Ext.isOpera&&Ext.isStrict){if(A=="input"){return B+2}if(A="textarea"){return B-2}}}}return B}});Ext.form.Field.msgFx={normal:{show:function(A,B){A.setDisplayed("block")},hide:function(A,B){A.setDisplayed(false).update("")}},slide:{show:function(A,B){A.slideIn("t",{stopFx:true})},hide:function(A,B){A.slideOut("t",{stopFx:true,useDisplay:true})}},slideRight:{show:function(A,B){A.fixDisplay();A.alignTo(B.el,"tl-tr");A.slideIn("l",{stopFx:true})},hide:function(A,B){A.slideOut("l",{stopFx:true,useDisplay:true})}}};Ext.reg("field",Ext.form.Field); +Ext.form.TextField=Ext.extend(Ext.form.Field,{grow:false,growMin:30,growMax:800,vtype:null,maskRe:null,disableKeyFilter:false,allowBlank:true,minLength:0,maxLength:Number.MAX_VALUE,minLengthText:"The minimum length for this field is {0}",maxLengthText:"The maximum length for this field is {0}",selectOnFocus:false,blankText:"This field is required",validator:null,regex:null,regexText:"",emptyText:null,emptyClass:"x-form-empty-field",initComponent:function(){Ext.form.TextField.superclass.initComponent.call(this);this.addEvents("autosize")},initEvents:function(){Ext.form.TextField.superclass.initEvents.call(this);if(this.validationEvent=="keyup"){this.validationTask=new Ext.util.DelayedTask(this.validate,this);this.el.on("keyup",this.filterValidation,this)}else{if(this.validationEvent!==false){this.el.on(this.validationEvent,this.validate,this,{buffer:this.validationDelay})}}if(this.selectOnFocus||this.emptyText){this.on("focus",this.preFocus,this);if(this.emptyText){this.on("blur",this.postBlur,this);this.applyEmptyText()}}if(this.maskRe||(this.vtype&&this.disableKeyFilter!==true&&(this.maskRe=Ext.form.VTypes[this.vtype+"Mask"]))){this.el.on("keypress",this.filterKeys,this)}if(this.grow){this.el.on("keyup",this.onKeyUp,this,{buffer:50});this.el.on("click",this.autoSize,this)}},processValue:function(A){if(this.stripCharsRe){var B=A.replace(this.stripCharsRe,"");if(B!==A){this.setRawValue(B);return B}}return A},filterValidation:function(A){if(!A.isNavKeyPress()){this.validationTask.delay(this.validationDelay)}},onKeyUp:function(A){if(!A.isNavKeyPress()){this.autoSize()}},reset:function(){Ext.form.TextField.superclass.reset.call(this);this.applyEmptyText()},applyEmptyText:function(){if(this.rendered&&this.emptyText&&this.getRawValue().length<1){this.setRawValue(this.emptyText);this.el.addClass(this.emptyClass)}},preFocus:function(){if(this.emptyText){if(this.el.dom.value==this.emptyText){this.setRawValue("")}this.el.removeClass(this.emptyClass)}if(this.selectOnFocus){this.el.dom.select()}},postBlur:function(){this.applyEmptyText()},filterKeys:function(B){var A=B.getKey();if(!Ext.isIE&&(B.isNavKeyPress()||A==B.BACKSPACE||(A==B.DELETE&&B.button==-1))){return }var D=B.getCharCode(),C=String.fromCharCode(D);if(Ext.isIE&&(B.isSpecialKey()||!C)){return }if(!this.maskRe.test(C)){B.stopEvent()}},setValue:function(A){if(this.emptyText&&this.el&&A!==undefined&&A!==null&&A!==""){this.el.removeClass(this.emptyClass)}Ext.form.TextField.superclass.setValue.apply(this,arguments);this.applyEmptyText();this.autoSize()},validateValue:function(A){if(A.length<1||A===this.emptyText){if(this.allowBlank){this.clearInvalid();return true}else{this.markInvalid(this.blankText);return false}}if(A.lengththis.maxLength){this.markInvalid(String.format(this.maxLengthText,this.maxLength));return false}if(this.vtype){var C=Ext.form.VTypes;if(!C[this.vtype](A,this)){this.markInvalid(this.vtypeText||C[this.vtype+"Text"]);return false}}if(typeof this.validator=="function"){var B=this.validator(A);if(B!==true){this.markInvalid(B);return false}}if(this.regex&&!this.regex.test(A)){this.markInvalid(this.regexText);return false}return true},selectText:function(E,A){var C=this.getRawValue();if(C.length>0){E=E===undefined?0:E;A=A===undefined?C.length:A;var D=this.el.dom;if(D.setSelectionRange){D.setSelectionRange(E,A)}else{if(D.createTextRange){var B=D.createTextRange();B.moveStart("character",E);B.moveEnd("character",A-C.length);B.select()}}}},autoSize:function(){if(!this.grow||!this.rendered){return }if(!this.metrics){this.metrics=Ext.util.TextMetrics.createInstance(this.el)}var C=this.el;var B=C.dom.value;var D=document.createElement("div");D.appendChild(document.createTextNode(B));B=D.innerHTML;D=null;B+=" ";var A=Math.min(this.growMax,Math.max(this.metrics.getWidth(B)+10,this.growMin));this.el.setWidth(A);this.fireEvent("autosize",this,A)}});Ext.reg("textfield",Ext.form.TextField); +Ext.form.TriggerField=Ext.extend(Ext.form.TextField,{defaultAutoCreate:{tag:"input",type:"text",size:"16",autocomplete:"off"},hideTrigger:false,autoSize:Ext.emptyFn,monitorTab:true,deferHeight:true,mimicing:false,onResize:function(A,B){Ext.form.TriggerField.superclass.onResize.call(this,A,B);if(typeof A=="number"){this.el.setWidth(this.adjustWidth("input",A-this.trigger.getWidth()))}this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth())},adjustSize:Ext.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap},getPositionEl:function(){return this.wrap},alignErrorIcon:function(){this.errorIcon.alignTo(this.wrap,"tl-tr",[2,0])},onRender:function(B,A){Ext.form.TriggerField.superclass.onRender.call(this,B,A);this.wrap=this.el.wrap({cls:"x-form-field-wrap"});this.trigger=this.wrap.createChild(this.triggerConfig||{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.triggerClass});if(this.hideTrigger){this.trigger.setDisplayed(false)}this.initTrigger();if(!this.width){this.wrap.setWidth(this.el.getWidth()+this.trigger.getWidth())}},initTrigger:function(){this.trigger.on("click",this.onTriggerClick,this,{preventDefault:true});this.trigger.addClassOnOver("x-form-trigger-over");this.trigger.addClassOnClick("x-form-trigger-click")},onDestroy:function(){if(this.trigger){this.trigger.removeAllListeners();this.trigger.remove()}if(this.wrap){this.wrap.remove()}Ext.form.TriggerField.superclass.onDestroy.call(this)},onFocus:function(){Ext.form.TriggerField.superclass.onFocus.call(this);if(!this.mimicing){this.wrap.addClass("x-trigger-wrap-focus");this.mimicing=true;Ext.get(Ext.isIE?document.body:document).on("mousedown",this.mimicBlur,this,{delay:10});if(this.monitorTab){this.el.on("keydown",this.checkTab,this)}}},checkTab:function(A){if(A.getKey()==A.TAB){this.triggerBlur()}},onBlur:function(){},mimicBlur:function(A){if(!this.wrap.contains(A.target)&&this.validateBlur(A)){this.triggerBlur()}},triggerBlur:function(){this.mimicing=false;Ext.get(Ext.isIE?document.body:document).un("mousedown",this.mimicBlur);if(this.monitorTab){this.el.un("keydown",this.checkTab,this)}this.beforeBlur();this.wrap.removeClass("x-trigger-wrap-focus");Ext.form.TriggerField.superclass.onBlur.call(this)},beforeBlur:Ext.emptyFn,validateBlur:function(A){return true},onDisable:function(){Ext.form.TriggerField.superclass.onDisable.call(this);if(this.wrap){this.wrap.addClass("x-item-disabled")}},onEnable:function(){Ext.form.TriggerField.superclass.onEnable.call(this);if(this.wrap){this.wrap.removeClass("x-item-disabled")}},onShow:function(){if(this.wrap){this.wrap.dom.style.display="";this.wrap.dom.style.visibility="visible"}},onHide:function(){this.wrap.dom.style.display="none"},onTriggerClick:Ext.emptyFn});Ext.form.TwinTriggerField=Ext.extend(Ext.form.TriggerField,{initComponent:function(){Ext.form.TwinTriggerField.superclass.initComponent.call(this);this.triggerConfig={tag:"span",cls:"x-form-twin-triggers",cn:[{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger1Class},{tag:"img",src:Ext.BLANK_IMAGE_URL,cls:"x-form-trigger "+this.trigger2Class}]}},getTrigger:function(A){return this.triggers[A]},initTrigger:function(){var A=this.trigger.select(".x-form-trigger",true);this.wrap.setStyle("overflow","hidden");var B=this;A.each(function(D,F,C){D.hide=function(){var G=B.wrap.getWidth();this.dom.style.display="none";B.el.setWidth(G-B.trigger.getWidth())};D.show=function(){var G=B.wrap.getWidth();this.dom.style.display="";B.el.setWidth(G-B.trigger.getWidth())};var E="Trigger"+(C+1);if(this["hide"+E]){D.dom.style.display="none"}D.on("click",this["on"+E+"Click"],this,{preventDefault:true});D.addClassOnOver("x-form-trigger-over");D.addClassOnClick("x-form-trigger-click")},this);this.triggers=A.elements},onTrigger1Click:Ext.emptyFn,onTrigger2Click:Ext.emptyFn});Ext.reg("trigger",Ext.form.TriggerField); +Ext.form.TextArea=Ext.extend(Ext.form.TextField,{growMin:60,growMax:1000,growAppend:" \n ",growPad:0,enterIsSpecial:false,preventScrollbars:false,onRender:function(B,A){if(!this.el){this.defaultAutoCreate={tag:"textarea",style:"width:100px;height:60px;",autocomplete:"off"}}Ext.form.TextArea.superclass.onRender.call(this,B,A);if(this.grow){this.textSizeEl=Ext.DomHelper.append(document.body,{tag:"pre",cls:"x-form-grow-sizer"});if(this.preventScrollbars){this.el.setStyle("overflow","hidden")}this.el.setHeight(this.growMin)}},onDestroy:function(){if(this.textSizeEl){Ext.removeNode(this.textSizeEl)}Ext.form.TextArea.superclass.onDestroy.call(this)},fireKey:function(A){if(A.isSpecialKey()&&(this.enterIsSpecial||(A.getKey()!=A.ENTER||A.hasModifier()))){this.fireEvent("specialkey",this,A)}},onKeyUp:function(A){if(!A.isNavKeyPress()||A.getKey()==A.ENTER){this.autoSize()}},autoSize:function(){if(!this.grow||!this.textSizeEl){return }var C=this.el;var A=C.dom.value;var D=this.textSizeEl;D.innerHTML="";D.appendChild(document.createTextNode(A));A=D.innerHTML;Ext.fly(D).setWidth(this.el.getWidth());if(A.length<1){A="  "}else{if(Ext.isIE){A=A.replace(/\n/g,"

     

    ")}A+=this.growAppend}D.innerHTML=A;var B=Math.min(this.growMax,Math.max(D.offsetHeight,this.growMin)+this.growPad);if(B!=this.lastHeight){this.lastHeight=B;this.el.setHeight(B);this.fireEvent("autosize",this,B)}}});Ext.reg("textarea",Ext.form.TextArea); +Ext.form.NumberField=Ext.extend(Ext.form.TextField,{fieldClass:"x-form-field x-form-num-field",allowDecimals:true,decimalSeparator:".",decimalPrecision:2,allowNegative:true,minValue:Number.NEGATIVE_INFINITY,maxValue:Number.MAX_VALUE,minText:"The minimum value for this field is {0}",maxText:"The maximum value for this field is {0}",nanText:"{0} is not a valid number",baseChars:"0123456789",initEvents:function(){Ext.form.NumberField.superclass.initEvents.call(this);var B=this.baseChars+"";if(this.allowDecimals){B+=this.decimalSeparator}if(this.allowNegative){B+="-"}this.stripCharsRe=new RegExp("[^"+B+"]","gi");var A=function(D){var C=D.getKey();if(!Ext.isIE&&(D.isSpecialKey()||C==D.BACKSPACE||C==D.DELETE)){return }var E=D.getCharCode();if(B.indexOf(String.fromCharCode(E))===-1){D.stopEvent()}};this.el.on("keypress",A,this)},validateValue:function(B){if(!Ext.form.NumberField.superclass.validateValue.call(this,B)){return false}if(B.length<1){return true}B=String(B).replace(this.decimalSeparator,".");if(isNaN(B)){this.markInvalid(String.format(this.nanText,B));return false}var A=this.parseValue(B);if(Athis.maxValue){this.markInvalid(String.format(this.maxText,this.maxValue));return false}return true},getValue:function(){return this.fixPrecision(this.parseValue(Ext.form.NumberField.superclass.getValue.call(this)))},setValue:function(A){A=parseFloat(A);A=isNaN(A)?"":String(A).replace(".",this.decimalSeparator);Ext.form.NumberField.superclass.setValue.call(this,A)},parseValue:function(A){A=parseFloat(String(A).replace(this.decimalSeparator,"."));return isNaN(A)?"":A},fixPrecision:function(B){var A=isNaN(B);if(!this.allowDecimals||this.decimalPrecision==-1||A||!B){return A?"":B}return parseFloat(parseFloat(B).toFixed(this.decimalPrecision))},beforeBlur:function(){var A=this.parseValue(this.getRawValue());if(A){this.setValue(this.fixPrecision(A))}}});Ext.reg("numberfield",Ext.form.NumberField); +Ext.form.DateField=Ext.extend(Ext.form.TriggerField,{format:"m/d/y",altFormats:"m/d/Y|n/j/Y|n/j/y|m/j/y|n/d/y|m/j/Y|n/d/Y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d",disabledDays:null,disabledDaysText:"Disabled",disabledDates:null,disabledDatesText:"Disabled",minValue:null,maxValue:null,minText:"The date in this field must be equal to or after {0}",maxText:"The date in this field must be equal to or before {0}",invalidText:"{0} is not a valid date - it must be in the format {1}",triggerClass:"x-form-date-trigger",defaultAutoCreate:{tag:"input",type:"text",size:"10",autocomplete:"off"},initComponent:function(){Ext.form.DateField.superclass.initComponent.call(this);if(typeof this.minValue=="string"){this.minValue=this.parseDate(this.minValue)}if(typeof this.maxValue=="string"){this.maxValue=this.parseDate(this.maxValue)}this.ddMatch=null;if(this.disabledDates){var A=this.disabledDates;var C="(?:";for(var B=0;Bthis.maxValue.getTime()){this.markInvalid(String.format(this.maxText,this.formatDate(this.maxValue)));return false}if(this.disabledDays){var A=E.getDay();for(var B=0;B
    {"+this.displayField+"}
    "}this.view=new Ext.DataView({applyTo:this.innerList,tpl:this.tpl,singleSelect:true,selectedClass:this.selectedClass,itemSelector:this.itemSelector||"."+A+"-item"});this.view.on("click",this.onViewClick,this);this.bindStore(this.store,true);if(this.resizable){this.resizer=new Ext.Resizable(this.list,{pinned:true,handles:"se"});this.resizer.on("resize",function(E,C,D){this.maxHeight=D-this.handleHeight-this.list.getFrameWidth("tb")-this.assetHeight;this.listWidth=C;this.innerList.setWidth(C-this.list.getFrameWidth("lr"));this.restrictHeight()},this);this[this.pageSize?"footer":"innerList"].setStyle("margin-bottom",this.handleHeight+"px")}}},bindStore:function(A,B){if(this.store&&!B){this.store.un("beforeload",this.onBeforeLoad,this);this.store.un("load",this.onLoad,this);this.store.un("loadexception",this.collapse,this);if(!A){this.store=null;if(this.view){this.view.setStore(null)}}}if(A){this.store=Ext.StoreMgr.lookup(A);this.store.on("beforeload",this.onBeforeLoad,this);this.store.on("load",this.onLoad,this);this.store.on("loadexception",this.collapse,this);if(this.view){this.view.setStore(A)}}},initEvents:function(){Ext.form.ComboBox.superclass.initEvents.call(this);this.keyNav=new Ext.KeyNav(this.el,{"up":function(A){this.inKeyMode=true;this.selectPrev()},"down":function(A){if(!this.isExpanded()){this.onTriggerClick()}else{this.inKeyMode=true;this.selectNext()}},"enter":function(A){this.onViewClick();this.delayedCheck=true;this.unsetDelayCheck.defer(10,this)},"esc":function(A){this.collapse()},"tab":function(A){this.onViewClick(false);return true},scope:this,doRelay:function(C,B,A){if(A=="down"||this.scope.isExpanded()){return Ext.KeyNav.prototype.doRelay.apply(this,arguments)}return true},forceKeyDown:true});this.queryDelay=Math.max(this.queryDelay||10,this.mode=="local"?10:250);this.dqTask=new Ext.util.DelayedTask(this.initQuery,this);if(this.typeAhead){this.taTask=new Ext.util.DelayedTask(this.onTypeAhead,this)}if(this.editable!==false){this.el.on("keyup",this.onKeyUp,this)}if(this.forceSelection){this.on("blur",this.doForce,this)}},onDestroy:function(){if(this.view){this.view.el.removeAllListeners();this.view.el.remove();this.view.purgeListeners()}if(this.list){this.list.destroy()}this.bindStore(null);Ext.form.ComboBox.superclass.onDestroy.call(this)},unsetDelayCheck:function(){delete this.delayedCheck},fireKey:function(A){if(A.isNavKeyPress()&&!this.isExpanded()&&!this.delayedCheck){this.fireEvent("specialkey",this,A)}},onResize:function(A,B){Ext.form.ComboBox.superclass.onResize.apply(this,arguments);if(this.list&&this.listWidth===undefined){var C=Math.max(A,this.minListWidth);this.list.setWidth(C);this.innerList.setWidth(C-this.list.getFrameWidth("lr"))}},onEnable:function(){Ext.form.ComboBox.superclass.onEnable.apply(this,arguments);if(this.hiddenField){this.hiddenField.disabled=false}},onDisable:function(){Ext.form.ComboBox.superclass.onDisable.apply(this,arguments);if(this.hiddenField){this.hiddenField.disabled=true}},setEditable:function(A){if(A==this.editable){return }this.editable=A;if(!A){this.el.dom.setAttribute("readOnly",true);this.el.on("mousedown",this.onTriggerClick,this);this.el.addClass("x-combo-noedit")}else{this.el.dom.setAttribute("readOnly",false);this.el.un("mousedown",this.onTriggerClick,this);this.el.removeClass("x-combo-noedit")}},onBeforeLoad:function(){if(!this.hasFocus){return }this.innerList.update(this.loadingText?"
    "+this.loadingText+"
    ":"");this.restrictHeight();this.selectedIndex=-1},onLoad:function(){if(!this.hasFocus){return }if(this.store.getCount()>0){this.expand();this.restrictHeight();if(this.lastQuery==this.allQuery){if(this.editable){this.el.dom.select()}if(!this.selectByValue(this.value,true)){this.select(0,true)}}else{this.selectNext();if(this.typeAhead&&this.lastKey!=Ext.EventObject.BACKSPACE&&this.lastKey!=Ext.EventObject.DELETE){this.taTask.delay(this.typeAheadDelay)}}}else{this.onEmptyResults()}},onTypeAhead:function(){if(this.store.getCount()>0){var B=this.store.getAt(0);var C=B.data[this.displayField];var A=C.length;var D=this.getRawValue().length;if(D!=A){this.setRawValue(C);this.selectText(D,C.length)}}},onSelect:function(A,B){if(this.fireEvent("beforeselect",this,A,B)!==false){this.setValue(A.data[this.valueField||this.displayField]);this.collapse();this.fireEvent("select",this,A,B)}},getValue:function(){if(this.valueField){return typeof this.value!="undefined"?this.value:""}else{return Ext.form.ComboBox.superclass.getValue.call(this)}},clearValue:function(){if(this.hiddenField){this.hiddenField.value=""}this.setRawValue("");this.lastSelectionText="";this.applyEmptyText();this.value=""},setValue:function(A){var C=A;if(this.valueField){var B=this.findRecord(this.valueField,A);if(B){C=B.data[this.displayField]}else{if(this.valueNotFoundText!==undefined){C=this.valueNotFoundText}}}this.lastSelectionText=C;if(this.hiddenField){this.hiddenField.value=A}Ext.form.ComboBox.superclass.setValue.call(this,C);this.value=A},findRecord:function(C,B){var A;if(this.store.getCount()>0){this.store.each(function(D){if(D.data[C]==B){A=D;return false}})}return A},onViewMove:function(B,A){this.inKeyMode=false},onViewOver:function(D,B){if(this.inKeyMode){return }var C=this.view.findItemFromChild(B);if(C){var A=this.view.indexOf(C);this.select(A,false)}},onViewClick:function(B){var A=this.view.getSelectedIndexes()[0];var C=this.store.getAt(A);if(C){this.onSelect(C,A)}if(B!==false){this.el.focus()}},restrictHeight:function(){this.innerList.dom.style.height="";var B=this.innerList.dom;var E=this.list.getFrameWidth("tb")+(this.resizable?this.handleHeight:0)+this.assetHeight;var C=Math.max(B.clientHeight,B.offsetHeight,B.scrollHeight);var A=this.getPosition()[1]-Ext.getBody().getScroll().top;var F=Ext.lib.Dom.getViewHeight()-A-this.getSize().height;var D=Math.max(A,F,this.minHeight||0)-this.list.shadow.offset-E-2;C=Math.min(C,D,this.maxHeight);this.innerList.setHeight(C);this.list.beginUpdate();this.list.setHeight(C+E);this.list.alignTo(this.el,this.listAlign);this.list.endUpdate()},onEmptyResults:function(){this.collapse()},isExpanded:function(){return this.list&&this.list.isVisible()},selectByValue:function(A,C){if(A!==undefined&&A!==null){var B=this.findRecord(this.valueField||this.displayField,A);if(B){this.select(this.store.indexOf(B),C);return true}}return false},select:function(A,C){this.selectedIndex=A;this.view.select(A);if(C!==false){var B=this.view.getNode(A);if(B){this.innerList.scrollChildIntoView(B,false)}}},selectNext:function(){var A=this.store.getCount();if(A>0){if(this.selectedIndex==-1){this.select(0)}else{if(this.selectedIndex0){if(this.selectedIndex==-1){this.select(0)}else{if(this.selectedIndex!=0){this.select(this.selectedIndex-1)}}}},onKeyUp:function(A){if(this.editable!==false&&!A.isSpecialKey()){this.lastKey=A.getKey();this.dqTask.delay(this.queryDelay)}},validateBlur:function(){return !this.list||!this.list.isVisible()},initQuery:function(){this.doQuery(this.getRawValue())},doForce:function(){if(this.el.dom.value.length>0){this.el.dom.value=this.lastSelectionText===undefined?"":this.lastSelectionText;this.applyEmptyText()}},doQuery:function(C,B){if(C===undefined||C===null){C=""}var A={query:C,forceAll:B,combo:this,cancel:false};if(this.fireEvent("beforequery",A)===false||A.cancel){return false}C=A.query;B=A.forceAll;if(B===true||(C.length>=this.minChars)){if(this.lastQuery!==C){this.lastQuery=C;if(this.mode=="local"){this.selectedIndex=-1;if(B){this.store.clearFilter()}else{this.store.filter(this.displayField,C)}this.onLoad()}else{this.store.baseParams[this.queryParam]=C;this.store.load({params:this.getParams(C)});this.expand()}}else{this.selectedIndex=-1;this.onLoad()}}},getParams:function(A){var B={};if(this.pageSize){B.start=0;B.limit=this.pageSize}return B},collapse:function(){if(!this.isExpanded()){return }this.list.hide();Ext.getDoc().un("mousewheel",this.collapseIf,this);Ext.getDoc().un("mousedown",this.collapseIf,this);this.fireEvent("collapse",this)},collapseIf:function(A){if(!A.within(this.wrap)&&!A.within(this.list)){this.collapse()}},expand:function(){if(this.isExpanded()||!this.hasFocus){return }this.list.alignTo(this.wrap,this.listAlign);this.list.show();this.innerList.setOverflow("auto");Ext.getDoc().on("mousewheel",this.collapseIf,this);Ext.getDoc().on("mousedown",this.collapseIf,this);this.fireEvent("expand",this)},onTriggerClick:function(){if(this.disabled){return }if(this.isExpanded()){this.collapse();this.el.focus()}else{this.onFocus({});if(this.triggerAction=="all"){this.doQuery(this.allQuery,true)}else{this.doQuery(this.getRawValue())}this.el.focus()}}});Ext.reg("combo",Ext.form.ComboBox); +Ext.form.Checkbox=Ext.extend(Ext.form.Field,{focusClass:undefined,fieldClass:"x-form-field",checked:false,defaultAutoCreate:{tag:"input",type:"checkbox",autocomplete:"off"},initComponent:function(){Ext.form.Checkbox.superclass.initComponent.call(this);this.addEvents("check")},onResize:function(){Ext.form.Checkbox.superclass.onResize.apply(this,arguments);if(!this.boxLabel){this.el.alignTo(this.wrap,"c-c")}},initEvents:function(){Ext.form.Checkbox.superclass.initEvents.call(this);this.el.on("click",this.onClick,this);this.el.on("change",this.onClick,this)},getResizeEl:function(){return this.wrap},getPositionEl:function(){return this.wrap},markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn,onRender:function(B,A){Ext.form.Checkbox.superclass.onRender.call(this,B,A);if(this.inputValue!==undefined){this.el.dom.value=this.inputValue}this.wrap=this.el.wrap({cls:"x-form-check-wrap"});if(this.boxLabel){this.wrap.createChild({tag:"label",htmlFor:this.el.id,cls:"x-form-cb-label",html:this.boxLabel})}if(this.checked){this.setValue(true)}else{this.checked=this.el.dom.checked}},onDestroy:function(){if(this.wrap){this.wrap.remove()}Ext.form.Checkbox.superclass.onDestroy.call(this)},initValue:Ext.emptyFn,getValue:function(){if(this.rendered){return this.el.dom.checked}return false},onClick:function(){if(this.el.dom.checked!=this.checked){this.setValue(this.el.dom.checked)}},setValue:function(A){this.checked=(A===true||A==="true"||A=="1"||String(A).toLowerCase()=="on");if(this.el&&this.el.dom){this.el.dom.checked=this.checked;this.el.dom.defaultChecked=this.checked}this.fireEvent("check",this,this.checked)}});Ext.reg("checkbox",Ext.form.Checkbox); +Ext.form.Radio=Ext.extend(Ext.form.Checkbox,{inputType:"radio",markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn,getGroupValue:function(){var A=this.el.up("form")||Ext.getBody();var B=A.child("input[name="+this.el.dom.name+"]:checked",true);return B?B.value:null},onClick:function(){if(this.el.dom.checked!=this.checked){var B=this.el.up("form")||Ext.getBody();var A=B.select("input[name="+this.el.dom.name+"]");A.each(function(C){if(C.dom.id==this.id){this.setValue(true)}else{Ext.getCmp(C.dom.id).setValue(false)}},this)}},setValue:function(A){if(typeof A=="boolean"){Ext.form.Radio.superclass.setValue.call(this,A)}else{var B=this.el.up("form").child("input[name="+this.el.dom.name+"][value="+A+"]",true);if(B){B.checked=true}}}});Ext.reg("radio",Ext.form.Radio); +Ext.form.Hidden=Ext.extend(Ext.form.Field,{inputType:"hidden",onRender:function(){Ext.form.Hidden.superclass.onRender.apply(this,arguments)},initEvents:function(){this.originalValue=this.getValue()},setSize:Ext.emptyFn,setWidth:Ext.emptyFn,setHeight:Ext.emptyFn,setPosition:Ext.emptyFn,setPagePosition:Ext.emptyFn,markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn});Ext.reg("hidden",Ext.form.Hidden); +Ext.form.BasicForm=function(B,A){Ext.apply(this,A);this.items=new Ext.util.MixedCollection(false,function(C){return C.id||(C.id=Ext.id())});this.addEvents("beforeaction","actionfailed","actioncomplete");if(B){this.initEl(B)}Ext.form.BasicForm.superclass.constructor.call(this)};Ext.extend(Ext.form.BasicForm,Ext.util.Observable,{timeout:30,activeAction:null,trackResetOnLoad:false,initEl:function(A){this.el=Ext.get(A);this.id=this.el.id||Ext.id();if(!this.standardSubmit){this.el.on("submit",this.onSubmit,this)}this.el.addClass("x-form")},getEl:function(){return this.el},onSubmit:function(A){A.stopEvent()},destroy:function(){this.items.each(function(A){Ext.destroy(A)});if(this.el){this.el.removeAllListeners();this.el.remove()}this.purgeListeners()},isValid:function(){var A=true;this.items.each(function(B){if(!B.validate()){A=false}});return A},isDirty:function(){var A=false;this.items.each(function(B){if(B.isDirty()){A=true;return false}});return A},doAction:function(B,A){if(typeof B=="string"){B=new Ext.form.Action.ACTION_TYPES[B](this,A)}if(this.fireEvent("beforeaction",this,B)!==false){this.beforeAction(B);B.run.defer(100,B)}return this},submit:function(B){if(this.standardSubmit){var A=this.isValid();if(A){this.el.dom.submit()}return A}this.doAction("submit",B);return this},load:function(A){this.doAction("load",A);return this},updateRecord:function(B){B.beginEdit();var A=B.fields;A.each(function(C){var D=this.findField(C.name);if(D){B.set(C.name,D.getValue())}},this);B.endEdit();return this},loadRecord:function(A){this.setValues(A.data);return this},beforeAction:function(A){var B=A.options;if(B.waitMsg){if(this.waitMsgTarget===true){this.el.mask(B.waitMsg,"x-mask-loading")}else{if(this.waitMsgTarget){this.waitMsgTarget=Ext.get(this.waitMsgTarget);this.waitMsgTarget.mask(B.waitMsg,"x-mask-loading")}else{Ext.MessageBox.wait(B.waitMsg,B.waitTitle||this.waitTitle||"Please Wait...")}}}},afterAction:function(A,C){this.activeAction=null;var B=A.options;if(B.waitMsg){if(this.waitMsgTarget===true){this.el.unmask()}else{if(this.waitMsgTarget){this.waitMsgTarget.unmask()}else{Ext.MessageBox.updateProgress(1);Ext.MessageBox.hide()}}}if(C){if(B.reset){this.reset()}Ext.callback(B.success,B.scope,[this,A]);this.fireEvent("actioncomplete",this,A)}else{Ext.callback(B.failure,B.scope,[this,A]);this.fireEvent("actionfailed",this,A)}},findField:function(B){var A=this.items.get(B);if(!A){this.items.each(function(C){if(C.isFormField&&(C.dataIndex==B||C.id==B||C.getName()==B)){A=C;return false}})}return A||null},markInvalid:function(G){if(Ext.isArray(G)){for(var C=0,A=G.length;C":">"),C,"")}return D.join("")},createToolbar:function(C){function B(F,D,E){return{itemId:F,cls:"x-btn-icon x-edit-"+F,enableToggle:D!==false,scope:C,handler:E||C.relayBtnCmd,clickEvent:"mousedown",tooltip:C.buttonTips[F]||undefined,tabIndex:-1}}var A=new Ext.Toolbar({renderTo:this.wrap.dom.firstChild});A.el.on("click",function(D){D.preventDefault()});if(this.enableFont&&!Ext.isSafari){this.fontSelect=A.el.createChild({tag:"select",cls:"x-font-select",html:this.createFontOptions()});this.fontSelect.on("change",function(){var D=this.fontSelect.dom.value;this.relayCmd("fontname",D);this.deferFocus()},this);A.add(this.fontSelect.dom,"-")}if(this.enableFormat){A.add(B("bold"),B("italic"),B("underline"))}if(this.enableFontSize){A.add("-",B("increasefontsize",false,this.adjustFont),B("decreasefontsize",false,this.adjustFont))}if(this.enableColors){A.add("-",{itemId:"forecolor",cls:"x-btn-icon x-edit-forecolor",clickEvent:"mousedown",tooltip:C.buttonTips["forecolor"]||undefined,tabIndex:-1,menu:new Ext.menu.ColorMenu({allowReselect:true,focus:Ext.emptyFn,value:"000000",plain:true,selectHandler:function(E,D){this.execCmd("forecolor",Ext.isSafari||Ext.isIE?"#"+D:D);this.deferFocus()},scope:this,clickEvent:"mousedown"})},{itemId:"backcolor",cls:"x-btn-icon x-edit-backcolor",clickEvent:"mousedown",tooltip:C.buttonTips["backcolor"]||undefined,tabIndex:-1,menu:new Ext.menu.ColorMenu({focus:Ext.emptyFn,value:"FFFFFF",plain:true,allowReselect:true,selectHandler:function(E,D){if(Ext.isGecko){this.execCmd("useCSS",false);this.execCmd("hilitecolor",D);this.execCmd("useCSS",true);this.deferFocus()}else{this.execCmd(Ext.isOpera?"hilitecolor":"backcolor",Ext.isSafari||Ext.isIE?"#"+D:D);this.deferFocus()}},scope:this,clickEvent:"mousedown"})})}if(this.enableAlignments){A.add("-",B("justifyleft"),B("justifycenter"),B("justifyright"))}if(!Ext.isSafari){if(this.enableLinks){A.add("-",B("createlink",false,this.createLink))}if(this.enableLists){A.add("-",B("insertorderedlist"),B("insertunorderedlist"))}if(this.enableSourceEdit){A.add("-",B("sourceedit",true,function(D){this.toggleSourceEdit(D.pressed)}))}}this.tb=A},getDocMarkup:function(){return""},getEditorBody:function(){return this.doc.body||this.doc.documentElement},onRender:function(C,A){Ext.form.HtmlEditor.superclass.onRender.call(this,C,A);this.el.dom.style.border="0 none";this.el.dom.setAttribute("tabIndex",-1);this.el.addClass("x-hidden");if(Ext.isIE){this.el.applyStyles("margin-top:-1px;margin-bottom:-1px;")}this.wrap=this.el.wrap({cls:"x-html-editor-wrap",cn:{cls:"x-html-editor-tb"}});this.createToolbar(this);this.tb.items.each(function(E){if(E.itemId!="sourceedit"){E.disable()}});var D=document.createElement("iframe");D.name=Ext.id();D.frameBorder="no";D.src=(Ext.SSL_SECURE_URL||"javascript:false");this.wrap.dom.appendChild(D);this.iframe=D;if(Ext.isIE){D.contentWindow.document.designMode="on";this.doc=D.contentWindow.document;this.win=D.contentWindow}else{this.doc=(D.contentDocument||window.frames[D.name].document);this.win=window.frames[D.name];this.doc.designMode="on"}this.doc.open();this.doc.write(this.getDocMarkup());this.doc.close();var B={run:function(){if(this.doc.body||this.doc.readyState=="complete"){Ext.TaskMgr.stop(B);this.doc.designMode="on";this.initEditor.defer(10,this)}},interval:10,duration:10000,scope:this};Ext.TaskMgr.start(B);if(!this.width){this.setSize(this.el.getSize())}},onResize:function(B,C){Ext.form.HtmlEditor.superclass.onResize.apply(this,arguments);if(this.el&&this.iframe){if(typeof B=="number"){var D=B-this.wrap.getFrameWidth("lr");this.el.setWidth(this.adjustWidth("textarea",D));this.iframe.style.width=D+"px"}if(typeof C=="number"){var A=C-this.wrap.getFrameWidth("tb")-this.tb.el.getHeight();this.el.setHeight(this.adjustWidth("textarea",A));this.iframe.style.height=A+"px";if(this.doc){this.getEditorBody().style.height=(A-(this.iframePad*2))+"px"}}}},toggleSourceEdit:function(A){if(A===undefined){A=!this.sourceEditMode}this.sourceEditMode=A===true;var C=this.tb.items.get("sourceedit");if(C.pressed!==this.sourceEditMode){C.toggle(this.sourceEditMode);return }if(this.sourceEditMode){this.tb.items.each(function(D){if(D.itemId!="sourceedit"){D.disable()}});this.syncValue();this.iframe.className="x-hidden";this.el.removeClass("x-hidden");this.el.dom.removeAttribute("tabIndex");this.el.focus()}else{if(this.initialized){this.tb.items.each(function(D){D.enable()})}this.pushValue();this.iframe.className="";this.el.addClass("x-hidden");this.el.dom.setAttribute("tabIndex",-1);this.deferFocus()}var B=this.lastSize;if(B){delete this.lastSize;this.setSize(B)}this.fireEvent("editmodechange",this,this.sourceEditMode)},createLink:function(){var A=prompt(this.createLinkText,this.defaultLinkValue);if(A&&A!="http:/"+"/"){this.relayCmd("createlink",A)}},adjustSize:Ext.BoxComponent.prototype.adjustSize,getResizeEl:function(){return this.wrap},getPositionEl:function(){return this.wrap},initEvents:function(){this.originalValue=this.getValue()},markInvalid:Ext.emptyFn,clearInvalid:Ext.emptyFn,setValue:function(A){Ext.form.HtmlEditor.superclass.setValue.call(this,A);this.pushValue()},cleanHtml:function(A){A=String(A);if(A.length>5){if(Ext.isSafari){A=A.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi,"")}}if(A==" "){A=""}return A},syncValue:function(){if(this.initialized){var D=this.getEditorBody();var C=D.innerHTML;if(Ext.isSafari){var B=D.getAttribute("style");var A=B.match(/text-align:(.*?);/i);if(A&&A[1]){C="
    "+C+"
    "}}C=this.cleanHtml(C);if(this.fireEvent("beforesync",this,C)!==false){this.el.dom.value=C;this.fireEvent("sync",this,C)}}},pushValue:function(){if(this.initialized){var A=this.el.dom.value;if(!this.activated&&A.length<1){A=" "}if(this.fireEvent("beforepush",this,A)!==false){this.getEditorBody().innerHTML=A;this.fireEvent("push",this,A)}}},deferFocus:function(){this.focus.defer(10,this)},focus:function(){if(this.win&&!this.sourceEditMode){this.win.focus()}else{this.el.focus()}},initEditor:function(){var B=this.getEditorBody();var A=this.el.getStyles("font-size","font-family","background-image","background-repeat");A["background-attachment"]="fixed";B.bgProperties="fixed";Ext.DomHelper.applyStyles(B,A);Ext.EventManager.on(this.doc,{"mousedown":this.onEditorEvent,"dblclick":this.onEditorEvent,"click":this.onEditorEvent,"keyup":this.onEditorEvent,buffer:100,scope:this});if(Ext.isGecko){Ext.EventManager.on(this.doc,"keypress",this.applyCommand,this)}if(Ext.isIE||Ext.isSafari||Ext.isOpera){Ext.EventManager.on(this.doc,"keydown",this.fixKeys,this)}this.initialized=true;this.fireEvent("initialize",this);this.pushValue()},onDestroy:function(){if(this.rendered){this.tb.items.each(function(A){if(A.menu){A.menu.removeAll();if(A.menu.el){A.menu.el.destroy()}}A.destroy()});this.wrap.dom.innerHTML="";this.wrap.remove()}},onFirstFocus:function(){this.activated=true;this.tb.items.each(function(D){D.enable()});if(Ext.isGecko){this.win.focus();var A=this.win.getSelection();if(!A.focusNode||A.focusNode.nodeType!=3){var B=A.getRangeAt(0);B.selectNodeContents(this.getEditorBody());B.collapse(true);this.deferFocus()}try{this.execCmd("useCSS",true);this.execCmd("styleWithCSS",false)}catch(C){}}this.fireEvent("activate",this)},adjustFont:function(B){var C=B.itemId=="increasefontsize"?1:-1;var A=parseInt(this.doc.queryCommandValue("FontSize")||2,10);if(Ext.isSafari3||Ext.isAir){if(A<=10){A=1+C}else{if(A<=13){A=2+C}else{if(A<=16){A=3+C}else{if(A<=18){A=4+C}else{if(A<=24){A=5+C}else{A=6+C}}}}}A=A.constrain(1,6)}else{if(Ext.isSafari){C*=2}A=Math.max(1,A+C)+(Ext.isSafari?"px":0)}this.execCmd("FontSize",A)},onEditorEvent:function(A){this.updateToolbar()},updateToolbar:function(){if(!this.activated){this.onFirstFocus();return }var B=this.tb.items.map,C=this.doc;if(this.enableFont&&!Ext.isSafari){var A=(this.doc.queryCommandValue("FontName")||this.defaultFont).toLowerCase();if(A!=this.fontSelect.dom.value){this.fontSelect.dom.value=A}}if(this.enableFormat){B.bold.toggle(C.queryCommandState("bold"));B.italic.toggle(C.queryCommandState("italic"));B.underline.toggle(C.queryCommandState("underline"))}if(this.enableAlignments){B.justifyleft.toggle(C.queryCommandState("justifyleft"));B.justifycenter.toggle(C.queryCommandState("justifycenter"));B.justifyright.toggle(C.queryCommandState("justifyright"))}if(!Ext.isSafari&&this.enableLists){B.insertorderedlist.toggle(C.queryCommandState("insertorderedlist"));B.insertunorderedlist.toggle(C.queryCommandState("insertunorderedlist"))}Ext.menu.MenuMgr.hideAll();this.syncValue()},relayBtnCmd:function(A){this.relayCmd(A.itemId)},relayCmd:function(B,A){this.win.focus();this.execCmd(B,A);this.updateToolbar();this.deferFocus()},execCmd:function(B,A){this.doc.execCommand(B,false,A===undefined?null:A);this.syncValue()},applyCommand:function(B){if(B.ctrlKey){var C=B.getCharCode(),A;if(C>0){C=String.fromCharCode(C);switch(C){case"b":A="bold";break;case"i":A="italic";break;case"u":A="underline";break}if(A){this.win.focus();this.execCmd(A);this.deferFocus();B.preventDefault()}}}},insertAtCursor:function(B){if(!this.activated){return }if(Ext.isIE){this.win.focus();var A=this.doc.selection.createRange();if(A){A.collapse(true);A.pasteHTML(B);this.syncValue();this.deferFocus()}}else{if(Ext.isGecko||Ext.isOpera){this.win.focus();this.execCmd("InsertHTML",B);this.deferFocus()}else{if(Ext.isSafari){this.execCmd("InsertText",B);this.deferFocus()}}}},fixKeys:function(){if(Ext.isIE){return function(D){var A=D.getKey(),B;if(A==D.TAB){D.stopEvent();B=this.doc.selection.createRange();if(B){B.collapse(true);B.pasteHTML("    ");this.deferFocus()}}else{if(A==D.ENTER){B=this.doc.selection.createRange();if(B){var C=B.parentElement();if(!C||C.tagName.toLowerCase()!="li"){D.stopEvent();B.pasteHTML("
    ");B.collapse(false);B.select()}}}}}}else{if(Ext.isOpera){return function(B){var A=B.getKey();if(A==B.TAB){B.stopEvent();this.win.focus();this.execCmd("InsertHTML","    ");this.deferFocus()}}}else{if(Ext.isSafari){return function(B){var A=B.getKey();if(A==B.TAB){B.stopEvent();this.execCmd("InsertText","\t");this.deferFocus()}}}}}}(),getToolbar:function(){return this.tb},buttonTips:{bold:{title:"Bold (Ctrl+B)",text:"Make the selected text bold.",cls:"x-html-editor-tip"},italic:{title:"Italic (Ctrl+I)",text:"Make the selected text italic.",cls:"x-html-editor-tip"},underline:{title:"Underline (Ctrl+U)",text:"Underline the selected text.",cls:"x-html-editor-tip"},increasefontsize:{title:"Grow Text",text:"Increase the font size.",cls:"x-html-editor-tip"},decreasefontsize:{title:"Shrink Text",text:"Decrease the font size.",cls:"x-html-editor-tip"},backcolor:{title:"Text Highlight Color",text:"Change the background color of the selected text.",cls:"x-html-editor-tip"},forecolor:{title:"Font Color",text:"Change the color of the selected text.",cls:"x-html-editor-tip"},justifyleft:{title:"Align Text Left",text:"Align text to the left.",cls:"x-html-editor-tip"},justifycenter:{title:"Center Text",text:"Center text in the editor.",cls:"x-html-editor-tip"},justifyright:{title:"Align Text Right",text:"Align text to the right.",cls:"x-html-editor-tip"},insertunorderedlist:{title:"Bullet List",text:"Start a bulleted list.",cls:"x-html-editor-tip"},insertorderedlist:{title:"Numbered List",text:"Start a numbered list.",cls:"x-html-editor-tip"},createlink:{title:"Hyperlink",text:"Make the selected text a hyperlink.",cls:"x-html-editor-tip"},sourceedit:{title:"Source Edit",text:"Switch to source editing mode.",cls:"x-html-editor-tip"}}});Ext.reg("htmleditor",Ext.form.HtmlEditor); +Ext.form.TimeField=Ext.extend(Ext.form.ComboBox,{minValue:null,maxValue:null,minText:"The time in this field must be equal to or after {0}",maxText:"The time in this field must be equal to or before {0}",invalidText:"{0} is not a valid time",format:"g:i A",altFormats:"g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|ha|gA|h a|g a|g A|gi|hi|gia|hia|g|H",increment:15,mode:"local",triggerAction:"all",typeAhead:false,initComponent:function(){Ext.form.TimeField.superclass.initComponent.call(this);if(typeof this.minValue=="string"){this.minValue=this.parseDate(this.minValue)}if(typeof this.maxValue=="string"){this.maxValue=this.parseDate(this.maxValue)}if(!this.store){var B=this.parseDate(this.minValue);if(!B){B=new Date().clearTime()}var A=this.parseDate(this.maxValue);if(!A){A=new Date().clearTime().add("mi",(24*60)-1)}var C=[];while(B<=A){C.push([B.dateFormat(this.format)]);B=B.add("mi",this.increment)}this.store=new Ext.data.SimpleStore({fields:["text"],data:C});this.displayField="text"}},getValue:function(){var A=Ext.form.TimeField.superclass.getValue.call(this);return this.formatDate(this.parseDate(A))||""},setValue:function(A){Ext.form.TimeField.superclass.setValue.call(this,this.formatDate(this.parseDate(A)))},validateValue:Ext.form.DateField.prototype.validateValue,parseDate:Ext.form.DateField.prototype.parseDate,formatDate:Ext.form.DateField.prototype.formatDate,beforeBlur:function(){var A=this.parseDate(this.getRawValue());if(A){this.setValue(A.dateFormat(this.format))}}});Ext.reg("timefield",Ext.form.TimeField); +Ext.form.Label=Ext.extend(Ext.BoxComponent,{onRender:function(B,A){if(!this.el){this.el=document.createElement("label");this.el.innerHTML=this.text?Ext.util.Format.htmlEncode(this.text):(this.html||"");if(this.forId){this.el.setAttribute("htmlFor",this.forId)}}Ext.form.Label.superclass.onRender.call(this,B,A)}});Ext.reg("label",Ext.form.Label); +Ext.form.Action=function(B,A){this.form=B;this.options=A||{}};Ext.form.Action.CLIENT_INVALID="client";Ext.form.Action.SERVER_INVALID="server";Ext.form.Action.CONNECT_FAILURE="connect";Ext.form.Action.LOAD_FAILURE="load";Ext.form.Action.prototype={type:"default",run:function(A){},success:function(A){},handleResponse:function(A){},failure:function(A){this.response=A;this.failureType=Ext.form.Action.CONNECT_FAILURE;this.form.afterAction(this,false)},processResponse:function(A){this.response=A;if(!A.responseText){return true}this.result=this.handleResponse(A);return this.result},getUrl:function(C){var A=this.options.url||this.form.url||this.form.el.dom.action;if(C){var B=this.getParams();if(B){A+=(A.indexOf("?")!=-1?"&":"?")+B}}return A},getMethod:function(){return(this.options.method||this.form.method||this.form.el.dom.method||"POST").toUpperCase()},getParams:function(){var A=this.form.baseParams;var B=this.options.params;if(B){if(typeof B=="object"){B=Ext.urlEncode(Ext.applyIf(B,A))}else{if(typeof B=="string"&&A){B+="&"+Ext.urlEncode(A)}}}else{if(A){B=Ext.urlEncode(A)}}return B},createCallback:function(A){var A=A||{};return{success:this.success,failure:this.failure,scope:this,timeout:(A.timeout*1000)||(this.form.timeout*1000),upload:this.form.fileUpload?this.success:undefined}}};Ext.form.Action.Submit=function(B,A){Ext.form.Action.Submit.superclass.constructor.call(this,B,A)};Ext.extend(Ext.form.Action.Submit,Ext.form.Action,{type:"submit",run:function(){var B=this.options;var C=this.getMethod();var A=C=="POST";if(B.clientValidation===false||this.form.isValid()){Ext.Ajax.request(Ext.apply(this.createCallback(B),{form:this.form.el.dom,url:this.getUrl(!A),method:C,params:A?this.getParams():null,isUpload:this.form.fileUpload}))}else{if(B.clientValidation!==false){this.failureType=Ext.form.Action.CLIENT_INVALID;this.form.afterAction(this,false)}}},success:function(B){var A=this.processResponse(B);if(A===true||A.success){this.form.afterAction(this,true);return }if(A.errors){this.form.markInvalid(A.errors);this.failureType=Ext.form.Action.SERVER_INVALID}this.form.afterAction(this,false)},handleResponse:function(C){if(this.form.errorReader){var B=this.form.errorReader.read(C);var F=[];if(B.records){for(var D=0,A=B.records.length;D=0){if(!D){C=F-1}D=false;while(C>=0){if(E.call(I||this,J,C,H)===true){return[J,C]}C--}J--}}else{if(C>=F){J++;D=false}while(J","
    ","
    {header}
    ","
    {body}
    ","
    ","
     
    ","
     
    ","")}if(!C.header){C.header=new Ext.Template("","{cells}","
    ")}if(!C.hcell){C.hcell=new Ext.Template("
    ",this.grid.enableHdMenu?"":"","{value}","
    ")}if(!C.body){C.body=new Ext.Template("{rows}")}if(!C.row){C.row=new Ext.Template("
    ","{cells}",(this.enableRowBody?"":""),"
    {body}
    ")}if(!C.cell){C.cell=new Ext.Template("","
    {value}
    ","")}for(var A in C){var B=C[A];if(B&&typeof B.compile=="function"&&!B.compiled){B.disableFormats=true;B.compile()}}this.templates=C;this.tdClass="x-grid3-cell";this.cellSelector="td.x-grid3-cell";this.hdCls="x-grid3-hd";this.rowSelector="div.x-grid3-row";this.colRe=new RegExp("x-grid3-td-([^\\s]+)","")},fly:function(A){if(!this._flyweight){this._flyweight=new Ext.Element.Flyweight(document.body)}this._flyweight.dom=A;return this._flyweight},getEditorParent:function(A){return this.scroller.dom},initElements:function(){var C=Ext.Element;var B=this.grid.getGridEl().dom.firstChild;var A=B.childNodes;this.el=new C(B);this.mainWrap=new C(A[0]);this.mainHd=new C(this.mainWrap.dom.firstChild);if(this.grid.hideHeaders){this.mainHd.setDisplayed(false)}this.innerHd=this.mainHd.dom.firstChild;this.scroller=new C(this.mainWrap.dom.childNodes[1]);if(this.forceFit){this.scroller.setStyle("overflow-x","hidden")}this.mainBody=new C(this.scroller.dom.firstChild);this.focusEl=new C(this.scroller.dom.childNodes[1]);this.focusEl.swallowEvent("click",true);this.resizeMarker=new C(A[1]);this.resizeProxy=new C(A[2])},getRows:function(){return this.hasRows()?this.mainBody.dom.childNodes:[]},findCell:function(A){if(!A){return false}return this.fly(A).findParent(this.cellSelector,3)},findCellIndex:function(C,B){var A=this.findCell(C);if(A&&(!B||this.fly(A).hasClass(B))){return this.getCellIndex(A)}return false},getCellIndex:function(B){if(B){var A=B.className.match(this.colRe);if(A&&A[1]){return this.cm.getIndexById(A[1])}}return false},findHeaderCell:function(B){var A=this.findCell(B);return A&&this.fly(A).hasClass(this.hdCls)?A:null},findHeaderIndex:function(A){return this.findCellIndex(A,this.hdCls)},findRow:function(A){if(!A){return false}return this.fly(A).findParent(this.rowSelector,10)},findRowIndex:function(A){var B=this.findRow(A);return B?B.rowIndex:false},getRow:function(A){return this.getRows()[A]},getCell:function(B,A){return this.getRow(B).getElementsByTagName("td")[A]},getHeaderCell:function(A){return this.mainHd.dom.getElementsByTagName("td")[A]},addRowClass:function(C,A){var B=this.getRow(C);if(B){this.fly(B).addClass(A)}},removeRowClass:function(C,A){var B=this.getRow(C);if(B){this.fly(B).removeClass(A)}},removeRow:function(A){Ext.removeNode(this.getRow(A))},removeRows:function(C,A){var B=this.mainBody.dom;for(var D=C;D<=A;D++){Ext.removeNode(B.childNodes[C])}},getScrollState:function(){var A=this.scroller.dom;return{left:A.scrollLeft,top:A.scrollTop}},restoreScroll:function(A){var B=this.scroller.dom;B.scrollLeft=A.left;B.scrollTop=A.top},scrollToTop:function(){this.scroller.dom.scrollTop=0;this.scroller.dom.scrollLeft=0},syncScroll:function(){this.syncHeaderScroll();var A=this.scroller.dom;this.grid.fireEvent("bodyscroll",A.scrollLeft,A.scrollTop)},syncHeaderScroll:function(){var A=this.scroller.dom;this.innerHd.scrollLeft=A.scrollLeft;this.innerHd.scrollLeft=A.scrollLeft},updateSortIcon:function(B,A){var D=this.sortClasses;var C=this.mainHd.select("td").removeClass(D);C.item(B).addClass(D[A=="DESC"?1:0])},updateAllColumnWidths:function(){var D=this.getTotalWidth();var H=this.cm.getColumnCount();var F=[];for(var B=0;B=this.ds.getCount()){return }E=(E!==undefined?E:0);var I=this.getRow(P),F;if(!(D===false&&E===0)){while(this.cm.isHidden(E)){E++}F=this.getCell(P,E)}if(!I){return }var L=this.scroller.dom;var O=0;var C=I,M=this.el.dom;while(C&&C!=M){O+=C.offsetTop;C=C.offsetParent}O-=this.mainHd.dom.offsetHeight;var N=O+I.offsetHeight;var A=L.clientHeight;var M=parseInt(L.scrollTop,10);var K=M+A;if(OK){L.scrollTop=N-A}}if(D!==false){var J=parseInt(F.offsetLeft,10);var H=J+F.offsetWidth;var G=parseInt(L.scrollLeft,10);var B=G+L.clientWidth;if(JB){L.scrollLeft=H-L.clientWidth}}}return F?Ext.fly(F).getXY():[L.scrollLeft,Ext.fly(I).getY()]},insertRows:function(A,F,C,E){if(!E&&F===0&&C==A.getCount()-1){this.refresh()}else{if(!E){this.fireEvent("beforerowsinserted",this,F,C)}var B=this.renderRows(F,C);var D=this.getRow(F);if(D){Ext.DomHelper.insertHtml("beforeBegin",D,B)}else{Ext.DomHelper.insertHtml("beforeEnd",this.mainBody.dom,B)}if(!E){this.fireEvent("rowsinserted",this,F,C);this.processRows(F)}}},deleteRows:function(A,C,B){if(A.getRowCount()<1){this.refresh()}else{this.fireEvent("beforerowsdeleted",this,C,B);this.removeRows(C,B);this.processRows(C);this.fireEvent("rowsdeleted",this,C,B)}},getColumnStyle:function(A,C){var B=!C?(this.cm.config[A].css||""):"";B+="width:"+this.getColumnWidth(A)+";";if(this.cm.isHidden(A)){B+="display:none;"}var D=this.cm.config[A].align;if(D){B+="text-align:"+D+";"}return B},getColumnWidth:function(B){var A=this.cm.getColumnWidth(B);if(typeof A=="number"){return(Ext.isBorderBox?A:(A-this.borderWidth>0?A-this.borderWidth:0))+"px"}return A},getTotalWidth:function(){return this.cm.getTotalWidth()+"px"},fitColumns:function(D,G,E){var F=this.cm,S,L,O;var R=F.getTotalWidth(false);var J=this.grid.getGridEl().getWidth(true)-this.scrollOffset;if(J<20){return }var B=J-R;if(B===0){return false}var A=F.getColumnCount(true);var P=A-(typeof E=="number"?1:0);if(P===0){P=1;E=undefined}var K=F.getColumnCount();var I=[];var N=0;var M=0;var H;for(O=0;OJ){var Q=P!=A?E:N;F.setColumnWidth(Q,Math.max(1,F.getColumnWidth(Q)-(R-J)),true)}if(D!==true){this.updateAllColumnWidths()}return true},autoExpand:function(B){var G=this.grid,A=this.cm;if(!this.userResized&&G.autoExpandColumn){var D=A.getTotalWidth(false);var H=this.grid.getGridEl().getWidth(true)-this.scrollOffset;if(D!=H){var F=A.getIndexById(G.autoExpandColumn);var E=A.getColumnWidth(F);var C=Math.min(Math.max(((H-D)+E),G.autoExpandMin),G.autoExpandMax);if(C!=E){A.setColumnWidth(F,C,true);if(B!==true){this.updateColumnWidth(F,C)}}}}},getColumnData:function(){var D=[],A=this.cm,E=A.getColumnCount();for(var C=0;C"+this.emptyText+"")}},updateHeaderSortState:function(){var B=this.ds.getSortState();if(!B){return }if(!this.sortState||(this.sortState.field!=B.field||this.sortState.direction!=B.direction)){this.grid.fireEvent("sortchange",this.grid,B)}this.sortState=B;var C=this.cm.findColumnIndex(B.field);if(C!=-1){var A=B.direction;this.updateSortIcon(C,A)}},destroy:function(){if(this.colMenu){this.colMenu.removeAll();Ext.menu.MenuMgr.unregister(this.colMenu);this.colMenu.getEl().remove();delete this.colMenu}if(this.hmenu){this.hmenu.removeAll();Ext.menu.MenuMgr.unregister(this.hmenu);this.hmenu.getEl().remove();delete this.hmenu}if(this.grid.enableColumnMove){var C=Ext.dd.DDM.ids["gridHeader"+this.grid.getGridEl().id];if(C){for(var A in C){if(!C[A].config.isTarget&&C[A].dragElId){var B=C[A].dragElId;C[A].unreg();Ext.get(B).remove()}else{if(C[A].config.isTarget){C[A].proxyTop.remove();C[A].proxyBottom.remove();C[A].unreg()}}if(Ext.dd.DDM.locationCache[A]){delete Ext.dd.DDM.locationCache[A]}}delete Ext.dd.DDM.ids["gridHeader"+this.grid.getGridEl().id]}}Ext.destroy(this.resizeMarker,this.resizeProxy);this.initData(null,null);Ext.EventManager.removeResizeListener(this.onWindowResize,this)},onDenyColumnHide:function(){},render:function(){var A=this.cm;var B=A.getColumnCount();if(this.autoFill){this.fitColumns(true,true)}else{if(this.forceFit){this.fitColumns(true,false)}else{if(this.grid.autoExpandColumn){this.autoExpand(true)}}}this.renderUI()},initData:function(B,A){if(this.ds){this.ds.un("load",this.onLoad,this);this.ds.un("datachanged",this.onDataChange,this);this.ds.un("add",this.onAdd,this);this.ds.un("remove",this.onRemove,this);this.ds.un("update",this.onUpdate,this);this.ds.un("clear",this.onClear,this)}if(B){B.on("load",this.onLoad,this);B.on("datachanged",this.onDataChange,this);B.on("add",this.onAdd,this);B.on("remove",this.onRemove,this);B.on("update",this.onUpdate,this);B.on("clear",this.onClear,this)}this.ds=B;if(this.cm){this.cm.un("configchange",this.onColConfigChange,this);this.cm.un("widthchange",this.onColWidthChange,this);this.cm.un("headerchange",this.onHeaderChange,this);this.cm.un("hiddenchange",this.onHiddenChange,this);this.cm.un("columnmoved",this.onColumnMove,this);this.cm.un("columnlockchange",this.onColumnLock,this)}if(A){A.on("configchange",this.onColConfigChange,this);A.on("widthchange",this.onColWidthChange,this);A.on("headerchange",this.onHeaderChange,this);A.on("hiddenchange",this.onHiddenChange,this);A.on("columnmoved",this.onColumnMove,this);A.on("columnlockchange",this.onColumnLock,this)}this.cm=A},onDataChange:function(){this.refresh();this.updateHeaderSortState()},onClear:function(){this.refresh()},onUpdate:function(B,A){this.refreshRow(A)},onAdd:function(C,A,B){this.insertRows(C,B,B+(A.length-1))},onRemove:function(D,A,B,C){if(C!==true){this.fireEvent("beforerowremoved",this,B,A)}this.removeRow(B);if(C!==true){this.processRows(B);this.applyEmptyText();this.fireEvent("rowremoved",this,B,A)}},onLoad:function(){this.scrollToTop()},onColWidthChange:function(A,B,C){this.updateColumnWidth(B,C)},onHeaderChange:function(A,B,C){this.updateHeaders()},onHiddenChange:function(A,B,C){this.updateColumnHidden(B,C)},onColumnMove:function(A,D,B){this.indexMap=null;var C=this.getScrollState();this.refresh(true);this.restoreScroll(C);this.afterMove(B)},onColConfigChange:function(){delete this.lastViewWidth;this.indexMap=null;this.refresh(true)},initUI:function(A){A.on("headerclick",this.onHeaderClick,this);if(A.trackMouseOver){A.on("mouseover",this.onRowOver,this);A.on("mouseout",this.onRowOut,this)}},initEvents:function(){},onHeaderClick:function(B,A){if(this.headersDisabled||!this.cm.isSortable(A)){return }B.stopEditing(true);B.store.sort(this.cm.getDataIndex(A))},onRowOver:function(B,A){var C;if((C=this.findRowIndex(A))!==false){this.addRowClass(C,"x-grid3-row-over")}},onRowOut:function(B,A){var C;if((C=this.findRowIndex(A))!==false&&C!==this.findRowIndex(B.getRelatedTarget())){this.removeRowClass(C,"x-grid3-row-over")}},handleWheel:function(A){A.stopPropagation()},onRowSelect:function(A){this.addRowClass(A,"x-grid3-row-selected")},onRowDeselect:function(A){this.removeRowClass(A,"x-grid3-row-selected")},onCellSelect:function(C,B){var A=this.getCell(C,B);if(A){this.fly(A).addClass("x-grid3-cell-selected")}},onCellDeselect:function(C,B){var A=this.getCell(C,B);if(A){this.fly(A).removeClass("x-grid3-cell-selected")}},onColumnSplitterMoved:function(C,B){this.userResized=true;var A=this.grid.colModel;A.setColumnWidth(C,B,true);if(this.forceFit){this.fitColumns(true,false,C);this.updateAllColumnWidths()}else{this.updateColumnWidth(C,B)}this.grid.fireEvent("columnresize",C,B)},handleHdMenuClick:function(C){var B=this.hdCtxIndex;var A=this.cm,D=this.ds;switch(C.id){case"asc":D.sort(A.getDataIndex(B),"ASC");break;case"desc":D.sort(A.getDataIndex(B),"DESC");break;default:B=A.getIndexById(C.id.substr(4));if(B!=-1){if(C.checked&&A.getColumnsBy(this.isHideableColumn,this).length<=1){this.onDenyColumnHide();return false}A.setHidden(B,C.checked)}}return true},isHideableColumn:function(A){return !A.hidden&&!A.fixed},beforeColMenuShow:function(){var A=this.cm,C=A.getColumnCount();this.colMenu.removeAll();for(var B=0;B","
    ",this.groupTextTpl,"
    ","
    ")}this.startGroup.compile();this.endGroup="
    "},findGroup:function(A){return Ext.fly(A).up(".x-grid-group",this.mainBody.dom)},getGroups:function(){return this.hasRows()?this.mainBody.dom.childNodes:[]},onAdd:function(){if(this.enableGrouping&&!this.ignoreAdd){var A=this.getScrollState();this.refresh();this.restoreScroll(A)}else{if(!this.enableGrouping){Ext.grid.GroupingView.superclass.onAdd.apply(this,arguments)}}},onRemove:function(E,A,B,D){Ext.grid.GroupingView.superclass.onRemove.apply(this,arguments);var C=document.getElementById(A._groupId);if(C&&C.childNodes[1].childNodes.length<1){Ext.removeNode(C)}this.applyEmptyText()},refreshRow:function(A){if(this.ds.getCount()==1){this.refresh()}else{this.isUpdating=true;Ext.grid.GroupingView.superclass.refreshRow.apply(this,arguments);this.isUpdating=false}},beforeMenuShow:function(){var C=this.getGroupField();var B=this.hmenu.items.get("groupBy");if(B){B.setDisabled(this.cm.config[this.hdCtxIndex].groupable===false)}var A=this.hmenu.items.get("showGroups");if(A){if(!!C){A.setDisabled(this.cm.config[this.hdCtxIndex].groupable===false)}A.setChecked(!!C)}},renderUI:function(){Ext.grid.GroupingView.superclass.renderUI.call(this);this.mainBody.on("mousedown",this.interceptMouse,this);if(this.enableGroupingMenu&&this.hmenu){this.hmenu.add("-",{id:"groupBy",text:this.groupByText,handler:this.onGroupByClick,scope:this,iconCls:"x-group-by-icon"});if(this.enableNoGroups){this.hmenu.add({id:"showGroups",text:this.showGroupsText,checked:true,checkHandler:this.onShowGroupsClick,scope:this})}this.hmenu.on("beforeshow",this.beforeMenuShow,this)}},onGroupByClick:function(){this.grid.store.groupBy(this.cm.getDataIndex(this.hdCtxIndex));this.beforeMenuShow()},onShowGroupsClick:function(A,B){if(B){this.onGroupByClick()}else{this.grid.store.clearGrouping()}},toggleGroup:function(C,B){this.grid.stopEditing(true);C=Ext.getDom(C);var A=Ext.fly(C);B=B!==undefined?B:A.hasClass("x-grid-group-collapsed");this.state[A.dom.id]=B;A[B?"removeClass":"addClass"]("x-grid-group-collapsed")},toggleAllGroups:function(C){var B=this.getGroups();for(var D=0,A=B.length;D=0&&this.config[A].resizable!==false&&this.config[A].fixed!==true},setHidden:function(A,B){var C=this.config[A];if(C.hidden!==B){C.hidden=B;this.totalWidth=null;this.fireEvent("hiddenchange",this,A,B)}},setEditor:function(A,B){this.config[A].editor=B}});Ext.grid.ColumnModel.defaultRenderer=function(A){if(typeof A=="string"&&A.length<1){return" "}return A};Ext.grid.DefaultColumnModel=Ext.grid.ColumnModel; +Ext.grid.AbstractSelectionModel=function(){this.locked=false;Ext.grid.AbstractSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.grid.AbstractSelectionModel,Ext.util.Observable,{init:function(A){this.grid=A;this.initEvents()},lock:function(){this.locked=true},unlock:function(){this.locked=false},isLocked:function(){return this.locked}}); +Ext.grid.RowSelectionModel=function(A){Ext.apply(this,A);this.selections=new Ext.util.MixedCollection(false,function(B){return B.id});this.last=false;this.lastActive=false;this.addEvents("selectionchange","beforerowselect","rowselect","rowdeselect");Ext.grid.RowSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.grid.RowSelectionModel,Ext.grid.AbstractSelectionModel,{singleSelect:false,initEvents:function(){if(!this.grid.enableDragDrop&&!this.grid.enableDrag){this.grid.on("rowmousedown",this.handleMouseDown,this)}else{this.grid.on("rowclick",function(B,D,C){if(C.button===0&&!C.shiftKey&&!C.ctrlKey){this.selectRow(D,false);B.view.focusRow(D)}},this)}this.rowNav=new Ext.KeyNav(this.grid.getGridEl(),{"up":function(C){if(!C.shiftKey){this.selectPrevious(C.shiftKey)}else{if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive-1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B}}else{this.selectFirstRow()}}},"down":function(C){if(!C.shiftKey){this.selectNext(C.shiftKey)}else{if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive+1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B}}else{this.selectFirstRow()}}},scope:this});var A=this.grid.view;A.on("refresh",this.onRefresh,this);A.on("rowupdated",this.onRowUpdated,this);A.on("rowremoved",this.onRemove,this)},onRefresh:function(){var F=this.grid.store,B;var D=this.getSelections();this.clearSelections(true);for(var C=0,A=D.length;C0},isSelected:function(A){var B=typeof A=="number"?this.grid.store.getAt(A):A;return(B&&this.selections.key(B.id)?true:false)},isIdSelected:function(A){return(this.selections.key(A)?true:false)},handleMouseDown:function(D,F,E){if(E.button!==0||this.isLocked()){return }var A=this.grid.getView();if(E.shiftKey&&this.last!==false){var C=this.last;this.selectRange(C,F,E.ctrlKey);this.last=C;A.focusRow(F)}else{var B=this.isSelected(F);if(E.ctrlKey&&B){this.deselectRow(F)}else{if(!B||this.getCount()>1){this.selectRow(F,E.ctrlKey||E.shiftKey);A.focusRow(F)}}}},selectRows:function(C,D){if(!D){this.clearSelections()}for(var B=0,A=C.length;B=A;C--){this.selectRow(C,true)}}},deselectRange:function(C,B,A){if(this.locked){return }for(var D=C;D<=B;D++){this.deselectRow(D,A)}},selectRow:function(B,D,A){if(this.locked||(B<0||B>=this.grid.store.getCount())){return }var C=this.grid.store.getAt(B);if(C&&this.fireEvent("beforerowselect",this,B,D,C)!==false){if(!D||this.singleSelect){this.clearSelections()}this.selections.add(C);this.last=this.lastActive=B;if(!A){this.grid.getView().onRowSelect(B)}this.fireEvent("rowselect",this,B,C);this.fireEvent("selectionchange",this)}},deselectRow:function(B,A){if(this.locked){return }if(this.last==B){this.last=false}if(this.lastActive==B){this.lastActive=false}var C=this.grid.store.getAt(B);if(C){this.selections.remove(C);if(!A){this.grid.getView().onRowDeselect(B)}this.fireEvent("rowdeselect",this,B,C);this.fireEvent("selectionchange",this)}},restoreLast:function(){if(this._last){this.last=this._last}},acceptsNav:function(C,B,A){return !A.isHidden(B)&&A.isCellEditable(B,C)},onEditorKey:function(F,E){var C=E.getKey(),G,D=this.grid,B=D.activeEditor;var A=E.shiftKey;if(C==E.TAB){E.stopEvent();B.completeEdit();if(A){G=D.walkCells(B.row,B.col-1,-1,this.acceptsNav,this)}else{G=D.walkCells(B.row,B.col+1,1,this.acceptsNav,this)}}else{if(C==E.ENTER){E.stopEvent();B.completeEdit();if(this.moveEditorOnEnter!==false){if(A){G=D.walkCells(B.row-1,B.col,-1,this.acceptsNav,this)}else{G=D.walkCells(B.row+1,B.col,1,this.acceptsNav,this)}}}else{if(C==E.ESC){B.cancelEdit()}}}if(G){D.startEditing(G[0],G[1])}}}); +Ext.grid.CellSelectionModel=function(A){Ext.apply(this,A);this.selection=null;this.addEvents("beforecellselect","cellselect","selectionchange");Ext.grid.CellSelectionModel.superclass.constructor.call(this)};Ext.extend(Ext.grid.CellSelectionModel,Ext.grid.AbstractSelectionModel,{initEvents:function(){this.grid.on("cellmousedown",this.handleMouseDown,this);this.grid.getGridEl().on(Ext.isIE?"keydown":"keypress",this.handleKeyDown,this);var A=this.grid.view;A.on("refresh",this.onViewChange,this);A.on("rowupdated",this.onRowUpdated,this);A.on("beforerowremoved",this.clearSelections,this);A.on("beforerowsinserted",this.clearSelections,this);if(this.grid.isEditor){this.grid.on("beforeedit",this.beforeEdit,this)}},beforeEdit:function(A){this.select(A.row,A.column,false,true,A.record)},onRowUpdated:function(A,B,C){if(this.selection&&this.selection.record==C){A.onCellSelect(B,this.selection.cell[1])}},onViewChange:function(){this.clearSelections(true)},getSelectedCell:function(){return this.selection?this.selection.cell:null},clearSelections:function(B){var A=this.selection;if(A){if(B!==true){this.grid.view.onCellDeselect(A.cell[0],A.cell[1])}this.selection=null;this.fireEvent("selectionchange",this,null)}},hasSelection:function(){return this.selection?true:false},handleMouseDown:function(B,D,A,C){if(C.button!==0||this.isLocked()){return }this.select(D,A)},select:function(F,C,B,E,D){if(this.fireEvent("beforecellselect",this,F,C)!==false){this.clearSelections();D=D||this.grid.store.getAt(F);this.selection={record:D,cell:[F,C]};if(!B){var A=this.grid.getView();A.onCellSelect(F,C);if(E!==true){A.focusCell(F,C)}}this.fireEvent("cellselect",this,F,C);this.fireEvent("selectionchange",this,this.selection)}},isSelectable:function(C,B,A){return !A.isHidden(B)},handleKeyDown:function(F){if(!F.isNavKeyPress()){return }var E=this.grid,J=this.selection;if(!J){F.stopEvent();var I=E.walkCells(0,0,1,this.isSelectable,this);if(I){this.select(I[0],I[1])}return }var B=this;var H=function(M,K,L){return E.walkCells(M,K,L,B.isSelectable,B)};var C=F.getKey(),A=J.cell[0],G=J.cell[1];var D;switch(C){case F.TAB:if(F.shiftKey){D=H(A,G-1,-1)}else{D=H(A,G+1,1)}break;case F.DOWN:D=H(A+1,G,1);break;case F.UP:D=H(A-1,G,-1);break;case F.RIGHT:D=H(A,G+1,1);break;case F.LEFT:D=H(A,G-1,-1);break;case F.ENTER:if(E.isEditor&&!E.editing){E.startEditing(A,G);F.stopEvent();return }break}if(D){this.select(D[0],D[1]);F.stopEvent()}},acceptsNav:function(C,B,A){return !A.isHidden(B)&&A.isCellEditable(B,C)},onEditorKey:function(E,D){var B=D.getKey(),F,C=this.grid,A=C.activeEditor;if(B==D.TAB){if(D.shiftKey){F=C.walkCells(A.row,A.col-1,-1,this.acceptsNav,this)}else{F=C.walkCells(A.row,A.col+1,1,this.acceptsNav,this)}D.stopEvent()}else{if(B==D.ENTER){A.completeEdit();D.stopEvent()}else{if(B==D.ESC){D.stopEvent();A.cancelEdit()}}}if(F){C.startEditing(F[0],F[1])}}}); +Ext.grid.EditorGridPanel=Ext.extend(Ext.grid.GridPanel,{clicksToEdit:2,isEditor:true,detectEdit:false,autoEncode:false,trackMouseOver:false,initComponent:function(){Ext.grid.EditorGridPanel.superclass.initComponent.call(this);if(!this.selModel){this.selModel=new Ext.grid.CellSelectionModel()}this.activeEditor=null;this.addEvents("beforeedit","afteredit","validateedit")},initEvents:function(){Ext.grid.EditorGridPanel.superclass.initEvents.call(this);this.on("bodyscroll",this.stopEditing,this,[true]);if(this.clicksToEdit==1){this.on("cellclick",this.onCellDblClick,this)}else{if(this.clicksToEdit=="auto"&&this.view.mainBody){this.view.mainBody.on("mousedown",this.onAutoEditClick,this)}this.on("celldblclick",this.onCellDblClick,this)}this.getGridEl().addClass("xedit-grid")},onCellDblClick:function(B,C,A){this.startEditing(C,A)},onAutoEditClick:function(C,B){if(C.button!==0){return }var E=this.view.findRowIndex(B);var A=this.view.findCellIndex(B);if(E!==false&&A!==false){this.stopEditing();if(this.selModel.getSelectedCell){var D=this.selModel.getSelectedCell();if(D&&D.cell[0]===E&&D.cell[1]===A){this.startEditing(E,A)}}else{if(this.selModel.isSelected(E)){this.startEditing(E,A)}}}},onEditComplete:function(B,D,A){this.editing=false;this.activeEditor=null;B.un("specialkey",this.selModel.onEditorKey,this.selModel);var C=B.record;var F=this.colModel.getDataIndex(B.col);D=this.postEditValue(D,A,C,F);if(String(D)!==String(A)){var E={grid:this,record:C,field:F,originalValue:A,value:D,row:B.row,column:B.col,cancel:false};if(this.fireEvent("validateedit",E)!==false&&!E.cancel){C.set(F,E.value);delete E.cancel;this.fireEvent("afteredit",E)}}this.view.focusCell(B.row,B.col)},startEditing:function(F,B){this.stopEditing();if(this.colModel.isCellEditable(B,F)){this.view.ensureVisible(F,B,true);var C=this.store.getAt(F);var E=this.colModel.getDataIndex(B);var D={grid:this,record:C,field:E,value:C.data[E],row:F,column:B,cancel:false};if(this.fireEvent("beforeedit",D)!==false&&!D.cancel){this.editing=true;var A=this.colModel.getCellEditor(B,F);if(!A.rendered){A.render(this.view.getEditorParent(A))}(function(){A.row=F;A.col=B;A.record=C;A.on("complete",this.onEditComplete,this,{single:true});A.on("specialkey",this.selModel.onEditorKey,this.selModel);this.activeEditor=A;var G=this.preEditValue(C,E);A.startEdit(this.view.getCell(F,B),G)}).defer(50,this)}}},preEditValue:function(A,B){return this.autoEncode&&typeof value=="string"?Ext.util.Format.htmlDecode(A.data[B]):A.data[B]},postEditValue:function(C,A,B,D){return this.autoEncode&&typeof C=="string"?Ext.util.Format.htmlEncode(C):C},stopEditing:function(A){if(this.activeEditor){this.activeEditor[A===true?"cancelEdit":"completeEdit"]()}this.activeEditor=null}});Ext.reg("editorgrid",Ext.grid.EditorGridPanel); +Ext.grid.GridEditor=function(B,A){Ext.grid.GridEditor.superclass.constructor.call(this,B,A);B.monitorTab=false};Ext.extend(Ext.grid.GridEditor,Ext.Editor,{alignment:"tl-tl",autoSize:"width",hideEl:false,cls:"x-small-editor x-grid-editor",shim:false,shadow:false}); +Ext.grid.PropertyRecord=Ext.data.Record.create([{name:"name",type:"string"},"value"]);Ext.grid.PropertyStore=function(A,B){this.grid=A;this.store=new Ext.data.Store({recordType:Ext.grid.PropertyRecord});this.store.on("update",this.onUpdate,this);if(B){this.setSource(B)}Ext.grid.PropertyStore.superclass.constructor.call(this)};Ext.extend(Ext.grid.PropertyStore,Ext.util.Observable,{setSource:function(C){this.source=C;this.store.removeAll();var B=[];for(var A in C){if(this.isEditableValue(C[A])){B.push(new Ext.grid.PropertyRecord({name:A,value:C[A]},A))}}this.store.loadRecords({records:B},{},true)},onUpdate:function(E,A,D){if(D==Ext.data.Record.EDIT){var B=A.data["value"];var C=A.modified["value"];if(this.grid.fireEvent("beforepropertychange",this.source,A.id,B,C)!==false){this.source[A.id]=B;A.commit();this.grid.fireEvent("propertychange",this.source,A.id,B,C)}else{A.reject()}}},getProperty:function(A){return this.store.getAt(A)},isEditableValue:function(A){if(Ext.isDate(A)){return true}else{if(typeof A=="object"||typeof A=="function"){return false}}return true},setValue:function(B,A){this.source[B]=A;this.store.getById(B).set("value",A)},getSource:function(){return this.source}});Ext.grid.PropertyColumnModel=function(C,B){this.grid=C;var D=Ext.grid;D.PropertyColumnModel.superclass.constructor.call(this,[{header:this.nameText,width:50,sortable:true,dataIndex:"name",id:"name",menuDisabled:true},{header:this.valueText,width:50,resizable:false,dataIndex:"value",id:"value",menuDisabled:true}]);this.store=B;this.bselect=Ext.DomHelper.append(document.body,{tag:"select",cls:"x-grid-editor x-hide-display",children:[{tag:"option",value:"true",html:"true"},{tag:"option",value:"false",html:"false"}]});var E=Ext.form;var A=new E.Field({el:this.bselect,bselect:this.bselect,autoShow:true,getValue:function(){return this.bselect.value=="true"}});this.editors={"date":new D.GridEditor(new E.DateField({selectOnFocus:true})),"string":new D.GridEditor(new E.TextField({selectOnFocus:true})),"number":new D.GridEditor(new E.NumberField({selectOnFocus:true,style:"text-align:left;"})),"boolean":new D.GridEditor(A)};this.renderCellDelegate=this.renderCell.createDelegate(this);this.renderPropDelegate=this.renderProp.createDelegate(this)};Ext.extend(Ext.grid.PropertyColumnModel,Ext.grid.ColumnModel,{nameText:"Name",valueText:"Value",dateFormat:"m/j/Y",renderDate:function(A){return A.dateFormat(this.dateFormat)},renderBool:function(A){return A?"true":"false"},isCellEditable:function(A,B){return A==1},getRenderer:function(A){return A==1?this.renderCellDelegate:this.renderPropDelegate},renderProp:function(A){return this.getPropertyName(A)},renderCell:function(A){var B=A;if(Ext.isDate(A)){B=this.renderDate(A)}else{if(typeof A=="boolean"){B=this.renderBool(A)}}return Ext.util.Format.htmlEncode(B)},getPropertyName:function(B){var A=this.grid.propertyNames;return A&&A[B]?A[B]:B},getCellEditor:function(A,E){var B=this.store.getProperty(E);var D=B.data["name"],C=B.data["value"];if(this.grid.customEditors[D]){return this.grid.customEditors[D]}if(Ext.isDate(C)){return this.editors["date"]}else{if(typeof C=="number"){return this.editors["number"]}else{if(typeof C=="boolean"){return this.editors["boolean"]}else{return this.editors["string"]}}}}});Ext.grid.PropertyGrid=Ext.extend(Ext.grid.EditorGridPanel,{enableColumnMove:false,stripeRows:false,trackMouseOver:false,clicksToEdit:1,enableHdMenu:false,viewConfig:{forceFit:true},initComponent:function(){this.customEditors=this.customEditors||{};this.lastEditRow=null;var B=new Ext.grid.PropertyStore(this);this.propStore=B;var A=new Ext.grid.PropertyColumnModel(this,B);B.store.sort("name","ASC");this.addEvents("beforepropertychange","propertychange");this.cm=A;this.ds=B.store;Ext.grid.PropertyGrid.superclass.initComponent.call(this);this.selModel.on("beforecellselect",function(E,D,C){if(C===0){this.startEditing.defer(200,this,[D,1]);return false}},this)},onRender:function(){Ext.grid.PropertyGrid.superclass.onRender.apply(this,arguments);this.getGridEl().addClass("x-props-grid")},afterRender:function(){Ext.grid.PropertyGrid.superclass.afterRender.apply(this,arguments);if(this.source){this.setSource(this.source)}},setSource:function(A){this.propStore.setSource(A)},getSource:function(){return this.propStore.getSource()}}); +Ext.grid.RowNumberer=function(A){Ext.apply(this,A);if(this.rowspan){this.renderer=this.renderer.createDelegate(this)}};Ext.grid.RowNumberer.prototype={header:"",width:23,sortable:false,fixed:true,menuDisabled:true,dataIndex:"",id:"numberer",rowspan:undefined,renderer:function(B,C,A,D){if(this.rowspan){C.cellAttr="rowspan=\""+this.rowspan+"\""}return D+1}}; +Ext.grid.CheckboxSelectionModel=Ext.extend(Ext.grid.RowSelectionModel,{header:"
     
    ",width:20,sortable:false,menuDisabled:true,fixed:true,dataIndex:"",id:"checker",initEvents:function(){Ext.grid.CheckboxSelectionModel.superclass.initEvents.call(this);this.grid.on("render",function(){var A=this.grid.getView();A.mainBody.on("mousedown",this.onMouseDown,this);Ext.fly(A.innerHd).on("mousedown",this.onHdMouseDown,this)},this)},onMouseDown:function(C,B){if(C.button===0&&B.className=="x-grid3-row-checker"){C.stopEvent();var D=C.getTarget(".x-grid3-row");if(D){var A=D.rowIndex;if(this.isSelected(A)){this.deselectRow(A)}else{this.selectRow(A,true)}}}},onHdMouseDown:function(C,A){if(A.className=="x-grid3-hd-checker"){C.stopEvent();var B=Ext.fly(A.parentNode);var D=B.hasClass("x-grid3-hd-checker-on");if(D){B.removeClass("x-grid3-hd-checker-on");this.clearSelections()}else{B.addClass("x-grid3-hd-checker-on");this.selectAll()}}},renderer:function(B,C,A){return"
     
    "}}); +Ext.LoadMask=function(C,B){this.el=Ext.get(C);Ext.apply(this,B);if(this.store){this.store.on("beforeload",this.onBeforeLoad,this);this.store.on("load",this.onLoad,this);this.store.on("loadexception",this.onLoad,this);this.removeMask=Ext.value(this.removeMask,false)}else{var A=this.el.getUpdater();A.showLoadIndicator=false;A.on("beforeupdate",this.onBeforeLoad,this);A.on("update",this.onLoad,this);A.on("failure",this.onLoad,this);this.removeMask=Ext.value(this.removeMask,true)}};Ext.LoadMask.prototype={msg:"Loading...",msgCls:"x-mask-loading",disabled:false,disable:function(){this.disabled=true},enable:function(){this.disabled=false},onLoad:function(){this.el.unmask(this.removeMask)},onBeforeLoad:function(){if(!this.disabled){this.el.mask(this.msg,this.msgCls)}},show:function(){this.onBeforeLoad()},hide:function(){this.onLoad()},destroy:function(){if(this.store){this.store.un("beforeload",this.onBeforeLoad,this);this.store.un("load",this.onLoad,this);this.store.un("loadexception",this.onLoad,this)}else{var A=this.el.getUpdater();A.un("beforeupdate",this.onBeforeLoad,this);A.un("update",this.onLoad,this);A.un("failure",this.onLoad,this)}}}; +Ext.ProgressBar=Ext.extend(Ext.BoxComponent,{baseCls:"x-progress",waitTimer:null,initComponent:function(){Ext.ProgressBar.superclass.initComponent.call(this);this.addEvents("update")},onRender:function(D,A){Ext.ProgressBar.superclass.onRender.call(this,D,A);var C=new Ext.Template("
    ","
    ","
    ","
    ","
     
    ","
    ","
    ","
    ","
     
    ","
    ","
    ","
    ");if(A){this.el=C.insertBefore(A,{cls:this.baseCls},true)}else{this.el=C.append(D,{cls:this.baseCls},true)}if(this.id){this.el.dom.id=this.id}var B=this.el.dom.firstChild;this.progressBar=Ext.get(B.firstChild);if(this.textEl){this.textEl=Ext.get(this.textEl);delete this.textTopEl}else{this.textTopEl=Ext.get(this.progressBar.dom.firstChild);var E=Ext.get(B.childNodes[1]);this.textTopEl.setStyle("z-index",99).addClass("x-hidden");this.textEl=new Ext.CompositeElement([this.textTopEl.dom.firstChild,E.dom.firstChild]);this.textEl.setWidth(B.offsetWidth)}if(this.value){this.updateProgress(this.value,this.text)}else{this.updateText(this.text)}this.setSize(this.width||"auto","auto");this.progressBar.setHeight(B.offsetHeight)},updateProgress:function(B,C){this.value=B||0;if(C){this.updateText(C)}var A=Math.floor(B*this.el.dom.firstChild.offsetWidth);this.progressBar.setWidth(A);if(this.textTopEl){this.textTopEl.removeClass("x-hidden").setWidth(A)}this.fireEvent("update",this,B,C);return this},wait:function(B){if(!this.waitTimer){var A=this;B=B||{};this.waitTimer=Ext.TaskMgr.start({run:function(C){var D=B.increment||10;this.updateProgress(((((C+D)%D)+1)*(100/D))*0.01)},interval:B.interval||1000,duration:B.duration,onStop:function(){if(B.fn){B.fn.apply(B.scope||this)}this.reset()},scope:A})}return this},isWaiting:function(){return this.waitTimer!=null},updateText:function(A){this.text=A||" ";this.textEl.update(this.text);return this},setSize:function(A,C){Ext.ProgressBar.superclass.setSize.call(this,A,C);if(this.textTopEl){var B=this.el.dom.firstChild;this.textEl.setSize(B.offsetWidth,B.offsetHeight)}return this},reset:function(A){this.updateProgress(0);if(this.textTopEl){this.textTopEl.addClass("x-hidden")}if(this.waitTimer){this.waitTimer.onStop=null;Ext.TaskMgr.stop(this.waitTimer);this.waitTimer=null}if(A===true){this.hide()}return this}});Ext.reg("progress",Ext.ProgressBar); diff --git a/src/gquery/public/ext-base.js b/src/gquery/public/ext-base.js new file mode 100644 index 00000000..fe67cb85 --- /dev/null +++ b/src/gquery/public/ext-base.js @@ -0,0 +1,10 @@ +/* + * Ext JS Library 2.0.2 + * Copyright(c) 2006-2008, Ext JS, LLC. + * licensing@extjs.com + * + * http://extjs.com/license + */ + +Ext={version:"2.0.2"};window["undefined"]=window["undefined"];Ext.apply=function(C,D,B){if(B){Ext.apply(C,B)}if(C&&D&&typeof D=="object"){for(var A in D){C[A]=D[A]}}return C};(function(){var idSeed=0;var ua=navigator.userAgent.toLowerCase();var isStrict=document.compatMode=="CSS1Compat",isOpera=ua.indexOf("opera")>-1,isSafari=(/webkit|khtml/).test(ua),isSafari3=isSafari&&ua.indexOf("webkit/5")!=-1,isIE=!isOpera&&ua.indexOf("msie")>-1,isIE7=!isOpera&&ua.indexOf("msie 7")>-1,isGecko=!isSafari&&ua.indexOf("gecko")>-1,isBorderBox=isIE&&!isStrict,isWindows=(ua.indexOf("windows")!=-1||ua.indexOf("win32")!=-1),isMac=(ua.indexOf("macintosh")!=-1||ua.indexOf("mac os x")!=-1),isAir=(ua.indexOf("adobeair")!=-1),isLinux=(ua.indexOf("linux")!=-1),isSecure=window.location.href.toLowerCase().indexOf("https")===0;if(isIE&&!isIE7){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}Ext.apply(Ext,{isStrict:isStrict,isSecure:isSecure,isReady:false,enableGarbageCollector:true,enableListenerCollection:false,SSL_SECURE_URL:"javascript:false",BLANK_IMAGE_URL:"http:/"+"/extjs.com/s.gif",emptyFn:function(){},applyIf:function(o,c){if(o&&c){for(var p in c){if(typeof o[p]=="undefined"){o[p]=c[p]}}}return o},addBehaviors:function(o){if(!Ext.isReady){Ext.onReady(function(){Ext.addBehaviors(o)});return }var cache={};for(var b in o){var parts=b.split("@");if(parts[1]){var s=parts[0];if(!cache[s]){cache[s]=Ext.select(s)}cache[s].on(parts[1],o[b])}}cache=null},id:function(el,prefix){prefix=prefix||"ext-gen";el=Ext.getDom(el);var id=prefix+(++idSeed);return el?(el.id?el.id:(el.id=id)):id},extend:function(){var io=function(o){for(var m in o){this[m]=o[m]}};var oc=Object.prototype.constructor;return function(sb,sp,overrides){if(typeof sp=="object"){overrides=sp;sp=sb;sb=overrides.constructor!=oc?overrides.constructor:function(){sp.apply(this,arguments)}}var F=function(){},sbp,spp=sp.prototype;F.prototype=spp;sbp=sb.prototype=new F();sbp.constructor=sb;sb.superclass=spp;if(spp.constructor==oc){spp.constructor=sp}sb.override=function(o){Ext.override(sb,o)};sbp.override=io;Ext.override(sb,overrides);sb.extend=function(o){Ext.extend(sb,o)};return sb}}(),override:function(origclass,overrides){if(overrides){var p=origclass.prototype;for(var method in overrides){p[method]=overrides[method]}}},namespace:function(){var a=arguments,o=null,i,j,d,rt;for(i=0;i=0){L=G[P]}if(!S||!L){return false}this.doRemove(S,O,L[this.WFN],false);delete G[P][this.WFN];delete G[P][this.FN];G.splice(P,1);return true},getTarget:function(N,M){N=N.browserEvent||N;var L=N.target||N.srcElement;return this.resolveTextNode(L)},resolveTextNode:function(L){if(Ext.isSafari&&L&&3==L.nodeType){return L.parentNode}else{return L}},getPageX:function(M){M=M.browserEvent||M;var L=M.pageX;if(!L&&0!==L){L=M.clientX||0;if(Ext.isIE){L+=this.getScroll()[1]}}return L},getPageY:function(L){L=L.browserEvent||L;var M=L.pageY;if(!M&&0!==M){M=L.clientY||0;if(Ext.isIE){M+=this.getScroll()[0]}}return M},getXY:function(L){L=L.browserEvent||L;return[this.getPageX(L),this.getPageY(L)]},getRelatedTarget:function(M){M=M.browserEvent||M;var L=M.relatedTarget;if(!L){if(M.type=="mouseout"){L=M.toElement}else{if(M.type=="mouseover"){L=M.fromElement}}}return this.resolveTextNode(L)},getTime:function(N){N=N.browserEvent||N;if(!N.time){var M=new Date().getTime();try{N.time=M}catch(L){this.lastError=L;return M}}return N.time},stopEvent:function(L){this.stopPropagation(L);this.preventDefault(L)},stopPropagation:function(L){L=L.browserEvent||L;if(L.stopPropagation){L.stopPropagation()}else{L.cancelBubble=true}},preventDefault:function(L){L=L.browserEvent||L;if(L.preventDefault){L.preventDefault()}else{L.returnValue=false}},getEvent:function(M){var L=M||window.event;if(!L){var N=this.getEvent.caller;while(N){L=N.arguments[0];if(L&&Event==L.constructor){break}N=N.caller}}return L},getCharCode:function(L){L=L.browserEvent||L;return L.charCode||L.keyCode||0},_getCacheIndex:function(Q,N,P){for(var O=0,M=G.length;O0)}var Q=[];for(var M=0,L=H.length;M0){for(var Q=0,S=T.length;Q0){O=G.length;while(O){N=O-1;M=G[N];if(M){R.removeListener(M[R.EL],M[R.TYPE],M[R.FN],N)}O=O-1}M=null;R.clearCache()}R.doRemove(window,"unload",R._unload)},getScroll:function(){var L=document.documentElement,M=document.body;if(L&&(L.scrollTop||L.scrollLeft)){return[L.scrollTop,L.scrollLeft]}else{if(M){return[M.scrollTop,M.scrollLeft]}else{return[0,0]}}},doAdd:function(){if(window.addEventListener){return function(O,M,N,L){O.addEventListener(M,N,(L))}}else{if(window.attachEvent){return function(O,M,N,L){O.attachEvent("on"+M,N)}}else{return function(){}}}}(),doRemove:function(){if(window.removeEventListener){return function(O,M,N,L){O.removeEventListener(M,N,(L))}}else{if(window.detachEvent){return function(N,L,M){N.detachEvent("on"+L,M)}}else{return function(){}}}}()}}();var D=Ext.lib.Event;D.on=D.addListener;D.un=D.removeListener;if(document&&document.body){D._load()}else{D.doAdd(window,"load",D._load)}D.doAdd(window,"unload",D._unload);D._tryPreloadAttach();Ext.lib.Ajax={request:function(K,I,E,J,F){if(F){var G=F.headers;if(G){for(var H in G){if(G.hasOwnProperty(H)){this.initHeader(H,G[H],false)}}}if(F.xmlData){this.initHeader("Content-Type","text/xml",false);K="POST";J=F.xmlData}else{if(F.jsonData){this.initHeader("Content-Type","text/javascript",false);K="POST";J=typeof F.jsonData=="object"?Ext.encode(F.jsonData):F.jsonData}}}return this.asyncRequest(K,I,E,J)},serializeForm:function(F){if(typeof F=="string"){F=(document.getElementById(F)||document.forms[F])}var G,E,H,J,K="",M=false;for(var L=0;L=200&&G<300){F=this.createResponseObject(I,J.argument);if(J.success){if(!J.scope){J.success(F)}else{J.success.apply(J.scope,[F])}}}else{switch(G){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:F=this.createExceptionObject(I.tId,J.argument,(E?E:false));if(J.failure){if(!J.scope){J.failure(F)}else{J.failure.apply(J.scope,[F])}}break;default:F=this.createResponseObject(I,J.argument);if(J.failure){if(!J.scope){J.failure(F)}else{J.failure.apply(J.scope,[F])}}}}this.releaseObject(I);F=null},createResponseObject:function(E,K){var H={};var M={};try{var G=E.conn.getAllResponseHeaders();var J=G.split("\n");for(var I=0;I=this.left&&E.right<=this.right&&E.top>=this.top&&E.bottom<=this.bottom)},getArea:function(){return((this.bottom-this.top)*(this.right-this.left))},intersect:function(I){var G=Math.max(this.top,I.top);var H=Math.min(this.right,I.right);var E=Math.min(this.bottom,I.bottom);var F=Math.max(this.left,I.left);if(E>=G&&H>=F){return new Ext.lib.Region(G,H,E,F)}else{return null}},union:function(I){var G=Math.min(this.top,I.top);var H=Math.max(this.right,I.right);var E=Math.max(this.bottom,I.bottom);var F=Math.min(this.left,I.left);return new Ext.lib.Region(G,H,E,F)},constrainTo:function(E){this.top=this.top.constrain(E.top,E.bottom);this.bottom=this.bottom.constrain(E.top,E.bottom);this.left=this.left.constrain(E.left,E.right);this.right=this.right.constrain(E.left,E.right);return this},adjust:function(G,F,E,H){this.top+=G;this.left+=F;this.right+=H;this.bottom+=E;return this}};Ext.lib.Region.getRegion=function(H){var J=Ext.lib.Dom.getXY(H);var G=J[1];var I=J[0]+H.offsetWidth;var E=J[1]+H.offsetHeight;var F=J[0];return new Ext.lib.Region(G,I,E,F)};Ext.lib.Point=function(E,F){if(Ext.isArray(E)){F=E[1];E=E[0]}this.x=this.right=this.left=this[0]=E;this.y=this.top=this.bottom=this[1]=F};Ext.lib.Point.prototype=new Ext.lib.Region();Ext.lib.Anim={scroll:function(H,F,I,J,E,G){return this.run(H,F,I,J,E,G,Ext.lib.Scroll)},motion:function(H,F,I,J,E,G){return this.run(H,F,I,J,E,G,Ext.lib.Motion)},color:function(H,F,I,J,E,G){return this.run(H,F,I,J,E,G,Ext.lib.ColorAnim)},run:function(I,F,K,L,E,H,G){G=G||Ext.lib.AnimBase;if(typeof L=="string"){L=Ext.lib.Easing[L]}var J=new G(I,F,K,L);J.animateX(function(){Ext.callback(E,H)});return J}};function C(E){if(!B){B=new Ext.Element.Flyweight()}B.dom=E;return B}if(Ext.isIE){function A(){var E=Function.prototype;delete E.createSequence;delete E.defer;delete E.createDelegate;delete E.createCallback;delete E.createInterceptor;window.detachEvent("onunload",A)}window.attachEvent("onunload",A)}Ext.lib.AnimBase=function(F,E,G,H){if(F){this.init(F,E,G,H)}};Ext.lib.AnimBase.prototype={toString:function(){var E=this.getEl();var F=E.id||E.tagName;return("Anim "+F)},patterns:{noNegatives:/width|height|opacity|padding/i,offsetAttribute:/^((width|height)|(top|left))$/,defaultUnit:/width|height|top$|bottom$|left$|right$/i,offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i},doMethod:function(E,G,F){return this.method(this.currentFrame,G,F-G,this.totalFrames)},setAttribute:function(E,G,F){if(this.patterns.noNegatives.test(E)){G=(G>0)?G:0}Ext.fly(this.getEl(),"_anim").setStyle(E,G+F)},getAttribute:function(E){var G=this.getEl();var I=C(G).getStyle(E);if(I!=="auto"&&!this.patterns.offsetUnit.test(I)){return parseFloat(I)}var F=this.patterns.offsetAttribute.exec(E)||[];var J=!!(F[3]);var H=!!(F[2]);if(H||(C(G).getStyle("position")=="absolute"&&J)){I=G["offset"+F[0].charAt(0).toUpperCase()+F[0].substr(1)]}else{I=0}return I},getDefaultUnit:function(E){if(this.patterns.defaultUnit.test(E)){return"px"}return""},animateX:function(G,E){var F=function(){this.onComplete.removeListener(F);if(typeof G=="function"){G.call(E||this,this)}};this.onComplete.addListener(F,this);this.animate()},setRuntimeAttribute:function(F){var K;var G;var H=this.attributes;this.runtimeAttributes[F]={};var J=function(L){return(typeof L!=="undefined")};if(!J(H[F]["to"])&&!J(H[F]["by"])){return false}K=(J(H[F]["from"]))?H[F]["from"]:this.getAttribute(F);if(J(H[F]["to"])){G=H[F]["to"]}else{if(J(H[F]["by"])){if(K.constructor==Array){G=[];for(var I=0,E=K.length;I0&&isFinite(O)){if(K.currentFrame+O>=N){O=N-(M+1)}K.currentFrame+=O}}};Ext.lib.Bezier=new function(){this.getPosition=function(I,H){var J=I.length;var G=[];for(var F=0;F0&&!Ext.isArray(O[0])){O=[O]}else{var N=[];for(P=0,R=O.length;P0){this.runtimeAttributes[S]=this.runtimeAttributes[S].concat(O)}this.runtimeAttributes[S][this.runtimeAttributes[S].length]=L}else{I.setRuntimeAttribute.call(this,S)}};var E=function(J,L){var K=Ext.lib.Dom.getXY(this.getEl());J=[J[0]-K[0]+L[0],J[1]-K[1]+L[1]];return J};var G=function(J){return(typeof J!=="undefined")}})();(function(){Ext.lib.Scroll=function(I,H,J,K){if(I){Ext.lib.Scroll.superclass.constructor.call(this,I,H,J,K)}};Ext.extend(Ext.lib.Scroll,Ext.lib.ColorAnim);var F=Ext.lib;var G=F.Scroll.superclass;var E=F.Scroll.prototype;E.toString=function(){var H=this.getEl();var I=H.id||H.tagName;return("Scroll "+I)};E.doMethod=function(H,K,I){var J=null;if(H=="scroll"){J=[this.method(this.currentFrame,K[0],I[0]-K[0],this.totalFrames),this.method(this.currentFrame,K[1],I[1]-K[1],this.totalFrames)]}else{J=G.doMethod.call(this,H,K,I)}return J};E.getAttribute=function(H){var J=null;var I=this.getEl();if(H=="scroll"){J=[I.scrollLeft,I.scrollTop]}else{J=G.getAttribute.call(this,H)}return J};E.setAttribute=function(H,K,J){var I=this.getEl();if(H=="scroll"){I.scrollLeft=K[0];I.scrollTop=K[1]}else{G.setAttribute.call(this,H,K,J)}}})()})(); diff --git a/src/gquery/public/ext-core.js b/src/gquery/public/ext-core.js new file mode 100644 index 00000000..749d9240 --- /dev/null +++ b/src/gquery/public/ext-core.js @@ -0,0 +1,19 @@ +/* + * Ext JS Library 2.0.2 + * Copyright(c) 2006-2008, Ext JS, LLC. + * licensing@extjs.com + * + * http://extjs.com/license + */ + +Ext.DomHelper=function(){var L=null;var F=/^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i;var B=/^table|tbody|tr|td$/i;var A=function(T){if(typeof T=="string"){return T}var O="";if(Ext.isArray(T)){for(var R=0,P=T.length;R"}else{O+=">";var U=T.children||T.cn;if(U){O+=A(U)}else{if(T.html){O+=T.html}}O+=""}return O};var M=function(T,O){var S;if(Ext.isArray(T)){S=document.createDocumentFragment();for(var R=0,P=T.length;R",K=""+E,H=C+"",D=""+K;var G=function(N,O,Q,P){if(!L){L=document.createElement("div")}var R;var S=null;if(N=="td"){if(O=="afterbegin"||O=="beforeend"){return }if(O=="beforebegin"){S=Q;Q=Q.parentNode}else{S=Q.nextSibling;Q=Q.parentNode}R=I(4,H,P,D)}else{if(N=="tr"){if(O=="beforebegin"){S=Q;Q=Q.parentNode;R=I(3,C,P,K)}else{if(O=="afterend"){S=Q.nextSibling;Q=Q.parentNode;R=I(3,C,P,K)}else{if(O=="afterbegin"){S=Q.firstChild}R=I(4,H,P,D)}}}else{if(N=="tbody"){if(O=="beforebegin"){S=Q;Q=Q.parentNode;R=I(2,J,P,E)}else{if(O=="afterend"){S=Q.nextSibling;Q=Q.parentNode;R=I(2,J,P,E)}else{if(O=="afterbegin"){S=Q.firstChild}R=I(3,C,P,K)}}}else{if(O=="beforebegin"||O=="afterend"){return }if(O=="afterbegin"){S=Q.firstChild}R=I(2,J,P,E)}}}Q.insertBefore(R,S);return R};return{useDom:false,markup:function(N){return A(N)},applyStyles:function(P,Q){if(Q){P=Ext.fly(P);if(typeof Q=="string"){var O=/\s?([a-z\-]*)\:\s?([^;]*);?/gi;var R;while((R=O.exec(Q))!=null){P.setStyle(R[1],R[2])}}else{if(typeof Q=="object"){for(var N in Q){P.setStyle(N,Q[N])}}else{if(typeof Q=="function"){Ext.DomHelper.applyStyles(P,Q.call())}}}}},insertHtml:function(P,R,Q){P=P.toLowerCase();if(R.insertAdjacentHTML){if(B.test(R.tagName)){var O;if(O=G(R.tagName.toLowerCase(),P,R,Q)){return O}}switch(P){case"beforebegin":R.insertAdjacentHTML("BeforeBegin",Q);return R.previousSibling;case"afterbegin":R.insertAdjacentHTML("AfterBegin",Q);return R.firstChild;case"beforeend":R.insertAdjacentHTML("BeforeEnd",Q);return R.lastChild;case"afterend":R.insertAdjacentHTML("AfterEnd",Q);return R.nextSibling}throw"Illegal insertion point -> \""+P+"\""}var N=R.ownerDocument.createRange();var S;switch(P){case"beforebegin":N.setStartBefore(R);S=N.createContextualFragment(Q);R.parentNode.insertBefore(S,R);return R.previousSibling;case"afterbegin":if(R.firstChild){N.setStartBefore(R.firstChild);S=N.createContextualFragment(Q);R.insertBefore(S,R.firstChild);return R.firstChild}else{R.innerHTML=Q;return R.firstChild}case"beforeend":if(R.lastChild){N.setStartAfter(R.lastChild);S=N.createContextualFragment(Q);R.appendChild(S);return R.lastChild}else{R.innerHTML=Q;return R.lastChild}case"afterend":N.setStartAfter(R);S=N.createContextualFragment(Q);R.parentNode.insertBefore(S,R.nextSibling);return R.nextSibling}throw"Illegal insertion point -> \""+P+"\""},insertBefore:function(N,P,O){return this.doInsert(N,P,O,"beforeBegin")},insertAfter:function(N,P,O){return this.doInsert(N,P,O,"afterEnd","nextSibling")},insertFirst:function(N,P,O){return this.doInsert(N,P,O,"afterBegin","firstChild")},doInsert:function(Q,S,R,T,P){Q=Ext.getDom(Q);var O;if(this.useDom){O=M(S,null);(P==="firstChild"?Q:Q.parentNode).insertBefore(O,P?Q[P]:Q)}else{var N=A(S);O=this.insertHtml(T,Q,N)}return R?Ext.get(O,true):O},append:function(P,R,Q){P=Ext.getDom(P);var O;if(this.useDom){O=M(R,null);P.appendChild(O)}else{var N=A(R);O=this.insertHtml("beforeEnd",P,N)}return Q?Ext.get(O,true):O},overwrite:function(N,P,O){N=Ext.getDom(N);N.innerHTML=A(P);return O?Ext.get(N.firstChild,true):N.firstChild},createTemplate:function(O){var N=A(O);return new Ext.Template(N)}}}(); +Ext.Template=function(E){var B=arguments;if(Ext.isArray(E)){E=E.join("")}else{if(B.length>1){var C=[];for(var D=0,A=B.length;D+~]\s?|\s|$)/;var tagTokenRe=/^(#)?([\w-\*]+)/;var nthRe=/(\d*)n\+?(\d*)/,nthRe2=/\D/;function child(p,index){var i=0;var n=p.firstChild;while(n){if(n.nodeType==1){if(++i==index){return n}}n=n.nextSibling}return null}function next(n){while((n=n.nextSibling)&&n.nodeType!=1){}return n}function prev(n){while((n=n.previousSibling)&&n.nodeType!=1){}return n}function children(d){var n=d.firstChild,ni=-1;while(n){var nx=n.nextSibling;if(n.nodeType==3&&!nonSpace.test(n.nodeValue)){d.removeChild(n)}else{n.nodeIndex=++ni}n=nx}return this}function byClassName(c,a,v){if(!v){return c}var r=[],ri=-1,cn;for(var i=0,ci;ci=c[i];i++){if((" "+ci.className+" ").indexOf(v)!=-1){r[++ri]=ci}}return r}function attrValue(n,attr){if(!n.tagName&&typeof n.length!="undefined"){n=n[0]}if(!n){return null}if(attr=="for"){return n.htmlFor}if(attr=="class"||attr=="className"){return n.className}return n.getAttribute(attr)||n[attr]}function getNodes(ns,mode,tagName){var result=[],ri=-1,cs;if(!ns){return result}tagName=tagName||"*";if(typeof ns.getElementsByTagName!="undefined"){ns=[ns]}if(!mode){for(var i=0,ni;ni=ns[i];i++){cs=ni.getElementsByTagName(tagName);for(var j=0,ci;ci=cs[j];j++){result[++ri]=ci}}}else{if(mode=="/"||mode==">"){var utag=tagName.toUpperCase();for(var i=0,ni,cn;ni=ns[i];i++){cn=ni.children||ni.childNodes;for(var j=0,cj;cj=cn[j];j++){if(cj.nodeName==utag||cj.nodeName==tagName||tagName=="*"){result[++ri]=cj}}}}else{if(mode=="+"){var utag=tagName.toUpperCase();for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(n&&(n.nodeName==utag||n.nodeName==tagName||tagName=="*")){result[++ri]=n}}}else{if(mode=="~"){for(var i=0,n;n=ns[i];i++){while((n=n.nextSibling)&&(n.nodeType!=1||(tagName=="*"||n.tagName.toLowerCase()!=tagName))){}if(n){result[++ri]=n}}}}}}return result}function concat(a,b){if(b.slice){return a.concat(b)}for(var i=0,l=b.length;i1){return nodup(results)}return results},selectNode:function(path,root){return Ext.DomQuery.select(path,root)[0]},selectValue:function(path,root,defaultValue){path=path.replace(trimRe,"");if(!valueCache[path]){valueCache[path]=Ext.DomQuery.compile(path,"select")}var n=valueCache[path](root);n=n[0]?n[0]:n;var v=(n&&n.firstChild?n.firstChild.nodeValue:null);return((v===null||v===undefined||v==="")?defaultValue:v)},selectNumber:function(path,root,defaultValue){var v=Ext.DomQuery.selectValue(path,root,defaultValue||0);return parseFloat(v)},is:function(el,ss){if(typeof el=="string"){el=document.getElementById(el)}var isArray=Ext.isArray(el);var result=Ext.DomQuery.filter(isArray?el:[el],ss);return isArray?(result.length==el.length):(result.length>0)},filter:function(els,ss,nonMatches){ss=ss.replace(trimRe,"");if(!simpleCache[ss]){simpleCache[ss]=Ext.DomQuery.compile(ss,"simple")}var result=simpleCache[ss](els);return nonMatches?quickDiff(result,els):result},matchers:[{re:/^\.([\w-]+)/,select:"n = byClassName(n, null, \" {1} \");"},{re:/^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,select:"n = byPseudo(n, \"{1}\", \"{2}\");"},{re:/^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,select:"n = byAttribute(n, \"{2}\", \"{4}\", \"{3}\", \"{1}\");"},{re:/^#([\w-]+)/,select:"n = byId(n, null, \"{1}\");"},{re:/^@([\w-]+)/,select:"return {firstChild:{nodeValue:attrValue(n, \"{1}\")}};"}],operators:{"=":function(a,v){return a==v},"!=":function(a,v){return a!=v},"^=":function(a,v){return a&&a.substr(0,v.length)==v},"$=":function(a,v){return a&&a.substr(a.length-v.length)==v},"*=":function(a,v){return a&&a.indexOf(v)!==-1},"%=":function(a,v){return(a%v)==0},"|=":function(a,v){return a&&(a==v||a.substr(0,v.length+1)==v+"-")},"~=":function(a,v){return a&&(" "+a+" ").indexOf(" "+v+" ")!=-1}},pseudos:{"first-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.previousSibling)&&n.nodeType!=1){}if(!n){r[++ri]=ci}}return r},"last-child":function(c){var r=[],ri=-1,n;for(var i=0,ci;ci=n=c[i];i++){while((n=n.nextSibling)&&n.nodeType!=1){}if(!n){r[++ri]=ci}}return r},"nth-child":function(c,a){var r=[],ri=-1;var m=nthRe.exec(a=="even"&&"2n"||a=="odd"&&"2n+1"||!nthRe2.test(a)&&"n+"+a||a);var f=(m[1]||1)-0,l=m[2]-0;for(var i=0,n;n=c[i];i++){var pn=n.parentNode;if(batch!=pn._batch){var j=0;for(var cn=pn.firstChild;cn;cn=cn.nextSibling){if(cn.nodeType==1){cn.nodeIndex=++j}}pn._batch=batch}if(f==1){if(l==0||n.nodeIndex==l){r[++ri]=n}}else{if((n.nodeIndex+l)%f==0){r[++ri]=n}}}return r},"only-child":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(!prev(ci)&&!next(ci)){r[++ri]=ci}}return r},"empty":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var cns=ci.childNodes,j=0,cn,empty=true;while(cn=cns[j]){++j;if(cn.nodeType==1||cn.nodeType==3){empty=false;break}}if(empty){r[++ri]=ci}}return r},"contains":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if((ci.textContent||ci.innerText||"").indexOf(v)!=-1){r[++ri]=ci}}return r},"nodeValue":function(c,v){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.firstChild&&ci.firstChild.nodeValue==v){r[++ri]=ci}}return r},"checked":function(c){var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(ci.checked==true){r[++ri]=ci}}return r},"not":function(c,ss){return Ext.DomQuery.filter(c,ss,true)},"any":function(c,selectors){var ss=selectors.split("|");var r=[],ri=-1,s;for(var i=0,ci;ci=c[i];i++){for(var j=0;s=ss[j];j++){if(Ext.DomQuery.is(ci,s)){r[++ri]=ci;break}}}return r},"odd":function(c){return this["nth-child"](c,"odd")},"even":function(c){return this["nth-child"](c,"even")},"nth":function(c,a){return c[a-1]||[]},"first":function(c){return c[0]||[]},"last":function(c){return c[c.length-1]||[]},"has":function(c,ss){var s=Ext.DomQuery.select;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){if(s(ss,ci).length>0){r[++ri]=ci}}return r},"next":function(c,ss){var is=Ext.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=next(ci);if(n&&is(n,ss)){r[++ri]=ci}}return r},"prev":function(c,ss){var is=Ext.DomQuery.is;var r=[],ri=-1;for(var i=0,ci;ci=c[i];i++){var n=prev(ci);if(n&&is(n,ss)){r[++ri]=ci}}return r}}}}();Ext.query=Ext.DomQuery.select; +Ext.util.Observable=function(){if(this.listeners){this.on(this.listeners);delete this.listeners}};Ext.util.Observable.prototype={fireEvent:function(){if(this.eventsSuspended!==true){var A=this.events[arguments[0].toLowerCase()];if(typeof A=="object"){return A.fire.apply(A,Array.prototype.slice.call(arguments,1))}}return true},filterOptRe:/^(?:scope|delay|buffer|single)$/,addListener:function(A,C,B,F){if(typeof A=="object"){F=A;for(var E in F){if(this.filterOptRe.test(E)){continue}if(typeof F[E]=="function"){this.addListener(E,F[E],F.scope,F)}else{this.addListener(E,F[E].fn,F[E].scope,F[E])}}return }F=(!F||typeof F=="boolean")?{}:F;A=A.toLowerCase();var D=this.events[A]||true;if(typeof D=="boolean"){D=new Ext.util.Event(this,A);this.events[A]=D}D.addListener(C,B,F)},removeListener:function(A,C,B){var D=this.events[A.toLowerCase()];if(typeof D=="object"){D.removeListener(C,B)}},purgeListeners:function(){for(var A in this.events){if(typeof this.events[A]=="object"){this.events[A].clearListeners()}}},relayEvents:function(F,D){var E=function(G){return function(){return this.fireEvent.apply(this,Ext.combine(G,Array.prototype.slice.call(arguments,0)))}};for(var C=0,A=D.length;C0},suspendEvents:function(){this.eventsSuspended=true},resumeEvents:function(){this.eventsSuspended=false},getMethodEvent:function(G){if(!this.methodEvents){this.methodEvents={}}var F=this.methodEvents[G];if(!F){F={};this.methodEvents[G]=F;F.originalFn=this[G];F.methodName=G;F.before=[];F.after=[];var C,B,D;var E=this;var A=function(J,I,H){if((B=J.apply(I||E,H))!==undefined){if(typeof B==="object"){if(B.returnValue!==undefined){C=B.returnValue}else{C=B}if(B.cancel===true){D=true}}else{if(B===false){D=true}else{C=B}}}};this[G]=function(){C=B=undefined;D=false;var I=Array.prototype.slice.call(arguments,0);for(var J=0,H=F.before.length;J0){this.firing=true;var G=Array.prototype.slice.call(arguments,0);for(var H=0;H");var D=document.getElementById("ie-deferred-loader");D.onreadystatechange=function(){if(this.readyState=="complete"){B()}}}else{if(Ext.isSafari){M=setInterval(function(){var E=document.readyState;if(E=="complete"){B()}},10)}}}L.on(window,"load",B)};var R=function(E,U){var D=new Ext.util.DelayedTask(E);return function(V){V=new Ext.EventObjectImpl(V);D.delay(U.buffer,E,null,[V])}};var P=function(V,U,D,E){return function(W){Ext.EventManager.removeListener(U,D,E);V(W)}};var F=function(D,E){return function(U){U=new Ext.EventObjectImpl(U);setTimeout(function(){D(U)},E.delay||10)}};var J=function(U,E,D,Y,X){var Z=(!D||typeof D=="boolean")?{}:D;Y=Y||Z.fn;X=X||Z.scope;var W=Ext.getDom(U);if(!W){throw"Error listening for \""+E+"\". Element \""+U+"\" doesn't exist."}var V=function(b){b=Ext.EventObject.setEvent(b);var a;if(Z.delegate){a=b.getTarget(Z.delegate,W);if(!a){return }}else{a=b.target}if(Z.stopEvent===true){b.stopEvent()}if(Z.preventDefault===true){b.preventDefault()}if(Z.stopPropagation===true){b.stopPropagation()}if(Z.normalized===false){b=b.browserEvent}Y.call(X||W,b,a,Z)};if(Z.delay){V=F(V,Z)}if(Z.single){V=P(V,W,E,Y)}if(Z.buffer){V=R(V,Z)}Y._handlers=Y._handlers||[];Y._handlers.push([Ext.id(W),E,V]);L.on(W,E,V);if(E=="mousewheel"&&W.addEventListener){W.addEventListener("DOMMouseScroll",V,false);L.on(window,"unload",function(){W.removeEventListener("DOMMouseScroll",V,false)})}if(E=="mousedown"&&W==document){Ext.EventManager.stoppedMouseDownEvent.addListener(V)}return V};var G=function(E,U,Z){var D=Ext.id(E),a=Z._handlers,X=Z;if(a){for(var V=0,Y=a.length;V=33&&D<=40)||D==this.RETURN||D==this.TAB||D==this.ESC},isSpecialKey:function(){var D=this.keyCode;return(this.type=="keypress"&&this.ctrlKey)||D==9||D==13||D==40||D==27||(D==16)||(D==17)||(D>=18&&D<=20)||(D>=33&&D<=35)||(D>=36&&D<=39)||(D>=44&&D<=45)},stopPropagation:function(){if(this.browserEvent){if(this.browserEvent.type=="mousedown"){Ext.EventManager.stoppedMouseDownEvent.fire(this)}B.stopPropagation(this.browserEvent)}},getCharCode:function(){return this.charCode||this.keyCode},getKey:function(){var D=this.keyCode||this.charCode;return Ext.isSafari?(A[D]||D):D},getPageX:function(){return this.xy[0]},getPageY:function(){return this.xy[1]},getTime:function(){if(this.browserEvent){return B.getTime(this.browserEvent)}return null},getXY:function(){return this.xy},getTarget:function(E,G,D){var F=Ext.get(this.target);return E?F.findParent(E,G,D):(D?F:this.target)},getRelatedTarget:function(){if(this.browserEvent){return B.getRelatedTarget(this.browserEvent)}return null},getWheelDelta:function(){var D=this.browserEvent;var E=0;if(D.wheelDelta){E=D.wheelDelta/120}else{if(D.detail){E=-D.detail/3}}return E},hasModifier:function(){return((this.ctrlKey||this.altKey)||this.shiftKey)?true:false},within:function(E,F){var D=this[F?"getRelatedTarget":"getTarget"]();return D&&Ext.fly(E).contains(D)},getPoint:function(){return new Ext.lib.Point(this.xy[0],this.xy[1])}};return new Ext.EventObjectImpl()}(); +(function(){var D=Ext.lib.Dom;var E=Ext.lib.Event;var A=Ext.lib.Anim;var propCache={};var camelRe=/(-[a-z])/gi;var camelFn=function(m,a){return a.charAt(1).toUpperCase()};var view=document.defaultView;Ext.Element=function(element,forceNew){var dom=typeof element=="string"?document.getElementById(element):element;if(!dom){return null}var id=dom.id;if(forceNew!==true&&id&&Ext.Element.cache[id]){return Ext.Element.cache[id]}this.dom=dom;this.id=id||Ext.id(dom)};var El=Ext.Element;El.prototype={originalDisplay:"",visibilityMode:1,defaultUnit:"px",setVisibilityMode:function(visMode){this.visibilityMode=visMode;return this},enableDisplayMode:function(display){this.setVisibilityMode(El.DISPLAY);if(typeof display!="undefined"){this.originalDisplay=display}return this},findParent:function(simpleSelector,maxDepth,returnEl){var p=this.dom,b=document.body,depth=0,dq=Ext.DomQuery,stopEl;maxDepth=maxDepth||50;if(typeof maxDepth!="number"){stopEl=Ext.getDom(maxDepth);maxDepth=10}while(p&&p.nodeType==1&&depthch||tcb){c.scrollTop=b-ch}}c.scrollTop=c.scrollTop;if(hscroll!==false){if(el.offsetWidth>c.clientWidth||lcr){c.scrollLeft=r-c.clientWidth}}c.scrollLeft=c.scrollLeft}return this},scrollChildIntoView:function(child,hscroll){Ext.fly(child,"_scrollChildIntoView").scrollIntoView(this,hscroll)},autoHeight:function(animate,duration,onComplete,easing){var oldHeight=this.getHeight();this.clip();this.setHeight(1);setTimeout(function(){var height=parseInt(this.dom.scrollHeight,10);if(!animate){this.setHeight(height);this.unclip();if(typeof onComplete=="function"){onComplete()}}else{this.setHeight(oldHeight);this.setHeight(height,animate,duration,function(){this.unclip();if(typeof onComplete=="function"){onComplete()}}.createDelegate(this),easing)}}.createDelegate(this),0);return this},contains:function(el){if(!el){return false}return D.isAncestor(this.dom,el.dom?el.dom:el)},isVisible:function(deep){var vis=!(this.getStyle("visibility")=="hidden"||this.getStyle("display")=="none");if(deep!==true||!vis){return vis}var p=this.dom.parentNode;while(p&&p.tagName.toLowerCase()!="body"){if(!Ext.fly(p,"_isVisible").isVisible()){return false}p=p.parentNode}return true},select:function(selector,unique){return El.select(selector,unique,this.dom)},query:function(selector,unique){return Ext.DomQuery.select(selector,this.dom)},child:function(selector,returnDom){var n=Ext.DomQuery.selectNode(selector,this.dom);return returnDom?n:Ext.get(n)},down:function(selector,returnDom){var n=Ext.DomQuery.selectNode(" > "+selector,this.dom);return returnDom?n:Ext.get(n)},initDD:function(group,config,overrides){var dd=new Ext.dd.DD(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides)},initDDProxy:function(group,config,overrides){var dd=new Ext.dd.DDProxy(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides)},initDDTarget:function(group,config,overrides){var dd=new Ext.dd.DDTarget(Ext.id(this.dom),group,config);return Ext.apply(dd,overrides)},setVisible:function(visible,animate){if(!animate||!A){if(this.visibilityMode==El.DISPLAY){this.setDisplayed(visible)}else{this.fixDisplay();this.dom.style.visibility=visible?"visible":"hidden"}}else{var dom=this.dom;var visMode=this.visibilityMode;if(visible){this.setOpacity(0.01);this.setVisible(true)}this.anim({opacity:{to:(visible?1:0)}},this.preanim(arguments,1),null,0.35,"easeIn",function(){if(!visible){if(visMode==El.DISPLAY){dom.style.display="none"}else{dom.style.visibility="hidden"}Ext.get(dom).setOpacity(1)}})}return this},isDisplayed:function(){return this.getStyle("display")!="none"},toggle:function(animate){this.setVisible(!this.isVisible(),this.preanim(arguments,0));return this},setDisplayed:function(value){if(typeof value=="boolean"){value=value?this.originalDisplay:"none"}this.setStyle("display",value);return this},focus:function(){try{this.dom.focus()}catch(e){}return this},blur:function(){try{this.dom.blur()}catch(e){}return this},addClass:function(className){if(Ext.isArray(className)){for(var i=0,len=className.length;idw+scrollX){x=swapX?r.left-w:dw+scrollX-w}if(xdh+scrollY){y=swapY?r.top-h:dh+scrollY-h}if(yvr){x=vr-w;moved=true}if((y+h)>vb){y=vb-h;moved=true}if(x";E.onAvailable(id,function(){var hd=document.getElementsByTagName("head")[0];var re=/(?:]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig;var srcRe=/\ssrc=([\'\"])(.*?)\1/i;var typeRe=/\stype=([\'\"])(.*?)\1/i;var match;while(match=re.exec(html)){var attrs=match[1];var srcMatch=attrs?attrs.match(srcRe):false;if(srcMatch&&srcMatch[2]){var s=document.createElement("script");s.src=srcMatch[2];var typeMatch=attrs.match(typeRe);if(typeMatch&&typeMatch[2]){s.type=typeMatch[2]}hd.appendChild(s)}else{if(match[2]&&match[2].length>0){if(window.execScript){window.execScript(match[2])}else{window.eval(match[2])}}}}var el=document.getElementById(id);if(el){Ext.removeNode(el)}if(typeof callback=="function"){callback()}});dom.innerHTML=html.replace(/(?:)((\n|\r|.)*?)(?:<\/script>)/ig,"");return this},load:function(){var um=this.getUpdater();um.update.apply(um,arguments);return this},getUpdater:function(){if(!this.updateManager){this.updateManager=new Ext.Updater(this)}return this.updateManager},unselectable:function(){this.dom.unselectable="on";this.swallowEvent("selectstart",true);this.applyStyles("-moz-user-select:none;-khtml-user-select:none;");this.addClass("x-unselectable");return this},getCenterXY:function(){return this.getAlignToXY(document,"c-c")},center:function(centerIn){this.alignTo(centerIn||document,"c-c");return this},isBorderBox:function(){return noBoxAdjust[this.dom.tagName.toLowerCase()]||Ext.isBorderBox},getBox:function(contentBox,local){var xy;if(!local){xy=this.getXY()}else{var left=parseInt(this.getStyle("left"),10)||0;var top=parseInt(this.getStyle("top"),10)||0;xy=[left,top]}var el=this.dom,w=el.offsetWidth,h=el.offsetHeight,bx;if(!contentBox){bx={x:xy[0],y:xy[1],0:xy[0],1:xy[1],width:w,height:h}}else{var l=this.getBorderWidth("l")+this.getPadding("l");var r=this.getBorderWidth("r")+this.getPadding("r");var t=this.getBorderWidth("t")+this.getPadding("t");var b=this.getBorderWidth("b")+this.getPadding("b");bx={x:xy[0]+l,y:xy[1]+t,0:xy[0]+l,1:xy[1]+t,width:w-(l+r),height:h-(t+b)}}bx.right=bx.x+bx.width;bx.bottom=bx.y+bx.height;return bx},getFrameWidth:function(sides,onlyContentBox){return onlyContentBox&&Ext.isBorderBox?0:(this.getPadding(sides)+this.getBorderWidth(sides))},setBox:function(box,adjust,animate){var w=box.width,h=box.height;if((adjust&&!this.autoBoxAdjust)&&!this.isBorderBox()){w-=(this.getBorderWidth("lr")+this.getPadding("lr"));h-=(this.getBorderWidth("tb")+this.getPadding("tb"))}this.setBounds(box.x,box.y,w,h,this.preanim(arguments,2));return this},repaint:function(){var dom=this.dom;this.addClass("x-repaint");setTimeout(function(){Ext.get(dom).removeClass("x-repaint")},1);return this},getMargins:function(side){if(!side){return{top:parseInt(this.getStyle("margin-top"),10)||0,left:parseInt(this.getStyle("margin-left"),10)||0,bottom:parseInt(this.getStyle("margin-bottom"),10)||0,right:parseInt(this.getStyle("margin-right"),10)||0}}else{return this.addStyles(side,El.margins)}},addStyles:function(sides,styles){var val=0,v,w;for(var i=0,len=sides.length;i=0?w:-1*w)}}}return val},createProxy:function(config,renderTo,matchBox){config=typeof config=="object"?config:{tag:"div",cls:config};var proxy;if(renderTo){proxy=Ext.DomHelper.append(renderTo,config,true)}else{proxy=Ext.DomHelper.insertBefore(this.dom,config,true)}if(matchBox){proxy.setBox(this.getBox())}return proxy},mask:function(msg,msgCls){if(this.getStyle("position")=="static"){this.setStyle("position","relative")}if(this._maskMsg){this._maskMsg.remove()}if(this._mask){this._mask.remove()}this._mask=Ext.DomHelper.append(this.dom,{cls:"ext-el-mask"},true);this.addClass("x-masked");this._mask.setDisplayed(true);if(typeof msg=="string"){this._maskMsg=Ext.DomHelper.append(this.dom,{cls:"ext-el-mask-msg",cn:{tag:"div"}},true);var mm=this._maskMsg;mm.dom.className=msgCls?"ext-el-mask-msg "+msgCls:"ext-el-mask-msg";mm.dom.firstChild.innerHTML=msg;mm.setDisplayed(true);mm.center(this)}if(Ext.isIE&&!(Ext.isIE7&&Ext.isStrict)&&this.getStyle("height")=="auto"){this._mask.setSize(this.dom.clientWidth,this.getHeight())}return this._mask},unmask:function(){if(this._mask){if(this._maskMsg){this._maskMsg.remove();delete this._maskMsg}this._mask.remove();delete this._mask}this.removeClass("x-masked")},isMasked:function(){return this._mask&&this._mask.isVisible()},createShim:function(){var el=document.createElement("iframe");el.frameBorder="no";el.className="ext-shim";if(Ext.isIE&&Ext.isSecure){el.src=Ext.SSL_SECURE_URL}var shim=Ext.get(this.dom.parentNode.insertBefore(el,this.dom));shim.autoBoxAdjust=false;return shim},remove:function(){Ext.removeNode(this.dom);delete El.cache[this.dom.id]},hover:function(overFn,outFn,scope){var preOverFn=function(e){if(!e.within(this,true)){overFn.apply(scope||this,arguments)}};var preOutFn=function(e){if(!e.within(this,true)){outFn.apply(scope||this,arguments)}};this.on("mouseover",preOverFn,this.dom);this.on("mouseout",preOutFn,this.dom);return this},addClassOnOver:function(className,preventFlicker){this.hover(function(){Ext.fly(this,"_internal").addClass(className)},function(){Ext.fly(this,"_internal").removeClass(className)});return this},addClassOnFocus:function(className){this.on("focus",function(){Ext.fly(this,"_internal").addClass(className)},this.dom);this.on("blur",function(){Ext.fly(this,"_internal").removeClass(className)},this.dom);return this},addClassOnClick:function(className){var dom=this.dom;this.on("mousedown",function(){Ext.fly(dom,"_internal").addClass(className);var d=Ext.getDoc();var fn=function(){Ext.fly(dom,"_internal").removeClass(className);d.removeListener("mouseup",fn)};d.on("mouseup",fn)});return this},swallowEvent:function(eventName,preventDefault){var fn=function(e){e.stopPropagation();if(preventDefault){e.preventDefault()}};if(Ext.isArray(eventName)){for(var i=0,len=eventName.length;idom.clientHeight||dom.scrollWidth>dom.clientWidth},scrollTo:function(side,value,animate){var prop=side.toLowerCase()=="left"?"scrollLeft":"scrollTop";if(!animate||!A){this.dom[prop]=value}else{var to=prop=="scrollLeft"?[value,this.dom.scrollTop]:[this.dom.scrollLeft,value];this.anim({scroll:{"to":to}},this.preanim(arguments,2),"scroll")}return this},scroll:function(direction,distance,animate){if(!this.isScrollable()){return }var el=this.dom;var l=el.scrollLeft,t=el.scrollTop;var w=el.scrollWidth,h=el.scrollHeight;var cw=el.clientWidth,ch=el.clientHeight;direction=direction.toLowerCase();var scrolled=false;var a=this.preanim(arguments,2);switch(direction){case"l":case"left":if(w-l>cw){var v=Math.min(l+distance,w-cw);this.scrollTo("left",v,a);scrolled=true}break;case"r":case"right":if(l>0){var v=Math.max(l-distance,0);this.scrollTo("left",v,a);scrolled=true}break;case"t":case"top":case"up":if(t>0){var v=Math.max(t-distance,0);this.scrollTo("top",v,a);scrolled=true}break;case"b":case"bottom":case"down":if(h-t>ch){var v=Math.min(t+distance,h-ch);this.scrollTo("top",v,a);scrolled=true}break}return scrolled},translatePoints:function(x,y){if(typeof x=="object"||Ext.isArray(x)){y=x[1];x=x[0]}var p=this.getStyle("position");var o=this.getXY();var l=parseInt(this.getStyle("left"),10);var t=parseInt(this.getStyle("top"),10);if(isNaN(l)){l=(p=="relative")?0:this.dom.offsetLeft}if(isNaN(t)){t=(p=="relative")?0:this.dom.offsetTop}return{left:(x-o[0]+l),top:(y-o[1]+t)}},getScroll:function(){var d=this.dom,doc=document;if(d==doc||d==doc.body){var l,t;if(Ext.isIE&&Ext.isStrict){l=doc.documentElement.scrollLeft||(doc.body.scrollLeft||0);t=doc.documentElement.scrollTop||(doc.body.scrollTop||0)}else{l=window.pageXOffset||(doc.body.scrollLeft||0);t=window.pageYOffset||(doc.body.scrollTop||0)}return{left:l,top:t}}else{return{left:d.scrollLeft,top:d.scrollTop}}},getColor:function(attr,defaultValue,prefix){var v=this.getStyle(attr);if(!v||v=="transparent"||v=="inherit"){return defaultValue}var color=typeof prefix=="undefined"?"#":prefix;if(v.substr(0,4)=="rgb("){var rvs=v.slice(4,v.length-1).split(",");for(var i=0;i<3;i++){var h=parseInt(rvs[i]);var s=h.toString(16);if(h<16){s="0"+s}color+=s}}else{if(v.substr(0,1)=="#"){if(v.length==4){for(var i=1;i<4;i++){var c=v.charAt(i);color+=c+c}}else{if(v.length==7){color+=v.substr(1)}}}}return(color.length>5?color.toLowerCase():defaultValue)},boxWrap:function(cls){cls=cls||"x-box";var el=Ext.get(this.insertHtml("beforeBegin",String.format("
    "+El.boxMarkup+"
    ",cls)));el.child("."+cls+"-mc").dom.appendChild(this.dom);return el},getAttributeNS:Ext.isIE?function(ns,name){var d=this.dom;var type=typeof d[ns+":"+name];if(type!="undefined"&&type!="unknown"){return d[ns+":"+name]}return d[name]}:function(ns,name){var d=this.dom;return d.getAttributeNS(ns,name)||d.getAttribute(ns+":"+name)||d.getAttribute(name)||d[name]},getTextWidth:function(text,min,max){return(Ext.util.TextMetrics.measure(this.dom,Ext.value(text,this.dom.innerHTML,true)).width).constrain(min||0,max||1000000)}};var ep=El.prototype;ep.on=ep.addListener;ep.mon=ep.addListener;ep.getUpdateManager=ep.getUpdater;ep.un=ep.removeListener;ep.autoBoxAdjust=true;El.unitPattern=/\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i;El.addUnits=function(v,defaultUnit){if(v===""||v=="auto"){return v}if(v===undefined){return""}if(typeof v=="number"||!El.unitPattern.test(v)){return v+(defaultUnit||"px")}return v};El.boxMarkup="
    ";El.VISIBILITY=1;El.DISPLAY=2;El.borders={l:"border-left-width",r:"border-right-width",t:"border-top-width",b:"border-bottom-width"};El.paddings={l:"padding-left",r:"padding-right",t:"padding-top",b:"padding-bottom"};El.margins={l:"margin-left",r:"margin-right",t:"margin-top",b:"margin-bottom"};El.cache={};var docEl;El.get=function(el){var ex,elm,id;if(!el){return null}if(typeof el=="string"){if(!(elm=document.getElementById(el))){return null}if(ex=El.cache[el]){ex.dom=elm}else{ex=El.cache[el]=new El(elm)}return ex}else{if(el.tagName){if(!(id=el.id)){id=Ext.id(el)}if(ex=El.cache[id]){ex.dom=el}else{ex=El.cache[id]=new El(el)}return ex}else{if(el instanceof El){if(el!=docEl){el.dom=document.getElementById(el.id)||el.dom;El.cache[el.id]=el}return el}else{if(el.isComposite){return el}else{if(Ext.isArray(el)){return El.select(el)}else{if(el==document){if(!docEl){var f=function(){};f.prototype=El.prototype;docEl=new f();docEl.dom=document}return docEl}}}}}}return null};El.uncache=function(el){for(var i=0,a=arguments,len=a.length;i0){F()}else{B.afterFx(D)}})};F.call(this)});return this},pause:function(C){var A=this.getFxEl();var B={};A.queueFx(B,function(){setTimeout(function(){A.afterFx(B)},C*1000)});return this},fadeIn:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){this.setOpacity(0);this.fixDisplay();this.dom.style.visibility="visible";var C=B.endOpacity||1;arguments.callee.anim=this.fxanim({opacity:{to:C}},B,null,0.5,"easeOut",function(){if(C==1){this.clearOpacity()}A.afterFx(B)})});return this},fadeOut:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){arguments.callee.anim=this.fxanim({opacity:{to:B.endOpacity||0}},B,null,0.5,"easeOut",function(){if(this.visibilityMode==Ext.Element.DISPLAY||B.useDisplay){this.dom.style.display="none"}else{this.dom.style.visibility="hidden"}this.clearOpacity();A.afterFx(B)})});return this},scale:function(A,B,C){this.shift(Ext.apply({},C,{width:A,height:B}));return this},shift:function(B){var A=this.getFxEl();B=B||{};A.queueFx(B,function(){var E={},D=B.width,F=B.height,C=B.x,H=B.y,G=B.opacity;if(D!==undefined){E.width={to:this.adjustWidth(D)}}if(F!==undefined){E.height={to:this.adjustHeight(F)}}if(C!==undefined||H!==undefined){E.points={to:[C!==undefined?C:this.getX(),H!==undefined?H:this.getY()]}}if(G!==undefined){E.opacity={to:G}}if(B.xy!==undefined){E.points={to:B.xy}}arguments.callee.anim=this.fxanim(E,B,"motion",0.35,"easeOut",function(){A.afterFx(B)})});return this},ghost:function(A,C){var B=this.getFxEl();C=C||{};B.queueFx(C,function(){A=A||"b";var H=this.getFxRestore();var E=this.getWidth(),G=this.getHeight();var F=this.dom.style;var J=function(){if(C.useDisplay){B.setDisplayed(false)}else{B.hide()}B.clearOpacity();B.setPositioning(H.pos);F.width=H.width;F.height=H.height;B.afterFx(C)};var D={opacity:{to:0},points:{}},I=D.points;switch(A.toLowerCase()){case"t":I.by=[0,-G];break;case"l":I.by=[-E,0];break;case"r":I.by=[E,0];break;case"b":I.by=[0,G];break;case"tl":I.by=[-E,-G];break;case"bl":I.by=[-E,G];break;case"br":I.by=[E,G];break;case"tr":I.by=[E,-G];break}arguments.callee.anim=this.fxanim(D,C,"motion",0.5,"easeOut",J)});return this},syncFx:function(){this.fxDefaults=Ext.apply(this.fxDefaults||{},{block:false,concurrent:true,stopFx:false});return this},sequenceFx:function(){this.fxDefaults=Ext.apply(this.fxDefaults||{},{block:false,concurrent:false,stopFx:false});return this},nextFx:function(){var A=this.fxQueue[0];if(A){A.call(this)}},hasActiveFx:function(){return this.fxQueue&&this.fxQueue[0]},stopFx:function(){if(this.hasActiveFx()){var A=this.fxQueue[0];if(A&&A.anim&&A.anim.isAnimated()){this.fxQueue=[A];A.anim.stop(true)}}return this},beforeFx:function(A){if(this.hasActiveFx()&&!A.concurrent){if(A.stopFx){this.stopFx();return true}return false}return true},hasFxBlock:function(){var A=this.fxQueue;return A&&A[0]&&A[0].block},queueFx:function(C,A){if(!this.fxQueue){this.fxQueue=[]}if(!this.hasFxBlock()){Ext.applyIf(C,this.fxDefaults);if(!C.concurrent){var B=this.beforeFx(C);A.block=C.block;this.fxQueue.push(A);if(B){this.nextFx()}}else{A.call(this)}}return this},fxWrap:function(F,D,C){var B;if(!D.wrap||!(B=Ext.get(D.wrap))){var A;if(D.fixPosition){A=this.getXY()}var E=document.createElement("div");E.style.visibility=C;B=Ext.get(this.dom.parentNode.insertBefore(E,this.dom));B.setPositioning(F);if(B.getStyle("position")=="static"){B.position("relative")}this.clearPositioning("auto");B.clip();B.dom.appendChild(this.dom);if(A){B.setXY(A)}}return B},fxUnwrap:function(A,C,B){this.clearPositioning();this.setPositioning(C);if(!B.wrap){A.dom.parentNode.insertBefore(this.dom,A.dom);A.remove()}},getFxRestore:function(){var A=this.dom.style;return{pos:this.getPositioning(),width:A.width,height:A.height}},afterFx:function(A){if(A.afterStyle){this.applyStyles(A.afterStyle)}if(A.afterCls){this.addClass(A.afterCls)}if(A.remove===true){this.remove()}Ext.callback(A.callback,A.scope,[this]);if(!A.concurrent){this.fxQueue.shift();this.nextFx()}},getFxEl:function(){return Ext.get(this.dom)},fxanim:function(D,E,B,F,C,A){B=B||"run";E=E||{};var G=Ext.lib.Anim[B](this.dom,D,(E.duration||F)||0.35,(E.easing||C)||"easeOut",function(){Ext.callback(A,this)},this);E.anim=G;return G}};Ext.Fx.resize=Ext.Fx.scale;Ext.apply(Ext.Element.prototype,Ext.Fx); +Ext.CompositeElement=function(A){this.elements=[];this.addElements(A)};Ext.CompositeElement.prototype={isComposite:true,addElements:function(E){if(!E){return this}if(typeof E=="string"){E=Ext.Element.selectorFunction(E)}var D=this.elements;var B=D.length-1;for(var C=0,A=E.length;C"+A.text+""}if(typeof A.scripts!="undefined"){this.loadScripts=A.scripts}if(typeof A.timeout!="undefined"){this.timeout=A.timeout}}this.showLoading();if(!D){this.defaultUrl=B}if(typeof B=="function"){B=B.call(this)}G=G||(F?"POST":"GET");if(G=="GET"){B=this.prepareUrl(B)}var E=Ext.apply(A||{},{url:B,params:(typeof F=="function"&&C)?F.createDelegate(C):F,success:this.processSuccess,failure:this.processFailure,scope:this,callback:undefined,timeout:(this.timeout*1000),argument:{"options":A,"url":B,"form":null,"callback":H,"scope":C||window,"params":F}});this.transaction=Ext.Ajax.request(E)}},formUpdate:function(C,A,B,D){if(this.fireEvent("beforeupdate",this.el,C,A)!==false){if(typeof A=="function"){A=A.call(this)}C=Ext.getDom(C);this.transaction=Ext.Ajax.request({form:C,url:A,success:this.processSuccess,failure:this.processFailure,scope:this,timeout:(this.timeout*1000),argument:{"url":A,"form":C,"callback":D,"reset":B}});this.showLoading.defer(1,this)}},refresh:function(A){if(this.defaultUrl==null){return }this.update(this.defaultUrl,null,A,true)},startAutoRefresh:function(B,C,D,E,A){if(A){this.update(C||this.defaultUrl,D,E,true)}if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId)}this.autoRefreshProcId=setInterval(this.update.createDelegate(this,[C||this.defaultUrl,D,E,true]),B*1000)},stopAutoRefresh:function(){if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);delete this.autoRefreshProcId}},isAutoRefreshing:function(){return this.autoRefreshProcId?true:false},showLoading:function(){if(this.showLoadIndicator){this.el.update(this.indicatorText)}},prepareUrl:function(B){if(this.disableCaching){var A="_dc="+(new Date().getTime());if(B.indexOf("?")!==-1){B+="&"+A}else{B+="?"+A}}return B},processSuccess:function(A){this.transaction=null;if(A.argument.form&&A.argument.reset){try{A.argument.form.reset()}catch(B){}}if(this.loadScripts){this.renderer.render(this.el,A,this,this.updateComplete.createDelegate(this,[A]))}else{this.renderer.render(this.el,A,this);this.updateComplete(A)}},updateComplete:function(A){this.fireEvent("update",this.el,A);if(typeof A.argument.callback=="function"){A.argument.callback.call(A.argument.scope,this.el,true,A,A.argument.options)}},processFailure:function(A){this.transaction=null;this.fireEvent("failure",this.el,A);if(typeof A.argument.callback=="function"){A.argument.callback.call(A.argument.scope,this.el,false,A,A.argument.options)}},setRenderer:function(A){this.renderer=A},getRenderer:function(){return this.renderer},setDefaultUrl:function(A){this.defaultUrl=A},abort:function(){if(this.transaction){Ext.Ajax.abort(this.transaction)}},isUpdating:function(){if(this.transaction){return Ext.Ajax.isLoading(this.transaction)}return false}});Ext.Updater.defaults={timeout:30,loadScripts:false,sslBlankUrl:(Ext.SSL_SECURE_URL||"javascript:false"),disableCaching:false,showLoadIndicator:true,indicatorText:"
    Loading...
    "};Ext.Updater.updateElement=function(D,C,E,B){var A=Ext.get(D).getUpdater();Ext.apply(A,B);A.update(C,E,B?B.callback:null)};Ext.Updater.update=Ext.Updater.updateElement;Ext.Updater.BasicRenderer=function(){};Ext.Updater.BasicRenderer.prototype={render:function(C,A,B,D){C.update(A.responseText,B.loadScripts,D)}};Ext.UpdateManager=Ext.Updater; +Ext.util.DelayedTask=function(E,D,A){var G=null,F,B;var C=function(){var H=new Date().getTime();if(H-B>=F){clearInterval(G);G=null;E.apply(D,A||[])}};this.delay=function(I,K,J,H){if(G&&I!=F){this.cancel()}F=I;B=new Date().getTime();E=K||E;D=J||D;A=H||A;if(!G){G=setInterval(C,F)}};this.cancel=function(){if(G){clearInterval(G);G=null}}}; diff --git a/src/gquery/public/jquery-1.2.3.js b/src/gquery/public/jquery-1.2.3.js new file mode 100644 index 00000000..ff25a2e1 --- /dev/null +++ b/src/gquery/public/jquery-1.2.3.js @@ -0,0 +1,3408 @@ +(function(){ +/* + * jQuery 1.2.3 - New Wave Javascript + * + * Copyright (c) 2008 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2008-02-06 00:21:25 -0500 (Wed, 06 Feb 2008) $ + * $Rev: 4663 $ + */ + +// Map over jQuery in case of overwrite +if ( window.jQuery ) + var _jQuery = window.jQuery; + +var jQuery = window.jQuery = function( selector, context ) { + // The jQuery object is actually just the init constructor 'enhanced' + return new jQuery.prototype.init( selector, context ); +}; + +// Map over the $ in case of overwrite +if ( window.$ ) + var _$ = window.$; + +// Map the jQuery namespace to the '$' one +window.$ = jQuery; + +// A simple way to check for HTML strings or ID strings +// (both of which we optimize for) +var quickExpr = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/; + +// Is it a simple selector +var isSimple = /^.[^:#\[\.]*$/; + +jQuery.fn = jQuery.prototype = { + init: function( selector, context ) { + // Make sure that a selection was provided + selector = selector || document; + + // Handle $(DOMElement) + if ( selector.nodeType ) { + this[0] = selector; + this.length = 1; + return this; + + // Handle HTML strings + } else if ( typeof selector == "string" ) { + // Are we dealing with HTML string or an ID? + var match = quickExpr.exec( selector ); + + // Verify a match, and that no context was specified for #id + if ( match && (match[1] || !context) ) { + + // HANDLE: $(html) -> $(array) + if ( match[1] ) + selector = jQuery.clean( [ match[1] ], context ); + + // HANDLE: $("#id") + else { + var elem = document.getElementById( match[3] ); + + // Make sure an element was located + if ( elem ) + // Handle the case where IE and Opera return items + // by name instead of ID + if ( elem.id != match[3] ) + return jQuery().find( selector ); + + // Otherwise, we inject the element directly into the jQuery object + else { + this[0] = elem; + this.length = 1; + return this; + } + + else + selector = []; + } + + // HANDLE: $(expr, [context]) + // (which is just equivalent to: $(content).find(expr) + } else + return new jQuery( context ).find( selector ); + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( jQuery.isFunction( selector ) ) + return new jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector ); + + return this.setArray( + // HANDLE: $(array) + selector.constructor == Array && selector || + + // HANDLE: $(arraylike) + // Watch for when an array-like object, contains DOM nodes, is passed in as the selector + (selector.jquery || selector.length && selector != window && !selector.nodeType && selector[0] != undefined && selector[0].nodeType) && jQuery.makeArray( selector ) || + + // HANDLE: $(*) + [ selector ] ); + }, + + // The current version of jQuery being used + jquery: "1.2.3", + + // The number of elements contained in the matched element set + size: function() { + return this.length; + }, + + // The number of elements contained in the matched element set + length: 0, + + // 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 == undefined ? + + // Return a 'clean' array + jQuery.makeArray( this ) : + + // Return just the object + 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( elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Force the current matched set of elements to become + // the specified array of elements (destroying the stack in the process) + // You should use pushStack() in order to do this, but maintain the stack + setArray: function( elems ) { + // Resetting the length to 0, then using the native Array push + // is a super-fast way to populate an object with array-like properties + this.length = 0; + Array.prototype.push.apply( this, elems ); + + return this; + }, + + // 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 ); + }, + + // Determine the position of an element within + // the matched set of elements + index: function( elem ) { + var ret = -1; + + // Locate the position of the desired element + this.each(function(i){ + if ( this == elem ) + ret = i; + }); + + return ret; + }, + + attr: function( name, value, type ) { + var options = name; + + // Look for the case where we're accessing a style value + if ( name.constructor == String ) + if ( value == undefined ) + return this.length && jQuery[ type || "attr" ]( this[0], name ) || undefined; + + else { + options = {}; + options[ name ] = value; + } + + // Check to see if we're setting style values + return this.each(function(i){ + // Set all the styles + for ( name in options ) + jQuery.attr( + type ? + this.style : + this, + name, jQuery.prop( this, options[ name ], type, i, name ) + ); + }); + }, + + css: function( key, value ) { + // ignore negative width and height values + if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 ) + value = undefined; + return this.attr( key, value, "curCSS" ); + }, + + text: function( text ) { + if ( typeof text != "object" && text != null ) + return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); + + var ret = ""; + + jQuery.each( text || this, function(){ + jQuery.each( this.childNodes, function(){ + if ( this.nodeType != 8 ) + ret += this.nodeType != 1 ? + this.nodeValue : + jQuery.fn.text( [ this ] ); + }); + }); + + return ret; + }, + + wrapAll: function( html ) { + if ( this[0] ) + // The elements to wrap the target around + jQuery( html, this[0].ownerDocument ) + .clone() + .insertBefore( this[0] ) + .map(function(){ + var elem = this; + + while ( elem.firstChild ) + elem = elem.firstChild; + + return elem; + }) + .append(this); + + return this; + }, + + wrapInner: function( html ) { + return this.each(function(){ + jQuery( this ).contents().wrapAll( html ); + }); + }, + + wrap: function( html ) { + return this.each(function(){ + jQuery( this ).wrapAll( html ); + }); + }, + + append: function() { + return this.domManip(arguments, true, false, function(elem){ + if (this.nodeType == 1) + this.appendChild( elem ); + }); + }, + + prepend: function() { + return this.domManip(arguments, true, true, function(elem){ + if (this.nodeType == 1) + this.insertBefore( elem, this.firstChild ); + }); + }, + + before: function() { + return this.domManip(arguments, false, false, function(elem){ + this.parentNode.insertBefore( elem, this ); + }); + }, + + after: function() { + return this.domManip(arguments, false, true, function(elem){ + this.parentNode.insertBefore( elem, this.nextSibling ); + }); + }, + + end: function() { + return this.prevObject || jQuery( [] ); + }, + + find: function( selector ) { + var elems = jQuery.map(this, function(elem){ + return jQuery.find( selector, elem ); + }); + + return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ? + jQuery.unique( elems ) : + elems ); + }, + + clone: function( events ) { + // Do the clone + var ret = this.map(function(){ + if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) { + // IE copies events bound via attachEvent when + // using cloneNode. Calling detachEvent on the + // clone will also remove the events from the orignal + // In order to get around this, we use innerHTML. + // Unfortunately, this means some modifications to + // attributes in IE that are actually only stored + // as properties will not be copied (such as the + // the name attribute on an input). + var clone = this.cloneNode(true), + container = document.createElement("div"); + container.appendChild(clone); + return jQuery.clean([container.innerHTML])[0]; + } else + return this.cloneNode(true); + }); + + // Need to set the expando to null on the cloned set if it exists + // removeData doesn't work here, IE removes it from the original as well + // this is primarily for IE but the data expando shouldn't be copied over in any browser + var clone = ret.find("*").andSelf().each(function(){ + if ( this[ expando ] != undefined ) + this[ expando ] = null; + }); + + // Copy the events from the original to the clone + if ( events === true ) + this.find("*").andSelf().each(function(i){ + if (this.nodeType == 3) + return; + var events = jQuery.data( this, "events" ); + + for ( var type in events ) + for ( var handler in events[ type ] ) + jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data ); + }); + + // Return the cloned set + return ret; + }, + + filter: function( selector ) { + return this.pushStack( + jQuery.isFunction( selector ) && + jQuery.grep(this, function(elem, i){ + return selector.call( elem, i ); + }) || + + jQuery.multiFilter( selector, this ) ); + }, + + not: function( selector ) { + if ( selector.constructor == String ) + // test special case where just one selector is passed in + if ( isSimple.test( selector ) ) + return this.pushStack( jQuery.multiFilter( selector, this, true ) ); + else + selector = jQuery.multiFilter( selector, this ); + + var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType; + return this.filter(function() { + return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector; + }); + }, + + add: function( selector ) { + return !selector ? this : this.pushStack( jQuery.merge( + this.get(), + selector.constructor == String ? + jQuery( selector ).get() : + selector.length != undefined && (!selector.nodeName || jQuery.nodeName(selector, "form")) ? + selector : [selector] ) ); + }, + + is: function( selector ) { + return selector ? + jQuery.multiFilter( selector, this ).length > 0 : + false; + }, + + hasClass: function( selector ) { + return this.is( "." + selector ); + }, + + val: function( value ) { + if ( value == undefined ) { + + if ( this.length ) { + var elem = this[0]; + + // We need to handle select boxes special + if ( jQuery.nodeName( elem, "select" ) ) { + var index = elem.selectedIndex, + values = [], + options = elem.options, + one = elem.type == "select-one"; + + // Nothing was selected + if ( index < 0 ) + return null; + + // Loop through all the selected options + for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { + var option = options[ i ]; + + if ( option.selected ) { + // Get the specifc value for the option + value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value; + + // We don't need an array for one selects + if ( one ) + return value; + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + + // Everything else, we just grab the value + } else + return (this[0].value || "").replace(/\r/g, ""); + + } + + return undefined; + } + + return this.each(function(){ + if ( this.nodeType != 1 ) + return; + + if ( value.constructor == Array && /radio|checkbox/.test( this.type ) ) + this.checked = (jQuery.inArray(this.value, value) >= 0 || + jQuery.inArray(this.name, value) >= 0); + + else if ( jQuery.nodeName( this, "select" ) ) { + var values = value.constructor == Array ? + value : + [ value ]; + + jQuery( "option", this ).each(function(){ + this.selected = (jQuery.inArray( this.value, values ) >= 0 || + jQuery.inArray( this.text, values ) >= 0); + }); + + if ( !values.length ) + this.selectedIndex = -1; + + } else + this.value = value; + }); + }, + + html: function( value ) { + return value == undefined ? + (this.length ? + this[0].innerHTML : + null) : + this.empty().append( value ); + }, + + replaceWith: function( value ) { + return this.after( value ).remove(); + }, + + eq: function( i ) { + return this.slice( i, i + 1 ); + }, + + slice: function() { + return this.pushStack( Array.prototype.slice.apply( this, arguments ) ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map(this, function(elem, i){ + return callback.call( elem, i, elem ); + })); + }, + + andSelf: function() { + return this.add( this.prevObject ); + }, + + data: function( key, value ){ + var parts = key.split("."); + parts[1] = parts[1] ? "." + parts[1] : ""; + + if ( value == null ) { + var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); + + if ( data == undefined && this.length ) + data = jQuery.data( this[0], key ); + + return data == null && parts[1] ? + this.data( parts[0] ) : + data; + } else + return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){ + jQuery.data( this, key, value ); + }); + }, + + removeData: function( key ){ + return this.each(function(){ + jQuery.removeData( this, key ); + }); + }, + + domManip: function( args, table, reverse, callback ) { + var clone = this.length > 1, elems; + + return this.each(function(){ + if ( !elems ) { + elems = jQuery.clean( args, this.ownerDocument ); + + if ( reverse ) + elems.reverse(); + } + + var obj = this; + + if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) ) + obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") ); + + var scripts = jQuery( [] ); + + jQuery.each(elems, function(){ + var elem = clone ? + jQuery( this ).clone( true )[0] : + this; + + // execute all scripts after the elements have been injected + if ( jQuery.nodeName( elem, "script" ) ) { + scripts = scripts.add( elem ); + } else { + // Remove any inner scripts for later evaluation + if ( elem.nodeType == 1 ) + scripts = scripts.add( jQuery( "script", elem ).remove() ); + + // Inject the elements into the document + callback.call( obj, elem ); + } + }); + + scripts.each( evalScript ); + }); + } +}; + +// Give the init function the jQuery prototype for later instantiation +jQuery.prototype.init.prototype = jQuery.prototype; + +function evalScript( i, elem ) { + if ( elem.src ) + jQuery.ajax({ + url: elem.src, + async: false, + dataType: "script" + }); + + else + jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); + + if ( elem.parentNode ) + elem.parentNode.removeChild( elem ); +} + +jQuery.extend = jQuery.fn.extend = function() { + // copy reference to target object + var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options; + + // Handle a deep copy situation + if ( target.constructor == 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" && typeof target != "function" ) + target = {}; + + // extend jQuery itself if only one argument is passed + if ( length == 1 ) { + target = this; + i = 0; + } + + for ( ; i < length; i++ ) + // Only deal with non-null/undefined values + if ( (options = arguments[ i ]) != null ) + // Extend the base object + for ( var name in options ) { + // Prevent never-ending loop + if ( target === options[ name ] ) + continue; + + // Recurse if we're merging object values + if ( deep && options[ name ] && typeof options[ name ] == "object" && target[ name ] && !options[ name ].nodeType ) + target[ name ] = jQuery.extend( target[ name ], options[ name ] ); + + // Don't bring in undefined values + else if ( options[ name ] != undefined ) + target[ name ] = options[ name ]; + + } + + // Return the modified object + return target; +}; + +var expando = "jQuery" + (new Date()).getTime(), uuid = 0, windowData = {}; + +// exclude the following css properties to add px +var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i; + +jQuery.extend({ + noConflict: function( deep ) { + window.$ = _$; + + if ( deep ) + window.jQuery = _jQuery; + + return jQuery; + }, + + // See test/unit/core.js for details concerning this function. + isFunction: function( fn ) { + return !!fn && typeof fn != "string" && !fn.nodeName && + fn.constructor != Array && /function/i.test( fn + "" ); + }, + + // check if an element is in a (or is an) XML document + isXMLDoc: function( elem ) { + return elem.documentElement && !elem.body || + elem.tagName && elem.ownerDocument && !elem.ownerDocument.body; + }, + + // Evalulates a script in a global context + globalEval: function( data ) { + data = jQuery.trim( data ); + + if ( data ) { + // Inspired by code by Andrea Giammarchi + // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html + var head = document.getElementsByTagName("head")[0] || document.documentElement, + script = document.createElement("script"); + + script.type = "text/javascript"; + if ( jQuery.browser.msie ) + script.text = data; + else + script.appendChild( document.createTextNode( data ) ); + + head.appendChild( script ); + head.removeChild( script ); + } + }, + + nodeName: function( elem, name ) { + return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase(); + }, + + cache: {}, + + data: function( elem, name, data ) { + elem = elem == window ? + windowData : + elem; + + var id = elem[ expando ]; + + // Compute a unique ID for the element + if ( !id ) + id = elem[ expando ] = ++uuid; + + // Only generate the data cache if we're + // trying to access or manipulate it + if ( name && !jQuery.cache[ id ] ) + jQuery.cache[ id ] = {}; + + // Prevent overriding the named cache with undefined values + if ( data != undefined ) + jQuery.cache[ id ][ name ] = data; + + // Return the named cache data, or the ID for the element + return name ? + jQuery.cache[ id ][ name ] : + id; + }, + + removeData: function( elem, name ) { + elem = elem == window ? + windowData : + elem; + + var id = elem[ expando ]; + + // If we want to remove a specific section of the element's data + if ( name ) { + if ( jQuery.cache[ id ] ) { + // Remove the section of cache data + delete jQuery.cache[ id ][ name ]; + + // If we've removed all the data, remove the element's cache + name = ""; + + for ( name in jQuery.cache[ id ] ) + break; + + if ( !name ) + jQuery.removeData( elem ); + } + + // Otherwise, we want to remove all of the element's data + } else { + // Clean up the element expando + try { + delete elem[ expando ]; + } catch(e){ + // IE has trouble directly removing the expando + // but it's ok with using removeAttribute + if ( elem.removeAttribute ) + elem.removeAttribute( expando ); + } + + // Completely remove the data cache + delete jQuery.cache[ id ]; + } + }, + + // args is for internal usage only + each: function( object, callback, args ) { + if ( args ) { + if ( object.length == undefined ) { + for ( var name in object ) + if ( callback.apply( object[ name ], args ) === false ) + break; + } else + for ( var i = 0, length = object.length; i < length; i++ ) + if ( callback.apply( object[ i ], args ) === false ) + break; + + // A special, fast, case for the most common use of each + } else { + if ( object.length == undefined ) { + for ( var name in object ) + if ( callback.call( object[ name ], name, object[ name ] ) === false ) + break; + } else + for ( var i = 0, length = object.length, value = object[0]; + i < length && callback.call( value, i, value ) !== false; value = object[++i] ){} + } + + return object; + }, + + prop: function( elem, value, type, i, name ) { + // Handle executable functions + if ( jQuery.isFunction( value ) ) + value = value.call( elem, i ); + + // Handle passing in a number to a CSS property + return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ? + value + "px" : + value; + }, + + className: { + // internal only, use addClass("class") + add: function( elem, classNames ) { + jQuery.each((classNames || "").split(/\s+/), function(i, className){ + if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) ) + elem.className += (elem.className ? " " : "") + className; + }); + }, + + // internal only, use removeClass("class") + remove: function( elem, classNames ) { + if (elem.nodeType == 1) + elem.className = classNames != undefined ? + jQuery.grep(elem.className.split(/\s+/), function(className){ + return !jQuery.className.has( classNames, className ); + }).join(" ") : + ""; + }, + + // internal only, use is(".class") + has: function( elem, className ) { + return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1; + } + }, + + // A method for quickly swapping in/out CSS properties to get correct calculations + swap: function( elem, options, callback ) { + var old = {}; + // Remember the old values, and insert the new ones + for ( var name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + callback.call( elem ); + + // Revert the old values + for ( var name in options ) + elem.style[ name ] = old[ name ]; + }, + + css: function( elem, name, force ) { + if ( name == "width" || name == "height" ) { + var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ]; + + function getWH() { + val = name == "width" ? elem.offsetWidth : elem.offsetHeight; + var padding = 0, border = 0; + jQuery.each( which, function() { + padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0; + border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0; + }); + val -= Math.round(padding + border); + } + + if ( jQuery(elem).is(":visible") ) + getWH(); + else + jQuery.swap( elem, props, getWH ); + + return Math.max(0, val); + } + + return jQuery.curCSS( elem, name, force ); + }, + + curCSS: function( elem, name, force ) { + var ret; + + // A helper method for determining if an element's values are broken + function color( elem ) { + if ( !jQuery.browser.safari ) + return false; + + var ret = document.defaultView.getComputedStyle( elem, null ); + return !ret || ret.getPropertyValue("color") == ""; + } + + // We need to handle opacity special in IE + if ( name == "opacity" && jQuery.browser.msie ) { + ret = jQuery.attr( elem.style, "opacity" ); + + return ret == "" ? + "1" : + ret; + } + // Opera sometimes will give the wrong display answer, this fixes it, see #2037 + if ( jQuery.browser.opera && name == "display" ) { + var save = elem.style.outline; + elem.style.outline = "0 solid black"; + elem.style.outline = save; + } + + // Make sure we're using the right name for getting the float value + if ( name.match( /float/i ) ) + name = styleFloat; + + if ( !force && elem.style && elem.style[ name ] ) + ret = elem.style[ name ]; + + else if ( document.defaultView && document.defaultView.getComputedStyle ) { + + // Only "float" is needed here + if ( name.match( /float/i ) ) + name = "float"; + + name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase(); + + var getComputedStyle = document.defaultView.getComputedStyle( elem, null ); + + if ( getComputedStyle && !color( elem ) ) + ret = getComputedStyle.getPropertyValue( name ); + + // If the element isn't reporting its values properly in Safari + // then some display: none elements are involved + else { + var swap = [], stack = []; + + // Locate all of the parent display: none elements + for ( var a = elem; a && color(a); a = a.parentNode ) + stack.unshift(a); + + // Go through and make them visible, but in reverse + // (It would be better if we knew the exact display type that they had) + for ( var i = 0; i < stack.length; i++ ) + if ( color( stack[ i ] ) ) { + swap[ i ] = stack[ i ].style.display; + stack[ i ].style.display = "block"; + } + + // Since we flip the display style, we have to handle that + // one special, otherwise get the value + ret = name == "display" && swap[ stack.length - 1 ] != null ? + "none" : + ( getComputedStyle && getComputedStyle.getPropertyValue( name ) ) || ""; + + // Finally, revert the display styles back + for ( var i = 0; i < swap.length; i++ ) + if ( swap[ i ] != null ) + stack[ i ].style.display = swap[ i ]; + } + + // We should always get a number back from opacity + if ( name == "opacity" && ret == "" ) + ret = "1"; + + } else if ( elem.currentStyle ) { + var camelCase = name.replace(/\-(\w)/g, function(all, letter){ + return letter.toUpperCase(); + }); + + ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ]; + + // 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 + if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) { + // Remember the original values + var style = elem.style.left, runtimeStyle = elem.runtimeStyle.left; + + // Put in the new values to get a computed value out + elem.runtimeStyle.left = elem.currentStyle.left; + elem.style.left = ret || 0; + ret = elem.style.pixelLeft + "px"; + + // Revert the changed values + elem.style.left = style; + elem.runtimeStyle.left = runtimeStyle; + } + } + + return ret; + }, + + clean: function( elems, context ) { + var ret = []; + context = context || document; + // !context.createElement fails in IE with an error but returns typeof 'object' + if (typeof context.createElement == 'undefined') + context = context.ownerDocument || context[0] && context[0].ownerDocument || document; + + jQuery.each(elems, function(i, elem){ + if ( !elem ) + return; + + if ( elem.constructor == Number ) + elem = elem.toString(); + + // Convert html string into DOM nodes + if ( typeof elem == "string" ) { + // Fix "XHTML"-style tags in all browsers + elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){ + return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ? + all : + front + ">"; + }); + + // Trim whitespace, otherwise indexOf won't work as expected + var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div"); + + var wrap = + // option or optgroup + !tags.indexOf("", "" ] || + + !tags.indexOf("", "" ] || + + tags.match(/^<(thead|tbody|tfoot|colg|cap)/) && + [ 1, "", "
    " ] || + + !tags.indexOf("", "" ] || + + // matched above + (!tags.indexOf("", "" ] || + + !tags.indexOf("", "" ] || + + // IE can't serialize and