|
|
@ -171,11 +171,24 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef |
|
|
|
model: { |
|
|
|
model: { |
|
|
|
|
|
|
|
|
|
|
|
googlespreadsheet: { |
|
|
|
googlespreadsheet: { |
|
|
|
|
|
|
|
extractSpreadsheetKey: function(url) { |
|
|
|
|
|
|
|
var key = VMM.Util.getUrlVars(url)["key"]; |
|
|
|
|
|
|
|
if (!key) { |
|
|
|
|
|
|
|
if (url.match("docs.google.com/spreadsheets/d/")) { |
|
|
|
|
|
|
|
var pos = url.indexOf("docs.google.com/spreadsheets/d/") + "docs.google.com/spreadsheets/d/".length; |
|
|
|
|
|
|
|
var tail = url.substr(pos); |
|
|
|
|
|
|
|
key = tail.split('/')[0] |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (!key) { key = url} |
|
|
|
|
|
|
|
return key; |
|
|
|
|
|
|
|
}, |
|
|
|
getData: function(raw) { |
|
|
|
getData: function(raw) { |
|
|
|
var getjsondata, key, worksheet, url, timeout, tries = 0; |
|
|
|
var getjsondata, key, worksheet, url, timeout, tries = 0; |
|
|
|
|
|
|
|
|
|
|
|
key = VMM.Util.getUrlVars(raw)["key"]; |
|
|
|
// new Google Docs URLs can specify 'key' differently.
|
|
|
|
|
|
|
|
// that format doesn't seem to have a way to specify a worksheet.
|
|
|
|
|
|
|
|
key = VMM.Timeline.DataObj.model.googlespreadsheet.extractSpreadsheetKey(raw); |
|
|
|
worksheet = VMM.Util.getUrlVars(raw)["worksheet"]; |
|
|
|
worksheet = VMM.Util.getUrlVars(raw)["worksheet"]; |
|
|
|
if (typeof worksheet == "undefined") worksheet = "od6"; |
|
|
|
if (typeof worksheet == "undefined") worksheet = "od6"; |
|
|
|
|
|
|
|
|
|
|
@ -297,7 +310,7 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef |
|
|
|
getDataCells: function(raw) { |
|
|
|
getDataCells: function(raw) { |
|
|
|
var getjsondata, key, url, timeout, tries = 0; |
|
|
|
var getjsondata, key, url, timeout, tries = 0; |
|
|
|
|
|
|
|
|
|
|
|
key = VMM.Util.getUrlVars(raw)["key"]; |
|
|
|
key = VMM.Timeline.DataObj.model.googlespreadsheet.extractSpreadsheetKey(raw); |
|
|
|
url = "https://spreadsheets.google.com/feeds/cells/" + key + "/od6/public/values?alt=json"; |
|
|
|
url = "https://spreadsheets.google.com/feeds/cells/" + key + "/od6/public/values?alt=json"; |
|
|
|
|
|
|
|
|
|
|
|
timeout = setTimeout(function() { |
|
|
|
timeout = setTimeout(function() { |
|
|
|