Example #1
0
 static void OnReady()
 {
     new jQuery("#button").click(e =>
     {
         new jQuery("#effect").toggleClass("newClass", 1000);
         JsContext.@return(false);
     });
 }
Example #2
0
 static void OnReady()
 {
     new jQuery("#button").click(x =>
     {
         new jQuery("#effect").addClass("newClass", 1000, callback);
         JsContext.@return(false);
     });
 }
Example #3
0
 static void OnReady()
 {
     new jQuery("#button").click(e =>
     {
         new jQuery(".newClass").switchClass("newClass", "anotherNewClass", 1000);
         new jQuery(".anotherNewClass").switchClass("anotherNewClass", "newClass", 1000);
         JsContext.@return(false);
     });
 }
Example #4
0
        public JsImplDateTime(int year, int month, int day)
        {
            var x = new JsDateEx();

            x.Year  = year;
            x.Month = month;
            x.Day   = day;
            JsContext.@return(x);
        }
Example #5
0
 static void OnReady()
 {
     // set effect from select menu value
     new jQuery("#button").click(e =>
     {
         runEffect();
         JsContext.@return(false);
     });
 }
Example #6
0
        static void OnReady()
        {
            var projects = new JsArray <AutocompleteItem>
            {
                new AutocompleteItem
                {
                    value = "jquery",
                    label = "jQuery",
                    desc  = "the write less, do more, JavaScript library",
                    icon  = "jquery_32x32.png"
                },
                new AutocompleteItem
                {
                    value = "jquery-ui",
                    label = "jQuery UI",
                    desc  = "the official user interface library for jQuery",
                    icon  = "jqueryui_32x32.png"
                },
                new AutocompleteItem
                {
                    value = "sizzlejs",
                    label = "Sizzle JS",
                    desc  = "a pure-JavaScript CSS selector engine",
                    icon  = "sizzlejs_32x32.png"
                }
            };

            new jQuery("#project").autocomplete(new AutocompleteOptions
            {
                source = projects,
                focus  = (e, ui) =>
                {
                    var ui2 = ui.As <UIWithItem>();
                    new jQuery("#project").val(ui2.item.label);
                    JsContext.JsCode(" new jQuery( '#project' ).val(ui.item.label)");
                    JsContext.@return(false);
                },
                select = (e, ui) =>
                {
                    new jQuery("#project").val(ui.As <UIWithItem>().item.label);
                    new jQuery("#project-id").val(ui.As <UIWithItem>().item.value);
                    new jQuery("#project-description").html(ui.As <UIWithItem>().item.As <AutocompleteItem>().desc);
                    new jQuery("#project-icon").attr("src", "images/" + ui.As <UIWithItem>().item.As <AutocompleteItem>().icon);
                    JsContext.@return(false);
                }
            }).data("autocomplete").As <UIWithItem>()._renderItem = (ul, item) =>

                                                                    new jQuery("<li></li>")
                                                                    .data("item.autocomplete", item)
                                                                    .append("<a>" + item.label + "<br>" + item.desc + "</a>")
                                                                    .appendTo(ul);
        }
Example #7
0
        static void OnReady()
        {
            // there's the gallery and the trash
            gallery = new jQuery("#gallery");
            trash   = new jQuery("#trash");

            // let the gallery items be draggable
            new jQuery("li", gallery).draggable(new DraggableOptions
            {
                cancel      = "a.ui-icon",                                                               // clicking an icon won't initiate dragging
                revert      = "invalid",                                                                 // when not dropped, the item will revert back to its initial position
                containment = new jQuery("#demo-frame").length.As <bool>() ? "#demo-frame" : "document", // stick to demo-frame if present
                helper      = "clone",
                cursor      = "move"
            });
            // let the trash be droppable, accepting the gallery items
            trash.droppable(new DroppableOptions
            {
                accept      = "#gallery > li",
                activeClass = "ui-state-highlight",
                drop        = (e, ui) => deleteImage(ui.draggable)
            });
            // let the gallery be droppable as well, accepting items from the trash
            gallery.droppable(new DroppableOptions
            {
                accept      = "#trash li",
                activeClass = "custom-state-active",
                drop        = (@event, ui) => recycleImage(ui.draggable)
            });
            // resolve the icons behavior with event delegation
            new jQuery("ul.gallery > li").click(e =>
            {
                var item   = new jQuery(JsContext.@this);
                var target = new jQuery(e.target);

                if (target.@is("a.ui-icon-trash"))
                {
                    deleteImage(item);
                }
                else if (target.@is("a.ui-icon-zoomin"))
                {
                    viewLargerImage(target);
                }
                else if (target.@is("a.ui-icon-refresh"))
                {
                    recycleImage(item);
                }

                JsContext.@return(false);
            });
        }
Example #8
0
        public JsImplDateTime(int year, int month, int day, int hour, int minute, int second, DateTimeKind kind)
        {
            JsDateEx x;

            if (kind == DateTimeKind.Utc)
            {
                x = new JsDateEx(JsDate.UTC(year, month - 1, day, hour, minute, second));
            }
            else
            {
                x = new JsDateEx(year, month - 1, day, hour, minute, second);
            }
            x._Kind = kind;
            JsContext.@return(x);
        }
Example #9
0
 static void OnReady()
 {
     // increase the default animation speed to exaggerate the effect
     // TODO: //$.fx.speeds._default = 1000;
     JsContext.JsCode("$.fx.speeds._default = 1000;");
     new jQuery("#dialog").dialog(new DialogOptions
     {
         autoOpen = false,
         show     = "blind",
         hide     = "explode",
     });
     new jQuery("#opener").click(e =>
     {
         new jQuery("#dialog").dialog("open");
         JsContext.@return(false);
     });
 }
Example #10
0
 static void OnReady()
 {
     new jQuery("#spinner").spinner(new SpinnerOptions
     {
         spin = (e, ui) =>
         {
             if (ui.value > 10)
             {
                 new jQuery(JsContext.@this).spinner("value", -10);
                 JsContext.@return(false);
             }
             else if (ui.value < -10)
             {
                 new jQuery(JsContext.@this).spinner("value", 10);
                 JsContext.@return(false);
             }
         }
     });
 }
Example #11
0
 static void OnReady()
 {
     new jQuery("#draggable").draggable();
     new jQuery("#droppable, #droppable-inner").droppable(new DroppableOptions
     {
         activeClass = "ui-state-hover",
         hoverClass  = "ui-state-active",
         drop        = (e, ui) =>
         {
             new jQuery(e.currentTarget).addClass("ui-state-highlight").find("> p").html("Dropped!");
             JsContext.@return(false);
         }
     });
     new jQuery("#droppable2, #droppable2-inner").droppable(new DroppableOptions
     {
         greedy      = true,
         activeClass = "ui-state-hover",
         hoverClass  = "ui-state-active",
         drop        = (e, ui) =>
         {
             new jQuery(e.currentTarget).addClass("ui-state-highlight").find(" > p ").html("Dropped!");
         }
     });
 }
Example #12
0
        public JsImplDateTime(int year, int month, int day, int hour, int minute, int second)
        {
            var x = new JsDateEx(year, month - 1, day, hour, minute, second);

            JsContext.@return(x);
        }
Example #13
0
        public JsImplDateTime()
        {
            var x = MinValue;

            JsContext.@return(x);
        }
Example #14
0
 static void OnReady()
 {
     new jQuery("input:submit, a, button", ".demo").button();
     new jQuery("a", ".demo").click(e => JsContext.@return(false));
 }