photo.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. Photo.js
  3. Author: tobychui
  4. This is a complete rewrite of the legacy Photo module for ArozOS
  5. */
  6. let photoList = [];
  7. function sideBarObject(){
  8. return {
  9. tags: [],
  10. }
  11. }
  12. function folderObject() {
  13. return {
  14. // data
  15. pathWildcard: "user:/Photo/*.jpg",
  16. images: [],
  17. folders: [],
  18. // init
  19. init() {
  20. this.getFolderInfo()
  21. },
  22. updateRenderingPath(newWidlcard){
  23. this.pathWildcard = newWidlcard;
  24. this.getFolderInfo();
  25. },
  26. getFolderInfo() {
  27. fetch(ao_root + "system/ajgi/interface?script=Photo/backend/listFolder.js", {
  28. method: 'POST',
  29. cache: 'no-cache',
  30. headers: {
  31. 'Content-Type': 'application/json'
  32. },
  33. body: JSON.stringify({
  34. "folder": this.pathWildcard
  35. })
  36. }).then(resp => {
  37. resp.json().then(data => {
  38. console.log(data);
  39. this.folders = data[0];
  40. this.images = data[1];
  41. });
  42. });
  43. }
  44. }
  45. }
  46. function showImage(object){
  47. var fd = JSON.parse(decodeURIComponent($(object).attr("filedata")));
  48. console.log(fd);
  49. }