less copy protection, more size visualization
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

78 satır
1.8 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. authors: {
  28. "chemicalcrux": {
  29. name: "chemicalcrux",
  30. url: "https://www.furaffinity.net/user/chemicalcrux"
  31. }
  32. }
  33. }
  34. const attribution = {};
  35. function prepareAttribution() {
  36. attribution["files"] = {};
  37. attributionData.sources.forEach(citation => {
  38. citation.files.forEach(file => {
  39. attribution.files[citation.prefix + file.name] = {
  40. authors: citation.authors,
  41. source: file.source
  42. }
  43. })
  44. });
  45. }
  46. function authorsOf(file) {
  47. if (attribution.files[file])
  48. return attribution.files[file].authors;
  49. else
  50. return undefined;
  51. }
  52. function authorsOfFull(file) {
  53. if (attribution.files[file]) {
  54. const result = [];
  55. attribution.files[file].authors.forEach(author => {
  56. result.push(attributionData.authors[author]);
  57. });
  58. return result;
  59. }
  60. else
  61. return undefined;
  62. }
  63. function sourceOf(file) {
  64. if (attribution.files[file])
  65. return attribution.files[file].source;
  66. else
  67. return undefined;
  68. }
  69. prepareAttribution();