changeset 36:7ed2ac0cec27

Correctly handle the library settings being added more than one time on a page
author Franck Deroche <franck@defr.org>
date Fri, 18 Sep 2009 15:12:46 +0200
parents abc9d39cfbe9
children bb510db429c9
files js/dnd-library.js
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/js/dnd-library.js	Fri Sep 18 15:11:03 2009 +0200
+++ b/js/dnd-library.js	Fri Sep 18 15:12:46 2009 +0200
@@ -74,6 +74,12 @@
     // Set up empty objects to keep track of things
     Drupal.settings.dndEditorRepresentations = {};
     Drupal.settings.dndLibraryPreviews = {};
+    
+    // Clean up the url if needed (this happen in case drupal_add_js is called
+    // multiple time for the page)
+    if (settings.url instanceof Object) {
+      settings.url = settings.url[0];
+    }
 
     // Initialize the library
     $.getJSON(Drupal.settings.basePath + settings.url, function(data) {