export function IconButtonRegister() {
    $.widget("metro.iconbutton", {
        version: "3.0.0",
        options: {
            iconbuttonText: ''
        },
        iconbutton: {},
        _create: function () {
            var that = this, element = this.element, o = this.options;
            $.each(element.data(), function (key, value) {
                if (key in o) {
                    try {
                        o[key] = $.parseJSON(value);
                    }
                    catch (e) {
                        o[key] = value;
                    }
                }
            });
            element.data('iconbutton', this);
            var newSpan = $('<span>');
            newSpan.css("padding-right", "10px");
            newSpan.hide();
            newSpan.text(this.options.iconbuttonText);
            var observer = new MutationObserver(function (mutations) {
                var text = $(mutations[0].target).attr("data-iconbutton-text");
                newSpan.text(text);
            });
            observer.observe(element.get(0), {
                attributes: true,
                attributeFilter: ['data-iconbutton-text']
            });
            element.append(newSpan);
            var link = element.find("a");
            var href = link.attr('href');
            newSpan.parent().click(function (evt) {
                newSpan.hide();
                if (href != "#") {
                    if (evt.ctrlKey) {
                        window.open(href);
                    }
                    else {
                        window.open(href, "_self");
                    }
                }
            });
            element.hover(function () { newSpan.stop(true, true).delay(400).show("fast"); }, function () { newSpan.stop(true, true).hide("fast"); });
        }
    });
}

//# sourceMappingURL=icon-button.js.map
