private void SubmitForm(jQueryEvent e) { e.PreventDefault(); string currentPassword = jQuery.Select("#change-password-current-password").GetValue(); string password = jQuery.Select("#change-password-new-password").GetValue(); string password2 = jQuery.Select("#change-password-new-password2").GetValue(); if (currentPassword == "" || password == "" || password2 == "" || submittingForm) { return; } if (password.Length < 8 || password != password2) { ErrorModal.ShowError(Strings.Get("AddUserInvalidInput")); return; } submittingForm = true; ChangePasswordRequest request = new ChangePasswordRequest(); request.currentPassword = currentPassword; request.newPassword = password; request.newPassword2 = password2; Request.Send(request, SubmitSuccess, SubmitFailure); }
private void OnMouseUp(jQueryEvent e) { bool wasMouseDown = IsMouseDown; IsMouseDown = false; if (IsEnabled && IsMouseOver && wasMouseDown) InvokeClick(); UpdateMouseState(); }
public static void RequestMatch(jQueryEvent e) { jQueryObject button = jQuery.FromElement(e.CurrentTarget); jQueryUIObject dialog = (jQueryUIObject)jQuery.Select("#challengeDialog"); jQueryUIObject datePicker = (jQueryUIObject)dialog.Find(".datepicker"); Utility.WireLocationAutoComplete((jQueryUIObject)dialog.Find(".placesAutoFill"), (jQueryUIObject)dialog.Find(".placesAutoValue")); string id = button.GetElement(0).ID; datePicker.DatePicker("disable"); dialog.Dialog( new JsonObject( "width", "260", "height", "324", "modal", true, "title", button.GetAttribute("Title"), "buttons", new JsonObject( "Challenge!", (jQueryEventHandler)delegate(jQueryEvent ex) { CreateMatch(id); } ), "open", (Callback)delegate() { dialog.Find(".comments").Focus(); datePicker.DatePicker("enable"); }, "position", "top" ) ); }
/// <summary> /// Popup for the calendar page showing potential and accepted offers by date. /// </summary> /// <param name="ev"></param> public static void Calendar(jQueryEvent ev) { jQueryUIObject dialog = (jQueryUIObject)jQuery.Select("#calendarCard"); dialog.Children().First().Html("Loading..."); JsonObject parameters = new JsonObject("page", 0); jQuery.Post("/services/Calendar?signed_request=" + Utility.GetSignedRequest(), Json.Stringify(parameters), (AjaxRequestCallback<object>)delegate(object data, string textStatus, jQueryXmlHttpRequest<object> request) { Utility.ProcessResponse((Dictionary)data); } ); // BUGBUG: currently the sizes are hard-coded and too big - need to fix this. dialog.Dialog( new JsonObject( "width", jQuery.Window.GetWidth() - 120, "height", jQuery.Window.GetHeight() - 40, "modal", true, "closeOnEscape", true, "title", "Calendar", "position", "top" ) ); }
private void SaveDetails(jQueryEvent e) { this.EditButton.Hide(EffectDuration.Fast); this.Obj.Attribute("disabled", "disabled").AddClass("ui-state-disabled"); // Find the objects with the .edit class that are descendants of objects with .keyvaluerow class // These are the editable key/value pairs jQueryObject edits = this.Obj.Find(".keyvaluerow .edit"); string ntrp = edits.Find(".ntrp").GetValue(); string court = edits.Find(".placesAutoValue").GetValue(); string playPreference = edits.Find(".preference").GetValue(); string style = edits.Find(".style").GetValue(); string email = ((CheckBoxElement)edits.Find(".email").GetElement(0)).Checked ? "true" : "false"; JsonObject parameters = new JsonObject ( "ntrp", ntrp, "preference", playPreference, "courtData", court, "style", style, "emailOffers", email ); // Post the user data to the service jQuery.Post("/services/PostTennisUserDetails" + "?signed_request=" + Utility.GetSignedRequest(), Json.Stringify(parameters), (AjaxRequestCallback<object>)delegate(object data, string textStatus, jQueryXmlHttpRequest<object> request) { Utility.ProcessResponse((Dictionary)data); }); }
public void DeleteCommand(object data, jQueryEvent e) { Utility.ConfirmDialog(ResourceStrings.ConfirmDeleteConnection,delegate(){ string id = e.Target.ParentNode.GetAttribute("rowId").ToString(); OrganizationServiceProxy.BeginDelete(Connection.LogicalName, new Guid(id), delegate(object state) { try { OrganizationServiceProxy.EndDelete(state); foreach (Entity connection in Connections.Data) { if (connection.Id == id) { Connections.RemoveItem(connection); break; } } Connections.Refresh(); } catch (Exception ex) { ErrorMessage.SetValue(ex.Message); } }); },null); }
private void SubmitForm(jQueryEvent e) { e.PreventDefault(); string name = jQuery.Trim(jQuery.Select("#admin-user-add-name").GetValue()); string password = jQuery.Select("#admin-user-add-password").GetValue(); string password2 = jQuery.Select("#admin-user-add-password2").GetValue(); if (name == "" || password == "" || password2 == "" || submittingForm) { return; } RegularExpression regex = new RegularExpression("[^a-zA-Z0-9]"); if (regex.Test(name) || password.Length < 8 || password != password2) { ErrorModal.ShowError(Strings.Get("AddUserInvalidInput")); return; } submittingForm = true; AdminUserAddRequest request = new AdminUserAddRequest(); request.username = name; request.password = password; request.password2 = password2; request.admin = jQuery.Select("#admin-user-add-administrator").Is(":checked"); Request.Send(request, SubmitSuccess, SubmitFailure); }
static void CustomDialog_3(jQueryEvent e){ var item = e.CurrentTarget.As<NavItem> (); var dd = new Div(c=>{ new TextField(c, i=>i.Placeholder="name"); new CheckField(c,i=>{ i.Input.Text="I like cayita"; i.Input.Checked=true; i.Input.Disabled=true; }); new TextAreaInput(c, i=>i.Value="cayita is amazing ..."); }); Bootbox.Dialog (dd, new BootboxHandler { Callback=()=> item.Text.LogInfo(), Label="Go", Class="btn-info", }, new BootboxOptions { Header=item.Text, Classes="modal-large", OnEscape=()=> "Esc pressed".LogInfo() }); }
private void OnAddNearbyClick(jQueryEvent e) { try { Service.GetSurroundingPlaces( int.Parse(this.view.uiRadiusPlaceAutoComplete.Value), int.Parse(this.view.uiNumberOfSurroundingTownsDropDown.Value), delegate(PlaceStub[] result, object context, string name) { for (int i = 0; i < result.Length; i++) { this.view.uiPlacesMultiSelector.AddItem(result[i].name, result[i].k.ToString()); } this.view.uiRadiusPlaceAutoComplete.Clear(); }, Trace.WebServiceFailure, null, 5000 ); } catch(Exception) { } e.PreventDefault(); }
private void OnKeyDown(jQueryEvent e) { if ("ABCDEFGHIJKLMNOPQRSTUVWXYZ,.;#[]".IndexOf(String.FromCharCode(e.Which)) > -1) { e.PreventDefault(); } }
private void OnBlur(jQueryEvent e) { if (GetDate() == null) { this.view.TextBox.Value = ""; } }
public static void InputKeypressHandler(jQueryEvent evt, InputElement el, TransformCharDelegate transformChar) { if (evt.AltKey || evt.CtrlKey) return; // don't ever change Alt+key or Ctrl+key if (jQuery.Browser.MSIE) { if (evt.Which == 13) return; // Enter seems to be the only non-printable key we catch in IE. char newc = transformChar((char)evt.Which); if (newc == 0) { evt.PreventDefault(); } else if (newc != evt.Which) { ((dynamic)evt).originalEvent.keyCode = newc; } } else { if (evt.Which == 0) return; // Firefox, and likely other non-IE browsers, lets us trap non-characters, but we don't want that. char newc = transformChar((char)evt.Which); if (newc == 0) { evt.PreventDefault(); } else if (newc != evt.Which) { int startPos = ((dynamic)el).selectionStart, endPos = ((dynamic)el).selectionEnd; string oldVal = el.Value; el.Value = oldVal.Substr(0, startPos) + String.FromCharCode(newc) + oldVal.Substr(endPos); ((dynamic)el).setSelectionRange(startPos + 1, startPos + 1); evt.PreventDefault(); } } }
void GoLicense(jQueryEvent evt) { evt.PreventDefault (); Work.Empty (); Work.Append (@"<div class=""well""> <p>Copyright AICL.</p> <p>Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:</p><p><a target=""_blank"" href=""http://www.apache.org/licenses/LICENSE-2.0"">http://www.apache.org/licenses/LICENSE-2.0</a></p><p>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.</p></div>"); }
public static Pointer GetCursorPosition(jQueryEvent ev) { if (ev.Me().originalEvent && ev.Me().originalEvent.targetTouches && ev.Me().originalEvent.targetTouches.length > 0) ev = ev.Me().originalEvent.targetTouches[0]; if (ev.PageX.Me() != null && ev.PageY.Me() != null) return new Pointer(ev.PageX, ev.PageY, 0, ev.Which == 3); //if (ev.x != null && ev.y != null) return new { x: ev.x, y: ev.y }; return new Pointer(ev.ClientX, ev.ClientY, 0, ev.Which == 3); }
private void BrowseButtonClicked(jQueryEvent e) { e.PreventDefault(); if (collectionId > 0) { AdminFinderModal.ShowDialog(jQuery.Select("#admin-manga-edit-path"), collectionId); } }
public void gotoFirst(jQueryEvent e) { if (getNavState().CanGotoFirst) { PagingInfo paging = new PagingInfo(); paging.PageNum = 0; _dataView.SetPagingOptions(paging); } }
static void CustomDialog_1(jQueryEvent e){ var i = e.CurrentTarget.As<NavItem> (); Bootbox.Dialog (i.Text, new BootboxHandler { Callback=()=> i.Text.LogInfo(), Label="My Custom Label" }); }
private void NavMangasClicked(jQueryEvent e) { e.PreventDefault(); if (this.GetType() != typeof(AdminMangasModule)) { AdminMangasModule.Instance.Show(null); } }
public void OnFocus(jQueryEvent ev) { Window.ClearTimeout(timeoutId); if (el.Value == watermark) { el.ClassName = ""; el.Value = ""; } }
private void NavSettingsClicked(jQueryEvent e) { e.PreventDefault(); if (this.GetType() != typeof(SettingsModule)) { SettingsModule.Instance.Show(null); } }
private void NavLogoutClicked(jQueryEvent e) { e.PreventDefault(); LoginRequest request = new LoginRequest(); request.password = "******"; Request.Send(request, LogoutSuccessful, LogoutSuccessful); }
private void NavFoldersClicked(jQueryEvent e) { e.PreventDefault(); if (this.GetType() != typeof(FoldersModule)) { FoldersModule.Instance.Show(null); } }
private void ReportLinkClick(jQueryEvent e) { e.PreventDefault(); var dialog = new ReportDialog(new ReportDialogOptions { ReportKey = J(e.Target).GetDataValue("key").As<string>() }); }
public void btnLogin_OnClick(jQueryEvent e) { if (string.IsNullOrEmpty(txtUsername.Value)) { Window.Alert("Please enter in a username"); return; } _loginManager.LoginUser(); }
private void EditDetails(jQueryEvent e) { jQueryObject edits = this.Obj.Find(".keyvaluerow .edit"); edits.Show(EffectDuration.Fast); edits.Prev(".value").Hide(EffectDuration.Fast); this.EditButton.Hide(EffectDuration.Fast); this.SaveButton.Show(EffectDuration.Fast); }
public void AddTerritoryToInput(jQueryEvent eventHandler) { jQueryObject autoSuggestBox = jQuery.Select("#TerritoriesAutoSuggest"); string[] territoryArray = autoSuggestBox.GetValue().Split(','); territoryArray[territoryArray.Length - 1] = " " + eventHandler.CurrentTarget.InnerHTML.Trim() + ", "; jQuery.Select("#TerritoriesAutoSuggest").Value(territoryArray.ToString()); }
void GoContact(jQueryEvent evt) { evt.PreventDefault (); Work.Empty (); Work.Append (@"<div class=""well""> <p><a target=""_blank"" href=""https://github.com/angelcolmenares"">https://github.com/angelcolmenares</a> <p><a target=""_blank"" href=""https://github.com/aicl"">https://github.com/aicl</a> </p></div>"); }
private void SaveCustomer(jQueryEvent evt) { var opts = new jQueryAjaxOptions { Url = "/Home/SaveCustomer" }; ((dynamic)opts).data = jQuery.Select("#customerForm").Serialize(); var req = jQuery.Ajax(opts); req.Success(_ => { ((DialogObject)jQuery.Select("#customerForm")).Close(); LoadCustomers(); }); req.Fail(_ => Window.Alert("Save failed")); }
private void AutoCompleteQueryGroupClick(jQueryEvent e) { if (this.view.uiJustBuddiesRadio.Checked) { this.view.uiBuddyMultiSelector.HtmlAutoComplete.SetWebMethod("GetBuddies"); } else { this.view.uiBuddyMultiSelector.HtmlAutoComplete.SetWebMethod("GetBuddiesThenUsrs"); } }
private void OnBackClick(jQueryEvent e) { if (Keyboard.IsAltPressed) { listTree.Home(); } else { listTree.Back(); } }