Results 1 to 2 of 2
Like Tree4Likes
  • 4 Post By devwithoutpower
  1.    #1  
    small patch for Adobe Reader app - folder support in local files navigation

    Part I) FileStore.jsjsjs
    line 97: orderBy: "name",
    replace with
    Code:
    orderBy: "path",
    after line 372: var rec, records = (inResponse && inResponse.results) || [], result = {files: []};

    add
    Code:
    var dirs = [];
    then after line 377: rec = records[i];
    add
    Code:
    var s = rec.path.substring(16).split('/');
    for(var x=0; x<s.length-1; x++) {
    	var f = s[0];
    	for(var y=1; y<=x; y++)
    		f = f + '/' + s[y]; 
    	if(dirs[f]===undefined)
    		dirs[f] = true;
    }
    and after line 398 (end of for loop)
    add
    Code:
    for(x in dirs) {
    	if(dirs[x]===true) {
    		var last = x.lastIndexOf('/');
    		result.files.push(new File({ fileStem: (last>=0 ? x.substr(last+1) : x), uri: '/media/internal/'+x, type: File.kFILETYPE_DIR }));
    	}
    }
    result.files.sort(function(A, B) { return A.isFolder() === B.isFolder() ? A.getFilename().localeCompare(B.getFilename()) : (B.isFolder() ? 1 : -1); });
    Part II) FolderContentsList.jsjsjs
    replace line 751
    Code:
    for (var i = inFrom, j = this.fsoCache.length; i < j; ++i) {
    with
    Code:
    var base = this.baseFolder.uri || '/media/internal';
    for (var i = inFrom, j = this.fsoCache.length; i < j; ++i) {
    var start = this.fsoCache[i].uri.indexOf(base+'/');
    if(start===-1 || start===0 && this.fsoCache[i].uri.substr(base.length+2).indexOf('/')!==-1)
    	continue;
    Enjoy. All line numbers taken from vanilla 10.3.406. Tasted with few files only - so please let me know if there are some preformance (or other) issues...
    Last edited by devwithoutpower; 11/18/2011 at 06:12 PM.
  2. jdale's Avatar
    Posts
    554 Posts
    Global Posts
    564 Global Posts
    #2  
    Also see http://forums.precentral.net/webos-p...ewed-page.html for a mega patch for the Reader. It doesn't have this... yet... but I see they've noticed this thread and I expect it will be in there soon.

Posting Permissions