Saturday, November 29, 2014

jQueryFileTree - an old plugin

I've been on a project at school for some time, it's a lot of fun. I enjoy working with others for a change. The project uses jQuery and we had a need to view directories from the server. Originally I wrote a very messy class that got the job done, but then one day I stumbled on jQueryFileTree.

Over all it was much simpler than my implementation. The only thing I don't like about it is it passes raw html from the connector script. My implementation passed a json object. Still, didn't take much work to get everything changed over. Most importantly, jQueryFileTree's implementation looked prettier... a lot prettier.

My lame file tree.
jQueryFileTree's default.


If there is anything I've learned about working with web interfaces, it's this: noone cares how efficient/useful/pretty/awesome your underlying scripts is, they only look at the surface. It's actually unfair the value placed on aesthetics. Cover some craptacular code with bootstrap, everyone think's it gold.

Why am I even writing about this?

For as much as I like jQueryFileTree, there were a couple of things it couldn't do. Now it can do those things, because open source!

One part of our project didn't need files, only folders. The user selects a folder and magic happens no matter what is inside. I added a Boolean option called 'folderSelect' to handle this behavior. By default it's false, but if set to true files are not displayed and when the user clicks a folder that directory path is passed to the callback.

The other thing we needed was a way to exclude files by name or extension. The new option 'exclude' is an array of strings. Any strings that match a folder or file name is given a hidden class. In contrast 'folderSelect' does not return files at all, this will return the excluded names but not show them. I did this just in case we wanted to have an option to show hidden files. In addition to names, any string that starts with '*.' will exclude by file extension.

jQueryFileTree with these new options can be found at this fork of the original. The exclusion code get's complicated, no doubt there are ways to improve it (I'm all ears if anyone has a suggestion).

Maybe I'll change it up to pass json in the ajax call, and have a way for the user to change up the look. I think that would be better. I don't have a need for that right now though, so I won't be surprised if it doesn't happen.




13 comments:

Elizabeth Johanson said...

I am one of the most experienced UK dissertation writers from England, UK. I have been teaching and helping the students with their academic issues, dissertation proposals, reports, etc. I would love to teach them about this plugin as well.

Unknown said...

Exportclub is an online pakistani men brand collection in pakistan.Our brand is established in 2010.Now,we are one of the best online styles for men summer at an affordable and reasonable price.

Unknown said...

Thanks for sharing this nice post!I have been reading this content since last night.It was really helpful and informative for me and all the readers.We are offering an online gift to karachi at an affordable and reasonable price.

Emma Watson said...

Searching for horse riding gear and apparel? Protective caps, Gloves, Tights, Boots, Whips and the sky is the limit from there! Reasonable costs. horse shops near me

thisisemliyblunt said...

Great service, easy and quick. Would use again, jet2holidays discount code just what we where looking for and very good price.

John said...

Basically, I was looking for an Essay Writing Service in Philadelphia when I landed on your site. I know I have been landed accidentally, but believe me, I am glad to come here because it has provided me very unique information about Jquery. I am sure it will help me in my computer science career.

thisisemliyblunt said...

On the off chance that they don't then your resume will appropriately, Best Discount code site
Kitchen With Dining
Top Brands Shoes For Men And Women
Prepping Up For Summer Skin
Perfect Swimsuit
Blue Sea Holidays
london travel guide
Emporio Armani
Beach Vacations, be going out with the rubbish without a subsequent look.

My Dissertations said...

No worries, we suggest you request My Dissertations to get MBA dissertation help online and we will make sure you get all the rest you need.

John David said...

Indeed, jQueryFileTree has been around for a while and remains a reliable choice for directory tree display. Speaking of longevity and reliability, I recently came across the DPS-275EB-A - Dell Red 275-Watts Power Supply. Despite being around for a considerable time, it's still a robust and efficient power supply, ensuring stable performance for various Dell systems. It's great to see these time-tested components stand the test of time in the tech world.

Emilia Cod said...

It's always fascinating to revisit and appreciate the enduring tools of the past. In the realm of networking, the longevity of jQueryFileTree is a testament to its reliability. While newer technologies and libraries have emerged, sometimes the classics remain relevant for specific use cases or for those who appreciate their simplicity and stability.

Antony said...

I would like to thank you for the efforts you have made in writing this article.
Abogado Criminal Federal de Nueva Jersey

es nueva jersey un estado de divorcio 50 50 said...

For a change, I enjoy collaborating with others. The project makes use of jQuery, and we needed to access directories from the server. Originally, I developed a really messy class that did the job, but then I discovered jQueryFileTree.
Thank you for sharing your knowledge! Keep up the good job! Continue to spread the word. Please take a peek at my website.

victortimely123 said...

The depth and richness of your blog posts never fail to impress. Your commitment to delivering valuable information shines through every article. Your blog stands as a reliable reservoir of knowledge and inspiration. Thank you for consistently crafting such enlightening content.Middlesex County Reckless Driving Lawyer and Middlesex County Reckless Driving Lawyer