예제 #1
0
        public URLEditor(jQueryObject input)
            : base(input)
        {
            input.AddClass("url").Attribute("title",
                                            "URL 'http://www.site.com/sayfa' formatında girilmelidir.");

            input.Bind("blur." + this.uniqueName, delegate
            {
                var validator = input.Closest("form").GetDataValue("validator").As <jQueryValidator>();
                if (validator == null)
                {
                    return;
                }

                if (!input.HasClass("error"))
                {
                    return;
                }

                var value = input.GetValue().TrimToNull();
                if (value == null)
                {
                    return;
                }

                value = "http://" + value;

                if (((dynamic)(jQueryValidator.Methods["url"])).apply(validator, new object[] { value, input[0] }) == true)
                {
                    input.Value(value);
                    validator.ValidateElement(input[0]);
                }
            });
        }
예제 #2
0
        public URLEditor(jQueryObject input)
            : base(input)
        {
            input.AddClass("url").Attribute("title",
                "URL 'http://www.site.com/sayfa' formatında girilmelidir.");

            input.Bind("blur." + this.uniqueName, delegate
            {
                var validator = input.Closest("form").GetDataValue("validator").As<jQueryValidator>();
                if (validator == null)
                    return;

                if (!input.HasClass("error"))
                    return;

                var value = input.GetValue().TrimToNull();
                if (value == null)
                    return;

                value = "http://" + value;

                if (((dynamic)(jQueryValidator.Methods["url"])).apply(validator, new object[] { value, input[0] }) == true)
                {
                    input.Value(value);
                    validator.ValidateElement(input[0]);
                }
            });
        }
예제 #3
0
        public static jQueryObject DialogFlexify(this jQueryObject dialog)
        {
            var flexify = new Flexify(dialog.Closest(".ui-dialog"), new FlexifyOptions {
            });

            return(dialog);
        }
예제 #4
0
        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 static jQueryValidator GetValidator(this jQueryObject element)
        {
            var form = element.Closest("form");

            if (form.Length == 0)
            {
                return(null);
            }

            return((jQueryValidator)form.GetDataValue("validator"));
        }
예제 #6
0
        private void PopulateOperatorList(jQueryObject select)
        {
            jQueryObject row = select.Closest("div.row");

            IFilterHandler handler = GetFilterHandlerFor(row);

            if (handler == null)
            {
                return;
            }

            List <string> operators = handler.GetOperators();

            SelectElement sel = (SelectElement)select[0];

            if (operators != null)
            {
                foreach (string op in operators)
                {
                    Q.AddOption(select, op, handler.OperatorTitle(op));
                }
            }
        }
        private static void OnSearchResultsMouseScroll(jQueryEvent e)
        {
            int?wheelDelta = (int)Script.Literal("{0}.originalEvent.wheelDelta", e);

            if (wheelDelta == null)
            {
                wheelDelta = (int)Script.Literal("{0}.originalEvent.wheelDeltaY", e);
            }
            if (wheelDelta == null)
            {
                wheelDelta = (int)Script.Literal("{0}.originalEvent.detail", e) * -30;
            }
            if (wheelDelta == null)
            {
                wheelDelta = (int)Script.Literal("{0}.originalEvent.delta", e) * -30;
            }
            jQueryObject target = jQuery.FromElement(e.Target);

            // Is this event from a results grid?
            jQueryObject gridContainer = target.Closest(".slick-cell");

            if (gridContainer.Length > 0)
            {
                return;
            }



            jQueryObject searchResultsDiv = jQuery.Select("#searchResults");

            int scrollLeft = searchResultsDiv.GetScrollLeft();

            searchResultsDiv.ScrollLeft(scrollLeft -= wheelDelta.Value);

            e.PreventDefault();
        }
예제 #8
0
        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);
        }
예제 #9
0
        public static void ExecuteOnceWhenShown(jQueryObject element, Action callback)
        {
            autoIncrement++;
            string eventClass = "ExecuteOnceWhenShown" + autoIncrement;

            bool executed = false;

            if (element.Is(":visible"))
                callback();
            else
            {
                jQueryObject uiTabs = element.Closest(".ui-tabs");
                if (uiTabs.Length > 0)
                {
                    uiTabs.Bind("tabsshow." + eventClass, delegate(jQueryEvent e)
                    {
                        if (element.Is(":visible"))
                        {
                            uiTabs.Unbind("tabsshow." + eventClass);

                            if (!executed)
                            {
                                executed = true;
                                element.Unbind("shown." + eventClass);
                                callback();
                            }
                        }
                    });
                }

                jQueryObject dialog;
                if (element.HasClass("ui-dialog"))
                    dialog = element.Children(".ui-dialog-content");
                else
                    dialog = element.Closest(".ui-dialog-content");

                if (dialog.Length > 0)
                    dialog.Bind("dialogopen." + eventClass, delegate
                    {
                        dialog.Unbind("dialogopen." + eventClass);

                        if (element.Is(":visible") && !executed)
                        {
                            executed = true;
                            element.Unbind("shown." + eventClass);
                            callback();
                        }
                    });

                element.Bind("shown." + eventClass, delegate
                {
                    if (element.Is(":visible"))
                    {
                        element.Unbind("shown." + eventClass);

                        if (!executed)
                        {
                            executed = true;
                            callback();
                        }
                    }
                });
            }
        }
예제 #10
0
        public static void ExecuteOnceWhenShown(jQueryObject element, Action callback)
        {
            autoIncrement++;
            string eventClass = "ExecuteOnceWhenShown" + autoIncrement;

            bool executed = false;

            if (element.Is(":visible"))
            {
                callback();
            }
            else
            {
                jQueryObject uiTabs = element.Closest(".ui-tabs");
                if (uiTabs.Length > 0)
                {
                    uiTabs.Bind("tabsshow." + eventClass, delegate(jQueryEvent e)
                    {
                        if (element.Is(":visible"))
                        {
                            uiTabs.Unbind("tabsshow." + eventClass);

                            if (!executed)
                            {
                                executed = true;
                                element.Unbind("shown." + eventClass);
                                callback();
                            }
                        }
                    });
                }

                jQueryObject dialog;
                if (element.HasClass("ui-dialog"))
                {
                    dialog = element.Children(".ui-dialog-content");
                }
                else
                {
                    dialog = element.Closest(".ui-dialog-content");
                }

                if (dialog.Length > 0)
                {
                    dialog.Bind("dialogopen." + eventClass, delegate
                    {
                        dialog.Unbind("dialogopen." + eventClass);

                        if (element.Is(":visible") && !executed)
                        {
                            executed = true;
                            element.Unbind("shown." + eventClass);
                            callback();
                        }
                    });
                }

                element.Bind("shown." + eventClass, delegate
                {
                    if (element.Is(":visible"))
                    {
                        element.Unbind("shown." + eventClass);

                        if (!executed)
                        {
                            executed = true;
                            callback();
                        }
                    }
                });
            }
        }
예제 #11
0
        public static void AddLinkToTitle(jQueryObject dialog)
        {
            var link = J("<a class=\"dialog-support-link\" tabindex=\"-1\" onclick=\"supportClick()\"><i class=\"fa icon-support\"></i>Destek</a>");

            link.AppendTo(dialog.Closest(".ui-dialog").Children(".ui-dialog-titlebar"));
        }