{"size": 3073, "ext": "js", "max_stars_repo_path": "netis/tests/jquery.myplugin/jquery.myplugin.js", "max_stars_repo_name": "katahiromz/katahiromz.github.io", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "netis/tests/jquery.myplugin/jquery.myplugin.js", "max_issues_repo_name": "katahiromz/katahiromz.github.io", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "netis/tests/jquery.myplugin/jquery.myplugin.js", "max_forks_repo_name": "katahiromz/katahiromz.github.io", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 38.8987341772, "max_line_length": 87, "alphanum_fraction": 0.4233647901}
;(function($) {
    var self = this;
    $.fn.myplugin = function(args) {
        var self = this;
        var methods = {
            init: function(options) {
                var defaults = {
                    // TODO:
                    width: "100%",
                    height: "auto",
                    border: "1px solid black",
                    text: "Hello, jQuery plugin",
                };
                let settings = $.extend(true, {}, defaults, options);
                self.data('settings', settings);
                return self.each(function(index, element) {
                    // TODO:
                    $(element).text(settings['text']);
                    $(element).css('width', settings['width']);
                    $(element).css('height', settings['height']);
                    $(element).css('border', settings['border']);
                });
            },
            destroy: function() {
                alert("destroy");
            },
            text: function(newValue) {
                if (newValue == undefined)
                    return self.data('settings')['text'];
                self.each(function(index, element) {
                    $(element).text(newValue);
                });
                self.data('settings', 'text') = newValue;
                return self;
            },
            border: function(newValue) {
                if (newValue == undefined)
                    return self.data('settings')['border'];
                self.each(function(index, element) {
                    $(element).css('border', newValue);
                });
                self.data('settings')['border'] = newValue;
                return self;
            },
            width: function(newValue) {
                if (newValue == undefined)
                    return self.data('settings')['width'];
                self.each(function(index, element) {
                    $(element).css('width', newValue);
                });
                self.data('settings')['width'] = newValue;
                return self;
            },
            height: function(newValue) {
                if (newValue == undefined)
                    return self.data('settings')['height'];
                self.each(function(index, element) {
                    $(element).css('height', newValue);
                });
                self.data('settings')['height'] = newValue;
                return self;
            },
            option: function(key, newValue) {
                if (newValue == undefined)
                    return self.data('settings')[key];
                self.data('settings')[key] = newValue;
                return self;
            },
        };
        if (methods[args]) {
            return methods[args].apply(this, Array.prototype.slice.call(arguments, 1));
        } else if (typeof args === 'object' || !args) {
            return methods.init.apply(this, arguments);
        } else {
            $.error("Method '" + args + "' not found in myplugin");
        }
    };
})(jQuery);
