Пример #1
0
 public void Show(string title)
 {
     Bussy.Find("h4").Html(title);
     Bussy.Find(".modal-dialog").Attr("class", "modal-dialog").AddClass("modal-" + DialogSize);
     Bussy.Find(".progress-bar").AddClass("progress-bar-" + ProgressType);
     Window.SetTimeout(this.DoShow);
 }
Пример #2
0
        public override void ActivateListeners(jQuery htmlObject)
        {
            // Activate tabs
            jQuery  tabs = htmlObject.Find(".tabs");
            dynamic opts = new RawJSObject();

            opts.initial  = _sheetTab;
            opts.callback = (ClickCallback)ClickTabSelect;
            new FVTTBridge.Bindings.Tabs(tabs, opts);

            //
            // Everything below here is only needed if the sheet is editable
            if (!Options.editable)
            {
                return;
            }

            // Update Inventory Item

            htmlObject.Find(".item-edit").Click(ev => {
                jQuery li = jQuery.Select(ev.CurrentTarget).Parents(".item");
                Item item = Actor.getOwnedItem(li.Data("itemId"));
                //item.render(true);
            });


            // Delete Inventory Item
            htmlObject.Find(".item-delete").Click(ev => {
                jQuery li = jQuery.Select(ev.CurrentTarget).Parents(".item");
                Actor.deleteOwnedItem(li.Data("itemId"), null);
                li.SlideUp(200, () => Render(false));
            });
            // hook stat roll buttons
            htmlObject.Find(".roll_stat_button").Click(ev =>
            {
                Element button = ev.CurrentTarget;
                DoStatRoll(button.GetAttribute("data-statname"));
            });


            htmlObject.Find(".roll_skill_button").Click(ev => {
                Element button = ev.CurrentTarget;
                DoSkillRoll(button.GetAttribute("data-skillname"));
            });

            // Clear skill pulldown
            htmlObject.Find("#skill_pulldown").Click(ev =>
            {
                htmlObject.Find(ev.CurrentTarget).Val("");
            });

            HTMLCollection clear_pulldowns = Document.GetElementsByClassName("clear_pulldown");

            foreach (Element el in clear_pulldowns)
            {
                el.AddEventListener("click", ev => { htmlObject.Find(ev.CurrentTarget.ToString()).Val(""); }, false);
            }

            htmlObject.Find("#add_skill_button").Click(ev =>
            {
                jQuery skillname = htmlObject.Find("#skill_pulldown");
                Console.WriteLine("add skill " + skillname.Val());
                DoAddSkill(skillname.Val());
            });

            htmlObject.Find("#roll_button").Click(ev =>
            {
                Console.WriteLine("show roll dialog");
                htmlObject.Find("#roll_dialog").Show();
            });

            HTMLCollection action_buttons = Document.GetElementsByClassName("action_button");

            foreach (Element el in action_buttons)
            {
                el.AddEventListener("click", ev =>
                {
                    Element button = (Element)ev.CurrentTarget;
                    DoItemAction(button.GetAttribute("data-itemkey"),
                                 button.GetAttribute("data-actionkey"));
                });
            }
        }