jquery-datatables-rails 1.11.2 → 1.11.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +7 -0
  2. data/lib/jquery/datatables/rails/engine.rb +1 -1
  3. data/lib/jquery/datatables/rails/version.rb +1 -1
  4. data/vendor/assets/images/dataTables/extras/button.png +0 -0
  5. data/vendor/assets/images/dataTables/extras/insert.png +0 -0
  6. data/vendor/assets/images/dataTables/foundation/sort_asc.png +0 -0
  7. data/vendor/assets/images/dataTables/foundation/sort_asc_disabled.png +0 -0
  8. data/vendor/assets/images/dataTables/foundation/sort_both.png +0 -0
  9. data/vendor/assets/images/dataTables/foundation/sort_desc.png +0 -0
  10. data/vendor/assets/images/dataTables/foundation/sort_desc_disabled.png +0 -0
  11. data/vendor/assets/images/dataTables/minus.png +0 -0
  12. data/vendor/assets/images/dataTables/plus.png +0 -0
  13. data/vendor/assets/javascripts/dataTables/extras/ColReorder.js +41 -15
  14. data/vendor/assets/javascripts/dataTables/extras/ColVis.js +1 -9
  15. data/vendor/assets/javascripts/dataTables/extras/TableTools.js +121 -69
  16. data/vendor/assets/javascripts/dataTables/extras/TableTools.min.js +50 -49
  17. data/vendor/assets/javascripts/dataTables/jquery.dataTables.bootstrap.js +2 -2
  18. data/vendor/assets/javascripts/dataTables/jquery.dataTables.bootstrap3.js +152 -0
  19. data/vendor/assets/javascripts/dataTables/jquery.dataTables.foundation.js +186 -0
  20. data/vendor/assets/javascripts/dataTables/jquery.dataTables.responsive.js +435 -0
  21. data/vendor/assets/media/dataTables/extras/as3/ZeroClipboard.as +1 -1
  22. data/vendor/assets/media/dataTables/extras/as3/ZeroClipboardPdf.as +1 -1
  23. data/vendor/assets/media/dataTables/extras/swf/copy_csv_xls.swf +0 -0
  24. data/vendor/assets/media/dataTables/extras/swf/copy_csv_xls_pdf.swf +0 -0
  25. data/vendor/assets/stylesheets/dataTables/extras/ColReorder.css.erb +21 -0
  26. data/vendor/assets/stylesheets/dataTables/extras/ColVis.css +76 -0
  27. data/vendor/assets/stylesheets/dataTables/extras/ColVisAlt.css.erb +104 -0
  28. data/vendor/assets/stylesheets/dataTables/extras/{TableTools.css → TableTools.css.erb} +39 -31
  29. data/vendor/assets/stylesheets/dataTables/jquery.dataTables.bootstrap.css.scss +5 -0
  30. data/vendor/assets/stylesheets/dataTables/jquery.dataTables.bootstrap3.css.scss +216 -0
  31. data/vendor/assets/stylesheets/dataTables/jquery.dataTables.foundation.css.scss +211 -0
  32. data/vendor/assets/stylesheets/dataTables/jquery.dataTables.responsive.css.scss +22 -0
  33. metadata +28 -15
@@ -17,60 +17,61 @@ break;case "mouseover":this.domElement&&this.cssEffects&&this.recoverActive&&thi
17
17
 
18
18
  /*
19
19
  * File: TableTools.min.js
20
- * Version: 2.1.3
20
+ * Version: 2.1.5
21
21
  * Author: Allan Jardine (www.sprymedia.co.uk)
22
- *
22
+ *
23
23
  * Copyright 2009-2012 Allan Jardine, all rights reserved.
24
24
  *
25
25
  * This source file is free software, under either the GPL v2 license or a
26
26
  * BSD (3 point) style license, as supplied with this software.
27
- *
28
- * This source file is distributed in the hope that it will be useful, but
29
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
27
+ *
28
+ * This source file is distributed in the hope that it will be useful, but
29
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
30
30
  * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
31
31
  */
32
32
  var TableTools;
33
- (function(e,m,f){TableTools=function(a,b){!this instanceof TableTools&&alert("Warning: TableTools must be initialised with the keyword 'new'");this.s={that:this,dt:a.fnSettings(),print:{saveStart:-1,saveLength:-1,saveScroll:-1,funcEnd:function(){}},buttonCounter:0,select:{type:"",selected:[],preRowSelect:null,postSelected:null,postDeselected:null,all:!1,selectedClass:""},custom:{},swfPath:"",buttonSet:[],master:!1,tags:{}};this.dom={container:null,table:null,print:{hidden:[],message:null},collection:{collection:null,
34
- background:null}};this.classes=e.extend(!0,{},TableTools.classes);this.s.dt.bJUI&&e.extend(!0,this.classes,TableTools.classes_themeroller);this.fnSettings=function(){return this.s};"undefined"==typeof b&&(b={});this._fnConstruct(b);return this};TableTools.prototype={fnGetSelected:function(){var a=[],b=this.s.dt.aoData,c,d;c=0;for(d=b.length;c<d;c++)b[c]._DTTT_selected&&a.push(b[c].nTr);return a},fnGetSelectedData:function(){var a=[],b=this.s.dt.aoData,c,d;c=0;for(d=b.length;c<d;c++)b[c]._DTTT_selected&&
35
- a.push(this.s.dt.oInstance.fnGetData(c));return a},fnIsSelected:function(a){a=this.s.dt.oInstance.fnGetPosition(a);return!0===this.s.dt.aoData[a]._DTTT_selected?!0:!1},fnSelectAll:function(a){var b=this._fnGetMasterSettings();this._fnRowSelect(!0===a?b.dt.aiDisplay:b.dt.aoData)},fnSelectNone:function(a){var b=this._fnGetMasterSettings();this._fnRowDeselect(!0===a?b.dt.aiDisplay:b.dt.aoData)},fnSelect:function(a){"single"==this.s.select.type?(this.fnSelectNone(),this._fnRowSelect(a)):"multi"==this.s.select.type&&
36
- this._fnRowSelect(a)},fnDeselect:function(a){this._fnRowDeselect(a)},fnGetTitle:function(a){var b="";"undefined"!=typeof a.sTitle&&""!==a.sTitle?b=a.sTitle:(a=f.getElementsByTagName("title"),0<a.length&&(b=a[0].innerHTML));return 4>"\u00a1".toString().length?b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""):b.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g,"")},fnCalcColRatios:function(a){var b=this.s.dt.aoColumns,a=this._fnColumnTargets(a.mColumns),c=[],d=0,e=0,h,f;h=0;for(f=a.length;h<f;h++)a[h]&&(d=
37
- b[h].nTh.offsetWidth,e+=d,c.push(d));h=0;for(f=c.length;h<f;h++)c[h]/=e;return c.join("\t")},fnGetTableData:function(a){if(this.s.dt)return this._fnGetDataTablesData(a)},fnSetText:function(a,b){this._fnFlashSetText(a,b)},fnResizeButtons:function(){for(var a in ZeroClipboard_TableTools.clients)if(a){var b=ZeroClipboard_TableTools.clients[a];"undefined"!=typeof b.domElement&&b.domElement.parentNode&&b.positionElement()}},fnResizeRequired:function(){for(var a in ZeroClipboard_TableTools.clients)if(a){var b=
38
- ZeroClipboard_TableTools.clients[a];if("undefined"!=typeof b.domElement&&b.domElement.parentNode==this.dom.container&&!1===b.sized)return!0}return!1},fnPrint:function(a,b){void 0===b&&(b={});void 0===a||a?this._fnPrintStart(b):this._fnPrintEnd()},fnInfo:function(a,b){var c=f.createElement("div");c.className=this.classes.print.info;c.innerHTML=a;f.body.appendChild(c);setTimeout(function(){e(c).fadeOut("normal",function(){f.body.removeChild(c)})},b)},_fnConstruct:function(a){var b=this;this._fnCustomiseSettings(a);
39
- this.dom.container=f.createElement(this.s.tags.container);this.dom.container.className=this.classes.container;"none"!=this.s.select.type&&this._fnRowSelectConfig();this._fnButtonDefinations(this.s.buttonSet,this.dom.container);this.s.dt.aoDestroyCallback.push({sName:"TableTools",fn:function(){b.dom.container.innerHTML=""}})},_fnCustomiseSettings:function(a){"undefined"==typeof this.s.dt._TableToolsInit&&(this.s.master=!0,this.s.dt._TableToolsInit=!0);this.dom.table=this.s.dt.nTable;this.s.custom=
40
- e.extend({},TableTools.DEFAULTS,a);this.s.swfPath=this.s.custom.sSwfPath;"undefined"!=typeof ZeroClipboard_TableTools&&(ZeroClipboard_TableTools.moviePath=this.s.swfPath);this.s.select.type=this.s.custom.sRowSelect;this.s.select.preRowSelect=this.s.custom.fnPreRowSelect;this.s.select.postSelected=this.s.custom.fnRowSelected;this.s.select.postDeselected=this.s.custom.fnRowDeselected;this.s.custom.sSelectedClass&&(this.classes.select.row=this.s.custom.sSelectedClass);this.s.tags=this.s.custom.oTags;
41
- this.s.buttonSet=this.s.custom.aButtons},_fnButtonDefinations:function(a,b){for(var c,d=0,g=a.length;d<g;d++){if("string"==typeof a[d]){if("undefined"==typeof TableTools.BUTTONS[a[d]]){alert("TableTools: Warning - unknown button type: "+a[d]);continue}c=e.extend({},TableTools.BUTTONS[a[d]],!0)}else{if("undefined"==typeof TableTools.BUTTONS[a[d].sExtends]){alert("TableTools: Warning - unknown button type: "+a[d].sExtends);continue}c=e.extend({},TableTools.BUTTONS[a[d].sExtends],!0);c=e.extend(c,a[d],
42
- !0)}b.appendChild(this._fnCreateButton(c,e(b).hasClass(this.classes.collection.container)))}},_fnCreateButton:function(a,b){var c=this._fnButtonBase(a,b);a.sAction.match(/flash/)?this._fnFlashConfig(c,a):"text"==a.sAction?this._fnTextConfig(c,a):"div"==a.sAction?this._fnTextConfig(c,a):"collection"==a.sAction&&(this._fnTextConfig(c,a),this._fnCollectionConfig(c,a));return c},_fnButtonBase:function(a,b){var c,d,e;b?(c="default"!==a.sTag?a.sTag:this.s.tags.collection.button,d="default"!==a.sLinerTag?
43
- a.sLiner:this.s.tags.collection.liner,e=this.classes.collection.buttons.normal):(c="default"!==a.sTag?a.sTag:this.s.tags.button,d="default"!==a.sLinerTag?a.sLiner:this.s.tags.liner,e=this.classes.buttons.normal);c=f.createElement(c);d=f.createElement(d);var h=this._fnGetMasterSettings();c.className=e+" "+a.sButtonClass;c.setAttribute("id","ToolTables_"+this.s.dt.sInstance+"_"+h.buttonCounter);c.appendChild(d);d.innerHTML=a.sButtonText;h.buttonCounter++;return c},_fnGetMasterSettings:function(){if(this.s.master)return this.s;
44
- for(var a=TableTools._aInstances,b=0,c=a.length;b<c;b++)if(this.dom.table==a[b].s.dt.nTable)return a[b].s},_fnCollectionConfig:function(a,b){var c=f.createElement(this.s.tags.collection.container);c.style.display="none";c.className=this.classes.collection.container;b._collection=c;f.body.appendChild(c);this._fnButtonDefinations(b.aButtons,c)},_fnCollectionShow:function(a,b){var c=this,d=e(a).offset(),g=b._collection,h=d.left,d=d.top+e(a).outerHeight(),p=e(m).height(),j=e(f).height(),k=e(m).width(),
45
- n=e(f).width();g.style.position="absolute";g.style.left=h+"px";g.style.top=d+"px";g.style.display="block";e(g).css("opacity",0);var l=f.createElement("div");l.style.position="absolute";l.style.left="0px";l.style.top="0px";l.style.height=(p>j?p:j)+"px";l.style.width=(k>n?k:n)+"px";l.className=this.classes.collection.background;e(l).css("opacity",0);f.body.appendChild(l);f.body.appendChild(g);p=e(g).outerWidth();k=e(g).outerHeight();h+p>n&&(g.style.left=n-p+"px");d+k>j&&(g.style.top=d-k-e(a).outerHeight()+
46
- "px");this.dom.collection.collection=g;this.dom.collection.background=l;setTimeout(function(){e(g).animate({opacity:1},500);e(l).animate({opacity:0.25},500)},10);this.fnResizeButtons();e(l).click(function(){c._fnCollectionHide.call(c,null,null)})},_fnCollectionHide:function(a,b){!(null!==b&&"collection"==b.sExtends)&&null!==this.dom.collection.collection&&(e(this.dom.collection.collection).animate({opacity:0},500,function(){this.style.display="none"}),e(this.dom.collection.background).animate({opacity:0},
47
- 500,function(){this.parentNode.removeChild(this)}),this.dom.collection.collection=null,this.dom.collection.background=null)},_fnRowSelectConfig:function(){if(this.s.master){var a=this,b=this.s.dt;e(b.nTable).addClass(this.classes.select.table);e("tr",b.nTBody).live("click",function(c){if(this.parentNode==b.nTBody&&null!==b.oInstance.fnGetData(this)&&(null===a.s.select.preRowSelect||a.s.select.preRowSelect.call(a,c)))a.fnIsSelected(this)?a._fnRowDeselect(this):"single"==a.s.select.type?(a.fnSelectNone(),
48
- a._fnRowSelect(this)):"multi"==a.s.select.type&&a._fnRowSelect(this)});b.oApi._fnCallbackReg(b,"aoRowCreatedCallback",function(c,d,g){b.aoData[g]._DTTT_selected&&e(c).addClass(a.classes.select.row)},"TableTools-SelectAll")}},_fnRowSelect:function(a){for(var a=this._fnSelectData(a),b=0===a.length?null:a[0].nTr,c=0,d=a.length;c<d;c++)a[c]._DTTT_selected=!0,a[c].nTr&&e(a[c].nTr).addClass(this.classes.select.row);null!==this.s.select.postSelected&&this.s.select.postSelected.call(this,b);TableTools._fnEventDispatch(this,
49
- "select",b)},_fnRowDeselect:function(a){for(var a=this._fnSelectData(a),b=0===a.length?null:a[0].nTr,c=0,d=a.length;c<d;c++)a[c].nTr&&a[c]._DTTT_selected&&e(a[c].nTr).removeClass(this.classes.select.row),a[c]._DTTT_selected=!1;null!==this.s.select.postDeselected&&this.s.select.postDeselected.call(this,b);TableTools._fnEventDispatch(this,"select",b)},_fnSelectData:function(a){var b=[],c,d,e;if(a.nodeName)c=this.s.dt.oInstance.fnGetPosition(a),b.push(this.s.dt.aoData[c]);else if("undefined"!==typeof a.length){d=
50
- 0;for(e=a.length;d<e;d++)a[d].nodeName?(c=this.s.dt.oInstance.fnGetPosition(a[d]),b.push(this.s.dt.aoData[c])):"number"===typeof a[d]?b.push(this.s.dt.aoData[a[d]]):b.push(a[d])}else b.push(a);return b},_fnTextConfig:function(a,b){var c=this;null!==b.fnInit&&b.fnInit.call(this,a,b);""!==b.sToolTip&&(a.title=b.sToolTip);e(a).hover(function(){b.fnMouseover!==null&&b.fnMouseover.call(this,a,b,null)},function(){b.fnMouseout!==null&&b.fnMouseout.call(this,a,b,null)});null!==b.fnSelect&&TableTools._fnEventListen(this,
51
- "select",function(d){b.fnSelect.call(c,a,b,d)});e(a).click(function(){b.fnClick!==null&&b.fnClick.call(c,a,b,null);b.fnComplete!==null&&b.fnComplete.call(c,a,b,null,null);c._fnCollectionHide(a,b)})},_fnFlashConfig:function(a,b){var c=this,d=new ZeroClipboard_TableTools.Client;null!==b.fnInit&&b.fnInit.call(this,a,b);d.setHandCursor(!0);"flash_save"==b.sAction?(d.setAction("save"),d.setCharSet("utf16le"==b.sCharSet?"UTF16LE":"UTF8"),d.setBomInc(b.bBomInc),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):
52
- "flash_pdf"==b.sAction?(d.setAction("pdf"),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):d.setAction("copy");d.addEventListener("mouseOver",function(){b.fnMouseover!==null&&b.fnMouseover.call(c,a,b,d)});d.addEventListener("mouseOut",function(){b.fnMouseout!==null&&b.fnMouseout.call(c,a,b,d)});d.addEventListener("mouseDown",function(){b.fnClick!==null&&b.fnClick.call(c,a,b,d)});d.addEventListener("complete",function(e,h){b.fnComplete!==null&&b.fnComplete.call(c,a,b,d,h);c._fnCollectionHide(a,
53
- b)});this._fnFlashGlue(d,a,b.sToolTip)},_fnFlashGlue:function(a,b,c){var d=this,e=b.getAttribute("id");f.getElementById(e)?a.glue(b,c):setTimeout(function(){d._fnFlashGlue(a,b,c)},100)},_fnFlashSetText:function(a,b){var c=this._fnChunkData(b,8192);a.clearText();for(var d=0,e=c.length;d<e;d++)a.appendText(c[d])},_fnColumnTargets:function(a){var b=[],c=this.s.dt;if("object"==typeof a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(!1);i=0;for(iLen=a.length;i<iLen;i++)b[a[i]]=!0}else if("visible"==
54
- a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!0:!1)}else if("hidden"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!1:!0)}else if("sortable"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bSortable?!0:!1)}else{i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(!0)}return b},_fnNewline:function(a){return"auto"==a.sNewLine?navigator.userAgent.match(/Windows/)?"\r\n":"\n":a.sNewLine},_fnGetDataTablesData:function(a){var b,
55
- c,d,g,h,f=[],j="",k=this.s.dt,n,l=RegExp(a.sFieldBoundary,"g"),m=this._fnColumnTargets(a.mColumns);d="undefined"!=typeof a.bSelectedOnly?a.bSelectedOnly:!1;if(a.bHeader){h=[];b=0;for(c=k.aoColumns.length;b<c;b++)m[b]&&(j=k.aoColumns[b].sTitle.replace(/\n/g," ").replace(/<.*?>/g,"").replace(/^\s+|\s+$/g,""),j=this._fnHtmlDecode(j),h.push(this._fnBoundData(j,a.sFieldBoundary,l)));f.push(h.join(a.sFieldSeperator))}var o=k.aiDisplay;g=this.fnGetSelected();if("none"!==this.s.select.type&&d&&0!==g.length){o=
56
- [];b=0;for(c=g.length;b<c;b++)o.push(k.oInstance.fnGetPosition(g[b]))}d=0;for(g=o.length;d<g;d++){n=k.aoData[o[d]].nTr;h=[];b=0;for(c=k.aoColumns.length;b<c;b++)m[b]&&(j=k.oApi._fnGetCellData(k,o[d],b,"display"),a.fnCellRender?j=a.fnCellRender(j,b,n,o[d])+"":"string"==typeof j?(j=j.replace(/\n/g," "),j=j.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi,"$1$2$3"),j=j.replace(/<.*?>/g,"")):j+="",j=j.replace(/^\s+/,"").replace(/\s+$/,""),j=this._fnHtmlDecode(j),h.push(this._fnBoundData(j,
57
- a.sFieldBoundary,l)));f.push(h.join(a.sFieldSeperator));a.bOpenRows&&(b=e.grep(k.aoOpenRows,function(a){return a.nParent===n}),1===b.length&&(j=this._fnBoundData(e("td",b[0].nTr).html(),a.sFieldBoundary,l),f.push(j)))}if(a.bFooter&&null!==k.nTFoot){h=[];b=0;for(c=k.aoColumns.length;b<c;b++)m[b]&&null!==k.aoColumns[b].nTf&&(j=k.aoColumns[b].nTf.innerHTML.replace(/\n/g," ").replace(/<.*?>/g,""),j=this._fnHtmlDecode(j),h.push(this._fnBoundData(j,a.sFieldBoundary,l)));f.push(h.join(a.sFieldSeperator))}return _sLastData=
58
- f.join(this._fnNewline(a))},_fnBoundData:function(a,b,c){return""===b?a:b+a.replace(c,b+b)+b},_fnChunkData:function(a,b){for(var c=[],d=a.length,e=0;e<d;e+=b)e+b<d?c.push(a.substring(e,e+b)):c.push(a.substring(e,d));return c},_fnHtmlDecode:function(a){if(-1==a.indexOf("&"))return a;var a=this._fnChunkData(a,2048),b=f.createElement("div"),c,d,e,h="";c=0;for(d=a.length;c<d;c++)e=a[c].lastIndexOf("&"),-1!=e&&(8<=a[c].length&&e>a[c].length-8)&&(a[c].substr(e),a[c]=a[c].substr(0,e)),b.innerHTML=a[c],h+=
59
- b.childNodes[0].nodeValue;return h},_fnPrintStart:function(a){var b=this,c=this.s.dt;this._fnPrintHideNodes(c.nTable);this.s.print.saveStart=c._iDisplayStart;this.s.print.saveLength=c._iDisplayLength;a.bShowAll&&(c._iDisplayStart=0,c._iDisplayLength=-1,c.oApi._fnCalculateEnd(c),c.oApi._fnDraw(c));(""!==c.oScroll.sX||""!==c.oScroll.sY)&&this._fnPrintScrollStart(c);var c=c.aanFeatures,d;for(d in c)if("i"!=d&&"t"!=d&&1==d.length)for(var g=0,h=c[d].length;g<h;g++)this.dom.print.hidden.push({node:c[d][g],
60
- display:"block"}),c[d][g].style.display="none";e(f.body).addClass(this.classes.print.body);""!==a.sInfo&&this.fnInfo(a.sInfo,3E3);a.sMessage&&(this.dom.print.message=f.createElement("div"),this.dom.print.message.className=this.classes.print.message,this.dom.print.message.innerHTML=a.sMessage,f.body.insertBefore(this.dom.print.message,f.body.childNodes[0]));this.s.print.saveScroll=e(m).scrollTop();m.scrollTo(0,0);e(f).bind("keydown.DTTT",function(a){if(a.keyCode==27){a.preventDefault();b._fnPrintEnd.call(b,
61
- a)}})},_fnPrintEnd:function(){var a=this.s.dt,b=this.s.print,c=this.dom.print;this._fnPrintShowNodes();(""!==a.oScroll.sX||""!==a.oScroll.sY)&&this._fnPrintScrollEnd();m.scrollTo(0,b.saveScroll);null!==c.message&&(f.body.removeChild(c.message),c.message=null);e(f.body).removeClass("DTTT_Print");a._iDisplayStart=b.saveStart;a._iDisplayLength=b.saveLength;a.oApi._fnCalculateEnd(a);a.oApi._fnDraw(a);e(f).unbind("keydown.DTTT")},_fnPrintScrollStart:function(){var a=this.s.dt;a.nScrollHead.getElementsByTagName("div")[0].getElementsByTagName("table");
62
- var b=a.nTable.parentNode,c=a.nTable.getElementsByTagName("thead");0<c.length&&a.nTable.removeChild(c[0]);null!==a.nTFoot&&(c=a.nTable.getElementsByTagName("tfoot"),0<c.length&&a.nTable.removeChild(c[0]));c=a.nTHead.cloneNode(!0);a.nTable.insertBefore(c,a.nTable.childNodes[0]);null!==a.nTFoot&&(c=a.nTFoot.cloneNode(!0),a.nTable.insertBefore(c,a.nTable.childNodes[1]));""!==a.oScroll.sX&&(a.nTable.style.width=e(a.nTable).outerWidth()+"px",b.style.width=e(a.nTable).outerWidth()+"px",b.style.overflow=
63
- "visible");""!==a.oScroll.sY&&(b.style.height=e(a.nTable).outerHeight()+"px",b.style.overflow="visible")},_fnPrintScrollEnd:function(){var a=this.s.dt,b=a.nTable.parentNode;""!==a.oScroll.sX&&(b.style.width=a.oApi._fnStringToCss(a.oScroll.sX),b.style.overflow="auto");""!==a.oScroll.sY&&(b.style.height=a.oApi._fnStringToCss(a.oScroll.sY),b.style.overflow="auto")},_fnPrintShowNodes:function(){for(var a=this.dom.print.hidden,b=0,c=a.length;b<c;b++)a[b].node.style.display=a[b].display;a.splice(0,a.length)},
64
- _fnPrintHideNodes:function(a){for(var b=this.dom.print.hidden,c=a.parentNode,d=c.childNodes,g=0,h=d.length;g<h;g++)if(d[g]!=a&&1==d[g].nodeType){var f=e(d[g]).css("display");"none"!=f&&(b.push({node:d[g],display:f}),d[g].style.display="none")}"BODY"!=c.nodeName&&this._fnPrintHideNodes(c)}};TableTools._aInstances=[];TableTools._aListeners=[];TableTools.fnGetMasters=function(){for(var a=[],b=0,c=TableTools._aInstances.length;b<c;b++)TableTools._aInstances[b].s.master&&a.push(TableTools._aInstances[b]);
65
- return a};TableTools.fnGetInstance=function(a){"object"!=typeof a&&(a=f.getElementById(a));for(var b=0,c=TableTools._aInstances.length;b<c;b++)if(TableTools._aInstances[b].s.master&&TableTools._aInstances[b].dom.table==a)return TableTools._aInstances[b];return null};TableTools._fnEventListen=function(a,b,c){TableTools._aListeners.push({that:a,type:b,fn:c})};TableTools._fnEventDispatch=function(a,b,c){for(var d=TableTools._aListeners,e=0,f=d.length;e<f;e++)a.dom.table==d[e].that.dom.table&&d[e].type==
66
- b&&d[e].fn(c)};TableTools.buttonBase={sAction:"text",sTag:"default",sLinerTag:"default",sButtonClass:"DTTT_button_text",sButtonText:"Button text",sTitle:"",sToolTip:"",sCharSet:"utf8",bBomInc:!1,sFileName:"*.csv",sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"auto",mColumns:"all",bHeader:!0,bFooter:!0,bOpenRows:!1,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null};TableTools.BUTTONS={csv:e.extend({},TableTools.buttonBase,{sAction:"flash_save",
67
- sButtonClass:"DTTT_button_csv",sButtonText:"CSV",sFieldBoundary:'"',sFieldSeperator:",",fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))}}),xls:e.extend({},TableTools.buttonBase,{sAction:"flash_save",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"DTTT_button_xls",sButtonText:"Excel",fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))}}),copy:e.extend({},TableTools.buttonBase,{sAction:"flash_copy",sButtonClass:"DTTT_button_copy",sButtonText:"Copy",fnClick:function(a,b,c){this.fnSetText(c,
68
- this.fnGetTableData(b))},fnComplete:function(a,b,c,d){a=d.split("\n").length;a=null===this.s.dt.nTFoot?a-1:a-2;this.fnInfo("<h6>Table copied</h6><p>Copied "+a+" row"+(1==a?"":"s")+" to the clipboard.</p>",1500)}}),pdf:e.extend({},TableTools.buttonBase,{sAction:"flash_pdf",sNewLine:"\n",sFileName:"*.pdf",sButtonClass:"DTTT_button_pdf",sButtonText:"PDF",sPdfOrientation:"portrait",sPdfSize:"A4",sPdfMessage:"",fnClick:function(a,b,c){this.fnSetText(c,"title:"+this.fnGetTitle(b)+"\nmessage:"+b.sPdfMessage+
69
- "\ncolWidth:"+this.fnCalcColRatios(b)+"\norientation:"+b.sPdfOrientation+"\nsize:"+b.sPdfSize+"\n--/TableToolsOpts--\n"+this.fnGetTableData(b))}}),print:e.extend({},TableTools.buttonBase,{sInfo:"<h6>Print view</h6><p>Please use your browser's print function to print this table. Press escape when finished.",sMessage:null,bShowAll:!0,sToolTip:"View print view",sButtonClass:"DTTT_button_print",sButtonText:"Print",fnClick:function(a,b){this.fnPrint(!0,b)}}),text:e.extend({},TableTools.buttonBase),select:e.extend({},
70
- TableTools.buttonBase,{sButtonText:"Select button",fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),select_single:e.extend({},TableTools.buttonBase,{sButtonText:"Select button",fnSelect:function(a){1==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),
71
- select_all:e.extend({},TableTools.buttonBase,{sButtonText:"Select all",fnClick:function(){this.fnSelectAll()},fnSelect:function(a){this.fnGetSelected().length==this.s.dt.fnRecordsDisplay()?e(a).addClass(this.classes.buttons.disabled):e(a).removeClass(this.classes.buttons.disabled)}}),select_none:e.extend({},TableTools.buttonBase,{sButtonText:"Deselect all",fnClick:function(){this.fnSelectNone()},fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},
72
- fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),ajax:e.extend({},TableTools.buttonBase,{sAjaxUrl:"/xhr.php",sButtonText:"Ajax button",fnClick:function(a,b){var c=this.fnGetTableData(b);e.ajax({url:b.sAjaxUrl,data:[{name:"tableData",value:c}],success:b.fnAjaxComplete,dataType:"json",type:"POST",cache:!1,error:function(){alert("Error detected when sending table data to server")}})},fnAjaxComplete:function(){alert("Ajax complete")}}),div:e.extend({},TableTools.buttonBase,{sAction:"div",
73
- sTag:"div",sButtonClass:"DTTT_nonbutton",sButtonText:"Text button"}),collection:e.extend({},TableTools.buttonBase,{sAction:"collection",sButtonClass:"DTTT_button_collection",sButtonText:"Collection",fnClick:function(a,b){this._fnCollectionShow(a,b)}})};TableTools.classes={container:"DTTT_container",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"},collection:{container:"DTTT_collection",background:"DTTT_collection_background",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"}},select:{table:"DTTT_selectable",
74
- row:"DTTT_selected"},print:{body:"DTTT_Print",info:"DTTT_print_info",message:"DTTT_PrintMessage"}};TableTools.classes_themeroller={container:"DTTT_container ui-buttonset ui-buttonset-multi",buttons:{normal:"DTTT_button ui-button ui-state-default"},collection:{container:"DTTT_collection ui-buttonset ui-buttonset-multi"}};TableTools.DEFAULTS={sSwfPath:"media/swf/copy_csv_xls_pdf.swf",sRowSelect:"none",sSelectedClass:null,fnPreRowSelect:null,fnRowSelected:null,fnRowDeselected:null,aButtons:["copy","csv",
75
- "xls","pdf","print"],oTags:{container:"div",button:"a",liner:"span",collection:{container:"div",button:"a",liner:"span"}}};TableTools.prototype.CLASS="TableTools";TableTools.VERSION="2.1.3";TableTools.prototype.VERSION=TableTools.VERSION;"function"==typeof e.fn.dataTable&&"function"==typeof e.fn.dataTableExt.fnVersionCheck&&e.fn.dataTableExt.fnVersionCheck("1.9.0")?e.fn.dataTableExt.aoFeatures.push({fnInit:function(a){a=new TableTools(a.oInstance,"undefined"!=typeof a.oInit.oTableTools?a.oInit.oTableTools:
76
- {});TableTools._aInstances.push(a);return a.dom.container},cFeature:"T",sFeature:"TableTools"}):alert("Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download");e.fn.DataTable.TableTools=TableTools})(jQuery,window,document);
33
+ (function(e,n,g){TableTools=function(a,b){!this instanceof TableTools&&alert("Warning: TableTools must be initialised with the keyword 'new'");this.s={that:this,dt:a.fnSettings(),print:{saveStart:-1,saveLength:-1,saveScroll:-1,funcEnd:function(){}},buttonCounter:0,select:{type:"",selected:[],preRowSelect:null,postSelected:null,postDeselected:null,all:!1,selectedClass:""},custom:{},swfPath:"",buttonSet:[],master:!1,tags:{}};this.dom={container:null,table:null,print:{hidden:[],message:null},collection:{collection:null,
34
+ background:null}};this.classes=e.extend(!0,{},TableTools.classes);this.s.dt.bJUI&&e.extend(!0,this.classes,TableTools.classes_themeroller);this.fnSettings=function(){return this.s};"undefined"==typeof b&&(b={});this._fnConstruct(b);return this};TableTools.prototype={fnGetSelected:function(a){var b=[],c=this.s.dt.aoData,d=this.s.dt.aiDisplay,f;if(a){a=0;for(f=d.length;a<f;a++)c[d[a]]._DTTT_selected&&b.push(c[d[a]].nTr)}else{a=0;for(f=c.length;a<f;a++)c[a]._DTTT_selected&&b.push(c[a].nTr)}return b},
35
+ fnGetSelectedData:function(){var a=[],b=this.s.dt.aoData,c,d;c=0;for(d=b.length;c<d;c++)b[c]._DTTT_selected&&a.push(this.s.dt.oInstance.fnGetData(c));return a},fnIsSelected:function(a){a=this.s.dt.oInstance.fnGetPosition(a);return!0===this.s.dt.aoData[a]._DTTT_selected?!0:!1},fnSelectAll:function(a){var b=this._fnGetMasterSettings();this._fnRowSelect(!0===a?b.dt.aiDisplay:b.dt.aoData)},fnSelectNone:function(a){this._fnGetMasterSettings();this._fnRowDeselect(this.fnGetSelected(a))},fnSelect:function(a){"single"==
36
+ this.s.select.type?(this.fnSelectNone(),this._fnRowSelect(a)):"multi"==this.s.select.type&&this._fnRowSelect(a)},fnDeselect:function(a){this._fnRowDeselect(a)},fnGetTitle:function(a){var b="";"undefined"!=typeof a.sTitle&&""!==a.sTitle?b=a.sTitle:(a=g.getElementsByTagName("title"),0<a.length&&(b=a[0].innerHTML));return 4>"\u00a1".toString().length?b.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g,""):b.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g,"")},fnCalcColRatios:function(a){var b=this.s.dt.aoColumns,
37
+ a=this._fnColumnTargets(a.mColumns),c=[],d=0,f=0,e,g;e=0;for(g=a.length;e<g;e++)a[e]&&(d=b[e].nTh.offsetWidth,f+=d,c.push(d));e=0;for(g=c.length;e<g;e++)c[e]/=f;return c.join("\t")},fnGetTableData:function(a){if(this.s.dt)return this._fnGetDataTablesData(a)},fnSetText:function(a,b){this._fnFlashSetText(a,b)},fnResizeButtons:function(){for(var a in ZeroClipboard_TableTools.clients)if(a){var b=ZeroClipboard_TableTools.clients[a];"undefined"!=typeof b.domElement&&b.domElement.parentNode&&b.positionElement()}},
38
+ fnResizeRequired:function(){for(var a in ZeroClipboard_TableTools.clients)if(a){var b=ZeroClipboard_TableTools.clients[a];if("undefined"!=typeof b.domElement&&b.domElement.parentNode==this.dom.container&&!1===b.sized)return!0}return!1},fnPrint:function(a,b){void 0===b&&(b={});void 0===a||a?this._fnPrintStart(b):this._fnPrintEnd()},fnInfo:function(a,b){var c=g.createElement("div");c.className=this.classes.print.info;c.innerHTML=a;g.body.appendChild(c);setTimeout(function(){e(c).fadeOut("normal",function(){g.body.removeChild(c)})},
39
+ b)},_fnConstruct:function(a){var b=this;this._fnCustomiseSettings(a);this.dom.container=g.createElement(this.s.tags.container);this.dom.container.className=this.classes.container;"none"!=this.s.select.type&&this._fnRowSelectConfig();this._fnButtonDefinations(this.s.buttonSet,this.dom.container);this.s.dt.aoDestroyCallback.push({sName:"TableTools",fn:function(){e(b.s.dt.nTBody).off("click.DTTT_Select","tr");e(b.dom.container).empty()}})},_fnCustomiseSettings:function(a){"undefined"==typeof this.s.dt._TableToolsInit&&
40
+ (this.s.master=!0,this.s.dt._TableToolsInit=!0);this.dom.table=this.s.dt.nTable;this.s.custom=e.extend({},TableTools.DEFAULTS,a);this.s.swfPath=this.s.custom.sSwfPath;"undefined"!=typeof ZeroClipboard_TableTools&&(ZeroClipboard_TableTools.moviePath=this.s.swfPath);this.s.select.type=this.s.custom.sRowSelect;this.s.select.preRowSelect=this.s.custom.fnPreRowSelect;this.s.select.postSelected=this.s.custom.fnRowSelected;this.s.select.postDeselected=this.s.custom.fnRowDeselected;this.s.custom.sSelectedClass&&
41
+ (this.classes.select.row=this.s.custom.sSelectedClass);this.s.tags=this.s.custom.oTags;this.s.buttonSet=this.s.custom.aButtons},_fnButtonDefinations:function(a,b){for(var c,d=0,f=a.length;d<f;d++){if("string"==typeof a[d]){if("undefined"==typeof TableTools.BUTTONS[a[d]]){alert("TableTools: Warning - unknown button type: "+a[d]);continue}c=e.extend({},TableTools.BUTTONS[a[d]],!0)}else{if("undefined"==typeof TableTools.BUTTONS[a[d].sExtends]){alert("TableTools: Warning - unknown button type: "+a[d].sExtends);
42
+ continue}c=e.extend({},TableTools.BUTTONS[a[d].sExtends],!0);c=e.extend(c,a[d],!0)}b.appendChild(this._fnCreateButton(c,e(b).hasClass(this.classes.collection.container)))}},_fnCreateButton:function(a,b){var c=this._fnButtonBase(a,b);a.sAction.match(/flash/)?this._fnFlashConfig(c,a):"text"==a.sAction?this._fnTextConfig(c,a):"div"==a.sAction?this._fnTextConfig(c,a):"collection"==a.sAction&&(this._fnTextConfig(c,a),this._fnCollectionConfig(c,a));return c},_fnButtonBase:function(a,b){var c,d,f;b?(c="default"!==
43
+ a.sTag?a.sTag:this.s.tags.collection.button,d="default"!==a.sLinerTag?a.sLiner:this.s.tags.collection.liner,f=this.classes.collection.buttons.normal):(c="default"!==a.sTag?a.sTag:this.s.tags.button,d="default"!==a.sLinerTag?a.sLiner:this.s.tags.liner,f=this.classes.buttons.normal);c=g.createElement(c);d=g.createElement(d);var e=this._fnGetMasterSettings();c.className=f+" "+a.sButtonClass;c.setAttribute("id","ToolTables_"+this.s.dt.sInstance+"_"+e.buttonCounter);c.appendChild(d);d.innerHTML=a.sButtonText;
44
+ e.buttonCounter++;return c},_fnGetMasterSettings:function(){if(this.s.master)return this.s;for(var a=TableTools._aInstances,b=0,c=a.length;b<c;b++)if(this.dom.table==a[b].s.dt.nTable)return a[b].s},_fnCollectionConfig:function(a,b){var c=g.createElement(this.s.tags.collection.container);c.style.display="none";c.className=this.classes.collection.container;b._collection=c;g.body.appendChild(c);this._fnButtonDefinations(b.aButtons,c)},_fnCollectionShow:function(a,b){var c=this,d=e(a).offset(),f=b._collection,
45
+ j=d.left,d=d.top+e(a).outerHeight(),m=e(n).height(),h=e(g).height(),k=e(n).width(),o=e(g).width();f.style.position="absolute";f.style.left=j+"px";f.style.top=d+"px";f.style.display="block";e(f).css("opacity",0);var l=g.createElement("div");l.style.position="absolute";l.style.left="0px";l.style.top="0px";l.style.height=(m>h?m:h)+"px";l.style.width=(k>o?k:o)+"px";l.className=this.classes.collection.background;e(l).css("opacity",0);g.body.appendChild(l);g.body.appendChild(f);m=e(f).outerWidth();k=e(f).outerHeight();
46
+ j+m>o&&(f.style.left=o-m+"px");d+k>h&&(f.style.top=d-k-e(a).outerHeight()+"px");this.dom.collection.collection=f;this.dom.collection.background=l;setTimeout(function(){e(f).animate({opacity:1},500);e(l).animate({opacity:0.25},500)},10);this.fnResizeButtons();e(l).click(function(){c._fnCollectionHide.call(c,null,null)})},_fnCollectionHide:function(a,b){!(null!==b&&"collection"==b.sExtends)&&null!==this.dom.collection.collection&&(e(this.dom.collection.collection).animate({opacity:0},500,function(){this.style.display=
47
+ "none"}),e(this.dom.collection.background).animate({opacity:0},500,function(){this.parentNode.removeChild(this)}),this.dom.collection.collection=null,this.dom.collection.background=null)},_fnRowSelectConfig:function(){if(this.s.master){var a=this,b=this.s.dt;e(b.nTable).addClass(this.classes.select.table);e(b.nTBody).on("click.DTTT_Select","tr",function(c){this.parentNode==b.nTBody&&null!==b.oInstance.fnGetData(this)&&(a.fnIsSelected(this)?a._fnRowDeselect(this,c):"single"==a.s.select.type?(a.fnSelectNone(),
48
+ a._fnRowSelect(this,c)):"multi"==a.s.select.type&&a._fnRowSelect(this,c))});b.oApi._fnCallbackReg(b,"aoRowCreatedCallback",function(c,d,f){b.aoData[f]._DTTT_selected&&e(c).addClass(a.classes.select.row)},"TableTools-SelectAll")}},_fnRowSelect:function(a,b){var c=this._fnSelectData(a),d=[],f,j;f=0;for(j=c.length;f<j;f++)c[f].nTr&&d.push(c[f].nTr);if(null===this.s.select.preRowSelect||this.s.select.preRowSelect.call(this,b,d,!0)){f=0;for(j=c.length;f<j;f++)c[f]._DTTT_selected=!0,c[f].nTr&&e(c[f].nTr).addClass(this.classes.select.row);
49
+ null!==this.s.select.postSelected&&this.s.select.postSelected.call(this,d);TableTools._fnEventDispatch(this,"select",d,!0)}},_fnRowDeselect:function(a,b){var c=this._fnSelectData(a),d=[],f,j;f=0;for(j=c.length;f<j;f++)c[f].nTr&&d.push(c[f].nTr);if(null===this.s.select.preRowSelect||this.s.select.preRowSelect.call(this,b,d,!1)){f=0;for(j=c.length;f<j;f++)c[f]._DTTT_selected=!1,c[f].nTr&&e(c[f].nTr).removeClass(this.classes.select.row);null!==this.s.select.postDeselected&&this.s.select.postDeselected.call(this,
50
+ d);TableTools._fnEventDispatch(this,"select",d,!1)}},_fnSelectData:function(a){var b=[],c,d,f;if(a.nodeName)c=this.s.dt.oInstance.fnGetPosition(a),b.push(this.s.dt.aoData[c]);else if("undefined"!==typeof a.length){d=0;for(f=a.length;d<f;d++)a[d].nodeName?(c=this.s.dt.oInstance.fnGetPosition(a[d]),b.push(this.s.dt.aoData[c])):"number"===typeof a[d]?b.push(this.s.dt.aoData[a[d]]):b.push(a[d])}else b.push(a);return b},_fnTextConfig:function(a,b){var c=this;null!==b.fnInit&&b.fnInit.call(this,a,b);""!==
51
+ b.sToolTip&&(a.title=b.sToolTip);e(a).hover(function(){b.fnMouseover!==null&&b.fnMouseover.call(this,a,b,null)},function(){b.fnMouseout!==null&&b.fnMouseout.call(this,a,b,null)});null!==b.fnSelect&&TableTools._fnEventListen(this,"select",function(d){b.fnSelect.call(c,a,b,d)});e(a).click(function(d){b.fnClick!==null&&b.fnClick.call(c,a,b,null,d);b.fnComplete!==null&&b.fnComplete.call(c,a,b,null,null);c._fnCollectionHide(a,b)})},_fnFlashConfig:function(a,b){var c=this,d=new ZeroClipboard_TableTools.Client;
52
+ null!==b.fnInit&&b.fnInit.call(this,a,b);d.setHandCursor(!0);"flash_save"==b.sAction?(d.setAction("save"),d.setCharSet("utf16le"==b.sCharSet?"UTF16LE":"UTF8"),d.setBomInc(b.bBomInc),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):"flash_pdf"==b.sAction?(d.setAction("pdf"),d.setFileName(b.sFileName.replace("*",this.fnGetTitle(b)))):d.setAction("copy");d.addEventListener("mouseOver",function(){b.fnMouseover!==null&&b.fnMouseover.call(c,a,b,d)});d.addEventListener("mouseOut",function(){b.fnMouseout!==
53
+ null&&b.fnMouseout.call(c,a,b,d)});d.addEventListener("mouseDown",function(){b.fnClick!==null&&b.fnClick.call(c,a,b,d)});d.addEventListener("complete",function(f,e){b.fnComplete!==null&&b.fnComplete.call(c,a,b,d,e);c._fnCollectionHide(a,b)});this._fnFlashGlue(d,a,b.sToolTip)},_fnFlashGlue:function(a,b,c){var d=this,f=b.getAttribute("id");g.getElementById(f)?a.glue(b,c):setTimeout(function(){d._fnFlashGlue(a,b,c)},100)},_fnFlashSetText:function(a,b){var c=this._fnChunkData(b,8192);a.clearText();for(var d=
54
+ 0,f=c.length;d<f;d++)a.appendText(c[d])},_fnColumnTargets:function(a){var b=[],c=this.s.dt;if("object"==typeof a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(!1);i=0;for(iLen=a.length;i<iLen;i++)b[a[i]]=!0}else if("visible"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!0:!1)}else if("hidden"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bVisible?!1:!0)}else if("sortable"==a){i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(c.aoColumns[i].bSortable?
55
+ !0:!1)}else{i=0;for(iLen=c.aoColumns.length;i<iLen;i++)b.push(!0)}return b},_fnNewline:function(a){return"auto"==a.sNewLine?navigator.userAgent.match(/Windows/)?"\r\n":"\n":a.sNewLine},_fnGetDataTablesData:function(a){var b,c,d,f,j,g=[],h="",k=this.s.dt,o,l=RegExp(a.sFieldBoundary,"g"),n=this._fnColumnTargets(a.mColumns);d="undefined"!=typeof a.bSelectedOnly?a.bSelectedOnly:!1;if(a.bHeader){j=[];b=0;for(c=k.aoColumns.length;b<c;b++)n[b]&&(h=k.aoColumns[b].sTitle.replace(/\n/g," ").replace(/<.*?>/g,
56
+ "").replace(/^\s+|\s+$/g,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator))}var p=k.aiDisplay;f=this.fnGetSelected();if("none"!==this.s.select.type&&d&&0!==f.length){p=[];b=0;for(c=f.length;b<c;b++)p.push(k.oInstance.fnGetPosition(f[b]))}d=0;for(f=p.length;d<f;d++){o=k.aoData[p[d]].nTr;j=[];b=0;for(c=k.aoColumns.length;b<c;b++)n[b]&&(h=k.oApi._fnGetCellData(k,p[d],b,"display"),a.fnCellRender?h=a.fnCellRender(h,b,o,p[d])+"":"string"==typeof h?
57
+ (h=h.replace(/\n/g," "),h=h.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi,"$1$2$3"),h=h.replace(/<.*?>/g,"")):h+="",h=h.replace(/^\s+/,"").replace(/\s+$/,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator));a.bOpenRows&&(b=e.grep(k.aoOpenRows,function(a){return a.nParent===o}),1===b.length&&(h=this._fnBoundData(e("td",b[0].nTr).html(),a.sFieldBoundary,l),g.push(h)))}if(a.bFooter&&null!==k.nTFoot){j=[];b=0;for(c=k.aoColumns.length;b<
58
+ c;b++)n[b]&&null!==k.aoColumns[b].nTf&&(h=k.aoColumns[b].nTf.innerHTML.replace(/\n/g," ").replace(/<.*?>/g,""),h=this._fnHtmlDecode(h),j.push(this._fnBoundData(h,a.sFieldBoundary,l)));g.push(j.join(a.sFieldSeperator))}return _sLastData=g.join(this._fnNewline(a))},_fnBoundData:function(a,b,c){return""===b?a:b+a.replace(c,b+b)+b},_fnChunkData:function(a,b){for(var c=[],d=a.length,f=0;f<d;f+=b)f+b<d?c.push(a.substring(f,f+b)):c.push(a.substring(f,d));return c},_fnHtmlDecode:function(a){if(-1===a.indexOf("&"))return a;
59
+ var b=g.createElement("div");return a.replace(/&([^\s]*);/g,function(a,d){if("#"===a.substr(1,1))return String.fromCharCode(Number(d.substr(1)));b.innerHTML=a;return b.childNodes[0].nodeValue})},_fnPrintStart:function(a){var b=this,c=this.s.dt;this._fnPrintHideNodes(c.nTable);this.s.print.saveStart=c._iDisplayStart;this.s.print.saveLength=c._iDisplayLength;a.bShowAll&&(c._iDisplayStart=0,c._iDisplayLength=-1,c.oApi._fnCalculateEnd(c),c.oApi._fnDraw(c));if(""!==c.oScroll.sX||""!==c.oScroll.sY)this._fnPrintScrollStart(c),
60
+ e(this.s.dt.nTable).bind("draw.DTTT_Print",function(){b._fnPrintScrollStart(c)});var d=c.aanFeatures,f;for(f in d)if("i"!=f&&"t"!=f&&1==f.length)for(var j=0,m=d[f].length;j<m;j++)this.dom.print.hidden.push({node:d[f][j],display:"block"}),d[f][j].style.display="none";e(g.body).addClass(this.classes.print.body);""!==a.sInfo&&this.fnInfo(a.sInfo,3E3);a.sMessage&&(this.dom.print.message=g.createElement("div"),this.dom.print.message.className=this.classes.print.message,this.dom.print.message.innerHTML=
61
+ a.sMessage,g.body.insertBefore(this.dom.print.message,g.body.childNodes[0]));this.s.print.saveScroll=e(n).scrollTop();n.scrollTo(0,0);e(g).bind("keydown.DTTT",function(a){if(a.keyCode==27){a.preventDefault();b._fnPrintEnd.call(b,a)}})},_fnPrintEnd:function(){var a=this.s.dt,b=this.s.print,c=this.dom.print;this._fnPrintShowNodes();if(""!==a.oScroll.sX||""!==a.oScroll.sY)e(this.s.dt.nTable).unbind("draw.DTTT_Print"),this._fnPrintScrollEnd();n.scrollTo(0,b.saveScroll);null!==c.message&&(g.body.removeChild(c.message),
62
+ c.message=null);e(g.body).removeClass("DTTT_Print");a._iDisplayStart=b.saveStart;a._iDisplayLength=b.saveLength;a.oApi._fnCalculateEnd(a);a.oApi._fnDraw(a);e(g).unbind("keydown.DTTT")},_fnPrintScrollStart:function(){var a=this.s.dt;a.nScrollHead.getElementsByTagName("div")[0].getElementsByTagName("table");var b=a.nTable.parentNode,c=a.nTable.getElementsByTagName("thead");0<c.length&&a.nTable.removeChild(c[0]);null!==a.nTFoot&&(c=a.nTable.getElementsByTagName("tfoot"),0<c.length&&a.nTable.removeChild(c[0]));
63
+ c=a.nTHead.cloneNode(!0);a.nTable.insertBefore(c,a.nTable.childNodes[0]);null!==a.nTFoot&&(c=a.nTFoot.cloneNode(!0),a.nTable.insertBefore(c,a.nTable.childNodes[1]));""!==a.oScroll.sX&&(a.nTable.style.width=e(a.nTable).outerWidth()+"px",b.style.width=e(a.nTable).outerWidth()+"px",b.style.overflow="visible");""!==a.oScroll.sY&&(b.style.height=e(a.nTable).outerHeight()+"px",b.style.overflow="visible")},_fnPrintScrollEnd:function(){var a=this.s.dt,b=a.nTable.parentNode;""!==a.oScroll.sX&&(b.style.width=
64
+ a.oApi._fnStringToCss(a.oScroll.sX),b.style.overflow="auto");""!==a.oScroll.sY&&(b.style.height=a.oApi._fnStringToCss(a.oScroll.sY),b.style.overflow="auto")},_fnPrintShowNodes:function(){for(var a=this.dom.print.hidden,b=0,c=a.length;b<c;b++)a[b].node.style.display=a[b].display;a.splice(0,a.length)},_fnPrintHideNodes:function(a){for(var b=this.dom.print.hidden,c=a.parentNode,d=c.childNodes,f=0,g=d.length;f<g;f++)if(d[f]!=a&&1==d[f].nodeType){var m=e(d[f]).css("display");"none"!=m&&(b.push({node:d[f],
65
+ display:m}),d[f].style.display="none")}"BODY"!=c.nodeName&&this._fnPrintHideNodes(c)}};TableTools._aInstances=[];TableTools._aListeners=[];TableTools.fnGetMasters=function(){for(var a=[],b=0,c=TableTools._aInstances.length;b<c;b++)TableTools._aInstances[b].s.master&&a.push(TableTools._aInstances[b]);return a};TableTools.fnGetInstance=function(a){"object"!=typeof a&&(a=g.getElementById(a));for(var b=0,c=TableTools._aInstances.length;b<c;b++)if(TableTools._aInstances[b].s.master&&TableTools._aInstances[b].dom.table==
66
+ a)return TableTools._aInstances[b];return null};TableTools._fnEventListen=function(a,b,c){TableTools._aListeners.push({that:a,type:b,fn:c})};TableTools._fnEventDispatch=function(a,b,c,d){for(var f=TableTools._aListeners,e=0,g=f.length;e<g;e++)a.dom.table==f[e].that.dom.table&&f[e].type==b&&f[e].fn(c,d)};TableTools.buttonBase={sAction:"text",sTag:"default",sLinerTag:"default",sButtonClass:"DTTT_button_text",sButtonText:"Button text",sTitle:"",sToolTip:"",sCharSet:"utf8",bBomInc:!1,sFileName:"*.csv",
67
+ sFieldBoundary:"",sFieldSeperator:"\t",sNewLine:"auto",mColumns:"all",bHeader:!0,bFooter:!0,bOpenRows:!1,bSelectedOnly:!1,fnMouseover:null,fnMouseout:null,fnClick:null,fnSelect:null,fnComplete:null,fnInit:null,fnCellRender:null};TableTools.BUTTONS={csv:e.extend({},TableTools.buttonBase,{sAction:"flash_save",sButtonClass:"DTTT_button_csv",sButtonText:"CSV",sFieldBoundary:'"',sFieldSeperator:",",fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))}}),xls:e.extend({},TableTools.buttonBase,
68
+ {sAction:"flash_save",sCharSet:"utf16le",bBomInc:!0,sButtonClass:"DTTT_button_xls",sButtonText:"Excel",fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))}}),copy:e.extend({},TableTools.buttonBase,{sAction:"flash_copy",sButtonClass:"DTTT_button_copy",sButtonText:"Copy",fnClick:function(a,b,c){this.fnSetText(c,this.fnGetTableData(b))},fnComplete:function(a,b,c,d){a=d.split("\n").length;a=null===this.s.dt.nTFoot?a-1:a-2;this.fnInfo("<h6>Table copied</h6><p>Copied "+a+" row"+(1==a?"":"s")+
69
+ " to the clipboard.</p>",1500)}}),pdf:e.extend({},TableTools.buttonBase,{sAction:"flash_pdf",sNewLine:"\n",sFileName:"*.pdf",sButtonClass:"DTTT_button_pdf",sButtonText:"PDF",sPdfOrientation:"portrait",sPdfSize:"A4",sPdfMessage:"",fnClick:function(a,b,c){this.fnSetText(c,"title:"+this.fnGetTitle(b)+"\nmessage:"+b.sPdfMessage+"\ncolWidth:"+this.fnCalcColRatios(b)+"\norientation:"+b.sPdfOrientation+"\nsize:"+b.sPdfSize+"\n--/TableToolsOpts--\n"+this.fnGetTableData(b))}}),print:e.extend({},TableTools.buttonBase,
70
+ {sInfo:"<h6>Print view</h6><p>Please use your browser's print function to print this table. Press escape when finished.",sMessage:null,bShowAll:!0,sToolTip:"View print view",sButtonClass:"DTTT_button_print",sButtonText:"Print",fnClick:function(a,b){this.fnPrint(!0,b)}}),text:e.extend({},TableTools.buttonBase),select:e.extend({},TableTools.buttonBase,{sButtonText:"Select button",fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},
71
+ fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),select_single:e.extend({},TableTools.buttonBase,{sButtonText:"Select button",fnSelect:function(a){1==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),select_all:e.extend({},TableTools.buttonBase,{sButtonText:"Select all",fnClick:function(){this.fnSelectAll()},fnSelect:function(a){this.fnGetSelected().length==
72
+ this.s.dt.fnRecordsDisplay()?e(a).addClass(this.classes.buttons.disabled):e(a).removeClass(this.classes.buttons.disabled)}}),select_none:e.extend({},TableTools.buttonBase,{sButtonText:"Deselect all",fnClick:function(){this.fnSelectNone()},fnSelect:function(a){0!==this.fnGetSelected().length?e(a).removeClass(this.classes.buttons.disabled):e(a).addClass(this.classes.buttons.disabled)},fnInit:function(a){e(a).addClass(this.classes.buttons.disabled)}}),ajax:e.extend({},TableTools.buttonBase,{sAjaxUrl:"/xhr.php",
73
+ sButtonText:"Ajax button",fnClick:function(a,b){var c=this.fnGetTableData(b);e.ajax({url:b.sAjaxUrl,data:[{name:"tableData",value:c}],success:b.fnAjaxComplete,dataType:"json",type:"POST",cache:!1,error:function(){alert("Error detected when sending table data to server")}})},fnAjaxComplete:function(){alert("Ajax complete")}}),div:e.extend({},TableTools.buttonBase,{sAction:"div",sTag:"div",sButtonClass:"DTTT_nonbutton",sButtonText:"Text button"}),collection:e.extend({},TableTools.buttonBase,{sAction:"collection",
74
+ sButtonClass:"DTTT_button_collection",sButtonText:"Collection",fnClick:function(a,b){this._fnCollectionShow(a,b)}})};TableTools.classes={container:"DTTT_container",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"},collection:{container:"DTTT_collection",background:"DTTT_collection_background",buttons:{normal:"DTTT_button",disabled:"DTTT_disabled"}},select:{table:"DTTT_selectable",row:"DTTT_selected"},print:{body:"DTTT_Print",info:"DTTT_print_info",message:"DTTT_PrintMessage"}};TableTools.classes_themeroller=
75
+ {container:"DTTT_container ui-buttonset ui-buttonset-multi",buttons:{normal:"DTTT_button ui-button ui-state-default"},collection:{container:"DTTT_collection ui-buttonset ui-buttonset-multi"}};TableTools.DEFAULTS={sSwfPath:"media/swf/copy_csv_xls_pdf.swf",sRowSelect:"none",sSelectedClass:null,fnPreRowSelect:null,fnRowSelected:null,fnRowDeselected:null,aButtons:["copy","csv","xls","pdf","print"],oTags:{container:"div",button:"a",liner:"span",collection:{container:"div",button:"a",liner:"span"}}};TableTools.prototype.CLASS=
76
+ "TableTools";TableTools.VERSION="2.1.5";TableTools.prototype.VERSION=TableTools.VERSION;"function"==typeof e.fn.dataTable&&"function"==typeof e.fn.dataTableExt.fnVersionCheck&&e.fn.dataTableExt.fnVersionCheck("1.9.0")?e.fn.dataTableExt.aoFeatures.push({fnInit:function(a){a=new TableTools(a.oInstance,"undefined"!=typeof a.oInit.oTableTools?a.oInit.oTableTools:{});TableTools._aInstances.push(a);return a.dom.container},cFeature:"T",sFeature:"TableTools"}):alert("Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download");
77
+ e.fn.DataTable.TableTools=TableTools})(jQuery,window,document);
@@ -41,7 +41,7 @@ $.extend( $.fn.dataTableExt.oPagination, {
41
41
  },
42
42
 
43
43
  "fnUpdate": function ( oSettings, fnDraw ) {
44
- var iListLength = 5;
44
+ var iListLength = jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages;
45
45
  var oPaging = oSettings.oInstance.fnPagingInfo();
46
46
  var an = oSettings.aanFeatures.p;
47
47
  var i, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
@@ -92,4 +92,4 @@ $.extend( $.fn.dataTableExt.oPagination, {
92
92
  }
93
93
  }
94
94
  }
95
- } );
95
+ } );
@@ -0,0 +1,152 @@
1
+ /* Set the defaults for DataTables initialisation */
2
+ $.extend( true, $.fn.dataTable.defaults, {
3
+ "sDom": "<'row'<'col-xs-6'l><'col-xs-6'f>r>t<'row'<'col-xs-6'i><'col-xs-6'p>>",
4
+ "sPaginationType": "bootstrap",
5
+ "oLanguage": {
6
+ "sLengthMenu": "_MENU_ records per page"
7
+ }
8
+ } );
9
+
10
+
11
+
12
+
13
+ /* Default class modification */
14
+ $.extend( $.fn.dataTableExt.oStdClasses, {
15
+ "sWrapper": "dataTables_wrapper form-inline",
16
+ "sFilterInput": "form-control input-sm",
17
+ "sLengthSelect": "form-control input-sm"
18
+ } );
19
+
20
+
21
+ /* API method to get paging information */
22
+ $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
23
+ {
24
+ return {
25
+ "iStart": oSettings._iDisplayStart,
26
+ "iEnd": oSettings.fnDisplayEnd(),
27
+ "iLength": oSettings._iDisplayLength,
28
+ "iTotal": oSettings.fnRecordsTotal(),
29
+ "iFilteredTotal": oSettings.fnRecordsDisplay(),
30
+ "iPage": oSettings._iDisplayLength === -1 ?
31
+ 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
32
+ "iTotalPages": oSettings._iDisplayLength === -1 ?
33
+ 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
34
+ };
35
+ };
36
+
37
+
38
+ /* Bootstrap style pagination control */
39
+ $.extend( $.fn.dataTableExt.oPagination, {
40
+ "bootstrap": {
41
+ "fnInit": function( oSettings, nPaging, fnDraw ) {
42
+ var oLang = oSettings.oLanguage.oPaginate;
43
+ var fnClickHandler = function ( e ) {
44
+ e.preventDefault();
45
+ if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) {
46
+ fnDraw( oSettings );
47
+ }
48
+ };
49
+
50
+ $(nPaging).append(
51
+ '<ul class="pagination">'+
52
+ '<li class="prev disabled"><a href="#">&larr; '+oLang.sPrevious+'</a></li>'+
53
+ '<li class="next disabled"><a href="#">'+oLang.sNext+' &rarr; </a></li>'+
54
+ '</ul>'
55
+ );
56
+ var els = $('a', nPaging);
57
+ $(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
58
+ $(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
59
+ },
60
+
61
+ "fnUpdate": function ( oSettings, fnDraw ) {
62
+ var iListLength = 5;
63
+ var oPaging = oSettings.oInstance.fnPagingInfo();
64
+ var an = oSettings.aanFeatures.p;
65
+ var i, ien, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
66
+
67
+ if ( oPaging.iTotalPages < iListLength) {
68
+ iStart = 1;
69
+ iEnd = oPaging.iTotalPages;
70
+ }
71
+ else if ( oPaging.iPage <= iHalf ) {
72
+ iStart = 1;
73
+ iEnd = iListLength;
74
+ } else if ( oPaging.iPage >= (oPaging.iTotalPages-iHalf) ) {
75
+ iStart = oPaging.iTotalPages - iListLength + 1;
76
+ iEnd = oPaging.iTotalPages;
77
+ } else {
78
+ iStart = oPaging.iPage - iHalf + 1;
79
+ iEnd = iStart + iListLength - 1;
80
+ }
81
+
82
+ for ( i=0, ien=an.length ; i<ien ; i++ ) {
83
+ // Remove the middle elements
84
+ $('li:gt(0)', an[i]).filter(':not(:last)').remove();
85
+
86
+ // Add the new list items and their event handlers
87
+ for ( j=iStart ; j<=iEnd ; j++ ) {
88
+ sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
89
+ $('<li '+sClass+'><a href="#">'+j+'</a></li>')
90
+ .insertBefore( $('li:last', an[i])[0] )
91
+ .bind('click', function (e) {
92
+ e.preventDefault();
93
+ oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
94
+ fnDraw( oSettings );
95
+ } );
96
+ }
97
+
98
+ // Add / remove disabled classes from the static elements
99
+ if ( oPaging.iPage === 0 ) {
100
+ $('li:first', an[i]).addClass('disabled');
101
+ } else {
102
+ $('li:first', an[i]).removeClass('disabled');
103
+ }
104
+
105
+ if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
106
+ $('li:last', an[i]).addClass('disabled');
107
+ } else {
108
+ $('li:last', an[i]).removeClass('disabled');
109
+ }
110
+ }
111
+ }
112
+ }
113
+ } );
114
+
115
+
116
+ /*
117
+ * TableTools Bootstrap compatibility
118
+ * Required TableTools 2.1+
119
+ */
120
+ if ( $.fn.DataTable.TableTools ) {
121
+ // Set the classes that TableTools uses to something suitable for Bootstrap
122
+ $.extend( true, $.fn.DataTable.TableTools.classes, {
123
+ "container": "DTTT btn-group",
124
+ "buttons": {
125
+ "normal": "btn btn-default",
126
+ "disabled": "disabled"
127
+ },
128
+ "collection": {
129
+ "container": "DTTT_dropdown dropdown-menu",
130
+ "buttons": {
131
+ "normal": "",
132
+ "disabled": "disabled"
133
+ }
134
+ },
135
+ "print": {
136
+ "info": "DTTT_print_info modal"
137
+ },
138
+ "select": {
139
+ "row": "active"
140
+ }
141
+ } );
142
+
143
+ // Have the collection use a bootstrap compatible dropdown
144
+ $.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, {
145
+ "collection": {
146
+ "container": "ul",
147
+ "button": "li",
148
+ "liner": "a"
149
+ }
150
+ } );
151
+ }
152
+
@@ -0,0 +1,186 @@
1
+ /* Set the defaults for DataTables initialisation */
2
+ $.extend( true, $.fn.dataTable.defaults, {
3
+ "sDom":
4
+ "<'row'<'large-6 columns'l><'large-6 columns'f>r>"+
5
+ "t"+
6
+ "<'row'<'large-6 columns'i><'large-6 columns'p>>",
7
+ "sPaginationType": "bootstrap",
8
+ "oLanguage": {
9
+ "sLengthMenu": "_MENU_ records per page"
10
+ }
11
+ } );
12
+
13
+
14
+ /* API method to get paging information */
15
+ $.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
16
+ {
17
+ return {
18
+ "iStart": oSettings._iDisplayStart,
19
+ "iEnd": oSettings.fnDisplayEnd(),
20
+ "iLength": oSettings._iDisplayLength,
21
+ "iTotal": oSettings.fnRecordsTotal(),
22
+ "iFilteredTotal": oSettings.fnRecordsDisplay(),
23
+ "iPage": oSettings._iDisplayLength === -1 ?
24
+ 0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
25
+ "iTotalPages": oSettings._iDisplayLength === -1 ?
26
+ 0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
27
+ };
28
+ };
29
+
30
+
31
+ /* Bootstrap style pagination control */
32
+ $.extend( $.fn.dataTableExt.oPagination, {
33
+ "bootstrap": {
34
+ "fnInit": function( oSettings, nPaging, fnDraw ) {
35
+ var oLang = oSettings.oLanguage.oPaginate;
36
+ var fnClickHandler = function ( e ) {
37
+ e.preventDefault();
38
+ if ( oSettings.oApi._fnPageChange(oSettings, e.data.action) ) {
39
+ fnDraw( oSettings );
40
+ }
41
+ };
42
+
43
+ $(nPaging).append(
44
+ '<ul class="pagination">'+
45
+ '<li class="prev arrow unavailable"><a href="">&laquo;</a></li>'+
46
+ '<li class="next arrow unavailable"><a href="">&raquo;</a></li>'+
47
+ '</ul>'
48
+ );
49
+ var els = $('a', nPaging);
50
+ $(els[0]).bind( 'click.DT', { action: "previous" }, fnClickHandler );
51
+ $(els[1]).bind( 'click.DT', { action: "next" }, fnClickHandler );
52
+ },
53
+
54
+ "fnUpdate": function ( oSettings, fnDraw ) {
55
+ var iListLength = 5;
56
+ var oPaging = oSettings.oInstance.fnPagingInfo();
57
+ var an = oSettings.aanFeatures.p;
58
+ var pages = [];
59
+ var i, ien, klass, host;
60
+
61
+ // This could use some improving - however, see
62
+ // https://github.com/DataTables/DataTables/issues/163 - this will
63
+ // be changing in the near future, so not much point in doing too
64
+ // much just now
65
+ if ( oPaging.iTotalPages <= 6 ) {
66
+ for ( i=0 ; i<oPaging.iTotalPages ; i++ ) {
67
+ pages.push( i );
68
+ }
69
+ }
70
+ else {
71
+ // Current page
72
+ pages.push( oPaging.iPage );
73
+
74
+ // After current page
75
+ var pagesAfter = oPaging.iPage + 2 >= oPaging.iTotalPages ?
76
+ oPaging.iTotalPages :
77
+ oPaging.iPage + 2;
78
+ for ( i=oPaging.iPage+1 ; i<pagesAfter ; i++ ) {
79
+ pages.push( i );
80
+ }
81
+
82
+ // After gap
83
+ if ( pagesAfter < oPaging.iTotalPages-2 ) {
84
+ pages.push( null );
85
+ }
86
+
87
+ // End
88
+ if ( $.inArray( oPaging.iTotalPages-2, pages ) === -1 && oPaging.iPage < oPaging.iTotalPages-2 ) {
89
+ pages.push( oPaging.iTotalPages-2 );
90
+ }
91
+ if ( $.inArray( oPaging.iTotalPages-1, pages ) === -1 ) {
92
+ pages.push( oPaging.iTotalPages-1 );
93
+ }
94
+
95
+ // Pages before
96
+ var pagesBefore = oPaging.iPage - 2 > 0 ?
97
+ oPaging.iPage - 2 :
98
+ 0;
99
+ for ( i=oPaging.iPage-1 ; i>pagesBefore ; i-- ) {
100
+ pages.unshift( i );
101
+ }
102
+
103
+ // Before gap
104
+ if ( pagesBefore > 1 ) {
105
+ pages.unshift( null );
106
+ }
107
+
108
+ // Start
109
+ if ( $.inArray( 1, pages ) === -1 && oPaging.iTotalPages > 1 ) {
110
+ pages.unshift( 1 );
111
+ }
112
+ if ( $.inArray( 0, pages ) === -1 ) {
113
+ pages.unshift( 0 );
114
+ }
115
+ }
116
+
117
+ for ( i=0, ien=an.length ; i<ien ; i++ ) {
118
+ // Remove the middle elements
119
+ host = an[i];
120
+ $('li:gt(0)', host).filter(':not(:last)').remove();
121
+
122
+ // Add the new list items and their event handlers
123
+ $.each( pages, function( ii, page ) {
124
+ klass = page === null ? 'unavailable' :
125
+ page === oPaging.iPage ? 'current' : '';
126
+ $('<li class="'+klass+'"><a href="">'+(page===null? '&hellip;' : page+1)+'</a></li>')
127
+ .insertBefore( $('li:last', host) )
128
+ .bind('click', function (e) {
129
+ e.preventDefault();
130
+ oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength;
131
+ fnDraw( oSettings );
132
+ } );
133
+ } );
134
+
135
+ // Add / remove disabled classes from the static elements
136
+ if ( oPaging.iPage === 0 ) {
137
+ $('li:first', host).addClass('unavailable');
138
+ } else {
139
+ $('li:first', host).removeClass('unavailable');
140
+ }
141
+
142
+ if ( oPaging.iPage === oPaging.iTotalPages-1 || oPaging.iTotalPages === 0 ) {
143
+ $('li:last', host).addClass('unavailable');
144
+ } else {
145
+ $('li:last', host).removeClass('unavailable');
146
+ }
147
+ }
148
+ }
149
+ }
150
+ } );
151
+
152
+
153
+ /*
154
+ * TableTools Foundation compatibility
155
+ * Required TableTools 2.1+
156
+ */
157
+ if ( $.fn.DataTable.TableTools ) {
158
+ // Set the classes that TableTools uses to something suitable for Foundation
159
+ $.extend( true, $.fn.DataTable.TableTools.classes, {
160
+ "container": "DTTT button-group",
161
+ "buttons": {
162
+ "normal": "button",
163
+ "disabled": "disabled"
164
+ },
165
+ "collection": {
166
+ "container": "DTTT_dropdown dropdown-menu",
167
+ "buttons": {
168
+ "normal": "",
169
+ "disabled": "disabled"
170
+ }
171
+ },
172
+ "select": {
173
+ "row": "active"
174
+ }
175
+ } );
176
+
177
+ // Have the collection use a bootstrap compatible dropdown
178
+ $.extend( true, $.fn.DataTable.TableTools.DEFAULTS.oTags, {
179
+ "collection": {
180
+ "container": "ul",
181
+ "button": "li",
182
+ "liner": "a"
183
+ }
184
+ } );
185
+ }
186
+