/* * File: ColVis.min.js * Version: 1.0.4 * Author: Allan Jardine (www.sprymedia.co.uk) * * Copyright 2010-2011 Allan Jardine, all rights reserved. * * This source file is free software, under either the GPL v2 license or a * BSD (3 point) style license, as supplied with this software. * * This source file is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. */ (function(c){ColVis=function(a,b){if(!this.CLASS||this.CLASS!="ColVis")alert("Warning: ColVis must be initialised with the keyword 'new'");if(typeof b=="undefined")b={};this.s={dt:null,oInit:b,fnStateChange:null,activate:"click",sAlign:"left",buttonText:"Show / hide columns",hidden:true,aiExclude:[],abOriginal:[],bRestore:false,sRestore:"Restore original"};this.dom={wrapper:null,button:null,collection:null,background:null,catcher:null,buttons:[],restore:null};ColVis.aInstances.push(this);this.s.dt= a;this._fnConstruct();return this};ColVis.prototype={fnRebuild:function(){for(var a=this.dom.buttons.length-1;a>=0;a--)this.dom.buttons[a]!==null&&this.dom.collection.removeChild(this.dom.buttons[a]);this.dom.buttons.splice(0,this.dom.buttons.length);this.dom.restore&&this.dom.restore.parentNode(this.dom.restore);this._fnAddButtons();this._fnDrawCallback()},_fnConstruct:function(){this._fnApplyCustomisation();var a=this;this.dom.wrapper=document.createElement("div");this.dom.wrapper.className="ColVis TableTools"; this.dom.button=this._fnDomBaseButton(this.s.buttonText);this.dom.button.className+=" ColVis_MasterButton";this.dom.wrapper.appendChild(this.dom.button);this.dom.catcher=this._fnDomCatcher();this.dom.collection=this._fnDomCollection();this.dom.background=this._fnDomBackground();this._fnAddButtons();for(var b=0,d=this.s.dt.aoColumns.length;b'+this.s.sRestore+"");c(b).click(function(){for(var e=0,g=a.s.abOriginal.length;e'+d.sTitle+"");c(e).click(function(h){var f=c("input",this).attr("checked")=== true?false:true;if(h.target.nodeName.toLowerCase()=="input")f=c("input",this).attr("checked");h=c.fn.dataTableExt.iApiIndex;c.fn.dataTableExt.iApiIndex=b._fnDataTablesApiIndex.call(b);b.s.dt.oInstance.fnSetColumnVis(a,f);c.fn.dataTableExt.iApiIndex=h;b.s.fnStateChange!==null&&b.s.fnStateChange.call(b,a,f)});return e},_fnDataTablesApiIndex:function(){for(var a=0,b=this.s.dt.oInstance.length;aj?f:j)+"px";e.style.width=(ki)d.style.left=i-b+"px";if(h+f>j)d.style.top=h-f-c(this.dom.button).outerHeight()+"px";setTimeout(function(){c(d).animate({opacity:1},500);c(e).animate({opacity:0.1},500,"linear",function(){jQuery.browser.msie&&jQuery.browser.version=="6.0"&&a._fnDrawCallback()})},10);this.s.hidden=false},_fnCollectionHide:function(){var a=this;if(!this.s.hidden&&this.dom.collection!==null){this.s.hidden=true;c(this.dom.collection).animate({opacity:0},500,function(){this.style.display="none"});c(this.dom.background).animate({opacity:0}, 500,function(){document.body.removeChild(a.dom.background);document.body.removeChild(a.dom.catcher)})}}};ColVis.fnRebuild=function(a){var b=null;if(typeof a!="undefined")b=a.fnSettings().nTable;for(var d=0,e=ColVis.aInstances.length;d