less copy protection, more size visualization
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

96 lines
2.4 KiB

  1. const attributionData = {
  2. sources: [
  3. {
  4. prefix: "./media/buildings/",
  5. files: [
  6. { name: "house.svg", source: null },
  7. { name: "mailbox.svg", source: null },
  8. { name: "mobile-home.svg", source: null },
  9. ],
  10. authors: [
  11. "chemicalcrux"
  12. ]
  13. },
  14. {
  15. prefix: "./media/buildings/skyscrapers/",
  16. files: [
  17. { name: "wide.svg", source: null },
  18. { name: "medium.svg", source: null },
  19. { name: "slender.svg", source: null },
  20. { name: "narrow.svg", source: null },
  21. ],
  22. authors: [
  23. "chemicalcrux"
  24. ]
  25. },
  26. {
  27. prefix: "./media/characters/abysgar/",
  28. files: [
  29. { name: "front.svg", source: "https://www.furaffinity.net/view/32424108/"}
  30. ],
  31. authors: [
  32. "clown-grin",
  33. "labratkuma"
  34. ]
  35. }
  36. ],
  37. authors: {
  38. "chemicalcrux": {
  39. name: "chemicalcrux",
  40. url: "https://www.furaffinity.net/user/chemicalcrux"
  41. },
  42. "clown-grin": {
  43. name: "clown-grin",
  44. url: "https://www.furaffinity.net/user/clown-grin"
  45. },
  46. "labratkuma": {
  47. name: "labratkuma",
  48. url: "https://www.furaffinity.net/user/labratkuma"
  49. }
  50. }
  51. }
  52. const attribution = {};
  53. function prepareAttribution() {
  54. attribution["files"] = {};
  55. attributionData.sources.forEach(citation => {
  56. citation.files.forEach(file => {
  57. attribution.files[citation.prefix + file.name] = {
  58. authors: citation.authors,
  59. source: file.source
  60. }
  61. })
  62. });
  63. }
  64. function authorsOf(file) {
  65. if (attribution.files[file])
  66. return attribution.files[file].authors;
  67. else
  68. return undefined;
  69. }
  70. function authorsOfFull(file) {
  71. if (attribution.files[file]) {
  72. const result = [];
  73. attribution.files[file].authors.forEach(author => {
  74. result.push(attributionData.authors[author]);
  75. });
  76. return result;
  77. }
  78. else
  79. return undefined;
  80. }
  81. function sourceOf(file) {
  82. if (attribution.files[file])
  83. return attribution.files[file].source;
  84. else
  85. return undefined;
  86. }
  87. prepareAttribution();