/*! jquery-takeout - v0.4.0 - 2014-07-21 * https://github.com/garrettn/jquery-takeout * Copyright (c) 2014 Garrett Nay; Licensed MIT */ !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){a.fn.takeout=function(b){var c;return"undo"===b?this.each(function(){var b,c=a(this),d=c.data("takeout");if(!d)throw new Error("Element does not have any Takeout data.");if(!d.placeholder)throw new Error("Element does not have a reference to a placeholder.");if(b=a("."+d.placeholderClass).filter(function(){return this===d.placeholder}),!b.length)throw new Error("Referenced placeholder does not exist in the document.");b.replaceWith(c),this.style.position=d.originalPosition,this.style.top=d.originalTop,this.style.left=d.originalLeft,c.removeData("takeout")}):(c=a.extend({appendTo:"body",placeholderClass:"takeout-placeholder"},b),this.each(function(){var b=a(this);if(b.data("takeout"))throw new Error("Element has already been taken out.");var d=b.outerHeight(!0),e=b.outerWidth(!0),f=b.offset(),g=this.style.position,h=this.style.top,i=this.style.left,j=a('
').height(d).width(e);b.replaceWith(j).appendTo(c.appendTo).css("position","absolute").offset(f).data({takeout:{placeholder:j.get(0),placeholderClass:c.placeholderClass,originalPosition:g,originalTop:h,originalLeft:i}})}))}});