/// // /* * jQuery-busy v1.0.3 * Copyright 2010 Tomasz Szymczyszyn * * Examples available at: * http://kammerer.boo.pl/code/jquery-busy * * This plug-in is dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ (function ($) { // Helper object factory function Busy(options) { this.options = $.extend({}, Busy.defaults, options); }; // Remembers currently "busied" targets along with options Busy.instances = []; Busy.repositionAll = function () { for (var i = 0; i < Busy.instances.length; i++) { if (!Busy.instances[i]) continue; var options = Busy.instances[i].options; new Busy(options).positionImg($(Busy.instances[i].target), $.data(Busy.instances[i].target, "busy"), options.position); } }; Busy.prototype.hide = function (targets) { targets.each(function () { var busyImg = $.data(this, "busy"); if (busyImg) busyImg.remove(); $(this).css("visibility", ""); //$(this).css("display", "block"); $.data(this, "busy", null); for (var i = 0; i < Busy.instances.length; i++) if (Busy.instances[i] != null && Busy.instances[i].target == this) Busy.instances[i] = null; }); }; Busy.prototype.show = function (targets) { var that = this; targets.each(function () { if ($.data(this, "busy")) return; var target = $(this); var busyImg = that.buildImg(); //busyImg.css("display", "none"); busyImg.css("visibility", "hidden"); busyImg.load(function () { that.positionImg(target, busyImg, that.options.position); busyImg.css("visibility", ""); //busyImg.css("display", "block"); }); $("body").append(busyImg); if (that.options.hide) target.css("visibility", "hidden"); //target.css("display", "none"); $.data(this, "busy", busyImg); Busy.instances.push({ target: this, options: that.options }); }); }; Busy.prototype.preload = function () { var busyImg = this.buildImg(); busyImg.css("visibility", "hidden"); //busyImg.css("display", "none"); busyImg.load(function () { $(this).remove(); }); $("body").append(busyImg); }; // Creates image node, wraps it in $ object and returns. Busy.prototype.buildImg = function () { var html = "