Update tabletop.js, supports new Sheets!

This commit is contained in:
Jessica Lord 2014-04-27 17:05:04 -07:00
parent 6d671375bc
commit a347e99d2d

View File

@ -96,9 +96,8 @@
} }
if(/pubhtml/.test(this.key)) { if(/pubhtml/.test(this.key)) {
alert("You passed a new Google Spreadsheets url as the key! This won't work yet, you'll need to change back to old Sheets."); this.log("You passed a new Google Spreadsheets url as the key! Attempting to parse.");
this.key = this.key.match("d\\/(.*?)\\/pubhtml")[1]; this.key = this.key.match("d\\/(.*?)\\/pubhtml")[1];
console.log(this.key);
} }
if(!this.key) { if(!this.key) {
@ -309,13 +308,17 @@
this.foundSheetNames.push(data.feed.entry[i].title.$t); this.foundSheetNames.push(data.feed.entry[i].title.$t);
// Only pull in desired sheets to reduce loading // Only pull in desired sheets to reduce loading
if( this.isWanted(data.feed.entry[i].content.$t) ) { if( this.isWanted(data.feed.entry[i].content.$t) ) {
var sheet_id = data.feed.entry[i].link[3].href.substr( data.feed.entry[i].link[3].href.length - 3, 3); var linkIdx = data.feed.entry[i].link.length-1;
var json_path = "/feeds/list/" + this.key + "/" + sheet_id + "/public/values?sq=" + this.query + '&alt=' var sheet_id = data.feed.entry[i].link[linkIdx].href.substr( data.feed.entry[i].link[linkIdx].href.length - 3, 3);
var json_path = "/feeds/list/" + this.key + "/" + sheet_id + "/public/values?alt="
if (inNodeJS || supportsCORS) { if (inNodeJS || supportsCORS) {
json_path += 'json'; json_path += 'json';
} else { } else {
json_path += 'json-in-script'; json_path += 'json-in-script';
} }
if(this.query) {
json_path += "&sq=" + this.query;
}
if(this.orderby) { if(this.orderby) {
json_path += "&orderby=column:" + this.orderby.toLowerCase(); json_path += "&orderby=column:" + this.orderby.toLowerCase();
} }