Skip to content

Commit

Permalink
reintroduced "loadFromSystem" method.
Browse files Browse the repository at this point in the history
  • Loading branch information
mb.jquery.components committed May 22, 2015
1 parent e3733d7 commit 6fdaa4b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion demo_lookUp.html
Expand Up @@ -153,7 +153,7 @@
// If your server allow directory listing you can use:
// (however this doesn't work locally on your computer)

// folderPath:"testImage/",
folderPath:"testImage/",

// else:

Expand Down
34 changes: 34 additions & 0 deletions inc/mb.bgndGallery.js
Expand Up @@ -146,6 +146,10 @@ jQuery.browser.mobile = jQuery.browser.android || jQuery.browser.blackberry || j

jQuery(containment).prepend(opt.gallery);

if(el.opt.folderPath && el.opt.images.length==0)
el.opt.images = jQuery.loadFromSystem(el.opt.folderPath) ;


if(el.opt.shuffle)
el.opt.images= jQuery.shuffle(el.opt.images);

Expand Down Expand Up @@ -798,6 +802,36 @@ jQuery.browser.mobile = jQuery.browser.android || jQuery.browser.blackberry || j
jQuery.fn.removeImages = jQuery.mbBgndGallery.removeImages;
jQuery.fn.applyFilter = jQuery.mbBgndGallery.applyFilter;

jQuery.loadFromSystem=function(folderPath, type){

// if directory listing is enabled on the remote server.
// if you run the page locally you need to run it under a local web server (Ex: http://localhost/yourPage)
// otherwise the directory listing is unavailable.

if(!folderPath)
return;
if(!type)
type= ["jpg","jpeg","png"];
var arr=[];
jQuery.ajax({
url:folderPath,
async:false,
success:function(response){
var tmp=jQuery(response);
var els= tmp.find("[href]");

els.each(function(){
for (var i in type){
if (jQuery(this).attr("href").indexOf(type[i])>=0)
arr.push(folderPath+jQuery(this).attr("href"));
arr = jQuery.unique(arr);
}
});
tmp.remove();
}
});
return arr.length != 0 ? arr : false;
};

jQuery.fn.greyScale = function(el) {
return this.each(function() {
Expand Down

0 comments on commit 6fdaa4b

Please sign in to comment.