Browse Source

Still fixing the IE json issue

pull/20/merge
Zach Wise 13 years ago
parent
commit
94c2b21310
  1. 4
      examples/embed.html
  2. 7
      source/js/VMM.js
  3. 29
      source/js/timeline.js
  4. 36
      timeline.js

4
examples/embed.html

@ -21,8 +21,8 @@
width: 900,
height: 700,
source: 'https://docs.google.com/a/digitalartwork.net/spreadsheet/ccc?hl=en_US&key=0Agl_Dv6iEbDadGRwZjJSRTR4RHJpanE2U3lkb0lyYUE&rm=full#gid=0',
css: 'http://veritetimeline.appspot.com/latest/timeline.css',
js: 'http://veritetimeline.appspot.com/latest/timeline-min.js'
css: '../timeline.css',
js: '../timeline.js'
}
</script>
<script type="text/javascript" src="../timeline-embed.js"></script>

7
source/js/VMM.js

@ -347,7 +347,12 @@ if (typeof VMM == 'undefined') {
$.getJSON(url, the_function);
}
}
// VMM.parseJSON(the_json);
VMM.parseJSON = function(the_json) {
if( typeof( jQuery ) != 'undefined' ){
return $.parseJSON(the_json);
}
}
// ADD ELEMENT AND RETURN IT
// VMM.appendAndGetElement(append_to_element, tag, cName, content, [attrib]);
VMM.appendAndGetElement = function(append_to_element, tag, cName, content) {

29
source/js/timeline.js

@ -119,12 +119,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* CHECK FOR IE7
================================================== */
var ie7 = false;
if ( $.browser.msie ) {
if ( parseInt($.browser.version, 10) == 7) {
if (VMM.Browser.browser == "MSIE") {
if ( parseInt(VMM.Browser.version, 10) == 7) {
ie7 = true;
}
}
/* VER
@ -1973,17 +1973,24 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
getData: function(raw_data) {
var _key = VMM.Util.getUrlVars(raw_data)["key"];
var _url = "https://spreadsheets.google.com/feeds/list/" + _key + "/od6/public/values?alt=json";
if ( $.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
if ( VMM.Browser.browser == "Explorer" && parseInt(VMM.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 );
// going to move this to VMM.getJSON
trace("it's ie");
var ie_xdr = new XDomainRequest();
var _url = "//spreadsheets.google.com/feeds/list/" + _key + "/od6/public/values?alt=json";
ie_xdr.open("get", _url);
ie_xdr.onload = function() {
var ie_j = {};
var ie_json = VMM.parseJSON(ie_xdr.responseText);
VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData(ie_json);
}
xdr.send();
ie_xdr.send();
} else {
trace("not ie");
VMM.getJSON(_url, VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData);
}

36
timeline.js

@ -347,7 +347,12 @@ if (typeof VMM == 'undefined') {
$.getJSON(url, the_function);
}
}
// VMM.parseJSON(the_json);
VMM.parseJSON = function(the_json) {
if( typeof( jQuery ) != 'undefined' ){
return $.parseJSON(the_json);
}
}
// ADD ELEMENT AND RETURN IT
// VMM.appendAndGetElement(append_to_element, tag, cName, content, [attrib]);
VMM.appendAndGetElement = function(append_to_element, tag, cName, content) {
@ -3598,12 +3603,12 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
/* CHECK FOR IE7
================================================== */
var ie7 = false;
if ( $.browser.msie ) {
if ( parseInt($.browser.version, 10) == 7) {
if (VMM.Browser.browser == "MSIE") {
if ( parseInt(VMM.Browser.version, 10) == 7) {
ie7 = true;
}
}
/* VER
@ -5452,17 +5457,24 @@ if(typeof VMM != 'undefined' && typeof VMM.Timeline == 'undefined') {
getData: function(raw_data) {
var _key = VMM.Util.getUrlVars(raw_data)["key"];
var _url = "https://spreadsheets.google.com/feeds/list/" + _key + "/od6/public/values?alt=json";
if ( $.browser.msie && parseInt($.browser.version, 10) >= 8 && window.XDomainRequest) {
if ( VMM.Browser.browser == "Explorer" && parseInt(VMM.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 );
// going to move this to VMM.getJSON
trace("it's ie");
var ie_xdr = new XDomainRequest();
var _url = "//spreadsheets.google.com/feeds/list/" + _key + "/od6/public/values?alt=json";
ie_xdr.open("get", _url);
ie_xdr.onload = function() {
var ie_j = {};
var ie_json = VMM.parseJSON(ie_xdr.responseText);
VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData(ie_json);
}
xdr.send();
ie_xdr.send();
} else {
trace("not ie");
VMM.getJSON(_url, VMM.Timeline.DataObj.model_GoogleSpreadsheet.buildData);
}

Loading…
Cancel
Save