{"id":17309601,"url":"https://github.com/jcubic/jquery.filebrowser","last_synced_at":"2025-04-14T13:32:18.332Z","repository":{"id":54682814,"uuid":"75653515","full_name":"jcubic/jquery.filebrowser","owner":"jcubic","description":"File browser jQuery plugin","archived":false,"fork":false,"pushed_at":"2023-05-26T14:20:08.000Z","size":989,"stargazers_count":35,"open_issues_count":1,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-01T04:26:54.027Z","etag":null,"topics":["browser","directories","explorer","files","filesystem","manager"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jcubic.png","metadata":{"files":{"readme":"README.in","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-05T18:18:45.000Z","updated_at":"2024-10-04T04:17:57.000Z","dependencies_parsed_at":"2022-08-14T00:00:13.959Z","dependency_job_id":null,"html_url":"https://github.com/jcubic/jquery.filebrowser","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcubic%2Fjquery.filebrowser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcubic%2Fjquery.filebrowser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcubic%2Fjquery.filebrowser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcubic%2Fjquery.filebrowser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcubic","download_url":"https://codeload.github.com/jcubic/jquery.filebrowser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223634176,"owners_count":17176879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser","directories","explorer","files","filesystem","manager"],"created_at":"2024-10-15T12:30:19.016Z","updated_at":"2024-11-08T05:01:30.132Z","avatar_url":"https://github.com/jcubic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [jQuery File Browser](https://github.com/jcubic/jquery.filebrowser) version {{VER}}\n\njQuery File Browser is a plugin for creating OS like file browsers.\n\n[Demo](http://codepen.io/jcubic/pen/aBKYRR)\n\n# installation\n\nto install you can grab the files from the repo or install from\n\n## bower\n\n```\nbower install jquery.filebrowser --save\n```\n\n## npm\n\n```\nnpm install jquery.filebrowser --save\n```\n\ninclude the files:\n\n```html\n\u003cscript src=\"js/jquery.filebrowser.min.js\"\u003e\u003c/script\u003e\n\u003clink href=\"css/jquery.filebrowser.min.css\" rel=\"stylesheet\"/\u003e\n```\n\nand you can use this code to initialize the plugin:\n\n```javascript\n$(function() {\n    var browse = $('#browser').browse({\n        root: '/',\n        separator: '/',\n        contextmenu: true,\n        dir: function(path) {\n            return new Promise(function(resolve, reject) {\n                 if (path == '/') {\n                     resolve({dirs: ['foo', 'bar'], files: []});\n                 } else if (path == '/foo/') {\n                     resolve({dirs: [], files: ['baz', 'quux']});\n                 } else if (path == '/bar/') {\n                     resolve({dirs: [], files: ['lorem', 'ipsum']});\n                 } else {\n                     reject(); // for cases when you type wrong path in address bar\n                 }\n             });\n        },\n        open: function(filename) {\n            console.log('opening ' + filename);\n        }\n    });\n});\n```\n\nAll user functions that modify the Directory like create, remove, copy, rename can return a promise,\nand the plugin will refresh the view (call dir function) when it's resolved.\n\nmore examples and usage in [examples directory](https://github.com/jcubic/jquery.filebrowser/tree/master/examples).\n\n# Requirement\n\nIf you want context menu (enabled using contextmenu option) you'll need jQuery UI and of course you need jQuery itself.\n\n# Options\n\n* name - used to distinguish different filesystem for copying nad moving files (rename)\n* dir - function that should return a promise that resolve to object `{files: \u003cARRAY\u003e, dirs: \u003cARRAY\u003e}` or return that object\n* exists - function that will return true/false or a promise that resolve to true/false that indicate if file or directory exists (used when create new file/directory)\n* separator - path separator (a string) usualy `/` or `\\` (to use `\\` you need to put `'\\\\'`) default /\n* root - root of the filesystem, it can be any path like `/home/\u003cuser\u003e`, default `/`\n* change - callback function that's called on refresh of the directory\n* init - callack executed on initalization of the plugin\n* item_class - function that should return addiional classes for the element (directory or file) you can use this to have different icons for C or D drive that's in root directory, see [windows example](https://github.com/jcubic/jquery.filebrowser/tree/master/examples/windows.html)\n* dbclick_delay - if the time of the second click is lower then this but hight then rename_delay it's consider as action for rename a file or directory\n* open - callback function executed with path of the file when you double click on the file\n* rename - callback function called with old path nad new path when you rename a file or directory\n* remove - callback function called with path when you delete file or directory\n* create - callback called with path of the new file or directory and string 'directory' or 'file' as second argument\n* copy - callback executed when you copy a file using CTRL+C and CTRL+V\n* upload - callback called with file object and the path when you drag and drop a file or directory to browser container, you can also drag into visible directory\n* error - called when error accured like when you try to enter invalid path in address bar\n* refresh_timer - timeout after fetch of the content of the file in miliseconds, used to see visible refresh when you change direcotry (you can set it to 0), default 100\n* menu - should return object which keys are names of the context menu and values are other object (they will create submenus) or a function that will be executed when menu item is click it acceppt single argument string 'li' or 'content' depend if you click on file/directory or on empty browser space. example:\n\n```javascript\n    menu: function(type) {\n        if (type == 'li') {\n            return {\n                'alert': function($li) {\n                    alert('alert for item ' + $li.text());\n                }\n            }\n        }  else {\n            return {\n                'Create File': function() {\n                    var name = prompt('name: ');\n                    var path;\n                    if (name) {\n                        path = this.join(this.path(), name);\n                    }\n                    this.create('file', path);\n                }\n            };\n        }\n    },\n```\n\n# API methods\n\n* path - return current path\n* name - return settings name\n* back - go back one directory\n* destroy - remove all events and DOM nodes\n* create - function(type, [path]) - create new directory of file (depend of first argument which is string 'file' or 'directory') if there is second argument it will create new file/directory of it's undefined it will create placeholder for file/directory with textarea to enter name\n* copy - selected files/directories for later paste\n* cut - like copy but when call paste it will remove old items\n* paste - if cut was executed it will call settings.rename and if copy was called it will call settings.copy and then refresh all views with the same directory\n* up - go up one directory\n* show - call settings.dir and rerender the directory view\n* join - return new path based on settings.separator and settings.root, accept any number of arguments\n* split - split the path using settings.separator and settings.root\n* walk - function(filename, fn) - call function for each file/directory the signature for callaback function: function(path_part, last, return_value) the function return value from last call to callback function, 3rd argument is a value from previous call to callback function.\n\n\n# License\n\nLicensed under [MIT](http://opensource.org/licenses/MIT) license\n\nCopyright (c) 2016-2021 [Jakub T. Jankiewicz](https://jcubic.pl/me)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcubic%2Fjquery.filebrowser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcubic%2Fjquery.filebrowser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcubic%2Fjquery.filebrowser/lists"}