vendor.datatables.js 215 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180
  1. /*!
  2. DataTables 1.10.16
  3. ©2008-2017 SpryMedia Ltd - datatables.net/license
  4. */
  5. (function(h){"function"===typeof define&&define.amd?define(["jquery"],function(E){return h(E,window,document)}):"object"===typeof exports?module.exports=function(E,G){E||(E=window);G||(G="undefined"!==typeof window?require("jquery"):require("jquery")(E));return h(G,E,E.document)}:h(jQuery,window,document)})(function(h,E,G,k){function X(a){var b,c,d={};h.each(a,function(e){if((b=e.match(/^([^A-Z]+?)([A-Z])/))&&-1!=="a aa ai ao as b fn i m o s ".indexOf(b[1]+" "))c=e.replace(b[0],b[2].toLowerCase()),
  6. d[c]=e,"o"===b[1]&&X(a[e])});a._hungarianMap=d}function I(a,b,c){a._hungarianMap||X(a);var d;h.each(b,function(e){d=a._hungarianMap[e];if(d!==k&&(c||b[d]===k))"o"===d.charAt(0)?(b[d]||(b[d]={}),h.extend(!0,b[d],b[e]),I(a[d],b[d],c)):b[d]=b[e]})}function Ca(a){var b=m.defaults.oLanguage,c=a.sZeroRecords;!a.sEmptyTable&&(c&&"No data available in table"===b.sEmptyTable)&&F(a,a,"sZeroRecords","sEmptyTable");!a.sLoadingRecords&&(c&&"Loading..."===b.sLoadingRecords)&&F(a,a,"sZeroRecords","sLoadingRecords");
  7. a.sInfoThousands&&(a.sThousands=a.sInfoThousands);(a=a.sDecimal)&&cb(a)}function db(a){A(a,"ordering","bSort");A(a,"orderMulti","bSortMulti");A(a,"orderClasses","bSortClasses");A(a,"orderCellsTop","bSortCellsTop");A(a,"order","aaSorting");A(a,"orderFixed","aaSortingFixed");A(a,"paging","bPaginate");A(a,"pagingType","sPaginationType");A(a,"pageLength","iDisplayLength");A(a,"searching","bFilter");"boolean"===typeof a.sScrollX&&(a.sScrollX=a.sScrollX?"100%":"");"boolean"===typeof a.scrollX&&(a.scrollX=
  8. a.scrollX?"100%":"");if(a=a.aoSearchCols)for(var b=0,c=a.length;b<c;b++)a[b]&&I(m.models.oSearch,a[b])}function eb(a){A(a,"orderable","bSortable");A(a,"orderData","aDataSort");A(a,"orderSequence","asSorting");A(a,"orderDataType","sortDataType");var b=a.aDataSort;"number"===typeof b&&!h.isArray(b)&&(a.aDataSort=[b])}function fb(a){if(!m.__browser){var b={};m.__browser=b;var c=h("<div/>").css({position:"fixed",top:0,left:-1*h(E).scrollLeft(),height:1,width:1,overflow:"hidden"}).append(h("<div/>").css({position:"absolute",
  9. top:1,left:1,width:100,overflow:"scroll"}).append(h("<div/>").css({width:"100%",height:10}))).appendTo("body"),d=c.children(),e=d.children();b.barWidth=d[0].offsetWidth-d[0].clientWidth;b.bScrollOversize=100===e[0].offsetWidth&&100!==d[0].clientWidth;b.bScrollbarLeft=1!==Math.round(e.offset().left);b.bBounding=c[0].getBoundingClientRect().width?!0:!1;c.remove()}h.extend(a.oBrowser,m.__browser);a.oScroll.iBarWidth=m.__browser.barWidth}function gb(a,b,c,d,e,f){var g,j=!1;c!==k&&(g=c,j=!0);for(;d!==
  10. e;)a.hasOwnProperty(d)&&(g=j?b(g,a[d],d,a):a[d],j=!0,d+=f);return g}function Da(a,b){var c=m.defaults.column,d=a.aoColumns.length,c=h.extend({},m.models.oColumn,c,{nTh:b?b:G.createElement("th"),sTitle:c.sTitle?c.sTitle:b?b.innerHTML:"",aDataSort:c.aDataSort?c.aDataSort:[d],mData:c.mData?c.mData:d,idx:d});a.aoColumns.push(c);c=a.aoPreSearchCols;c[d]=h.extend({},m.models.oSearch,c[d]);ja(a,d,h(b).data())}function ja(a,b,c){var b=a.aoColumns[b],d=a.oClasses,e=h(b.nTh);if(!b.sWidthOrig){b.sWidthOrig=
  11. e.attr("width")||null;var f=(e.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);f&&(b.sWidthOrig=f[1])}c!==k&&null!==c&&(eb(c),I(m.defaults.column,c),c.mDataProp!==k&&!c.mData&&(c.mData=c.mDataProp),c.sType&&(b._sManualType=c.sType),c.className&&!c.sClass&&(c.sClass=c.className),c.sClass&&e.addClass(c.sClass),h.extend(b,c),F(b,c,"sWidth","sWidthOrig"),c.iDataSort!==k&&(b.aDataSort=[c.iDataSort]),F(b,c,"aDataSort"));var g=b.mData,j=Q(g),i=b.mRender?Q(b.mRender):null,c=function(a){return"string"===
  12. typeof a&&-1!==a.indexOf("@")};b._bAttrSrc=h.isPlainObject(g)&&(c(g.sort)||c(g.type)||c(g.filter));b._setter=null;b.fnGetData=function(a,b,c){var d=j(a,b,k,c);return i&&b?i(d,b,a,c):d};b.fnSetData=function(a,b,c){return R(g)(a,b,c)};"number"!==typeof g&&(a._rowReadObject=!0);a.oFeatures.bSort||(b.bSortable=!1,e.addClass(d.sSortableNone));a=-1!==h.inArray("asc",b.asSorting);c=-1!==h.inArray("desc",b.asSorting);!b.bSortable||!a&&!c?(b.sSortingClass=d.sSortableNone,b.sSortingClassJUI=""):a&&!c?(b.sSortingClass=
  13. d.sSortableAsc,b.sSortingClassJUI=d.sSortJUIAscAllowed):!a&&c?(b.sSortingClass=d.sSortableDesc,b.sSortingClassJUI=d.sSortJUIDescAllowed):(b.sSortingClass=d.sSortable,b.sSortingClassJUI=d.sSortJUI)}function Y(a){if(!1!==a.oFeatures.bAutoWidth){var b=a.aoColumns;Ea(a);for(var c=0,d=b.length;c<d;c++)b[c].nTh.style.width=b[c].sWidth}b=a.oScroll;(""!==b.sY||""!==b.sX)&&ka(a);r(a,null,"column-sizing",[a])}function Z(a,b){var c=la(a,"bVisible");return"number"===typeof c[b]?c[b]:null}function $(a,b){var c=
  14. la(a,"bVisible"),c=h.inArray(b,c);return-1!==c?c:null}function aa(a){var b=0;h.each(a.aoColumns,function(a,d){d.bVisible&&"none"!==h(d.nTh).css("display")&&b++});return b}function la(a,b){var c=[];h.map(a.aoColumns,function(a,e){a[b]&&c.push(e)});return c}function Fa(a){var b=a.aoColumns,c=a.aoData,d=m.ext.type.detect,e,f,g,j,i,h,l,q,t;e=0;for(f=b.length;e<f;e++)if(l=b[e],t=[],!l.sType&&l._sManualType)l.sType=l._sManualType;else if(!l.sType){g=0;for(j=d.length;g<j;g++){i=0;for(h=c.length;i<h;i++){t[i]===
  15. k&&(t[i]=B(a,i,e,"type"));q=d[g](t[i],a);if(!q&&g!==d.length-1)break;if("html"===q)break}if(q){l.sType=q;break}}l.sType||(l.sType="string")}}function hb(a,b,c,d){var e,f,g,j,i,n,l=a.aoColumns;if(b)for(e=b.length-1;0<=e;e--){n=b[e];var q=n.targets!==k?n.targets:n.aTargets;h.isArray(q)||(q=[q]);f=0;for(g=q.length;f<g;f++)if("number"===typeof q[f]&&0<=q[f]){for(;l.length<=q[f];)Da(a);d(q[f],n)}else if("number"===typeof q[f]&&0>q[f])d(l.length+q[f],n);else if("string"===typeof q[f]){j=0;for(i=l.length;j<
  16. i;j++)("_all"==q[f]||h(l[j].nTh).hasClass(q[f]))&&d(j,n)}}if(c){e=0;for(a=c.length;e<a;e++)d(e,c[e])}}function M(a,b,c,d){var e=a.aoData.length,f=h.extend(!0,{},m.models.oRow,{src:c?"dom":"data",idx:e});f._aData=b;a.aoData.push(f);for(var g=a.aoColumns,j=0,i=g.length;j<i;j++)g[j].sType=null;a.aiDisplayMaster.push(e);b=a.rowIdFn(b);b!==k&&(a.aIds[b]=f);(c||!a.oFeatures.bDeferRender)&&Ga(a,e,c,d);return e}function ma(a,b){var c;b instanceof h||(b=h(b));return b.map(function(b,e){c=Ha(a,e);return M(a,
  17. c.data,e,c.cells)})}function B(a,b,c,d){var e=a.iDraw,f=a.aoColumns[c],g=a.aoData[b]._aData,j=f.sDefaultContent,i=f.fnGetData(g,d,{settings:a,row:b,col:c});if(i===k)return a.iDrawError!=e&&null===j&&(J(a,0,"Requested unknown parameter "+("function"==typeof f.mData?"{function}":"'"+f.mData+"'")+" for row "+b+", column "+c,4),a.iDrawError=e),j;if((i===g||null===i)&&null!==j&&d!==k)i=j;else if("function"===typeof i)return i.call(g);return null===i&&"display"==d?"":i}function ib(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,
  18. d,{settings:a,row:b,col:c})}function Ia(a){return h.map(a.match(/(\\.|[^\.])+/g)||[""],function(a){return a.replace(/\\\./g,".")})}function Q(a){if(h.isPlainObject(a)){var b={};h.each(a,function(a,c){c&&(b[a]=Q(c))});return function(a,c,f,g){var j=b[c]||b._;return j!==k?j(a,c,f,g):a}}if(null===a)return function(a){return a};if("function"===typeof a)return function(b,c,f,g){return a(b,c,f,g)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var c=function(a,
  19. b,f){var g,j;if(""!==f){j=Ia(f);for(var i=0,n=j.length;i<n;i++){f=j[i].match(ba);g=j[i].match(U);if(f){j[i]=j[i].replace(ba,"");""!==j[i]&&(a=a[j[i]]);g=[];j.splice(0,i+1);j=j.join(".");if(h.isArray(a)){i=0;for(n=a.length;i<n;i++)g.push(c(a[i],b,j))}a=f[0].substring(1,f[0].length-1);a=""===a?g:g.join(a);break}else if(g){j[i]=j[i].replace(U,"");a=a[j[i]]();continue}if(null===a||a[j[i]]===k)return k;a=a[j[i]]}}return a};return function(b,e){return c(b,e,a)}}return function(b){return b[a]}}function R(a){if(h.isPlainObject(a))return R(a._);
  20. if(null===a)return function(){};if("function"===typeof a)return function(b,d,e){a(b,"set",d,e)};if("string"===typeof a&&(-1!==a.indexOf(".")||-1!==a.indexOf("[")||-1!==a.indexOf("("))){var b=function(a,d,e){var e=Ia(e),f;f=e[e.length-1];for(var g,j,i=0,n=e.length-1;i<n;i++){g=e[i].match(ba);j=e[i].match(U);if(g){e[i]=e[i].replace(ba,"");a[e[i]]=[];f=e.slice();f.splice(0,i+1);g=f.join(".");if(h.isArray(d)){j=0;for(n=d.length;j<n;j++)f={},b(f,d[j],g),a[e[i]].push(f)}else a[e[i]]=d;return}j&&(e[i]=e[i].replace(U,
  21. ""),a=a[e[i]](d));if(null===a[e[i]]||a[e[i]]===k)a[e[i]]={};a=a[e[i]]}if(f.match(U))a[f.replace(U,"")](d);else a[f.replace(ba,"")]=d};return function(c,d){return b(c,d,a)}}return function(b,d){b[a]=d}}function Ja(a){return D(a.aoData,"_aData")}function na(a){a.aoData.length=0;a.aiDisplayMaster.length=0;a.aiDisplay.length=0;a.aIds={}}function oa(a,b,c){for(var d=-1,e=0,f=a.length;e<f;e++)a[e]==b?d=e:a[e]>b&&a[e]--; -1!=d&&c===k&&a.splice(d,1)}function ca(a,b,c,d){var e=a.aoData[b],f,g=function(c,d){for(;c.childNodes.length;)c.removeChild(c.firstChild);
  22. c.innerHTML=B(a,b,d,"display")};if("dom"===c||(!c||"auto"===c)&&"dom"===e.src)e._aData=Ha(a,e,d,d===k?k:e._aData).data;else{var j=e.anCells;if(j)if(d!==k)g(j[d],d);else{c=0;for(f=j.length;c<f;c++)g(j[c],c)}}e._aSortData=null;e._aFilterData=null;g=a.aoColumns;if(d!==k)g[d].sType=null;else{c=0;for(f=g.length;c<f;c++)g[c].sType=null;Ka(a,e)}}function Ha(a,b,c,d){var e=[],f=b.firstChild,g,j,i=0,n,l=a.aoColumns,q=a._rowReadObject,d=d!==k?d:q?{}:[],t=function(a,b){if("string"===typeof a){var c=a.indexOf("@");
  23. -1!==c&&(c=a.substring(c+1),R(a)(d,b.getAttribute(c)))}},m=function(a){if(c===k||c===i)j=l[i],n=h.trim(a.innerHTML),j&&j._bAttrSrc?(R(j.mData._)(d,n),t(j.mData.sort,a),t(j.mData.type,a),t(j.mData.filter,a)):q?(j._setter||(j._setter=R(j.mData)),j._setter(d,n)):d[i]=n;i++};if(f)for(;f;){g=f.nodeName.toUpperCase();if("TD"==g||"TH"==g)m(f),e.push(f);f=f.nextSibling}else{e=b.anCells;f=0;for(g=e.length;f<g;f++)m(e[f])}if(b=b.firstChild?b:b.nTr)(b=b.getAttribute("id"))&&R(a.rowId)(d,b);return{data:d,cells:e}}
  24. function Ga(a,b,c,d){var e=a.aoData[b],f=e._aData,g=[],j,i,n,l,q;if(null===e.nTr){j=c||G.createElement("tr");e.nTr=j;e.anCells=g;j._DT_RowIndex=b;Ka(a,e);l=0;for(q=a.aoColumns.length;l<q;l++){n=a.aoColumns[l];i=c?d[l]:G.createElement(n.sCellType);i._DT_CellIndex={row:b,column:l};g.push(i);if((!c||n.mRender||n.mData!==l)&&(!h.isPlainObject(n.mData)||n.mData._!==l+".display"))i.innerHTML=B(a,b,l,"display");n.sClass&&(i.className+=" "+n.sClass);n.bVisible&&!c?j.appendChild(i):!n.bVisible&&c&&i.parentNode.removeChild(i);
  25. n.fnCreatedCell&&n.fnCreatedCell.call(a.oInstance,i,B(a,b,l),f,b,l)}r(a,"aoRowCreatedCallback",null,[j,f,b])}e.nTr.setAttribute("role","row")}function Ka(a,b){var c=b.nTr,d=b._aData;if(c){var e=a.rowIdFn(d);e&&(c.id=e);d.DT_RowClass&&(e=d.DT_RowClass.split(" "),b.__rowc=b.__rowc?qa(b.__rowc.concat(e)):e,h(c).removeClass(b.__rowc.join(" ")).addClass(d.DT_RowClass));d.DT_RowAttr&&h(c).attr(d.DT_RowAttr);d.DT_RowData&&h(c).data(d.DT_RowData)}}function jb(a){var b,c,d,e,f,g=a.nTHead,j=a.nTFoot,i=0===
  26. h("th, td",g).length,n=a.oClasses,l=a.aoColumns;i&&(e=h("<tr/>").appendTo(g));b=0;for(c=l.length;b<c;b++)f=l[b],d=h(f.nTh).addClass(f.sClass),i&&d.appendTo(e),a.oFeatures.bSort&&(d.addClass(f.sSortingClass),!1!==f.bSortable&&(d.attr("tabindex",a.iTabIndex).attr("aria-controls",a.sTableId),La(a,f.nTh,b))),f.sTitle!=d[0].innerHTML&&d.html(f.sTitle),Ma(a,"header")(a,d,f,n);i&&da(a.aoHeader,g);h(g).find(">tr").attr("role","row");h(g).find(">tr>th, >tr>td").addClass(n.sHeaderTH);h(j).find(">tr>th, >tr>td").addClass(n.sFooterTH);
  27. if(null!==j){a=a.aoFooter[0];b=0;for(c=a.length;b<c;b++)f=l[b],f.nTf=a[b].cell,f.sClass&&h(f.nTf).addClass(f.sClass)}}function ea(a,b,c){var d,e,f,g=[],j=[],i=a.aoColumns.length,n;if(b){c===k&&(c=!1);d=0;for(e=b.length;d<e;d++){g[d]=b[d].slice();g[d].nTr=b[d].nTr;for(f=i-1;0<=f;f--)!a.aoColumns[f].bVisible&&!c&&g[d].splice(f,1);j.push([])}d=0;for(e=g.length;d<e;d++){if(a=g[d].nTr)for(;f=a.firstChild;)a.removeChild(f);f=0;for(b=g[d].length;f<b;f++)if(n=i=1,j[d][f]===k){a.appendChild(g[d][f].cell);
  28. for(j[d][f]=1;g[d+i]!==k&&g[d][f].cell==g[d+i][f].cell;)j[d+i][f]=1,i++;for(;g[d][f+n]!==k&&g[d][f].cell==g[d][f+n].cell;){for(c=0;c<i;c++)j[d+c][f+n]=1;n++}h(g[d][f].cell).attr("rowspan",i).attr("colspan",n)}}}}function N(a){var b=r(a,"aoPreDrawCallback","preDraw",[a]);if(-1!==h.inArray(!1,b))C(a,!1);else{var b=[],c=0,d=a.asStripeClasses,e=d.length,f=a.oLanguage,g=a.iInitDisplayStart,j="ssp"==y(a),i=a.aiDisplay;a.bDrawing=!0;g!==k&&-1!==g&&(a._iDisplayStart=j?g:g>=a.fnRecordsDisplay()?0:g,a.iInitDisplayStart=
  29. -1);var g=a._iDisplayStart,n=a.fnDisplayEnd();if(a.bDeferLoading)a.bDeferLoading=!1,a.iDraw++,C(a,!1);else if(j){if(!a.bDestroying&&!kb(a))return}else a.iDraw++;if(0!==i.length){f=j?a.aoData.length:n;for(j=j?0:g;j<f;j++){var l=i[j],q=a.aoData[l];null===q.nTr&&Ga(a,l);l=q.nTr;if(0!==e){var t=d[c%e];q._sRowStripe!=t&&(h(l).removeClass(q._sRowStripe).addClass(t),q._sRowStripe=t)}r(a,"aoRowCallback",null,[l,q._aData,c,j]);b.push(l);c++}}else c=f.sZeroRecords,1==a.iDraw&&"ajax"==y(a)?c=f.sLoadingRecords:
  30. f.sEmptyTable&&0===a.fnRecordsTotal()&&(c=f.sEmptyTable),b[0]=h("<tr/>",{"class":e?d[0]:""}).append(h("<td />",{valign:"top",colSpan:aa(a),"class":a.oClasses.sRowEmpty}).html(c))[0];r(a,"aoHeaderCallback","header",[h(a.nTHead).children("tr")[0],Ja(a),g,n,i]);r(a,"aoFooterCallback","footer",[h(a.nTFoot).children("tr")[0],Ja(a),g,n,i]);d=h(a.nTBody);d.children().detach();d.append(h(b));r(a,"aoDrawCallback","draw",[a]);a.bSorted=!1;a.bFiltered=!1;a.bDrawing=!1}}function S(a,b){var c=a.oFeatures,d=c.bFilter;
  31. c.bSort&&lb(a);d?fa(a,a.oPreviousSearch):a.aiDisplay=a.aiDisplayMaster.slice();!0!==b&&(a._iDisplayStart=0);a._drawHold=b;N(a);a._drawHold=!1}function mb(a){var b=a.oClasses,c=h(a.nTable),c=h("<div/>").insertBefore(c),d=a.oFeatures,e=h("<div/>",{id:a.sTableId+"_wrapper","class":b.sWrapper+(a.nTFoot?"":" "+b.sNoFooter)});a.nHolding=c[0];a.nTableWrapper=e[0];a.nTableReinsertBefore=a.nTable.nextSibling;for(var f=a.sDom.split(""),g,j,i,n,l,q,k=0;k<f.length;k++){g=null;j=f[k];if("<"==j){i=h("<div/>")[0];
  32. n=f[k+1];if("'"==n||'"'==n){l="";for(q=2;f[k+q]!=n;)l+=f[k+q],q++;"H"==l?l=b.sJUIHeader:"F"==l&&(l=b.sJUIFooter);-1!=l.indexOf(".")?(n=l.split("."),i.id=n[0].substr(1,n[0].length-1),i.className=n[1]):"#"==l.charAt(0)?i.id=l.substr(1,l.length-1):i.className=l;k+=q}e.append(i);e=h(i)}else if(">"==j)e=e.parent();else if("l"==j&&d.bPaginate&&d.bLengthChange)g=nb(a);else if("f"==j&&d.bFilter)g=ob(a);else if("r"==j&&d.bProcessing)g=pb(a);else if("t"==j)g=qb(a);else if("i"==j&&d.bInfo)g=rb(a);else if("p"==
  33. j&&d.bPaginate)g=sb(a);else if(0!==m.ext.feature.length){i=m.ext.feature;q=0;for(n=i.length;q<n;q++)if(j==i[q].cFeature){g=i[q].fnInit(a);break}}g&&(i=a.aanFeatures,i[j]||(i[j]=[]),i[j].push(g),e.append(g))}c.replaceWith(e);a.nHolding=null}function da(a,b){var c=h(b).children("tr"),d,e,f,g,j,i,n,l,q,k;a.splice(0,a.length);f=0;for(i=c.length;f<i;f++)a.push([]);f=0;for(i=c.length;f<i;f++){d=c[f];for(e=d.firstChild;e;){if("TD"==e.nodeName.toUpperCase()||"TH"==e.nodeName.toUpperCase()){l=1*e.getAttribute("colspan");
  34. q=1*e.getAttribute("rowspan");l=!l||0===l||1===l?1:l;q=!q||0===q||1===q?1:q;g=0;for(j=a[f];j[g];)g++;n=g;k=1===l?!0:!1;for(j=0;j<l;j++)for(g=0;g<q;g++)a[f+g][n+j]={cell:e,unique:k},a[f+g].nTr=d}e=e.nextSibling}}}function ra(a,b,c){var d=[];c||(c=a.aoHeader,b&&(c=[],da(c,b)));for(var b=0,e=c.length;b<e;b++)for(var f=0,g=c[b].length;f<g;f++)if(c[b][f].unique&&(!d[f]||!a.bSortCellsTop))d[f]=c[b][f].cell;return d}function sa(a,b,c){r(a,"aoServerParams","serverParams",[b]);if(b&&h.isArray(b)){var d={},
  35. e=/(.*?)\[\]$/;h.each(b,function(a,b){var c=b.name.match(e);c?(c=c[0],d[c]||(d[c]=[]),d[c].push(b.value)):d[b.name]=b.value});b=d}var f,g=a.ajax,j=a.oInstance,i=function(b){r(a,null,"xhr",[a,b,a.jqXHR]);c(b)};if(h.isPlainObject(g)&&g.data){f=g.data;var n=h.isFunction(f)?f(b,a):f,b=h.isFunction(f)&&n?n:h.extend(!0,b,n);delete g.data}n={data:b,success:function(b){var c=b.error||b.sError;c&&J(a,0,c);a.json=b;i(b)},dataType:"json",cache:!1,type:a.sServerMethod,error:function(b,c){var d=r(a,null,"xhr",
  36. [a,null,a.jqXHR]);-1===h.inArray(!0,d)&&("parsererror"==c?J(a,0,"Invalid JSON response",1):4===b.readyState&&J(a,0,"Ajax error",7));C(a,!1)}};a.oAjaxData=b;r(a,null,"preXhr",[a,b]);a.fnServerData?a.fnServerData.call(j,a.sAjaxSource,h.map(b,function(a,b){return{name:b,value:a}}),i,a):a.sAjaxSource||"string"===typeof g?a.jqXHR=h.ajax(h.extend(n,{url:g||a.sAjaxSource})):h.isFunction(g)?a.jqXHR=g.call(j,b,i,a):(a.jqXHR=h.ajax(h.extend(n,g)),g.data=f)}function kb(a){return a.bAjaxDataGet?(a.iDraw++,C(a,
  37. !0),sa(a,tb(a),function(b){ub(a,b)}),!1):!0}function tb(a){var b=a.aoColumns,c=b.length,d=a.oFeatures,e=a.oPreviousSearch,f=a.aoPreSearchCols,g,j=[],i,n,l,k=V(a);g=a._iDisplayStart;i=!1!==d.bPaginate?a._iDisplayLength:-1;var t=function(a,b){j.push({name:a,value:b})};t("sEcho",a.iDraw);t("iColumns",c);t("sColumns",D(b,"sName").join(","));t("iDisplayStart",g);t("iDisplayLength",i);var pa={draw:a.iDraw,columns:[],order:[],start:g,length:i,search:{value:e.sSearch,regex:e.bRegex}};for(g=0;g<c;g++)n=b[g],
  38. l=f[g],i="function"==typeof n.mData?"function":n.mData,pa.columns.push({data:i,name:n.sName,searchable:n.bSearchable,orderable:n.bSortable,search:{value:l.sSearch,regex:l.bRegex}}),t("mDataProp_"+g,i),d.bFilter&&(t("sSearch_"+g,l.sSearch),t("bRegex_"+g,l.bRegex),t("bSearchable_"+g,n.bSearchable)),d.bSort&&t("bSortable_"+g,n.bSortable);d.bFilter&&(t("sSearch",e.sSearch),t("bRegex",e.bRegex));d.bSort&&(h.each(k,function(a,b){pa.order.push({column:b.col,dir:b.dir});t("iSortCol_"+a,b.col);t("sSortDir_"+
  39. a,b.dir)}),t("iSortingCols",k.length));b=m.ext.legacy.ajax;return null===b?a.sAjaxSource?j:pa:b?j:pa}function ub(a,b){var c=ta(a,b),d=b.sEcho!==k?b.sEcho:b.draw,e=b.iTotalRecords!==k?b.iTotalRecords:b.recordsTotal,f=b.iTotalDisplayRecords!==k?b.iTotalDisplayRecords:b.recordsFiltered;if(d){if(1*d<a.iDraw)return;a.iDraw=1*d}na(a);a._iRecordsTotal=parseInt(e,10);a._iRecordsDisplay=parseInt(f,10);d=0;for(e=c.length;d<e;d++)M(a,c[d]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=!1;N(a);a._bInitComplete||
  40. ua(a,b);a.bAjaxDataGet=!0;C(a,!1)}function ta(a,b){var c=h.isPlainObject(a.ajax)&&a.ajax.dataSrc!==k?a.ajax.dataSrc:a.sAjaxDataProp;return"data"===c?b.aaData||b[c]:""!==c?Q(c)(b):b}function ob(a){var b=a.oClasses,c=a.sTableId,d=a.oLanguage,e=a.oPreviousSearch,f=a.aanFeatures,g='<input type="search" class="'+b.sFilterInput+'"/>',j=d.sSearch,j=j.match(/_INPUT_/)?j.replace("_INPUT_",g):j+g,b=h("<div/>",{id:!f.f?c+"_filter":null,"class":b.sFilter}).append(h("<label/>").append(j)),f=function(){var b=!this.value?
  41. "":this.value;b!=e.sSearch&&(fa(a,{sSearch:b,bRegex:e.bRegex,bSmart:e.bSmart,bCaseInsensitive:e.bCaseInsensitive}),a._iDisplayStart=0,N(a))},g=null!==a.searchDelay?a.searchDelay:"ssp"===y(a)?400:0,i=h("input",b).val(e.sSearch).attr("placeholder",d.sSearchPlaceholder).on("keyup.DT search.DT input.DT paste.DT cut.DT",g?Na(f,g):f).on("keypress.DT",function(a){if(13==a.keyCode)return!1}).attr("aria-controls",c);h(a.nTable).on("search.dt.DT",function(b,c){if(a===c)try{i[0]!==G.activeElement&&i.val(e.sSearch)}catch(d){}});
  42. return b[0]}function fa(a,b,c){var d=a.oPreviousSearch,e=a.aoPreSearchCols,f=function(a){d.sSearch=a.sSearch;d.bRegex=a.bRegex;d.bSmart=a.bSmart;d.bCaseInsensitive=a.bCaseInsensitive};Fa(a);if("ssp"!=y(a)){vb(a,b.sSearch,c,b.bEscapeRegex!==k?!b.bEscapeRegex:b.bRegex,b.bSmart,b.bCaseInsensitive);f(b);for(b=0;b<e.length;b++)wb(a,e[b].sSearch,b,e[b].bEscapeRegex!==k?!e[b].bEscapeRegex:e[b].bRegex,e[b].bSmart,e[b].bCaseInsensitive);xb(a)}else f(b);a.bFiltered=!0;r(a,null,"search",[a])}function xb(a){for(var b=
  43. m.ext.search,c=a.aiDisplay,d,e,f=0,g=b.length;f<g;f++){for(var j=[],i=0,n=c.length;i<n;i++)e=c[i],d=a.aoData[e],b[f](a,d._aFilterData,e,d._aData,i)&&j.push(e);c.length=0;h.merge(c,j)}}function wb(a,b,c,d,e,f){if(""!==b){for(var g=[],j=a.aiDisplay,d=Oa(b,d,e,f),e=0;e<j.length;e++)b=a.aoData[j[e]]._aFilterData[c],d.test(b)&&g.push(j[e]);a.aiDisplay=g}}function vb(a,b,c,d,e,f){var d=Oa(b,d,e,f),f=a.oPreviousSearch.sSearch,g=a.aiDisplayMaster,j,e=[];0!==m.ext.search.length&&(c=!0);j=yb(a);if(0>=b.length)a.aiDisplay=
  44. g.slice();else{if(j||c||f.length>b.length||0!==b.indexOf(f)||a.bSorted)a.aiDisplay=g.slice();b=a.aiDisplay;for(c=0;c<b.length;c++)d.test(a.aoData[b[c]]._sFilterRow)&&e.push(b[c]);a.aiDisplay=e}}function Oa(a,b,c,d){a=b?a:Pa(a);c&&(a="^(?=.*?"+h.map(a.match(/"[^"]+"|[^ ]+/g)||[""],function(a){if('"'===a.charAt(0))var b=a.match(/^"(.*)"$/),a=b?b[1]:a;return a.replace('"',"")}).join(")(?=.*?")+").*$");return RegExp(a,d?"i":"")}function yb(a){var b=a.aoColumns,c,d,e,f,g,j,i,h,l=m.ext.type.search;c=!1;
  45. d=0;for(f=a.aoData.length;d<f;d++)if(h=a.aoData[d],!h._aFilterData){j=[];e=0;for(g=b.length;e<g;e++)c=b[e],c.bSearchable?(i=B(a,d,e,"filter"),l[c.sType]&&(i=l[c.sType](i)),null===i&&(i=""),"string"!==typeof i&&i.toString&&(i=i.toString())):i="",i.indexOf&&-1!==i.indexOf("&")&&(va.innerHTML=i,i=Wb?va.textContent:va.innerText),i.replace&&(i=i.replace(/[\r\n]/g,"")),j.push(i);h._aFilterData=j;h._sFilterRow=j.join(" ");c=!0}return c}function zb(a){return{search:a.sSearch,smart:a.bSmart,regex:a.bRegex,
  46. caseInsensitive:a.bCaseInsensitive}}function Ab(a){return{sSearch:a.search,bSmart:a.smart,bRegex:a.regex,bCaseInsensitive:a.caseInsensitive}}function rb(a){var b=a.sTableId,c=a.aanFeatures.i,d=h("<div/>",{"class":a.oClasses.sInfo,id:!c?b+"_info":null});c||(a.aoDrawCallback.push({fn:Bb,sName:"information"}),d.attr("role","status").attr("aria-live","polite"),h(a.nTable).attr("aria-describedby",b+"_info"));return d[0]}function Bb(a){var b=a.aanFeatures.i;if(0!==b.length){var c=a.oLanguage,d=a._iDisplayStart+
  47. 1,e=a.fnDisplayEnd(),f=a.fnRecordsTotal(),g=a.fnRecordsDisplay(),j=g?c.sInfo:c.sInfoEmpty;g!==f&&(j+=" "+c.sInfoFiltered);j+=c.sInfoPostFix;j=Cb(a,j);c=c.fnInfoCallback;null!==c&&(j=c.call(a.oInstance,a,d,e,f,g,j));h(b).html(j)}}function Cb(a,b){var c=a.fnFormatNumber,d=a._iDisplayStart+1,e=a._iDisplayLength,f=a.fnRecordsDisplay(),g=-1===e;return b.replace(/_START_/g,c.call(a,d)).replace(/_END_/g,c.call(a,a.fnDisplayEnd())).replace(/_MAX_/g,c.call(a,a.fnRecordsTotal())).replace(/_TOTAL_/g,c.call(a,
  48. f)).replace(/_PAGE_/g,c.call(a,g?1:Math.ceil(d/e))).replace(/_PAGES_/g,c.call(a,g?1:Math.ceil(f/e)))}function ga(a){var b,c,d=a.iInitDisplayStart,e=a.aoColumns,f;c=a.oFeatures;var g=a.bDeferLoading;if(a.bInitialised){mb(a);jb(a);ea(a,a.aoHeader);ea(a,a.aoFooter);C(a,!0);c.bAutoWidth&&Ea(a);b=0;for(c=e.length;b<c;b++)f=e[b],f.sWidth&&(f.nTh.style.width=v(f.sWidth));r(a,null,"preInit",[a]);S(a);e=y(a);if("ssp"!=e||g)"ajax"==e?sa(a,[],function(c){var f=ta(a,c);for(b=0;b<f.length;b++)M(a,f[b]);a.iInitDisplayStart=
  49. d;S(a);C(a,!1);ua(a,c)},a):(C(a,!1),ua(a))}else setTimeout(function(){ga(a)},200)}function ua(a,b){a._bInitComplete=!0;(b||a.oInit.aaData)&&Y(a);r(a,null,"plugin-init",[a,b]);r(a,"aoInitComplete","init",[a,b])}function Qa(a,b){var c=parseInt(b,10);a._iDisplayLength=c;Ra(a);r(a,null,"length",[a,c])}function nb(a){for(var b=a.oClasses,c=a.sTableId,d=a.aLengthMenu,e=h.isArray(d[0]),f=e?d[0]:d,d=e?d[1]:d,e=h("<select/>",{name:c+"_length","aria-controls":c,"class":b.sLengthSelect}),g=0,j=f.length;g<j;g++)e[0][g]=
  50. new Option("number"===typeof d[g]?a.fnFormatNumber(d[g]):d[g],f[g]);var i=h("<div><label/></div>").addClass(b.sLength);a.aanFeatures.l||(i[0].id=c+"_length");i.children().append(a.oLanguage.sLengthMenu.replace("_MENU_",e[0].outerHTML));h("select",i).val(a._iDisplayLength).on("change.DT",function(){Qa(a,h(this).val());N(a)});h(a.nTable).on("length.dt.DT",function(b,c,d){a===c&&h("select",i).val(d)});return i[0]}function sb(a){var b=a.sPaginationType,c=m.ext.pager[b],d="function"===typeof c,e=function(a){N(a)},
  51. b=h("<div/>").addClass(a.oClasses.sPaging+b)[0],f=a.aanFeatures;d||c.fnInit(a,b,e);f.p||(b.id=a.sTableId+"_paginate",a.aoDrawCallback.push({fn:function(a){if(d){var b=a._iDisplayStart,i=a._iDisplayLength,h=a.fnRecordsDisplay(),l=-1===i,b=l?0:Math.ceil(b/i),i=l?1:Math.ceil(h/i),h=c(b,i),k,l=0;for(k=f.p.length;l<k;l++)Ma(a,"pageButton")(a,f.p[l],l,h,b,i)}else c.fnUpdate(a,e)},sName:"pagination"}));return b}function Sa(a,b,c){var d=a._iDisplayStart,e=a._iDisplayLength,f=a.fnRecordsDisplay();0===f||-1===
  52. e?d=0:"number"===typeof b?(d=b*e,d>f&&(d=0)):"first"==b?d=0:"previous"==b?(d=0<=e?d-e:0,0>d&&(d=0)):"next"==b?d+e<f&&(d+=e):"last"==b?d=Math.floor((f-1)/e)*e:J(a,0,"Unknown paging action: "+b,5);b=a._iDisplayStart!==d;a._iDisplayStart=d;b&&(r(a,null,"page",[a]),c&&N(a));return b}function pb(a){return h("<div/>",{id:!a.aanFeatures.r?a.sTableId+"_processing":null,"class":a.oClasses.sProcessing}).html(a.oLanguage.sProcessing).insertBefore(a.nTable)[0]}function C(a,b){a.oFeatures.bProcessing&&h(a.aanFeatures.r).css("display",
  53. b?"block":"none");r(a,null,"processing",[a,b])}function qb(a){var b=h(a.nTable);b.attr("role","grid");var c=a.oScroll;if(""===c.sX&&""===c.sY)return a.nTable;var d=c.sX,e=c.sY,f=a.oClasses,g=b.children("caption"),j=g.length?g[0]._captionSide:null,i=h(b[0].cloneNode(!1)),n=h(b[0].cloneNode(!1)),l=b.children("tfoot");l.length||(l=null);i=h("<div/>",{"class":f.sScrollWrapper}).append(h("<div/>",{"class":f.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:d?!d?null:v(d):"100%"}).append(h("<div/>",
  54. {"class":f.sScrollHeadInner}).css({"box-sizing":"content-box",width:c.sXInner||"100%"}).append(i.removeAttr("id").css("margin-left",0).append("top"===j?g:null).append(b.children("thead"))))).append(h("<div/>",{"class":f.sScrollBody}).css({position:"relative",overflow:"auto",width:!d?null:v(d)}).append(b));l&&i.append(h("<div/>",{"class":f.sScrollFoot}).css({overflow:"hidden",border:0,width:d?!d?null:v(d):"100%"}).append(h("<div/>",{"class":f.sScrollFootInner}).append(n.removeAttr("id").css("margin-left",
  55. 0).append("bottom"===j?g:null).append(b.children("tfoot")))));var b=i.children(),k=b[0],f=b[1],t=l?b[2]:null;if(d)h(f).on("scroll.DT",function(){var a=this.scrollLeft;k.scrollLeft=a;l&&(t.scrollLeft=a)});h(f).css(e&&c.bCollapse?"max-height":"height",e);a.nScrollHead=k;a.nScrollBody=f;a.nScrollFoot=t;a.aoDrawCallback.push({fn:ka,sName:"scrolling"});return i[0]}function ka(a){var b=a.oScroll,c=b.sX,d=b.sXInner,e=b.sY,b=b.iBarWidth,f=h(a.nScrollHead),g=f[0].style,j=f.children("div"),i=j[0].style,n=j.children("table"),
  56. j=a.nScrollBody,l=h(j),q=j.style,t=h(a.nScrollFoot).children("div"),m=t.children("table"),o=h(a.nTHead),p=h(a.nTable),s=p[0],r=s.style,u=a.nTFoot?h(a.nTFoot):null,x=a.oBrowser,T=x.bScrollOversize,Xb=D(a.aoColumns,"nTh"),O,K,P,w,Ta=[],y=[],z=[],A=[],B,C=function(a){a=a.style;a.paddingTop="0";a.paddingBottom="0";a.borderTopWidth="0";a.borderBottomWidth="0";a.height=0};K=j.scrollHeight>j.clientHeight;if(a.scrollBarVis!==K&&a.scrollBarVis!==k)a.scrollBarVis=K,Y(a);else{a.scrollBarVis=K;p.children("thead, tfoot").remove();
  57. u&&(P=u.clone().prependTo(p),O=u.find("tr"),P=P.find("tr"));w=o.clone().prependTo(p);o=o.find("tr");K=w.find("tr");w.find("th, td").removeAttr("tabindex");c||(q.width="100%",f[0].style.width="100%");h.each(ra(a,w),function(b,c){B=Z(a,b);c.style.width=a.aoColumns[B].sWidth});u&&H(function(a){a.style.width=""},P);f=p.outerWidth();if(""===c){r.width="100%";if(T&&(p.find("tbody").height()>j.offsetHeight||"scroll"==l.css("overflow-y")))r.width=v(p.outerWidth()-b);f=p.outerWidth()}else""!==d&&(r.width=
  58. v(d),f=p.outerWidth());H(C,K);H(function(a){z.push(a.innerHTML);Ta.push(v(h(a).css("width")))},K);H(function(a,b){if(h.inArray(a,Xb)!==-1)a.style.width=Ta[b]},o);h(K).height(0);u&&(H(C,P),H(function(a){A.push(a.innerHTML);y.push(v(h(a).css("width")))},P),H(function(a,b){a.style.width=y[b]},O),h(P).height(0));H(function(a,b){a.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+z[b]+"</div>";a.style.width=Ta[b]},K);u&&H(function(a,b){a.innerHTML='<div class="dataTables_sizing" style="height:0;overflow:hidden;">'+
  59. A[b]+"</div>";a.style.width=y[b]},P);if(p.outerWidth()<f){O=j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")?f+b:f;if(T&&(j.scrollHeight>j.offsetHeight||"scroll"==l.css("overflow-y")))r.width=v(O-b);(""===c||""!==d)&&J(a,1,"Possible column misalignment",6)}else O="100%";q.width=v(O);g.width=v(O);u&&(a.nScrollFoot.style.width=v(O));!e&&T&&(q.height=v(s.offsetHeight+b));c=p.outerWidth();n[0].style.width=v(c);i.width=v(c);d=p.height()>j.clientHeight||"scroll"==l.css("overflow-y");e="padding"+
  60. (x.bScrollbarLeft?"Left":"Right");i[e]=d?b+"px":"0px";u&&(m[0].style.width=v(c),t[0].style.width=v(c),t[0].style[e]=d?b+"px":"0px");p.children("colgroup").insertBefore(p.children("thead"));l.scroll();if((a.bSorted||a.bFiltered)&&!a._drawHold)j.scrollTop=0}}function H(a,b,c){for(var d=0,e=0,f=b.length,g,j;e<f;){g=b[e].firstChild;for(j=c?c[e].firstChild:null;g;)1===g.nodeType&&(c?a(g,j,d):a(g,d),d++),g=g.nextSibling,j=c?j.nextSibling:null;e++}}function Ea(a){var b=a.nTable,c=a.aoColumns,d=a.oScroll,
  61. e=d.sY,f=d.sX,g=d.sXInner,j=c.length,i=la(a,"bVisible"),n=h("th",a.nTHead),l=b.getAttribute("width"),k=b.parentNode,t=!1,m,o,p=a.oBrowser,d=p.bScrollOversize;(m=b.style.width)&&-1!==m.indexOf("%")&&(l=m);for(m=0;m<i.length;m++)o=c[i[m]],null!==o.sWidth&&(o.sWidth=Db(o.sWidthOrig,k),t=!0);if(d||!t&&!f&&!e&&j==aa(a)&&j==n.length)for(m=0;m<j;m++)i=Z(a,m),null!==i&&(c[i].sWidth=v(n.eq(m).width()));else{j=h(b).clone().css("visibility","hidden").removeAttr("id");j.find("tbody tr").remove();var s=h("<tr/>").appendTo(j.find("tbody"));
  62. j.find("thead, tfoot").remove();j.append(h(a.nTHead).clone()).append(h(a.nTFoot).clone());j.find("tfoot th, tfoot td").css("width","");n=ra(a,j.find("thead")[0]);for(m=0;m<i.length;m++)o=c[i[m]],n[m].style.width=null!==o.sWidthOrig&&""!==o.sWidthOrig?v(o.sWidthOrig):"",o.sWidthOrig&&f&&h(n[m]).append(h("<div/>").css({width:o.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(a.aoData.length)for(m=0;m<i.length;m++)t=i[m],o=c[t],h(Eb(a,t)).clone(!1).append(o.sContentPadding).appendTo(s);h("[name]",
  63. j).removeAttr("name");o=h("<div/>").css(f||e?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(j).appendTo(k);f&&g?j.width(g):f?(j.css("width","auto"),j.removeAttr("width"),j.width()<k.clientWidth&&l&&j.width(k.clientWidth)):e?j.width(k.clientWidth):l&&j.width(l);for(m=e=0;m<i.length;m++)k=h(n[m]),g=k.outerWidth()-k.width(),k=p.bBounding?Math.ceil(n[m].getBoundingClientRect().width):k.outerWidth(),e+=k,c[i[m]].sWidth=v(k-g);b.style.width=v(e);o.remove()}l&&(b.style.width=
  64. v(l));if((l||f)&&!a._reszEvt)b=function(){h(E).on("resize.DT-"+a.sInstance,Na(function(){Y(a)}))},d?setTimeout(b,1E3):b(),a._reszEvt=!0}function Db(a,b){if(!a)return 0;var c=h("<div/>").css("width",v(a)).appendTo(b||G.body),d=c[0].offsetWidth;c.remove();return d}function Eb(a,b){var c=Fb(a,b);if(0>c)return null;var d=a.aoData[c];return!d.nTr?h("<td/>").html(B(a,c,b,"display"))[0]:d.anCells[b]}function Fb(a,b){for(var c,d=-1,e=-1,f=0,g=a.aoData.length;f<g;f++)c=B(a,f,b,"display")+"",c=c.replace(Yb,
  65. ""),c=c.replace(/&nbsp;/g," "),c.length>d&&(d=c.length,e=f);return e}function v(a){return null===a?"0px":"number"==typeof a?0>a?"0px":a+"px":a.match(/\d$/)?a+"px":a}function V(a){var b,c,d=[],e=a.aoColumns,f,g,j,i;b=a.aaSortingFixed;c=h.isPlainObject(b);var n=[];f=function(a){a.length&&!h.isArray(a[0])?n.push(a):h.merge(n,a)};h.isArray(b)&&f(b);c&&b.pre&&f(b.pre);f(a.aaSorting);c&&b.post&&f(b.post);for(a=0;a<n.length;a++){i=n[a][0];f=e[i].aDataSort;b=0;for(c=f.length;b<c;b++)g=f[b],j=e[g].sType||
  66. "string",n[a]._idx===k&&(n[a]._idx=h.inArray(n[a][1],e[g].asSorting)),d.push({src:i,col:g,dir:n[a][1],index:n[a]._idx,type:j,formatter:m.ext.type.order[j+"-pre"]})}return d}function lb(a){var b,c,d=[],e=m.ext.type.order,f=a.aoData,g=0,j,i=a.aiDisplayMaster,h;Fa(a);h=V(a);b=0;for(c=h.length;b<c;b++)j=h[b],j.formatter&&g++,Gb(a,j.col);if("ssp"!=y(a)&&0!==h.length){b=0;for(c=i.length;b<c;b++)d[i[b]]=b;g===h.length?i.sort(function(a,b){var c,e,g,j,i=h.length,k=f[a]._aSortData,m=f[b]._aSortData;for(g=
  67. 0;g<i;g++)if(j=h[g],c=k[j.col],e=m[j.col],c=c<e?-1:c>e?1:0,0!==c)return"asc"===j.dir?c:-c;c=d[a];e=d[b];return c<e?-1:c>e?1:0}):i.sort(function(a,b){var c,g,j,i,k=h.length,m=f[a]._aSortData,o=f[b]._aSortData;for(j=0;j<k;j++)if(i=h[j],c=m[i.col],g=o[i.col],i=e[i.type+"-"+i.dir]||e["string-"+i.dir],c=i(c,g),0!==c)return c;c=d[a];g=d[b];return c<g?-1:c>g?1:0})}a.bSorted=!0}function Hb(a){for(var b,c,d=a.aoColumns,e=V(a),a=a.oLanguage.oAria,f=0,g=d.length;f<g;f++){c=d[f];var j=c.asSorting;b=c.sTitle.replace(/<.*?>/g,
  68. "");var i=c.nTh;i.removeAttribute("aria-sort");c.bSortable&&(0<e.length&&e[0].col==f?(i.setAttribute("aria-sort","asc"==e[0].dir?"ascending":"descending"),c=j[e[0].index+1]||j[0]):c=j[0],b+="asc"===c?a.sSortAscending:a.sSortDescending);i.setAttribute("aria-label",b)}}function Ua(a,b,c,d){var e=a.aaSorting,f=a.aoColumns[b].asSorting,g=function(a,b){var c=a._idx;c===k&&(c=h.inArray(a[1],f));return c+1<f.length?c+1:b?null:0};"number"===typeof e[0]&&(e=a.aaSorting=[e]);c&&a.oFeatures.bSortMulti?(c=h.inArray(b,
  69. D(e,"0")),-1!==c?(b=g(e[c],!0),null===b&&1===e.length&&(b=0),null===b?e.splice(c,1):(e[c][1]=f[b],e[c]._idx=b)):(e.push([b,f[0],0]),e[e.length-1]._idx=0)):e.length&&e[0][0]==b?(b=g(e[0]),e.length=1,e[0][1]=f[b],e[0]._idx=b):(e.length=0,e.push([b,f[0]]),e[0]._idx=0);S(a);"function"==typeof d&&d(a)}function La(a,b,c,d){var e=a.aoColumns[c];Va(b,{},function(b){!1!==e.bSortable&&(a.oFeatures.bProcessing?(C(a,!0),setTimeout(function(){Ua(a,c,b.shiftKey,d);"ssp"!==y(a)&&C(a,!1)},0)):Ua(a,c,b.shiftKey,d))})}
  70. function wa(a){var b=a.aLastSort,c=a.oClasses.sSortColumn,d=V(a),e=a.oFeatures,f,g;if(e.bSort&&e.bSortClasses){e=0;for(f=b.length;e<f;e++)g=b[e].src,h(D(a.aoData,"anCells",g)).removeClass(c+(2>e?e+1:3));e=0;for(f=d.length;e<f;e++)g=d[e].src,h(D(a.aoData,"anCells",g)).addClass(c+(2>e?e+1:3))}a.aLastSort=d}function Gb(a,b){var c=a.aoColumns[b],d=m.ext.order[c.sSortDataType],e;d&&(e=d.call(a.oInstance,a,b,$(a,b)));for(var f,g=m.ext.type.order[c.sType+"-pre"],j=0,i=a.aoData.length;j<i;j++)if(c=a.aoData[j],
  71. c._aSortData||(c._aSortData=[]),!c._aSortData[b]||d)f=d?e[j]:B(a,j,b,"sort"),c._aSortData[b]=g?g(f):f}function xa(a){if(a.oFeatures.bStateSave&&!a.bDestroying){var b={time:+new Date,start:a._iDisplayStart,length:a._iDisplayLength,order:h.extend(!0,[],a.aaSorting),search:zb(a.oPreviousSearch),columns:h.map(a.aoColumns,function(b,d){return{visible:b.bVisible,search:zb(a.aoPreSearchCols[d])}})};r(a,"aoStateSaveParams","stateSaveParams",[a,b]);a.oSavedState=b;a.fnStateSaveCallback.call(a.oInstance,a,
  72. b)}}function Ib(a,b,c){var d,e,f=a.aoColumns,b=function(b){if(b&&b.time){var g=r(a,"aoStateLoadParams","stateLoadParams",[a,b]);if(-1===h.inArray(!1,g)&&(g=a.iStateDuration,!(0<g&&b.time<+new Date-1E3*g)&&!(b.columns&&f.length!==b.columns.length))){a.oLoadedState=h.extend(!0,{},b);b.start!==k&&(a._iDisplayStart=b.start,a.iInitDisplayStart=b.start);b.length!==k&&(a._iDisplayLength=b.length);b.order!==k&&(a.aaSorting=[],h.each(b.order,function(b,c){a.aaSorting.push(c[0]>=f.length?[0,c[1]]:c)}));b.search!==
  73. k&&h.extend(a.oPreviousSearch,Ab(b.search));if(b.columns){d=0;for(e=b.columns.length;d<e;d++)g=b.columns[d],g.visible!==k&&(f[d].bVisible=g.visible),g.search!==k&&h.extend(a.aoPreSearchCols[d],Ab(g.search))}r(a,"aoStateLoaded","stateLoaded",[a,b])}}c()};if(a.oFeatures.bStateSave){var g=a.fnStateLoadCallback.call(a.oInstance,a,b);g!==k&&b(g)}else c()}function ya(a){var b=m.settings,a=h.inArray(a,D(b,"nTable"));return-1!==a?b[a]:null}function J(a,b,c,d){c="DataTables warning: "+(a?"table id="+a.sTableId+
  74. " - ":"")+c;d&&(c+=". For more information about this error, please see http://datatables.net/tn/"+d);if(b)E.console&&console.log&&console.log(c);else if(b=m.ext,b=b.sErrMode||b.errMode,a&&r(a,null,"error",[a,d,c]),"alert"==b)alert(c);else{if("throw"==b)throw Error(c);"function"==typeof b&&b(a,d,c)}}function F(a,b,c,d){h.isArray(c)?h.each(c,function(c,d){h.isArray(d)?F(a,b,d[0],d[1]):F(a,b,d)}):(d===k&&(d=c),b[c]!==k&&(a[d]=b[c]))}function Jb(a,b,c){var d,e;for(e in b)b.hasOwnProperty(e)&&(d=b[e],
  75. h.isPlainObject(d)?(h.isPlainObject(a[e])||(a[e]={}),h.extend(!0,a[e],d)):a[e]=c&&"data"!==e&&"aaData"!==e&&h.isArray(d)?d.slice():d);return a}function Va(a,b,c){h(a).on("click.DT",b,function(b){a.blur();c(b)}).on("keypress.DT",b,function(a){13===a.which&&(a.preventDefault(),c(a))}).on("selectstart.DT",function(){return!1})}function z(a,b,c,d){c&&a[b].push({fn:c,sName:d})}function r(a,b,c,d){var e=[];b&&(e=h.map(a[b].slice().reverse(),function(b){return b.fn.apply(a.oInstance,d)}));null!==c&&(b=h.Event(c+
  76. ".dt"),h(a.nTable).trigger(b,d),e.push(b.result));return e}function Ra(a){var b=a._iDisplayStart,c=a.fnDisplayEnd(),d=a._iDisplayLength;b>=c&&(b=c-d);b-=b%d;if(-1===d||0>b)b=0;a._iDisplayStart=b}function Ma(a,b){var c=a.renderer,d=m.ext.renderer[b];return h.isPlainObject(c)&&c[b]?d[c[b]]||d._:"string"===typeof c?d[c]||d._:d._}function y(a){return a.oFeatures.bServerSide?"ssp":a.ajax||a.sAjaxSource?"ajax":"dom"}function ha(a,b){var c=[],c=Kb.numbers_length,d=Math.floor(c/2);b<=c?c=W(0,b):a<=d?(c=W(0,
  77. c-2),c.push("ellipsis"),c.push(b-1)):(a>=b-1-d?c=W(b-(c-2),b):(c=W(a-d+2,a+d-1),c.push("ellipsis"),c.push(b-1)),c.splice(0,0,"ellipsis"),c.splice(0,0,0));c.DT_el="span";return c}function cb(a){h.each({num:function(b){return za(b,a)},"num-fmt":function(b){return za(b,a,Wa)},"html-num":function(b){return za(b,a,Aa)},"html-num-fmt":function(b){return za(b,a,Aa,Wa)}},function(b,c){x.type.order[b+a+"-pre"]=c;b.match(/^html\-/)&&(x.type.search[b+a]=x.type.search.html)})}function Lb(a){return function(){var b=
  78. [ya(this[m.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return m.ext.internal[a].apply(this,b)}}var m=function(a){this.$=function(a,b){return this.api(!0).$(a,b)};this._=function(a,b){return this.api(!0).rows(a,b).data()};this.api=function(a){return a?new s(ya(this[x.iApiIndex])):new s(this)};this.fnAddData=function(a,b){var c=this.api(!0),d=h.isArray(a)&&(h.isArray(a[0])||h.isPlainObject(a[0]))?c.rows.add(a):c.row.add(a);(b===k||b)&&c.draw();return d.flatten().toArray()};this.fnAdjustColumnSizing=
  79. function(a){var b=this.api(!0).columns.adjust(),c=b.settings()[0],d=c.oScroll;a===k||a?b.draw(!1):(""!==d.sX||""!==d.sY)&&ka(c)};this.fnClearTable=function(a){var b=this.api(!0).clear();(a===k||a)&&b.draw()};this.fnClose=function(a){this.api(!0).row(a).child.hide()};this.fnDeleteRow=function(a,b,c){var d=this.api(!0),a=d.rows(a),e=a.settings()[0],h=e.aoData[a[0][0]];a.remove();b&&b.call(this,e,h);(c===k||c)&&d.draw();return h};this.fnDestroy=function(a){this.api(!0).destroy(a)};this.fnDraw=function(a){this.api(!0).draw(a)};
  80. this.fnFilter=function(a,b,c,d,e,h){e=this.api(!0);null===b||b===k?e.search(a,c,d,h):e.column(b).search(a,c,d,h);e.draw()};this.fnGetData=function(a,b){var c=this.api(!0);if(a!==k){var d=a.nodeName?a.nodeName.toLowerCase():"";return b!==k||"td"==d||"th"==d?c.cell(a,b).data():c.row(a).data()||null}return c.data().toArray()};this.fnGetNodes=function(a){var b=this.api(!0);return a!==k?b.row(a).node():b.rows().nodes().flatten().toArray()};this.fnGetPosition=function(a){var b=this.api(!0),c=a.nodeName.toUpperCase();
  81. return"TR"==c?b.row(a).index():"TD"==c||"TH"==c?(a=b.cell(a).index(),[a.row,a.columnVisible,a.column]):null};this.fnIsOpen=function(a){return this.api(!0).row(a).child.isShown()};this.fnOpen=function(a,b,c){return this.api(!0).row(a).child(b,c).show().child()[0]};this.fnPageChange=function(a,b){var c=this.api(!0).page(a);(b===k||b)&&c.draw(!1)};this.fnSetColumnVis=function(a,b,c){a=this.api(!0).column(a).visible(b);(c===k||c)&&a.columns.adjust().draw()};this.fnSettings=function(){return ya(this[x.iApiIndex])};
  82. this.fnSort=function(a){this.api(!0).order(a).draw()};this.fnSortListener=function(a,b,c){this.api(!0).order.listener(a,b,c)};this.fnUpdate=function(a,b,c,d,e){var h=this.api(!0);c===k||null===c?h.row(b).data(a):h.cell(b,c).data(a);(e===k||e)&&h.columns.adjust();(d===k||d)&&h.draw();return 0};this.fnVersionCheck=x.fnVersionCheck;var b=this,c=a===k,d=this.length;c&&(a={});this.oApi=this.internal=x.internal;for(var e in m.ext.internal)e&&(this[e]=Lb(e));this.each(function(){var e={},g=1<d?Jb(e,a,!0):
  83. a,j=0,i,e=this.getAttribute("id"),n=!1,l=m.defaults,q=h(this);if("table"!=this.nodeName.toLowerCase())J(null,0,"Non-table node initialisation ("+this.nodeName+")",2);else{db(l);eb(l.column);I(l,l,!0);I(l.column,l.column,!0);I(l,h.extend(g,q.data()));var t=m.settings,j=0;for(i=t.length;j<i;j++){var o=t[j];if(o.nTable==this||o.nTHead.parentNode==this||o.nTFoot&&o.nTFoot.parentNode==this){var s=g.bRetrieve!==k?g.bRetrieve:l.bRetrieve;if(c||s)return o.oInstance;if(g.bDestroy!==k?g.bDestroy:l.bDestroy){o.oInstance.fnDestroy();
  84. break}else{J(o,0,"Cannot reinitialise DataTable",3);return}}if(o.sTableId==this.id){t.splice(j,1);break}}if(null===e||""===e)this.id=e="DataTables_Table_"+m.ext._unique++;var p=h.extend(!0,{},m.models.oSettings,{sDestroyWidth:q[0].style.width,sInstance:e,sTableId:e});p.nTable=this;p.oApi=b.internal;p.oInit=g;t.push(p);p.oInstance=1===b.length?b:q.dataTable();db(g);g.oLanguage&&Ca(g.oLanguage);g.aLengthMenu&&!g.iDisplayLength&&(g.iDisplayLength=h.isArray(g.aLengthMenu[0])?g.aLengthMenu[0][0]:g.aLengthMenu[0]);
  85. g=Jb(h.extend(!0,{},l),g);F(p.oFeatures,g,"bPaginate bLengthChange bFilter bSort bSortMulti bInfo bProcessing bAutoWidth bSortClasses bServerSide bDeferRender".split(" "));F(p,g,["asStripeClasses","ajax","fnServerData","fnFormatNumber","sServerMethod","aaSorting","aaSortingFixed","aLengthMenu","sPaginationType","sAjaxSource","sAjaxDataProp","iStateDuration","sDom","bSortCellsTop","iTabIndex","fnStateLoadCallback","fnStateSaveCallback","renderer","searchDelay","rowId",["iCookieDuration","iStateDuration"],
  86. ["oSearch","oPreviousSearch"],["aoSearchCols","aoPreSearchCols"],["iDisplayLength","_iDisplayLength"]]);F(p.oScroll,g,[["sScrollX","sX"],["sScrollXInner","sXInner"],["sScrollY","sY"],["bScrollCollapse","bCollapse"]]);F(p.oLanguage,g,"fnInfoCallback");z(p,"aoDrawCallback",g.fnDrawCallback,"user");z(p,"aoServerParams",g.fnServerParams,"user");z(p,"aoStateSaveParams",g.fnStateSaveParams,"user");z(p,"aoStateLoadParams",g.fnStateLoadParams,"user");z(p,"aoStateLoaded",g.fnStateLoaded,"user");z(p,"aoRowCallback",
  87. g.fnRowCallback,"user");z(p,"aoRowCreatedCallback",g.fnCreatedRow,"user");z(p,"aoHeaderCallback",g.fnHeaderCallback,"user");z(p,"aoFooterCallback",g.fnFooterCallback,"user");z(p,"aoInitComplete",g.fnInitComplete,"user");z(p,"aoPreDrawCallback",g.fnPreDrawCallback,"user");p.rowIdFn=Q(g.rowId);fb(p);var u=p.oClasses;h.extend(u,m.ext.classes,g.oClasses);q.addClass(u.sTable);p.iInitDisplayStart===k&&(p.iInitDisplayStart=g.iDisplayStart,p._iDisplayStart=g.iDisplayStart);null!==g.iDeferLoading&&(p.bDeferLoading=
  88. !0,e=h.isArray(g.iDeferLoading),p._iRecordsDisplay=e?g.iDeferLoading[0]:g.iDeferLoading,p._iRecordsTotal=e?g.iDeferLoading[1]:g.iDeferLoading);var v=p.oLanguage;h.extend(!0,v,g.oLanguage);v.sUrl&&(h.ajax({dataType:"json",url:v.sUrl,success:function(a){Ca(a);I(l.oLanguage,a);h.extend(true,v,a);ga(p)},error:function(){ga(p)}}),n=!0);null===g.asStripeClasses&&(p.asStripeClasses=[u.sStripeOdd,u.sStripeEven]);var e=p.asStripeClasses,x=q.children("tbody").find("tr").eq(0);-1!==h.inArray(!0,h.map(e,function(a){return x.hasClass(a)}))&&
  89. (h("tbody tr",this).removeClass(e.join(" ")),p.asDestroyStripes=e.slice());e=[];t=this.getElementsByTagName("thead");0!==t.length&&(da(p.aoHeader,t[0]),e=ra(p));if(null===g.aoColumns){t=[];j=0;for(i=e.length;j<i;j++)t.push(null)}else t=g.aoColumns;j=0;for(i=t.length;j<i;j++)Da(p,e?e[j]:null);hb(p,g.aoColumnDefs,t,function(a,b){ja(p,a,b)});if(x.length){var w=function(a,b){return a.getAttribute("data-"+b)!==null?b:null};h(x[0]).children("th, td").each(function(a,b){var c=p.aoColumns[a];if(c.mData===
  90. a){var d=w(b,"sort")||w(b,"order"),e=w(b,"filter")||w(b,"search");if(d!==null||e!==null){c.mData={_:a+".display",sort:d!==null?a+".@data-"+d:k,type:d!==null?a+".@data-"+d:k,filter:e!==null?a+".@data-"+e:k};ja(p,a)}}})}var T=p.oFeatures,e=function(){if(g.aaSorting===k){var a=p.aaSorting;j=0;for(i=a.length;j<i;j++)a[j][1]=p.aoColumns[j].asSorting[0]}wa(p);T.bSort&&z(p,"aoDrawCallback",function(){if(p.bSorted){var a=V(p),b={};h.each(a,function(a,c){b[c.src]=c.dir});r(p,null,"order",[p,a,b]);Hb(p)}});
  91. z(p,"aoDrawCallback",function(){(p.bSorted||y(p)==="ssp"||T.bDeferRender)&&wa(p)},"sc");var a=q.children("caption").each(function(){this._captionSide=h(this).css("caption-side")}),b=q.children("thead");b.length===0&&(b=h("<thead/>").appendTo(q));p.nTHead=b[0];b=q.children("tbody");b.length===0&&(b=h("<tbody/>").appendTo(q));p.nTBody=b[0];b=q.children("tfoot");if(b.length===0&&a.length>0&&(p.oScroll.sX!==""||p.oScroll.sY!==""))b=h("<tfoot/>").appendTo(q);if(b.length===0||b.children().length===0)q.addClass(u.sNoFooter);
  92. else if(b.length>0){p.nTFoot=b[0];da(p.aoFooter,p.nTFoot)}if(g.aaData)for(j=0;j<g.aaData.length;j++)M(p,g.aaData[j]);else(p.bDeferLoading||y(p)=="dom")&&ma(p,h(p.nTBody).children("tr"));p.aiDisplay=p.aiDisplayMaster.slice();p.bInitialised=true;n===false&&ga(p)};g.bStateSave?(T.bStateSave=!0,z(p,"aoDrawCallback",xa,"state_save"),Ib(p,g,e)):e()}});b=null;return this},x,s,o,u,Xa={},Mb=/[\r\n]/g,Aa=/<.*?>/g,Zb=/^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/,$b=RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^|\\-)",
  93. "g"),Wa=/[',$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfk]/gi,L=function(a){return!a||!0===a||"-"===a?!0:!1},Nb=function(a){var b=parseInt(a,10);return!isNaN(b)&&isFinite(a)?b:null},Ob=function(a,b){Xa[b]||(Xa[b]=RegExp(Pa(b),"g"));return"string"===typeof a&&"."!==b?a.replace(/\./g,"").replace(Xa[b],"."):a},Ya=function(a,b,c){var d="string"===typeof a;if(L(a))return!0;b&&d&&(a=Ob(a,b));c&&d&&(a=a.replace(Wa,""));return!isNaN(parseFloat(a))&&isFinite(a)},Pb=function(a,b,c){return L(a)?!0:!(L(a)||"string"===
  94. typeof a)?null:Ya(a.replace(Aa,""),b,c)?!0:null},D=function(a,b,c){var d=[],e=0,f=a.length;if(c!==k)for(;e<f;e++)a[e]&&a[e][b]&&d.push(a[e][b][c]);else for(;e<f;e++)a[e]&&d.push(a[e][b]);return d},ia=function(a,b,c,d){var e=[],f=0,g=b.length;if(d!==k)for(;f<g;f++)a[b[f]][c]&&e.push(a[b[f]][c][d]);else for(;f<g;f++)e.push(a[b[f]][c]);return e},W=function(a,b){var c=[],d;b===k?(b=0,d=a):(d=b,b=a);for(var e=b;e<d;e++)c.push(e);return c},Qb=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&b.push(a[c]);
  95. return b},qa=function(a){var b;a:{if(!(2>a.length)){b=a.slice().sort();for(var c=b[0],d=1,e=b.length;d<e;d++){if(b[d]===c){b=!1;break a}c=b[d]}}b=!0}if(b)return a.slice();b=[];var e=a.length,f,g=0,d=0;a:for(;d<e;d++){c=a[d];for(f=0;f<g;f++)if(b[f]===c)continue a;b.push(c);g++}return b};m.util={throttle:function(a,b){var c=b!==k?b:200,d,e;return function(){var b=this,g=+new Date,j=arguments;d&&g<d+c?(clearTimeout(e),e=setTimeout(function(){d=k;a.apply(b,j)},c)):(d=g,a.apply(b,j))}},escapeRegex:function(a){return a.replace($b,
  96. "\\$1")}};var A=function(a,b,c){a[b]!==k&&(a[c]=a[b])},ba=/\[.*?\]$/,U=/\(\)$/,Pa=m.util.escapeRegex,va=h("<div>")[0],Wb=va.textContent!==k,Yb=/<.*?>/g,Na=m.util.throttle,Rb=[],w=Array.prototype,ac=function(a){var b,c,d=m.settings,e=h.map(d,function(a){return a.nTable});if(a){if(a.nTable&&a.oApi)return[a];if(a.nodeName&&"table"===a.nodeName.toLowerCase())return b=h.inArray(a,e),-1!==b?[d[b]]:null;if(a&&"function"===typeof a.settings)return a.settings().toArray();"string"===typeof a?c=h(a):a instanceof
  97. h&&(c=a)}else return[];if(c)return c.map(function(){b=h.inArray(this,e);return-1!==b?d[b]:null}).toArray()};s=function(a,b){if(!(this instanceof s))return new s(a,b);var c=[],d=function(a){(a=ac(a))&&(c=c.concat(a))};if(h.isArray(a))for(var e=0,f=a.length;e<f;e++)d(a[e]);else d(a);this.context=qa(c);b&&h.merge(this,b);this.selector={rows:null,cols:null,opts:null};s.extend(this,this,Rb)};m.Api=s;h.extend(s.prototype,{any:function(){return 0!==this.count()},concat:w.concat,context:[],count:function(){return this.flatten().length},
  98. each:function(a){for(var b=0,c=this.length;b<c;b++)a.call(this,this[b],b,this);return this},eq:function(a){var b=this.context;return b.length>a?new s(b[a],this[a]):null},filter:function(a){var b=[];if(w.filter)b=w.filter.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)a.call(this,this[c],c,this)&&b.push(this[c]);return new s(this.context,b)},flatten:function(){var a=[];return new s(this.context,a.concat.apply(a,this.toArray()))},join:w.join,indexOf:w.indexOf||function(a,b){for(var c=b||0,
  99. d=this.length;c<d;c++)if(this[c]===a)return c;return-1},iterator:function(a,b,c,d){var e=[],f,g,j,h,n,l=this.context,m,o,u=this.selector;"string"===typeof a&&(d=c,c=b,b=a,a=!1);g=0;for(j=l.length;g<j;g++){var r=new s(l[g]);if("table"===b)f=c.call(r,l[g],g),f!==k&&e.push(f);else if("columns"===b||"rows"===b)f=c.call(r,l[g],this[g],g),f!==k&&e.push(f);else if("column"===b||"column-rows"===b||"row"===b||"cell"===b){o=this[g];"column-rows"===b&&(m=Ba(l[g],u.opts));h=0;for(n=o.length;h<n;h++)f=o[h],f=
  100. "cell"===b?c.call(r,l[g],f.row,f.column,g,h):c.call(r,l[g],f,g,h,m),f!==k&&e.push(f)}}return e.length||d?(a=new s(l,a?e.concat.apply([],e):e),b=a.selector,b.rows=u.rows,b.cols=u.cols,b.opts=u.opts,a):this},lastIndexOf:w.lastIndexOf||function(a,b){return this.indexOf.apply(this.toArray.reverse(),arguments)},length:0,map:function(a){var b=[];if(w.map)b=w.map.call(this,a,this);else for(var c=0,d=this.length;c<d;c++)b.push(a.call(this,this[c],c));return new s(this.context,b)},pluck:function(a){return this.map(function(b){return b[a]})},
  101. pop:w.pop,push:w.push,reduce:w.reduce||function(a,b){return gb(this,a,b,0,this.length,1)},reduceRight:w.reduceRight||function(a,b){return gb(this,a,b,this.length-1,-1,-1)},reverse:w.reverse,selector:null,shift:w.shift,slice:function(){return new s(this.context,this)},sort:w.sort,splice:w.splice,toArray:function(){return w.slice.call(this)},to$:function(){return h(this)},toJQuery:function(){return h(this)},unique:function(){return new s(this.context,qa(this))},unshift:w.unshift});s.extend=function(a,
  102. b,c){if(c.length&&b&&(b instanceof s||b.__dt_wrapper)){var d,e,f,g=function(a,b,c){return function(){var d=b.apply(a,arguments);s.extend(d,d,c.methodExt);return d}};d=0;for(e=c.length;d<e;d++)f=c[d],b[f.name]="function"===typeof f.val?g(a,f.val,f):h.isPlainObject(f.val)?{}:f.val,b[f.name].__dt_wrapper=!0,s.extend(a,b[f.name],f.propExt)}};s.register=o=function(a,b){if(h.isArray(a))for(var c=0,d=a.length;c<d;c++)s.register(a[c],b);else for(var e=a.split("."),f=Rb,g,j,c=0,d=e.length;c<d;c++){g=(j=-1!==
  103. e[c].indexOf("()"))?e[c].replace("()",""):e[c];var i;a:{i=0;for(var n=f.length;i<n;i++)if(f[i].name===g){i=f[i];break a}i=null}i||(i={name:g,val:{},methodExt:[],propExt:[]},f.push(i));c===d-1?i.val=b:f=j?i.methodExt:i.propExt}};s.registerPlural=u=function(a,b,c){s.register(a,c);s.register(b,function(){var a=c.apply(this,arguments);return a===this?this:a instanceof s?a.length?h.isArray(a[0])?new s(a.context,a[0]):a[0]:k:a})};o("tables()",function(a){var b;if(a){b=s;var c=this.context;if("number"===
  104. typeof a)a=[c[a]];else var d=h.map(c,function(a){return a.nTable}),a=h(d).filter(a).map(function(){var a=h.inArray(this,d);return c[a]}).toArray();b=new b(a)}else b=this;return b});o("table()",function(a){var a=this.tables(a),b=a.context;return b.length?new s(b[0]):a});u("tables().nodes()","table().node()",function(){return this.iterator("table",function(a){return a.nTable},1)});u("tables().body()","table().body()",function(){return this.iterator("table",function(a){return a.nTBody},1)});u("tables().header()",
  105. "table().header()",function(){return this.iterator("table",function(a){return a.nTHead},1)});u("tables().footer()","table().footer()",function(){return this.iterator("table",function(a){return a.nTFoot},1)});u("tables().containers()","table().container()",function(){return this.iterator("table",function(a){return a.nTableWrapper},1)});o("draw()",function(a){return this.iterator("table",function(b){"page"===a?N(b):("string"===typeof a&&(a="full-hold"===a?!1:!0),S(b,!1===a))})});o("page()",function(a){return a===
  106. k?this.page.info().page:this.iterator("table",function(b){Sa(b,a)})});o("page.info()",function(){if(0===this.context.length)return k;var a=this.context[0],b=a._iDisplayStart,c=a.oFeatures.bPaginate?a._iDisplayLength:-1,d=a.fnRecordsDisplay(),e=-1===c;return{page:e?0:Math.floor(b/c),pages:e?1:Math.ceil(d/c),start:b,end:a.fnDisplayEnd(),length:c,recordsTotal:a.fnRecordsTotal(),recordsDisplay:d,serverSide:"ssp"===y(a)}});o("page.len()",function(a){return a===k?0!==this.context.length?this.context[0]._iDisplayLength:
  107. k:this.iterator("table",function(b){Qa(b,a)})});var Sb=function(a,b,c){if(c){var d=new s(a);d.one("draw",function(){c(d.ajax.json())})}if("ssp"==y(a))S(a,b);else{C(a,!0);var e=a.jqXHR;e&&4!==e.readyState&&e.abort();sa(a,[],function(c){na(a);for(var c=ta(a,c),d=0,e=c.length;d<e;d++)M(a,c[d]);S(a,b);C(a,!1)})}};o("ajax.json()",function(){var a=this.context;if(0<a.length)return a[0].json});o("ajax.params()",function(){var a=this.context;if(0<a.length)return a[0].oAjaxData});o("ajax.reload()",function(a,
  108. b){return this.iterator("table",function(c){Sb(c,!1===b,a)})});o("ajax.url()",function(a){var b=this.context;if(a===k){if(0===b.length)return k;b=b[0];return b.ajax?h.isPlainObject(b.ajax)?b.ajax.url:b.ajax:b.sAjaxSource}return this.iterator("table",function(b){h.isPlainObject(b.ajax)?b.ajax.url=a:b.ajax=a})});o("ajax.url().load()",function(a,b){return this.iterator("table",function(c){Sb(c,!1===b,a)})});var Za=function(a,b,c,d,e){var f=[],g,j,i,n,l,m;i=typeof b;if(!b||"string"===i||"function"===
  109. i||b.length===k)b=[b];i=0;for(n=b.length;i<n;i++){j=b[i]&&b[i].split&&!b[i].match(/[\[\(:]/)?b[i].split(","):[b[i]];l=0;for(m=j.length;l<m;l++)(g=c("string"===typeof j[l]?h.trim(j[l]):j[l]))&&g.length&&(f=f.concat(g))}a=x.selector[a];if(a.length){i=0;for(n=a.length;i<n;i++)f=a[i](d,e,f)}return qa(f)},$a=function(a){a||(a={});a.filter&&a.search===k&&(a.search=a.filter);return h.extend({search:"none",order:"current",page:"all"},a)},ab=function(a){for(var b=0,c=a.length;b<c;b++)if(0<a[b].length)return a[0]=
  110. a[b],a[0].length=1,a.length=1,a.context=[a.context[b]],a;a.length=0;return a},Ba=function(a,b){var c,d,e,f=[],g=a.aiDisplay;c=a.aiDisplayMaster;var j=b.search;d=b.order;e=b.page;if("ssp"==y(a))return"removed"===j?[]:W(0,c.length);if("current"==e){c=a._iDisplayStart;for(d=a.fnDisplayEnd();c<d;c++)f.push(g[c])}else if("current"==d||"applied"==d)f="none"==j?c.slice():"applied"==j?g.slice():h.map(c,function(a){return-1===h.inArray(a,g)?a:null});else if("index"==d||"original"==d){c=0;for(d=a.aoData.length;c<
  111. d;c++)"none"==j?f.push(c):(e=h.inArray(c,g),(-1===e&&"removed"==j||0<=e&&"applied"==j)&&f.push(c))}return f};o("rows()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=$a(b),c=this.iterator("table",function(c){var e=b,f;return Za("row",a,function(a){var b=Nb(a);if(b!==null&&!e)return[b];f||(f=Ba(c,e));if(b!==null&&h.inArray(b,f)!==-1)return[b];if(a===null||a===k||a==="")return f;if(typeof a==="function")return h.map(f,function(b){var e=c.aoData[b];return a(b,e._aData,e.nTr)?b:null});
  112. b=Qb(ia(c.aoData,f,"nTr"));if(a.nodeName){if(a._DT_RowIndex!==k)return[a._DT_RowIndex];if(a._DT_CellIndex)return[a._DT_CellIndex.row];b=h(a).closest("*[data-dt-row]");return b.length?[b.data("dt-row")]:[]}if(typeof a==="string"&&a.charAt(0)==="#"){var i=c.aIds[a.replace(/^#/,"")];if(i!==k)return[i.idx]}return h(b).filter(a).map(function(){return this._DT_RowIndex}).toArray()},c,e)},1);c.selector.rows=a;c.selector.opts=b;return c});o("rows().nodes()",function(){return this.iterator("row",function(a,
  113. b){return a.aoData[b].nTr||k},1)});o("rows().data()",function(){return this.iterator(!0,"rows",function(a,b){return ia(a.aoData,b,"_aData")},1)});u("rows().cache()","row().cache()",function(a){return this.iterator("row",function(b,c){var d=b.aoData[c];return"search"===a?d._aFilterData:d._aSortData},1)});u("rows().invalidate()","row().invalidate()",function(a){return this.iterator("row",function(b,c){ca(b,c,a)})});u("rows().indexes()","row().index()",function(){return this.iterator("row",function(a,
  114. b){return b},1)});u("rows().ids()","row().id()",function(a){for(var b=[],c=this.context,d=0,e=c.length;d<e;d++)for(var f=0,g=this[d].length;f<g;f++){var h=c[d].rowIdFn(c[d].aoData[this[d][f]]._aData);b.push((!0===a?"#":"")+h)}return new s(c,b)});u("rows().remove()","row().remove()",function(){var a=this;this.iterator("row",function(b,c,d){var e=b.aoData,f=e[c],g,h,i,n,l;e.splice(c,1);g=0;for(h=e.length;g<h;g++)if(i=e[g],l=i.anCells,null!==i.nTr&&(i.nTr._DT_RowIndex=g),null!==l){i=0;for(n=l.length;i<
  115. n;i++)l[i]._DT_CellIndex.row=g}oa(b.aiDisplayMaster,c);oa(b.aiDisplay,c);oa(a[d],c,!1);0<b._iRecordsDisplay&&b._iRecordsDisplay--;Ra(b);c=b.rowIdFn(f._aData);c!==k&&delete b.aIds[c]});this.iterator("table",function(a){for(var c=0,d=a.aoData.length;c<d;c++)a.aoData[c].idx=c});return this});o("rows.add()",function(a){var b=this.iterator("table",function(b){var c,f,g,h=[];f=0;for(g=a.length;f<g;f++)c=a[f],c.nodeName&&"TR"===c.nodeName.toUpperCase()?h.push(ma(b,c)[0]):h.push(M(b,c));return h},1),c=this.rows(-1);
  116. c.pop();h.merge(c,b);return c});o("row()",function(a,b){return ab(this.rows(a,b))});o("row().data()",function(a){var b=this.context;if(a===k)return b.length&&this.length?b[0].aoData[this[0]]._aData:k;b[0].aoData[this[0]]._aData=a;ca(b[0],this[0],"data");return this});o("row().node()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]].nTr||null:null});o("row.add()",function(a){a instanceof h&&a.length&&(a=a[0]);var b=this.iterator("table",function(b){return a.nodeName&&
  117. "TR"===a.nodeName.toUpperCase()?ma(b,a)[0]:M(b,a)});return this.row(b[0])});var bb=function(a,b){var c=a.context;if(c.length&&(c=c[0].aoData[b!==k?b:a[0]])&&c._details)c._details.remove(),c._detailsShow=k,c._details=k},Tb=function(a,b){var c=a.context;if(c.length&&a.length){var d=c[0].aoData[a[0]];if(d._details){(d._detailsShow=b)?d._details.insertAfter(d.nTr):d._details.detach();var e=c[0],f=new s(e),g=e.aoData;f.off("draw.dt.DT_details column-visibility.dt.DT_details destroy.dt.DT_details");0<D(g,
  118. "_details").length&&(f.on("draw.dt.DT_details",function(a,b){e===b&&f.rows({page:"current"}).eq(0).each(function(a){a=g[a];a._detailsShow&&a._details.insertAfter(a.nTr)})}),f.on("column-visibility.dt.DT_details",function(a,b){if(e===b)for(var c,d=aa(b),f=0,h=g.length;f<h;f++)c=g[f],c._details&&c._details.children("td[colspan]").attr("colspan",d)}),f.on("destroy.dt.DT_details",function(a,b){if(e===b)for(var c=0,d=g.length;c<d;c++)g[c]._details&&bb(f,c)}))}}};o("row().child()",function(a,b){var c=this.context;
  119. if(a===k)return c.length&&this.length?c[0].aoData[this[0]]._details:k;if(!0===a)this.child.show();else if(!1===a)bb(this);else if(c.length&&this.length){var d=c[0],c=c[0].aoData[this[0]],e=[],f=function(a,b){if(h.isArray(a)||a instanceof h)for(var c=0,k=a.length;c<k;c++)f(a[c],b);else a.nodeName&&"tr"===a.nodeName.toLowerCase()?e.push(a):(c=h("<tr><td/></tr>").addClass(b),h("td",c).addClass(b).html(a)[0].colSpan=aa(d),e.push(c[0]))};f(a,b);c._details&&c._details.detach();c._details=h(e);c._detailsShow&&
  120. c._details.insertAfter(c.nTr)}return this});o(["row().child.show()","row().child().show()"],function(){Tb(this,!0);return this});o(["row().child.hide()","row().child().hide()"],function(){Tb(this,!1);return this});o(["row().child.remove()","row().child().remove()"],function(){bb(this);return this});o("row().child.isShown()",function(){var a=this.context;return a.length&&this.length?a[0].aoData[this[0]]._detailsShow||!1:!1});var bc=/^([^:]+):(name|visIdx|visible)$/,Ub=function(a,b,c,d,e){for(var c=
  121. [],d=0,f=e.length;d<f;d++)c.push(B(a,e[d],b));return c};o("columns()",function(a,b){a===k?a="":h.isPlainObject(a)&&(b=a,a="");var b=$a(b),c=this.iterator("table",function(c){var e=a,f=b,g=c.aoColumns,j=D(g,"sName"),i=D(g,"nTh");return Za("column",e,function(a){var b=Nb(a);if(a==="")return W(g.length);if(b!==null)return[b>=0?b:g.length+b];if(typeof a==="function"){var e=Ba(c,f);return h.map(g,function(b,f){return a(f,Ub(c,f,0,0,e),i[f])?f:null})}var k=typeof a==="string"?a.match(bc):"";if(k)switch(k[2]){case "visIdx":case "visible":b=
  122. parseInt(k[1],10);if(b<0){var m=h.map(g,function(a,b){return a.bVisible?b:null});return[m[m.length+b]]}return[Z(c,b)];case "name":return h.map(j,function(a,b){return a===k[1]?b:null});default:return[]}if(a.nodeName&&a._DT_CellIndex)return[a._DT_CellIndex.column];b=h(i).filter(a).map(function(){return h.inArray(this,i)}).toArray();if(b.length||!a.nodeName)return b;b=h(a).closest("*[data-dt-column]");return b.length?[b.data("dt-column")]:[]},c,f)},1);c.selector.cols=a;c.selector.opts=b;return c});u("columns().header()",
  123. "column().header()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTh},1)});u("columns().footer()","column().footer()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].nTf},1)});u("columns().data()","column().data()",function(){return this.iterator("column-rows",Ub,1)});u("columns().dataSrc()","column().dataSrc()",function(){return this.iterator("column",function(a,b){return a.aoColumns[b].mData},1)});u("columns().cache()","column().cache()",
  124. function(a){return this.iterator("column-rows",function(b,c,d,e,f){return ia(b.aoData,f,"search"===a?"_aFilterData":"_aSortData",c)},1)});u("columns().nodes()","column().nodes()",function(){return this.iterator("column-rows",function(a,b,c,d,e){return ia(a.aoData,e,"anCells",b)},1)});u("columns().visible()","column().visible()",function(a,b){var c=this.iterator("column",function(b,c){if(a===k)return b.aoColumns[c].bVisible;var f=b.aoColumns,g=f[c],j=b.aoData,i,n,l;if(a!==k&&g.bVisible!==a){if(a){var m=
  125. h.inArray(!0,D(f,"bVisible"),c+1);i=0;for(n=j.length;i<n;i++)l=j[i].nTr,f=j[i].anCells,l&&l.insertBefore(f[c],f[m]||null)}else h(D(b.aoData,"anCells",c)).detach();g.bVisible=a;ea(b,b.aoHeader);ea(b,b.aoFooter);xa(b)}});a!==k&&(this.iterator("column",function(c,e){r(c,null,"column-visibility",[c,e,a,b])}),(b===k||b)&&this.columns.adjust());return c});u("columns().indexes()","column().index()",function(a){return this.iterator("column",function(b,c){return"visible"===a?$(b,c):c},1)});o("columns.adjust()",
  126. function(){return this.iterator("table",function(a){Y(a)},1)});o("column.index()",function(a,b){if(0!==this.context.length){var c=this.context[0];if("fromVisible"===a||"toData"===a)return Z(c,b);if("fromData"===a||"toVisible"===a)return $(c,b)}});o("column()",function(a,b){return ab(this.columns(a,b))});o("cells()",function(a,b,c){h.isPlainObject(a)&&(a.row===k?(c=a,a=null):(c=b,b=null));h.isPlainObject(b)&&(c=b,b=null);if(null===b||b===k)return this.iterator("table",function(b){var d=a,e=$a(c),f=
  127. b.aoData,g=Ba(b,e),j=Qb(ia(f,g,"anCells")),i=h([].concat.apply([],j)),l,n=b.aoColumns.length,m,o,u,s,r,v;return Za("cell",d,function(a){var c=typeof a==="function";if(a===null||a===k||c){m=[];o=0;for(u=g.length;o<u;o++){l=g[o];for(s=0;s<n;s++){r={row:l,column:s};if(c){v=f[l];a(r,B(b,l,s),v.anCells?v.anCells[s]:null)&&m.push(r)}else m.push(r)}}return m}if(h.isPlainObject(a))return[a];c=i.filter(a).map(function(a,b){return{row:b._DT_CellIndex.row,column:b._DT_CellIndex.column}}).toArray();if(c.length||
  128. !a.nodeName)return c;v=h(a).closest("*[data-dt-row]");return v.length?[{row:v.data("dt-row"),column:v.data("dt-column")}]:[]},b,e)});var d=this.columns(b,c),e=this.rows(a,c),f,g,j,i,n,l=this.iterator("table",function(a,b){f=[];g=0;for(j=e[b].length;g<j;g++){i=0;for(n=d[b].length;i<n;i++)f.push({row:e[b][g],column:d[b][i]})}return f},1);h.extend(l.selector,{cols:b,rows:a,opts:c});return l});u("cells().nodes()","cell().node()",function(){return this.iterator("cell",function(a,b,c){return(a=a.aoData[b])&&
  129. a.anCells?a.anCells[c]:k},1)});o("cells().data()",function(){return this.iterator("cell",function(a,b,c){return B(a,b,c)},1)});u("cells().cache()","cell().cache()",function(a){a="search"===a?"_aFilterData":"_aSortData";return this.iterator("cell",function(b,c,d){return b.aoData[c][a][d]},1)});u("cells().render()","cell().render()",function(a){return this.iterator("cell",function(b,c,d){return B(b,c,d,a)},1)});u("cells().indexes()","cell().index()",function(){return this.iterator("cell",function(a,
  130. b,c){return{row:b,column:c,columnVisible:$(a,c)}},1)});u("cells().invalidate()","cell().invalidate()",function(a){return this.iterator("cell",function(b,c,d){ca(b,c,a,d)})});o("cell()",function(a,b,c){return ab(this.cells(a,b,c))});o("cell().data()",function(a){var b=this.context,c=this[0];if(a===k)return b.length&&c.length?B(b[0],c[0].row,c[0].column):k;ib(b[0],c[0].row,c[0].column,a);ca(b[0],c[0].row,"data",c[0].column);return this});o("order()",function(a,b){var c=this.context;if(a===k)return 0!==
  131. c.length?c[0].aaSorting:k;"number"===typeof a?a=[[a,b]]:a.length&&!h.isArray(a[0])&&(a=Array.prototype.slice.call(arguments));return this.iterator("table",function(b){b.aaSorting=a.slice()})});o("order.listener()",function(a,b,c){return this.iterator("table",function(d){La(d,a,b,c)})});o("order.fixed()",function(a){if(!a){var b=this.context,b=b.length?b[0].aaSortingFixed:k;return h.isArray(b)?{pre:b}:b}return this.iterator("table",function(b){b.aaSortingFixed=h.extend(!0,{},a)})});o(["columns().order()",
  132. "column().order()"],function(a){var b=this;return this.iterator("table",function(c,d){var e=[];h.each(b[d],function(b,c){e.push([c,a])});c.aaSorting=e})});o("search()",function(a,b,c,d){var e=this.context;return a===k?0!==e.length?e[0].oPreviousSearch.sSearch:k:this.iterator("table",function(e){e.oFeatures.bFilter&&fa(e,h.extend({},e.oPreviousSearch,{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),1)})});u("columns().search()","column().search()",function(a,
  133. b,c,d){return this.iterator("column",function(e,f){var g=e.aoPreSearchCols;if(a===k)return g[f].sSearch;e.oFeatures.bFilter&&(h.extend(g[f],{sSearch:a+"",bRegex:null===b?!1:b,bSmart:null===c?!0:c,bCaseInsensitive:null===d?!0:d}),fa(e,e.oPreviousSearch,1))})});o("state()",function(){return this.context.length?this.context[0].oSavedState:null});o("state.clear()",function(){return this.iterator("table",function(a){a.fnStateSaveCallback.call(a.oInstance,a,{})})});o("state.loaded()",function(){return this.context.length?
  134. this.context[0].oLoadedState:null});o("state.save()",function(){return this.iterator("table",function(a){xa(a)})});m.versionCheck=m.fnVersionCheck=function(a){for(var b=m.version.split("."),a=a.split("."),c,d,e=0,f=a.length;e<f;e++)if(c=parseInt(b[e],10)||0,d=parseInt(a[e],10)||0,c!==d)return c>d;return!0};m.isDataTable=m.fnIsDataTable=function(a){var b=h(a).get(0),c=!1;if(a instanceof m.Api)return!0;h.each(m.settings,function(a,e){var f=e.nScrollHead?h("table",e.nScrollHead)[0]:null,g=e.nScrollFoot?
  135. h("table",e.nScrollFoot)[0]:null;if(e.nTable===b||f===b||g===b)c=!0});return c};m.tables=m.fnTables=function(a){var b=!1;h.isPlainObject(a)&&(b=a.api,a=a.visible);var c=h.map(m.settings,function(b){if(!a||a&&h(b.nTable).is(":visible"))return b.nTable});return b?new s(c):c};m.camelToHungarian=I;o("$()",function(a,b){var c=this.rows(b).nodes(),c=h(c);return h([].concat(c.filter(a).toArray(),c.find(a).toArray()))});h.each(["on","one","off"],function(a,b){o(b+"()",function(){var a=Array.prototype.slice.call(arguments);
  136. a[0]=h.map(a[0].split(/\s/),function(a){return!a.match(/\.dt\b/)?a+".dt":a}).join(" ");var d=h(this.tables().nodes());d[b].apply(d,a);return this})});o("clear()",function(){return this.iterator("table",function(a){na(a)})});o("settings()",function(){return new s(this.context,this.context)});o("init()",function(){var a=this.context;return a.length?a[0].oInit:null});o("data()",function(){return this.iterator("table",function(a){return D(a.aoData,"_aData")}).flatten()});o("destroy()",function(a){a=a||
  137. !1;return this.iterator("table",function(b){var c=b.nTableWrapper.parentNode,d=b.oClasses,e=b.nTable,f=b.nTBody,g=b.nTHead,j=b.nTFoot,i=h(e),f=h(f),k=h(b.nTableWrapper),l=h.map(b.aoData,function(a){return a.nTr}),o;b.bDestroying=!0;r(b,"aoDestroyCallback","destroy",[b]);a||(new s(b)).columns().visible(!0);k.off(".DT").find(":not(tbody *)").off(".DT");h(E).off(".DT-"+b.sInstance);e!=g.parentNode&&(i.children("thead").detach(),i.append(g));j&&e!=j.parentNode&&(i.children("tfoot").detach(),i.append(j));
  138. b.aaSorting=[];b.aaSortingFixed=[];wa(b);h(l).removeClass(b.asStripeClasses.join(" "));h("th, td",g).removeClass(d.sSortable+" "+d.sSortableAsc+" "+d.sSortableDesc+" "+d.sSortableNone);f.children().detach();f.append(l);g=a?"remove":"detach";i[g]();k[g]();!a&&c&&(c.insertBefore(e,b.nTableReinsertBefore),i.css("width",b.sDestroyWidth).removeClass(d.sTable),(o=b.asDestroyStripes.length)&&f.children().each(function(a){h(this).addClass(b.asDestroyStripes[a%o])}));c=h.inArray(b,m.settings);-1!==c&&m.settings.splice(c,
  139. 1)})});h.each(["column","row","cell"],function(a,b){o(b+"s().every()",function(a){var d=this.selector.opts,e=this;return this.iterator(b,function(f,g,h,i,n){a.call(e[b](g,"cell"===b?h:d,"cell"===b?d:k),g,h,i,n)})})});o("i18n()",function(a,b,c){var d=this.context[0],a=Q(a)(d.oLanguage);a===k&&(a=b);c!==k&&h.isPlainObject(a)&&(a=a[c]!==k?a[c]:a._);return a.replace("%d",c)});m.version="1.10.16";m.settings=[];m.models={};m.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0};m.models.oRow=
  140. {nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1};m.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,
  141. sWidthOrig:null};m.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(a){return a.toString().replace(/\B(?=(\d{3})+(?!\d))/g,
  142. this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(a){try{return JSON.parse((-1===a.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+a.sInstance+"_"+location.pathname))}catch(b){}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(a,b){try{(-1===a.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+a.sInstance+
  143. "_"+location.pathname,JSON.stringify(b))}catch(c){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",
  144. sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"Processing...",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:h.extend({},m.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null,rowId:"DT_RowId"};
  145. X(m.defaults);m.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null};X(m.defaults.column);m.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,
  146. bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],
  147. aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,bAjaxDataGet:!0,jqXHR:null,json:k,oAjaxData:k,fnServerData:null,
  148. aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==y(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==y(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var a=this._iDisplayLength,
  149. b=this._iDisplayStart,c=b+a,d=this.aiDisplay.length,e=this.oFeatures,f=e.bPaginate;return e.bServerSide?!1===f||-1===a?b+d:Math.min(b+a,this._iRecordsDisplay):!f||c>d||-1===a?d:c},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null};m.ext=x={buttons:{},classes:{},builder:"-source-",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},
  150. order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:m.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:m.version};h.extend(x,{afnFiltering:x.search,aTypes:x.type.detect,ofnSearch:x.type.search,oSort:x.type.order,afnSortData:x.order,aoFeatures:x.feature,oApi:x.internal,oStdClasses:x.classes,oPagination:x.pager});h.extend(m.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",
  151. sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",
  152. sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});var Kb=m.ext.pager;h.extend(Kb,{simple:function(){return["previous","next"]},full:function(){return["first","previous","next","last"]},numbers:function(a,b){return[ha(a,
  153. b)]},simple_numbers:function(a,b){return["previous",ha(a,b),"next"]},full_numbers:function(a,b){return["first","previous",ha(a,b),"next","last"]},first_last_numbers:function(a,b){return["first",ha(a,b),"last"]},_numbers:ha,numbers_length:7});h.extend(!0,m.ext.renderer,{pageButton:{_:function(a,b,c,d,e,f){var g=a.oClasses,j=a.oLanguage.oPaginate,i=a.oLanguage.oAria.paginate||{},n,l,m=0,o=function(b,d){var k,s,u,r,v=function(b){Sa(a,b.data.action,true)};k=0;for(s=d.length;k<s;k++){r=d[k];if(h.isArray(r)){u=
  154. h("<"+(r.DT_el||"div")+"/>").appendTo(b);o(u,r)}else{n=null;l="";switch(r){case "ellipsis":b.append('<span class="ellipsis">&#x2026;</span>');break;case "first":n=j.sFirst;l=r+(e>0?"":" "+g.sPageButtonDisabled);break;case "previous":n=j.sPrevious;l=r+(e>0?"":" "+g.sPageButtonDisabled);break;case "next":n=j.sNext;l=r+(e<f-1?"":" "+g.sPageButtonDisabled);break;case "last":n=j.sLast;l=r+(e<f-1?"":" "+g.sPageButtonDisabled);break;default:n=r+1;l=e===r?g.sPageButtonActive:""}if(n!==null){u=h("<a>",{"class":g.sPageButton+
  155. " "+l,"aria-controls":a.sTableId,"aria-label":i[r],"data-dt-idx":m,tabindex:a.iTabIndex,id:c===0&&typeof r==="string"?a.sTableId+"_"+r:null}).html(n).appendTo(b);Va(u,{action:r},v);m++}}}},s;try{s=h(b).find(G.activeElement).data("dt-idx")}catch(u){}o(h(b).empty(),d);s!==k&&h(b).find("[data-dt-idx="+s+"]").focus()}}});h.extend(m.ext.type.detect,[function(a,b){var c=b.oLanguage.sDecimal;return Ya(a,c)?"num"+c:null},function(a){if(a&&!(a instanceof Date)&&!Zb.test(a))return null;var b=Date.parse(a);
  156. return null!==b&&!isNaN(b)||L(a)?"date":null},function(a,b){var c=b.oLanguage.sDecimal;return Ya(a,c,!0)?"num-fmt"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Pb(a,c)?"html-num"+c:null},function(a,b){var c=b.oLanguage.sDecimal;return Pb(a,c,!0)?"html-num-fmt"+c:null},function(a){return L(a)||"string"===typeof a&&-1!==a.indexOf("<")?"html":null}]);h.extend(m.ext.type.search,{html:function(a){return L(a)?a:"string"===typeof a?a.replace(Mb," ").replace(Aa,""):""},string:function(a){return L(a)?
  157. a:"string"===typeof a?a.replace(Mb," "):a}});var za=function(a,b,c,d){if(0!==a&&(!a||"-"===a))return-Infinity;b&&(a=Ob(a,b));a.replace&&(c&&(a=a.replace(c,"")),d&&(a=a.replace(d,"")));return 1*a};h.extend(x.type.order,{"date-pre":function(a){return Date.parse(a)||-Infinity},"html-pre":function(a){return L(a)?"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return L(a)?"":"string"===typeof a?a.toLowerCase():!a.toString?"":a.toString()},"string-asc":function(a,b){return a<
  158. b?-1:a>b?1:0},"string-desc":function(a,b){return a<b?1:a>b?-1:0}});cb("");h.extend(!0,m.ext.renderer,{header:{_:function(a,b,c,d){h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(c.sSortingClass+" "+d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass)}})},jqueryui:function(a,b,c,d){h("<div/>").addClass(d.sSortJUIWrapper).append(b.contents()).append(h("<span/>").addClass(d.sSortIcon+" "+c.sSortingClassJUI)).appendTo(b);
  159. h(a.nTable).on("order.dt.DT",function(e,f,g,h){if(a===f){e=c.idx;b.removeClass(d.sSortAsc+" "+d.sSortDesc).addClass(h[e]=="asc"?d.sSortAsc:h[e]=="desc"?d.sSortDesc:c.sSortingClass);b.find("span."+d.sSortIcon).removeClass(d.sSortJUIAsc+" "+d.sSortJUIDesc+" "+d.sSortJUI+" "+d.sSortJUIAscAllowed+" "+d.sSortJUIDescAllowed).addClass(h[e]=="asc"?d.sSortJUIAsc:h[e]=="desc"?d.sSortJUIDesc:c.sSortingClassJUI)}})}}});var Vb=function(a){return"string"===typeof a?a.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,
  160. "&quot;"):a};m.render={number:function(a,b,c,d,e){return{display:function(f){if("number"!==typeof f&&"string"!==typeof f)return f;var g=0>f?"-":"",h=parseFloat(f);if(isNaN(h))return Vb(f);h=h.toFixed(c);f=Math.abs(h);h=parseInt(f,10);f=c?b+(f-h).toFixed(c).substring(2):"";return g+(d||"")+h.toString().replace(/\B(?=(\d{3})+(?!\d))/g,a)+f+(e||"")}}},text:function(){return{display:Vb}}};h.extend(m.ext.internal,{_fnExternApiFunc:Lb,_fnBuildAjax:sa,_fnAjaxUpdate:kb,_fnAjaxParameters:tb,_fnAjaxUpdateDraw:ub,
  161. _fnAjaxDataSrc:ta,_fnAddColumn:Da,_fnColumnOptions:ja,_fnAdjustColumnSizing:Y,_fnVisibleToColumnIndex:Z,_fnColumnIndexToVisible:$,_fnVisbleColumns:aa,_fnGetColumns:la,_fnColumnTypes:Fa,_fnApplyColumnDefs:hb,_fnHungarianMap:X,_fnCamelToHungarian:I,_fnLanguageCompat:Ca,_fnBrowserDetect:fb,_fnAddData:M,_fnAddTr:ma,_fnNodeToDataIndex:function(a,b){return b._DT_RowIndex!==k?b._DT_RowIndex:null},_fnNodeToColumnIndex:function(a,b,c){return h.inArray(c,a.aoData[b].anCells)},_fnGetCellData:B,_fnSetCellData:ib,
  162. _fnSplitObjNotation:Ia,_fnGetObjectDataFn:Q,_fnSetObjectDataFn:R,_fnGetDataMaster:Ja,_fnClearTable:na,_fnDeleteIndex:oa,_fnInvalidate:ca,_fnGetRowElements:Ha,_fnCreateTr:Ga,_fnBuildHead:jb,_fnDrawHead:ea,_fnDraw:N,_fnReDraw:S,_fnAddOptionsHtml:mb,_fnDetectHeader:da,_fnGetUniqueThs:ra,_fnFeatureHtmlFilter:ob,_fnFilterComplete:fa,_fnFilterCustom:xb,_fnFilterColumn:wb,_fnFilter:vb,_fnFilterCreateSearch:Oa,_fnEscapeRegex:Pa,_fnFilterData:yb,_fnFeatureHtmlInfo:rb,_fnUpdateInfo:Bb,_fnInfoMacros:Cb,_fnInitialise:ga,
  163. _fnInitComplete:ua,_fnLengthChange:Qa,_fnFeatureHtmlLength:nb,_fnFeatureHtmlPaginate:sb,_fnPageChange:Sa,_fnFeatureHtmlProcessing:pb,_fnProcessingDisplay:C,_fnFeatureHtmlTable:qb,_fnScrollDraw:ka,_fnApplyToChildren:H,_fnCalculateColumnWidths:Ea,_fnThrottle:Na,_fnConvertToWidth:Db,_fnGetWidestNode:Eb,_fnGetMaxLenString:Fb,_fnStringToCss:v,_fnSortFlatten:V,_fnSort:lb,_fnSortAria:Hb,_fnSortListener:Ua,_fnSortAttachListener:La,_fnSortingClasses:wa,_fnSortData:Gb,_fnSaveState:xa,_fnLoadState:Ib,_fnSettingsFromNode:ya,
  164. _fnLog:J,_fnMap:F,_fnBindAction:Va,_fnCallbackReg:z,_fnCallbackFire:r,_fnLengthOverflow:Ra,_fnRenderer:Ma,_fnDataSource:y,_fnRowAttributes:Ka,_fnCalculateEnd:function(){}});h.fn.dataTable=m;m.$=h;h.fn.dataTableSettings=m.settings;h.fn.dataTableExt=m.ext;h.fn.DataTable=function(a){return h(this).dataTable(a).api()};h.each(m,function(a,b){h.fn.DataTable[a]=b});return h.fn.dataTable});
  165. /*!
  166. DataTables Bootstrap 3 integration
  167. ©2011-2014 SpryMedia Ltd - datatables.net/license
  168. */
  169. (function(l,q){var e=function(b,c){b.extend(!0,c.defaults,{dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-5'i><'col-sm-7'p>>",renderer:"bootstrap"});b.extend(c.ext.classes,{sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",sLengthSelect:"form-control input-sm"});c.ext.renderer.pageButton.bootstrap=function(g,e,r,s,i,m){var t=new c.Api(g),u=g.oClasses,j=g.oLanguage.oPaginate,d,f,n=0,p=function(c,e){var k,h,o,a,l=function(a){a.preventDefault();
  170. b(a.currentTarget).hasClass("disabled")||t.page(a.data.action).draw(!1)};k=0;for(h=e.length;k<h;k++)if(a=e[k],b.isArray(a))p(c,a);else{f=d="";switch(a){case "ellipsis":d="&hellip;";f="disabled";break;case "first":d=j.sFirst;f=a+(0<i?"":" disabled");break;case "previous":d=j.sPrevious;f=a+(0<i?"":" disabled");break;case "next":d=j.sNext;f=a+(i<m-1?"":" disabled");break;case "last":d=j.sLast;f=a+(i<m-1?"":" disabled");break;default:d=a+1,f=i===a?"active":""}d&&(o=b("<li>",{"class":u.sPageButton+" "+
  171. f,id:0===r&&"string"===typeof a?g.sTableId+"_"+a:null}).append(b("<a>",{href:"#","aria-controls":g.sTableId,"data-dt-idx":n,tabindex:g.iTabIndex}).html(d)).appendTo(c),g.oApi._fnBindAction(o,{action:a},l),n++)}},h;try{h=b(q.activeElement).data("dt-idx")}catch(l){}p(b(e).empty().html('<ul class="pagination"/>').children("ul"),s);h&&b(e).find("[data-dt-idx="+h+"]").focus()};c.TableTools&&(b.extend(!0,c.TableTools.classes,{container:"DTTT btn-group",buttons:{normal:"btn btn-default",disabled:"disabled"},
  172. collection:{container:"DTTT_dropdown dropdown-menu",buttons:{normal:"",disabled:"disabled"}},print:{info:"DTTT_print_info"},select:{row:"active"}}),b.extend(!0,c.TableTools.DEFAULTS.oTags,{collection:{container:"ul",button:"li",liner:"a"}}))};"function"===typeof define&&define.amd?define(["jquery","datatables"],e):"object"===typeof exports?e(require("jquery"),require("datatables")):jQuery&&e(jQuery,jQuery.fn.dataTable)})(window,document);
  173. /*! TableTools 2.2.4
  174. * 2009-2015 SpryMedia Ltd - datatables.net/license
  175. *
  176. * ZeroClipboard 1.0.4
  177. * Author: Joseph Huckaby - MIT licensed
  178. */
  179. /**
  180. * @summary TableTools
  181. * @description Tools and buttons for DataTables
  182. * @version 2.2.4
  183. * @file dataTables.tableTools.js
  184. * @author SpryMedia Ltd (www.sprymedia.co.uk)
  185. * @contact www.sprymedia.co.uk/contact
  186. * @copyright Copyright 2009-2015 SpryMedia Ltd.
  187. *
  188. * This source file is free software, available under the following license:
  189. * MIT license - http://datatables.net/license/mit
  190. *
  191. * This source file is distributed in the hope that it will be useful, but
  192. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  193. * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
  194. *
  195. * For details please refer to: http://www.datatables.net
  196. */
  197. /* Global scope for TableTools for backwards compatibility.
  198. * Will be removed in 2.3
  199. */
  200. var TableTools;
  201. (function(window, document, undefined) {
  202. var factory = function( $, DataTable ) {
  203. "use strict";
  204. //include ZeroClipboard.js
  205. /* ZeroClipboard 1.0.4
  206. * Author: Joseph Huckaby
  207. */
  208. var ZeroClipboard_TableTools = {
  209. version: "1.0.4-TableTools2",
  210. clients: {}, // registered upload clients on page, indexed by id
  211. moviePath: '', // URL to movie
  212. nextId: 1, // ID of next movie
  213. $: function(thingy) {
  214. // simple DOM lookup utility function
  215. if (typeof(thingy) == 'string') {
  216. thingy = document.getElementById(thingy);
  217. }
  218. if (!thingy.addClass) {
  219. // extend element with a few useful methods
  220. thingy.hide = function() { this.style.display = 'none'; };
  221. thingy.show = function() { this.style.display = ''; };
  222. thingy.addClass = function(name) { this.removeClass(name); this.className += ' ' + name; };
  223. thingy.removeClass = function(name) {
  224. this.className = this.className.replace( new RegExp("\\s*" + name + "\\s*"), " ").replace(/^\s+/, '').replace(/\s+$/, '');
  225. };
  226. thingy.hasClass = function(name) {
  227. return !!this.className.match( new RegExp("\\s*" + name + "\\s*") );
  228. };
  229. }
  230. return thingy;
  231. },
  232. setMoviePath: function(path) {
  233. // set path to ZeroClipboard.swf
  234. this.moviePath = path;
  235. },
  236. dispatch: function(id, eventName, args) {
  237. // receive event from flash movie, send to client
  238. var client = this.clients[id];
  239. if (client) {
  240. client.receiveEvent(eventName, args);
  241. }
  242. },
  243. register: function(id, client) {
  244. // register new client to receive events
  245. this.clients[id] = client;
  246. },
  247. getDOMObjectPosition: function(obj) {
  248. // get absolute coordinates for dom element
  249. var info = {
  250. left: 0,
  251. top: 0,
  252. width: obj.width ? obj.width : obj.offsetWidth,
  253. height: obj.height ? obj.height : obj.offsetHeight
  254. };
  255. if ( obj.style.width !== "" ) {
  256. info.width = obj.style.width.replace("px","");
  257. }
  258. if ( obj.style.height !== "" ) {
  259. info.height = obj.style.height.replace("px","");
  260. }
  261. while (obj) {
  262. info.left += obj.offsetLeft;
  263. info.top += obj.offsetTop;
  264. obj = obj.offsetParent;
  265. }
  266. return info;
  267. },
  268. Client: function(elem) {
  269. // constructor for new simple upload client
  270. this.handlers = {};
  271. // unique ID
  272. this.id = ZeroClipboard_TableTools.nextId++;
  273. this.movieId = 'ZeroClipboard_TableToolsMovie_' + this.id;
  274. // register client with singleton to receive flash events
  275. ZeroClipboard_TableTools.register(this.id, this);
  276. // create movie
  277. if (elem) {
  278. this.glue(elem);
  279. }
  280. }
  281. };
  282. ZeroClipboard_TableTools.Client.prototype = {
  283. id: 0, // unique ID for us
  284. ready: false, // whether movie is ready to receive events or not
  285. movie: null, // reference to movie object
  286. clipText: '', // text to copy to clipboard
  287. fileName: '', // default file save name
  288. action: 'copy', // action to perform
  289. handCursorEnabled: true, // whether to show hand cursor, or default pointer cursor
  290. cssEffects: true, // enable CSS mouse effects on dom container
  291. handlers: null, // user event handlers
  292. sized: false,
  293. glue: function(elem, title) {
  294. // glue to DOM element
  295. // elem can be ID or actual DOM element object
  296. this.domElement = ZeroClipboard_TableTools.$(elem);
  297. // float just above object, or zIndex 99 if dom element isn't set
  298. var zIndex = 99;
  299. if (this.domElement.style.zIndex) {
  300. zIndex = parseInt(this.domElement.style.zIndex, 10) + 1;
  301. }
  302. // find X/Y position of domElement
  303. var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
  304. // create floating DIV above element
  305. this.div = document.createElement('div');
  306. var style = this.div.style;
  307. style.position = 'absolute';
  308. style.left = '0px';
  309. style.top = '0px';
  310. style.width = (box.width) + 'px';
  311. style.height = box.height + 'px';
  312. style.zIndex = zIndex;
  313. if ( typeof title != "undefined" && title !== "" ) {
  314. this.div.title = title;
  315. }
  316. if ( box.width !== 0 && box.height !== 0 ) {
  317. this.sized = true;
  318. }
  319. // style.backgroundColor = '#f00'; // debug
  320. if ( this.domElement ) {
  321. this.domElement.appendChild(this.div);
  322. this.div.innerHTML = this.getHTML( box.width, box.height ).replace(/&/g, '&amp;');
  323. }
  324. },
  325. positionElement: function() {
  326. var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
  327. var style = this.div.style;
  328. style.position = 'absolute';
  329. //style.left = (this.domElement.offsetLeft)+'px';
  330. //style.top = this.domElement.offsetTop+'px';
  331. style.width = box.width + 'px';
  332. style.height = box.height + 'px';
  333. if ( box.width !== 0 && box.height !== 0 ) {
  334. this.sized = true;
  335. } else {
  336. return;
  337. }
  338. var flash = this.div.childNodes[0];
  339. flash.width = box.width;
  340. flash.height = box.height;
  341. },
  342. getHTML: function(width, height) {
  343. // return HTML for movie
  344. var html = '';
  345. var flashvars = 'id=' + this.id +
  346. '&width=' + width +
  347. '&height=' + height;
  348. if (navigator.userAgent.match(/MSIE/)) {
  349. // IE gets an OBJECT tag
  350. var protocol = location.href.match(/^https/i) ? 'https://' : 'http://';
  351. html += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+protocol+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="'+width+'" height="'+height+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard_TableTools.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+flashvars+'"/><param name="wmode" value="transparent"/></object>';
  352. }
  353. else {
  354. // all other browsers get an EMBED tag
  355. html += '<embed id="'+this.movieId+'" src="'+ZeroClipboard_TableTools.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+width+'" height="'+height+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+flashvars+'" wmode="transparent" />';
  356. }
  357. return html;
  358. },
  359. hide: function() {
  360. // temporarily hide floater offscreen
  361. if (this.div) {
  362. this.div.style.left = '-2000px';
  363. }
  364. },
  365. show: function() {
  366. // show ourselves after a call to hide()
  367. this.reposition();
  368. },
  369. destroy: function() {
  370. // destroy control and floater
  371. if (this.domElement && this.div) {
  372. this.hide();
  373. this.div.innerHTML = '';
  374. var body = document.getElementsByTagName('body')[0];
  375. try { body.removeChild( this.div ); } catch(e) {}
  376. this.domElement = null;
  377. this.div = null;
  378. }
  379. },
  380. reposition: function(elem) {
  381. // reposition our floating div, optionally to new container
  382. // warning: container CANNOT change size, only position
  383. if (elem) {
  384. this.domElement = ZeroClipboard_TableTools.$(elem);
  385. if (!this.domElement) {
  386. this.hide();
  387. }
  388. }
  389. if (this.domElement && this.div) {
  390. var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement);
  391. var style = this.div.style;
  392. style.left = '' + box.left + 'px';
  393. style.top = '' + box.top + 'px';
  394. }
  395. },
  396. clearText: function() {
  397. // clear the text to be copy / saved
  398. this.clipText = '';
  399. if (this.ready) {
  400. this.movie.clearText();
  401. }
  402. },
  403. appendText: function(newText) {
  404. // append text to that which is to be copied / saved
  405. this.clipText += newText;
  406. if (this.ready) { this.movie.appendText(newText) ;}
  407. },
  408. setText: function(newText) {
  409. // set text to be copied to be copied / saved
  410. this.clipText = newText;
  411. if (this.ready) { this.movie.setText(newText) ;}
  412. },
  413. setCharSet: function(charSet) {
  414. // set the character set (UTF16LE or UTF8)
  415. this.charSet = charSet;
  416. if (this.ready) { this.movie.setCharSet(charSet) ;}
  417. },
  418. setBomInc: function(bomInc) {
  419. // set if the BOM should be included or not
  420. this.incBom = bomInc;
  421. if (this.ready) { this.movie.setBomInc(bomInc) ;}
  422. },
  423. setFileName: function(newText) {
  424. // set the file name
  425. this.fileName = newText;
  426. if (this.ready) {
  427. this.movie.setFileName(newText);
  428. }
  429. },
  430. setAction: function(newText) {
  431. // set action (save or copy)
  432. this.action = newText;
  433. if (this.ready) {
  434. this.movie.setAction(newText);
  435. }
  436. },
  437. addEventListener: function(eventName, func) {
  438. // add user event listener for event
  439. // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel
  440. eventName = eventName.toString().toLowerCase().replace(/^on/, '');
  441. if (!this.handlers[eventName]) {
  442. this.handlers[eventName] = [];
  443. }
  444. this.handlers[eventName].push(func);
  445. },
  446. setHandCursor: function(enabled) {
  447. // enable hand cursor (true), or default arrow cursor (false)
  448. this.handCursorEnabled = enabled;
  449. if (this.ready) {
  450. this.movie.setHandCursor(enabled);
  451. }
  452. },
  453. setCSSEffects: function(enabled) {
  454. // enable or disable CSS effects on DOM container
  455. this.cssEffects = !!enabled;
  456. },
  457. receiveEvent: function(eventName, args) {
  458. var self;
  459. // receive event from flash
  460. eventName = eventName.toString().toLowerCase().replace(/^on/, '');
  461. // special behavior for certain events
  462. switch (eventName) {
  463. case 'load':
  464. // movie claims it is ready, but in IE this isn't always the case...
  465. // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function
  466. this.movie = document.getElementById(this.movieId);
  467. if (!this.movie) {
  468. self = this;
  469. setTimeout( function() { self.receiveEvent('load', null); }, 1 );
  470. return;
  471. }
  472. // firefox on pc needs a "kick" in order to set these in certain cases
  473. if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) {
  474. self = this;
  475. setTimeout( function() { self.receiveEvent('load', null); }, 100 );
  476. this.ready = true;
  477. return;
  478. }
  479. this.ready = true;
  480. this.movie.clearText();
  481. this.movie.appendText( this.clipText );
  482. this.movie.setFileName( this.fileName );
  483. this.movie.setAction( this.action );
  484. this.movie.setCharSet( this.charSet );
  485. this.movie.setBomInc( this.incBom );
  486. this.movie.setHandCursor( this.handCursorEnabled );
  487. break;
  488. case 'mouseover':
  489. if (this.domElement && this.cssEffects) {
  490. //this.domElement.addClass('hover');
  491. if (this.recoverActive) {
  492. this.domElement.addClass('active');
  493. }
  494. }
  495. break;
  496. case 'mouseout':
  497. if (this.domElement && this.cssEffects) {
  498. this.recoverActive = false;
  499. if (this.domElement.hasClass('active')) {
  500. this.domElement.removeClass('active');
  501. this.recoverActive = true;
  502. }
  503. //this.domElement.removeClass('hover');
  504. }
  505. break;
  506. case 'mousedown':
  507. if (this.domElement && this.cssEffects) {
  508. this.domElement.addClass('active');
  509. }
  510. break;
  511. case 'mouseup':
  512. if (this.domElement && this.cssEffects) {
  513. this.domElement.removeClass('active');
  514. this.recoverActive = false;
  515. }
  516. break;
  517. } // switch eventName
  518. if (this.handlers[eventName]) {
  519. for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) {
  520. var func = this.handlers[eventName][idx];
  521. if (typeof(func) == 'function') {
  522. // actual function reference
  523. func(this, args);
  524. }
  525. else if ((typeof(func) == 'object') && (func.length == 2)) {
  526. // PHP style object + method, i.e. [myObject, 'myMethod']
  527. func[0][ func[1] ](this, args);
  528. }
  529. else if (typeof(func) == 'string') {
  530. // name of function
  531. window[func](this, args);
  532. }
  533. } // foreach event handler defined
  534. } // user defined handler for event
  535. }
  536. };
  537. // For the Flash binding to work, ZeroClipboard_TableTools must be on the global
  538. // object list
  539. window.ZeroClipboard_TableTools = ZeroClipboard_TableTools;
  540. //include TableTools.js
  541. /* TableTools
  542. * 2009-2015 SpryMedia Ltd - datatables.net/license
  543. */
  544. /*globals TableTools,ZeroClipboard_TableTools*/
  545. (function($, window, document) {
  546. /**
  547. * TableTools provides flexible buttons and other tools for a DataTables enhanced table
  548. * @class TableTools
  549. * @constructor
  550. * @param {Object} oDT DataTables instance. When using DataTables 1.10 this can
  551. * also be a jQuery collection, jQuery selector, table node, DataTables API
  552. * instance or DataTables settings object.
  553. * @param {Object} oOpts TableTools options
  554. * @param {String} oOpts.sSwfPath ZeroClipboard SWF path
  555. * @param {String} oOpts.sRowSelect Row selection options - 'none', 'single', 'multi' or 'os'
  556. * @param {Function} oOpts.fnPreRowSelect Callback function just prior to row selection
  557. * @param {Function} oOpts.fnRowSelected Callback function just after row selection
  558. * @param {Function} oOpts.fnRowDeselected Callback function when row is deselected
  559. * @param {Array} oOpts.aButtons List of buttons to be used
  560. */
  561. TableTools = function( oDT, oOpts )
  562. {
  563. /* Santiy check that we are a new instance */
  564. if ( ! this instanceof TableTools )
  565. {
  566. alert( "Warning: TableTools must be initialised with the keyword 'new'" );
  567. }
  568. // In 1.10 we can use the API to get the settings object from a number of
  569. // sources
  570. var dtSettings = $.fn.dataTable.Api ?
  571. new $.fn.dataTable.Api( oDT ).settings()[0] :
  572. oDT.fnSettings();
  573. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  574. * Public class variables
  575. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  576. /**
  577. * @namespace Settings object which contains customisable information for TableTools instance
  578. */
  579. this.s = {
  580. /**
  581. * Store 'this' so the instance can be retrieved from the settings object
  582. * @property that
  583. * @type object
  584. * @default this
  585. */
  586. "that": this,
  587. /**
  588. * DataTables settings objects
  589. * @property dt
  590. * @type object
  591. * @default <i>From the oDT init option</i>
  592. */
  593. "dt": dtSettings,
  594. /**
  595. * @namespace Print specific information
  596. */
  597. "print": {
  598. /**
  599. * DataTables draw 'start' point before the printing display was shown
  600. * @property saveStart
  601. * @type int
  602. * @default -1
  603. */
  604. "saveStart": -1,
  605. /**
  606. * DataTables draw 'length' point before the printing display was shown
  607. * @property saveLength
  608. * @type int
  609. * @default -1
  610. */
  611. "saveLength": -1,
  612. /**
  613. * Page scrolling point before the printing display was shown so it can be restored
  614. * @property saveScroll
  615. * @type int
  616. * @default -1
  617. */
  618. "saveScroll": -1,
  619. /**
  620. * Wrapped function to end the print display (to maintain scope)
  621. * @property funcEnd
  622. * @type Function
  623. * @default function () {}
  624. */
  625. "funcEnd": function () {}
  626. },
  627. /**
  628. * A unique ID is assigned to each button in each instance
  629. * @property buttonCounter
  630. * @type int
  631. * @default 0
  632. */
  633. "buttonCounter": 0,
  634. /**
  635. * @namespace Select rows specific information
  636. */
  637. "select": {
  638. /**
  639. * Select type - can be 'none', 'single' or 'multi'
  640. * @property type
  641. * @type string
  642. * @default ""
  643. */
  644. "type": "",
  645. /**
  646. * Array of nodes which are currently selected
  647. * @property selected
  648. * @type array
  649. * @default []
  650. */
  651. "selected": [],
  652. /**
  653. * Function to run before the selection can take place. Will cancel the select if the
  654. * function returns false
  655. * @property preRowSelect
  656. * @type Function
  657. * @default null
  658. */
  659. "preRowSelect": null,
  660. /**
  661. * Function to run when a row is selected
  662. * @property postSelected
  663. * @type Function
  664. * @default null
  665. */
  666. "postSelected": null,
  667. /**
  668. * Function to run when a row is deselected
  669. * @property postDeselected
  670. * @type Function
  671. * @default null
  672. */
  673. "postDeselected": null,
  674. /**
  675. * Indicate if all rows are selected (needed for server-side processing)
  676. * @property all
  677. * @type boolean
  678. * @default false
  679. */
  680. "all": false,
  681. /**
  682. * Class name to add to selected TR nodes
  683. * @property selectedClass
  684. * @type String
  685. * @default ""
  686. */
  687. "selectedClass": ""
  688. },
  689. /**
  690. * Store of the user input customisation object
  691. * @property custom
  692. * @type object
  693. * @default {}
  694. */
  695. "custom": {},
  696. /**
  697. * SWF movie path
  698. * @property swfPath
  699. * @type string
  700. * @default ""
  701. */
  702. "swfPath": "",
  703. /**
  704. * Default button set
  705. * @property buttonSet
  706. * @type array
  707. * @default []
  708. */
  709. "buttonSet": [],
  710. /**
  711. * When there is more than one TableTools instance for a DataTable, there must be a
  712. * master which controls events (row selection etc)
  713. * @property master
  714. * @type boolean
  715. * @default false
  716. */
  717. "master": false,
  718. /**
  719. * Tag names that are used for creating collections and buttons
  720. * @namesapce
  721. */
  722. "tags": {}
  723. };
  724. /**
  725. * @namespace Common and useful DOM elements for the class instance
  726. */
  727. this.dom = {
  728. /**
  729. * DIV element that is create and all TableTools buttons (and their children) put into
  730. * @property container
  731. * @type node
  732. * @default null
  733. */
  734. "container": null,
  735. /**
  736. * The table node to which TableTools will be applied
  737. * @property table
  738. * @type node
  739. * @default null
  740. */
  741. "table": null,
  742. /**
  743. * @namespace Nodes used for the print display
  744. */
  745. "print": {
  746. /**
  747. * Nodes which have been removed from the display by setting them to display none
  748. * @property hidden
  749. * @type array
  750. * @default []
  751. */
  752. "hidden": [],
  753. /**
  754. * The information display saying telling the user about the print display
  755. * @property message
  756. * @type node
  757. * @default null
  758. */
  759. "message": null
  760. },
  761. /**
  762. * @namespace Nodes used for a collection display. This contains the currently used collection
  763. */
  764. "collection": {
  765. /**
  766. * The div wrapper containing the buttons in the collection (i.e. the menu)
  767. * @property collection
  768. * @type node
  769. * @default null
  770. */
  771. "collection": null,
  772. /**
  773. * Background display to provide focus and capture events
  774. * @property background
  775. * @type node
  776. * @default null
  777. */
  778. "background": null
  779. }
  780. };
  781. /**
  782. * @namespace Name space for the classes that this TableTools instance will use
  783. * @extends TableTools.classes
  784. */
  785. this.classes = $.extend( true, {}, TableTools.classes );
  786. if ( this.s.dt.bJUI )
  787. {
  788. $.extend( true, this.classes, TableTools.classes_themeroller );
  789. }
  790. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  791. * Public class methods
  792. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  793. /**
  794. * Retreieve the settings object from an instance
  795. * @method fnSettings
  796. * @returns {object} TableTools settings object
  797. */
  798. this.fnSettings = function () {
  799. return this.s;
  800. };
  801. /* Constructor logic */
  802. if ( typeof oOpts == 'undefined' )
  803. {
  804. oOpts = {};
  805. }
  806. TableTools._aInstances.push( this );
  807. this._fnConstruct( oOpts );
  808. return this;
  809. };
  810. TableTools.prototype = {
  811. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  812. * Public methods
  813. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  814. /**
  815. * Retreieve the settings object from an instance
  816. * @returns {array} List of TR nodes which are currently selected
  817. * @param {boolean} [filtered=false] Get only selected rows which are
  818. * available given the filtering applied to the table. By default
  819. * this is false - i.e. all rows, regardless of filtering are
  820. selected.
  821. */
  822. "fnGetSelected": function ( filtered )
  823. {
  824. var
  825. out = [],
  826. data = this.s.dt.aoData,
  827. displayed = this.s.dt.aiDisplay,
  828. i, iLen;
  829. if ( filtered )
  830. {
  831. // Only consider filtered rows
  832. for ( i=0, iLen=displayed.length ; i<iLen ; i++ )
  833. {
  834. if ( data[ displayed[i] ]._DTTT_selected )
  835. {
  836. out.push( data[ displayed[i] ].nTr );
  837. }
  838. }
  839. }
  840. else
  841. {
  842. // Use all rows
  843. for ( i=0, iLen=data.length ; i<iLen ; i++ )
  844. {
  845. if ( data[i]._DTTT_selected )
  846. {
  847. out.push( data[i].nTr );
  848. }
  849. }
  850. }
  851. return out;
  852. },
  853. /**
  854. * Get the data source objects/arrays from DataTables for the selected rows (same as
  855. * fnGetSelected followed by fnGetData on each row from the table)
  856. * @returns {array} Data from the TR nodes which are currently selected
  857. */
  858. "fnGetSelectedData": function ()
  859. {
  860. var out = [];
  861. var data=this.s.dt.aoData;
  862. var i, iLen;
  863. for ( i=0, iLen=data.length ; i<iLen ; i++ )
  864. {
  865. if ( data[i]._DTTT_selected )
  866. {
  867. out.push( this.s.dt.oInstance.fnGetData(i) );
  868. }
  869. }
  870. return out;
  871. },
  872. /**
  873. * Get the indexes of the selected rows
  874. * @returns {array} List of row indexes
  875. * @param {boolean} [filtered=false] Get only selected rows which are
  876. * available given the filtering applied to the table. By default
  877. * this is false - i.e. all rows, regardless of filtering are
  878. selected.
  879. */
  880. "fnGetSelectedIndexes": function ( filtered )
  881. {
  882. var
  883. out = [],
  884. data = this.s.dt.aoData,
  885. displayed = this.s.dt.aiDisplay,
  886. i, iLen;
  887. if ( filtered )
  888. {
  889. // Only consider filtered rows
  890. for ( i=0, iLen=displayed.length ; i<iLen ; i++ )
  891. {
  892. if ( data[ displayed[i] ]._DTTT_selected )
  893. {
  894. out.push( displayed[i] );
  895. }
  896. }
  897. }
  898. else
  899. {
  900. // Use all rows
  901. for ( i=0, iLen=data.length ; i<iLen ; i++ )
  902. {
  903. if ( data[i]._DTTT_selected )
  904. {
  905. out.push( i );
  906. }
  907. }
  908. }
  909. return out;
  910. },
  911. /**
  912. * Check to see if a current row is selected or not
  913. * @param {Node} n TR node to check if it is currently selected or not
  914. * @returns {Boolean} true if select, false otherwise
  915. */
  916. "fnIsSelected": function ( n )
  917. {
  918. var pos = this.s.dt.oInstance.fnGetPosition( n );
  919. return (this.s.dt.aoData[pos]._DTTT_selected===true) ? true : false;
  920. },
  921. /**
  922. * Select all rows in the table
  923. * @param {boolean} [filtered=false] Select only rows which are available
  924. * given the filtering applied to the table. By default this is false -
  925. * i.e. all rows, regardless of filtering are selected.
  926. */
  927. "fnSelectAll": function ( filtered )
  928. {
  929. this._fnRowSelect( filtered ?
  930. this.s.dt.aiDisplay :
  931. this.s.dt.aoData
  932. );
  933. },
  934. /**
  935. * Deselect all rows in the table
  936. * @param {boolean} [filtered=false] Deselect only rows which are available
  937. * given the filtering applied to the table. By default this is false -
  938. * i.e. all rows, regardless of filtering are deselected.
  939. */
  940. "fnSelectNone": function ( filtered )
  941. {
  942. this._fnRowDeselect( this.fnGetSelectedIndexes(filtered) );
  943. },
  944. /**
  945. * Select row(s)
  946. * @param {node|object|array} n The row(s) to select. Can be a single DOM
  947. * TR node, an array of TR nodes or a jQuery object.
  948. */
  949. "fnSelect": function ( n )
  950. {
  951. if ( this.s.select.type == "single" )
  952. {
  953. this.fnSelectNone();
  954. this._fnRowSelect( n );
  955. }
  956. else
  957. {
  958. this._fnRowSelect( n );
  959. }
  960. },
  961. /**
  962. * Deselect row(s)
  963. * @param {node|object|array} n The row(s) to deselect. Can be a single DOM
  964. * TR node, an array of TR nodes or a jQuery object.
  965. */
  966. "fnDeselect": function ( n )
  967. {
  968. this._fnRowDeselect( n );
  969. },
  970. /**
  971. * Get the title of the document - useful for file names. The title is retrieved from either
  972. * the configuration object's 'title' parameter, or the HTML document title
  973. * @param {Object} oConfig Button configuration object
  974. * @returns {String} Button title
  975. */
  976. "fnGetTitle": function( oConfig )
  977. {
  978. var sTitle = "";
  979. if ( typeof oConfig.sTitle != 'undefined' && oConfig.sTitle !== "" ) {
  980. sTitle = oConfig.sTitle;
  981. } else {
  982. var anTitle = document.getElementsByTagName('title');
  983. if ( anTitle.length > 0 )
  984. {
  985. sTitle = anTitle[0].innerHTML;
  986. }
  987. }
  988. /* Strip characters which the OS will object to - checking for UTF8 support in the scripting
  989. * engine
  990. */
  991. if ( "\u00A1".toString().length < 4 ) {
  992. return sTitle.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g, "");
  993. } else {
  994. return sTitle.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g, "");
  995. }
  996. },
  997. /**
  998. * Calculate a unity array with the column width by proportion for a set of columns to be
  999. * included for a button. This is particularly useful for PDF creation, where we can use the
  1000. * column widths calculated by the browser to size the columns in the PDF.
  1001. * @param {Object} oConfig Button configuration object
  1002. * @returns {Array} Unity array of column ratios
  1003. */
  1004. "fnCalcColRatios": function ( oConfig )
  1005. {
  1006. var
  1007. aoCols = this.s.dt.aoColumns,
  1008. aColumnsInc = this._fnColumnTargets( oConfig.mColumns ),
  1009. aColWidths = [],
  1010. iWidth = 0, iTotal = 0, i, iLen;
  1011. for ( i=0, iLen=aColumnsInc.length ; i<iLen ; i++ )
  1012. {
  1013. if ( aColumnsInc[i] )
  1014. {
  1015. iWidth = aoCols[i].nTh.offsetWidth;
  1016. iTotal += iWidth;
  1017. aColWidths.push( iWidth );
  1018. }
  1019. }
  1020. for ( i=0, iLen=aColWidths.length ; i<iLen ; i++ )
  1021. {
  1022. aColWidths[i] = aColWidths[i] / iTotal;
  1023. }
  1024. return aColWidths.join('\t');
  1025. },
  1026. /**
  1027. * Get the information contained in a table as a string
  1028. * @param {Object} oConfig Button configuration object
  1029. * @returns {String} Table data as a string
  1030. */
  1031. "fnGetTableData": function ( oConfig )
  1032. {
  1033. /* In future this could be used to get data from a plain HTML source as well as DataTables */
  1034. if ( this.s.dt )
  1035. {
  1036. return this._fnGetDataTablesData( oConfig );
  1037. }
  1038. },
  1039. /**
  1040. * Pass text to a flash button instance, which will be used on the button's click handler
  1041. * @param {Object} clip Flash button object
  1042. * @param {String} text Text to set
  1043. */
  1044. "fnSetText": function ( clip, text )
  1045. {
  1046. this._fnFlashSetText( clip, text );
  1047. },
  1048. /**
  1049. * Resize the flash elements of the buttons attached to this TableTools instance - this is
  1050. * useful for when initialising TableTools when it is hidden (display:none) since sizes can't
  1051. * be calculated at that time.
  1052. */
  1053. "fnResizeButtons": function ()
  1054. {
  1055. for ( var cli in ZeroClipboard_TableTools.clients )
  1056. {
  1057. if ( cli )
  1058. {
  1059. var client = ZeroClipboard_TableTools.clients[cli];
  1060. if ( typeof client.domElement != 'undefined' &&
  1061. client.domElement.parentNode )
  1062. {
  1063. client.positionElement();
  1064. }
  1065. }
  1066. }
  1067. },
  1068. /**
  1069. * Check to see if any of the ZeroClipboard client's attached need to be resized
  1070. */
  1071. "fnResizeRequired": function ()
  1072. {
  1073. for ( var cli in ZeroClipboard_TableTools.clients )
  1074. {
  1075. if ( cli )
  1076. {
  1077. var client = ZeroClipboard_TableTools.clients[cli];
  1078. if ( typeof client.domElement != 'undefined' &&
  1079. client.domElement.parentNode == this.dom.container &&
  1080. client.sized === false )
  1081. {
  1082. return true;
  1083. }
  1084. }
  1085. }
  1086. return false;
  1087. },
  1088. /**
  1089. * Programmatically enable or disable the print view
  1090. * @param {boolean} [bView=true] Show the print view if true or not given. If false, then
  1091. * terminate the print view and return to normal.
  1092. * @param {object} [oConfig={}] Configuration for the print view
  1093. * @param {boolean} [oConfig.bShowAll=false] Show all rows in the table if true
  1094. * @param {string} [oConfig.sInfo] Information message, displayed as an overlay to the
  1095. * user to let them know what the print view is.
  1096. * @param {string} [oConfig.sMessage] HTML string to show at the top of the document - will
  1097. * be included in the printed document.
  1098. */
  1099. "fnPrint": function ( bView, oConfig )
  1100. {
  1101. if ( oConfig === undefined )
  1102. {
  1103. oConfig = {};
  1104. }
  1105. if ( bView === undefined || bView )
  1106. {
  1107. this._fnPrintStart( oConfig );
  1108. }
  1109. else
  1110. {
  1111. this._fnPrintEnd();
  1112. }
  1113. },
  1114. /**
  1115. * Show a message to the end user which is nicely styled
  1116. * @param {string} message The HTML string to show to the user
  1117. * @param {int} time The duration the message is to be shown on screen for (mS)
  1118. */
  1119. "fnInfo": function ( message, time ) {
  1120. var info = $('<div/>')
  1121. .addClass( this.classes.print.info )
  1122. .html( message )
  1123. .appendTo( 'body' );
  1124. setTimeout( function() {
  1125. info.fadeOut( "normal", function() {
  1126. info.remove();
  1127. } );
  1128. }, time );
  1129. },
  1130. /**
  1131. * Get the container element of the instance for attaching to the DOM
  1132. * @returns {node} DOM node
  1133. */
  1134. "fnContainer": function () {
  1135. return this.dom.container;
  1136. },
  1137. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1138. * Private methods (they are of course public in JS, but recommended as private)
  1139. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1140. /**
  1141. * Constructor logic
  1142. * @method _fnConstruct
  1143. * @param {Object} oOpts Same as TableTools constructor
  1144. * @returns void
  1145. * @private
  1146. */
  1147. "_fnConstruct": function ( oOpts )
  1148. {
  1149. var that = this;
  1150. this._fnCustomiseSettings( oOpts );
  1151. /* Container element */
  1152. this.dom.container = document.createElement( this.s.tags.container );
  1153. this.dom.container.className = this.classes.container;
  1154. /* Row selection config */
  1155. if ( this.s.select.type != 'none' )
  1156. {
  1157. this._fnRowSelectConfig();
  1158. }
  1159. /* Buttons */
  1160. this._fnButtonDefinations( this.s.buttonSet, this.dom.container );
  1161. /* Destructor */
  1162. this.s.dt.aoDestroyCallback.push( {
  1163. "sName": "TableTools",
  1164. "fn": function () {
  1165. $(that.s.dt.nTBody)
  1166. .off( 'click.DTTT_Select', that.s.custom.sRowSelector )
  1167. .off( 'mousedown.DTTT_Select', 'tr' )
  1168. .off( 'mouseup.DTTT_Select', 'tr' );
  1169. $(that.dom.container).empty();
  1170. // Remove the instance
  1171. var idx = $.inArray( that, TableTools._aInstances );
  1172. if ( idx !== -1 ) {
  1173. TableTools._aInstances.splice( idx, 1 );
  1174. }
  1175. }
  1176. } );
  1177. },
  1178. /**
  1179. * Take the user defined settings and the default settings and combine them.
  1180. * @method _fnCustomiseSettings
  1181. * @param {Object} oOpts Same as TableTools constructor
  1182. * @returns void
  1183. * @private
  1184. */
  1185. "_fnCustomiseSettings": function ( oOpts )
  1186. {
  1187. /* Is this the master control instance or not? */
  1188. if ( typeof this.s.dt._TableToolsInit == 'undefined' )
  1189. {
  1190. this.s.master = true;
  1191. this.s.dt._TableToolsInit = true;
  1192. }
  1193. /* We can use the table node from comparisons to group controls */
  1194. this.dom.table = this.s.dt.nTable;
  1195. /* Clone the defaults and then the user options */
  1196. this.s.custom = $.extend( {}, TableTools.DEFAULTS, oOpts );
  1197. /* Flash file location */
  1198. this.s.swfPath = this.s.custom.sSwfPath;
  1199. if ( typeof ZeroClipboard_TableTools != 'undefined' )
  1200. {
  1201. ZeroClipboard_TableTools.moviePath = this.s.swfPath;
  1202. }
  1203. /* Table row selecting */
  1204. this.s.select.type = this.s.custom.sRowSelect;
  1205. this.s.select.preRowSelect = this.s.custom.fnPreRowSelect;
  1206. this.s.select.postSelected = this.s.custom.fnRowSelected;
  1207. this.s.select.postDeselected = this.s.custom.fnRowDeselected;
  1208. // Backwards compatibility - allow the user to specify a custom class in the initialiser
  1209. if ( this.s.custom.sSelectedClass )
  1210. {
  1211. this.classes.select.row = this.s.custom.sSelectedClass;
  1212. }
  1213. this.s.tags = this.s.custom.oTags;
  1214. /* Button set */
  1215. this.s.buttonSet = this.s.custom.aButtons;
  1216. },
  1217. /**
  1218. * Take the user input arrays and expand them to be fully defined, and then add them to a given
  1219. * DOM element
  1220. * @method _fnButtonDefinations
  1221. * @param {array} buttonSet Set of user defined buttons
  1222. * @param {node} wrapper Node to add the created buttons to
  1223. * @returns void
  1224. * @private
  1225. */
  1226. "_fnButtonDefinations": function ( buttonSet, wrapper )
  1227. {
  1228. var buttonDef;
  1229. for ( var i=0, iLen=buttonSet.length ; i<iLen ; i++ )
  1230. {
  1231. if ( typeof buttonSet[i] == "string" )
  1232. {
  1233. if ( typeof TableTools.BUTTONS[ buttonSet[i] ] == 'undefined' )
  1234. {
  1235. alert( "TableTools: Warning - unknown button type: "+buttonSet[i] );
  1236. continue;
  1237. }
  1238. buttonDef = $.extend( {}, TableTools.BUTTONS[ buttonSet[i] ], true );
  1239. }
  1240. else
  1241. {
  1242. if ( typeof TableTools.BUTTONS[ buttonSet[i].sExtends ] == 'undefined' )
  1243. {
  1244. alert( "TableTools: Warning - unknown button type: "+buttonSet[i].sExtends );
  1245. continue;
  1246. }
  1247. var o = $.extend( {}, TableTools.BUTTONS[ buttonSet[i].sExtends ], true );
  1248. buttonDef = $.extend( o, buttonSet[i], true );
  1249. }
  1250. var button = this._fnCreateButton(
  1251. buttonDef,
  1252. $(wrapper).hasClass(this.classes.collection.container)
  1253. );
  1254. if ( button ) {
  1255. wrapper.appendChild( button );
  1256. }
  1257. }
  1258. },
  1259. /**
  1260. * Create and configure a TableTools button
  1261. * @method _fnCreateButton
  1262. * @param {Object} oConfig Button configuration object
  1263. * @returns {Node} Button element
  1264. * @private
  1265. */
  1266. "_fnCreateButton": function ( oConfig, bCollectionButton )
  1267. {
  1268. var nButton = this._fnButtonBase( oConfig, bCollectionButton );
  1269. if ( oConfig.sAction.match(/flash/) )
  1270. {
  1271. if ( ! this._fnHasFlash() ) {
  1272. return false;
  1273. }
  1274. this._fnFlashConfig( nButton, oConfig );
  1275. }
  1276. else if ( oConfig.sAction == "text" )
  1277. {
  1278. this._fnTextConfig( nButton, oConfig );
  1279. }
  1280. else if ( oConfig.sAction == "div" )
  1281. {
  1282. this._fnTextConfig( nButton, oConfig );
  1283. }
  1284. else if ( oConfig.sAction == "collection" )
  1285. {
  1286. this._fnTextConfig( nButton, oConfig );
  1287. this._fnCollectionConfig( nButton, oConfig );
  1288. }
  1289. if ( this.s.dt.iTabIndex !== -1 ) {
  1290. $(nButton)
  1291. .attr( 'tabindex', this.s.dt.iTabIndex )
  1292. .attr( 'aria-controls', this.s.dt.sTableId )
  1293. .on( 'keyup.DTTT', function (e) {
  1294. // Trigger the click event on return key when focused.
  1295. // Note that for Flash buttons this has no effect since we
  1296. // can't programmatically trigger the Flash export
  1297. if ( e.keyCode === 13 ) {
  1298. e.stopPropagation();
  1299. $(this).trigger( 'click' );
  1300. }
  1301. } )
  1302. .on( 'mousedown.DTTT', function (e) {
  1303. // On mousedown we want to stop the focus occurring on the
  1304. // button, focus is used only for the keyboard navigation.
  1305. // But using preventDefault for the flash buttons stops the
  1306. // flash action. However, it is not the button that gets
  1307. // focused but the flash element for flash buttons, so this
  1308. // works
  1309. if ( ! oConfig.sAction.match(/flash/) ) {
  1310. e.preventDefault();
  1311. }
  1312. } );
  1313. }
  1314. return nButton;
  1315. },
  1316. /**
  1317. * Create the DOM needed for the button and apply some base properties. All buttons start here
  1318. * @method _fnButtonBase
  1319. * @param {o} oConfig Button configuration object
  1320. * @returns {Node} DIV element for the button
  1321. * @private
  1322. */
  1323. "_fnButtonBase": function ( o, bCollectionButton )
  1324. {
  1325. var sTag, sLiner, sClass;
  1326. if ( bCollectionButton )
  1327. {
  1328. sTag = o.sTag && o.sTag !== "default" ? o.sTag : this.s.tags.collection.button;
  1329. sLiner = o.sLinerTag && o.sLinerTag !== "default" ? o.sLiner : this.s.tags.collection.liner;
  1330. sClass = this.classes.collection.buttons.normal;
  1331. }
  1332. else
  1333. {
  1334. sTag = o.sTag && o.sTag !== "default" ? o.sTag : this.s.tags.button;
  1335. sLiner = o.sLinerTag && o.sLinerTag !== "default" ? o.sLiner : this.s.tags.liner;
  1336. sClass = this.classes.buttons.normal;
  1337. }
  1338. var
  1339. nButton = document.createElement( sTag ),
  1340. nSpan = document.createElement( sLiner ),
  1341. masterS = this._fnGetMasterSettings();
  1342. nButton.className = sClass+" "+o.sButtonClass;
  1343. nButton.setAttribute('id', "ToolTables_"+this.s.dt.sInstance+"_"+masterS.buttonCounter );
  1344. nButton.appendChild( nSpan );
  1345. nSpan.innerHTML = o.sButtonText;
  1346. masterS.buttonCounter++;
  1347. return nButton;
  1348. },
  1349. /**
  1350. * Get the settings object for the master instance. When more than one TableTools instance is
  1351. * assigned to a DataTable, only one of them can be the 'master' (for the select rows). As such,
  1352. * we will typically want to interact with that master for global properties.
  1353. * @method _fnGetMasterSettings
  1354. * @returns {Object} TableTools settings object
  1355. * @private
  1356. */
  1357. "_fnGetMasterSettings": function ()
  1358. {
  1359. if ( this.s.master )
  1360. {
  1361. return this.s;
  1362. }
  1363. else
  1364. {
  1365. /* Look for the master which has the same DT as this one */
  1366. var instances = TableTools._aInstances;
  1367. for ( var i=0, iLen=instances.length ; i<iLen ; i++ )
  1368. {
  1369. if ( this.dom.table == instances[i].s.dt.nTable )
  1370. {
  1371. return instances[i].s;
  1372. }
  1373. }
  1374. }
  1375. },
  1376. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1377. * Button collection functions
  1378. */
  1379. /**
  1380. * Create a collection button, when activated will present a drop down list of other buttons
  1381. * @param {Node} nButton Button to use for the collection activation
  1382. * @param {Object} oConfig Button configuration object
  1383. * @returns void
  1384. * @private
  1385. */
  1386. "_fnCollectionConfig": function ( nButton, oConfig )
  1387. {
  1388. var nHidden = document.createElement( this.s.tags.collection.container );
  1389. nHidden.style.display = "none";
  1390. nHidden.className = this.classes.collection.container;
  1391. oConfig._collection = nHidden;
  1392. document.body.appendChild( nHidden );
  1393. this._fnButtonDefinations( oConfig.aButtons, nHidden );
  1394. },
  1395. /**
  1396. * Show a button collection
  1397. * @param {Node} nButton Button to use for the collection
  1398. * @param {Object} oConfig Button configuration object
  1399. * @returns void
  1400. * @private
  1401. */
  1402. "_fnCollectionShow": function ( nButton, oConfig )
  1403. {
  1404. var
  1405. that = this,
  1406. oPos = $(nButton).offset(),
  1407. nHidden = oConfig._collection,
  1408. iDivX = oPos.left,
  1409. iDivY = oPos.top + $(nButton).outerHeight(),
  1410. iWinHeight = $(window).height(), iDocHeight = $(document).height(),
  1411. iWinWidth = $(window).width(), iDocWidth = $(document).width();
  1412. nHidden.style.position = "absolute";
  1413. nHidden.style.left = iDivX+"px";
  1414. nHidden.style.top = iDivY+"px";
  1415. nHidden.style.display = "block";
  1416. $(nHidden).css('opacity',0);
  1417. var nBackground = document.createElement('div');
  1418. nBackground.style.position = "absolute";
  1419. nBackground.style.left = "0px";
  1420. nBackground.style.top = "0px";
  1421. nBackground.style.height = ((iWinHeight>iDocHeight)? iWinHeight : iDocHeight) +"px";
  1422. nBackground.style.width = ((iWinWidth>iDocWidth)? iWinWidth : iDocWidth) +"px";
  1423. nBackground.className = this.classes.collection.background;
  1424. $(nBackground).css('opacity',0);
  1425. document.body.appendChild( nBackground );
  1426. document.body.appendChild( nHidden );
  1427. /* Visual corrections to try and keep the collection visible */
  1428. var iDivWidth = $(nHidden).outerWidth();
  1429. var iDivHeight = $(nHidden).outerHeight();
  1430. if ( iDivX + iDivWidth > iDocWidth )
  1431. {
  1432. nHidden.style.left = (iDocWidth-iDivWidth)+"px";
  1433. }
  1434. if ( iDivY + iDivHeight > iDocHeight )
  1435. {
  1436. nHidden.style.top = (iDivY-iDivHeight-$(nButton).outerHeight())+"px";
  1437. }
  1438. this.dom.collection.collection = nHidden;
  1439. this.dom.collection.background = nBackground;
  1440. /* This results in a very small delay for the end user but it allows the animation to be
  1441. * much smoother. If you don't want the animation, then the setTimeout can be removed
  1442. */
  1443. setTimeout( function () {
  1444. $(nHidden).animate({"opacity": 1}, 500);
  1445. $(nBackground).animate({"opacity": 0.25}, 500);
  1446. }, 10 );
  1447. /* Resize the buttons to the Flash contents fit */
  1448. this.fnResizeButtons();
  1449. /* Event handler to remove the collection display */
  1450. $(nBackground).click( function () {
  1451. that._fnCollectionHide.call( that, null, null );
  1452. } );
  1453. },
  1454. /**
  1455. * Hide a button collection
  1456. * @param {Node} nButton Button to use for the collection
  1457. * @param {Object} oConfig Button configuration object
  1458. * @returns void
  1459. * @private
  1460. */
  1461. "_fnCollectionHide": function ( nButton, oConfig )
  1462. {
  1463. if ( oConfig !== null && oConfig.sExtends == 'collection' )
  1464. {
  1465. return;
  1466. }
  1467. if ( this.dom.collection.collection !== null )
  1468. {
  1469. $(this.dom.collection.collection).animate({"opacity": 0}, 500, function (e) {
  1470. this.style.display = "none";
  1471. } );
  1472. $(this.dom.collection.background).animate({"opacity": 0}, 500, function (e) {
  1473. this.parentNode.removeChild( this );
  1474. } );
  1475. this.dom.collection.collection = null;
  1476. this.dom.collection.background = null;
  1477. }
  1478. },
  1479. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1480. * Row selection functions
  1481. */
  1482. /**
  1483. * Add event handlers to a table to allow for row selection
  1484. * @method _fnRowSelectConfig
  1485. * @returns void
  1486. * @private
  1487. */
  1488. "_fnRowSelectConfig": function ()
  1489. {
  1490. if ( this.s.master )
  1491. {
  1492. var
  1493. that = this,
  1494. i, iLen,
  1495. dt = this.s.dt,
  1496. aoOpenRows = this.s.dt.aoOpenRows;
  1497. $(dt.nTable).addClass( this.classes.select.table );
  1498. // When using OS style selection, we want to cancel the shift text
  1499. // selection, but only when the shift key is used (so you can
  1500. // actually still select text in the table)
  1501. if ( this.s.select.type === 'os' ) {
  1502. $(dt.nTBody).on( 'mousedown.DTTT_Select', 'tr', function(e) {
  1503. if ( e.shiftKey ) {
  1504. $(dt.nTBody)
  1505. .css( '-moz-user-select', 'none' )
  1506. .one('selectstart.DTTT_Select', 'tr', function () {
  1507. return false;
  1508. } );
  1509. }
  1510. } );
  1511. $(dt.nTBody).on( 'mouseup.DTTT_Select', 'tr', function(e) {
  1512. $(dt.nTBody).css( '-moz-user-select', '' );
  1513. } );
  1514. }
  1515. // Row selection
  1516. $(dt.nTBody).on( 'click.DTTT_Select', this.s.custom.sRowSelector, function(e) {
  1517. var row = this.nodeName.toLowerCase() === 'tr' ?
  1518. this :
  1519. $(this).parents('tr')[0];
  1520. var select = that.s.select;
  1521. var pos = that.s.dt.oInstance.fnGetPosition( row );
  1522. /* Sub-table must be ignored (odd that the selector won't do this with >) */
  1523. if ( row.parentNode != dt.nTBody ) {
  1524. return;
  1525. }
  1526. /* Check that we are actually working with a DataTables controlled row */
  1527. if ( dt.oInstance.fnGetData(row) === null ) {
  1528. return;
  1529. }
  1530. // Shift click, ctrl click and simple click handling to make
  1531. // row selection a lot like a file system in desktop OSs
  1532. if ( select.type == 'os' ) {
  1533. if ( e.ctrlKey || e.metaKey ) {
  1534. // Add or remove from the selection
  1535. if ( that.fnIsSelected( row ) ) {
  1536. that._fnRowDeselect( row, e );
  1537. }
  1538. else {
  1539. that._fnRowSelect( row, e );
  1540. }
  1541. }
  1542. else if ( e.shiftKey ) {
  1543. // Add a range of rows, from the last selected row to
  1544. // this one
  1545. var rowIdxs = that.s.dt.aiDisplay.slice(); // visible rows
  1546. var idx1 = $.inArray( select.lastRow, rowIdxs );
  1547. var idx2 = $.inArray( pos, rowIdxs );
  1548. if ( that.fnGetSelected().length === 0 || idx1 === -1 ) {
  1549. // select from top to here - slightly odd, but both
  1550. // Windows and Mac OS do this
  1551. rowIdxs.splice( $.inArray( pos, rowIdxs )+1, rowIdxs.length );
  1552. }
  1553. else {
  1554. // reverse so we can shift click 'up' as well as down
  1555. if ( idx1 > idx2 ) {
  1556. var tmp = idx2;
  1557. idx2 = idx1;
  1558. idx1 = tmp;
  1559. }
  1560. rowIdxs.splice( idx2+1, rowIdxs.length );
  1561. rowIdxs.splice( 0, idx1 );
  1562. }
  1563. if ( ! that.fnIsSelected( row ) ) {
  1564. // Select range
  1565. that._fnRowSelect( rowIdxs, e );
  1566. }
  1567. else {
  1568. // Deselect range - need to keep the clicked on row selected
  1569. rowIdxs.splice( $.inArray( pos, rowIdxs ), 1 );
  1570. that._fnRowDeselect( rowIdxs, e );
  1571. }
  1572. }
  1573. else {
  1574. // No cmd or shift click. Deselect current if selected,
  1575. // or select this row only
  1576. if ( that.fnIsSelected( row ) && that.fnGetSelected().length === 1 ) {
  1577. that._fnRowDeselect( row, e );
  1578. }
  1579. else {
  1580. that.fnSelectNone();
  1581. that._fnRowSelect( row, e );
  1582. }
  1583. }
  1584. }
  1585. else if ( that.fnIsSelected( row ) ) {
  1586. that._fnRowDeselect( row, e );
  1587. }
  1588. else if ( select.type == "single" ) {
  1589. that.fnSelectNone();
  1590. that._fnRowSelect( row, e );
  1591. }
  1592. else if ( select.type == "multi" ) {
  1593. that._fnRowSelect( row, e );
  1594. }
  1595. select.lastRow = pos;
  1596. } );//.on('selectstart', function () { return false; } );
  1597. // Bind a listener to the DataTable for when new rows are created.
  1598. // This allows rows to be visually selected when they should be and
  1599. // deferred rendering is used.
  1600. dt.oApi._fnCallbackReg( dt, 'aoRowCreatedCallback', function (tr, data, index) {
  1601. if ( dt.aoData[index]._DTTT_selected ) {
  1602. $(tr).addClass( that.classes.select.row );
  1603. }
  1604. }, 'TableTools-SelectAll' );
  1605. }
  1606. },
  1607. /**
  1608. * Select rows
  1609. * @param {*} src Rows to select - see _fnSelectData for a description of valid inputs
  1610. * @private
  1611. */
  1612. "_fnRowSelect": function ( src, e )
  1613. {
  1614. var
  1615. that = this,
  1616. data = this._fnSelectData( src ),
  1617. firstTr = data.length===0 ? null : data[0].nTr,
  1618. anSelected = [],
  1619. i, len;
  1620. // Get all the rows that will be selected
  1621. for ( i=0, len=data.length ; i<len ; i++ )
  1622. {
  1623. if ( data[i].nTr )
  1624. {
  1625. anSelected.push( data[i].nTr );
  1626. }
  1627. }
  1628. // User defined pre-selection function
  1629. if ( this.s.select.preRowSelect !== null && !this.s.select.preRowSelect.call(this, e, anSelected, true) )
  1630. {
  1631. return;
  1632. }
  1633. // Mark them as selected
  1634. for ( i=0, len=data.length ; i<len ; i++ )
  1635. {
  1636. data[i]._DTTT_selected = true;
  1637. if ( data[i].nTr )
  1638. {
  1639. $(data[i].nTr).addClass( that.classes.select.row );
  1640. }
  1641. }
  1642. // Post-selection function
  1643. if ( this.s.select.postSelected !== null )
  1644. {
  1645. this.s.select.postSelected.call( this, anSelected );
  1646. }
  1647. TableTools._fnEventDispatch( this, 'select', anSelected, true );
  1648. },
  1649. /**
  1650. * Deselect rows
  1651. * @param {*} src Rows to deselect - see _fnSelectData for a description of valid inputs
  1652. * @private
  1653. */
  1654. "_fnRowDeselect": function ( src, e )
  1655. {
  1656. var
  1657. that = this,
  1658. data = this._fnSelectData( src ),
  1659. firstTr = data.length===0 ? null : data[0].nTr,
  1660. anDeselectedTrs = [],
  1661. i, len;
  1662. // Get all the rows that will be deselected
  1663. for ( i=0, len=data.length ; i<len ; i++ )
  1664. {
  1665. if ( data[i].nTr )
  1666. {
  1667. anDeselectedTrs.push( data[i].nTr );
  1668. }
  1669. }
  1670. // User defined pre-selection function
  1671. if ( this.s.select.preRowSelect !== null && !this.s.select.preRowSelect.call(this, e, anDeselectedTrs, false) )
  1672. {
  1673. return;
  1674. }
  1675. // Mark them as deselected
  1676. for ( i=0, len=data.length ; i<len ; i++ )
  1677. {
  1678. data[i]._DTTT_selected = false;
  1679. if ( data[i].nTr )
  1680. {
  1681. $(data[i].nTr).removeClass( that.classes.select.row );
  1682. }
  1683. }
  1684. // Post-deselection function
  1685. if ( this.s.select.postDeselected !== null )
  1686. {
  1687. this.s.select.postDeselected.call( this, anDeselectedTrs );
  1688. }
  1689. TableTools._fnEventDispatch( this, 'select', anDeselectedTrs, false );
  1690. },
  1691. /**
  1692. * Take a data source for row selection and convert it into aoData points for the DT
  1693. * @param {*} src Can be a single DOM TR node, an array of TR nodes (including a
  1694. * a jQuery object), a single aoData point from DataTables, an array of aoData
  1695. * points or an array of aoData indexes
  1696. * @returns {array} An array of aoData points
  1697. */
  1698. "_fnSelectData": function ( src )
  1699. {
  1700. var out = [], pos, i, iLen;
  1701. if ( src.nodeName )
  1702. {
  1703. // Single node
  1704. pos = this.s.dt.oInstance.fnGetPosition( src );
  1705. out.push( this.s.dt.aoData[pos] );
  1706. }
  1707. else if ( typeof src.length !== 'undefined' )
  1708. {
  1709. // jQuery object or an array of nodes, or aoData points
  1710. for ( i=0, iLen=src.length ; i<iLen ; i++ )
  1711. {
  1712. if ( src[i].nodeName )
  1713. {
  1714. pos = this.s.dt.oInstance.fnGetPosition( src[i] );
  1715. out.push( this.s.dt.aoData[pos] );
  1716. }
  1717. else if ( typeof src[i] === 'number' )
  1718. {
  1719. out.push( this.s.dt.aoData[ src[i] ] );
  1720. }
  1721. else
  1722. {
  1723. out.push( src[i] );
  1724. }
  1725. }
  1726. return out;
  1727. }
  1728. else if ( typeof src === 'number' )
  1729. {
  1730. out.push(this.s.dt.aoData[src]);
  1731. }
  1732. else
  1733. {
  1734. // A single aoData point
  1735. out.push( src );
  1736. }
  1737. return out;
  1738. },
  1739. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1740. * Text button functions
  1741. */
  1742. /**
  1743. * Configure a text based button for interaction events
  1744. * @method _fnTextConfig
  1745. * @param {Node} nButton Button element which is being considered
  1746. * @param {Object} oConfig Button configuration object
  1747. * @returns void
  1748. * @private
  1749. */
  1750. "_fnTextConfig": function ( nButton, oConfig )
  1751. {
  1752. var that = this;
  1753. if ( oConfig.fnInit !== null )
  1754. {
  1755. oConfig.fnInit.call( this, nButton, oConfig );
  1756. }
  1757. if ( oConfig.sToolTip !== "" )
  1758. {
  1759. nButton.title = oConfig.sToolTip;
  1760. }
  1761. $(nButton).hover( function () {
  1762. if ( oConfig.fnMouseover !== null )
  1763. {
  1764. oConfig.fnMouseover.call( this, nButton, oConfig, null );
  1765. }
  1766. }, function () {
  1767. if ( oConfig.fnMouseout !== null )
  1768. {
  1769. oConfig.fnMouseout.call( this, nButton, oConfig, null );
  1770. }
  1771. } );
  1772. if ( oConfig.fnSelect !== null )
  1773. {
  1774. TableTools._fnEventListen( this, 'select', function (n) {
  1775. oConfig.fnSelect.call( that, nButton, oConfig, n );
  1776. } );
  1777. }
  1778. $(nButton).click( function (e) {
  1779. //e.preventDefault();
  1780. if ( oConfig.fnClick !== null )
  1781. {
  1782. oConfig.fnClick.call( that, nButton, oConfig, null, e );
  1783. }
  1784. /* Provide a complete function to match the behaviour of the flash elements */
  1785. if ( oConfig.fnComplete !== null )
  1786. {
  1787. oConfig.fnComplete.call( that, nButton, oConfig, null, null );
  1788. }
  1789. that._fnCollectionHide( nButton, oConfig );
  1790. } );
  1791. },
  1792. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1793. * Flash button functions
  1794. */
  1795. /**
  1796. * Check if the Flash plug-in is available
  1797. * @method _fnHasFlash
  1798. * @returns {boolean} `true` if Flash available, `false` otherwise
  1799. * @private
  1800. */
  1801. "_fnHasFlash": function ()
  1802. {
  1803. try {
  1804. var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
  1805. if (fo) {
  1806. return true;
  1807. }
  1808. }
  1809. catch (e) {
  1810. if (
  1811. navigator.mimeTypes &&
  1812. navigator.mimeTypes['application/x-shockwave-flash'] !== undefined &&
  1813. navigator.mimeTypes['application/x-shockwave-flash'].enabledPlugin
  1814. ) {
  1815. return true;
  1816. }
  1817. }
  1818. return false;
  1819. },
  1820. /**
  1821. * Configure a flash based button for interaction events
  1822. * @method _fnFlashConfig
  1823. * @param {Node} nButton Button element which is being considered
  1824. * @param {o} oConfig Button configuration object
  1825. * @returns void
  1826. * @private
  1827. */
  1828. "_fnFlashConfig": function ( nButton, oConfig )
  1829. {
  1830. var that = this;
  1831. var flash = new ZeroClipboard_TableTools.Client();
  1832. if ( oConfig.fnInit !== null )
  1833. {
  1834. oConfig.fnInit.call( this, nButton, oConfig );
  1835. }
  1836. flash.setHandCursor( true );
  1837. if ( oConfig.sAction == "flash_save" )
  1838. {
  1839. flash.setAction( 'save' );
  1840. flash.setCharSet( (oConfig.sCharSet=="utf16le") ? 'UTF16LE' : 'UTF8' );
  1841. flash.setBomInc( oConfig.bBomInc );
  1842. flash.setFileName( oConfig.sFileName.replace('*', this.fnGetTitle(oConfig)) );
  1843. }
  1844. else if ( oConfig.sAction == "flash_pdf" )
  1845. {
  1846. flash.setAction( 'pdf' );
  1847. flash.setFileName( oConfig.sFileName.replace('*', this.fnGetTitle(oConfig)) );
  1848. }
  1849. else
  1850. {
  1851. flash.setAction( 'copy' );
  1852. }
  1853. flash.addEventListener('mouseOver', function(client) {
  1854. if ( oConfig.fnMouseover !== null )
  1855. {
  1856. oConfig.fnMouseover.call( that, nButton, oConfig, flash );
  1857. }
  1858. } );
  1859. flash.addEventListener('mouseOut', function(client) {
  1860. if ( oConfig.fnMouseout !== null )
  1861. {
  1862. oConfig.fnMouseout.call( that, nButton, oConfig, flash );
  1863. }
  1864. } );
  1865. flash.addEventListener('mouseDown', function(client) {
  1866. if ( oConfig.fnClick !== null )
  1867. {
  1868. oConfig.fnClick.call( that, nButton, oConfig, flash );
  1869. }
  1870. } );
  1871. flash.addEventListener('complete', function (client, text) {
  1872. if ( oConfig.fnComplete !== null )
  1873. {
  1874. oConfig.fnComplete.call( that, nButton, oConfig, flash, text );
  1875. }
  1876. that._fnCollectionHide( nButton, oConfig );
  1877. } );
  1878. if ( oConfig.fnSelect !== null )
  1879. {
  1880. TableTools._fnEventListen( this, 'select', function (n) {
  1881. oConfig.fnSelect.call( that, nButton, oConfig, n );
  1882. } );
  1883. }
  1884. this._fnFlashGlue( flash, nButton, oConfig.sToolTip );
  1885. },
  1886. /**
  1887. * Wait until the id is in the DOM before we "glue" the swf. Note that this function will call
  1888. * itself (using setTimeout) until it completes successfully
  1889. * @method _fnFlashGlue
  1890. * @param {Object} clip Zero clipboard object
  1891. * @param {Node} node node to glue swf to
  1892. * @param {String} text title of the flash movie
  1893. * @returns void
  1894. * @private
  1895. */
  1896. "_fnFlashGlue": function ( flash, node, text )
  1897. {
  1898. var that = this;
  1899. var id = node.getAttribute('id');
  1900. if ( document.getElementById(id) )
  1901. {
  1902. flash.glue( node, text );
  1903. }
  1904. else
  1905. {
  1906. setTimeout( function () {
  1907. that._fnFlashGlue( flash, node, text );
  1908. }, 100 );
  1909. }
  1910. },
  1911. /**
  1912. * Set the text for the flash clip to deal with
  1913. *
  1914. * This function is required for large information sets. There is a limit on the
  1915. * amount of data that can be transferred between Javascript and Flash in a single call, so
  1916. * we use this method to build up the text in Flash by sending over chunks. It is estimated
  1917. * that the data limit is around 64k, although it is undocumented, and appears to be different
  1918. * between different flash versions. We chunk at 8KiB.
  1919. * @method _fnFlashSetText
  1920. * @param {Object} clip the ZeroClipboard object
  1921. * @param {String} sData the data to be set
  1922. * @returns void
  1923. * @private
  1924. */
  1925. "_fnFlashSetText": function ( clip, sData )
  1926. {
  1927. var asData = this._fnChunkData( sData, 8192 );
  1928. clip.clearText();
  1929. for ( var i=0, iLen=asData.length ; i<iLen ; i++ )
  1930. {
  1931. clip.appendText( asData[i] );
  1932. }
  1933. },
  1934. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  1935. * Data retrieval functions
  1936. */
  1937. /**
  1938. * Convert the mixed columns variable into a boolean array the same size as the columns, which
  1939. * indicates which columns we want to include
  1940. * @method _fnColumnTargets
  1941. * @param {String|Array} mColumns The columns to be included in data retrieval. If a string
  1942. * then it can take the value of "visible" or "hidden" (to include all visible or
  1943. * hidden columns respectively). Or an array of column indexes
  1944. * @returns {Array} A boolean array the length of the columns of the table, which each value
  1945. * indicating if the column is to be included or not
  1946. * @private
  1947. */
  1948. "_fnColumnTargets": function ( mColumns )
  1949. {
  1950. var aColumns = [];
  1951. var dt = this.s.dt;
  1952. var i, iLen;
  1953. var columns = dt.aoColumns;
  1954. var columnCount = columns.length;
  1955. if ( typeof mColumns == "function" )
  1956. {
  1957. var a = mColumns.call( this, dt );
  1958. for ( i=0, iLen=columnCount ; i<iLen ; i++ )
  1959. {
  1960. aColumns.push( $.inArray( i, a ) !== -1 ? true : false );
  1961. }
  1962. }
  1963. else if ( typeof mColumns == "object" )
  1964. {
  1965. for ( i=0, iLen=columnCount ; i<iLen ; i++ )
  1966. {
  1967. aColumns.push( false );
  1968. }
  1969. for ( i=0, iLen=mColumns.length ; i<iLen ; i++ )
  1970. {
  1971. aColumns[ mColumns[i] ] = true;
  1972. }
  1973. }
  1974. else if ( mColumns == "visible" )
  1975. {
  1976. for ( i=0, iLen=columnCount ; i<iLen ; i++ )
  1977. {
  1978. aColumns.push( columns[i].bVisible ? true : false );
  1979. }
  1980. }
  1981. else if ( mColumns == "hidden" )
  1982. {
  1983. for ( i=0, iLen=columnCount ; i<iLen ; i++ )
  1984. {
  1985. aColumns.push( columns[i].bVisible ? false : true );
  1986. }
  1987. }
  1988. else if ( mColumns == "sortable" )
  1989. {
  1990. for ( i=0, iLen=columnCount ; i<iLen ; i++ )
  1991. {
  1992. aColumns.push( columns[i].bSortable ? true : false );
  1993. }
  1994. }
  1995. else /* all */
  1996. {
  1997. for ( i=0, iLen=columnCount ; i<iLen ; i++ )
  1998. {
  1999. aColumns.push( true );
  2000. }
  2001. }
  2002. return aColumns;
  2003. },
  2004. /**
  2005. * New line character(s) depend on the platforms
  2006. * @method method
  2007. * @param {Object} oConfig Button configuration object - only interested in oConfig.sNewLine
  2008. * @returns {String} Newline character
  2009. */
  2010. "_fnNewline": function ( oConfig )
  2011. {
  2012. if ( oConfig.sNewLine == "auto" )
  2013. {
  2014. return navigator.userAgent.match(/Windows/) ? "\r\n" : "\n";
  2015. }
  2016. else
  2017. {
  2018. return oConfig.sNewLine;
  2019. }
  2020. },
  2021. /**
  2022. * Get data from DataTables' internals and format it for output
  2023. * @method _fnGetDataTablesData
  2024. * @param {Object} oConfig Button configuration object
  2025. * @param {String} oConfig.sFieldBoundary Field boundary for the data cells in the string
  2026. * @param {String} oConfig.sFieldSeperator Field separator for the data cells
  2027. * @param {String} oConfig.sNewline New line options
  2028. * @param {Mixed} oConfig.mColumns Which columns should be included in the output
  2029. * @param {Boolean} oConfig.bHeader Include the header
  2030. * @param {Boolean} oConfig.bFooter Include the footer
  2031. * @param {Boolean} oConfig.bSelectedOnly Include only the selected rows in the output
  2032. * @returns {String} Concatenated string of data
  2033. * @private
  2034. */
  2035. "_fnGetDataTablesData": function ( oConfig )
  2036. {
  2037. var i, iLen, j, jLen;
  2038. var aRow, aData=[], sLoopData='', arr;
  2039. var dt = this.s.dt, tr, child;
  2040. var regex = new RegExp(oConfig.sFieldBoundary, "g"); /* Do it here for speed */
  2041. var aColumnsInc = this._fnColumnTargets( oConfig.mColumns );
  2042. var bSelectedOnly = (typeof oConfig.bSelectedOnly != 'undefined') ? oConfig.bSelectedOnly : false;
  2043. /*
  2044. * Header
  2045. */
  2046. if ( oConfig.bHeader )
  2047. {
  2048. aRow = [];
  2049. for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
  2050. {
  2051. if ( aColumnsInc[i] )
  2052. {
  2053. sLoopData = dt.aoColumns[i].sTitle.replace(/\n/g," ").replace( /<.*?>/g, "" ).replace(/^\s+|\s+$/g,"");
  2054. sLoopData = this._fnHtmlDecode( sLoopData );
  2055. aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) );
  2056. }
  2057. }
  2058. aData.push( aRow.join(oConfig.sFieldSeperator) );
  2059. }
  2060. bSelectedOnly = true;
  2061. /*
  2062. * Body
  2063. */
  2064. var aDataIndex;
  2065. var aSelected = this.fnGetSelectedIndexes();
  2066. bSelectedOnly = this.s.select.type !== "none" && bSelectedOnly && aSelected.length !== 0;
  2067. if ( bSelectedOnly ) {
  2068. // Use the selected indexes
  2069. aDataIndex = aSelected;
  2070. }
  2071. else if ( DataTable.Api ) {
  2072. // 1.10+ style
  2073. aDataIndex = new DataTable.Api( dt )
  2074. .rows( oConfig.oSelectorOpts )
  2075. .indexes()
  2076. .flatten()
  2077. .toArray();
  2078. }
  2079. else {
  2080. // 1.9- style
  2081. aDataIndex = dt.oInstance
  2082. .$('tr', oConfig.oSelectorOpts)
  2083. .map( function (id, row) {
  2084. return dt.oInstance.fnGetPosition( row );
  2085. } )
  2086. .get();
  2087. }
  2088. for ( j=0, jLen=aDataIndex.length ; j<jLen ; j++ )
  2089. {
  2090. tr = dt.aoData[ aDataIndex[j] ].nTr;
  2091. aRow = [];
  2092. /* Columns */
  2093. for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
  2094. {
  2095. if ( aColumnsInc[i] )
  2096. {
  2097. /* Convert to strings (with small optimisation) */
  2098. var mTypeData = dt.oApi._fnGetCellData( dt, aDataIndex[j], i, 'display' );
  2099. if ( oConfig.fnCellRender )
  2100. {
  2101. sLoopData = oConfig.fnCellRender( mTypeData, i, tr, aDataIndex[j] )+"";
  2102. }
  2103. else if ( typeof mTypeData == "string" )
  2104. {
  2105. /* Strip newlines, replace img tags with alt attr. and finally strip html... */
  2106. sLoopData = mTypeData.replace(/\n/g," ");
  2107. sLoopData =
  2108. sLoopData.replace(/<img.*?\s+alt\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s>]+)).*?>/gi,
  2109. '$1$2$3');
  2110. sLoopData = sLoopData.replace( /<.*?>/g, "" );
  2111. }
  2112. else
  2113. {
  2114. sLoopData = mTypeData+"";
  2115. }
  2116. /* Trim and clean the data */
  2117. sLoopData = sLoopData.replace(/^\s+/, '').replace(/\s+$/, '');
  2118. sLoopData = this._fnHtmlDecode( sLoopData );
  2119. /* Bound it and add it to the total data */
  2120. aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) );
  2121. }
  2122. }
  2123. aData.push( aRow.join(oConfig.sFieldSeperator) );
  2124. /* Details rows from fnOpen */
  2125. if ( oConfig.bOpenRows )
  2126. {
  2127. arr = $.grep(dt.aoOpenRows, function(o) { return o.nParent === tr; });
  2128. if ( arr.length === 1 )
  2129. {
  2130. sLoopData = this._fnBoundData( $('td', arr[0].nTr).html(), oConfig.sFieldBoundary, regex );
  2131. aData.push( sLoopData );
  2132. }
  2133. }
  2134. }
  2135. /*
  2136. * Footer
  2137. */
  2138. if ( oConfig.bFooter && dt.nTFoot !== null )
  2139. {
  2140. aRow = [];
  2141. for ( i=0, iLen=dt.aoColumns.length ; i<iLen ; i++ )
  2142. {
  2143. if ( aColumnsInc[i] && dt.aoColumns[i].nTf !== null )
  2144. {
  2145. sLoopData = dt.aoColumns[i].nTf.innerHTML.replace(/\n/g," ").replace( /<.*?>/g, "" );
  2146. sLoopData = this._fnHtmlDecode( sLoopData );
  2147. aRow.push( this._fnBoundData( sLoopData, oConfig.sFieldBoundary, regex ) );
  2148. }
  2149. }
  2150. aData.push( aRow.join(oConfig.sFieldSeperator) );
  2151. }
  2152. var _sLastData = aData.join( this._fnNewline(oConfig) );
  2153. return _sLastData;
  2154. },
  2155. /**
  2156. * Wrap data up with a boundary string
  2157. * @method _fnBoundData
  2158. * @param {String} sData data to bound
  2159. * @param {String} sBoundary bounding char(s)
  2160. * @param {RegExp} regex search for the bounding chars - constructed outside for efficiency
  2161. * in the loop
  2162. * @returns {String} bound data
  2163. * @private
  2164. */
  2165. "_fnBoundData": function ( sData, sBoundary, regex )
  2166. {
  2167. if ( sBoundary === "" )
  2168. {
  2169. return sData;
  2170. }
  2171. else
  2172. {
  2173. return sBoundary + sData.replace(regex, sBoundary+sBoundary) + sBoundary;
  2174. }
  2175. },
  2176. /**
  2177. * Break a string up into an array of smaller strings
  2178. * @method _fnChunkData
  2179. * @param {String} sData data to be broken up
  2180. * @param {Int} iSize chunk size
  2181. * @returns {Array} String array of broken up text
  2182. * @private
  2183. */
  2184. "_fnChunkData": function ( sData, iSize )
  2185. {
  2186. var asReturn = [];
  2187. var iStrlen = sData.length;
  2188. for ( var i=0 ; i<iStrlen ; i+=iSize )
  2189. {
  2190. if ( i+iSize < iStrlen )
  2191. {
  2192. asReturn.push( sData.substring( i, i+iSize ) );
  2193. }
  2194. else
  2195. {
  2196. asReturn.push( sData.substring( i, iStrlen ) );
  2197. }
  2198. }
  2199. return asReturn;
  2200. },
  2201. /**
  2202. * Decode HTML entities
  2203. * @method _fnHtmlDecode
  2204. * @param {String} sData encoded string
  2205. * @returns {String} decoded string
  2206. * @private
  2207. */
  2208. "_fnHtmlDecode": function ( sData )
  2209. {
  2210. if ( sData.indexOf('&') === -1 )
  2211. {
  2212. return sData;
  2213. }
  2214. var n = document.createElement('div');
  2215. return sData.replace( /&([^\s]*?);/g, function( match, match2 ) {
  2216. if ( match.substr(1, 1) === '#' )
  2217. {
  2218. return String.fromCharCode( Number(match2.substr(1)) );
  2219. }
  2220. else
  2221. {
  2222. n.innerHTML = match;
  2223. return n.childNodes[0].nodeValue;
  2224. }
  2225. } );
  2226. },
  2227. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2228. * Printing functions
  2229. */
  2230. /**
  2231. * Show print display
  2232. * @method _fnPrintStart
  2233. * @param {Event} e Event object
  2234. * @param {Object} oConfig Button configuration object
  2235. * @returns void
  2236. * @private
  2237. */
  2238. "_fnPrintStart": function ( oConfig )
  2239. {
  2240. var that = this;
  2241. var oSetDT = this.s.dt;
  2242. /* Parse through the DOM hiding everything that isn't needed for the table */
  2243. this._fnPrintHideNodes( oSetDT.nTable );
  2244. /* Show the whole table */
  2245. this.s.print.saveStart = oSetDT._iDisplayStart;
  2246. this.s.print.saveLength = oSetDT._iDisplayLength;
  2247. if ( oConfig.bShowAll )
  2248. {
  2249. oSetDT._iDisplayStart = 0;
  2250. oSetDT._iDisplayLength = -1;
  2251. if ( oSetDT.oApi._fnCalculateEnd ) {
  2252. oSetDT.oApi._fnCalculateEnd( oSetDT );
  2253. }
  2254. oSetDT.oApi._fnDraw( oSetDT );
  2255. }
  2256. /* Adjust the display for scrolling which might be done by DataTables */
  2257. if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" )
  2258. {
  2259. this._fnPrintScrollStart( oSetDT );
  2260. // If the table redraws while in print view, the DataTables scrolling
  2261. // setup would hide the header, so we need to readd it on draw
  2262. $(this.s.dt.nTable).bind('draw.DTTT_Print', function () {
  2263. that._fnPrintScrollStart( oSetDT );
  2264. } );
  2265. }
  2266. /* Remove the other DataTables feature nodes - but leave the table! and info div */
  2267. var anFeature = oSetDT.aanFeatures;
  2268. for ( var cFeature in anFeature )
  2269. {
  2270. if ( cFeature != 'i' && cFeature != 't' && cFeature.length == 1 )
  2271. {
  2272. for ( var i=0, iLen=anFeature[cFeature].length ; i<iLen ; i++ )
  2273. {
  2274. this.dom.print.hidden.push( {
  2275. "node": anFeature[cFeature][i],
  2276. "display": "block"
  2277. } );
  2278. anFeature[cFeature][i].style.display = "none";
  2279. }
  2280. }
  2281. }
  2282. /* Print class can be used for styling */
  2283. $(document.body).addClass( this.classes.print.body );
  2284. /* Show information message to let the user know what is happening */
  2285. if ( oConfig.sInfo !== "" )
  2286. {
  2287. this.fnInfo( oConfig.sInfo, 3000 );
  2288. }
  2289. /* Add a message at the top of the page */
  2290. if ( oConfig.sMessage )
  2291. {
  2292. $('<div/>')
  2293. .addClass( this.classes.print.message )
  2294. .html( oConfig.sMessage )
  2295. .prependTo( 'body' );
  2296. }
  2297. /* Cache the scrolling and the jump to the top of the page */
  2298. this.s.print.saveScroll = $(window).scrollTop();
  2299. window.scrollTo( 0, 0 );
  2300. /* Bind a key event listener to the document for the escape key -
  2301. * it is removed in the callback
  2302. */
  2303. $(document).bind( "keydown.DTTT", function(e) {
  2304. /* Only interested in the escape key */
  2305. if ( e.keyCode == 27 )
  2306. {
  2307. e.preventDefault();
  2308. that._fnPrintEnd.call( that, e );
  2309. }
  2310. } );
  2311. },
  2312. /**
  2313. * Printing is finished, resume normal display
  2314. * @method _fnPrintEnd
  2315. * @param {Event} e Event object
  2316. * @returns void
  2317. * @private
  2318. */
  2319. "_fnPrintEnd": function ( e )
  2320. {
  2321. var that = this;
  2322. var oSetDT = this.s.dt;
  2323. var oSetPrint = this.s.print;
  2324. var oDomPrint = this.dom.print;
  2325. /* Show all hidden nodes */
  2326. this._fnPrintShowNodes();
  2327. /* Restore DataTables' scrolling */
  2328. if ( oSetDT.oScroll.sX !== "" || oSetDT.oScroll.sY !== "" )
  2329. {
  2330. $(this.s.dt.nTable).unbind('draw.DTTT_Print');
  2331. this._fnPrintScrollEnd();
  2332. }
  2333. /* Restore the scroll */
  2334. window.scrollTo( 0, oSetPrint.saveScroll );
  2335. /* Drop the print message */
  2336. $('div.'+this.classes.print.message).remove();
  2337. /* Styling class */
  2338. $(document.body).removeClass( 'DTTT_Print' );
  2339. /* Restore the table length */
  2340. oSetDT._iDisplayStart = oSetPrint.saveStart;
  2341. oSetDT._iDisplayLength = oSetPrint.saveLength;
  2342. if ( oSetDT.oApi._fnCalculateEnd ) {
  2343. oSetDT.oApi._fnCalculateEnd( oSetDT );
  2344. }
  2345. oSetDT.oApi._fnDraw( oSetDT );
  2346. $(document).unbind( "keydown.DTTT" );
  2347. },
  2348. /**
  2349. * Take account of scrolling in DataTables by showing the full table
  2350. * @returns void
  2351. * @private
  2352. */
  2353. "_fnPrintScrollStart": function ()
  2354. {
  2355. var
  2356. oSetDT = this.s.dt,
  2357. nScrollHeadInner = oSetDT.nScrollHead.getElementsByTagName('div')[0],
  2358. nScrollHeadTable = nScrollHeadInner.getElementsByTagName('table')[0],
  2359. nScrollBody = oSetDT.nTable.parentNode,
  2360. nTheadSize, nTfootSize;
  2361. /* Copy the header in the thead in the body table, this way we show one single table when
  2362. * in print view. Note that this section of code is more or less verbatim from DT 1.7.0
  2363. */
  2364. nTheadSize = oSetDT.nTable.getElementsByTagName('thead');
  2365. if ( nTheadSize.length > 0 )
  2366. {
  2367. oSetDT.nTable.removeChild( nTheadSize[0] );
  2368. }
  2369. if ( oSetDT.nTFoot !== null )
  2370. {
  2371. nTfootSize = oSetDT.nTable.getElementsByTagName('tfoot');
  2372. if ( nTfootSize.length > 0 )
  2373. {
  2374. oSetDT.nTable.removeChild( nTfootSize[0] );
  2375. }
  2376. }
  2377. nTheadSize = oSetDT.nTHead.cloneNode(true);
  2378. oSetDT.nTable.insertBefore( nTheadSize, oSetDT.nTable.childNodes[0] );
  2379. if ( oSetDT.nTFoot !== null )
  2380. {
  2381. nTfootSize = oSetDT.nTFoot.cloneNode(true);
  2382. oSetDT.nTable.insertBefore( nTfootSize, oSetDT.nTable.childNodes[1] );
  2383. }
  2384. /* Now adjust the table's viewport so we can actually see it */
  2385. if ( oSetDT.oScroll.sX !== "" )
  2386. {
  2387. oSetDT.nTable.style.width = $(oSetDT.nTable).outerWidth()+"px";
  2388. nScrollBody.style.width = $(oSetDT.nTable).outerWidth()+"px";
  2389. nScrollBody.style.overflow = "visible";
  2390. }
  2391. if ( oSetDT.oScroll.sY !== "" )
  2392. {
  2393. nScrollBody.style.height = $(oSetDT.nTable).outerHeight()+"px";
  2394. nScrollBody.style.overflow = "visible";
  2395. }
  2396. },
  2397. /**
  2398. * Take account of scrolling in DataTables by showing the full table. Note that the redraw of
  2399. * the DataTable that we do will actually deal with the majority of the hard work here
  2400. * @returns void
  2401. * @private
  2402. */
  2403. "_fnPrintScrollEnd": function ()
  2404. {
  2405. var
  2406. oSetDT = this.s.dt,
  2407. nScrollBody = oSetDT.nTable.parentNode;
  2408. if ( oSetDT.oScroll.sX !== "" )
  2409. {
  2410. nScrollBody.style.width = oSetDT.oApi._fnStringToCss( oSetDT.oScroll.sX );
  2411. nScrollBody.style.overflow = "auto";
  2412. }
  2413. if ( oSetDT.oScroll.sY !== "" )
  2414. {
  2415. nScrollBody.style.height = oSetDT.oApi._fnStringToCss( oSetDT.oScroll.sY );
  2416. nScrollBody.style.overflow = "auto";
  2417. }
  2418. },
  2419. /**
  2420. * Resume the display of all TableTools hidden nodes
  2421. * @method _fnPrintShowNodes
  2422. * @returns void
  2423. * @private
  2424. */
  2425. "_fnPrintShowNodes": function ( )
  2426. {
  2427. var anHidden = this.dom.print.hidden;
  2428. for ( var i=0, iLen=anHidden.length ; i<iLen ; i++ )
  2429. {
  2430. anHidden[i].node.style.display = anHidden[i].display;
  2431. }
  2432. anHidden.splice( 0, anHidden.length );
  2433. },
  2434. /**
  2435. * Hide nodes which are not needed in order to display the table. Note that this function is
  2436. * recursive
  2437. * @method _fnPrintHideNodes
  2438. * @param {Node} nNode Element which should be showing in a 'print' display
  2439. * @returns void
  2440. * @private
  2441. */
  2442. "_fnPrintHideNodes": function ( nNode )
  2443. {
  2444. var anHidden = this.dom.print.hidden;
  2445. var nParent = nNode.parentNode;
  2446. var nChildren = nParent.childNodes;
  2447. for ( var i=0, iLen=nChildren.length ; i<iLen ; i++ )
  2448. {
  2449. if ( nChildren[i] != nNode && nChildren[i].nodeType == 1 )
  2450. {
  2451. /* If our node is shown (don't want to show nodes which were previously hidden) */
  2452. var sDisplay = $(nChildren[i]).css("display");
  2453. if ( sDisplay != "none" )
  2454. {
  2455. /* Cache the node and it's previous state so we can restore it */
  2456. anHidden.push( {
  2457. "node": nChildren[i],
  2458. "display": sDisplay
  2459. } );
  2460. nChildren[i].style.display = "none";
  2461. }
  2462. }
  2463. }
  2464. if ( nParent.nodeName.toUpperCase() != "BODY" )
  2465. {
  2466. this._fnPrintHideNodes( nParent );
  2467. }
  2468. }
  2469. };
  2470. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2471. * Static variables
  2472. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2473. /**
  2474. * Store of all instances that have been created of TableTools, so one can look up other (when
  2475. * there is need of a master)
  2476. * @property _aInstances
  2477. * @type Array
  2478. * @default []
  2479. * @private
  2480. */
  2481. TableTools._aInstances = [];
  2482. /**
  2483. * Store of all listeners and their callback functions
  2484. * @property _aListeners
  2485. * @type Array
  2486. * @default []
  2487. */
  2488. TableTools._aListeners = [];
  2489. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2490. * Static methods
  2491. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2492. /**
  2493. * Get an array of all the master instances
  2494. * @method fnGetMasters
  2495. * @returns {Array} List of master TableTools instances
  2496. * @static
  2497. */
  2498. TableTools.fnGetMasters = function ()
  2499. {
  2500. var a = [];
  2501. for ( var i=0, iLen=TableTools._aInstances.length ; i<iLen ; i++ )
  2502. {
  2503. if ( TableTools._aInstances[i].s.master )
  2504. {
  2505. a.push( TableTools._aInstances[i] );
  2506. }
  2507. }
  2508. return a;
  2509. };
  2510. /**
  2511. * Get the master instance for a table node (or id if a string is given)
  2512. * @method fnGetInstance
  2513. * @returns {Object} ID of table OR table node, for which we want the TableTools instance
  2514. * @static
  2515. */
  2516. TableTools.fnGetInstance = function ( node )
  2517. {
  2518. if ( typeof node != 'object' )
  2519. {
  2520. node = document.getElementById(node);
  2521. }
  2522. for ( var i=0, iLen=TableTools._aInstances.length ; i<iLen ; i++ )
  2523. {
  2524. if ( TableTools._aInstances[i].s.master && TableTools._aInstances[i].dom.table == node )
  2525. {
  2526. return TableTools._aInstances[i];
  2527. }
  2528. }
  2529. return null;
  2530. };
  2531. /**
  2532. * Add a listener for a specific event
  2533. * @method _fnEventListen
  2534. * @param {Object} that Scope of the listening function (i.e. 'this' in the caller)
  2535. * @param {String} type Event type
  2536. * @param {Function} fn Function
  2537. * @returns void
  2538. * @private
  2539. * @static
  2540. */
  2541. TableTools._fnEventListen = function ( that, type, fn )
  2542. {
  2543. TableTools._aListeners.push( {
  2544. "that": that,
  2545. "type": type,
  2546. "fn": fn
  2547. } );
  2548. };
  2549. /**
  2550. * An event has occurred - look up every listener and fire it off. We check that the event we are
  2551. * going to fire is attached to the same table (using the table node as reference) before firing
  2552. * @method _fnEventDispatch
  2553. * @param {Object} that Scope of the listening function (i.e. 'this' in the caller)
  2554. * @param {String} type Event type
  2555. * @param {Node} node Element that the event occurred on (may be null)
  2556. * @param {boolean} [selected] Indicate if the node was selected (true) or deselected (false)
  2557. * @returns void
  2558. * @private
  2559. * @static
  2560. */
  2561. TableTools._fnEventDispatch = function ( that, type, node, selected )
  2562. {
  2563. var listeners = TableTools._aListeners;
  2564. for ( var i=0, iLen=listeners.length ; i<iLen ; i++ )
  2565. {
  2566. if ( that.dom.table == listeners[i].that.dom.table && listeners[i].type == type )
  2567. {
  2568. listeners[i].fn( node, selected );
  2569. }
  2570. }
  2571. };
  2572. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2573. * Constants
  2574. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2575. TableTools.buttonBase = {
  2576. // Button base
  2577. "sAction": "text",
  2578. "sTag": "default",
  2579. "sLinerTag": "default",
  2580. "sButtonClass": "DTTT_button_text",
  2581. "sButtonText": "Button text",
  2582. "sTitle": "",
  2583. "sToolTip": "",
  2584. // Common button specific options
  2585. "sCharSet": "utf8",
  2586. "bBomInc": false,
  2587. "sFileName": "*.csv",
  2588. "sFieldBoundary": "",
  2589. "sFieldSeperator": "\t",
  2590. "sNewLine": "auto",
  2591. "mColumns": "all", /* "all", "visible", "hidden" or array of column integers */
  2592. "bHeader": true,
  2593. "bFooter": true,
  2594. "bOpenRows": false,
  2595. "bSelectedOnly": false,
  2596. "oSelectorOpts": undefined, // See http://datatables.net/docs/DataTables/1.9.4/#$ for full options
  2597. // Callbacks
  2598. "fnMouseover": null,
  2599. "fnMouseout": null,
  2600. "fnClick": null,
  2601. "fnSelect": null,
  2602. "fnComplete": null,
  2603. "fnInit": null,
  2604. "fnCellRender": null
  2605. };
  2606. /**
  2607. * @namespace Default button configurations
  2608. */
  2609. TableTools.BUTTONS = {
  2610. "csv": $.extend( {}, TableTools.buttonBase, {
  2611. "sAction": "flash_save",
  2612. "sButtonClass": "DTTT_button_csv",
  2613. "sButtonText": "CSV",
  2614. "sFieldBoundary": '"',
  2615. "sFieldSeperator": ",",
  2616. "fnClick": function( nButton, oConfig, flash ) {
  2617. this.fnSetText( flash, this.fnGetTableData(oConfig) );
  2618. }
  2619. } ),
  2620. "xls": $.extend( {}, TableTools.buttonBase, {
  2621. "sAction": "flash_save",
  2622. "sCharSet": "utf16le",
  2623. "bBomInc": true,
  2624. "sButtonClass": "DTTT_button_xls",
  2625. "sButtonText": "Excel",
  2626. "fnClick": function( nButton, oConfig, flash ) {
  2627. this.fnSetText( flash, this.fnGetTableData(oConfig) );
  2628. }
  2629. } ),
  2630. "copy": $.extend( {}, TableTools.buttonBase, {
  2631. "sAction": "flash_copy",
  2632. "sButtonClass": "DTTT_button_copy",
  2633. "sButtonText": "Copy",
  2634. "fnClick": function( nButton, oConfig, flash ) {
  2635. this.fnSetText( flash, this.fnGetTableData(oConfig) );
  2636. },
  2637. "fnComplete": function(nButton, oConfig, flash, text) {
  2638. var lines = text.split('\n').length;
  2639. if (oConfig.bHeader) lines--;
  2640. if (this.s.dt.nTFoot !== null && oConfig.bFooter) lines--;
  2641. var plural = (lines==1) ? "" : "s";
  2642. this.fnInfo( '<h6>Table copied</h6>'+
  2643. '<p>Copied '+lines+' row'+plural+' to the clipboard.</p>',
  2644. 1500
  2645. );
  2646. }
  2647. } ),
  2648. "pdf": $.extend( {}, TableTools.buttonBase, {
  2649. "sAction": "flash_pdf",
  2650. "sNewLine": "\n",
  2651. "sFileName": "*.pdf",
  2652. "sButtonClass": "DTTT_button_pdf",
  2653. "sButtonText": "PDF",
  2654. "sPdfOrientation": "portrait",
  2655. "sPdfSize": "A4",
  2656. "sPdfMessage": "",
  2657. "fnClick": function( nButton, oConfig, flash ) {
  2658. this.fnSetText( flash,
  2659. "title:"+ this.fnGetTitle(oConfig) +"\n"+
  2660. "message:"+ oConfig.sPdfMessage +"\n"+
  2661. "colWidth:"+ this.fnCalcColRatios(oConfig) +"\n"+
  2662. "orientation:"+ oConfig.sPdfOrientation +"\n"+
  2663. "size:"+ oConfig.sPdfSize +"\n"+
  2664. "--/TableToolsOpts--\n" +
  2665. this.fnGetTableData(oConfig)
  2666. );
  2667. }
  2668. } ),
  2669. "print": $.extend( {}, TableTools.buttonBase, {
  2670. "sInfo": "<h6>Print view</h6><p>Please use your browser's print function to "+
  2671. "print this table. Press escape when finished.</p>",
  2672. "sMessage": null,
  2673. "bShowAll": true,
  2674. "sToolTip": "View print view",
  2675. "sButtonClass": "DTTT_button_print",
  2676. "sButtonText": "Print",
  2677. "fnClick": function ( nButton, oConfig ) {
  2678. this.fnPrint( true, oConfig );
  2679. }
  2680. } ),
  2681. "text": $.extend( {}, TableTools.buttonBase ),
  2682. "select": $.extend( {}, TableTools.buttonBase, {
  2683. "sButtonText": "Select button",
  2684. "fnSelect": function( nButton, oConfig ) {
  2685. if ( this.fnGetSelected().length !== 0 ) {
  2686. $(nButton).removeClass( this.classes.buttons.disabled );
  2687. } else {
  2688. $(nButton).addClass( this.classes.buttons.disabled );
  2689. }
  2690. },
  2691. "fnInit": function( nButton, oConfig ) {
  2692. $(nButton).addClass( this.classes.buttons.disabled );
  2693. }
  2694. } ),
  2695. "select_single": $.extend( {}, TableTools.buttonBase, {
  2696. "sButtonText": "Select button",
  2697. "fnSelect": function( nButton, oConfig ) {
  2698. var iSelected = this.fnGetSelected().length;
  2699. if ( iSelected == 1 ) {
  2700. $(nButton).removeClass( this.classes.buttons.disabled );
  2701. } else {
  2702. $(nButton).addClass( this.classes.buttons.disabled );
  2703. }
  2704. },
  2705. "fnInit": function( nButton, oConfig ) {
  2706. $(nButton).addClass( this.classes.buttons.disabled );
  2707. }
  2708. } ),
  2709. "select_all": $.extend( {}, TableTools.buttonBase, {
  2710. "sButtonText": "Select all",
  2711. "fnClick": function( nButton, oConfig ) {
  2712. this.fnSelectAll();
  2713. },
  2714. "fnSelect": function( nButton, oConfig ) {
  2715. if ( this.fnGetSelected().length == this.s.dt.fnRecordsDisplay() ) {
  2716. $(nButton).addClass( this.classes.buttons.disabled );
  2717. } else {
  2718. $(nButton).removeClass( this.classes.buttons.disabled );
  2719. }
  2720. }
  2721. } ),
  2722. "select_none": $.extend( {}, TableTools.buttonBase, {
  2723. "sButtonText": "Deselect all",
  2724. "fnClick": function( nButton, oConfig ) {
  2725. this.fnSelectNone();
  2726. },
  2727. "fnSelect": function( nButton, oConfig ) {
  2728. if ( this.fnGetSelected().length !== 0 ) {
  2729. $(nButton).removeClass( this.classes.buttons.disabled );
  2730. } else {
  2731. $(nButton).addClass( this.classes.buttons.disabled );
  2732. }
  2733. },
  2734. "fnInit": function( nButton, oConfig ) {
  2735. $(nButton).addClass( this.classes.buttons.disabled );
  2736. }
  2737. } ),
  2738. "ajax": $.extend( {}, TableTools.buttonBase, {
  2739. "sAjaxUrl": "/xhr.php",
  2740. "sButtonText": "Ajax button",
  2741. "fnClick": function( nButton, oConfig ) {
  2742. var sData = this.fnGetTableData(oConfig);
  2743. $.ajax( {
  2744. "url": oConfig.sAjaxUrl,
  2745. "data": [
  2746. { "name": "tableData", "value": sData }
  2747. ],
  2748. "success": oConfig.fnAjaxComplete,
  2749. "dataType": "json",
  2750. "type": "POST",
  2751. "cache": false,
  2752. "error": function () {
  2753. alert( "Error detected when sending table data to server" );
  2754. }
  2755. } );
  2756. },
  2757. "fnAjaxComplete": function( json ) {
  2758. alert( 'Ajax complete' );
  2759. }
  2760. } ),
  2761. "div": $.extend( {}, TableTools.buttonBase, {
  2762. "sAction": "div",
  2763. "sTag": "div",
  2764. "sButtonClass": "DTTT_nonbutton",
  2765. "sButtonText": "Text button"
  2766. } ),
  2767. "collection": $.extend( {}, TableTools.buttonBase, {
  2768. "sAction": "collection",
  2769. "sButtonClass": "DTTT_button_collection",
  2770. "sButtonText": "Collection",
  2771. "fnClick": function( nButton, oConfig ) {
  2772. this._fnCollectionShow(nButton, oConfig);
  2773. }
  2774. } )
  2775. };
  2776. /*
  2777. * on* callback parameters:
  2778. * 1. node - button element
  2779. * 2. object - configuration object for this button
  2780. * 3. object - ZeroClipboard reference (flash button only)
  2781. * 4. string - Returned string from Flash (flash button only - and only on 'complete')
  2782. */
  2783. // Alias to match the other plug-ins styling
  2784. TableTools.buttons = TableTools.BUTTONS;
  2785. /**
  2786. * @namespace Classes used by TableTools - allows the styles to be override easily.
  2787. * Note that when TableTools initialises it will take a copy of the classes object
  2788. * and will use its internal copy for the remainder of its run time.
  2789. */
  2790. TableTools.classes = {
  2791. "container": "DTTT_container",
  2792. "buttons": {
  2793. "normal": "DTTT_button",
  2794. "disabled": "DTTT_disabled"
  2795. },
  2796. "collection": {
  2797. "container": "DTTT_collection",
  2798. "background": "DTTT_collection_background",
  2799. "buttons": {
  2800. "normal": "DTTT_button",
  2801. "disabled": "DTTT_disabled"
  2802. }
  2803. },
  2804. "select": {
  2805. "table": "DTTT_selectable",
  2806. "row": "DTTT_selected selected"
  2807. },
  2808. "print": {
  2809. "body": "DTTT_Print",
  2810. "info": "DTTT_print_info",
  2811. "message": "DTTT_PrintMessage"
  2812. }
  2813. };
  2814. /**
  2815. * @namespace ThemeRoller classes - built in for compatibility with DataTables'
  2816. * bJQueryUI option.
  2817. */
  2818. TableTools.classes_themeroller = {
  2819. "container": "DTTT_container ui-buttonset ui-buttonset-multi",
  2820. "buttons": {
  2821. "normal": "DTTT_button ui-button ui-state-default"
  2822. },
  2823. "collection": {
  2824. "container": "DTTT_collection ui-buttonset ui-buttonset-multi"
  2825. }
  2826. };
  2827. /**
  2828. * @namespace TableTools default settings for initialisation
  2829. */
  2830. TableTools.DEFAULTS = {
  2831. "sSwfPath": "../swf/copy_csv_xls_pdf.swf",
  2832. "sRowSelect": "none",
  2833. "sRowSelector": "tr",
  2834. "sSelectedClass": null,
  2835. "fnPreRowSelect": null,
  2836. "fnRowSelected": null,
  2837. "fnRowDeselected": null,
  2838. "aButtons": [ "copy", "csv", "xls", "pdf", "print" ],
  2839. "oTags": {
  2840. "container": "div",
  2841. "button": "a", // We really want to use buttons here, but Firefox and IE ignore the
  2842. // click on the Flash element in the button (but not mouse[in|out]).
  2843. "liner": "span",
  2844. "collection": {
  2845. "container": "div",
  2846. "button": "a",
  2847. "liner": "span"
  2848. }
  2849. }
  2850. };
  2851. // Alias to match the other plug-ins
  2852. TableTools.defaults = TableTools.DEFAULTS;
  2853. /**
  2854. * Name of this class
  2855. * @constant CLASS
  2856. * @type String
  2857. * @default TableTools
  2858. */
  2859. TableTools.prototype.CLASS = "TableTools";
  2860. /**
  2861. * TableTools version
  2862. * @constant VERSION
  2863. * @type String
  2864. * @default See code
  2865. */
  2866. TableTools.version = "2.2.4";
  2867. // DataTables 1.10 API
  2868. //
  2869. // This will be extended in a big way in in TableTools 3 to provide API methods
  2870. // such as rows().select() and rows.selected() etc, but for the moment the
  2871. // tabletools() method simply returns the instance.
  2872. if ( $.fn.dataTable.Api ) {
  2873. $.fn.dataTable.Api.register( 'tabletools()', function () {
  2874. var tt = null;
  2875. if ( this.context.length > 0 ) {
  2876. tt = TableTools.fnGetInstance( this.context[0].nTable );
  2877. }
  2878. return tt;
  2879. } );
  2880. }
  2881. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2882. * Initialisation
  2883. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2884. /*
  2885. * Register a new feature with DataTables
  2886. */
  2887. if ( typeof $.fn.dataTable == "function" &&
  2888. typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
  2889. $.fn.dataTableExt.fnVersionCheck('1.9.0') )
  2890. {
  2891. $.fn.dataTableExt.aoFeatures.push( {
  2892. "fnInit": function( oDTSettings ) {
  2893. var init = oDTSettings.oInit;
  2894. var opts = init ?
  2895. init.tableTools || init.oTableTools || {} :
  2896. {};
  2897. return new TableTools( oDTSettings.oInstance, opts ).dom.container;
  2898. },
  2899. "cFeature": "T",
  2900. "sFeature": "TableTools"
  2901. } );
  2902. }
  2903. else
  2904. {
  2905. alert( "Warning: TableTools requires DataTables 1.9.0 or newer - www.datatables.net/download");
  2906. }
  2907. $.fn.DataTable.TableTools = TableTools;
  2908. })(jQuery, window, document);
  2909. /*
  2910. * Register a new feature with DataTables
  2911. */
  2912. if ( typeof $.fn.dataTable == "function" &&
  2913. typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
  2914. $.fn.dataTableExt.fnVersionCheck('1.9.0') )
  2915. {
  2916. $.fn.dataTableExt.aoFeatures.push( {
  2917. "fnInit": function( oDTSettings ) {
  2918. var oOpts = typeof oDTSettings.oInit.oTableTools != 'undefined' ?
  2919. oDTSettings.oInit.oTableTools : {};
  2920. var oTT = new TableTools( oDTSettings.oInstance, oOpts );
  2921. TableTools._aInstances.push( oTT );
  2922. return oTT.dom.container;
  2923. },
  2924. "cFeature": "T",
  2925. "sFeature": "TableTools"
  2926. } );
  2927. }
  2928. else
  2929. {
  2930. alert( "Warning: TableTools 2 requires DataTables 1.9.0 or newer - www.datatables.net/download");
  2931. }
  2932. $.fn.dataTable.TableTools = TableTools;
  2933. $.fn.DataTable.TableTools = TableTools;
  2934. return TableTools;
  2935. }; // /factory
  2936. // Define as an AMD module if possible
  2937. if ( typeof define === 'function' && define.amd ) {
  2938. define( ['jquery', 'datatables'], factory );
  2939. }
  2940. else if ( typeof exports === 'object' ) {
  2941. // Node/CommonJS
  2942. factory( require('jquery'), require('datatables') );
  2943. }
  2944. else if ( jQuery && !jQuery.fn.dataTable.TableTools ) {
  2945. // Otherwise simply initialise as normal, stopping multiple evaluation
  2946. factory( jQuery, jQuery.fn.dataTable );
  2947. }
  2948. })(window, document);
  2949. /*! ColVis 1.1.2
  2950. * ©2010-2015 SpryMedia Ltd - datatables.net/license
  2951. */
  2952. /**
  2953. * @summary ColVis
  2954. * @description Controls for column visibility in DataTables
  2955. * @version 1.1.2
  2956. * @file dataTables.colReorder.js
  2957. * @author SpryMedia Ltd (www.sprymedia.co.uk)
  2958. * @contact www.sprymedia.co.uk/contact
  2959. * @copyright Copyright 2010-2015 SpryMedia Ltd.
  2960. *
  2961. * This source file is free software, available under the following license:
  2962. * MIT license - http://datatables.net/license/mit
  2963. *
  2964. * This source file is distributed in the hope that it will be useful, but
  2965. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  2966. * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
  2967. *
  2968. * For details please refer to: http://www.datatables.net
  2969. */
  2970. (function(window, document, undefined) {
  2971. var factory = function( $, DataTable ) {
  2972. "use strict";
  2973. /**
  2974. * ColVis provides column visibility control for DataTables
  2975. *
  2976. * @class ColVis
  2977. * @constructor
  2978. * @param {object} DataTables settings object. With DataTables 1.10 this can
  2979. * also be and API instance, table node, jQuery collection or jQuery selector.
  2980. * @param {object} ColVis configuration options
  2981. */
  2982. var ColVis = function( oDTSettings, oInit )
  2983. {
  2984. /* Santiy check that we are a new instance */
  2985. if ( !this.CLASS || this.CLASS != "ColVis" )
  2986. {
  2987. alert( "Warning: ColVis must be initialised with the keyword 'new'" );
  2988. }
  2989. if ( typeof oInit == 'undefined' )
  2990. {
  2991. oInit = {};
  2992. }
  2993. var camelToHungarian = $.fn.dataTable.camelToHungarian;
  2994. if ( camelToHungarian ) {
  2995. camelToHungarian( ColVis.defaults, ColVis.defaults, true );
  2996. camelToHungarian( ColVis.defaults, oInit );
  2997. }
  2998. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2999. * Public class variables
  3000. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  3001. /**
  3002. * @namespace Settings object which contains customisable information for
  3003. * ColVis instance. Augmented by ColVis.defaults
  3004. */
  3005. this.s = {
  3006. /**
  3007. * DataTables settings object
  3008. * @property dt
  3009. * @type Object
  3010. * @default null
  3011. */
  3012. "dt": null,
  3013. /**
  3014. * Customisation object
  3015. * @property oInit
  3016. * @type Object
  3017. * @default passed in
  3018. */
  3019. "oInit": oInit,
  3020. /**
  3021. * Flag to say if the collection is hidden
  3022. * @property hidden
  3023. * @type boolean
  3024. * @default true
  3025. */
  3026. "hidden": true,
  3027. /**
  3028. * Store the original visibility settings so they could be restored
  3029. * @property abOriginal
  3030. * @type Array
  3031. * @default []
  3032. */
  3033. "abOriginal": []
  3034. };
  3035. /**
  3036. * @namespace Common and useful DOM elements for the class instance
  3037. */
  3038. this.dom = {
  3039. /**
  3040. * Wrapper for the button - given back to DataTables as the node to insert
  3041. * @property wrapper
  3042. * @type Node
  3043. * @default null
  3044. */
  3045. "wrapper": null,
  3046. /**
  3047. * Activation button
  3048. * @property button
  3049. * @type Node
  3050. * @default null
  3051. */
  3052. "button": null,
  3053. /**
  3054. * Collection list node
  3055. * @property collection
  3056. * @type Node
  3057. * @default null
  3058. */
  3059. "collection": null,
  3060. /**
  3061. * Background node used for shading the display and event capturing
  3062. * @property background
  3063. * @type Node
  3064. * @default null
  3065. */
  3066. "background": null,
  3067. /**
  3068. * Element to position over the activation button to catch mouse events when using mouseover
  3069. * @property catcher
  3070. * @type Node
  3071. * @default null
  3072. */
  3073. "catcher": null,
  3074. /**
  3075. * List of button elements
  3076. * @property buttons
  3077. * @type Array
  3078. * @default []
  3079. */
  3080. "buttons": [],
  3081. /**
  3082. * List of group button elements
  3083. * @property groupButtons
  3084. * @type Array
  3085. * @default []
  3086. */
  3087. "groupButtons": [],
  3088. /**
  3089. * Restore button
  3090. * @property restore
  3091. * @type Node
  3092. * @default null
  3093. */
  3094. "restore": null
  3095. };
  3096. /* Store global reference */
  3097. ColVis.aInstances.push( this );
  3098. /* Constructor logic */
  3099. this.s.dt = $.fn.dataTable.Api ?
  3100. new $.fn.dataTable.Api( oDTSettings ).settings()[0] :
  3101. oDTSettings;
  3102. this._fnConstruct( oInit );
  3103. return this;
  3104. };
  3105. ColVis.prototype = {
  3106. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  3107. * Public methods
  3108. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  3109. /**
  3110. * Get the ColVis instance's control button so it can be injected into the
  3111. * DOM
  3112. * @method button
  3113. * @returns {node} ColVis button
  3114. */
  3115. button: function ()
  3116. {
  3117. return this.dom.wrapper;
  3118. },
  3119. /**
  3120. * Alias of `rebuild` for backwards compatibility
  3121. * @method fnRebuild
  3122. */
  3123. "fnRebuild": function ()
  3124. {
  3125. this.rebuild();
  3126. },
  3127. /**
  3128. * Rebuild the list of buttons for this instance (i.e. if there is a column
  3129. * header update)
  3130. * @method fnRebuild
  3131. */
  3132. rebuild: function ()
  3133. {
  3134. /* Remove the old buttons */
  3135. for ( var i=this.dom.buttons.length-1 ; i>=0 ; i-- ) {
  3136. this.dom.collection.removeChild( this.dom.buttons[i] );
  3137. }
  3138. this.dom.buttons.splice( 0, this.dom.buttons.length );
  3139. this.dom.groupButtons.splice(0, this.dom.groupButtons.length);
  3140. if ( this.dom.restore ) {
  3141. this.dom.restore.parentNode( this.dom.restore );
  3142. }
  3143. /* Re-add them (this is not the optimal way of doing this, it is fast and effective) */
  3144. this._fnAddGroups();
  3145. this._fnAddButtons();
  3146. /* Update the checkboxes */
  3147. this._fnDrawCallback();
  3148. },
  3149. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  3150. * Private methods (they are of course public in JS, but recommended as private)
  3151. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  3152. /**
  3153. * Constructor logic
  3154. * @method _fnConstruct
  3155. * @returns void
  3156. * @private
  3157. */
  3158. "_fnConstruct": function ( init )
  3159. {
  3160. this._fnApplyCustomisation( init );
  3161. var that = this;
  3162. var i, iLen;
  3163. this.dom.wrapper = document.createElement('div');
  3164. this.dom.wrapper.className = "ColVis";
  3165. this.dom.button = $( '<button />', {
  3166. 'class': !this.s.dt.bJUI ?
  3167. "ColVis_Button ColVis_MasterButton" :
  3168. "ColVis_Button ColVis_MasterButton ui-button ui-state-default"
  3169. } )
  3170. .append( '<span>'+this.s.buttonText+'</span>' )
  3171. .bind( this.s.activate=="mouseover" ? "mouseover" : "click", function (e) {
  3172. e.preventDefault();
  3173. that._fnCollectionShow();
  3174. } )
  3175. .appendTo( this.dom.wrapper )[0];
  3176. this.dom.catcher = this._fnDomCatcher();
  3177. this.dom.collection = this._fnDomCollection();
  3178. this.dom.background = this._fnDomBackground();
  3179. this._fnAddGroups();
  3180. this._fnAddButtons();
  3181. /* Store the original visibility information */
  3182. for ( i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
  3183. {
  3184. this.s.abOriginal.push( this.s.dt.aoColumns[i].bVisible );
  3185. }
  3186. /* Update on each draw */
  3187. this.s.dt.aoDrawCallback.push( {
  3188. "fn": function () {
  3189. that._fnDrawCallback.call( that );
  3190. },
  3191. "sName": "ColVis"
  3192. } );
  3193. /* If columns are reordered, then we need to update our exclude list and
  3194. * rebuild the displayed list
  3195. */
  3196. $(this.s.dt.oInstance).bind( 'column-reorder.dt', function ( e, oSettings, oReorder ) {
  3197. for ( i=0, iLen=that.s.aiExclude.length ; i<iLen ; i++ ) {
  3198. that.s.aiExclude[i] = oReorder.aiInvertMapping[ that.s.aiExclude[i] ];
  3199. }
  3200. var mStore = that.s.abOriginal.splice( oReorder.iFrom, 1 )[0];
  3201. that.s.abOriginal.splice( oReorder.iTo, 0, mStore );
  3202. that.fnRebuild();
  3203. } );
  3204. $(this.s.dt.oInstance).bind( 'destroy.dt', function () {
  3205. $(that.dom.wrapper).remove();
  3206. } );
  3207. // Set the initial state
  3208. this._fnDrawCallback();
  3209. },
  3210. /**
  3211. * Apply any customisation to the settings from the DataTables initialisation
  3212. * @method _fnApplyCustomisation
  3213. * @returns void
  3214. * @private
  3215. */
  3216. "_fnApplyCustomisation": function ( init )
  3217. {
  3218. $.extend( true, this.s, ColVis.defaults, init );
  3219. // Slightly messy overlap for the camelCase notation
  3220. if ( ! this.s.showAll && this.s.bShowAll ) {
  3221. this.s.showAll = this.s.sShowAll;
  3222. }
  3223. if ( ! this.s.restore && this.s.bRestore ) {
  3224. this.s.restore = this.s.sRestore;
  3225. }
  3226. // CamelCase to Hungarian for the column groups
  3227. var groups = this.s.groups;
  3228. var hungarianGroups = this.s.aoGroups;
  3229. if ( groups ) {
  3230. for ( var i=0, ien=groups.length ; i<ien ; i++ ) {
  3231. if ( groups[i].title ) {
  3232. hungarianGroups[i].sTitle = groups[i].title;
  3233. }
  3234. if ( groups[i].columns ) {
  3235. hungarianGroups[i].aiColumns = groups[i].columns;
  3236. }
  3237. }
  3238. }
  3239. },
  3240. /**
  3241. * On each table draw, check the visibility checkboxes as needed. This allows any process to
  3242. * update the table's column visibility and ColVis will still be accurate.
  3243. * @method _fnDrawCallback
  3244. * @returns void
  3245. * @private
  3246. */
  3247. "_fnDrawCallback": function ()
  3248. {
  3249. var columns = this.s.dt.aoColumns;
  3250. var buttons = this.dom.buttons;
  3251. var groups = this.s.aoGroups;
  3252. var button;
  3253. for ( var i=0, ien=buttons.length ; i<ien ; i++ ) {
  3254. button = buttons[i];
  3255. if ( button.__columnIdx !== undefined ) {
  3256. $('input', button).prop( 'checked', columns[ button.__columnIdx ].bVisible );
  3257. }
  3258. }
  3259. var allVisible = function ( columnIndeces ) {
  3260. for ( var k=0, kLen=columnIndeces.length ; k<kLen ; k++ )
  3261. {
  3262. if ( columns[columnIndeces[k]].bVisible === false ) { return false; }
  3263. }
  3264. return true;
  3265. };
  3266. var allHidden = function ( columnIndeces ) {
  3267. for ( var m=0 , mLen=columnIndeces.length ; m<mLen ; m++ )
  3268. {
  3269. if ( columns[columnIndeces[m]].bVisible === true ) { return false; }
  3270. }
  3271. return true;
  3272. };
  3273. for ( var j=0, jLen=groups.length ; j<jLen ; j++ )
  3274. {
  3275. if ( allVisible(groups[j].aiColumns) )
  3276. {
  3277. $('input', this.dom.groupButtons[j]).prop('checked', true);
  3278. $('input', this.dom.groupButtons[j]).prop('indeterminate', false);
  3279. }
  3280. else if ( allHidden(groups[j].aiColumns) )
  3281. {
  3282. $('input', this.dom.groupButtons[j]).prop('checked', false);
  3283. $('input', this.dom.groupButtons[j]).prop('indeterminate', false);
  3284. }
  3285. else
  3286. {
  3287. $('input', this.dom.groupButtons[j]).prop('indeterminate', true);
  3288. }
  3289. }
  3290. },
  3291. /**
  3292. * Loop through the groups (provided in the settings) and create a button for each.
  3293. * @method _fnAddgroups
  3294. * @returns void
  3295. * @private
  3296. */
  3297. "_fnAddGroups": function ()
  3298. {
  3299. var nButton;
  3300. if ( typeof this.s.aoGroups != 'undefined' )
  3301. {
  3302. for ( var i=0, iLen=this.s.aoGroups.length ; i<iLen ; i++ )
  3303. {
  3304. nButton = this._fnDomGroupButton( i );
  3305. this.dom.groupButtons.push( nButton );
  3306. this.dom.buttons.push( nButton );
  3307. this.dom.collection.appendChild( nButton );
  3308. }
  3309. }
  3310. },
  3311. /**
  3312. * Loop through the columns in the table and as a new button for each one.
  3313. * @method _fnAddButtons
  3314. * @returns void
  3315. * @private
  3316. */
  3317. "_fnAddButtons": function ()
  3318. {
  3319. var
  3320. nButton,
  3321. columns = this.s.dt.aoColumns;
  3322. if ( $.inArray( 'all', this.s.aiExclude ) === -1 ) {
  3323. for ( var i=0, iLen=columns.length ; i<iLen ; i++ )
  3324. {
  3325. if ( $.inArray( i, this.s.aiExclude ) === -1 )
  3326. {
  3327. nButton = this._fnDomColumnButton( i );
  3328. nButton.__columnIdx = i;
  3329. this.dom.buttons.push( nButton );
  3330. }
  3331. }
  3332. }
  3333. if ( this.s.order === 'alpha' ) {
  3334. this.dom.buttons.sort( function ( a, b ) {
  3335. var titleA = columns[ a.__columnIdx ].sTitle;
  3336. var titleB = columns[ b.__columnIdx ].sTitle;
  3337. return titleA === titleB ?
  3338. 0 :
  3339. titleA < titleB ?
  3340. -1 :
  3341. 1;
  3342. } );
  3343. }
  3344. if ( this.s.restore )
  3345. {
  3346. nButton = this._fnDomRestoreButton();
  3347. nButton.className += " ColVis_Restore";
  3348. this.dom.buttons.push( nButton );
  3349. }
  3350. if ( this.s.showAll )
  3351. {
  3352. nButton = this._fnDomShowXButton( this.s.showAll, true );
  3353. nButton.className += " ColVis_ShowAll";
  3354. this.dom.buttons.push( nButton );
  3355. }
  3356. if ( this.s.showNone )
  3357. {
  3358. nButton = this._fnDomShowXButton( this.s.showNone, false );
  3359. nButton.className += " ColVis_ShowNone";
  3360. this.dom.buttons.push( nButton );
  3361. }
  3362. $(this.dom.collection).append( this.dom.buttons );
  3363. },
  3364. /**
  3365. * Create a button which allows a "restore" action
  3366. * @method _fnDomRestoreButton
  3367. * @returns {Node} Created button
  3368. * @private
  3369. */
  3370. "_fnDomRestoreButton": function ()
  3371. {
  3372. var
  3373. that = this,
  3374. dt = this.s.dt;
  3375. return $(
  3376. '<li class="ColVis_Special '+(dt.bJUI ? 'ui-button ui-state-default' : '')+'">'+
  3377. this.s.restore+
  3378. '</li>'
  3379. )
  3380. .click( function (e) {
  3381. for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
  3382. {
  3383. that.s.dt.oInstance.fnSetColumnVis( i, that.s.abOriginal[i], false );
  3384. }
  3385. that._fnAdjustOpenRows();
  3386. that.s.dt.oInstance.fnAdjustColumnSizing( false );
  3387. that.s.dt.oInstance.fnDraw( false );
  3388. } )[0];
  3389. },
  3390. /**
  3391. * Create a button which allows show all and show node actions
  3392. * @method _fnDomShowXButton
  3393. * @returns {Node} Created button
  3394. * @private
  3395. */
  3396. "_fnDomShowXButton": function ( str, action )
  3397. {
  3398. var
  3399. that = this,
  3400. dt = this.s.dt;
  3401. return $(
  3402. '<li class="ColVis_Special '+(dt.bJUI ? 'ui-button ui-state-default' : '')+'">'+
  3403. str+
  3404. '</li>'
  3405. )
  3406. .click( function (e) {
  3407. for ( var i=0, iLen=that.s.abOriginal.length ; i<iLen ; i++ )
  3408. {
  3409. if (that.s.aiExclude.indexOf(i) === -1)
  3410. {
  3411. that.s.dt.oInstance.fnSetColumnVis( i, action, false );
  3412. }
  3413. }
  3414. that._fnAdjustOpenRows();
  3415. that.s.dt.oInstance.fnAdjustColumnSizing( false );
  3416. that.s.dt.oInstance.fnDraw( false );
  3417. } )[0];
  3418. },
  3419. /**
  3420. * Create the DOM for a show / hide group button
  3421. * @method _fnDomGroupButton
  3422. * @param {int} i Group in question, order based on that provided in settings
  3423. * @returns {Node} Created button
  3424. * @private
  3425. */
  3426. "_fnDomGroupButton": function ( i )
  3427. {
  3428. var
  3429. that = this,
  3430. dt = this.s.dt,
  3431. oGroup = this.s.aoGroups[i];
  3432. return $(
  3433. '<li class="ColVis_Special '+(dt.bJUI ? 'ui-button ui-state-default' : '')+'">'+
  3434. '<label>'+
  3435. '<input type="checkbox" />'+
  3436. '<span>'+oGroup.sTitle+'</span>'+
  3437. '</label>'+
  3438. '</li>'
  3439. )
  3440. .click( function (e) {
  3441. var showHide = !$('input', this).is(":checked");
  3442. if ( e.target.nodeName.toLowerCase() !== "li" )
  3443. {
  3444. showHide = ! showHide;
  3445. }
  3446. for ( var j=0 ; j < oGroup.aiColumns.length ; j++ )
  3447. {
  3448. that.s.dt.oInstance.fnSetColumnVis( oGroup.aiColumns[j], showHide );
  3449. }
  3450. } )[0];
  3451. },
  3452. /**
  3453. * Create the DOM for a show / hide button
  3454. * @method _fnDomColumnButton
  3455. * @param {int} i Column in question
  3456. * @returns {Node} Created button
  3457. * @private
  3458. */
  3459. "_fnDomColumnButton": function ( i )
  3460. {
  3461. var
  3462. that = this,
  3463. column = this.s.dt.aoColumns[i],
  3464. dt = this.s.dt;
  3465. var title = this.s.fnLabel===null ?
  3466. column.sTitle :
  3467. this.s.fnLabel( i, column.sTitle, column.nTh );
  3468. return $(
  3469. '<li '+(dt.bJUI ? 'class="ui-button ui-state-default"' : '')+'>'+
  3470. '<label>'+
  3471. '<input type="checkbox" />'+
  3472. '<span>'+title+'</span>'+
  3473. '</label>'+
  3474. '</li>'
  3475. )
  3476. .click( function (e) {
  3477. var showHide = !$('input', this).is(":checked");
  3478. if ( e.target.nodeName.toLowerCase() !== "li" )
  3479. {
  3480. if ( e.target.nodeName.toLowerCase() == "input" || that.s.fnStateChange === null )
  3481. {
  3482. showHide = ! showHide;
  3483. }
  3484. }
  3485. /* Need to consider the case where the initialiser created more than one table - change the
  3486. * API index that DataTables is using
  3487. */
  3488. var oldIndex = $.fn.dataTableExt.iApiIndex;
  3489. $.fn.dataTableExt.iApiIndex = that._fnDataTablesApiIndex.call(that);
  3490. // Optimisation for server-side processing when scrolling - don't do a full redraw
  3491. if ( dt.oFeatures.bServerSide )
  3492. {
  3493. that.s.dt.oInstance.fnSetColumnVis( i, showHide, false );
  3494. that.s.dt.oInstance.fnAdjustColumnSizing( false );
  3495. if (dt.oScroll.sX !== "" || dt.oScroll.sY !== "" )
  3496. {
  3497. that.s.dt.oInstance.oApi._fnScrollDraw( that.s.dt );
  3498. }
  3499. that._fnDrawCallback();
  3500. }
  3501. else
  3502. {
  3503. that.s.dt.oInstance.fnSetColumnVis( i, showHide );
  3504. }
  3505. $.fn.dataTableExt.iApiIndex = oldIndex; /* Restore */
  3506. if ( that.s.fnStateChange !== null )
  3507. {
  3508. if ( e.target.nodeName.toLowerCase() == "span" )
  3509. {
  3510. e.preventDefault();
  3511. }
  3512. that.s.fnStateChange.call( that, i, showHide );
  3513. }
  3514. } )[0];
  3515. },
  3516. /**
  3517. * Get the position in the DataTables instance array of the table for this
  3518. * instance of ColVis
  3519. * @method _fnDataTablesApiIndex
  3520. * @returns {int} Index
  3521. * @private
  3522. */
  3523. "_fnDataTablesApiIndex": function ()
  3524. {
  3525. for ( var i=0, iLen=this.s.dt.oInstance.length ; i<iLen ; i++ )
  3526. {
  3527. if ( this.s.dt.oInstance[i] == this.s.dt.nTable )
  3528. {
  3529. return i;
  3530. }
  3531. }
  3532. return 0;
  3533. },
  3534. /**
  3535. * Create the element used to contain list the columns (it is shown and
  3536. * hidden as needed)
  3537. * @method _fnDomCollection
  3538. * @returns {Node} div container for the collection
  3539. * @private
  3540. */
  3541. "_fnDomCollection": function ()
  3542. {
  3543. return $('<ul />', {
  3544. 'class': !this.s.dt.bJUI ?
  3545. "ColVis_collection" :
  3546. "ColVis_collection ui-buttonset ui-buttonset-multi"
  3547. } )
  3548. .css( {
  3549. 'display': 'none',
  3550. 'opacity': 0,
  3551. 'position': ! this.s.bCssPosition ?
  3552. 'absolute' :
  3553. ''
  3554. } )[0];
  3555. },
  3556. /**
  3557. * An element to be placed on top of the activate button to catch events
  3558. * @method _fnDomCatcher
  3559. * @returns {Node} div container for the collection
  3560. * @private
  3561. */
  3562. "_fnDomCatcher": function ()
  3563. {
  3564. var
  3565. that = this,
  3566. nCatcher = document.createElement('div');
  3567. nCatcher.className = "ColVis_catcher";
  3568. $(nCatcher).click( function () {
  3569. that._fnCollectionHide.call( that, null, null );
  3570. } );
  3571. return nCatcher;
  3572. },
  3573. /**
  3574. * Create the element used to shade the background, and capture hide events (it is shown and
  3575. * hidden as needed)
  3576. * @method _fnDomBackground
  3577. * @returns {Node} div container for the background
  3578. * @private
  3579. */
  3580. "_fnDomBackground": function ()
  3581. {
  3582. var that = this;
  3583. var background = $('<div></div>')
  3584. .addClass( 'ColVis_collectionBackground' )
  3585. .css( 'opacity', 0 )
  3586. .click( function () {
  3587. that._fnCollectionHide.call( that, null, null );
  3588. } );
  3589. /* When considering a mouse over action for the activation, we also consider a mouse out
  3590. * which is the same as a mouse over the background - without all the messing around of
  3591. * bubbling events. Use the catcher element to avoid messing around with bubbling
  3592. */
  3593. if ( this.s.activate == "mouseover" )
  3594. {
  3595. background.mouseover( function () {
  3596. that.s.overcollection = false;
  3597. that._fnCollectionHide.call( that, null, null );
  3598. } );
  3599. }
  3600. return background[0];
  3601. },
  3602. /**
  3603. * Show the show / hide list and the background
  3604. * @method _fnCollectionShow
  3605. * @returns void
  3606. * @private
  3607. */
  3608. "_fnCollectionShow": function ()
  3609. {
  3610. var that = this, i, iLen, iLeft;
  3611. var oPos = $(this.dom.button).offset();
  3612. var nHidden = this.dom.collection;
  3613. var nBackground = this.dom.background;
  3614. var iDivX = parseInt(oPos.left, 10);
  3615. var iDivY = parseInt(oPos.top + $(this.dom.button).outerHeight(), 10);
  3616. if ( ! this.s.bCssPosition )
  3617. {
  3618. nHidden.style.top = iDivY+"px";
  3619. nHidden.style.left = iDivX+"px";
  3620. }
  3621. $(nHidden).css( {
  3622. 'display': 'block',
  3623. 'opacity': 0
  3624. } );
  3625. nBackground.style.bottom ='0px';
  3626. nBackground.style.right = '0px';
  3627. var oStyle = this.dom.catcher.style;
  3628. oStyle.height = $(this.dom.button).outerHeight()+"px";
  3629. oStyle.width = $(this.dom.button).outerWidth()+"px";
  3630. oStyle.top = oPos.top+"px";
  3631. oStyle.left = iDivX+"px";
  3632. document.body.appendChild( nBackground );
  3633. document.body.appendChild( nHidden );
  3634. document.body.appendChild( this.dom.catcher );
  3635. /* This results in a very small delay for the end user but it allows the animation to be
  3636. * much smoother. If you don't want the animation, then the setTimeout can be removed
  3637. */
  3638. $(nHidden).animate({"opacity": 1}, that.s.iOverlayFade);
  3639. $(nBackground).animate({"opacity": 0.1}, that.s.iOverlayFade, 'linear', function () {
  3640. /* In IE6 if you set the checked attribute of a hidden checkbox, then this is not visually
  3641. * reflected. As such, we need to do it here, once it is visible. Unbelievable.
  3642. */
  3643. if ( $.browser && $.browser.msie && $.browser.version == "6.0" )
  3644. {
  3645. that._fnDrawCallback();
  3646. }
  3647. });
  3648. /* Visual corrections to try and keep the collection visible */
  3649. if ( !this.s.bCssPosition )
  3650. {
  3651. iLeft = ( this.s.sAlign=="left" ) ?
  3652. iDivX :
  3653. iDivX - $(nHidden).outerWidth() + $(this.dom.button).outerWidth();
  3654. nHidden.style.left = iLeft+"px";
  3655. var iDivWidth = $(nHidden).outerWidth();
  3656. var iDivHeight = $(nHidden).outerHeight();
  3657. var iDocWidth = $(document).width();
  3658. if ( iLeft + iDivWidth > iDocWidth )
  3659. {
  3660. nHidden.style.left = (iDocWidth-iDivWidth)+"px";
  3661. }
  3662. }
  3663. this.s.hidden = false;
  3664. },
  3665. /**
  3666. * Hide the show / hide list and the background
  3667. * @method _fnCollectionHide
  3668. * @returns void
  3669. * @private
  3670. */
  3671. "_fnCollectionHide": function ( )
  3672. {
  3673. var that = this;
  3674. if ( !this.s.hidden && this.dom.collection !== null )
  3675. {
  3676. this.s.hidden = true;
  3677. $(this.dom.collection).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
  3678. this.style.display = "none";
  3679. } );
  3680. $(this.dom.background).animate({"opacity": 0}, that.s.iOverlayFade, function (e) {
  3681. document.body.removeChild( that.dom.background );
  3682. document.body.removeChild( that.dom.catcher );
  3683. } );
  3684. }
  3685. },
  3686. /**
  3687. * Alter the colspan on any fnOpen rows
  3688. */
  3689. "_fnAdjustOpenRows": function ()
  3690. {
  3691. var aoOpen = this.s.dt.aoOpenRows;
  3692. var iVisible = this.s.dt.oApi._fnVisbleColumns( this.s.dt );
  3693. for ( var i=0, iLen=aoOpen.length ; i<iLen ; i++ ) {
  3694. aoOpen[i].nTr.getElementsByTagName('td')[0].colSpan = iVisible;
  3695. }
  3696. }
  3697. };
  3698. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  3699. * Static object methods
  3700. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  3701. /**
  3702. * Rebuild the collection for a given table, or all tables if no parameter given
  3703. * @method ColVis.fnRebuild
  3704. * @static
  3705. * @param object oTable DataTable instance to consider - optional
  3706. * @returns void
  3707. */
  3708. ColVis.fnRebuild = function ( oTable )
  3709. {
  3710. var nTable = null;
  3711. if ( typeof oTable != 'undefined' )
  3712. {
  3713. nTable = $.fn.dataTable.Api ?
  3714. new $.fn.dataTable.Api( oTable ).table().node() :
  3715. oTable.fnSettings().nTable;
  3716. }
  3717. for ( var i=0, iLen=ColVis.aInstances.length ; i<iLen ; i++ )
  3718. {
  3719. if ( typeof oTable == 'undefined' || nTable == ColVis.aInstances[i].s.dt.nTable )
  3720. {
  3721. ColVis.aInstances[i].fnRebuild();
  3722. }
  3723. }
  3724. };
  3725. ColVis.defaults = {
  3726. /**
  3727. * Mode of activation. Can be 'click' or 'mouseover'
  3728. * @property activate
  3729. * @type string
  3730. * @default click
  3731. */
  3732. active: 'click',
  3733. /**
  3734. * Text used for the button
  3735. * @property buttonText
  3736. * @type string
  3737. * @default Show / hide columns
  3738. */
  3739. buttonText: 'Show / hide columns',
  3740. /**
  3741. * List of columns (integers) which should be excluded from the list
  3742. * @property aiExclude
  3743. * @type array
  3744. * @default []
  3745. */
  3746. aiExclude: [],
  3747. /**
  3748. * Show restore button
  3749. * @property bRestore
  3750. * @type boolean
  3751. * @default false
  3752. */
  3753. bRestore: false,
  3754. /**
  3755. * Restore button text
  3756. * @property sRestore
  3757. * @type string
  3758. * @default Restore original
  3759. */
  3760. sRestore: 'Restore original',
  3761. /**
  3762. * Show Show-All button
  3763. * @property bShowAll
  3764. * @type boolean
  3765. * @default false
  3766. */
  3767. bShowAll: false,
  3768. /**
  3769. * Show All button text
  3770. * @property sShowAll
  3771. * @type string
  3772. * @default Restore original
  3773. */
  3774. sShowAll: 'Show All',
  3775. /**
  3776. * Position of the collection menu when shown - align "left" or "right"
  3777. * @property sAlign
  3778. * @type string
  3779. * @default left
  3780. */
  3781. sAlign: 'left',
  3782. /**
  3783. * Callback function to tell the user when the state has changed
  3784. * @property fnStateChange
  3785. * @type function
  3786. * @default null
  3787. */
  3788. fnStateChange: null,
  3789. /**
  3790. * Overlay animation duration in mS
  3791. * @property iOverlayFade
  3792. * @type integer|false
  3793. * @default 500
  3794. */
  3795. iOverlayFade: 500,
  3796. /**
  3797. * Label callback for column names. Takes three parameters: 1. the
  3798. * column index, 2. the column title detected by DataTables and 3. the
  3799. * TH node for the column
  3800. * @property fnLabel
  3801. * @type function
  3802. * @default null
  3803. */
  3804. fnLabel: null,
  3805. /**
  3806. * Indicate if the column list should be positioned by Javascript,
  3807. * visually below the button or allow CSS to do the positioning
  3808. * @property bCssPosition
  3809. * @type boolean
  3810. * @default false
  3811. */
  3812. bCssPosition: false,
  3813. /**
  3814. * Group buttons
  3815. * @property aoGroups
  3816. * @type array
  3817. * @default []
  3818. */
  3819. aoGroups: [],
  3820. /**
  3821. * Button ordering - 'alpha' (alphabetical) or 'column' (table column
  3822. * order)
  3823. * @property order
  3824. * @type string
  3825. * @default column
  3826. */
  3827. order: 'column'
  3828. };
  3829. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  3830. * Static object properties
  3831. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  3832. /**
  3833. * Collection of all ColVis instances
  3834. * @property ColVis.aInstances
  3835. * @static
  3836. * @type Array
  3837. * @default []
  3838. */
  3839. ColVis.aInstances = [];
  3840. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  3841. * Constants
  3842. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  3843. /**
  3844. * Name of this class
  3845. * @constant CLASS
  3846. * @type String
  3847. * @default ColVis
  3848. */
  3849. ColVis.prototype.CLASS = "ColVis";
  3850. /**
  3851. * ColVis version
  3852. * @constant VERSION
  3853. * @type String
  3854. * @default See code
  3855. */
  3856. ColVis.VERSION = "1.1.2";
  3857. ColVis.prototype.VERSION = ColVis.VERSION;
  3858. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  3859. * Initialisation
  3860. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  3861. /*
  3862. * Register a new feature with DataTables
  3863. */
  3864. if ( typeof $.fn.dataTable == "function" &&
  3865. typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
  3866. $.fn.dataTableExt.fnVersionCheck('1.7.0') )
  3867. {
  3868. $.fn.dataTableExt.aoFeatures.push( {
  3869. "fnInit": function( oDTSettings ) {
  3870. var init = oDTSettings.oInit;
  3871. var colvis = new ColVis( oDTSettings, init.colVis || init.oColVis || {} );
  3872. return colvis.button();
  3873. },
  3874. "cFeature": "C",
  3875. "sFeature": "ColVis"
  3876. } );
  3877. }
  3878. else
  3879. {
  3880. alert( "Warning: ColVis requires DataTables 1.7 or greater - www.datatables.net/download");
  3881. }
  3882. // Make ColVis accessible from the DataTables instance
  3883. $.fn.dataTable.ColVis = ColVis;
  3884. $.fn.DataTable.ColVis = ColVis;
  3885. return ColVis;
  3886. }; // /factory
  3887. // Define as an AMD module if possible
  3888. if ( typeof define === 'function' && define.amd ) {
  3889. define( ['jquery', 'datatables'], factory );
  3890. }
  3891. else if ( typeof exports === 'object' ) {
  3892. // Node/CommonJS
  3893. factory( require('jquery'), require('datatables') );
  3894. }
  3895. else if ( jQuery && !jQuery.fn.dataTable.ColVis ) {
  3896. // Otherwise simply initialise as normal, stopping multiple evaluation
  3897. factory( jQuery, jQuery.fn.dataTable );
  3898. }
  3899. })(window, document);
  3900. /**
  3901. * File: datatables.responsive.js
  3902. * Version: 0.2.0
  3903. * Author: Seen Sai Yang
  3904. * Info: https://github.com/Comanche/datatables-responsive
  3905. *
  3906. * Copyright 2013 Seen Sai Yang, all rights reserved.
  3907. *
  3908. * This source file is free software, under either the GPL v2 license or a
  3909. * BSD style license.
  3910. *
  3911. * This source file is distributed in the hope that it will be useful, but
  3912. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  3913. * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
  3914. *
  3915. * You should have received a copy of the GNU General Public License and the
  3916. * BSD license along with this program. These licenses are also available at:
  3917. * https://raw.github.com/Comanche/datatables-responsive/master/license-gpl2.txt
  3918. * https://raw.github.com/Comanche/datatables-responsive/master/license-bsd.txt
  3919. */
  3920. 'use strict';
  3921. /**
  3922. * Constructor for responsive datables helper.
  3923. *
  3924. * This helper class makes datatables responsive to the window size.
  3925. *
  3926. * The parameter, breakpoints, is an object for each breakpoint key/value pair
  3927. * with the following format: { breakpoint_name: pixel_width_at_breakpoint }.
  3928. *
  3929. * An example is as follows:
  3930. *
  3931. * {
  3932. * tablet: 1024,
  3933. * phone: 480
  3934. * }
  3935. *
  3936. * These breakpoint name may be used as possible values for the data-hide
  3937. * attribute. The data-hide attribute is optional and may be defined for each
  3938. * th element in the table header.
  3939. *
  3940. * The parameter, options, is an object of options supported by the responsive
  3941. * helper. The following options are supported:
  3942. *
  3943. * {
  3944. * hideEmptyColumnsInRowDetail - Boolean, default: false.
  3945. * clickOn - icon|cell|row, default: icon
  3946. * showDetail - function called when detail row shown
  3947. * hideDetail - function called when detail row hidden
  3948. * }
  3949. *
  3950. * @param {Object|string} tableSelector jQuery wrapped set or selector for
  3951. * datatables container element.
  3952. * @param {Object} breakpoints Object defining the responsive
  3953. * breakpoint for datatables.
  3954. * @param {Object} options Object of options.
  3955. */
  3956. function ResponsiveDatatablesHelper(tableSelector, breakpoints, options) {
  3957. if (typeof tableSelector === 'string') {
  3958. this.tableElement = $(tableSelector);
  3959. } else {
  3960. this.tableElement = tableSelector;
  3961. }
  3962. // Get data table API.
  3963. this.api = this.tableElement.dataTable().api();
  3964. // State of column indexes and which are shown or hidden.
  3965. this.columnIndexes = [];
  3966. this.columnsShownIndexes = [];
  3967. this.columnsHiddenIndexes = [];
  3968. this.currentBreakpoint = '';
  3969. this.lastBreakpoint = '';
  3970. this.lastColumnsHiddenIndexes = [];
  3971. // Save state
  3972. var fileName = window.location.pathname.split("/").pop();
  3973. var context = this.api.settings().context[0];
  3974. this.tableId = context.sTableId;
  3975. this.saveState = context.oInit.bStateSave;
  3976. this.cookieName = 'DataTablesResponsiveHelper_' + this.tableId + (fileName ? '_' + fileName : '');
  3977. this.lastStateExists = false;
  3978. // Index of the th in the header tr that stores where the attribute
  3979. // data-class="expand"
  3980. // is defined.
  3981. this.expandColumn = undefined;
  3982. // Stores original breakpoint defitions
  3983. this.origBreakpointsDefs = undefined;
  3984. // Stores the break points defined in the table header.
  3985. // Each th in the header tr may contain an optional attribute like
  3986. // data-hide="phone,tablet"
  3987. // These attributes and the breakpoints object will be used to create this
  3988. // object.
  3989. this.breakpoints = {
  3990. /**
  3991. * We will be generating data in the following format:
  3992. * phone : {
  3993. * lowerLimit : undefined,
  3994. * upperLimit : 320,
  3995. * columnsToHide: []
  3996. * },
  3997. * tablet: {
  3998. * lowerLimit : 320,
  3999. * upperLimit : 724,
  4000. * columnsToHide: []
  4001. * }
  4002. */
  4003. };
  4004. // Store default options
  4005. this.options = {
  4006. hideEmptyColumnsInRowDetail: false,
  4007. clickOn: 'icon',
  4008. showDetail: null,
  4009. hideDetail: null
  4010. };
  4011. // Expand icon template
  4012. this.expandIconTemplate = '<span class="responsiveExpander"></span>';
  4013. // Row template
  4014. this.rowTemplate = '<tr class="row-detail"><td><ul><!--column item--></ul></td></tr>';
  4015. this.rowLiTemplate = '<li><span class="columnTitle"><!--column title--></span>: <span class="columnValue"><!--column value--></span></li>';
  4016. // Responsive behavior on/off flag
  4017. this.disabled = true;
  4018. // Skip next windows width change flag
  4019. this.skipNextWindowsWidthChange = false;
  4020. // Initialize settings
  4021. this.init(breakpoints, options);
  4022. }
  4023. /**
  4024. * Responsive datatables helper init function.
  4025. * Builds breakpoint limits for columns and begins to listen to window resize
  4026. * event.
  4027. *
  4028. * See constructor for the breakpoints parameter.
  4029. *
  4030. * @param {Object} breakpoints
  4031. * @param {Object} options
  4032. */
  4033. ResponsiveDatatablesHelper.prototype.init = function (breakpoints, options) {
  4034. this.origBreakpointsDefs = breakpoints;
  4035. this.initBreakpoints();
  4036. // Enable responsive behavior.
  4037. this.disable(false);
  4038. // Extend options
  4039. $.extend(this.options, options);
  4040. };
  4041. ResponsiveDatatablesHelper.prototype.initBreakpoints = function () {
  4042. // Get last state if it exists
  4043. if (this.saveState) {
  4044. this.getState();
  4045. }
  4046. if (!this.lastStateExists) {
  4047. /** Generate breakpoints in the format we need. ***********************/
  4048. // First, we need to create a sorted array of the breakpoints given.
  4049. var breakpointsSorted = [];
  4050. for (var prop in this.origBreakpointsDefs) {
  4051. breakpointsSorted.push({
  4052. name: prop,
  4053. upperLimit: this.origBreakpointsDefs[prop],
  4054. columnsToHide: []
  4055. });
  4056. }
  4057. breakpointsSorted.sort(function (a, b) {
  4058. return a.upperLimit - b.upperLimit;
  4059. });
  4060. // Set lower and upper limits for each breakpoint.
  4061. var lowerLimit = 0;
  4062. for (var i = 0; i < breakpointsSorted.length; i++) {
  4063. breakpointsSorted[i].lowerLimit = lowerLimit;
  4064. lowerLimit = breakpointsSorted[i].upperLimit;
  4065. }
  4066. // Add the default breakpoint which shows all (has no upper limit).
  4067. breakpointsSorted.push({
  4068. name : 'always',
  4069. lowerLimit : lowerLimit,
  4070. upperLimit : Infinity,
  4071. columnsToHide: []
  4072. });
  4073. // Copy the sorted breakpoint array into the breakpoints object using the
  4074. // name as the key.
  4075. this.breakpoints = {};
  4076. var i, l;
  4077. for (i = 0, l = breakpointsSorted.length; i < l; i++) {
  4078. this.breakpoints[breakpointsSorted[i].name] = breakpointsSorted[i];
  4079. }
  4080. /** Create range of visible columns and their indexes *****************/
  4081. // We need the range of all visible column indexes to calculate the
  4082. // columns to show:
  4083. // Columns to show = all visible columns - columns to hide
  4084. var columns = this.api.columns().header();
  4085. var visibleColumnsHeadersTds = [];
  4086. for (i = 0, l = columns.length; i < l; i++) {
  4087. if (this.api.column(i).visible()) {
  4088. this.columnIndexes.push(i);
  4089. visibleColumnsHeadersTds.push(columns[i]);
  4090. }
  4091. }
  4092. /** Sort columns into breakpoints respectively ************************/
  4093. // Read column headers' attributes and get needed info
  4094. for (var index = 0; index < visibleColumnsHeadersTds.length; index++) {
  4095. // Get the column with the attribute data-class="expand" so we know
  4096. // where to display the expand icon.
  4097. var col = $(visibleColumnsHeadersTds[index]);
  4098. if (col.attr('data-class') === 'expand') {
  4099. this.expandColumn = this.columnIndexes[index];
  4100. }
  4101. // The data-hide attribute has the breakpoints that this column
  4102. // is associated with.
  4103. // If it's defined, get the data-hide attribute and sort this
  4104. // column into the appropriate breakpoint's columnsToHide array.
  4105. var dataHide = col.attr('data-hide');
  4106. if (dataHide !== undefined) {
  4107. var splitBreakingPoints = dataHide.split(/,\s*/);
  4108. for (var i = 0; i < splitBreakingPoints.length; i++) {
  4109. var bp = splitBreakingPoints[i];
  4110. if (bp === 'always') {
  4111. // A column with an 'always' breakpoint is always hidden.
  4112. // Loop through all breakpoints and add it to each except the
  4113. // default breakpoint.
  4114. for (var prop in this.breakpoints) {
  4115. if (this.breakpoints[prop].name !== 'default') {
  4116. this.breakpoints[prop].columnsToHide.push(this.columnIndexes[index]);
  4117. }
  4118. }
  4119. } else if (this.breakpoints[bp] !== undefined) {
  4120. // Translate visible column index to internal column index.
  4121. this.breakpoints[bp].columnsToHide.push(this.columnIndexes[index]);
  4122. }
  4123. }
  4124. }
  4125. }
  4126. }
  4127. };
  4128. /**
  4129. * Sets or removes window resize handler.
  4130. *
  4131. * @param {Boolean} bindFlag
  4132. */
  4133. ResponsiveDatatablesHelper.prototype.setWindowsResizeHandler = function(bindFlag) {
  4134. if (bindFlag === undefined) {
  4135. bindFlag = true;
  4136. }
  4137. if (bindFlag) {
  4138. var that = this;
  4139. $(window).bind("resize", function () {
  4140. that.respond();
  4141. });
  4142. } else {
  4143. $(window).unbind("resize");
  4144. }
  4145. };
  4146. /**
  4147. * Respond window size change. This helps make datatables responsive.
  4148. */
  4149. ResponsiveDatatablesHelper.prototype.respond = function () {
  4150. if (this.disabled) {
  4151. return;
  4152. }
  4153. var that = this;
  4154. // Get new windows width
  4155. var newWindowWidth = $(window).width();
  4156. // Loop through breakpoints to see which columns need to be shown/hidden.
  4157. var newColumnsToHide = [];
  4158. for (var prop in this.breakpoints) {
  4159. var element = this.breakpoints[prop];
  4160. if ((!element.lowerLimit || newWindowWidth > element.lowerLimit) && (!element.upperLimit || newWindowWidth <= element.upperLimit)) {
  4161. this.currentBreakpoint = element.name;
  4162. newColumnsToHide = element.columnsToHide;
  4163. }
  4164. }
  4165. // Find out if a column show/hide should happen.
  4166. // Skip column show/hide if this window width change follows immediately
  4167. // after a previous column show/hide. This will help prevent a loop.
  4168. var columnShowHide = false;
  4169. if (!this.skipNextWindowsWidthChange) {
  4170. // Check difference in length
  4171. if (this.lastBreakpoint.length === 0 && newColumnsToHide.length) {
  4172. // No previous breakpoint and new breakpoint
  4173. columnShowHide = true;
  4174. } else if (this.lastBreakpoint != this.currentBreakpoint) {
  4175. // Different breakpoints
  4176. columnShowHide = true;
  4177. } else if (this.columnsHiddenIndexes.length !== newColumnsToHide.length) {
  4178. // Difference in number of hidden columns
  4179. columnShowHide = true;
  4180. } else {
  4181. // Possible same number of columns but check for difference in columns
  4182. var d1 = this.difference(this.columnsHiddenIndexes, newColumnsToHide).length;
  4183. var d2 = this.difference(newColumnsToHide, this.columnsHiddenIndexes).length;
  4184. columnShowHide = d1 + d2 > 0;
  4185. }
  4186. }
  4187. if (columnShowHide) {
  4188. // Showing/hiding a column at breakpoint may cause a windows width
  4189. // change. Let's flag to skip the column show/hide that may be
  4190. // caused by the next windows width change.
  4191. this.skipNextWindowsWidthChange = true;
  4192. this.columnsHiddenIndexes = newColumnsToHide;
  4193. this.columnsShownIndexes = this.difference(this.columnIndexes, this.columnsHiddenIndexes);
  4194. this.showHideColumns();
  4195. this.lastBreakpoint = this.currentBreakpoint;
  4196. this.setState();
  4197. this.skipNextWindowsWidthChange = false;
  4198. }
  4199. // We don't skip this part.
  4200. // If one or more columns have been hidden, add the has-columns-hidden class to table.
  4201. // This class will show what state the table is in.
  4202. if (this.columnsHiddenIndexes.length) {
  4203. this.tableElement.addClass('has-columns-hidden');
  4204. // Show details for each row that is tagged with the class .detail-show.
  4205. $('tr.detail-show', this.tableElement).each(function (index, element) {
  4206. var tr = $(element);
  4207. if (tr.next('.row-detail').length === 0) {
  4208. ResponsiveDatatablesHelper.prototype.showRowDetail(that, tr);
  4209. }
  4210. });
  4211. } else {
  4212. this.tableElement.removeClass('has-columns-hidden');
  4213. $('tr.row-detail', this.tableElement).each(function (event) {
  4214. ResponsiveDatatablesHelper.prototype.hideRowDetail(that, $(this).prev());
  4215. });
  4216. }
  4217. };
  4218. /**
  4219. * Show/hide datatables columns.
  4220. */
  4221. ResponsiveDatatablesHelper.prototype.showHideColumns = function () {
  4222. // Calculate the columns to show
  4223. // Show columns that may have been previously hidden.
  4224. for (var i = 0, l = this.columnsShownIndexes.length; i < l; i++) {
  4225. this.api.column(this.columnsShownIndexes[i]).visible(true);
  4226. }
  4227. // Hide columns that may have been previously shown.
  4228. for (var i = 0, l = this.columnsHiddenIndexes.length; i < l; i++) {
  4229. this.api.column(this.columnsHiddenIndexes[i]).visible(false);
  4230. }
  4231. // Rebuild details to reflect shown/hidden column changes.
  4232. var that = this;
  4233. $('tr.row-detail', this.tableElement).each(function () {
  4234. ResponsiveDatatablesHelper.prototype.hideRowDetail(that, $(this).prev());
  4235. });
  4236. if (this.tableElement.hasClass('has-columns-hidden')) {
  4237. $('tr.detail-show', this.tableElement).each(function (index, element) {
  4238. ResponsiveDatatablesHelper.prototype.showRowDetail(that, $(element));
  4239. });
  4240. }
  4241. };
  4242. /**
  4243. * Create the expand icon on the column with the data-class="expand" attribute
  4244. * defined for it's header.
  4245. *
  4246. * @param {Object} tr table row object
  4247. */
  4248. ResponsiveDatatablesHelper.prototype.createExpandIcon = function (tr) {
  4249. if (this.disabled) {
  4250. return;
  4251. }
  4252. // Get the td for tr with the same index as the th in the header tr
  4253. // that has the data-class="expand" attribute defined.
  4254. var tds = $('td', tr);
  4255. // Loop through tds and create an expand icon on the td that has a column
  4256. // index equal to the expand column given.
  4257. for (var i = 0, l = tds.length; i < l; i++) {
  4258. var td = tds[i];
  4259. var tdIndex = this.api.cell(td).index().column;
  4260. td = $(td);
  4261. if (tdIndex === this.expandColumn) {
  4262. // Create expand icon if there isn't one already.
  4263. if ($('span.responsiveExpander', td).length == 0) {
  4264. td.prepend(this.expandIconTemplate);
  4265. // Respond to click event on expander icon.
  4266. switch (this.options.clickOn) {
  4267. case 'cell':
  4268. td.on('click', {responsiveDatatablesHelperInstance: this}, this.showRowDetailEventHandler);
  4269. break;
  4270. case 'row':
  4271. $(tr).on('click', {responsiveDatatablesHelperInstance: this}, this.showRowDetailEventHandler);
  4272. break;
  4273. default:
  4274. td.on('click', 'span.responsiveExpander', {responsiveDatatablesHelperInstance: this}, this.showRowDetailEventHandler);
  4275. break;
  4276. }
  4277. }
  4278. break;
  4279. }
  4280. }
  4281. };
  4282. /**
  4283. * Show row detail event handler.
  4284. *
  4285. * This handler is used to handle the click event of the expand icon defined in
  4286. * the table row data element.
  4287. *
  4288. * @param {Object} event jQuery event object
  4289. */
  4290. ResponsiveDatatablesHelper.prototype.showRowDetailEventHandler = function (event) {
  4291. var responsiveDatatablesHelperInstance = event.data.responsiveDatatablesHelperInstance;
  4292. if (responsiveDatatablesHelperInstance.disabled) {
  4293. return;
  4294. }
  4295. var td = $(this);
  4296. // Nothing to do if there are no columns hidden.
  4297. if (!td.closest('table').hasClass('has-columns-hidden')) {
  4298. return;
  4299. }
  4300. // Get the parent tr of which this td belongs to.
  4301. var tr = td.closest('tr');
  4302. // Show/hide row details
  4303. if (tr.hasClass('detail-show')) {
  4304. ResponsiveDatatablesHelper.prototype.hideRowDetail(responsiveDatatablesHelperInstance, tr);
  4305. } else {
  4306. ResponsiveDatatablesHelper.prototype.showRowDetail(responsiveDatatablesHelperInstance, tr);
  4307. }
  4308. tr.toggleClass('detail-show');
  4309. // Prevent click event from bubbling up to higher-level DOM elements.
  4310. event.stopPropagation();
  4311. };
  4312. /**
  4313. * Show row details.
  4314. *
  4315. * @param {ResponsiveDatatablesHelper} responsiveDatatablesHelperInstance instance of ResponsiveDatatablesHelper
  4316. * @param {Object} tr jQuery wrapped set
  4317. */
  4318. ResponsiveDatatablesHelper.prototype.showRowDetail = function (responsiveDatatablesHelperInstance, tr) {
  4319. // Get column because we need their titles.
  4320. var api = responsiveDatatablesHelperInstance.api;
  4321. var columns = api.columns().header();
  4322. // Create the new tr.
  4323. var newTr = $(responsiveDatatablesHelperInstance.rowTemplate);
  4324. // Get the ul that we'll insert li's into.
  4325. var ul = $('ul', newTr);
  4326. // Loop through hidden columns and create an li for each of them.
  4327. for (var i = 0; i < responsiveDatatablesHelperInstance.columnsHiddenIndexes.length; i++) {
  4328. var index = responsiveDatatablesHelperInstance.columnsHiddenIndexes[i];
  4329. // Get row td
  4330. var rowIndex = api.row(tr).index();
  4331. var td = api.cell(rowIndex, index).node();
  4332. // Don't create li if contents are empty (depends on hideEmptyColumnsInRowDetail option).
  4333. if (!responsiveDatatablesHelperInstance.options.hideEmptyColumnsInRowDetail || td.innerHTML.trim().length) {
  4334. var li = $(responsiveDatatablesHelperInstance.rowLiTemplate);
  4335. var hiddenColumnName = $(columns[index]).attr('data-name');
  4336. $('.columnTitle', li).html(hiddenColumnName !== undefined ? hiddenColumnName : columns[index].innerHTML);
  4337. var contents = $(td).contents();
  4338. var clonedContents = contents.clone();
  4339. // Select elements' selectedIndex are not cloned. Do it manually.
  4340. for (var n = 0, m = contents.length; n < m; n++) {
  4341. var node = contents[n];
  4342. if (node.nodeType === Node.ELEMENT_NODE && node.tagName === 'SELECT') {
  4343. clonedContents[n].selectedIndex = node.selectedIndex
  4344. }
  4345. }
  4346. // Set the column contents and save the original td source.
  4347. $('.columnValue', li).append(clonedContents).data('originalTdSource', td);
  4348. // Copy index to data attribute, so we'll know where to put the value when the tr.row-detail is removed.
  4349. li.attr('data-column', index);
  4350. // Copy td class to new li.
  4351. var tdClass = $(td).attr('class');
  4352. if (tdClass !== 'undefined' && tdClass !== false && tdClass !== '') {
  4353. li.addClass(tdClass)
  4354. }
  4355. ul.append(li);
  4356. }
  4357. }
  4358. // Create tr colspan attribute.
  4359. var colspan = responsiveDatatablesHelperInstance.columnIndexes.length - responsiveDatatablesHelperInstance.columnsHiddenIndexes.length;
  4360. newTr.find('> td').attr('colspan', colspan);
  4361. // Append the new tr after the current tr.
  4362. tr.after(newTr);
  4363. // call the showDetail function if needbe
  4364. if (responsiveDatatablesHelperInstance.options.showDetail){
  4365. responsiveDatatablesHelperInstance.options.showDetail(newTr);
  4366. }
  4367. };
  4368. /**
  4369. * Hide row details.
  4370. *
  4371. * @param {ResponsiveDatatablesHelper} responsiveDatatablesHelperInstance instance of ResponsiveDatatablesHelper
  4372. * @param {Object} tr jQuery wrapped set
  4373. */
  4374. ResponsiveDatatablesHelper.prototype.hideRowDetail = function (responsiveDatatablesHelperInstance, tr) {
  4375. // If the value of an input has changed while in row detail, we need to copy its state back
  4376. // to the DataTables object so that value will persist when the tr.row-detail is removed.
  4377. var rowDetail = tr.next('.row-detail');
  4378. if (responsiveDatatablesHelperInstance.options.hideDetail){
  4379. responsiveDatatablesHelperInstance.options.hideDetail(rowDetail);
  4380. }
  4381. rowDetail.find('li').each(function () {
  4382. var columnValueContainer = $(this).find('span.columnValue');
  4383. var tdContents = columnValueContainer.contents();
  4384. var td = columnValueContainer.data('originalTdSource');
  4385. $(td).empty().append(tdContents);
  4386. });
  4387. rowDetail.remove();
  4388. };
  4389. /**
  4390. * Enable/disable responsive behavior and restores changes made.
  4391. *
  4392. * @param {Boolean} disable, default is true
  4393. */
  4394. ResponsiveDatatablesHelper.prototype.disable = function (disable) {
  4395. this.disabled = (disable === undefined) || disable;
  4396. if (this.disabled) {
  4397. // Remove windows resize handler.
  4398. this.setWindowsResizeHandler(false);
  4399. // Remove all trs that have row details.
  4400. $('tbody tr.row-detail', this.tableElement).remove();
  4401. // Remove all trs that are marked to have row details shown.
  4402. $('tbody tr', this.tableElement).removeClass('detail-show');
  4403. // Remove all expander icons.
  4404. $('tbody tr span.responsiveExpander', this.tableElement).remove();
  4405. this.columnsHiddenIndexes = [];
  4406. this.columnsShownIndexes = this.columnIndexes;
  4407. this.showHideColumns();
  4408. this.tableElement.removeClass('has-columns-hidden');
  4409. this.tableElement.off('click', 'span.responsiveExpander', this.showRowDetailEventHandler);
  4410. } else {
  4411. // Add windows resize handler.
  4412. this.setWindowsResizeHandler();
  4413. }
  4414. };
  4415. /**
  4416. * Get state from cookie.
  4417. */
  4418. ResponsiveDatatablesHelper.prototype.getState = function () {
  4419. if (typeof(Storage)) {
  4420. // Use local storage
  4421. var value = JSON.parse(localStorage.getItem(this.cookieName));
  4422. if (value) {
  4423. this.columnIndexes = value.columnIndexes;
  4424. this.breakpoints = value.breakpoints;
  4425. this.expandColumn = value.expandColumn;
  4426. this.lastBreakpoint = value.lastBreakpoint;
  4427. this.lastStateExists = true;
  4428. }
  4429. } else {
  4430. // No local storage.
  4431. }
  4432. };
  4433. /**
  4434. * Saves state to cookie.
  4435. */
  4436. ResponsiveDatatablesHelper.prototype.setState = function () {
  4437. if (typeof(Storage)) {
  4438. // Use local storage
  4439. var d1 = this.difference(this.lastColumnsHiddenIndexes, this.columnsHiddenIndexes).length;
  4440. var d2 = this.difference(this.columnsHiddenIndexes, this.lastColumnsHiddenIndexes).length;
  4441. if (d1 + d2 > 0) {
  4442. var tt;
  4443. var value = {
  4444. columnIndexes: this.columnIndexes, // array
  4445. columnsHiddenIndexes: this.columnsHiddenIndexes, // array
  4446. breakpoints: this.breakpoints, // object
  4447. expandColumn: this.expandColumn, // int|undefined
  4448. lastBreakpoint: this.lastBreakpoint // string
  4449. };
  4450. localStorage.setItem(this.cookieName, JSON.stringify(value));
  4451. this.lastColumnsHiddenIndexes = this.columnsHiddenIndexes.slice(0);
  4452. }
  4453. } else {
  4454. // No local storage.
  4455. }
  4456. };
  4457. /**
  4458. * Get Difference.
  4459. */
  4460. ResponsiveDatatablesHelper.prototype.difference = function (a, b) {
  4461. var arr = [], i, hash = {};
  4462. for (i = b.length - 1; i >= 0; i--) {
  4463. hash[b[i]] = true;
  4464. }
  4465. for (i = a.length - 1; i >= 0; i--) {
  4466. if (hash[a[i]] !== true) {
  4467. arr.push(a[i]);
  4468. }
  4469. }
  4470. return arr;
  4471. };