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. 27
      source/js/timeline.js
  4. 34
      timeline.js

4
examples/embed.html

@ -21,8 +21,8 @@
width: 900, width: 900,
height: 700, height: 700,
source: 'https://docs.google.com/a/digitalartwork.net/spreadsheet/ccc?hl=en_US&key=0Agl_Dv6iEbDadGRwZjJSRTR4RHJpanE2U3lkb0lyYUE&rm=full#gid=0', 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', css: '../timeline.css',
js: 'http://veritetimeline.appspot.com/latest/timeline-min.js' js: '../timeline.js'
} }
</script> </script>
<script type="text/javascript" src="../timeline-embed.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); $.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 // ADD ELEMENT AND RETURN IT
// VMM.appendAndGetElement(append_to_element, tag, cName, content, [attrib]); // VMM.appendAndGetElement(append_to_element, tag, cName, content, [attrib]);
VMM.appendAndGetElement = function(append_to_element, tag, cName, content) { VMM.appendAndGetElement = function(append_to_element, tag, cName, content) {

27
source/js/timeline.js

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

34
timeline.js

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

Loading…
Cancel
Save