;(function ( $, window, document, undefined ) { // Defaults var pluginName = "loadingIndicator", defaults = { useImage: false, showOnInit: true, loadingImage: "../src/images/loader.gif", loadingClass: "loader", wrapperClass: "loading-indicator-wrapper" }; // Constructor function Plugin ( element, options ) { this.element = element; this.$wrapper = null; this.options = $.extend( {}, defaults, options ); this._defaults = defaults; this._name = pluginName; this.init(); } // Prototype Plugin.prototype = { init: function () { this.addLoader(); if (this.options.showOnInit) { this.show(); } else { this.hide(); } }, addLoader: function () { var $wrapper = this.createDOM(); this.$wrapper = $wrapper; $(this.element).append($wrapper); }, createDOM: function() { var $wrapper = $('
'), $helper = $(''), $indicator = this.options.useImage ? $('