--- wysiwyg.module 2009-09-21 23:13:43.000000000 +0200 +++ wysiwyg1.module 2009-09-21 23:12:54.000000000 +0200 @@ -136,7 +136,7 @@ // for each input format. $extra_class = ' wysiwyg-resizable-1'; $field['#resizable'] = FALSE; - drupal_add_js('misc/textarea.js'); + myDrupal_add_js('misc/textarea.js'); } // Determine the available input formats. The last child element is a @@ -255,10 +255,10 @@ foreach ($files as $file => $options) { if (is_array($options)) { $options += array('type' => 'module', 'scope' => 'header', 'defer' => FALSE, 'cache' => TRUE, 'preprocess' => TRUE); - drupal_add_js($editor['library path'] . '/' . $file, $options['type'], $options['scope'], $options['defer'], $options['cache'], $options['preprocess']); + myDrupal_add_js($editor['library path'] . '/' . $file, $options['type'], $options['scope'], $options['defer'], $options['cache'], $options['preprocess']); } else { - drupal_add_js($editor['library path'] . '/' . $options); + myDrupal_add_js($editor['library path'] . '/' . $options); } } // If editor defines an additional load callback, invoke it. @@ -272,7 +272,7 @@ $files = $editor['js files']; } foreach ($files as $file) { - drupal_add_js($editor['js path'] . '/' . $file); + myDrupal_add_js($editor['js path'] . '/' . $file); } // Load CSS stylesheets for this editor. $files = array(); @@ -283,7 +283,7 @@ drupal_add_css($editor['css path'] . '/' . $file); } - drupal_add_js(array('wysiwyg' => array( + myDrupal_add_js(array('wysiwyg' => array( 'configs' => array($editor['name'] => array()), // @todo Move into (global) editor settings. // If JS compression is enabled, at least TinyMCE is unable to determine @@ -301,7 +301,7 @@ // Add basic Wysiwyg settings if any editor has been added. if (!isset($settings_added) && $loaded[$name]) { - drupal_add_js(array('wysiwyg' => array( + myDrupal_add_js(array('wysiwyg' => array( 'configs' => array(), 'disable' => t('Disable rich-text'), 'enable' => t('Enable rich-text'), @@ -310,11 +310,11 @@ $path = drupal_get_path('module', 'wysiwyg'); // Initialize our namespaces in the *header* to do not force editor // integration scripts to check and define Drupal.wysiwyg on its own. - drupal_add_js($path . '/wysiwyg.init.js', 'core'); + myDrupal_add_js($path . '/wysiwyg.init.js', 'core'); // The 'none' editor is a special editor implementation, allowing us to // attach and detach regular Drupal behaviors just like any other editor. - drupal_add_js($path . '/editors/js/none.js'); + myDrupal_add_js($path . '/editors/js/none.js'); // Add wysiwyg.js to the footer to ensure it's executed after the // Drupal.settings array has been rendered and populated. Also, since editor @@ -322,7 +322,7 @@ // and Drupal.wysiwygInit() must be executed AFTER editors registered // their callbacks and BEFORE Drupal.behaviors are applied, this must come // last. - drupal_add_js($path . '/wysiwyg.js', 'module', 'footer'); + myDrupal_add_js($path . '/wysiwyg.js', 'module', 'footer'); $settings_added = TRUE; } @@ -340,7 +340,7 @@ $config = wysiwyg_get_editor_config($profile, $theme); // drupal_to_js() does not properly convert numeric array keys, so we need // to use a string instead of the format id. - drupal_add_js(array('wysiwyg' => array('configs' => array($profile->editor => array('format' . $profile->format => $config)))), 'setting'); + myDrupal_add_js(array('wysiwyg' => array('configs' => array($profile->editor => array('format' . $profile->format => $config)))), 'setting'); $formats[$profile->format] = TRUE; } } @@ -415,7 +415,7 @@ // settings for native external plugins with required values. $settings_native = call_user_func($editor['plugin settings callback'], $editor, $profile, $profile_plugins_native); - drupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('native' => $settings_native)))), 'setting'); + myDrupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('native' => $settings_native)))), 'setting'); } // Process Drupal plugins. @@ -429,10 +429,10 @@ if (!isset($processed_plugins[$proxy][$plugin])) { $profile_plugins_drupal[$plugin] = $processed_plugins[$proxy][$plugin] = $meta; // Load the Drupal plugin's JavaScript. - drupal_add_js($meta['js path'] . '/' . $meta['js file']); + myDrupal_add_js($meta['js path'] . '/' . $meta['js file']); // Add plugin-specific settings. if (isset($meta['settings'])) { - drupal_add_js(array('wysiwyg' => array('plugins' => array('drupal' => array($plugin => $meta['settings'])))), 'setting'); + myDrupal_add_js(array('wysiwyg' => array('plugins' => array('drupal' => array($plugin => $meta['settings'])))), 'setting'); } } else { @@ -444,7 +444,7 @@ // the settings for Drupal plugins with custom, required values. $settings_drupal = call_user_func($editor['proxy plugin settings callback'], $editor, $profile, $profile_plugins_drupal); - drupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('drupal' => $settings_drupal)))), 'setting'); + myDrupal_add_js(array('wysiwyg' => array('plugins' => array('format' . $profile->format => array('drupal' => $settings_drupal)))), 'setting'); } } @@ -950,6 +950,14 @@ return $result; } +function myDrupal_add_js($path, $type, $scope, $defer, $cache, $preprocess) { + if(!$type) $type = 'module'; + if(!$scope) $scope = 'header'; + if(!$defer) $defer = FALSE; + if(!$cache) $cache = TRUE; + drupal_add_js($path, $type, $scope, $defer, $cache, FALSE); +} + /** * @} End of "defgroup wysiwyg_api". */