在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:jqueryfiletree/jqueryfiletree开源软件地址:https://github.com/jqueryfiletree/jqueryfiletree开源编程语言:CSS 28.6%开源软件介绍:jQueryFileTreeNOTE:I no longer use jQuery and have no need for a filetree, so it would be great if someone wanted to take over this project to maintain it, address issues, set up integrated testing, etc.DEMOhttp://jqueryfiletree.github.io/ INSTALLINGBower: Manual: Download ZIP ABOUTjQueryFileTree is a configurable, AJAX file browser plugin for jQuery. This repo is a continuation of unmaintained jQuery File Tree (12 April 2008) by Cory S.N. LaViska at ABeautifulSite.net jQueryFileTree requires at least jQuery 1.2 FEATURES
CREATING A FILE TREEIn it’s simplest form, you can create a file tree using the following code: $(document).ready( function() {
$('.class').fileTree({ root: '/some/folder/' }, function(file) {
alert(file);
});
}); Where .class is the class of an empty DIV element that exists on your page. The file tree will automatically load when your page loads. Any DIV elements with this class will share the same file tree. CONFIGURING THE FILE TREEParameters are passed as an object to the fileTree() function. Valid options include:
* Anything other than 'swing' and 'linear' requires an external lib or script like jQuery UI or jquery.easing There are many options available, which would look something like this: $(document).ready( function() {
$('.class').fileTree({
root: '/some/folder/',
script: 'jqueryFileTree.php',
expandSpeed: 1000,
collapseSpeed: 1000,
multiFolder: false
}, function(file) {
alert(file);
});
}); STYLING THE FILE TREEThe file tree relies 100% on CSS for styling. Refer to jqueryFileTree.less to make any changes to the default styling. CONNECTOR SCRIPTSjQueryFileTree comes with a handful of serverside connector scripts that are used to read the file system on your server and return data to the clientside script via AJAX. The default connector script is jqueryFileTree.php. You can use a connector script for another language by setting the script parameter to the location of the script you want to use (see Configuring the File Tree). Alternatively, you can build a custom connector script to extend the functionality of jQueryFileTree to better suit your needs (see Custom Connector Scripts). Connector scripts for the following languages are provided:
(DAVE) Note that all of the connector scripts have been left unmaintained outside of the PHP one in which I have updated (and will continue to do so). If you've improved or created a connector, feel free to create a pull request. Use connector scripts as a starting point, but be mindful that often such (largely) unmaintained examples lack the security necessary for production. CUSTOM CONNECTOR SCRIPTSYou can create a custom connector script to extend the functionality of the file tree. The easiest way to do this is probably by modifying one of the scripts supplied in the download. If you want to start from scratch, your script should accept one POST variable (dir) and output an unsorted list in the following format: <ul class="jqueryFileTree">
<li class="directory collapsed"><a href="#" rel="/this/folder/">Folder Name</a></li>
(additional folders here)
<li class="file ext_txt"><a href="#" rel="/this/folder/filename.txt">filename.txt</a></li>
(additional files here)
</ul> Note that the corresponding file extension should be written as a class of the li element, prefixed with ext_. (The prefix is used to prevent invalid class names for file extensions that begin with non-alpha characters.) Additionally you may choose to enable multi-select, which appends a checkbox to each item. Visible child elements will automatically be checked/unchecked along with the parent. Currently this is only supported in PHP; feel free to update other connectors to reflect the following format: <ul class="jqueryFileTree">
<li class="directory collapsed"><input type='checkbox' /><a href="#" rel="/this/folder/">Folder Name</a></li>
(additional folders here)
<li class="file ext_txt"><input type='checkbox' /><a href="#" rel="/this/folder/filename.txt">filename.txt</a></li>
(additional files here)
</ul> EVENTSjQueryFileTree now supports binding event listeners to the file tree element $('.filetree')
.on('filetreeinitiated', function(e, data) { console.log(data); });
.on('filetreeexpand', function (e, data) { console.log(data); })
.on('filetreeexpanded', function (e, data) { console.log(data); })
.on('filetreecollapsed', function (e, data) { console.log(data); })
.on('filetreecollapse', function (e, data) { console.log(data); })
.on('filetreeclicked', function(e, data) { console.log(data); }); All except 'filetreeinitiated' return the data object with the following properties
Pretty much has the information you need, but I included the LI object anyways so you can easily get any other data you want with something like LICENSING & TERMS OF USEThis plugin is dual-licensed under the GNU General Public License and the MIT License and is copyright 2008 A Beautiful Site, LLC. CONTRIBUTINGGulp is used to compile the CoffeeScript and LESS files into js and css files respectively. If you are making changes to jQueryFileTree itself (and not the connectors), you MUST make your changes inside jQueryFileTree.coffee and jQueryFileTree.less or the next time jQueryFileTree is compiled your changes will disappear. TESTINGIn order to test, you'll need Bower and Gulp. Right now, I just have a manual browser demo to test functionality.
SPECIAL THANKSA special thanks goes out to FAMFAMFAM for their excellent Silk Icon Set. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论