12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024 |
- <html>
- <head>
- <title>File Manager</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0 user-scalable=no">
- <link rel="stylesheet" href="../../script/tocas/tocas.css">
- <link rel="icon" type="image/png" href="./img/small_icon.png">
- <link rel="manifest" crossorigin="use-credentials" href="manifest.json">
- <script type="text/javascript" src="../../script/tocas/tocas.js"></script>
- <script type="text/javascript" src="../../script/jquery.min.js"></script>
- <script type="text/javascript" src="../../script/ao_module.js"></script>
- <script type="text/javascript" src="../../script/forge-sha256.min.js"></script>
- <script type="text/javascript" src="../../script/qrcode.min.js"></script>
- <script>
- window.mobilecheck = function() {
- var check = false;
- (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
- return check;
- };
- </script>
- <style>
- body{
- color:black;
- height:100%;
- }
- @font-face {
- font-family: 'TaipeiSansTCBeta-Regular';
- src: url('../../script/font/TaipeiSansTCBeta-Regular.ttf');
- }
- h1, h2, h3, p, span, div,span { font-family: 'TaipeiSansTCBeta-Regular',"Lucida Console", "Courier New", monospace;}
- html{
- height:100%;
- overflow:hidden;
- }
- body.whiteTheme{
- background-color:rgb(250, 250, 250);
- }
- .darkTheme{
- background-color:#242330 !important;
- color:white;
- }
- .whiteTheme{
- color:#0d0d0d
- }
- .navibar{
- position:fixed;
- width:100%;
- padding-left:12px;
- padding-right:12px;
- padding-top:6px;
- padding-bottom:3px;
- z-index: 99;
- }
- .navibar.darkTheme{
- background-color:#17161f !important;
- border-bottom:2px solid #34b7eb;
- }
- .navibar.whiteTheme{
- /*box-shadow: 0 2px 4px 2px rgb(224, 224, 224);*/
- background-color:#fcfcfc;
- border-bottom:2px solid #34b7eb;
- }
- .whiteTheme .button.standard{
- box-shadow: 0 1px 1px 0px rgb(190, 190, 190);
- border: 0px;
- }
- .whiteTheme .button.standard:hover{
- background-color:#82c2f0 !important;
- color:white !important;
- }
- .ts.button{
- margin-bottom:2px;
- }
- .ts.button.darkTheme{
- background-color:#17161f !important;
- border: 1px solid #262533;
- color:white;
- }
- .ts.button.active.darkTheme{
- background-color:#312f42 !important;
- border: 1px solid #262533;
- color:white;
- }
- .ts.button.darkTheme:hover{
- background-color:#312f42 !important;
- color:white !important;
- }
- .rightPad{
- margin-right:37px;
- }
- .addressBar{
- width:100%;
- padding:3px;
- padding-left: 0px;
- padding-right: 0px;
- min-height: 35px;
- padding-top:6px;
- }
- .breadcrumb.darkTheme{
- background-color:transparent;
- }
- .section.darkTheme{
- color:white !important;
- background-color:transparent;
- }
- .selectable{
- cursor:pointer;
- }
- .rightAlign{
- position:absolute;
- right:0px;
- top:3px;
- }
- .addressText{
- padding:5px;
- border-radius: 3px;
- }
- .addressText.darkTheme{
- border: 1px solid #262533;
- }
- .addressText.whiteTheme{
- border: 1px solid #cfcfcf;
- }
- .divider.whiteTheme{
- color:#262533 !important;
- background-color:transparent;
- }
- .divider.darkTheme{
- background-color:transparent;
- color: white !important;
- }
- #directorySidebar{
- padding:12px;
- overflow-y:auto;
- padding-bottom:20px;
- }
- #directorySidebar.darkTheme{
- border-right:2px solid rgb(25, 24, 31);
- color:white;
- position:absolute;
- }
- #directorySidebar.whiteTheme{
- border-right:2px solid rgba(219, 226, 241, 0.7);
- background-color:#f5f5f5;
- color:rgb(44, 44, 44);
- position:absolute;
- }
- #folderView{
- position:absolute;
- padding-left:2em;
- padding-right:2em;
- padding-top:2em;
- overflow-y:auto;
- }
- #folderView.whiteTheme{
- background-color:white;
- }
- .item.darkTheme{
- color:white;
- }
- .rightmargin.icon{
- margin-right:8px !important;
- }
- .dir{
- cursor:pointer;
- }
- .dir:hover{
- color:#d1d1d1 !important;
- }
- .dir.item.whiteTheme{
- color:rgb(78, 78, 78);
- }
- .device{
- cursor:pointer;
- }
- .device:hover{
- color:#d1d1d1;
- }
- .accordion.darkTheme{
- color:white !important;
- }
- .accordion.whiteTheme{
- background-color:transparent !important;
- }
- .fileObject{
- display:block !important;
- cursor:pointer;
- overflow-wrap: break-word !important;
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- user-select: none;
- }
- .fileObject.darkTheme{
- border:1px solid rgb(72, 69, 88) !important;
- }
- .segmented.list.darkTheme{
- border:1px solid rgb(8, 8, 10) !important;
- box-shadow: 0 0 0 0;
- border-radius: 0px;
- }
- .fileObject.darkTheme:hover{
- background-color:#17161f !important;
- }
- .fileObject.darkTheme:hover span{
- background-color:#17161f !important;
- }
- .fileObject.whiteTheme:hover{
- background-color:#f2f2f2 !important;
- }
- .fileObject.darkTheme.selected{
- background-color:#100f16 !important;
-
- }
- .fileObject.darkTheme.selected span{
- background-color:#100f16 !important;
-
- }
- .fileObject.whiteTheme.selected{
- background-color:#d2f2f7 !important;
- color:black !important;
- }
- .mobilePathDisplayWrapper{
- width:100%;
- margin-bottom:5px;
- }
- .ts.card.darkTheme{
- border:1px solid rgb(72, 69, 88) !important;
- box-shadow: 0 0 0 0 transparent;
- }
- .darkTheme.header{
- color:white !important;
- background-color:transparent !important;
- }
- .darkTheme.meta{
- color:rgba(255, 255, 255, 0.836) !important;
- background-color:transparent !important;
- }
- .darkTheme.description{
- color:white !important;
- background-color:transparent !important;
- }
- .whiteTheme.header{
- background-color:transparent;
- }
- .whiteTheme.meta{
- background-color:transparent;
- }
- .whiteTheme.description{
- background-color:transparent;
- }
- #folderList{
- margin-bottom:16px;
- }
- .msgbox{
- padding:3px;
- }
- .closeMsgButton{
- position:absolute;
- top:8px;
- right:12px;
- }
- .closeMsgButton{
- cursor:pointer;
- }
- .popup{
- position:fixed;
- top:30px;
- z-index:110;
- left:34%;
- right:34%;
- bottom:30px;
- padding-bottom:24px;
- border: 0px solid transparent !important;
- }
- .popup.wide{
- left:24%;
- right:24%;
- }
- .popup.darkTheme{
- -webkit-box-shadow: 3px 4px 5px 0px rgb(35, 33, 46) ;
- -moz-box-shadow: 3px 4px 5px 0px rgb(35, 33, 46);
- box-shadow: 3px 4px 5px 0px rgb(35, 33, 46) ;
- border: 1px solid rgb(22, 21, 29);
- }
- .popup.whiteTheme{
- -webkit-box-shadow: 3px 4px 5px 0px rgba(138,138,138,1);
- -moz-box-shadow: 3px 4px 5px 0px rgba(138,138,138,1);
- box-shadow: 3px 4px 5px 0px rgba(138,138,138,1);
- border: 1px solid rgb(226, 226, 226);
- background-color:white;
- }
- @media only screen and (max-width: 1920px) {
- .popup{
- left:35em;
- right:35em;
- }
- .popup.wide{
- left:20em;
- right:20em;
- }
- }
- @media only screen and (max-width: 1500px) {
- .popup{
- left:20em;
- right:20em;
- }
- .popup.wide{
- left:14em;
- right:14em;
- }
- }
-
-
- @media only screen and (max-width: 1200px) {
- .popup{
- left:14em;
- right:14em;
- }
- .popup.wide{
- left:5em;
- right:5em;
- }
- }
- @media only screen and (max-width: 800px) {
- .popup{
- left:5em;
- right:5em;
- }
- .popup.wide{
- left:2em;
- right:2em;
- }
- }
- @media only screen and (max-width: 600px) {
- .popup{
- position:fixed;
- top:5%;
- z-index:100;
- left:1em;
- right:1em;
- }
- }
- .popupheader{
- width:100%;
- padding:3px;
- padding-left:12px;
- border-bottom:2px solid #34b7eb;
- background-color: #171719;
- color: white;
- height:29px;
- }
- .popupcontent{
- height: calc(100% - 29px);
- overflow:auto;
- }
- .popupcloser{
- position:absolute;
- top:5px;
- right:0px;
- font-size: 120%;
- cursor:pointer;
- }
- .popupbuttons{
- cursor:pointer;
- padding:5px;
- padding-left:12px;
- margin-bottom:4px;
- border: 1px solid #dedede;
- border-radius: 4px;
- }
- .popupbuttons.primary.whiteTheme{
- background-color:#51aded;
- box-shadow: 0 2px 1px 0px #34a2ee !important;
- border: 1px solid transparent;
- color:white;
- }
- .popupbuttons.negative{
- background-color:#ed5151;
- box-shadow: 0 2px 1px 0px #ee3434 !important;
- border: 1px solid transparent;
- color:white;
- }
- .popupbuttons.primary.darkTheme{
- background-color:#413f57 !important;
- box-shadow: 0 2px 1px 0px #3c3b50 !important;
- border: 1px solid transparent;
- color:white;
- }
- .popupbuttons.negative.darkTheme{
- background-color:#ed5151 !important;
- }
- .popupbuttons.disabled{
- opacity: 0.4;
- pointer-events: none;
- }
- .popupbuttons.primary.disabled{
- opacity: 0.4;
- pointer-events: none;
- }
- .whiteTheme.allowHover:hover{
- background-color:rgba(238, 238, 238, 0.932);
- }
- .whiteTheme.allowHover.primary:hover{
- background-color:#76c0f5;
- }
- .allowHover.negative:hover{
- background-color:#f57676;
- }
- .allowHover.negative.darkTheme:hover{
- background-color:#f57676 !important;
- }
- .darkTheme.allowHover:hover{
- background-color:#111017 !important;
- }
- .ts.list.darkTheme{
- background-color:#464457 !important;
- }
- input.darkTheme{
- color:white !important;
- }
- .ts.segmented.list.darkTheme .item{
- color:white !important;
- }
- .newFileFormat{
- cursor:pointer;
- }
-
- .popupWrapper{
- position:fixed;
- top:0px;
- left:0px;
- width:100%;
- height:100%;
- z-index:99;
- background-color:rgba(27,27,27,0.5);
- display:none;
- }
- @supports (backdrop-filter: none) {
- .popupWrapper {
- backdrop-filter: blur(5px);
- }
- }
- .breadcrumb.whiteTheme{
- background-color:white;
- }
- #openWithModuleList{
- height:250px;
- overflow-y:auto;
- }
- #openWith .segment.darkTheme{
- color:white !important;
- }
- #openWithModuleList .item{
- padding:8px;
- padding-left:22px;
- border-radius: 2px;
- display: flex;
- flex-wrap: wrap;
- }
- #openWithModuleList.darkTheme .item.selected{
- background-color:#100f16 !important;
- }
- #openWithModuleList.whiteTheme .item.selected{
- background-color:#51aded !important;
- color:white;
- }
-
- #openWithModuleList.darkTheme .item.selectable:hover{
- background-color:rgba(250,250,250,0.05);
- }
- #openWithModuleList.whiteTheme .item.selectable:hover{
- background-color:rgba(35,35,35,0.14);
- }
- .contextmenu.darkTheme .item{
- color:white !important;
- }
- .contextmenu .item{
- font-size:90% !important;
- }
- #uploadTab{
- position:fixed;
- right:0px;
- bottom: 0px;
- width:300px;
- margin-bottom:0px !important;
- padding:0px !important;
- }
- #uploadTab.darkTheme{
- color:white;
- background-color:rgba(35,35,35,0.14);
- border: 1px solid #17161f !important;
- box-shadow: 0px 0px 0px 0px rgba(0,0,0,0.75);
- }
- .statusBar{
- height:32px;
- background-color:#f5f5f5;
- padding:8px;
- }
- .statusBar.whiteTheme{
- color:rgb(78, 78, 78);
- }
- .statusBar.darkTheme{
- background-color:#181720 !important;
- }
- .hideUploadButton{
- float: right;
- cursor:pointer;
- }
- .uploadList{
- margin:8px;
- padding-bottom:3px;
- margin-bottom:0px;
- max-height: 250px;
- overflow-y:auto;
- }
- .uploadTask{
- margin-top:6px;
- }
- .uploadTaskRemoveIcon{
- position:absolute;
- top:0px;
- right:0px;
- cursor:pointer;
- }
- .clearallButton{
- padding:8px;
- cursor:pointer;
- }
- .normal.object.whiteTheme{
- color:#303030;
- }
- .normal.object.darkTheme{
- color:white;
- }
- .sub.header.darkTheme{
- color:rgb(190, 190, 190) !important;
- }
- .hex.foldername{
- color:#2b9447 !important;
- }
- .um.filename{
- color: #69aaff !important;
- }
- .dropdown.inverted{
- background-color: #17161f !important;
- }
- .sharebtn{
- cursor: pointer;
- }
- .sharebtn.darkTheme {
- color: white !important;
- background-color: transparent !important;
- }
- .sharebtn.whiteTheme:hover{
- opacity: 0.5;
- }
- .sharebtn.darkTheme:hover{
- opacity: 0.5;
- }
- i.blue{
- color: #345eeb;
- }
- </style>
- </head>
- <body class="whiteTheme">
- <div id="navibar" class="navibar whiteTheme">
- <!-- Directoy navigations -->
- <button id="backbtn" class="ts icon tiny button standard whiteTheme" onclick="previosPath();" title="Back"><i class="left arrow icon"></i></button>
- <button id="ppbtn" class="ts icon tiny button standard whiteTheme rightPad" onclick="parentDir();" title="Parent Folder"><i class="up arrow icon"></i></button>
-
- <!-- File Read Operations -->
- <button class="ts icon tiny button standard whiteTheme" title="Open" onclick="openViaButton();"><i class="folder open icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="Open with" onclick="openWith();"><i class="external icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme singleObjectOnly" title="Share File" onclick="shareFile();"><i class="share alternate icon"></i></button>
- <button class="ts labeled icon tiny button standard whiteTheme" style="width:154px;" title="Download" onclick="downloadFile();">
- <i class="download icon"></i>
- Download
- </button>
- <!-- File Edit Operations -->
- <button class="ts icon tiny button standard whiteTheme" title="Copy" onclick="copy();"><i class="copy icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="Paste" onclick="paste();"><i class="paste icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="Cut" onclick="cut();"><i class="cut icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="New File" onclick="newfile();"><i class="file outline icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="New Folder" onclick="newFolder();"><i class="folder outline icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="Upload" onclick="upload();"><i class="upload icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="Create Zip" onclick="zipFile();"><i class="zip file icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="Rename" onclick="rename();"><i class="i cursor icon"></i></button>
- <button class="ts icon tiny negative button" title="Delete" onclick="deleteFile();"><i class="trash outline icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="Refresh" onclick="refreshList();"><i class="refresh icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="Home" onclick="openHomeDir();"><i class="home icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="File Info" onclick="showFileProperties();"><i class="notice icon"></i></button>
-
-
- <div class="addressBar">
- <button class="ts icon tiny button standard whiteTheme" onclick="toggleSidebar();" title="Toggle Folder List"><i class="content icon"></i></button>
- <button class="ts icon tiny button inverted" title="Dark Theme" onclick="toggleDarkTheme();"><i class="moon icon" id="darkthemebtn"></i></button>
- <button class="ts tiny icon button standard whiteTheme" title="Edit Path" onclick="showEditCurrentPathInput(event)"><i class="ui edit icon"></i></button>
- <div id="pathDisplayField" class="ts breadcrumb whiteTheme addressText pathDisplay desktopOnly" ondblclick="showEditCurrentPathInput(event);">
- <div class="section whiteTheme selectable"><i class="folder icon"></i> user</div>
- <div class="divider whiteTheme">:/</div>
- <div class="section whiteTheme selectable">Desktop</div>
- </div>
-
- <div id="pathInputField" class="ts action mini input whiteTheme" style="display:none;">
- <input type="text" style="min-width: 200px;" class="whiteTheme" placeholder="Type a path and press enter" onkeydown="handleOpenPathKeydown(event);">
- <button class="ts icon button" title="Open" onclick="openEnteredPath(this);">
- <i class="checkmark icon"></i>
- </button>
- </div>
- <div class="rightAlign">
- <select id="sortingMethodSelector" title="Sorting Method" class="ts basic borderless mini dropdown" onchange="updateSortingMethods();" autocomplete="off">
- <option value="default">Ascending</option>
- <option value="reverse">Descending</option>
- <option value="smallToLarge">Smallest</option>
- <option value="largeToSmall"> Largest</option>
- <option value="mostRecent">Most Recent</option>
- <option value="leastRecent">Least Recent</option>
- </select>
- <button id="searhbtn" class="ts icon tiny button standard whiteTheme" title="Search" onclick="toggleSearch();"><i class="search icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme videmode" mode="grid" title="Block View" onclick="changeViewMode(this);"><i class="block layout icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme videmode" mode="list" title="List View" onclick="changeViewMode(this);"><i class="align justify icon"></i></button>
- </div>
- </div>
- <div class="mobilePathDisplayWrapper">
- <div id="mobilePathDisplay" style="width:100%;" class="ts pathDisplay breadcrumb whiteTheme addressText mobileOnly">
- <div class="section whiteTheme selectable"><i class="folder icon"></i> user</div>
- <div class="divider whiteTheme">:/</div>
- <div class="section whiteTheme selectable">Desktop</div>
- </div>
- </div>
- <div class="searchbar" style="z-index:999; display:none;">
- <div style="width: 80%; display:inline-block; margin-top:-4px;">
- <div class="ts mini fluid input">
- <input autocomplete="off" id="searchInput" type="text" class="whiteTheme" placeholder="File Search (Start wildcard search with / , e.g. /*.mp3)" onkeypress="handleSearchBarPress(event);">
- </div>
- </div>
- <button class="ts icon tiny button standard whiteTheme" title="Case Sensitive" onclick="toggleCaseSensitive(this);">Aa</button>
- <button class="ts icon tiny button standard whiteTheme" title="Search" onclick="handleSearch();"><i class="search icon"></i></button>
- <button class="ts icon tiny button standard whiteTheme" title="Clear Search" onclick="hideSearchBar();"><i class="remove icon"></i></button>
- </div>
- <div class="msgbox" style="z-index:999; display:none;">
- <i class="checkmark icon"></i> <span>No Message</span>
- <div class="closeMsgButton" onclick="$(this).parent().slideUp('fast');"><i class="remove icon"></i></div>
- </div>
- </div>
-
- <div id="mainWindow">
- <div id="directorySidebar" class="whiteTheme">
- <div class="ts list">
- <details class="ts accordion fluid whiteTheme" open>
- <summary>
- <i class="dropdown icon"></i> User
- </summary>
- <div id="userroot" class="ts list" style="padding-top:0px !important;">
- <div class="dir item whiteTheme"><i class="loading circle notched rightmargin icon"></i> Initiating</div>
- </div>
- </details>
- <details class="ts accordion fluid whiteTheme" open>
- <summary>
- <i class="dropdown icon"></i> Storage
- </summary>
- <div id="storageroot" class="ts list" style="padding-top:0px !important;">
- <div class="dir item whiteTheme"><i class="loading circle notched rightmargin icon"></i> Initiating</div>
- </div>
- </details>
- <!--
- <details class="ts accordion fluid whiteTheme" open>
- <summary>
- <i class="caret down icon"></i>Disks
- </summary>
- <div id="deviceList" class="ts list" style="padding-top:0px !important;">
- <div class="dir item whiteTheme"><i class="loading circle notched rightmargin icon"></i> Initiating</div>
- </div>
- </details>
- -->
- <!-- >
- <div class="item fluid whiteTheme">
- <i class="world icon"></i>Network
- </div>
- -->
- <br>
- </div>
- </div>
- <div id="folderView" class="whiteTheme" ondrop="drop(event)" ondragover="allowDrop(event)">
- <div id="folderList" class="ts segmented fluid list whiteTheme">
- </div>
- <div id="fileList" class="ts segmented fluid list whiteTheme">
- </div>
- <br>
- </div>
- </div>
- <!-- Other popup windows -->
- <div class="popupWrapper"></div>
- <!-- Overwrite Selection Box-->
- <div id="overwriteModeSelection" class="popup whiteTheme" style="display:none;">
- <div class="popupheader whiteTheme">
- <i class="paste icon"></i> Replace, Keep or Skip Files
- <div class="popupcloser" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i>
- </div>
- </div>
- <div class="popupcontent" style="padding:12px;">
- <small style="font-size:80%;">Copying <span class="owm-fc"></span> files from <span class="owm-srcdir"></span> to <span class="owm-destdir"></span>.</small>
- <p>The destination has <span class="owm-fc"></span> files with the same names.</p>
- <div class="popupbuttons whiteTheme allowHover primary" onclick="changeOverwriteRule(0,true);">
- <i class="checkmark icon"></i> Replace the files in the destination
- </div>
- <div class="popupbuttons whiteTheme allowHover" onclick="changeOverwriteRule(1,true);">
- <i class="reply icon"></i> Skip these files
- </div>
- <div class="popupbuttons whiteTheme allowHover" onclick="changeOverwriteRule(2,true);">
- <i class="undo icon"></i> Rename and keep the files
- </div>
- </div>
- </div>
- <!-- Force delete confirmation box -->
- <div id="forceDeleteConfirmBox" class="popup whiteTheme" style="display:none;">
- <div class="popupheader whiteTheme">
- <i class="trash icon"></i> Permanently Remove Files
- <div class="popupcloser" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i>
- </div>
- </div>
- <div class="popupcontent" style="padding:12px;">
- <p>Are you sure you want to remove these files <u>permanently?</u><br>This action is <u>irreversible</u>.</p>
- <div class="ts list whiteTheme deleteFilelist" style="max-height:350px;overflow-y:auto; ">
- </div>
- <div class="popupbuttons whiteTheme allowHover" style="background-color: #eb4034 !important;" onclick="forceDelete(true);";>
- <i class="trash icon"></i> Confirm
- </div>
- <div class="popupbuttons whiteTheme allowHover" onclick="cancelForceDelete();hideAllPopupWindows();">
- <i class="remove icon"></i> Cancel
- </div>
- </div>
- </div>
- <!-- Delete confirm box -->
- <div id="deleteConfirmBox" class="popup whiteTheme" style="display:none;">
- <div class="popupheader whiteTheme">
- <i class="recycle icon"></i> Move files to Trash Bin
- <div class="popupcloser" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i>
- </div>
- </div>
- <div class="popupcontent" style="padding:12px;">
- <p>Are you sure you want to move these files to trash bin?</p>
- <div class="ts list whiteTheme deleteFilelist" style="max-height:350px;overflow-y:auto; ">
- </div>
- <div class="popupbuttons whiteTheme allowHover" style="color: #2bbbdf !important;" onclick="deleteFile(true);";>
- <i class="recycle icon"></i> Move to Trash
- </div>
- <div class="popupbuttons whiteTheme allowHover" onclick="cancelDelete();hideAllPopupWindows();">
- <i class="remove icon"></i> Cancel
- </div>
- </div>
- </div>
- <!-- Rename tool box -->
- <div id="renameBox" class="popup whiteTheme" style="display:none;">
- <div class="popupheader whiteTheme">
- <i class="text cursor icon"></i> Rename Files
- <div class="popupcloser" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i>
- </div>
- </div>
- <div class="popupcontent" style="padding:12px;">
- <p>Enter the new filename for renaming. </p>
- <p class="multifileWarning"><i class="notice icon"></i> Other files will be named as file(#)</p>
- <div class="ts left icon small fluid input" style="margin-bottom:12px;">
- <input type="text" class="whiteTheme orgfn" placeholder="Original Filename" readonly="true">
- <i class="minus square icon" style="color:rgb(122, 176, 247)"></i>
- </div>
- <div class="ts left icon small fluid input" style="margin-bottom:12px;">
- <input type="text" class="whiteTheme newfn" placeholder="New Filename" onkeydown="handleEnterKeyDown(event, function(){confirmRename(true);})">
- <i class="add square icon" style="color:rgb(122, 176, 247)"></i>
- </div>
- <div class="popupbuttons whiteTheme allowHover primary" onclick="confirmRename(true);";>
- <i class="checkmark icon"></i> OK
- </div>
- <div class="popupbuttons whiteTheme allowHover" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i> Cancel
- </div>
- </div>
- </div>
- <!-- New File Dialog-->
- <div id="newFile" class="popup whiteTheme" style="display:none;">
- <div class="popupheader whiteTheme">
- <i class="add icon"></i> New File
- <div class="popupcloser" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i>
- </div>
- </div>
- <div class="popupcontent" style="padding:12px;">
- <p>Please select a type of file to be created.</p>
- <div class="ts segmented list whiteTheme newfilelist" style="max-height:18em; overflow-y:scroll">
- <div class="item newFileFormat" ext="php">No Item</div>
- </div>
- <p>Or create an empty file with given filename:</p>
- <div class="ts left icon small fluid input" style="margin-bottom:12px;">
- <input id="createNewFileName" type="text" class="whiteTheme" placeholder="New Filename" onkeydown="handleEnterKeyDown(event, confirmNewFile);">
- <i class="add square icon" style="color:rgb(122, 176, 247)"></i>
- </div>
- <p class="duplicateWarning" style="color:#CE5F58; display:none;"><i class="caution sign icon"></i> The given filename already exist.</p>
- <div class="popupbuttons whiteTheme allowHover primary" onclick="confirmNewFile();";>
- <i class="add icon"></i> Create
- </div>
- <div class="popupbuttons whiteTheme allowHover" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i> Cancel
- </div>
- </div>
- </div>
- <!-- New Folder Dialog-->
- <div id="newFolder" class="popup whiteTheme" style="display:none;">
- <div class="popupheader whiteTheme">
- <i class="folder icon"></i> New Folder
- <div class="popupcloser" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i>
- </div>
- </div>
- <div class="popupcontent" style="padding:12px;">
- <p>Please enter the new folder name to be created.</p>
- <div class="ts left icon small fluid input" style="margin-bottom:12px;">
- <input id="createNewFolder" type="text" class="whiteTheme" placeholder="New Folder Name" onkeydown="handleEnterKeyDown(event, function(){newFolder(true);});">
- <i class="add square icon" style="color:rgb(122, 176, 247)"></i>
- </div>
- <p class="duplicateWarning" style="color:#CE5F58; display:none;"><i class="caution sign icon"></i> The given folder already exist.</p>
- <div class="popupbuttons whiteTheme allowHover primary" onclick="newFolder(true);";>
- <i class="add icon"></i> Create
- </div>
- <div class="popupbuttons whiteTheme allowHover" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i> Cancel
- </div>
- </div>
- </div>
- <!-- Share File Dialog-->
- <div id="shareFile" class="popup wide whiteTheme" style="display:none;">
- <div class="popupheader whiteTheme">
- <i class="external icon"></i> Share File
- <div class="popupcloser" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i>
- </div>
- </div>
- <div class="popupcontent" style="padding:12px;">
- <div class="ts stackable grid">
- <div class="eight wide column">
- <div class="width: 100%; ">
- <div style="display: block; margin-left: auto; margin-right: auto;" align="center">
- <div id="qrcode" style="border: 10px solid white; background-color: white;"></div>
- </div>
- <a id="sharelink" href="" target="_blank" style="margin-top:8px; font-size: 120%; padding-left: 20px; padding-right: 20px; word-break: break-all;">Scan this QR Code to copy the share link</a>
- </div>
- </div>
- <div class="eight wide column" style="padding-left: 12px;">
- <div class="ts header whiteTheme">
- Share Settings
- <div class="sub header whiteTheme">Change who can see this file</div>
- </div>
- <div id="shareSettingForm" class="ts form">
- <div class="field">
- <label><p class="whiteTheme">Visable options:</p></label>
- <div class="ts checkboxes">
- <div class="ts radio checkbox">
- <input id="anyone" type="radio" class="shareoption" name="shareopt" value="anyone" checked="true">
- <label for="anyone">
- <div class="ts header">
- <div class="content whiteTheme">
- <i class="globe icon"></i> Anyone with the link
- <div class="sub header whiteTheme">Anyone who has the link can access this file</div>
- </div>
- </div>
- </label>
- </div>
- <div class="ts radio disabled checkbox">
- <input id="signedin" type="radio" class="shareoption" value="signedin" name="shareopt">
- <label for="signedin">
- <div class="ts header">
- <div class="content whiteTheme">
- <i class="user circle outline icon"></i> Anyone signed in
- <div class="sub header whiteTheme">Anyone who has signed in can access this file</div>
- </div>
- </div>
- </label>
- </div>
- <div class="ts radio disabled checkbox">
- <input id="samegroup" type="radio" class="shareoption" value="samegroup" name="shareopt">
- <label for="samegroup">
- <div class="ts header">
- <div class="content whiteTheme">
- <i class="users icon"></i> Users in the same group
- <div class="sub header whiteTheme">Anyone who is in the same group as you do</div>
- </div>
- </div>
- </label>
- </div>
- <br>
- <button class="ts small button" onclick="updateShareSettings(this)" style="border: 0px solid transparent;">Update</button>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <div class="ts divider"></div>
- <div id="sharingRemoveBtn" class="popupbuttons negative whiteTheme allowHover" onclick="removeSharing()">
- <i class="remove icon"></i> Remove Sharing
- </div>
- <div class="popupbuttons whiteTheme allowHover" onclick="hideShare()">
- <i class="checkmark icon"></i> OK
- </div>
- </div>
- </div>
- <!-- Open With Dialog-->
- <div id="openWith" class="popup whiteTheme" style="display:none;">
- <div class="popupheader whiteTheme">
- <i class="external icon"></i> Open File With
- <div class="popupcloser" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i>
- </div>
- </div>
- <div class="popupcontent" style="padding:12px;">
- <p>Select a module from the list below:</p>
- <div id="openWithModuleList" class="ts segment whiteTheme" style="padding:0px;">
- <div class="item selectable">
- <div class="content" style="padding-left:12px;">
- <div class="header">Loading...</div>
- </div>
- </div>
- </div>
- <div class="openWithModule popupbuttons whiteTheme allowHover primary" onclick="openWithSelectedModule(this);";>
- <i class="external icon"></i> Open with Selected Module
- </div>
- <div class="openWithModule popupbuttons whiteTheme allowHover" onclick="openFileWithModuleInNewTab(this);">
- <i class="add icon"></i> Open in new tab
- </div>
- <div class="popupbuttons whiteTheme allowHover vdonly" onclick="openRawFileInFloatWindow(this);">
- <i class="window restore outline icon"></i> Open File directly in floatWindow
- </div>
- <div class="popupbuttons whiteTheme allowHover" onclick="hideAllPopupWindows();">
- <i class="remove icon"></i> Cancel
- </div>
- </div>
- </div>
- <!-- Context Menu -->
- <div id="contextmenu" class="ts small contextmenu visible whiteTheme" style="min-width:250px;">
- <div class="item" onclick="openViaButton();">
- <i class="folder open icon"></i> Open
- </div>
- <div class="item fileonly" onclick="openWith();">
- <i class="external icon"></i> Open With
- </div>
- <div class="item folderonly" onclick="openSelectedFolderInNewWindow();">
- <i class="external icon"></i> Open In New Window
- </div>
- <!-- This is the vroot alternative new windows-->
- <div class="item vrootonly" onclick="openSelectedVroot();">
- <i class="external icon"></i> Open In New Window
- </div>
- <div class="item shareonly" onclick="openFileLocation();">
- <i class="folder outline icon"></i> Open File Location
- </div>
- <div class="item singleObjectOnlyHide" onclick="shareFile();">
- <i class="share alternate icon"></i> Share
- </div>
- <div class="item mobileonly" onclick="toggleCtrl();">
- <i class="mouse pointer icon"></i> Multi-select
- </div>
- <div class="item" onclick="copy();">
- <i class="copy icon"></i> Copy
- <span class="description">Ctrl + C</span>
- </div>
- <div class="item allowNoSelection" onclick="paste();">
- <i class="paste icon"></i> Paste
- <span class="description">Ctrl + V</span>
- </div>
- <div class="item" onclick="cut();">
- <i class="cut icon"></i> Cut
- <span class="description">Ctrl + X</span>
- </div>
- <div class="divider vroothide noSelectionOnly"></div>
- <div class="item noSelectionOnly" onclick="newfile();">
- <i class="file outline icon"></i> New File
- </div>
- <div class="item noSelectionOnly" onclick="newFolder();">
- <i class="folder outline icon"></i> New Folder
- </div>
- <div class="divider vroothide"></div>
- <div class="item noSelectionOnly" onclick="upload();">
- <i class="upload icon"></i> Upload
- </div>
- <div class="item" onclick="zipFile();">
- <i class="zip file icon"></i> Create Zip
- </div>
- <div class="item" onclick="rename();">
- <i class="i cursor icon"></i> Rename
- </div>
- <div class="item" onclick="deleteFile();">
- <i class="trash icon"></i> Delete
- </div>
- <div class="item backuponly" onclick="openBackupManager();">
- <i class="block layout icon"></i> Backup & Restore
- </div>
- <div class="divider vroothide"></div>
- <div class="item noSelectionOnly" onclick="refreshList();">
- <i class="refresh icon"></i> Refresh
- </div>
- <div class="item" onclick="downloadFile();">
- <i class="download icon"></i> Download
- </div>
- <div class="item" onclick="showFileProperties();">
- <i class="notice icon"></i> Properties
- </div>
- <!-- This properties shows the currentDirectory properties instead of the selected file properties-->
- <div class="item noSelectionOnly" onclick="showCurrentDirectoryProperties();">
- <i class="notice icon"></i> Properties
- </div>
- <!-- This properties show the vroot properties -->
- <!-- This properties shows the currentDirectory properties instead of the selected file properties-->
- <div class="item vrootonly" onclick="showVrootProperties();">
- <i class="notice icon"></i> Properties
- </div>
- </div>
- <!-- Upload Progress Bars-->
- <div id="uploadTab" class="ts segment whiteTheme" style="display:none;">
- <div class="statusBar whiteTheme">
- <i class="upload icon"></i><span id="uploadCount">0</span> Files / <i class="wait icon"></i> <span id="waitingCount">0</span> Files
- <div class="hideUploadButton" onclick="toggleUploadList();">
- <i class="caret down icon"></i>
- </div>
- </div>
- <div class="uploadList" id="uploadProgressList">
-
- </div>
- <br>
- <!--
- <div class="clearallButton">
- <a onclick="clearAllUploadTask();">Clear All</a>
- </div>
- -->
- </div>
-
- <script>
- let directorySidebarWidth = 250; //Width of the sidebar
- let sideBarShown = true; //Indicate if sidebar is shown
- let rootDirs = []; //Storage location for rootDirs
- let currentTheme = "whiteTheme"; //Default theme
- let viewMode = "list"; //Viewmode, support {list, grid, detail}
- let sortMode = "default"; //Sortmode, support {default, reverse, smallToLarge, largeToSmall, mostRecent, leastRecent}
- let currentPath = "user:/"
- let viewHistory = []; //View history
- let enableBetaFilename = false; //Enable beta filename conversion from "inith..." to "normal"
- let currentFilelist = []; //The current file list in the currentPath
- let currentPathHash = ""; //The folder content hash
- let enableAutoRefresh = true; //Enable directory updates on file change
- let filesIconTheme = "default";
- //File operations
- let clipboard = []; //System clipboard
- let cutMode = false; //If set to true, this is cut mode. Else copy mode
- let useLocalstorage = lscheck();
- let overwriteMode = "keep"; //Overwrite mode, support {skip, overwrite, keep}
- let thumbRenderWebSocket = null;
- let searchCaseSensitive = false;
- let searchMode = false;
- //Keypress listeners
- let ctrlHold = false;
- let shiftHold = false;
- //Upload related
- let uploadingFileCount = 0;
- let maxConcurrentUpload = 4; //Maxmium number of oncurrent upload
- let uploadPendingList = []; //Upload pending queue for mass upoad
- let lowMemoryMode = true; //Upload with low memory mode channel
- let uploadFileChunkSize = 1024 * 512; //512KB, 4MB not working quite well on slow network
- //File Sharing related
- let shareEditingObject = "";
- let shareEditingUUID = "";
- //System Information
- let systemUUID = "";
- let systemIP = "";
- //Browser detection
- let isMobile = window.mobilecheck();
- let isChromium = window.chrome;
- let isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
- let isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
- let isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
- //Intiiation functions
- initRootDirs();
- initSystemInfo();
- initUploadMode();
- if (isMobile){
- //Mobile css adjustment
- sideBarShown = false;
- $("#directorySidebar").hide();
- $("#directorySidebar").css("width",window.innerWidth + "px");
- $("body").css("overflow","hidden");
- directorySidebarWidth = window.innerWidth;
- $("#folderView").css({
- "padding-right":"1em",
- "padding-left":"1em",
- "padding-top":"1em",
- });
- $(".desktopOnly").hide();
- $(".mobileOnly").show();
- //Adjust minor css on mobile devices
- $(".rightPad").css("margin-right", "37px");
- }else{
- $(".mobileOnly").hide();
- $(".desktopOnly").show();
- $(".rightPad").css("margin-right", "37px");
- }
- //Initialize view mode buttons
- updateViewmodeButtons();
- loadListModeFromDB();
- //Initialize system theme
- loadPreference("file_explorer/theme",function(data){
- if (data.error === undefined){
- if (data == "darkTheme"){
- toggleDarkTheme();
- }else{
- //White theme
-
- }
- }
- });
- if (window.location.hash != ""){
- //Check if the hash is standard open protocol. If yes, translate it
- if (ao_module_loadInputFiles() === null){
- //Window location hash set. List the desire directory
- currentPath = window.location.hash.substring(1,window.location.hash.length);
- if (currentPath.substring(currentPath.length -1) != "/"){
- currentPath = currentPath + "/";
- }
- currentPath = decodeURIComponent(currentPath);
- loadListModeFromDB(function(){
- listDirectory(currentPath);
- });
-
- }else{
- //This is ao_module load file input. Handle the file opening
- var filelist = ao_module_loadInputFiles();
- if (filelist.length > 0){
- filelist = filelist[0];
- //Check if this is folder or file. Only opendir when it is folder
- //Updates 27-12-2020: Open folder and highlight the file if it is file
- if (filelist.filename.includes(".") == false){
- //Try to open it and overwrite the hash to filesystem hash
- loadListModeFromDB(function(){
- listDirectory(filelist.filepath);
- });
- }else{
- //File. Open its parent folder and highlight the target file if exists
- var parentdir = filelist.filepath.split("/");
- let focusFilename = JSON.parse(JSON.stringify(filelist.filename));
- parentdir.pop();
- parentdir = parentdir.join("/");
- loadListModeFromDB(function(){
- listDirectory(parentdir, function(){
- focusFileObject(focusFilename);
- });
- });
- }
- }
- }
- }else{
- //Initialized directory views
- loadListModeFromDB(function(){
- listDirectory(currentPath);
- });
- }
-
-
-
- //Create a timer to check change in current folder
- setInterval(function(){
- if (enableAutoRefresh == false){
- return;
- }
- getDirHash(function(hash){
- if (hash.error !== undefined){
- //Something went wrong. Ignore this request
- console.log(hash.error)
- }else{
- //Check if the hash match with the last hash.
- if (hash != currentPathHash){
- //console.log(currentPathHash, hash);
- refreshList();
- currentPathHash = hash;
- if (currentPath == "user:/"){
- //Reload the User root folder list
- initRootDirs();
- }
- }
- }
- });
- }, 5000)
- //END OF INIT FUNCTIONS
- //Get the system ID and ip address from the system id services
- function initSystemInfo(){
- $.get("../../system/id/requestInfo",function(data){
- if (data.error !== undefined){
- msgbox("remove", data.error);
- }else{
- systemUUID = data.SystemUUID;
- systemIP = data.IpAddress;
- }
- });
- }
- //Initiate the sidebar contents
- function initRootDirs(){
- //Load user directories
- $.ajax({
- url:"../../system/file_system/listRoots?user=true",
- success: function(data){
- $("#userroot").html("");
- for (var i =0; i < data.length; i++){
- var thisRootObject = data[i];
- if (thisRootObject.IsDir == true && !(thisRootObject.Filename == ".cache" || thisRootObject.Filename == ".trash")){
- //Files will not be listed in the root directory list
- var icon = getUserRootIcons(thisRootObject.Filename);
- var displayName = thisRootObject.Filename;
- var vpath = thisRootObject.Filepath;
- $("#userroot").append(`<div class="dir item ${currentTheme}" filepath="${vpath}" type="folder" onclick="openthis(this);"><i class="${icon} rightmargin icon"></i> ${displayName}</div>`);
- }
- }
- }
- });
- //Load other storage devices
- $.ajax({
- url:"../../system/file_system/listRoots",
- success: function(data){
- $("#storageroot").html("");
- for (var i =0; i < data.length; i++){
- var thisRoot = data[i];
- var displayName = thisRoot.RootName;
- var rootPath = thisRoot.RootPath;
- var containBackup = thisRoot.RootBackups;
- $("#storageroot").append(`<div class="dir item ${currentTheme}" contain-backup="${containBackup}" filepath="${rootPath}" type="folder" rootname="${displayName}" onclick="openthis(this);"><i class="disk outline rightmargin icon"></i> ${displayName} (${rootPath})</div>`);
- }
- }
- });
- //Initial Host device drives
- /*
- $.ajax({
- url: "../../system/file_system/listDrives",
- success: function(data){
- $("#deviceList").html("");
- for (var i =0; i < data.length; i++){
- var drivePath = data[i].Drivepath;
- var usagePercentage = ((data[i].DriveTotalSpace - data[i].DriveFreeSpace) / data[i].DriveTotalSpace) * 100;
- var className = "primary";
- if (usagePercentage > 90){
- className = "negative";
- }
- $("#deviceList").append(`<div class="dir item ${currentTheme}" filepath="${drivePath}" ><i class="disk outline rightmargin icon"></i> ${drivePath}
- <div style="width:100px;height:15px !important; position:absolute;right:3px;top:6px;"">
- <div class="ts ${className} tiny progress">
- <div class="bar" style="width: ${usagePercentage}%"></div>
- </div>
- </div>
- </div>`);
- }
- }
- });
- */
- }
-
- function getUserRootIcons(foldername){
- var icon = "folder open";
- foldername = foldername.toLowerCase();
- if (foldername == "desktop"){
- icon = "computer";
- }else if (foldername == "document"){
- icon = "file text outline";
- }else if (foldername == "music" || foldername == "audio"){
- icon = "music";
- }else if (foldername == "photo" || foldername == "picture"){
- icon = "image";
- }else if (foldername == "video" || foldername == "film"){
- icon = "video";
- }else if (foldername == "trash" || foldername == "bin" || foldername == "rubbish"){
- icon = "trash"
- }else if (foldername == "download"){
- icon = "download"
- }else if (foldername == "www" || foldername == "web" || foldername == "mysite"){
- icon = "globe"
- }else if (foldername == "model"){
- icon = "cube"
- }else if (foldername == "appdata"){
- icon = "code"
- }
- return icon;
- }
- // ============================== FOLDER LISTING FUNCTIONS ====================
- function listDirectory(path, callback=undefined, recordUndo=true){
- var recordPreviousPage = true;
- if (recordUndo == false){
- recordPreviousPage = false;
- }
- //Backup the current selected files if it is an refresh operation
- let selectedFiles = [];
- if (path == currentPath){
- $(".fileObject.item.selected").each(function(){
- selectedFiles.push($(this).attr("filename"));
- });
- //Set record histroy to false on refresh
- recordPreviousPage = false;
- }
-
- //Always pad slash to the end of path
- if (path.substring(path.length - 1) != "/"){
- path = path + "/";
- }
- //Clean the path if there are any malformat
- if (path.indexOf("//") != -1){
- path = path.split("//").join("/");
- }
- if (recordPreviousPage){
- viewHistory.push(currentPath);
- }
-
- window.location.hash = path;
- updatePathDisplay(path);
- currentPath = path;
- //Update floatWindow title if exists
- if (ao_module_virtualDesktop){
- var tmp = path.split("/");
- tmp.pop();
- ao_module_setWindowTitle("File Manager - " + tmp.pop());
- }
- //Check if there are parent path for curret path
- if (checkIfParentDirExists(currentPath)){
- $("#ppbtn").removeClass("disabled");
- }else{
- $("#ppbtn").addClass("disabled");
- }
- if (viewHistory.length < 1){
- $("#backbtn").addClass("disabled");
- }else{
- $("#backbtn").removeClass("disabled");
- }
- //Add loading screen to the folderlists and fileList
- $("#fileList").html("");
- if (currentTheme == "darkTheme"){
- $("#folderList").html(`<div style="height: 100px;">
- <div class="ts active dimmer">
- <div class="ts text loader">Loading</div>
- </div>
- </div>`);
- }else{
- $("#folderList").html(`<div style="height: 100px;">
- <div class="ts active inverted dimmer">
- <div class="ts text loader">Loading</div>
- </div>
- </div>`);
- }
-
- //Get sort mode from server side
- $.ajax({
- url: "../../system/file_system/sortMode",
- data: {opr: "get", folder: currentPath},
- success: function(data){
- if (data.error == undefined){
- sortMode = data;
- }
- $("#sortingMethodSelector").val(sortMode);
- //Start listdir event
- $.ajax({
- url: "../../system/file_system/listDir",
- method: "POST",
- data: {dir: decodeURIComponent(path), sort: sortMode},
- success: function(data){
- //Parse the filelist into global variable
- currentFilelist = [];
- if (data === null){
- //There is nothing is this folder.
- $("#folderList").hide();
- $("#fileList").hide();
- return;
- }
- if (data.error !== undefined){
- //Parse path error. Try to refresh the page
- //console.log("Path parse error! Redirecting to parent directory.", data.error);
- //var pdir = currentPath.split("/");
- //pdir.pop(); pdir.pop();
- //pdir = pdir.join("/");
- //currentPath = pdir;
- enableAutoRefresh = false;
- //Check if it is already rooted and no more parent ahead
- if (currentPath == ""){
- currentPath = "user:/";
- }
-
- //Print folder not found exceotion
- $("#folderList").show();
- $("#folderList").html(`<div class="ts basic segment ${currentTheme}">
- <div class="ts header">
- <i class="remove icon ${currentTheme}"></i> <span class="${currentTheme}">This Folder Cannot Be Opened</span>
- <div class="sub header ${currentTheme}" style="margin-top:12px;">The server return the following error message: <br><code>${data.error.toUpperCase()}</code><br>
- ${ao_module_utils.timeConverter(Date.now()/1000)}</div>
- </div>
- </div>`);
- $("#fileList").hide();
- //listDirectory(currentPath, function(){
- // window.location.reload();
- //});
- return;
- }else{
- enableAutoRefresh = true;
- //Filelist returned. Render it
- renderDirectory(data,function(){
- //Restore the selected file list
- $(".fileObject.item").each(function(){
- for (var i = 0; i < selectedFiles.length; i++){
- var thisFilename = selectedFiles[i];
- if (thisFilename == $(this).attr("filename")){
- $(this).addClass("selected");
- }
- }
- });
-
- //Perform the callback
- if (callback !== undefined){
- callback();
- }
- });
- }
- }
- });
- }
- });
- }
- //Render filelist --> Convert a file list object into the visable form of file list
- function renderDirectory(filelist, callback=undefined){
- var data = filelist;
- $("#fileList").html("");
- $("#folderList").html("");
- //Build the css strcture of the list
- if (viewMode == "list"){
- $("#fileList").attr("class",`ts segmented fluid list ${currentTheme}`);
- $("#folderList").attr("class",`ts segmented fluid list ${currentTheme}`);
- }else if (viewMode == "details"){
-
- }else if (viewMode == "grid"){
- $("#fileList").attr("class",`${currentTheme}`).css("vertical-align","top");
- $("#folderList").attr("class",`${currentTheme}`).css("vertical-align","top");
- }
-
- var files = [];
- var folders = [];
- for (var i =0; i < data.length; i++){
- if (data[i].IsDir == true){
- //This is folder
- folders.push(data[i]);
- }else{
- //This is file
- files.push(data[i]);
- }
- currentFilelist.push(JSON.parse(JSON.stringify(data[i].Filename)));
- }
- //Define the grid size for the interface
- var gridSize = 150 ;
- if (isMobile){
- //Update 3/5/2021: Optimize the width calculation method to best fit
- //A hack to align the divs to center of the container
- $("#folderView").attr("align", "center");
- $("#folderList").attr("align", "left");
- $("#fileList").attr("align", "left");
- //Calculate the best width to fit all the grids
- var bestCount = Math.floor(parseFloat($("#folderView").width()) / parseFloat(gridSize));
- var bestOffset = $("#folderView").width() % gridSize;
- gridSize = gridSize + (bestOffset / bestCount) - (window.innerWidth - $("#folderView").width()) / bestCount;
- }
-
- //List all folders
- for (var i =0; i < folders.length; i++){
- var filename = folders[i].Filename;
- var filepath = folders[i].Filepath;
- var realpath = folders[i].Realpath;
- var isDir = folders[i].IsDir;
- var filesize = folders[i].Filesize;
- var Displaysize = folders[i].Displaysize;
- var isShared = folders[i].IsShared;
- var ext = getExtFromPath(filepath);
- //var icon = ao_module_utils.getIconFromExt(ext);
- var icon = "folder";
- var shareicon = "";
- if (isShared == true){
- shareicon = `<button class="sharebtn ${currentTheme}" onclick='handleShareFilebuttonClick(event, this);' style="margin-left: 4px; height: 16px;">
- <i class='share alternate icon'></i>
- </button>`
- }
- if (viewMode == "list"){
- var textclass = "normal object";
- if (currentTheme == "darkTheme"){
- textclass += " darkTheme";
- }
- var displayName = filename;
- try{
- //Try to decode it using ArozOS Beta naming scheme
- if (enableBetaFilename && ao_module_codec.decodeHexFoldername(displayName) != displayName){
- displayName = ao_module_codec.decodeHexFoldername(displayName, false);
- textclass = "hex foldername";
- }
- }catch(ex){
- //Codec decode failed. Fallback to default name
- }
-
- $("#folderList").append(`<div class="fileObject item ${currentTheme}" draggable="true" ondragstart="onFileObjectDragStart(this,event);" ondrop="dropToFolder(event)" ondragover="allowDrop(event)" fileID="${i}" filename="${filename}" filepath="${filepath}" ondblclick="openthis(this,event);" type="folder">
- <span style="display:inline-block !important;word-break: break-all;" class="${textclass}">
- <i class="${icon} icon" style="margin-right:12px; color:#eab54e;"></i> ${displayName} ${shareicon}
- </span></div>`);
- }else if (viewMode == "grid"){
- var displayName = JSON.parse(JSON.stringify(filename));
- var textclass = "normal object";
- try{
- //Try to decode it using ArozOS Beta naming scheme
- if (enableBetaFilename && ao_module_codec.decodeHexFoldername(displayName) != displayName){
- displayName = ao_module_codec.decodeHexFoldername(displayName, false);
- textclass = "hex foldername";
- }
- }catch(ex){
- //Codec decode failed. Fallback to default name
-
- }
- if (displayName.length > 16){
- displayName = displayName.substring(0,16) + "...";
- }
- $("#folderList").append(`
- <div class="ts card fileObject ${currentTheme}" draggable="true" ondragstart="onFileObjectDragStart(this,event);" ondrop="dropToFolder(event)" ondragover="allowDrop(event)" fileID="${i}" filename="${filename}" filepath="${filepath}" ondblclick="openthis(this,event);" type="folder" style="width:${gridSize}px; display:inline-block !important;vertical-align:top; height:15em; margin-top:0px !important; overflow:hidden;">
- <div class="image" style="text-align: center;">
- <img draggable="true"ondragstart="disableDrag(event);" src="../../img/desktop/files_icon/${filesIconTheme}/folder.png" style="height: 148px; width: 148px; display: inline-block;">
- </div>
- <div class="content" style="font-size: 12px;">
- <div class="header ${currentTheme} ${textclass}" title="${filename}">${displayName} ${shareicon}</div>
- </div>
- </div>`);
- }
- }
- if (folders.length == 0){
- $("#folderList").hide();
- }else{
- $("#folderList").show();
- }
-
- //List all files
- var fl = folders.length;
- for (var i =0; i < files.length; i++){
- var filename = files[i].Filename;
- var filepath = files[i].Filepath;
- var realpath = files[i].Realpath;
- var filesize = files[i].Filesize;
- var Displaysize = files[i].Displaysize;
- var isShared = files[i].IsShared;
- var ext = getExtFromPath(filepath);
- var icon = "file outline";
- if (ext == ""){
- icon = "file outline";
- }else if (ext == "shortcut"){
- //Use the default shortcut icon
- icon = ao_module_utils.getIconFromExt(ext);
- //Check if the shortcut object exists
- if (files[i].Shortcut != undefined){
- icon = files[i].Shortcut.Icon;
- }
- }else{
- icon = ao_module_utils.getIconFromExt(ext);
- }
- var shareicon = "";
- if (isShared){
- shareicon = `<button class="sharebtn ${currentTheme}" onclick='handleShareFilebuttonClick(event, this);' style="margin-left: 4px; height: 16px;">
- <i class='share alternate icon'></i>
- </button>`
- }
-
- var fileType = "file";
- if (ext == "shortcut"){
- fileType = "shortcut";
- }
- if (viewMode == "list"){
- var displayName = filename;
- var textclass = "normal object";
- if (currentTheme == "darkTheme"){
- textclass += " darkTheme";
- }
- if (ext == "shortcut"){
- //This is a shortcut file
- displayName = files[i].Shortcut.Name;
- //Adjust the icon based on its shortcut ype
- switch(files[i].Shortcut.Type){
- case "folder":
- icon = "blue folder";
- break;
- case "module":
- icon = "play circle";
- break;
- default:
- icon = "external";
- }
- }
- if (enableBetaFilename){
- decodedName = ao_module_codec.decodeUmFilename(displayName);
- if (decodedName != displayName){
- displayName = decodedName;
- textclass = "um filename";
- }
- filename = ao_module_codec.decodeUmFilename(filename);
- }
- $("#fileList").append(`<div class="fileObject item ${currentTheme}" draggable="true" ondragstart="onFileObjectDragStart(this,event);" fileID="${fl + i}" filename="${filename}" filepath="${filepath}" ondblclick="openthis(this,event);" type="${fileType}" filesize="${filesize}" displaysize="${Displaysize}">
- <span style="display:inline-block !important;word-break: break-all;text-overflow: ellipsis !important;overflow: hidden;" class="${textclass}">
- <i class="${icon} icon" style="margin-right:12px;"></i>
- ${displayName} ${shareicon}
- </span>
- </div>`);
- }else if (viewMode == "grid"){
- //Update the icon path depends on the type of file
- var imagePath = "../../img/desktop/files_icon/" + filesIconTheme + "/" + icon + ".png";
- var displayName = JSON.parse(JSON.stringify(filename));
- if (ext == "shortcut"){
- //This is a shortcut file. Treat it specially
- imagePath = "../../" + icon;
- displayName = files[i].Shortcut.Name;
- ext = files[i].Shortcut.Type;
- ext = ext.charAt(0).toUpperCase() + ext.slice(1);
- }else{
- ext = "." + ext;
- }
- var textclass = "normal object";
- if (enableBetaFilename){
- decodedName = ao_module_codec.decodeUmFilename(displayName);
- if (decodedName != displayName){
- textclass = "um filename";
- displayName = decodedName;
- }
- filename = ao_module_codec.decodeUmFilename(filename);
- }
-
- if (displayName.length > 20){
- displayName = displayName.substring(0,20) + "...";
- }
-
-
- $("#fileList").append(`
- <div class="ts card fileObject ${currentTheme}" draggable="true" ondragstart="onFileObjectDragStart(this,event);" fileID="${fl + i}" filename="${filename}" filepath="${filepath}" ondblclick="openthis(this,event);" type="${fileType}" style="width:${gridSize}px; display:inline-block !important;vertical-align:top; height:20em; margin-top:0px !important; overflow:hidden;">
- <div class="image" style="text-align: center !important;">
- <img draggable="true"ondragstart="disableDrag(event);" style="height: 148px; width: 148px; display:inline-block;" src="${imagePath}">
- </div>
- <div class="content">
- <div class="header ${currentTheme} ${textclass}" title="${filename}" style="text-overflow: ellipsis; font-size: 100%">${displayName} ${shareicon}</div>
- <div class="meta ${currentTheme}">
- <div>${ext}</div>
- </div>
- <div class="description ${currentTheme}">
- ${Displaysize}
- </div>
- </div>
- </div>
- `);
- }
- }
- if (files.length == 0){
- $("#fileList").hide();
- }else{
- $("#fileList").show();
- }
- bindFileObjectEvents();
- currentFilelist.sort();
- //Update the filelist hash
- enableAutoRefresh = false;
- getDirHash(function(hash){
- currentPathHash = hash;
- enableAutoRefresh = true;
- });
- //If viewmode is grid, load file thumbnails
- if (viewMode == "grid"){
- startThumbnailLoader();
- }
- if (callback !== undefined){
- callback();
- }
- }
- function startThumbnailLoader(){
- let path = currentPath;
- let protocol = "wss://";
- if (location.protocol !== 'https:') {
- protocol = "ws://";
- }
- var port = window.location.port;
- if (window.location.port == ""){
- port = "80";
- }
- thumbRenderWebSocket = new WebSocket(protocol + window.location.hostname + ":" + port + "/system/file_system/handleCacheRender?folder=" + path);
- thumbRenderWebSocket.onopen = function(e) {
- };
- thumbRenderWebSocket.onmessage = function(event) {
- //Find the correct file in the current directory and place its image
- if (path == currentPath){
- var thumbData = JSON.parse(event.data);
- $(".fileObject").each(function(){
- if (thumbData[1].length > 0){
- if ($(this).attr("filename") == thumbData[0]){
- $(this).find("img").attr("src","data:image/jpg;base64," + thumbData[1]);
- }
- }
-
- });
- }
- };
- thumbRenderWebSocket.onclose = function(event) {
- //Transfer ended
- };
- thumbRenderWebSocket.onerror = function(error) {
- //Cache render on websocket failed. Fallback to AJAX request
- console.log("Cannot connect to WebSocket cache renderer. Falling back to AJAX request");
- startFallbackThumbnailLoader();
- };
- }
- function startFallbackThumbnailLoader(){
- let startingCurrentDir = currentPath;
- $(".fileObject").each(function(){
- let filepath = $(this).attr("filepath");
- let targetDOM = $(this);
- $.ajax({
- url: "../../system/file_system/loadThumbnail",
- data: {vpath: filepath},
- success: function(data){
- if (startingCurrentDir == currentPath){
- //User still not changed page
- if (data.error == undefined && typeof data != "undefined" && data != ""){
- $(targetDOM).find("img").attr("src","data:image/jpg;base64," + data);
- }
- }
-
- }
- })
- });
- }
- //Make an div not draggable
- function disableDrag(event){
- event.preventDefault();
- event.stopPropagation();
- }
- //Make fileObject draggable
- function onFileObjectDragStart(object, event){
- if ((ctrlHold) && $(object).hasClass("selected") == false){
- $(object).addClass("selected");
- }else if ($(object).hasClass("selected") == false){
- $(".fileObject.selected").removeClass("selected");
- $(object).addClass("selected");
- }
- var fileList = [];
- $(".selected.fileObject").each(function(){
- var filename = $(this).attr('filename');
- var filepath = $(this).attr('filepath');
- var sourceSystemUUID = systemUUID;
- //Extra information is passed in due to the need for cross cluster communication in the future
- fileList.push({
- filename: filename,
- filepath: filepath,
- hostUUID: sourceSystemUUID
- });
- });
-
- event.dataTransfer.setData("filedata", JSON.stringify(fileList));
- }
- //Bind onclicke events for fileObjects
- var lastClickedFileID = 0;
- function bindFileObjectEvents(){
- $(".fileObject").off("click").on('click',function(evt){
- if (!ctrlHold && isMobile){
- //If on mobile, click means open
- openthis(this,evt);
- return
- }
- if (ctrlHold == true){
- if ($(this).hasClass("selected")){
- $(this).removeClass("selected");
- }else{
- $(this).addClass("selected");
- }
-
- lastClickedFileID = parseInt($(this).attr("fileid"));
- }else if (shiftHold == true){
- //Select everything in range lastClicked to this
- var thisFileID = $(this).attr("fileid");
- let start = parseInt(thisFileID);
- let end = parseInt(lastClickedFileID);
- if (start > end){
- start = parseInt(lastClickedFileID);
- end = parseInt(thisFileID);
- }
- //Select all fileObject in range.
- $(".fileObject").each(function(){
- let currentItemFileID = $(this).attr('fileid');
- currentItemFileID = currentItemFileID - 0;
- if (currentItemFileID >= start && currentItemFileID <= end){
- $(this).addClass("selected");
- }
- });
- }else{
- //Nothing is pressed. Deselect everything and add this only
- $(".fileObject.selected").removeClass("selected");
- $(this).addClass("selected");
- lastClickedFileID = $(this).attr("fileID");
- }
- if ($(".fileObject.selected").length != 1){
- //Multiple object selected
- $(".singleObjectOnly").addClass("disabled");
- $(".singleObjectOnlyHide").hide();
- }else{
- //Single object
- $(".singleObjectOnly").removeClass("disabled");
- $(".singleObjectOnlyHide").show();
- }
- });
- //Bind right click select on items
- $(".fileObject").off("mousedown").on("mousedown",function(evt){
- if (evt.which == 3){
- //Right click on this file
- if ($(this).hasClass('selected') == false){
- $(".fileObject.selected").removeClass("selected");
- $(this).addClass("selected");
- }
- }
- });
- //This function calculate and offset the context menu to not go out of the window area
- function calculateContextMenuOffsets(evt){
- var defaultLeftPost = evt.pageX;
- var defaultTopPost =evt.pageY;
-
- if (evt.pageX > window.innerWidth / 2){
- defaultLeftPost = evt.pageX - $("#contextmenu").width() + "px";
- }
- if (evt.pageY > window.innerHeight / 2){
- defaultTopPost = evt.pageY - $("#contextmenu").height() + "px";
- }
- $("#contextmenu").css({
- left: defaultLeftPost,
- top: defaultTopPost
- });
- }
- //Rightclick on a file object
- $(".fileObject").off("contextmenu").on("contextmenu", function(evt){
- evt.preventDefault();
-
- if (isMobile){
- //Firefox Mobile. Fix select with context menu not working bug
- var selectedObject = $(evt.target);
-
- if ($(selectedObject).hasClass("fileObject")){
- if (!ctrlHold){
- $(".fileObject.selected").removeClass("selected");
- }
- $(selectedObject).addClass("selected");
- }else{
- //Uptrace 5 layers for fileObject
- for (var i = 0; i < 5; i++){
- if ($(selectedObject).hasClass("fileObject") == false){
- selectedObject = $(selectedObject).parent();
- }else{
- break;
- }
- }
- if (!ctrlHold){
- $(".fileObject.selected").removeClass("selected");
- }
- $(selectedObject).addClass("selected");
- }
- }
- calculateContextMenuOffsets(evt);
- //Show all options by defaults
- $("#contextmenu").find(".item").show();
- $("#contextmenu").find(".vroothide").show();
- $("#contextmenu").find(".noSelectionOnly").hide();
- $("#contextmenu").find(".vrootonly").hide();
-
- //Hide backup manual
- $("#contextmenu").find(".backuponly").hide();
- //Check if this is folder or file. Replace the suitable selections
- if ($(this).attr("type") == "folder"){
- //Use folder mode
- $("#contextmenu").find(".folderonly").show();
- $("#contextmenu").find(".fileonly").hide();
- }else{
- //Use file mode
- $("#contextmenu").find(".folderonly").hide();
- $("#contextmenu").find(".fileonly").show();
- }
- if (searchMode == true){
- $("#contextmenu").find(".shareonly").show();
- }else{
- $("#contextmenu").find(".shareonly").hide();
- }
- $("#contextmenu").addClass("visible");
- //Handle CSS offset of the contextmenu
- if ($("#contextmenu").offset().top < 0){
- $("#contextmenu").css("top","0px");
- }else if($("#contextmenu").offset().top + $("#contextmenu").height() > window.innerHeight){
- $("#contextmenu").css("top",window.innerHeight - $("#contextmenu").height() + "px");
- }
- if (isMobile){
- $("#contextmenu").find(".mobileonly").show();
- }else{
- $("#contextmenu").find(".mobileonly").hide();
- }
- });
- //Right click on empty space of the file selector
- $("#folderView").off("contextmenu").on("contextmenu", function(e){
- if ($(e.target).attr("id") == "folderView" || $(e.target).attr("id") == "fileList" || $(e.target).attr("id") == "folderList"){
- //Context menu on the empty space of the folder / file list
- e.preventDefault();
- $("#contextmenu").find(".item").hide();
- $("#contextmenu").find(".noSelectionOnly").show();
- $("#contextmenu").find(".allowNoSelection").show();
- $("#contextmenu").find(".vroothide").show();
- //Calculate the position of the context menu
- calculateContextMenuOffsets(e);
- //Show context menu
- $("#contextmenu").addClass("visible");
- //Handle CSS offset of the contextmenu
- if ($("#contextmenu").offset().top < 0){
- $("#contextmenu").css("top","0px");
- }else if($("#contextmenu").offset().top + $("#contextmenu").height() > window.innerHeight){
- $("#contextmenu").css("top",window.innerHeight - $("#contextmenu").height() + "px");
- }
- }
- });
- //Handle right click on storage roots
- $("#storageroot").off("contextmenu").on("contextmenu", function(e){
- if ($(e.target).is("i")){
- e.target = e.target.parentElement;
- }
- $("#storageroot").find(".dir.item").each(function(){
- if ($(this).attr("rootname") != undefined){
- $(this).removeClass("active");
- }
- });
- if ($(e.target).attr("rootname") != undefined){
- //Correct one. Show vroot functions
- e.preventDefault();
- var rootname = $(e.target).attr("rootname");
- var containBackup = $(e.target).attr("contain-backup") == "true";
- $(e.target).addClass("active");
- $("#contextmenu").find(".item").hide();
- $("#contextmenu").find(".vroothide").hide();
- $("#contextmenu").find(".vrootonly").show();
- //Check if this is a backup drive
- if (containBackup == true){
- $("#contextmenu").find(".backuponly").show();
- }else{
- $("#contextmenu").find(".backuponly").hide();
- }
- //Show context menu
- calculateContextMenuOffsets(e);
- $("#contextmenu").addClass("visible");
- //Handle CSS offset of the contextmenu
- if ($("#contextmenu").offset().top < 0){
- $("#contextmenu").css("top","0px");
- }else if($("#contextmenu").offset().top + $("#contextmenu").height() > window.innerHeight){
- $("#contextmenu").css("top",window.innerHeight - $("#contextmenu").height() + "px");
- }
- }
- });
- $(document).on("click",function(evt){
- $(".contextmenu").removeClass("visible");
- });
- }
- //Change the current view mode
- function changeViewMode(object){
- var targetMode = $(object).attr("mode");
- viewMode = targetMode;
- listDirectory(currentPath);
- updateViewmodeButtons();
- setPreference("file_explorer/listmode",targetMode)
- }
- function updateViewmodeButtons(){
- $(".videmode").removeClass('disabled');
- $(".videmode").each(function(){
- if ($(this).attr("mode") == viewMode){
- $(this).addClass("disabled");
- }
- });
- }
- function previosPath(){
- //Remove the current directory from history
- if (viewHistory.length == 0){
- //This is already the first page
- return;
- }
- var previousPath = viewHistory.pop();
- listDirectory(previousPath, undefined, false);
- }
- function parentDir(){
- //If under searchmode, parentDir go back to the currentPath
- if (searchMode){
- hideSearchBar();
- return;
- }
- //Check if there are any parent dir for this path
- if (checkIfParentDirExists(currentPath)){
- //There are parent path. Get it from currentPath
- pathInfo = currentPath.split("/");
- pathInfo.pop();
- var parentFolderName = pathInfo.pop();
- parentPath = pathInfo.join("/") + "/"
-
- //List the parentDir
- listDirectory(parentPath, function(){
- focusFileObject(parentFolderName);
- });
-
- }
- }
- //Move the page focus to the given fileobject
- function focusFileObject(targetFileName){
- $(".fileObject").each(function(){
- if ($(this).attr("filename") == targetFileName){
- $(this).addClass("selected");
- //Trying to vertically align the directory from its parent list
- $("#folderView").stop().finish().animate({
- scrollTop: $(this).offset().top - $("#folderView").offset().top - (window.innerHeight - $("#navibar").height())/2 + $(this).height()
- }, 300);
- }
- });
- }
- function loadListModeFromDB(callback = undefined){
- //Get list mode from storage
- loadPreference("file_explorer/listmode",function(data){
- if (data != "" && data.error === undefined){
- viewMode = data;
- updateViewmodeButtons();
- }
- if (callback !== undefined){
- callback();
- }
- });
- }
- function rootDir(){
- //Go to the root dir of the current path
- var rootDir = currentPath.split("/").shift();
- rootDir = rootDir + "/";
- listDirectory(rootDir);
- }
- function showEditCurrentPathInput(e){
- e.preventDefault();
- $("#pathInputField").find("input").val(currentPath);
- if (isMobile){
- $("#mobilePathDisplay").hide();
- $(".mobilePathDisplayWrapper").append($("#pathInputField"));
- $("#pathInputField").find("input").css("width", window.innerWidth - 54 + "px");
- }else{
- //Desktop
- $("#pathInputField").find("input").css("width", $("#pathDisplayField").width() - 24+ "px");
- $("#pathDisplayField").hide();
- }
- $("#pathInputField").show();
- }
- function handleOpenPathKeydown(e){
- if (e.key == "enter" | e.keyCode == 13){
- //Etner pressed
- openEnteredPath($("#pathInputField").find("button"));
- }
- }
- function openEnteredPath(object){
- var newPath = $(object).parent().find("input").val();
- //Filter out the path
- newPath = newPath.split("\\").join("/");
- listDirectory(newPath);
- hideManualOpenPathInput();
- }
- function hideManualOpenPathInput(){
- $("#pathInputField").hide();
- if (isMobile){
- $("#mobilePathDisplay").show();
- }else{
- $("#pathDisplayField").show();
- }
- }
- function checkIfParentDirExists(path){
- if (path.includes("/")){
- pathInfo = path.split("/");
- if (pathInfo[1] == ""){
- return false;
- }else{
- return true;
- }
- }else{
- return false;
- }
- }
- function getDirHash(callback){
- $.ajax({
- url: "../../system/file_system/listDirHash",
- data: {dir: currentPath},
- success: function(data){
- if (data.error !== undefined){
- if (data.error == "Invalid dir given"){
- //Storage has been unmounted. Back to parent
- var pdir = currentPath.split("/");
- pdir.pop();pdir.pop();
- pdir = pdir.join("/");
- currentPath = pdir;
- listDirectory(currentPath, function(){
- window.location.reload();
- });
- return;
- }
- }
- callback(data);
- }
- })
- }
- function openHomeDir(){
- listDirectory("user:/", function(){
- hideManualOpenPathInput();
- hideSearchBar();
- })
- }
- //=================================== FILE OPERATIONS ========================
- function refreshList(){
- if (searchMode == true){
- //Refresh the search result
- if ($("#searchInput").val().length > 0){
- handleSearch();
- }
- return;
- }
- shiftHold = false;
- ctrlHold = false;
- let currentScrollTop = JSON.parse(JSON.stringify($("#folderView").scrollTop()));
- listDirectory(currentPath, function(){
- //Scroll back to the original height
- $("#folderView").scrollTop(currentScrollTop);
- });
- }
- function zipFile(){
- $(".popup").fadeOut('fast');
- var zippingFiles = [];
- $(".fileObject.selected").each(function(){
- var filepath = $(this).attr("filepath");
- zippingFiles.push(filepath);
- });
- console.log(zippingFiles);
- //Request to create a zip file, named with the parent dir name
- var oprConfig = {
- opr: "zip",
- src: zippingFiles,
- dest: currentPath,
- overwriteMode: "overwrite",
- callbackWindowID: ao_module_windowID,
- callbackFunction: `callRefresh("${currentPath}")`
- }
- var configHash = encodeURIComponent(JSON.stringify(oprConfig));
- var title = "Zipping " + zippingFiles.length;
- if (fileList.length > 1){
- title += " files";
- }else{
- title += " file";
- }
- parent.newFloatWindow({
- url: "SystemAO/file_system/file_operation.html#" + configHash,
- width: 400,
- height: 220,
- appicon: "SystemAO/file_system/img/selector.png",
- title: title
- });
- }
- let renameFileObjects = [];
- function rename(){
- $(".popup").fadeOut('fast');
- renameFileObjects = [];
- var filenames = [];
- $(".fileObject.selected").each(function(){
- var fileObjectType = $(this).attr("type");
- let fileObject = {
- filename: $(this).attr('filename'),
- filepath: $(this).attr("filepath"),
- filetype: fileObjectType
- }
- renameFileObjects.push(JSON.parse(JSON.stringify(fileObject)));
- filenames.push($(this).attr('filename'));
- });
- var oldname = "unknown file.txt";
- if (renameFileObjects.length == 0){
- return;
- }else if (renameFileObjects.length > 0){
- $("#renameBox").find(".multifileWarning").hide();
- oldname = filenames[0];
- }
- $("#renameBox").find(".orgfn").val(oldname);
- $("#renameBox").find(".newfn").val(oldname);
- showPopupWrapper();
- $("#renameBox").fadeIn(100);
- }
- function confirmRename(){
- var oldName = $("#renameBox").find(".orgfn").val();
- var newName = $("#renameBox").find(".newfn").val();
- if (newName == oldName){
- msgbox("remove","New filename is identical to the original filename.")
- $("#renameBox").fadeOut(100);
- $(".popupWrapper").fadeOut(100);
- return;
- }
- var newNameWithoutExt = newName;
- var newnameExt = "";
- if (newName.includes(".")){
- tmp = newName.split(".");
- newnameExt = tmp.pop();
- newNameWithoutExt = tmp.join(".");
- }
- var counter = 0;
- var srclist = [];
- var newnamelist = [];
- for (var i =0; i < renameFileObjects.length; i++){
- var thisFilepath = renameFileObjects[i].filepath;
- var thisFiletype = renameFileObjects[i].filetype;
- var thisFilename = renameFileObjects[i].filename;
-
- var newFilename = newName;
- if ( i > 0){
- if (thisFiletype == "file"){
- var thisFileExt = thisFilename.split(".").pop();
- newFilename = newNameWithoutExt + "(" + i + ")." + thisFileExt;
- }else if (thisFiletype == "folder"){
- newFilename = newNameWithoutExt + "(" + i + ")";
- }
- }
- srclist.push(thisFilepath);
- newnamelist.push(newFilename);
-
- }
- console.log(srclist, newnamelist);
- //Send the request to serverside
- requestCSRFToken(function(token){
- $.ajax({
- url: "../../system/file_system/fileOpr",
- method: "POST",
- data: {opr: "rename", src: JSON.stringify(srclist), new: JSON.stringify(newnamelist), csrft: token},
- success: function(data){
- if (data.error !== undefined){
- msgbox("remove",data.error);
- }else{
- refreshList();
- msgbox("checkmark","Rename suceed");
- }
- $("#renameBox").fadeOut(100);
- $(".popupWrapper").fadeOut(100);
- },
- error: function(){
- $("#renameBox").fadeOut(100);
- $(".popupWrapper").fadeOut(100);
- }
- });
- renameFileObjects = [];
- });
-
- hideAllPopupWindows();
- }
- function changeOverwriteRule(mode, doPasteAgain=false){
- switch (mode){
- case 0:
- overwriteMode = "overwrite";
- break;
- case 1:
- overwriteMode = "skip";
- break;
- case 2:
- overwriteMode = "keep";
- break;
- default:
- overwriteMode = "keep";
- }
- if (doPasteAgain){
- //Initiate paste without checking and close the overwritemode selector
- paste(undefined, true);
- $("#overwriteModeSelection").fadeOut(100);
- }
- }
- function copy(){
- cutMode = false;
- clipboard = [];
- if ($(".fileObject.selected").length == 0){
- return;
- }
- $(".fileObject.selected").each(function(){
- var thisFilepath = $(this).attr("filepath");
- clipboard.push(thisFilepath);
- });
- if (useLocalstorage){
- localStorage.setItem("ao/file_system/clipboard",JSON.stringify(clipboard));
- localStorage.setItem("ao/file_system/cutmode","false");
- }
- msgbox("copy",clipboard.length + " objects copied.")
- }
- function cut(){
- cutMode = true;
- clipboard = [];
- if ($(".fileObject.selected").length == 0){
- return;
- }
- $(".fileObject.selected").each(function(){
- var thisFilepath = $(this).attr("filepath");
- clipboard.push(thisFilepath);
- });
- if (useLocalstorage){
- localStorage.setItem("ao/file_system/clipboard",JSON.stringify(clipboard));
- localStorage.setItem("ao/file_system/cutmode","true");
- }
- msgbox("cut",clipboard.length + " objects ready to be moved.")
- }
- function paste(redirectPasteTarget="", nocheck=false){
- let thisOprCutMode = cutMode;
- let fileList = clipboard;
- let targetDir = currentPath;
- if (redirectPasteTarget != ""){
- //Allow redirection of paste target if necessary
- targetDir = redirectPasteTarget;
- }
- if (useLocalstorage){
- //There are localStorage. Always use localStorage if exists.
- var crossFrameClipboard = localStorage.getItem("ao/file_system/clipboard");
- var useCutMode = localStorage.getItem("ao/file_system/cutmode");
- if (crossFrameClipboard !== "" && crossFrameClipboard !== undefined && crossFrameClipboard !== null){
- fileList = JSON.parse(crossFrameClipboard);
- }
- if (useCutMode !== "" && useCutMode !== undefined && useCutMode !== null){
- thisOprCutMode = (useCutMode == "true");
- }
- }
- if (fileList.length == 0){
- //There are nothing to paste
- msgbox("question","There are nothing to paste.")
- return;
- }
- //console.log(fileList,JSON.stringify(fileList));
- if (thisOprCutMode == true){
- //Cut and paste
- $.ajax({
- type: 'POST',
- url: `../../system/file_system/validateFileOpr`,
- data: {src: JSON.stringify(fileList), dest: targetDir},
- success: function(data){
- if (!nocheck && data.length > 0){
- //There are problem with the copy target. Pop up overwrite rule selector
- showDuplicateHandler(data);
- }else{
- //OK!
- //Clear clipboard settings
- localStorage.setItem("ao/file_system/clipboard", "");
- clipboard = "";
- //Stsart operations
- if (!ao_module_virtualDesktop){
- //Not under desktop mode. Use direct copy API
- requestCSRFToken(function(token){
- $.ajax({
- type: 'POST',
- url: `../../system/file_system/fileOpr`,
- data: {opr: "move" ,src: JSON.stringify(fileList), dest: targetDir,existsresp: overwriteMode, csrft: token},
- success: function(data){
- if (data.error !== undefined){
- msgbox("remove",data.error);
- }else{
- //OK
- msgbox("checkmark",fileList.length + " objects moved.")
- refreshList();
- }
- hideAllPopupWindows();
- }
- });
- });
-
- }else{
- //Pass the request to operation handler
- var oprConfig = {
- opr: "move",
- src: fileList,
- dest: targetDir,
- overwriteMode: overwriteMode,
- callbackWindowID: ao_module_windowID,
- callbackFunction: `callRefresh("${targetDir}")`
- }
- var configHash = encodeURIComponent(JSON.stringify(oprConfig));
- var title = "Moving " + fileList.length;
- if (fileList.length > 1){
- title += " files";
- }else{
- title += " file";
- }
- parent.newFloatWindow({
- url: "SystemAO/file_system/file_operation.html#" + configHash,
- width: 400,
- height: 220,
- appicon: "SystemAO/file_system/img/selector.png",
- title: title
- });
- hideAllPopupWindows();
- }
- }
- }
- });
- }else{
- //Copy and paste
- //Check if the file list is OK for continue without the need for overwrite
- $.ajax({
- type: 'POST',
- url: `../../system/file_system/validateFileOpr`,
- data: {src: JSON.stringify(fileList), dest: targetDir},
- success: function(data){
- if (!nocheck && data.length > 0){
- //There are problem with the copy target. Pop up overwrite rule selector
- showDuplicateHandler(data);
- }else{
- //OK!
- if (!ao_module_virtualDesktop){
- requestCSRFToken(function(token){
- $.ajax({
- type: 'POST',
- url: `../../system/file_system/fileOpr`,
- data: {opr: "copy" ,src: JSON.stringify(fileList), dest: targetDir,existsresp: overwriteMode, csrft: token},
- success: function(data){
- if (data.error !== undefined){
- msgbox("remove",data.error);
- }else{
- //OK
- msgbox("checkmark",fileList.length + " objects copied.")
- refreshList();
- }
- hideAllPopupWindows();
- }
- });
- });
-
- }else{
- //Pass the request to operation handler
- var oprConfig = {
- opr: "copy",
- src: fileList,
- dest: targetDir,
- overwriteMode: overwriteMode,
- callbackWindowID: ao_module_windowID,
- callbackFunction: `callRefresh("${targetDir}")`
- }
- var configHash = encodeURIComponent(JSON.stringify(oprConfig));
- var title = "Copying " + fileList.length;
- if (fileList.length > 1){
- title += " files";
- }else{
- title += " file";
- }
- parent.newFloatWindow({
- url: "SystemAO/file_system/file_operation.html#" + configHash,
- width: 400,
- height: 220,
- appicon: "SystemAO/file_system/img/selector.png",
- title: title
- });
- hideAllPopupWindows();
- }
-
- }
- }
- });
- }
- }
- //Callback function for file operation display
- window.callRefresh = function(targetdir){
- console.log(currentPath, targetdir);
- if (currentPath == targetdir){
- refreshList();
- }
- }
- //This action may duplicate files. Show handler
- function showDuplicateHandler(duplicateFileList){
- $(".popup").fadeOut(100);
- var duplicatedFileCounts = duplicateFileList.length;
- showPopupWrapper();
- $("#overwriteModeSelection").fadeIn(100);
- $("#overwriteModeSelection").find(".owm-fc").text(duplicatedFileCounts);
- var srcpath = duplicateFileList[0];
- srcpath = srcpath.split("/");
- srcpath.pop();
- srcpath = srcpath.join("/");
- $("#overwriteModeSelection").find(".owm-srcdir").text(srcpath);
- $("#overwriteModeSelection").find(".owm-destdir").text(currentPath);
- }
- //Force delete. Use normal delete fucntion if you want to move things to recycle bin instead.
- let forceDeleteList = [];
- function forceDelete(confirmed=false){
- if (confirmed == false){
- //Show confirm box
- let deletePendingList = [];
- var listObject = $("#forceDeleteConfirmBox").find(".deleteFilelist")[0];
- $(listObject).html("");
- $(".selected.fileObject").each(function(data){
- var thispath = $(this).attr("filepath");
- var thisfilename = $(this).attr("filename");
- var ext = thisfilename.split(".").pop();
- var icon = ao_module_utils.getIconFromExt(ext);
- deletePendingList.push(thispath);
- $(listObject).append(`<div class="item ${currentTheme}" ><span style="display:inline-block;">${thisfilename}</span></div>`);
- });
- showPopupWrapper();
- $("#forceDeleteConfirmBox").fadeIn(100);
- forceDeleteList = deletePendingList;
- }else{
- //Start force delete function
- $("#forceDeleteConfirmBox").fadeOut(100);
- let fdlistLength = forceDeleteList.length;
- requestCSRFToken(function(token){
- $.ajax({
- url: "../../system/file_system/fileOpr",
- method:"POST",
- data: {opr: "delete", src: JSON.stringify(forceDeleteList), csrft: token},
- success: function(data){
- if (data.error !== undefined){
- msgbox("caution",data.error);
- }else{
- refreshList();
- msgbox("checkmark",fdlistLength + " objects removed.")
- }
- hideAllPopupWindows();
- }
- });
- //Finishing up delete sequence
- forceDeleteList = [];
- });
-
- }
- }
- let deleteFileList = [];
- function deleteFile(confirmed = false){
- if (!confirmed){
- //Show the confirm dialog
- $("#deleteConfirmBox").find(".deleteFilelist").html("");
- $(".fileObject.selected").each(function(data){
- var thisfilename = $(this).attr('filename');
- var thisFilepath = $(this).attr('filepath');
- deleteFileList.push(thisFilepath);
- $("#deleteConfirmBox").find(".deleteFilelist").append(`<div class="item ${currentTheme}" ><span style="display:inline-block;">${thisfilename}</span></div>`);
- });
- if (deleteFileList.length == 0){
- //No files selected
- return;
- }else{
- //File selected. Continue to delete
- showPopupWrapper();
- $("#deleteConfirmBox").fadeIn(100);
- }
- }else{
- //Continue to delete files
- let fdlistLength = deleteFileList.length;
- requestCSRFToken(function(token){
- $.ajax({
- url: "../../system/file_system/fileOpr",
- method:"POST",
- data: {opr: "recycle", src: JSON.stringify(deleteFileList), csrft: token},
- success: function(data){
- if (data.error !== undefined){
- msgbox("caution",data.error);
- }else{
- refreshList();
- msgbox("checkmark",fdlistLength + " objects moved to trash bin.")
- }
- if (currentPath == "user:/"){
- //Reload the User root folder list
- initRootDirs();
- }
- }
- });
- console.log(deleteFileList);
- deleteFileList = [];
- hideAllPopupWindows();
- });
-
- }
- }
- function cancelDelete(){
- deleteFileList=[];
-
- }
- function cancelForceDelete(){
- $("#forceDeleteConfirmBox").fadeOut(100);
- forceDeleteList = [];
- }
- function upload(){
- var input = document.createElement('input');
- input.type = 'file';
- input.multiple = true;
- input.onchange = e => {
- var files = e.target.files;
- msgbox("upload","Upload Started");
- for (var i = 0; i < files.length; i++){
- uploadFile(files[i]);
- }
- }
- input.click();
- }
- function updatePathDisplay(path){
- var pathInfo = path.split("/");
- var vdID = pathInfo[0];
- //As path always end with /, pop the empty pathinfo from array
- pathInfo.pop();
- var l = pathInfo.length;
- //Append the starting vdir
- $(".pathDisplay").html("");
- $(".pathDisplay").append(`<div class="section ${currentTheme} selectable" onclick="rootDir();"><i class="folder icon"></i> ${vdID}</div>`);
- $(".pathDisplay").append(`<div class="divider ${currentTheme} whiteTheme">/</div>`);
- //console.log(pathInfo);
- if (l > 3){
- //E.g. user:/Desktop/test/boo/ => Display as user:/.../test/boo/
- $(".pathDisplay").append(`<div class="section ${currentTheme}">...</div>`);
- $(".pathDisplay").append(`<div class="divider ${currentTheme} whiteTheme">/</div>`);
- $(".pathDisplay").append(`<div class="section ${currentTheme} selectable" onclick="parentDir();">${shortenLongFoldername(pathInfo[l-2], 40)}</div>`);
- $(".pathDisplay").append(`<div class="divider ${currentTheme} whiteTheme">/</div>`);
- $(".pathDisplay").append(`<div class="section ${currentTheme} selectable" onclick="refreshList();">${shortenLongFoldername(pathInfo[l-1], 60)}</div>`);
- }else if (l == 3){
- $(".pathDisplay").append(`<div class="section ${currentTheme} selectable" onclick="parentDir();">${shortenLongFoldername(pathInfo[l-2], 40)}</div>`);
- $(".pathDisplay").append(`<div class="divider ${currentTheme} whiteTheme">/</div>`);
- $(".pathDisplay").append(`<div class="section ${currentTheme} selectable" onclick="refreshList();">${shortenLongFoldername(pathInfo[l-1], 60)}</div>`);
- }else if (l == 2){
- //E.g. user:/Desktop or user:/
- $(".pathDisplay").append(`<div class="section ${currentTheme} selectable" onclick="refreshList();">${shortenLongFoldername(pathInfo[1], 80)}</div>`);
- }
- //Update the manual input field as well
- $("#pathInputField").find("input").val(path);
- }
- function shortenLongFoldername(name, maxchar = 20){
- var resultname = name;
- if (name.length > maxchar){
- //Shorten it
- var offset = parseInt((maxchar - 2) / 2);
- resultname = name.substr(0, offset) + "..." + name.substr(name.length - offset)
- }
- return resultname
- }
- function getExtFromPath(path){
- if (path.includes(".") == false){
- return "";
- }
- return path.split(".").pop();
- }
- function getFileObjectFromFID(fid){
- var targetFileObject = null;
- $(".fileObject").each(function(){
- if ($(this).attr("fileid") == fid){
- targetFileObject = $(this);
- }
- });
- return targetFileObject;
- }
- function openViaButton(){
- let fileOpenList = [];
- let foldersToBeOpened=[];
- $(".fileObject.selected").each(function(){
- let type = $(this).attr("type");
- let filepath = $(this).attr("filepath");
- if (type == "file"){
- fileOpenList.push(filepath);
- }else if (type == "folder"){
- foldersToBeOpened.push(filepath);
- }
- });
- //Open files
- openPathWithDefaultOpener(fileOpenList);
- //Open folders
- openFolderInNewWindow(foldersToBeOpened);
- }
- function openthis(object,evt=null){
- if (evt !== null){
- evt.preventDefault();
- }
- var objType = $(object).attr("type");
- if ( objType == "file"){
- //Open this file. Generate the access path from filepath
- var filepath = $(object).attr("filepath");
- //Only one path to be opened. Pass in as a single object array
- openPathWithDefaultOpener([filepath]);
- }else if (objType == "folder"){
- //Open this folder
- var folderPath = $(object).attr('filepath');
- listDirectory(folderPath, function(){
- //Scroll to top of the list
- $("#folderView").stop().finish().animate({
- scrollTop: 0
- }, 300);
- if ($(object).hasClass('dir') && isMobile){
- toggleSidebar();
- }
- });
- }else if (objType == "shortcut"){
- //Load the shortcut information
-
- getShortcutInfo($(object).attr('filepath'), function(shortcutInfo){
- /*
- Shortcut Info format
- 0: Shortcut type
- 1: Shortcut Name
- 2: Shortcut target
- 3: Shortcut icon image
- */
- if (shortcutInfo[0] == "module"){
- //This is a module
- if (ao_module_virtualDesktop){
- //Open Module with VDI API
- parent.openModule(shortcutInfo[2]);
- }else{
- //Open module in new tab
- $.get("../../system/modules/getLaunchPara?module=" + shortcutInfo[2], function(data) {
- window.open("../../" + data.StartDir);
- });
- }
- }else if (shortcutInfo[0] == "folder"){
- //This is a folder
- listDirectory(shortcutInfo[2]);
- }else if (shortcutInfo[0] == "url"){
- //This is a url shortcut
- window.open(shortcutInfo[2]);
- }
- console.log(shortcutInfo);
- });
-
-
- }
- //Check if this opened in sidebar and in mobile mode. Close sidebar if yes
-
- }
- /*
- Shortcut Info format
- 0: Shortcut type
- 1: Shortcut Name
- 2: Shortcut target
- 3: Shortcut icon image
- */
- function getShortcutInfo(filepath, callback){
- $.get("../../media?file=" + filepath, function(data){
- //This return the shortcut information. Split it and see what shortcut is this
- data = data.split("\r\n").join("\n");
- var shortcutInfo = data.trim().split("\n");
- callback(shortcutInfo);
- });
- }
- //Download the selected files.
- function downloadFile(){
- var fileList = [];
- if ($(".fileObject.selected").length == 1 && $(".fileObject.selected").attr("type") == "file"){
- //One file. Download directly.
- var downloadURL = "/media?file=" + encodeURIComponent($(".fileObject.selected").attr("filepath")) + "&download=true";
- var filename = $(".fileObject.selected").attr("filename");
- generateDownloadFromURL(downloadURL,escape(filename));
- }else if ($(".fileObject.selected").length > 1 || ($(".fileObject.selected").length == 1 && $(".fileObject.selected").attr("type") == "folder")){
- //Do zip and download for multiple files
- $(".fileObject.selected").each(function(){
- fileList.push($(this).attr("filepath"));
- });
- console.log("Zipping: ", fileList);
- //Add a display for file compression
- var fileCount = $(".fileObject.selected").length;
-
- var displayString = "Zipping " + fileCount + " files";
- if (fileCount == 1){
- //Use the filename as task name
- displayString = "Zipping " + $(".fileObject.selected").attr("filename");
- }
-
- var taskUUID = appendUploadFileItem(displayString, -1);
- $("#uploadTab").show();
- //Set the progress bar to intermediate mode
- let targetTaskDisplayObject = getUploadTaskByID(taskUUID);
- targetTaskDisplayObject.find(".progress").addClass("preparing");
- //Zip the file or folder
- $.ajax({
- url: "../../system/file_system/zipHandler",
- data: {opr: "tmpzip", src: JSON.stringify(fileList), dest: ""},
- method: "POST",
- success: function(data){
- if (data.error !== undefined){
- //Error
- targetTaskDisplayObject.find(".progress").removeClass("preparing").removeClass("primary").addClass("negative");
-
- msgbox("remove",data.error);
- }else{
- //Zip completed.
- targetTaskDisplayObject.find(".progress").removeClass("preparing").removeClass("primary").addClass("positive");
- //Open the zip file
- window.open("../../media?file=" + data + "&download=true");
- }
-
- targetTaskDisplayObject.find(".bar").css("width", "100%");
- //Hide the taskbar after 5 secs
- setTimeout(function(){
- //Fade out this task
- $(targetTaskDisplayObject).fadeOut('fast',
- function(){
- $(this).remove();
- if ($(".uploadTask").length == 0){
- $("#uploadTab").hide();
- }
- }
- );
-
- }, 3000);
-
- },
- error: function(){
- targetTaskDisplayObject.find(".progress").removeClass("preparing").removeClass("primary").addClass("negative");
- targetTaskDisplayObject.find(".bar").css("width", "100%");
- msgbox("remove","Zipping failed due to unknown reason");
- setTimeout(function(){
- if ($(".uploadTask").length == 0){
- $("#uploadTab").hide();
- }
- }, 3000);
- }
- });
-
- }else{
- alert("No file selected!")
- }
-
- }
- //Create a new file
- function newfile(){
- $(".popup").fadeOut('fast');
- showPopupWrapper();
- $("#newFile").fadeIn('fast');
- $("#newFile").find(".duplicateWarning").hide();
- $("#createNewFileName").parent().removeClass("error");
- //Update the newfile list
- $("#newFile").find(".newfilelist").html("");
- requestCSRFToken(function(token){
- $.ajax({
- url: "../../system/file_system/newItem",
- data: {csrft: token},
- success: function(data){
- if (data.error !== undefined){
- return;
- }
- for (var i =0; i < data.length; i++){
- var desc = data[i].Desc;
- var ext = data[i].Ext;
- var icon = ao_module_utils.getIconFromExt(ext);
- $("#newFile").find(".newfilelist").append(`<div class="item newFileFormat" ext="${ext}"><i class="${icon} icon" style="margin-right:12px;"></i> ${desc}</div>`);
- }
- //Initialize the new file as txt
- var filename = "newfile";
- var finalFilename = filename;
- var i = 0;
- while (currentFilelist.includes(finalFilename)){
- finalFilename = finalFilename + "(" + i + ")";
- i++;
- }
- $("#createNewFileName").val(finalFilename + ".txt");
- //Hook events for on click
- $(".newFileFormat").off("click").on("click",function(data){
- $(".newFileFormat").removeClass("selected");
- $(this).addClass("selected");
- //Parse the newfilename
- var selectedExt = $(this).attr("ext");
- var filename = "newfile";
- var finalFilename = filename;
- var i = 0;
- while (currentFilelist.includes(finalFilename)){
- finalFilename = finalFilename + "(" + i + ")";
- i++;
- }
- $("#createNewFileName").val(filename + "." + selectedExt);
- });
- }
- });
- });
- }
- function filePermission(){
- //Open file permission window
- if ($(".fileObject.selected").length > 0){
- //Build the filelist
- var fileList = [];
- $(".fileObject.selected").each(function(){
- var filepath = $(this).attr("filepath");
- fileList.push(filepath);
- });
- var hashPassthrough = encodeURIComponent(JSON.stringify(fileList));
- ao_module_newfw({
- url: "SystemAO/file_system/file_permission.html#" + hashPassthrough,
- width: 340,
- height: 480,
- appicon: "SystemAO/file_system/img/properties.png",
- title: "File Permissions",
- })
- }
- }
- function newFolder(confirmed = false){
- if (confirmed == false){
- //Launch the dialog for newFolder
- $(".popup").fadeOut(100);
- $("#createNewFolder").val("");
- $("#createNewFolder").parent().removeClass("error").removeClass("success");
- $("#newFolder").find(".duplicateWarning").hide();
- showPopupWrapper();
- $("#newFolder").fadeIn(100);
- }else{
- //Create new folder
- var newFoldername = $("#createNewFolder").val();
- if (newFoldername == ""){
- $("#createNewFolder").parent().addClass("error");
- return;
- }
- if (currentFilelist.includes(newFoldername)){
- //Current filelist already contain a folder with the same name
- $("#createNewFolder").parent().addClass("error");
- $("#newFolder").find(".duplicateWarning").show();
- return;
- }
- //OK to proceed.
- $("#createNewFolder").parent().removeClass("error").addClass("success");
- $("#newFolder").find(".duplicateWarning").hide();
- requestCSRFToken(function(token){
- $.ajax({
- url: "../../system/file_system/newItem",
- data: {type: "folder", src: currentPath, filename: newFoldername, csrft: token},
- success: function(data){
- if (data.error !== undefined){
- msgbox("remove", data.error);
- }else{
- msgbox("checkmark","New folder created.");
- refreshList();
- }
- $("#newFolder").fadeOut('fast');
- hideAllPopupWindows();
- if (currentPath == "user:/"){
- //Reload the User root folder list
- initRootDirs();
- }
- }
- });
- });
-
- }
- }
- function confirmNewFile(){
- var filename = $("#createNewFileName").val();
- if (filename == ""){
- //Filename not set
- $("#createNewFileName").parent().addClass("error");
- return;
- }else if(currentFilelist.includes(filename)){
- //File with this name already exists
- $("#createNewFileName").parent().addClass("error");
- $("#newFile").find(".duplicateWarning").show();
- return;
- }
- $("#createNewFileName").parent().removeClass("error");
- //Ok to proceed
- requestCSRFToken(function(token){
- $.ajax({
- url: "../../system/file_system/newItem",
- data: {type: "file", src: currentPath, filename:filename,csrft: token},
- success: function(data){
- if (data.error !== undefined){
- msgbox("remove",data.error);
- }else{
- msgbox("checkmark",filename + " created.");
- refreshList();
- }
- }
- });
- });
-
- hideAllPopupWindows();
- $("#newFile").fadeOut('fast');
- }
- //Open File Location
- function openFileLocation(){
- var folders = [];
- $(".selected.fileObject").each(function(){
- var thisFilepath = $(this).attr('filepath');
- var thisFilename = $(this).attr('filename');
- openPathInNewWindow(encodeURIComponent(JSON.stringify([{
- filename: thisFilename,
- filepath: thisFilepath
- }])))
- });
-
- }
- //OpenWith dialog
- function openWith(){
- if ($(".selected.fileObject").length == 0){
- msgbox("question","No file selected");
- return;
- }
- //Get a list of modules and append it into the selection list
- $.get("../../system/modules/list",function(data){
- if (data.error !== undefined){
- console.log(data.error);
- }else{
- $("#openWithModuleList").html("");
- for (var i =0; i < data.length; i++){
- var thisModule = data[i];
- var supportFW = `<div class="ts horizontal mini label"><i class="checkmark icon"></i>floatWindow Window</div>`;
- var supportEmb = `<div class="ts horizontal mini label"><i class="checkmark icon"></i>Embedded Window</div>`;
- if (!thisModule.SupportFW){
- supportFW = "";
- }
- if (!thisModule.LaunchEmb){
- supportEmb = "";
- }
- var launchInfo = encodeURIComponent(JSON.stringify(thisModule));
- $("#openWithModuleList").append(`<div class="item selectable openWithModule" launchInfo="${launchInfo}" onclick="selectOpenWithModule(this, event);" ondblclick="selectOpenWithModule(this, event); openWithSelectedModule();">
- <img class="ts avatar image" src="../../${thisModule.IconPath}">
- <div class="content" style="padding-left:12px;">
- <div class="header">${thisModule.Name}</div>
- <div class="description">
- ${supportFW}
- ${supportEmb}
- </div>
- </div>
- </div>`);
- }
- }
- });
- $(".openWithModule.popupbuttons").addClass("disabled");
- if (!ao_module_virtualDesktop){
- $("#openWith").find(".vdonly").hide();
- }
- showPopupWrapper();
- $("#openWith").fadeIn('fast');
- }
- //Functions for handling open with module selection and file opening
- function selectOpenWithModule(object, event){
- event.preventDefault();
- $(".openWithModule.popupbuttons").removeClass("disabled");
- $(".openWithModule.selected").removeClass("selected");
- $(object).addClass("selected");
- }
- function openWithSelectedModule(btn){
- if ($(btn).hasClass("disabled")){
- return false;
- }
- var targetModuleInfo = JSON.parse(decodeURIComponent($(".openWithModule.selected").attr("launchInfo")));
- var targetObjects = $(".selected.fileObject");
- console.log(targetModuleInfo);
- //Phrase launch mode from the module info
- var launchURL = targetModuleInfo.StartDir
- var launchSize = [undefined, undefined];
- var iconPath = targetModuleInfo.IconPath;
- var title = targetModuleInfo.Name;
- if (targetModuleInfo.SupportEmb){
- //Launch with embedded mode
- launchURL = targetModuleInfo.LaunchEmb;
- if (targetModuleInfo.InitEmbSize !== null){
- launchSize = targetModuleInfo.InitEmbSize
- }
-
- }else if (targetModuleInfo.SupportFW){
- //Launch with floatWindow mode
- launchURL = targetModuleInfo.LaunchFWDir;
- if (targetModuleInfo.InitFWSize !== null){
- launchSize = targetModuleInfo.InitFWSize
- }
- }else if (targetModuleInfo.StartDir !== ""){
- //Launch with default mode
- }else{
- msgbox("remove","This module has no endpoint for opening a file.");
- return;
- }
- //Parse the filelist
- var filelist = [];
- $(targetObjects).each(function(){
- var filename = $(this).attr("filename");
- var filepath = $(this).attr("filepath");
- filelist.push({
- filename: filename,
- filepath: filepath
- });
- });
- fileHash = encodeURIComponent(JSON.stringify(filelist));
- if (ao_module_virtualDesktop){
- //Open the target module in a new fw
- parent.newFloatWindow({
- url: launchURL + "#" + fileHash,
- width: launchSize[0],
- height: launchSize[1],
- appicon: iconPath,
- title: title
- });
- }else{
- //Redirect current window to the target module
- window.location.href = "../../" + launchURL + "#" + fileHash;
- }
- hideAllPopupWindows();
- }
- function openFileWithModuleInNewTab(btn){
- if ($(btn).hasClass("disabled")){
- return false;
- }
- var targetModuleInfo = JSON.parse(decodeURIComponent($(".openWithModule.selected").attr("launchInfo")));
- var targetObjects = $(".selected.fileObject");
- //Parse the filelist
- var filelist = [];
- $(targetObjects).each(function(){
- var filename = $(this).attr("filename");
- var filepath = $(this).attr("filepath");
- filelist.push({
- filename: filename,
- filepath: filepath
- });
- });
- //Directly passing the file information to the startdir
- fileHash = encodeURIComponent(JSON.stringify(filelist));
- window.open("../../" + targetModuleInfo.StartDir + "#" + fileHash);
- hideAllPopupWindows();
- }
- function openRawFileInFloatWindow(btn){
- //Directly open this (or more than one) files / folder in floatWindow
- var targetObjects = $(".selected.fileObject");
- $(targetObjects).each(function(){
- if ($(this).attr("type") == "file"){
- var launchURL = "media?file=" + $(this).attr('filepath');
- parent.newFloatWindow({
- url: launchURL,
- appicon: "img/system/file.png",
- title: $(this).attr('filename'),
- "background-color": "#1f1f1f"
- });
- }else if ($(this).attr("type") == "folder"){
- var launchURL = "SystemAO/file_system/file_explorer.html#" + $(this).attr("filepath");
- parent.newFloatWindow({
- url: launchURL,
- appicon: "SystemAO/file_system/img/small_icon.png",
- title: "File Manager - " + $(this).attr('filename'),
- });
- }else{
- //Not supported openeing type.
- console.log("Failed to open file " + $(this).attr('filepath') + " . WIP")
- }
- });
- hideAllPopupWindows();
- }
- //Open the filepaths in the given paramters
- function openPathWithDefaultOpener(filepaths){
- console.log("Opening: ", filepaths);
- for (var i =0; i < filepaths.length; i++){
- let filepath = JSON.parse(JSON.stringify(filepaths[i]));
- var ext = "." + filepath.split(".").pop();
- $.ajax({
- url: "../../system/modules/getDefault",
- method: "GET",
- data: {opr: "launch", ext: ext, mode: "launch"},
- success: function(data){
- if (data.error !== undefined){
- //No default opener assigned. Launch it with opener selector
- var url = "SystemAO/file_system/defaultOpener.html";
- var icon = "SystemAO/file_system/img/opener.png";
- var title = "Select an opener WebApp: "
- var openFileList = [];
- var openFileObject = {
- filepath: filepath,
- filename: filepath.split("/").pop()
- }
- openFileList.push(openFileObject);
- var openParamter = encodeURIComponent(JSON.stringify(openFileObject));
- var ao_module_virtualDesktop = !(!parent.isDesktopMode);
- console.log(window.innerHeight/2 - 510/20);
- if (ao_module_virtualDesktop){
- parent.newFloatWindow({
- url: url + "#" + openParamter,
- width: 320,
- height: 510,
- appicon: icon,
- title: title
- });
- }else{
- url = "defaultOpener.html";
- window.open(url + "#" + openParamter);
- }
- }else{
- //Assigned. Launch with given paramter
- var url = data["StartDir"];
- var size = [undefined, undefined];
- var title = data["Name"];
- var icon = "img/system/favicon.png";
- if (data["IconPath"] != ""){
- icon = data["IconPath"];
- }
- //Use floatWindow if exists
- if (data["SupportFW"] == true && data["LaunchFWDir"] != ""){
- url = data["LaunchFWDir"];
- if (data["InitFWSize"] !== null){
- size = data["InitFWSize"]
- }
- }
- //Use embedded mode if exists
- if (data["SupportEmb"] == true && data["LaunchEmb"] != ""){
- url = data["LaunchEmb"];
- if (data["InitEmbSize"] !== null){
- size = data["InitEmbSize"]
- }
- }
- //Build open File Hash Data Format
- var openFileList = [];
- var openFileObject = {
- filepath: filepath,
- filename: filepath.split("/").pop()
- }
- openFileList.push(openFileObject);
- var openParamter = encodeURIComponent(JSON.stringify(openFileList));
-
- //Add launch files info and launch floatWindow
- var ao_module_virtualDesktop = !(!parent.isDesktopMode);
- if (ao_module_virtualDesktop){
- parent.newFloatWindow({
- url: url + "#" + openParamter,
- width: size[0],
- height: size[1],
- appicon: icon,
- title: title
- });
- }else{
- window.open("../../" + url + "#" + openParamter);
- }
-
- }
- }
- });
- }
- }
- function openSelectedFolderInNewWindow(){
- $(".fileObject.selected").each(function(){
- if ($(this).attr("type") == "folder"){
- console.log($(this).attr('filepath'));
- openPathInNewWindow([$(this).attr('filepath')]);
- }
- })
- }
- function openSelectedVroot(){
- $("#storageroot").find(".dir.item").each(function(){
- if ($(this).hasClass("active")){
- var thisRootPath = $(this).attr('filepath');
- openPathInNewWindow([$(this).attr('filepath')]);
- }
- });
- }
- //Always open the first object locally, and open others in new floatWindows
- function openFolderInNewWindow(paths){
- if (paths.length > 0){
- listDirectory(paths[0]);
- for (var i = 1; i < paths.length; i++){
- //newFloatWindow(location.href.replace(location.hash,"") + "#" + path[i])
- openPathInNewWindow(paths[i]);
- }
- }
- }
- function openPathInNewWindow(path){
- console.log("Opening in new File Maanger: ", window.location.pathname + "#" + path);
- ao_module_newfw({
- url: window.location.pathname + "#" + path,
- appicon: "SystemAO/file_system/img/small_icon.png",
- title: "File Manager",
- width: 1080,
- height: 580,
- parent: ao_module_windowID,
- });
- }
- //Preference setting and loading functions.
- function setPreference(key, value){
- $.ajax({
- url:"../../system/file_system/preference?key=" + key + "&value=" + value,
- success: function(data){
- if (data.error !== undefined){
- console.log(data);
- }
- }
- });
- }
- function loadPreference(key, callback){
- $.get("../../system/file_system/preference?key=" + key,function(data){
- callback(data);
- });
- }
- // ============================== WINDOW RESIZE FUNCTIONS =====================
- $(document).ready(function(data){
- if (window.innerWidth < 620 && !isMobile){
- toggleSidebar(false);
- }
- initWindowSizes(false);
- });
- $(window).on("resize",function(){
- initWindowSizes(false);
- if (!isMobile && window.innerWidth < 620 && sideBarShown == true){
- toggleSidebar(false);
- }else if (!isMobile && window.innerWidth > 650 && sideBarShown == false){
- toggleSidebar(false);
- }
- if (isMobile){
- refreshList();
- }
- });
- function handleShareFilebuttonClick(event, object){
- event.preventDefault();
- event.stopImmediatePropagation();
- $(".fileObject.selected").removeClass("selected");
- if (viewMode == "list"){
- $(object).parent().parent().addClass("selected");
- }else if (viewMode == "grid"){
- $(object).parent().parent().parent().addClass("selected");
- }
-
- shareFile();
- }
-
- function shareFile(){
- var selectedFiles = [];
- $(".fileObject.selected").each(function(){
- var thisFilepath = $(this).attr("filepath");
- selectedFiles.push(thisFilepath);
- });
- if (selectedFiles.length != 1){
- //Try to share more than 1 files, which is not supported
- console.log("Multi share is current not supported");
- return
- }
- //OK! Continue to generate link
- var selectedFile = selectedFiles[0];
- shareEditingObject = selectedFile;
- $.ajax({
- url: "../../system/file_system/share/new",
- data: {path: selectedFile},
- success: function(data){
- if (data.error !== undefined){
- alert(data.error);
- }else{
- //Build the predicted share endpoint
- let protocol = "https://";
- if (location.protocol !== 'https:') {
- protocol = "http://";
- }
- //Continue to render QR Code and UI contents
- $("#qrcode").html("");
- var shareURL = protocol + window.location.hostname + ":" + window.location.port + "/share?id=" + data.UUID;
- shareEditingUUID = data.UUID;
- new QRCode(document.getElementById("qrcode"), shareURL);
- $("#sharelink").text(shareURL);
- $("#sharelink").attr("href", shareURL);
- $(".shareoption").parent().removeClass("disabled");
- $("#sharingRemoveBtn").show();
- //Check the correct checkbox
- var tagetCheckbox = data.Permission;
- if (tagetCheckbox == "anyone"){
- $("#anyone")[0].checked = true;
- }else if (tagetCheckbox == "signedin"){
- $("#signedin")[0].checked = true;
- }else if (tagetCheckbox == "samegroup"){
- $("#samegroup")[0].checked = true;
- }
- //Show the share file interface
- $(".popup").fadeOut('fast');
- showPopupWrapper();
- $("#shareFile").fadeIn("fast");
- //Reload the list
- listDirectory(currentPath);
- }
-
- }
- });
-
- }
- function removeSharing(){
- if (shareEditingObject == ""){
- return
- }
- //The target file to remove
- var selectedFile = shareEditingObject;
- $.ajax({
- url: "../../system/file_system/share/delete",
- data: {path: selectedFile},
- success: function(data){
- console.log(data);
- $("#qrcode").html(`<img src="img/private.png">`);
- $(".shareoption").parent().addClass("disabled");
- $("#sharelink").text("(Sharing Removed)");
- $("#sharelink").removeAttr("href");
- $("#sharingRemoveBtn").hide();
- //Reload the current filelist and hide the share interface
- listDirectory(currentPath);
- //Reset sharing file settings
- shareEditingObject = ""
- shareEditingUUID = ""
- }
- });
- }
- function updateShareSettings(object){
- $(object).addClass("loading");
- var shareMode = $("#shareSettingForm [name='shareopt']:checked").val();
- $.ajax({
- url: "../../system/file_system/share/edit",
- data: {uuid: shareEditingUUID, mode: shareMode},
- success: function(data){
- if (data.error !== undefined){
- alert(data.error);
- }
- $(object).removeClass("loading");
- $(object).html(`<i class="checkmark icon"></i> Updated`);
- $(object).addClass("positive");
- setTimeout(function(){
- $(object).html("Update");
- $(object).removeClass("positive");
- }, 3000);
- }
- })
- }
- function hideShare(){
- hideAllPopupWindows();
- }
- function toggleSidebar(useAnimation=true){
- //Fixing desktop bugs on showing the sidebar
- if (isMobile){
- $("#directorySidebar").stop().finish().animate({left: "toggle"},200);
- }else{
- if ($("#directorySidebar").offset().left < 0){
- $("#directorySidebar").stop().finish().animate({left: 0},200);
- }else{
- $("#directorySidebar").stop().finish().animate({left: -1 * directorySidebarWidth},200);
- }
- }
-
- sideBarShown = !sideBarShown;
- initWindowSizes(useAnimation);
- }
- function initWindowSizes(animate=true){
- var h = $("#navibar").css("height");
- var hint = $("#navibar").height();
- //$("#mainWindow").css("padding-top",h);
- var windowHeight = window.innerHeight - hint - 12;
- //console.log(windowHeight);
- if (sideBarShown){
- //Resize the sidebar
- $("#directorySidebar").css("top",h);
- $("#directorySidebar").css("width",directorySidebarWidth);
- $("#directorySidebar").css("height",windowHeight + "px");
- //Resize the file viewer
- $("#folderView").css("top",h);
- if (window.innerWidth > 650){
- if (animate){
- $("#folderView").stop().finish().animate({
- left: directorySidebarWidth + 'px',
- width: window.innerWidth - directorySidebarWidth - 2 + "px"
- },200);
- }else{
- $("#folderView").css({
- left: directorySidebarWidth + 'px',
- width: window.innerWidth - directorySidebarWidth - 2 + "px"
- });
- }
- }else{
- //Window width too small to allow resizing sidebar shown. Overlap it
- if (animate){
- $("#folderView").stop().finish().animate({
- left: directorySidebarWidth + 'px',
- width: window.innerWidth + "px"
- },200);
- }else{
- $("#folderView").css({
- left: directorySidebarWidth + 'px',
- width: window.innerWidth + "px"
- });
- }
- }
-
- if (isChromium){
- //$("#mainWindow").css("height", window.innerWidth);
- }
- //$("#folderView").css("left",directorySidebarWidth + "px");
- $("#folderView").css("height",windowHeight + "px");
- }else{
- $("#folderView").css("top",h);
- if (animate){
- $("#folderView").stop().finish().animate({
- left:'0px',
- width:(window.innerWidth - 2 + "px")
- },200);
- }else{
- $("#folderView").css({
- left:'0px',
- width:(window.innerWidth - 2 + "px")
- });
- }
- $("#folderView").css("height",windowHeight + "px");
-
- }
- }
- function toggleDarkTheme(){
- if ($(".darkTheme").length > 0){
- //Set To Whitetheme
- $(".darkTheme").removeClass("darkTheme").addClass("whiteTheme");
- currentTheme = "whiteTheme";
- $("#darkthemebtn").attr("class","moon icon");
- $("#darkthemebtn").parent().addClass("inverted");
- $(".dropdown").removeClass("inverted");
- setPreference("file_explorer/theme","whiteTheme");
- //If in vdi mode, update desktop's listMenu as well
- if (ao_module_virtualDesktop){
- parent.initTheme("whiteTheme");
- }
- $(".rightPad").css("margin-right", "37px");
-
- }else{
- //Set to DarkTheme
- $(".whiteTheme").removeClass("whiteTheme").addClass("darkTheme");
- currentTheme = "darkTheme";
- $("#darkthemebtn").attr("class","sun icon");
- $("#darkthemebtn").parent().removeClass("inverted");
- $(".dropdown").addClass("inverted");
- setPreference("file_explorer/theme","darkTheme");
- //If in vdi mode, update desktop's listMenu as well
- if (ao_module_virtualDesktop){
- parent.initTheme("darkTheme");
- }
- $(".rightPad").css("margin-right", "40px");
- }
-
- }
- function msgbox(icon, text){
- $($(".msgbox").find("span")[0]).text(text);
- $($(".msgbox").find("i")[0]).attr("class", icon + " icon");
- $(".msgbox").stop().finish().slideDown('fast').delay(3000).slideUp('fast');
- }
- //Keyboard hotkey events
- $(document).keydown(function(event){
- if ($(':focus').is("input")){
- //Do not block operations on input fields.
- return;
- }
- if(event.which==17 || event.which == 91){
- ctrlHold = true;
- }else if (event.which == 16){
- shiftHold = true;
- }else if (event.which == 67 && ctrlHold == true){
- //Ctrl + C
- if (!$(".popup").is(":visible")){
- event.preventDefault();
- copy();
- }
- }else if (event.which == 88 && ctrlHold == true){
- //Ctrl + X
- if (!$(".popup").is(":visible")){
- event.preventDefault();
- cut();
- }
- }else if (event.which == 65 && ctrlHold == true){
- //Ctrl + A
- event.preventDefault();
- $(".fileObject").addClass("selected");
- }else if (event.which == 78 && shiftHold == true){
- //Shift + N, Open new file manager window with current path
- event.preventDefault();
- openPathInNewWindow(currentPath);
- }else if (event.which == 86 && ctrlHold == true){
- if (!$(".popup").is(":visible")){
- paste();
- }
- }else if (event.which == 46 && shiftHold == true){
- //Shift + delete
- forceDelete();
- }else if (event.which == 46){
- //Delete
- deleteFile();
- }else if (event.which == 38){
- //Up Arrow
- if ($(".popup:visible").length == 0){
- //No popup visiable
- if (ctrlHold == true){
- //Parenet path
- parentDir();
- }else{
- //Select the file on the upper
- selectPreviousFile(event);
- }
- }
- }else if (event.which == 40){
- //Down arrow
- if ($(".popup:visible").length == 0){
- //No popup visiable
- selectNextFile(event);
- }
- }else if (event.which == 39){
- //Right arrow
- if ($(".popup:visible").length == 0 && viewMode == "grid"){
- //No popup visiable and grid mode
- selectRightFile(event);
- }
- }else if (event.which == 37){
- //Left arrow
- if ($(".popup:visible").length == 0 && viewMode == "grid"){
- //No popup visiable and grid mode
- selectLeftFile(event);
- }
- }else if (event.which == 13){
- //Enter key
- if ($(".fileObject.selected").length > 0){
- openViaButton();
- }
- }else if (event.which == 27){
- //Esc key
- hideAllPopupWindows();
- $(".fileObject.selected").removeClass("selected");
- }else{
- //console.log(event.which);
- }
- });
- $(document).keyup(function(event){
- if(event.which==17 || event.which == 91){
- ctrlHold = false;
- }else if (event.which == 16){
- shiftHold = false;
- }
- });
- $("#directorySidebar").on("click",function(evt){
- //Clear the button holding
- $(".fileObject.selected").removeClass("selected");
- shiftHold = false;
- ctrlHold = false;
- });
- //Check if localstorage is availble
- function lscheck(){
- var test = 'test';
- try {
- localStorage.setItem(test, test);
- localStorage.removeItem(test);
- return true;
- } catch(e) {
- return false;
- }
- }
- function selectNextFile(e){
- e.preventDefault();
- //Check if there are no selection. If yes, select the first file object
- if ($(".fileObject.selected").length == 0 && $(".fileObject").length > 0){
- //Select the first file object
- $($(".fileObject")[0]).addClass("selected");
- return
- }else if ( $(".fileObject").length == 0){
- //No file in this folder
- return
- }
- //Already contain selected file on the interface. Seleect it
- var baseObject = $($(".fileObject.selected")[0]);
- if ($(".fileObject.selected").length > 1){
- $(".fileObject.selected").removeClass("selected");
- }
- if (viewMode == "list"){
- //Select the next file
- var nextObject = $(".fileObject").eq( $(".fileObject").index( $(baseObject) ) + 1 );
- if (nextObject.length > 0){
- nextObject.addClass("selected");
- scrollToFileObject(nextObject);
- $(baseObject).removeClass("selected");
- }
- }else if (viewMode == "grid"){
- var colobj = getFileObjectInTheSameCol(baseObject);
- var nextObject = baseObject;
- for (var i = 0; i < colobj.length; i++){
- if ($(colobj[i]).hasClass("selected") && i != colobj.length - 1){
- nextObject = colobj[i + 1];
- }
- }
- $(baseObject).removeClass("selected");
- nextObject.addClass("selected");
- scrollToFileObject(nextObject);
- }
- }
- function selectPreviousFile(e){
- e.preventDefault();
- //Check if there are no selection. If yes, select the first file object
- if ($(".fileObject.selected").length == 0 && $(".fileObject").length > 0){
- //Select the first file object
- $($(".fileObject")[$(".fileObject").length - 1]).addClass("selected");
- return
- }else if ( $(".fileObject").length == 0){
- //No file in this folder
- return
- }
- var baseObject = $($(".fileObject.selected")[0]);
- if ($(".fileObject.selected").length > 1){
- $(".fileObject.selected").removeClass("selected");
- }
- if (viewMode == "list"){
- //Select the previous file
- if ($(".fileObject").index( $(baseObject) ) -1 < 0){
- return;
- }
- var previousObject = $(".fileObject").eq( $(".fileObject").index( $(baseObject) ) -1 );
- if (previousObject.length > 0){
- previousObject.addClass("selected");
- scrollToFileObject(previousObject);
- $(baseObject).removeClass("selected");
- }
-
-
- }else if (viewMode == "grid"){
- var colobj = getFileObjectInTheSameCol(baseObject);
- var prevObj = baseObject;
- for (var i = 0; i < colobj.length; i++){
- if ($(colobj[i]).hasClass("selected") && i > 0){
- prevObj = colobj[i - 1];
- }
- }
- $(baseObject).removeClass("selected");
- prevObj.addClass("selected");
- scrollToFileObject(prevObj);
- }
- }
- function scrollToFileObject(fileObject){
- if (viewMode == "grid"){
- $('#folderView').scrollTop($(fileObject)[0].offsetTop - ($("#directorySidebar").height()/2 - 340));
- }else{
- $('#folderView').scrollTop($(fileObject)[0].offsetTop - ($("#directorySidebar").height()/2 - 140));
- }
- }
- //Grid mode left right opr
- function selectLeftFile(e){
- e.preventDefault();
- if (viewMode != "grid"){
- return;
- }
- if ($(".fileObject.selected").length == 0 && $(".fileObject").length > 0){
- //Select the first file object
- $($(".fileObject")[$(".fileObject").length - 1]).addClass("selected");
- return
- }else if ( $(".fileObject").length == 0){
- //No file in this folder
- return
- }
- var baseObject = $($(".fileObject.selected")[0]);
- if ($(".fileObject").index( $(baseObject) ) -1 < 0){
- return;
- }
- var previousObject = $(".fileObject").eq( $(".fileObject").index( $(baseObject) ) -1 );
- if (previousObject.length > 0){
- previousObject.addClass("selected");
- scrollToFileObject(previousObject);
- $(baseObject).removeClass("selected");
- }
- }
- function selectRightFile(e){
- e.preventDefault();
- if (viewMode != "grid"){
- return;
- }
-
- if ($(".fileObject.selected").length == 0 && $(".fileObject").length > 0){
- //Select the first file object
- $($(".fileObject")[0]).addClass("selected");
- return
- }else if ( $(".fileObject").length == 0){
- //No file in this folder
- return
- }
- var baseObject = $($(".fileObject.selected")[0]);
- var nextObject = $(".fileObject").eq( $(".fileObject").index( $(baseObject) ) + 1 );
- if (nextObject.length > 0){
- nextObject.addClass("selected");
- scrollToFileObject(nextObject);
- $(baseObject).removeClass("selected");
- }
- }
- //Functions for getting file objects in the same collume
- function getFileObjectInTheSameCol(baseFileObject){
- if (viewMode != "grid"){
- return;
- }
- var baseOffset = $(baseFileObject).offset().left;
- var fileObjectInTheSameCol = [];
- $(".fileObject").each(function(){
- if ($(this).offset().left == baseOffset){
- let thisFileObject = $(this);
- fileObjectInTheSameCol.push(thisFileObject);
- }
- });
- return fileObjectInTheSameCol;
- }
- //Function for getting file objects in the same row
- function getFileObjectInTheSameRow(baseFileObject){
- if (viewMode != "grid"){
- return;
- }
- var baseOffset = $(baseFileObject).offset().top;
- var fileObjectInTheSameRow = [];
- $(".fileObject").each(function(){
- if ($(this).offset().top == baseOffset){
- let thisFileObject = $(this);
- fileObjectInTheSameRow.push(thisFileObject);
- }
- });
-
- return fileObjectInTheSameRow;
- }
- //Handle drag drop upload
- function drop(event){
- event.preventDefault();
- console.log(event, event.target)
- //Check if this is file upload or file move / copy function
- let dt = event.dataTransfer
- let files = dt.files
- if (files.length > 0){
- //Upload file via dragdrop
- msgbox("upload","Upload Started");
- let items = event.dataTransfer.items;
- for (let i=0; i<items.length; i++) {
- let item = items[i].webkitGetAsEntry();
- if (item) {
- recursiveScanFilesUpload(item);
- }
- }
-
- }else{
- //File transfer within system
- let filedata = event.dataTransfer.getData("filedata");
- if (filedata != ""){
- try{
- let fileList = JSON.parse(filedata);
- //Check if the file objects are from the same host
- let localFiles = [];
- let remoteFiles = [];
- fileList.forEach(file => {
- if (file.hostUUID == systemUUID){
- //Local file
- localFiles.push(file);
- }else{
- //Remote files
- remoteFiles.push(file);
- }
- });
- //Start processing the local files
- let currentVroot = currentPath.split(":/").shift();
- clipboard = [];
- //Assume all files are from the same directory
- if (localFiles.length > 0){
- //Check if drag drop from the same directory
- let currentDirname = currentPath.split("/")
- currentDirname.pop();
- currentDirname = currentDirname.join("/");
- let firstFileDirname = localFiles[0].filepath.split("/")
- firstFileDirname.pop();
- firstFileDirname = firstFileDirname.join("/");
- if (currentDirname == firstFileDirname){
- //Drag start and drop location are the same directory
- msgbox("remove","Source and destination file names are the same")
- return;
- }
- let fileVroot = localFiles[0].filepath.split(":/").shift();
- if (currentVroot == fileVroot){
- //Same device same root. Move the file
- cutMode = true;
- }else{
- //Same device differnet root. Copy the file
- cutMode = false;
- }
- //Move all localFiles into clipboard
- localFiles.forEach(file => {
- clipboard.push(file.filepath);
- });
- if (useLocalstorage){
- localStorage.setItem("ao/file_system/clipboard",JSON.stringify(clipboard));
- if (cutMode){
- localStorage.setItem("ao/file_system/cutmode","true");
- }else{
- localStorage.setItem("ao/file_system/cutmode","false");
- }
-
- }
- //Paste all the files to the current path
- console.log(clipboard);
- paste();
- }
-
-
- }catch(ex){
- console.log(ex);
- msgbox("remove","File drop failed. Unable to decode filelist.");
- }
- }
-
-
- }
-
- }
- function recursiveScanFilesUpload(item, rootpath="", base=""){
- var filesInside = [];
- if (item.isDirectory) {
- //This is a directory
- let directoryReader = item.createReader();
- directoryReader.readEntries(function(entries) {
- entries.forEach(function(entry) {
- recursiveScanFilesUpload(entry, rootpath + item.name + "/", base);
- });
- });
- }else{
- //This is a file. Upload it
- item.file(function(fileObject){
- if (isChrome || isSafari){
- //WebKits
- console.log("Upload Target", fileObject, rootpath);
- uploadFile(fileObject, undefined, currentPath + rootpath);
-
- }else{
- //Firefox. Special handling for root path.
-
- //Updates for Firefox 84.0.2 (64-bit), which changed minor implementation on relative path in folder updates
- //This section of code is deprecated since then
- /*
- //As firefox will keep its file input relative path, we need to remove the root folder
- //name from the rootpath passed in by the webkit API
-
- if (rootpath.substr(rootpath.length - 1, 1) == "/"){
- rootpath = rootpath.substr(0, rootpath.length - 1);
- }
- var rootpathInfo = rootpath.split("/");
- if (rootpathInfo.length > 1){
- //Uploading folder to folder. Extract the folder root name
- rootpathInfo.pop();
- }else{
- //Uploading file to folder. Do nothing
- }
- rootpath = rootpathInfo.join("/") + "/";
- console.log("Upload Target", fileObject, rootpath);
- uploadFile(fileObject, undefined, currentPath + rootpath);
- */
- console.log(currentPath + rootpath);
- uploadFile(fileObject, undefined, currentPath + base);
- }
-
- });
- }
- return filesInside;
- }
- function showCurrentDirectoryProperties(){
- var fileList = [currentPath];
- console.log(fileList);
- var hashPassthrough = encodeURIComponent(JSON.stringify(fileList));
- ao_module_newfw({
- url: "SystemAO/file_system/file_properties.html#" + hashPassthrough,
- width: 340,
- height: 480,
- appicon: "SystemAO/file_system/img/properties.png",
- title: "File Properties",
- });
- }
- function showVrootProperties(){
- var rootname = [$("#storageroot").find(".dir.item.active").attr("filepath")];
- var hashPassthrough = encodeURIComponent(JSON.stringify(rootname));
- ao_module_newfw({
- url: "SystemAO/disk/diskprop.html#" + hashPassthrough,
- width: 410,
- height: 580,
- appicon: "img/system/drive.svg",
- title: "Disk Properties",
- });
- }
- function openBackupManager(){
- var rootname = [$("#storageroot").find(".dir.item.active").attr("filepath")];
- var hashPassthrough = encodeURIComponent(JSON.stringify(rootname));
- ao_module_newfw({
- url: "SystemAO/disk/disk_restore.html#" + hashPassthrough,
- width: 410,
- height: 580,
- appicon: "img/system/backup.svg",
- title: "Backup & Restore",
- });
- }
- function showFileProperties(){
- //Show the file list of the selected files
- if ($(".fileObject.selected").length > 0){
- //Build the filelist
- var fileList = [];
- $(".fileObject.selected").each(function(){
- var filepath = $(this).attr("filepath");
- fileList.push(filepath);
- });
- var hashPassthrough = encodeURIComponent(JSON.stringify(fileList));
- ao_module_newfw({
- url: "SystemAO/file_system/file_properties.html#" + hashPassthrough,
- width: 340,
- height: 480,
- appicon: "SystemAO/file_system/img/properties.png",
- title: "File Properties",
- });
- }
-
- }
- function initUploadMode(){
- //Get the amount of RAM on the server side to check if low memory mode should be used.
- $.ajax({
- url: "../../system/info/getRAMinfo",
- success: function(data){
- if (data.error !== undefined){
- //Permission denied or other reasons that cannot access harwdare info. Use default mode
- lowMemoryMode = true;
- }else{
- //Check if ramsize > 1.8 GB (2GB). If yes, switch to large memory upload mode
- var memsize = JSON.parse(data);
- if (parseFloat(memsize)/ 1024 / 1024 / 1024 >= 3.8){
- console.log("[File Explorer] Entering large memory upload mode")
- lowMemoryMode = false;
- }
- }
- },
- error: function(){
- //Hardware mode disabled. Always use low memory upload mode instead
- lowMemoryMode = true;
- }
- });
- }
- let uploadBufferedRefreshTimer;
-
- function uploadFile(file, uuid=undefined, targetDir=undefined) {
- if (lowMemoryMode){
- /*
- Low Memory Upload Mode
- */
- var filename = encodeURIComponent(file.name);
- var filesize = file.size;
- //Generate a new file item
- let taskUUID = uuid; //For queueing objects
- if (taskUUID == undefined){
- //If this is a new file to be uploaded
- taskUUID = appendUploadFileItem(file.name, file.size);
- }
- //Push to upload pending list if the max concurrent upload is reached
- if (uploadingFileCount >= maxConcurrentUpload){
- let uploadDir = currentPath;
- if (targetDir !== undefined){
- uploadDir = targetDir;
- }else if (isFirefox && uploadDir == currentPath && file.webkitRelativePath != ""){
- //Use the webkitRelativePath instead of the name, this is a folder upload
- //Deprecated for Firefox 84.0.2 updates
- /*
- let pathinfo = file.webkitRelativePath.split("/");
- pathinfo.pop();
- let subpath = pathinfo.join("/");
- uploadDir = uploadDir + subpath;
- */
- uploadDir = targetDir;
- }
- uploadPendingList.push({
- File: file,
- UUID: taskUUID,
- TargetDir: JSON.parse(JSON.stringify(uploadDir)),
- });
- return
- }
- function updateProgressForWebSocketUpload(uuid, progress){
- $(".uploadTask").each(function(){
- if ($(this).attr("taskID") == uuid){
- //Update this progress bar
- $(this).find(".bar").css("width",progress + "%");
- if (progress == 100){
- //When progress = 100 and the server is not response with 200,
- //That means the upload has finish and server is processing the upload
- $(this).find(".progress").addClass("indeterminate");
- }
- }
- });
- }
- //Open the websocket
- let path = currentPath;
- let protocol = "wss://";
- if (location.protocol !== 'https:') {
- protocol = "ws://";
- }
- var port = window.location.port;
- if (window.location.port == ""){
- port = "80";
- }
- let uploadDir = currentPath;
- if (targetDir !== undefined){
- //Not uploading to current directory. Change upload path to target
- uploadDir = targetDir;
- }
- //Fixing Firefox path issues on or above FF48.0
- if (isFirefox && file.webkitRelativePath != ""){
- //Use the webkitRelativePath instead of the name, this is a folder upload
- let pathinfo = file.webkitRelativePath.split("/");
- pathinfo.pop();
- let subpath = pathinfo.join("/");
- uploadDir = uploadDir + subpath;
- //console.log("Firefox Mode: ", uploadDir, "Target Dir", targetDir)
- }
- let socket = new WebSocket(protocol + window.location.hostname + ":" + port + "/system/file_system/lowmemUpload?filename=" + filename + "&path=" + uploadDir);
- let currentSendingIndex = 0;
- let chunks = Math.ceil(file.size/uploadFileChunkSize,uploadFileChunkSize);
-
- //Define a function for sending a particular chunk
- function sendChunk(id){
- var offsetStart = id*uploadFileChunkSize;
- var offsetEnd = id*uploadFileChunkSize + uploadFileChunkSize;
- var thisblob = file.slice(offsetStart,offsetEnd);
- socket.send(thisblob);
- //console.log(id + "/" + chunks);
- //Update progress to first percentage
- var progress = id / (chunks-1) * 100.0;
- if (progress > 100){
- progress = 100;
- }
- updateProgressForWebSocketUpload(taskUUID, progress)
-
- }
- //Update all UI elements
- updateUploadFileCount();
- uploadingFileCount++;
- //Start sending
- socket.onopen = function(e) {
- if (filesize < uploadFileChunkSize){
- //This file is smaller than chunk size, set it to somwhere within 10% - 20% so it doesn't look like it is stuck
- updateProgressForWebSocketUpload(taskUUID, 10 + Math.floor(Math.random() * Math.floor(10)))
- }
-
- //Send the first chunk
- sendChunk(0);
- currentSendingIndex++;
- };
- socket.onmessage = function(event) {
- //Append to the send index
- var incomingValue = event.data;
- if (incomingValue == "next"){
- if (currentSendingIndex == chunks + 1){
- //Already finished
- socket.send("done");
- }else{
- //Send next chunk
- sendChunk(currentSendingIndex);
- currentSendingIndex++;
- }
-
- }else if (incomingValue == "OK"){
- //Merge completed
- $(".uploadTask").each(function(){
- if ($(this).attr("taskID") == taskUUID){
- //Update this progress bar to completed
- $(this).find(".bar").css("width","100%");
- $(this).find(".progress").attr("class","ts tiny positive progress");
- $(this).find(".uploadTaskRemoveIcon").show();
- $(this).addClass("ended");
- $.when($(this).delay(1000).fadeOut("fast")).then(function(){
- $(this).remove();
- updateUploadFileCount();
- });
-
- }
- });
- }else{
- //Try to parse it as JSON
- try{
- var resp = JSON.parse(incomingValue.split('\\' + '"').join("\""));
- console.log(resp);
- if (resp.error !== undefined){
- //This is an error message
- msgbox("remove",resp.error);
- //Update the progress bar to error
- $(".uploadTask").each(function(){
- if ($(this).attr("taskID") == taskUUID){
- //Update this progress bar to completed
- $(this).find(".bar").css("width","100%");
- $(this).find(".progress").attr("class","ts tiny negative progress");
- $(this).find(".uploadTaskRemoveIcon").show();
- $(this).addClass("ended");
- }
- });
- }
- }catch(ex){
- //Something else
- console.log(incomingValue);
- console.log(ex);
- }
- }
- };
- socket.onclose = function(event) {
- uploadingFileCount--;
- updateUploadFileCount();
- //After the previous file has uploaded / errored, check if there are another file needed to be uploaded
- setTimeout(function(){
- if (uploadPendingList.length > 0){
- let nextFile = uploadPendingList.shift();
- uploadFile(nextFile.File, nextFile.UUID, nextFile.TargetDir);
- }
- }, 100)
- };
- socket.onerror = function(error) {
- console.log(error.message);
- console.log("Unable to open WebSocket connection. Fall back to FORM POST upload mode. (Check your nginx / reverse proxy settings!!!)")
- //Try to fallback to FORM POST upload mode
- lowMemoryMode = false;
-
- uploadPendingList.push({
- File: file,
- UUID: taskUUID,
- TargetDir: JSON.parse(JSON.stringify(targetDir)),
- });
-
-
- return
- /*
- msgbox("caution","Upload failed due to unknown reason");
- //Something went wrong. Set the color to red
- $(".uploadTask").each(function(){
- if ($(this).attr("taskID") == taskUUID){
- //Update this progress bar to completed
- $(this).find(".bar").css("width","100%");
- $(this).find(".progress").attr("class","ts tiny negative progress");
- $(this).find(".uploadTaskRemoveIcon").show();
- $(this).addClass("ended");
- }
- });
- */
- };
- }else{
- /*
- Standard Upload Mode
- (For host with RAM >= 2GB)
- */
- //Create the task progress Object
- let taskUUID = uuid; //For queueing objects
- if (taskUUID == undefined){
- //If this is a new file to be uploaded
- taskUUID = appendUploadFileItem(file.name, file.size);
- }
-
- //Updates 22-10-2020
- //Added file upload queuing system to prevent too many request on-the-fly at the same time
- if (uploadingFileCount >= maxConcurrentUpload){
- //Push to upload pending list
- //Sometime files will be recursively uploaded (aka retry multiple time), hence the targetDir needed to be copied as well
- let uploadDir = currentPath;
- if (targetDir !== undefined){
- uploadDir = targetDir;
- }
- uploadPendingList.push({
- File: file,
- UUID: taskUUID,
- TargetDir: JSON.parse(JSON.stringify(uploadDir)),
- });
- return
- }
- //Prase upload Form
- let uploadCurrentPath = JSON.parse(JSON.stringify(currentPath));
- if (targetDir !== undefined){
- //The upload paramter supplied targetDir
- uploadCurrentPath = targetDir;
- }
- let url = '../../system/file_system/upload?path=' + uploadCurrentPath
- //console.log("Uploading To => ", uploadCurrentPath, targetDir, currentPath);
- let formData = new FormData()
- let xhr = new XMLHttpRequest()
- formData.append('file', file);
- formData.append('path', uploadCurrentPath);
- xhr.open('POST', url, true)
- xhr.upload.addEventListener("progress", function(e) {
- var progress = (e.loaded * 100.0 / e.total) || 100;
- $(".uploadTask").each(function(){
- if ($(this).attr("taskID") == taskUUID){
- //Update this progress bar
- $(this).find(".bar").css("width",progress + "%");
- if (progress == 100){
- //When progress = 100 and the server is not response with 200,
- //That means the upload has finish and server is processing the upload
- $(this).find(".progress").addClass("indeterminate");
- }
- }
- });
- })
- xhr.addEventListener('readystatechange', function(e) {
- if (xhr.readyState == 4 && xhr.status == 200) {
- //Upload process ended
- //Update task status
- $(".uploadTask").each(function(){
- if ($(this).attr("taskID") == taskUUID){
- //Update this progress bar to completed
- $(this).find(".bar").css("width","100%");
- $(this).find(".progress").attr("class","ts tiny positive progress");
- $(this).find(".uploadTaskRemoveIcon").show();
- $(this).addClass("ended");
- //Update 15-11-2020
- //Remove this taskbar after 3 secounds to prevent lags during > 2000 uploads
- $.when($(this).delay(1000).fadeOut("fast")).then(function(){
- $(this).remove();
- updateUploadFileCount();
- });
-
- }
- });
- var resp = JSON.parse(e.target.response);
- if (resp.error !== undefined){
- msgbox("caution",resp.error);
- //Something went wrong. Set the color to red
- $(".uploadTask").each(function(){
- if ($(this).attr("taskID") == taskUUID){
- //Update this progress bar to completed
- $(this).find(".bar").css("width","100%");
- $(this).find(".progress").attr("class","ts tiny negative progress");
- $(this).find(".uploadTaskRemoveIcon").show();
- $(this).addClass("ended");
- }
- });
- }
- uploadingFileCount--;
- //After the previous file has uploaded / errored, check if there are another file needed to be uploaded
- setTimeout(function(){
- if (uploadPendingList.length > 0){
- let nextFile = uploadPendingList.shift();
- uploadFile(nextFile.File, nextFile.UUID, nextFile.TargetDir);
- }
- }, 100)
-
- }else if (xhr.readyState == 4 && xhr.status != 200) {
- msgbox("remove","File too big or the target disk is fulled");
- console.log(xhr);
- $(".uploadTask").each(function(){
- if ($(this).attr("taskID") == taskUUID){
- //Upload screwed up. Show negative
- $(this).find(".progress").attr("class","ts tiny negative progress");
- $(this).find(".uploadTaskRemoveIcon").show();
- $(this).addClass("ended");
- }
- });
- uploadingFileCount--;
- //After the previous file has uploaded / errored, check if there are another file needed to be uploaded
- setTimeout(function(){
- if (uploadPendingList.length > 0){
- let nextFile = uploadPendingList.shift();
- uploadFile(nextFile.File, nextFile.UUID, nextFile.TargetDir);
- }
- }, 100)
- }
-
- updateUploadFileCount();
- })
- xhr.send(formData);
- uploadingFileCount++;
- updateUploadFileCount();
- }
- }
- //Clear all finished upload tasks
- function clearAllUploadTask(){
- $(".uploadTask.ended").slideUp('300',function(){
- $(this).remove();
- updateUploadFileCount();
- });
-
- }
- function toggleSearch(){
- //Start search mode
- $(".searchbar").slideDown("fast", function(){
- initWindowSizes(true);
- });
- $("#searhbtn").addClass("disabled");
- //Force videmode to list
- viewMode = "list"
- $(".videmode.button").each(function(){
- $(this).addClass('disabled');
- });
- searchMode = true;
-
- //Adjust the css for mobile interface
- if (isMobile){
- $("#searchInput").parent().parent().css("width", window.innerWidth - 135 + "px");
- }
- //Clear current folderlist
- $("#folderList").show();
- $("#folderList").html(`<div class="ts basic segment ${currentTheme}">
- <div class="ts header">
- <i class="arrow up icon ${currentTheme}"></i> <span class="${currentTheme}">Type to Start Search</span>
- <div class="sub header ${currentTheme}" style="margin-top:12px;">Type something in the search bar to start searching.<br>
- Start wildcard matching with "/" (slash) and your wildcard string (e.g. /*.mp3)</div>
- </div>
- </div>`);
- $("#fileList").hide();
- }
- function hideSearchBar(skipFilelistRefresh = false){
- $(".searchbar").slideUp("fast", function(){
- initWindowSizes(true);
- });
- $("#searchInput").val("");
- $("#searhbtn").removeClass("disabled");
- $(".videmode.button").each(function(){
- if ($(this).attr("mode") != "list"){
- $(this).removeClass('disabled');
- }
- });
- if (skipFilelistRefresh == false){
- listDirectory(currentPath);
- }
- searchMode = false;
- }
-
- //Handle case sensitive in keyword searching
- function toggleCaseSensitive(btn){
- if ($(btn).hasClass("active")){
- $(btn).removeClass("active");
- searchCaseSensitive = false;
- }else{
- $(btn).addClass("active");
- searchCaseSensitive = true;
- }
- }
- function handleSearch(){
- var keyword = $("#searchInput").val();
- $("#folderList").html(`<div class="ts basic segment ${currentTheme}">
- <i class="loading spinner icon ${currentTheme}"></i> <span class="${currentTheme}">Searching</span>
- </div>`);
- $("#fileList").hide();
- $("#fileList").html("");
-
- $.ajax({
- url: "../../system/file_system/search",
- data: {path: currentPath, keyword: keyword, casesensitive: searchCaseSensitive},
- success: function(data){
- if (data.error !== undefined){
- msgbox("remove", data.error);
- }else{
- //Render the filelist
- console.log(data);
- if (data.length == 0){
- $("#folderList").show();
- $("#folderList").html(`<div class="ts basic segment ${currentTheme}">
- <div class="ts header ${currentTheme}">
- <i class="question icon" ${currentTheme}></i> <span class="${currentTheme}">No Matching Results</span>
- <div class="sub header ${currentTheme}">The host return no matching results for your keyword "${keyword}". <br>Check your spelling and if your wildcard are valid.</div>
- </div>
- </div>`);
- }else{
- renderDirectory(data);
- }
-
- }
- }, error: function(){
- $("#folderList").html(`<div class="ts basic segment">
- <div class="ts header">
- <i class="remove icon"></i> Search Error
- <div class="sub header">Search timeout has occurred during file searching.</div>
- </div>
- </div>`);
- }
- })
- }
- function handleSearchBarPress(e){
- if (e.keyCode == 13 || e.key == "Enter"){
- e.preventDefault();
- handleSearch();
- }
- }
- function toggleCtrl(){
- ctrlHold = !ctrlHold;
- }
- function getUploadTaskByID(taskUUID){
- var task = undefined;
- $("#uploadTab").find(".uploadTask").each(function(){
- if ($(this).attr("taskid") == taskUUID){
- task = $(this);
- }
- });
- return task;
- }
- function appendUploadFileItem(filename, filesize){
- var newuuid = uuidv4();
- var humanReadableFilesize = 0;
- if (filesize < 0){
- humanReadableFilesize = "Unknown Size"
- }else{
- humanReadableFilesize = bytesToSize(filesize);
- }
-
- $("#uploadProgressList").append(`<div class="uploadTask" taskID="${newuuid}">
- <p style="width: calc(100% - 15px);">${filename} (${humanReadableFilesize})</p>
- <div class="ts tiny primary progress" style="margin-top:-12px;">
- <div class="bar" style="width: 0%"></div>
- </div>
- <div class="uploadTaskRemoveIcon" onclick="removeThisTask(this);" style="display:none;">
- <i class="remove icon"></i>
- </div>
- </div>`);
- return newuuid;
- }
- function removeThisTask(object){
- $(object).parent().fadeOut('fast',
- function(){
- $(this).remove();
- updateUploadFileCount();
- }
- );
-
- }
- function toggleUploadList(){
- $("#uploadProgressList").toggle();
- if ($("#uploadProgressList").is(":visible")){
- $("#hideUploadButton").html('<i class="caret down icon"></i>');
- }else{
- $("#hideUploadButton").html('<i class="caret up icon"></i>');
- }
- }
- function updateUploadFileCount(){
- $("#uploadCount").text(uploadingFileCount);
- $("#waitingCount").text(uploadPendingList.length);
- if (uploadingFileCount == 0 && $(".uploadTask").length == 0){
- $("#uploadTab").hide();
- }else{
- $("#uploadTab").show();
- }
- }
- function bytesToSize(bytes) {
- var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
- if (bytes == 0) return '0 Byte';
- var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
- return Math.round(bytes / Math.pow(1024, i) * 100, 2) / 100 + ' ' + sizes[i];
- }
- function uuidv4() {
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
- var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
- return v.toString(16);
- });
- }
- function dropToFolder(event){
- event.preventDefault();
- event.stopImmediatePropagation();
- console.log("Drop to folder detected");
- //Extract target folder path from object
- var targetPath = $(event.target).attr("filepath");
- if (targetPath == ""){
- return
- }
-
- //Check if this is upload or file move drag
- var files = event.dataTransfer.files;
- if (files.length > 0){
- //Upload mode. Extract the target folder basename from path
- if (targetPath.substr(targetPath.length -1,1) == "/"){
- targetPath = targetPath.substr(0, targetPath.length-1);
- }
- var folderBase = targetPath.split("/").pop() + "/";
- var items = event.dataTransfer.items;
- for (let i=0; i<items.length; i++) {
- let item = items[i].webkitGetAsEntry();
- if (item) {
- recursiveScanFilesUpload(item, folderBase, folderBase);
- }
- }
- }else if (event.dataTransfer.getData("filedata") != ""){
- var targetVroot = targetPath.split(":/").shift();
- //Get the source files
- var filelist = JSON.parse(event.dataTransfer.getData("filedata"));
- if (filelist.length > 0){
- var srcVroot = filelist[0].filepath.split(":/").shift();
- if (srcVroot == targetVroot){
- //Use move mode
- cutMode = true;
-
- }else{
- //Use copy mode
- cutMode = false;
- }
- //Parse the filelist
- clipboard = [];
- filelist.forEach(file=>{
- clipboard.push(file.filepath);
- });
- if (useLocalstorage){
- localStorage.setItem("ao/file_system/clipboard",JSON.stringify(clipboard));
- localStorage.setItem("ao/file_system/cutmode","true");
- }
-
- //Perform operations
- paste(targetPath, false)
- }
- }
- }
- function allowDrop(event){
- event.preventDefault();
- }
- $(".popupWrapper").on("click",function(){
- hideAllPopupWindows();
- });
- function hideAllPopupWindows(){
- $(".popup").fadeOut(100);
- $(".popupWrapper").fadeOut(100);
- $('body').css("overflow","");
- }
- function showPopupWrapper(){
- $(".popupWrapper").fadeIn('fast');
- $('body').css("overflow","hidden");
- }
- //Handle keydown of enter on certain input boxes
- function handleEnterKeyDown(event, handler){
- if (event.which == 13){
- handler();
- }
- }
- //Generate a download link and press it
- function generateDownloadFromURL(url, filename){
- let a = document.createElement('a')
- a.href = url;
- a.download = filename;
- document.body.appendChild(a)
- a.click()
- document.body.removeChild(a)
- }
- //Update sorting method for file listing
- function updateSortingMethods(){
- var method = $("#sortingMethodSelector").val();
- sortMode = method;
- //Save it to server side
- $.ajax({
- url: "../../system/file_system/sortMode",
- method: "POST",
- data: {opr: "set", folder: currentPath, mode: sortMode},
- success: function(data){
- //console.log("Sort mode saved: " + data)
- refreshList();
- }
- });
- }
- function requestCSRFToken(callback){
- $.ajax({
- url: "../../system/csrf/new",
- success: function(token){
- callback(token);
- }
- })
- }
- </script>
- </body>
- </html>
|