From 0df921d035ba00042d1de6c63f2243c641498853 Mon Sep 17 00:00:00 2001 From: Zach Wise Date: Sun, 1 Apr 2012 23:19:38 -0500 Subject: [PATCH] Fix for IE problem loading from google docs thnx @mwidmann --- source/js/timeline.js | 17 +++++++++++++---- timeline.js | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/source/js/timeline.js b/source/js/timeline.js index 09b6844..3fbd18f 100755 --- a/source/js/timeline.js +++ b/source/js/timeline.js @@ -1971,12 +1971,21 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { type: "google spreadsheet", getData: function(raw_data) { - //https://spreadsheets.google.com/feeds/list/0Agl_Dv6iEbDadGRwZjJSRTR4RHJpanE2U3lkb0lyYUE/od6/public/values?alt=json - // https://docs.google.com/a/digitalartwork.net/spreadsheet/ccc?hl=en_US&key=0Agl_Dv6iEbDadGRwZjJSRTR4RHJpanE2U3lkb0lyYUE&rm=full#gid=0 var _key = VMM.Util.getUrlVars(raw_data)["key"]; var _url = "https://spreadsheets.google.com/feeds/list/" + _key + "/od6/public/values?alt=json"; - - VMM.getJSON(_url, VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData); + + if ( $.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) { + // Use Microsoft XDR + var xdr = new XDomainRequest(); + xdr.open("get", _url); + xdr.onload = function() { + var json = $.parseJSON( xdr.responseText ); + VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData( json ); + } + xdr.send(); + } else { + VMM.getJSON(_url, VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData); + } }, diff --git a/timeline.js b/timeline.js index a71a380..e6fbdb0 100644 --- a/timeline.js +++ b/timeline.js @@ -5450,12 +5450,21 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') { type: "google spreadsheet", getData: function(raw_data) { - //https://spreadsheets.google.com/feeds/list/0Agl_Dv6iEbDadGRwZjJSRTR4RHJpanE2U3lkb0lyYUE/od6/public/values?alt=json - // https://docs.google.com/a/digitalartwork.net/spreadsheet/ccc?hl=en_US&key=0Agl_Dv6iEbDadGRwZjJSRTR4RHJpanE2U3lkb0lyYUE&rm=full#gid=0 var _key = VMM.Util.getUrlVars(raw_data)["key"]; var _url = "https://spreadsheets.google.com/feeds/list/" + _key + "/od6/public/values?alt=json"; - - VMM.getJSON(_url, VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData); + + if ( $.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) { + // Use Microsoft XDR + var xdr = new XDomainRequest(); + xdr.open("get", _url); + xdr.onload = function() { + var json = $.parseJSON( xdr.responseText ); + VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData( json ); + } + xdr.send(); + } else { + VMM.getJSON(_url, VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData); + } },