From a347e99d2d1dc0903cdd84b3ec51d5f02b931eb0 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Sun, 27 Apr 2014 17:05:04 -0700 Subject: [PATCH] Update tabletop.js, supports new Sheets! --- js/tabletop.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/tabletop.js b/js/tabletop.js index e4562f5..0ec6677 100644 --- a/js/tabletop.js +++ b/js/tabletop.js @@ -96,9 +96,8 @@ } 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]; - console.log(this.key); } if(!this.key) { @@ -309,13 +308,17 @@ this.foundSheetNames.push(data.feed.entry[i].title.$t); // Only pull in desired sheets to reduce loading 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 json_path = "/feeds/list/" + this.key + "/" + sheet_id + "/public/values?sq=" + this.query + '&alt=' + var linkIdx = data.feed.entry[i].link.length-1; + 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) { json_path += 'json'; } else { json_path += 'json-in-script'; } + if(this.query) { + json_path += "&sq=" + this.query; + } if(this.orderby) { json_path += "&orderby=column:" + this.orderby.toLowerCase(); }