Browse Source

Fixed an issue with duplicate external JS files being able to load

pull/13/merge
Zach Wise 13 years ago
parent
commit
8322813792
  1. 12
      source/js/VMM.LoadLib.js
  2. 16
      source/js/VMM.js
  3. 2
      timeline-min.js
  4. 28
      timeline.js

12
source/js/VMM.LoadLib.js

@ -16,7 +16,7 @@
copies or substantial portions of the Software. copies or substantial portions of the Software.
================================================== */ ================================================== */
window.loadedJS = [];
if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') { if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') {
@ -36,22 +36,18 @@ if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') {
var loaded_Array = []; var loaded_Array = [];
function isLoaded(url) { function isLoaded(url) {
for(var i=0; i<loaded_Array.length; i++) {
var has_been_loaded = false; var has_been_loaded = false;
for(var i=0; i<loaded_Array.length; i++) {
if (loaded_Array[i] == url) { if (loaded_Array[i] == url) {
has_been_loaded = true; has_been_loaded = true;
} }
}
if (!has_been_loaded) { if (!has_been_loaded) {
loaded_Array.push(url); loaded_Array.push(url);
} }
return has_been_loaded; return has_been_loaded;
} }
}
function createNode(name, attrs) { function createNode(name, attrs) {
var node = doc.createElement(name), attr; var node = doc.createElement(name), attr;
@ -239,8 +235,10 @@ if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') {
js: function (urls, callback, obj, context) { js: function (urls, callback, obj, context) {
if (isLoaded(urls)) { if (isLoaded(urls)) {
console.log("already LOADED");
return callback; return callback;
} else { } else {
console.log("NOT LOADED");
load('js', urls, callback, obj, context); load('js', urls, callback, obj, context);
} }
} }

16
source/js/VMM.js

@ -97,19 +97,8 @@ if (typeof VMM == 'undefined') {
/* Master Config /* Master Config
================================================== */ ================================================== */
//VMM.master_config.youtube_array //VMM.master_config.youtube_array
VMM.master_config = ({ //VMM.master_config.loadedJS
init: function() {
return this;
},
youtube: {
active: false,
array: [],
api_loaded:false
},
}).init();
VMM.master_config = ({ VMM.master_config = ({
@ -1438,7 +1427,6 @@ if (typeof VMM == 'undefined') {
media.id = d; media.id = d;
success = true; success = true;
} else if (VMM.FileExtention.googleDocType(d)) { } else if (VMM.FileExtention.googleDocType(d)) {
trace("GOOGLE DOC " + d);
media.type = "googledoc"; media.type = "googledoc";
media.id = d; media.id = d;
success = true; success = true;
@ -1472,7 +1460,7 @@ if (typeof VMM == 'undefined') {
var flag = false; var flag = false;
for (var i = 0; i < validFileExtensions.length; i++) { for (var i = 0; i < validFileExtensions.length; i++) {
trace("TEST " + fileExtension);
if (fileExtension.toLowerCase().match(validFileExtensions[i].toString().toLowerCase()) || fileName.match("docs.google.com") ) { if (fileExtension.toLowerCase().match(validFileExtensions[i].toString().toLowerCase()) || fileName.match("docs.google.com") ) {
flag = true; flag = true;

2
timeline-min.js vendored

File diff suppressed because one or more lines are too long

28
timeline.js

@ -97,19 +97,8 @@ if (typeof VMM == 'undefined') {
/* Master Config /* Master Config
================================================== */ ================================================== */
//VMM.master_config.youtube_array //VMM.master_config.youtube_array
VMM.master_config = ({ //VMM.master_config.loadedJS
init: function() {
return this;
},
youtube: {
active: false,
array: [],
api_loaded:false
},
}).init();
VMM.master_config = ({ VMM.master_config = ({
@ -1438,7 +1427,6 @@ if (typeof VMM == 'undefined') {
media.id = d; media.id = d;
success = true; success = true;
} else if (VMM.FileExtention.googleDocType(d)) { } else if (VMM.FileExtention.googleDocType(d)) {
trace("GOOGLE DOC " + d);
media.type = "googledoc"; media.type = "googledoc";
media.id = d; media.id = d;
success = true; success = true;
@ -1472,7 +1460,7 @@ if (typeof VMM == 'undefined') {
var flag = false; var flag = false;
for (var i = 0; i < validFileExtensions.length; i++) { for (var i = 0; i < validFileExtensions.length; i++) {
trace("TEST " + fileExtension);
if (fileExtension.toLowerCase().match(validFileExtensions[i].toString().toLowerCase()) || fileName.match("docs.google.com") ) { if (fileExtension.toLowerCase().match(validFileExtensions[i].toString().toLowerCase()) || fileName.match("docs.google.com") ) {
flag = true; flag = true;
@ -3225,7 +3213,7 @@ if(typeof VMM != 'undefined' && typeof VMM.Util == 'undefined') {
copies or substantial portions of the Software. copies or substantial portions of the Software.
================================================== */ ================================================== */
window.loadedJS = [];
if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') { if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') {
@ -3245,22 +3233,18 @@ if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') {
var loaded_Array = []; var loaded_Array = [];
function isLoaded(url) { function isLoaded(url) {
for(var i=0; i<loaded_Array.length; i++) {
var has_been_loaded = false; var has_been_loaded = false;
for(var i=0; i<loaded_Array.length; i++) {
if (loaded_Array[i] == url) { if (loaded_Array[i] == url) {
has_been_loaded = true; has_been_loaded = true;
} }
}
if (!has_been_loaded) { if (!has_been_loaded) {
loaded_Array.push(url); loaded_Array.push(url);
} }
return has_been_loaded; return has_been_loaded;
} }
}
function createNode(name, attrs) { function createNode(name, attrs) {
var node = doc.createElement(name), attr; var node = doc.createElement(name), attr;
@ -3448,8 +3432,10 @@ if(typeof VMM != 'undefined' && typeof VMM.LoadLib == 'undefined') {
js: function (urls, callback, obj, context) { js: function (urls, callback, obj, context) {
if (isLoaded(urls)) { if (isLoaded(urls)) {
console.log("already LOADED");
return callback; return callback;
} else { } else {
console.log("NOT LOADED");
load('js', urls, callback, obj, context); load('js', urls, callback, obj, context);
} }
} }

Loading…
Cancel
Save