Skip to content

Instantly share code, notes, and snippets.

@michaelrog
Created September 6, 2011 05:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelrog/1196668 to your computer and use it in GitHub Desktop.
Save michaelrog/1196668 to your computer and use it in GitHub Desktop.
JS/jQuery to tweak Assets File Manager view
/*
This JS/jQuery code simulates clicks that cause the Assets File Manager to:
- switch to List view
- expand the first level of subfolders
Simply add it to your EE2 CP via your favorite method. I suggest using Brandon Kelly's CP_JS_CSS.
(The timeout is a bit of a hack: Without a slight delay, expanding the subfolders doesn't work. I think this is because the file tree are loaded via AJAX-y methods, which require a wee bit of time to complete.)
P&T Assets: http://pixelandtonic.com/assets
P&T CP_JS_CSS: https://github.com/pixelandtonic/cp_css_js
*/
$(function(){
assets_fm_views = function(){
// switch to list view
$(".assets-fm-list").click();
// expand folders
$(".assets-fm-toggle").click();
}
var do_it = setTimeout("assets_fm_views()", 400);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment