Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CheckPath(p, temp) {
- var result = new Array();
- var folders = new Array();
- var res = null;
- folders.push(p);
- var licznik = folders.length;
- while( licznik > 0) {
- res = TestDir(folders[0], temp);
- result.concat(res[0]);
- folders.concat(res[1]);
- folders.shift();
- licznik = folders.length;
- }
- return folders;
- }
- function TestDir(p, temp) {
- var result = new Array(new Array(), new Array());
- var folders = new Array();
- return Promise.resolve($.ajax({
- method: "POST",
- url: "testcore.php",
- data: { path: p, template: temp},
- dataType: "json"
- })).then(function(data) {
- result[0] = data[0];
- folders = data[1];
- if(folders.length > 0) {
- for(i = 0; i<folders.length; i++) {
- zm = folders[i].split("/");
- zm = zm[zm.length-1];
- if( zm != "static" && zm != "_products" && zm != "templates" && zm != "") {
- result[1].push(folders[i]);
- }
- }
- }
- }).then(function() {
- return result;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment