public static void InitFullHeightGridPage(jQueryObject gridDiv) { J("body") .AddClass("full-height-page"); jQueryEventHandler layout = delegate { if (gridDiv.Parent().HasClass("page-content")) { gridDiv.CSS("height", "1px") .CSS("overflow", "hidden"); } Q.LayoutFillHeight(gridDiv); gridDiv.TriggerHandler("layout"); }; if (Window.Instance.As <dynamic>().Metronic != null) { Window.Instance.As <dynamic>().Metronic.addResizeHandler(layout); } else { } //jQuery.Window.Resize(layout); layout(null); }
public static void AddFullHeightResizeHandler(Action<int> handler) { J("body") .AddClass("full-height-page"); jQueryEventHandler layout = delegate { int avail; try { avail = int.Parse(J(".page-content").GetCSS("min-height") ?? "0") - int.Parse(J(".page-content").GetCSS("padding-top") ?? "0") - int.Parse(J(".page-content").GetCSS("padding-bottom") ?? "0"); } catch { avail = 100; } handler(avail); }; if (Window.Instance.As<dynamic>().Metronic != null) Window.Instance.As<dynamic>().Metronic.addResizeHandler(layout); else { jQuery.Window.Resize(layout); } layout(null); }
public override void Init(System.Html.Element element, Func <object> valueAccessor, Func <System.Collections.Dictionary> allBindingsAccessor, object viewModel, object context) { // Get the text box element jQueryObject select = jQuery.FromElement(element).Find(".sparkle-input-optionset-part"); jQueryEventHandler onChangeHandler = delegate(jQueryEvent e) { Observable <OptionSetValue> observable = (Observable <OptionSetValue>)valueAccessor(); string newValue = select.GetValue(); int? newValueInt = null; if (!String.IsNullOrEmpty(newValue)) { newValueInt = int.Parse(newValue); } // Set the optionset value OptionSetValue newValueOptionSetValue = new OptionSetValue(newValueInt); newValueOptionSetValue.Name = select.Find("option:selected").GetText(); observable.SetValue(newValueOptionSetValue); }; select.Change(onChangeHandler); allBindingsAccessor()["optionsValue"] = "value"; allBindingsAccessor()["optionsText"] = "name"; OptionSetBindingOptions optionSetOptions = (OptionSetBindingOptions)((object)allBindingsAccessor()["optionSetOptions"]); // Create a value accessor for the optionset options Func <List <OptionSetItem> > optionsValueAccessor = delegate() { return(MetadataCache.GetOptionSetValues(optionSetOptions.entityLogicalName, optionSetOptions.attributeLogicalName, optionSetOptions.allowEmpty)); }; Script.Literal("ko.bindingHandlers.options.update({0},{1},{2},{3},{4})", select.GetElement(0), optionsValueAccessor, allBindingsAccessor, viewModel, context); //Script.Literal("return { controlsDescendantBindings: true };"); }
public FilterDisplayBar(jQueryObject div) : base(div, null) { this.Element.Find(".cap").Text(Q.Text("Controls.FilterPanel.EffectiveFilter")); this.Element.Find(".edit").Text(Q.Text("Controls.FilterPanel.EditFilter")); this.Element.Find(".reset").Attribute("title", Q.Text("Controls.FilterPanel.ResetFilterHint")); jQueryEventHandler openFilterDialog = delegate(jQueryEvent e) { e.PreventDefault(); var dialog = new FilterDialog(); dialog.FilterPanel.Store = this.Store; dialog.DialogOpen(); }; this.Element.Find(".edit").Click(openFilterDialog); this.Element.Find(".txt").Click(openFilterDialog); this.Element.Find(".reset").Click(e => { e.PreventDefault(); this.Store.Items.Clear(); this.Store.RaiseChanged(); }); }
[IncludeGenericArguments(false)] // saltarelle bug ı var, değiştirme public static void ChangeSelect2 <TWidget>(this TWidget widget, jQueryEventHandler handler) where TWidget : Widget { widget.Element.Bind2("change." + widget.UniqueName, (e, x) => { if (e.HasOriginalEvent() || Q.IsFalse(x)) { handler(e); } }); }
public static void AttachKeyPressHandler(Element el, jQueryEventHandler handler) { // return, escape, F1-F12 // http://www.quirksmode.org/js/keys.html. var jq = jQuery.FromElement(el); jq.Keydown(handler); if (jQuery.Browser.MSIE && (jQuery.Browser.Version == "6.0" || jQuery.Browser.Version == "7.0")) { jq.Keypress(delegate(jQueryEvent e) { if (e.Which == 13 || e.Which == 27 || (e.Which >= 112 && e.Which <= 123)) handler(e); }); } }
public Grid(object config) { dragFeedbackHandler = new jQueryEventHandler(ValuesDiv_DragFeedback); if (!Script.IsUndefined(config)) { InitConfig(JsDictionary.GetDictionary(config)); } else { InitDefault(); } }
public static void AttachKeyPressHandler(Element el, jQueryEventHandler handler) { // return, escape, F1-F12 // http://www.quirksmode.org/js/keys.html. var jq = jQuery.FromElement(el); jq.Keydown(handler); if (jQuery.Browser.MSIE && (jQuery.Browser.Version == "6.0" || jQuery.Browser.Version == "7.0")) { jq.Keypress(delegate(jQueryEvent e) { if (e.Which == 13 || e.Which == 27 || (e.Which >= 112 && e.Which <= 123)) { handler(e); } }); } }
public static void ExecuteEverytimeWhenShown(jQueryObject element, Action callback, bool callNowIfVisible) { autoIncrement++; string eventClass = "ExecuteEverytimeWhenShown" + autoIncrement; bool wasVisible = element.Is(":visible"); if (wasVisible && callNowIfVisible) { callback(); } jQueryEventHandler check = delegate(jQueryEvent e) { if (element.Is(":visible")) { if (!wasVisible) { wasVisible = true; callback(); } } else { wasVisible = false; } }; var uiTabs = element.Closest(".ui-tabs"); if (uiTabs.Length > 0) { uiTabs.Bind("tabsactivate." + eventClass, check); } var dialog = element.Closest(".ui-dialog-content"); if (dialog.Length > 0) { dialog.Bind("dialogopen." + eventClass, check); } element.Bind("shown." + eventClass, check); }
public override void Init(System.Html.Element element, Func <object> valueAccessor, Func <System.Collections.Dictionary> allBindingsAccessor, object viewModel, object context) { // Get the text box element jQueryObject textBox = jQuery.FromElement(element).Find(".sparkle-input-textbox-part"); NumberFormatInfo format = GetNumberFormatInfo(allBindingsAccessor); jQueryEventHandler onChangeHandler = delegate(jQueryEvent e) { Observable <string> observable = (Observable <string>)valueAccessor(); string newValue = textBox.GetValue(); TrySetObservable(valueAccessor, textBox, newValue, format); }; textBox.Change(onChangeHandler); // Stop further binding //Script.Literal("return { controlsDescendantBindings: true };"); }
public static void InitFullHeightGridPage(jQueryObject gridDiv) { J("body") .AddClass("full-height-page"); gridDiv.AddClass("responsive-height"); jQueryEventHandler layout = delegate { bool inPageContent = gridDiv.Parent().HasClass("page-content") || gridDiv.Parent().Is("section.content"); if (inPageContent) { gridDiv.CSS("height", "1px") .CSS("overflow", "hidden"); } Q.LayoutFillHeight(gridDiv); if (inPageContent) { gridDiv.CSS("overflow", ""); } gridDiv.TriggerHandler("layout"); }; if (J("body").HasClass("has-layout-event")) { J("body").Bind("layout", layout); } else if (Window.Instance.As <dynamic>().Metronic != null) { Window.Instance.As <dynamic>().Metronic.addResizeHandler(layout); } else { jQuery.Window.Resize(layout); } layout(null); }
public void Attach() { if (id == null || isAttached) { throw new Exception("Must set ID and can only attach once"); } isAttached = true; UIUtils.FixStrangeIE7SelectIssue(GetElement().Children[SelectedTab + 1]); clickHandler = new jQueryEventHandler(Delegate.ThisFix((Action <Element, jQueryEvent>)Link_Click)); Element elem = GetElement(); ElementCollection children = elem.Children; for (int i = 0; i < tabCaptions.Length; i++) { if (i != selectedTab) { children[i + 1].Style.Display = "none"; } } var links = new List <Element>(); ElementCollection lis = children[0].Children[0].Children; for (int i = 0; i < lis.Length; i++) { links.Add(lis[i].Children[0]); } jQuery.FromElements((Element[])links).Click(clickHandler); if (jQuery.Browser.MSIE && Utils.ParseDouble(jQuery.Browser.Version) < 8) { elem.Style.Width = children[1].ClientWidth + "px"; } }
/// <summary> /// Attaches a handler for handling the specified event once on the matched set of elements. /// </summary> /// <param name="eventName">The name of the event.</param> /// <param name="eventData">Any data that needs to be passed to the event handler.</param> /// <param name="eventHandler">The event handler to be invoked.</param> /// <returns></returns> public jElement one(string eventName, JsDictionary eventData, jQueryEventHandler eventHandler) { return null; }
[IncludeGenericArguments(false)] // saltarelle bug ı var, değiştirme public static void Change <TWidget>(this TWidget widget, jQueryEventHandler handler) where TWidget : Widget { widget.Element.Bind("change." + widget.UniqueName, handler); }
/// <summary> /// Attaches an event handler function for one or more events to the selected elements. /// </summary> /// <param name="eventName">The name of the event</param> /// <param name="selector">A selector string to filter the descendants of the selected elements that trigger the event.</param> /// <param name="data">A custom data structure to be passed to the handler</param> /// <param name="eventHandler">The event handler to be invoked</param> /// <returns>The current jElement.</returns> public jElement on(string eventName, string selector, object data, jQueryEventHandler eventHandler) { return null; }
/// <summary> /// Attaches a handler for the handling the specified event once on the matched /// set of elements. /// </summary> /// <param name="eventName">The name of the event.</param> /// <param name="eventHandler">The event handler to be invoked.</param> /// <returns></returns> public jElement one(string eventName, jQueryEventHandler eventHandler) { return null; }
public void Unbind(string eventName, jQueryEventHandler callback) { }
/// <summary> /// Removes an event handler which has been created by called On() /// </summary> /// <param name="events">One or more space-separated event types and optional namespaces</param> /// <param name="selector">A selector which should match the one originally passed to On()</param> /// <param name="eventHandler">A handler function previously attached for the event(s)</param> /// <returns>The current jElement.</returns> public jElement off(string events, string selector, jQueryEventHandler eventHandler) { return null; }
public Tree(object config) { dragFeedbackHandler = new jQueryEventHandler(Element_DragFeedback); if (!Script.IsUndefined(config)) { InitConfig(JsDictionary.GetDictionary(config)); } else InitDefault(); }
public void OnClick(jQueryEventHandler e) { jQueryApi.jQuery.FromElement(ControlContainer).Click(e); }
public static jQueryObject ScrollPagerPlugin(ScrollPagerPluginOptions customOptions) { ScrollPagerPluginOptions defaultOptions = new ScrollPagerPluginOptions(); defaultOptions.pageSize = 10; defaultOptions.currentPage = 1; defaultOptions.holder = ".listcontainer"; defaultOptions.viewport = ""; defaultOptions.pageHeight = 23; defaultOptions.onPageChanged = null; defaultOptions.container = "#listcontainerdiv"; ScrollPagerPluginOptions options = jQuery.ExtendObject <ScrollPagerPluginOptions>(new ScrollPagerPluginOptions(), defaultOptions, customOptions); return(jQuery.Current.Each(delegate(int i, Element element) { jQueryObject selector = jQuery.This; int pageCounter = 1; PositionInfo iPosition = new PositionInfo(); MouseInfo iMouse = new MouseInfo(); Number candidatePageIndex = 0; //this goes through every item in the selector .Children() .Each(delegate(int ic, Element elc) { if (ic < pageCounter * options.pageSize && ic >= (pageCounter - 1) * options.pageSize) { jQuery.This.AddClass("page" + pageCounter); } else { jQuery.This.AddClass("page" + (pageCounter + 1)); pageCounter++; } }); //set and default the slider item height int contHeight = jQuery.Select(options.container).GetHeight(); int sliderItemHeight = contHeight; //show/hide the appropriate regions selector.Children().Hide(); jQuery.Select(".page" + options.currentPage).Show(); //more than one page? if (pageCounter > 1) { //calculate the slider item height sliderItemHeight = (contHeight / pageCounter); //Build pager navigation string pageNav = "<UL class=scrollbar sizcache='4' sizset='13'>"; for (i = 1; i <= pageCounter; i++) { if (i == options.currentPage) { pageNav += "<LI class='currentPage pageItem' sizcache='4' sizset='13'><A class='sliderPage' href='#' rel='" + i + "'></A>"; } else { pageNav += "<LI class='pageNav" + i + " pageItem' sizcache='4' sizset='14'><A class='sliderPage' href='#' rel='" + i + "'></A>"; } } //Create slider item string sliderItem = "<LI class='thumb' sizcache='4' sizset='13' style='top:" + (options.currentPage - 1) * sliderItemHeight + "; height:" + (sliderItemHeight - 3) + "'><A class='sliderThumb' href='#' rel='" + i + "'></A>"; pageNav += sliderItem; pageNav += "</LI></UL>"; if (options.holder == "") { selector.After(pageNav); } else { jQuery.Select(options.holder).Append(pageNav); } //Apply the slider item height jQuery.Select(".pageItem").Height(sliderItemHeight); } jQueryObject oTrack = jQuery.Select(".scrollbar"); jQueryObject oThumb = jQuery.Select(".thumb"); //jQueryObject oViewPort = jQuery.Select(options.viewport); Number maxPos = (oTrack.GetHeight() - oThumb.GetHeight()); jQueryObject pageItemCollection = jQuery.Select(".pageItem a"); Action <jQueryObject> selectPageItem = delegate(jQueryObject pageItem) { string clickedLink = pageItem.GetAttribute("rel"); options.onPageChanged.Invoke(pageItem, new SelectedPageEventArgs(int.Parse(clickedLink))); options.currentPage = int.Parse(clickedLink); //remove current current (!) page jQuery.Select("li.currentPage").RemoveClass("currentPage"); //Add current page highlighting pageItem.Parent("li").AddClass("currentPage"); //hide and show relevant links selector.Children().Hide(); selector.Find(".page" + clickedLink).Show(); }; //Action<jQueryObject> selectPageItem = delegate(jQueryObject pageItem) jQueryEventHandler selectPageItemHandler = delegate(jQueryEvent pageItemClickedEvent) { //grab the REL attribute jQueryObject pageItem = jQuery.FromElement(pageItemClickedEvent.CurrentTarget); selectPageItem(pageItem); }; //pager navigation behaviour pageItemCollection.Live("click", selectPageItemHandler); jQueryEventHandler wheel = delegate(jQueryEvent oEvent) { }; jQueryEventHandler drag = delegate(jQueryEvent oEvent) { Number candidatePos = Math.Max(0, (iPosition.Start + ((oEvent.PageY) - iMouse.Start))); iPosition.Now = (candidatePos > maxPos) ? maxPos : candidatePos; candidatePageIndex = Math.Round(iPosition.Now / oThumb.GetHeight()); oThumb.CSS("top", iPosition.Now.ToString());; }; jQueryEventHandler end = null; end = delegate(jQueryEvent oEvent) { jQuery.Document.Unbind("mousemove", drag); jQuery.Document.Unbind("mouseup", end); oThumb.Die("mouseup", end); selectPageItem(jQuery.FromElement(pageItemCollection[candidatePageIndex])); }; jQueryEventHandler start = delegate(jQueryEvent oEvent) { iMouse.Start = oEvent.PageY; string oThumbDir = oThumb.GetCSS("top"); iPosition.Start = (oThumbDir == "auto") ? 0 : int.Parse(oThumbDir); jQuery.Document.Bind("mousemove", drag); jQuery.Document.Bind("mouseup", end); oThumb.Live("mouseup", end); }; Action setEvents = delegate() { oThumb.Live("mousedown", start); oTrack.Live("mouseup", drag); //if (options.scroll != null) //{ // oViewPort[0].AddEventListener("DOMMouseScroll", wheel, false); // oViewPort[0].AddEventListener("mousewheel", wheel, false); //} //else if (options.scroll != null) //{ // oViewPort[0].OnMouseWheel = wheel; //} }; setEvents.Invoke(); })); }
public static jQueryObject LostFocus(this jQueryObject q, JsDictionary eventData, jQueryEventHandler eventHandler) { return(null); }
public void Attach() { if (id == null || isAttached) throw new Exception("Must set ID and can only attach once"); isAttached = true; UIUtils.FixStrangeIE7SelectIssue(GetElement().Children[SelectedTab + 1]); clickHandler = new jQueryEventHandler(Delegate.ThisFix((Action<Element, jQueryEvent>)Link_Click)); Element elem = GetElement(); ElementCollection children = elem.Children; for (int i = 0; i < tabCaptions.Length; i++) { if (i != selectedTab) children[i + 1].Style.Display = "none"; } var links = new List<Element>(); ElementCollection lis = children[0].Children[0].Children; for (int i = 0; i < lis.Length; i++) links.Add(lis[i].Children[0]); jQuery.FromElements((Element[])links).Click(clickHandler); if (jQuery.Browser.MSIE && Utils.ParseDouble(jQuery.Browser.Version) < 8) { elem.Style.Width = children[1].ClientWidth + "px"; } }
public NavItem(string value, string text=null, jQueryEventHandler handler=null, bool disable=false, string iconClassName=null) { }
public void On ( string eventName, jQueryEventHandler eventHandler, string selector="", object context=null ) { }
public void Off ( string eventName, jQueryEventHandler eventHandler, string selector="") { }
public ScrollBar() { _stopScrollHandler = StopScroll; _dragHandler = Drag; }
public static jQueryObject LostFocus(this jQueryObject q, jQueryEventHandler eventHandler) { return(null); }
public static jQueryObject LostFocus(this jQueryObject q, jQueryEventHandler eventHandler) { return null; }
public static jQueryObject LostFocus(this jQueryObject q, JsDictionary eventData, jQueryEventHandler eventHandler) { return null; }
public static NavItem NavItem(string value, string text, jQueryEventHandler handler, bool disable, string iconClassName) { var i = new HtmlListItem ().As<NavItem>(); i.SetAttribute ("value", value); if (disable) jQuery.FromElement (i).AddClass ("disabled"); i.Handler = handler; i._icon = new CssIcon (iconClassName); i._anchor = new Anchor (); jQuery.FromElement (i._anchor).Append (i._icon); i._anchor.Text = text??value; jQuery.FromElement (i).Append (i._anchor); SetToAtomProperty (i, "get_text", (Func<string>)(() => i._anchor.Text)); SetToAtomProperty (i, "set_text", (Action<string>)((v) => i._anchor.Text=v)); SetToAtomProperty (i, "get_value", (Func<string>)(() => i.GetAttribute ("value").ToString () ?? "" )); SetToAtomProperty (i, "set_value", (Action<string>)((v) => i.SetAttribute ("value", v) )); SetToAtomProperty (i, "get_iconClass", (Func<string>)(() => i._icon.ClassName)); SetToAtomProperty (i, "set_iconClass", (Action<string>)((v) => i._icon.ClassName = v)); SetToAtomProperty (i, "is_disabled", (Func<bool>)(() => jQuery.FromElement (i).HasClass ("disabled"))); SetToAtomProperty (i, "disable",(Action<bool>)((d) =>{ if(d)jQuery.FromElement (i).AddClass ("disabled"); else jQuery.FromElement (i).RemoveClass ("disabled"); })); i.Clicked += ev=>{ if( i.Disabled ) return; var h = i.Handler; if (h!=null) h(ev); }; return i; }