mirror of
https://github.com/chaoticbackup/chaoticbackup.github.io.git
synced 2026-04-26 01:02:54 -05:00
[add] dynamically grabs all spreadsheets
This commit is contained in:
parent
05fb08d089
commit
6ddc437c05
|
|
@ -5,21 +5,29 @@ class URLS {
|
||||||
static base_url = "https://spreadsheets.google.com/feeds/list/";
|
static base_url = "https://spreadsheets.google.com/feeds/list/";
|
||||||
static data_format = "/od6/public/values?alt=json";
|
static data_format = "/od6/public/values?alt=json";
|
||||||
// + "/od6/public/basic?alt=json"; // Alternate data format
|
// + "/od6/public/basic?alt=json"; // Alternate data format
|
||||||
|
static base_spreadsheet = "1cUNmwV693zl2zqbH_IG4Wz8o9Va_sOHe7pAZF6M59Es";
|
||||||
get base_image() { return "https://drive.google.com/uc?id="; }
|
get base_image() { return "https://drive.google.com/uc?id="; }
|
||||||
|
|
||||||
constructor() {}
|
static path(spreadsheetID) {
|
||||||
|
return URLS.base_url + spreadsheetID + URLS.data_format;
|
||||||
// Singleton
|
|
||||||
static instance = null;
|
|
||||||
static createInstance() {
|
|
||||||
var object = new URLS();
|
|
||||||
return object;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
// This sets up urls
|
||||||
|
this.urls = {};
|
||||||
|
var self = this;
|
||||||
|
this.getSpreadsheet(URLS.path(URLS.base_spreadsheet), function(data) {
|
||||||
|
data.forEach(function(d) {
|
||||||
|
if (!self.urls[d.gsx$type.$t]) self.urls[d.gsx$type.$t] = {};
|
||||||
|
self.urls[d.gsx$type.$t][d.gsx$subtype.$t] = d.gsx$url.$t;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Singleton
|
||||||
|
instance = null;
|
||||||
static getInstance() {
|
static getInstance() {
|
||||||
if (!URLS.instance) {
|
if (!URLS.instance) { URLS.instance = new URLS(); }
|
||||||
URLS.instance = URLS.createInstance();
|
|
||||||
}
|
|
||||||
return URLS.instance;
|
return URLS.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,11 +43,8 @@ class URLS {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static path(spreadsheetID) {
|
|
||||||
return URLS.base_url + spreadsheetID + URLS.data_format;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Creatures */
|
/* Creatures */
|
||||||
|
/* TODO remove legacy getters when introducing state management*/
|
||||||
get Creatures_Card_Data() {
|
get Creatures_Card_Data() {
|
||||||
return URLS.path("1fUFYhG1NLLkSTzrdbevm6ZMKNP6xLiKUZvM1sY10pVI");
|
return URLS.path("1fUFYhG1NLLkSTzrdbevm6ZMKNP6xLiKUZvM1sY10pVI");
|
||||||
}
|
}
|
||||||
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||||
import Interactive from 'react-interactive';
|
import Interactive from 'react-interactive';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
import PageNotFound from '../../PageNotFound';
|
import PageNotFound from '../../PageNotFound';
|
||||||
import API from '../../Spreadsheet';
|
import API from '../../SpreadsheetData';
|
||||||
import s from '../../../styles/app.style';
|
import s from '../../../styles/app.style';
|
||||||
|
|
||||||
export default class Creatures extends React.Component {
|
export default class Creatures extends React.Component {
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import Interactive from 'react-interactive';
|
||||||
import { Link } from 'react-router';
|
import { Link } from 'react-router';
|
||||||
import UnderConstruction from '../../UnderConstruction';
|
import UnderConstruction from '../../UnderConstruction';
|
||||||
import PageNotFound from '../../PageNotFound';
|
import PageNotFound from '../../PageNotFound';
|
||||||
import API from '../../Spreadsheet';
|
import API from '../../SpreadsheetData';
|
||||||
import s from '../../../styles/app.style';
|
import s from '../../../styles/app.style';
|
||||||
|
|
||||||
export default class Mugic extends React.Component {
|
export default class Mugic extends React.Component {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import { Link } from 'react-router';
|
||||||
// import {browserHistory} from 'react-router';
|
// import {browserHistory} from 'react-router';
|
||||||
import PageNotFound from '../../PageNotFound';
|
import PageNotFound from '../../PageNotFound';
|
||||||
import UnderConstruction from '../../UnderConstruction';
|
import UnderConstruction from '../../UnderConstruction';
|
||||||
import API from '../../Spreadsheet';
|
import API from '../../SpreadsheetData';
|
||||||
import s from '../../../styles/app.style';
|
import s from '../../../styles/app.style';
|
||||||
|
|
||||||
export default class SingleCreature extends React.Component {
|
export default class SingleCreature extends React.Component {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user