attached patch makes the ajax spellcheck module work with Drupal 4.7. it should fix http://drupal.org/node/57084, http://drupal.org/node/49195, and http://drupal.org/node/70237. please test, review, and apply. thanks!

[technical details: problem with the current version is that spellcheck.js tries to get Drupals base url from the documents <base> tag (document.getElementsByTagName('base')[0].href). in Drupal 4.7, there is no <base> anymore. instead, this patch passes the ajax spellcheck endpoint (http://my.site.com/spellcheck, http://my.site.com/index.php?q=spellcheck, or similar) to spellcheck.js via the javascript variable ajax_spellcheck_path (using url(), so it works with both clean and plain urls).]

CommentFileSizeAuthor
ajax_spellcheck.patch1.44 KBax
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Thox’s picture

This probably works but I believe it is the wrong way to go around this problem. The real solution is to provide the various javascript access to a base_url-like variable. Otherwise every script will be dumping out even more junk HTML / JavaScript which shouldn't be needed.

In fact, I'd personally add the <base> tag back in, although I don't know the reasons why it was removed.

ax’s picture

> In fact, I'd personally add the <base> tag back in, although I don't
> know the reasons why it was removed.

http://drupal.org/node/13148

> This probably works but I believe it is the wrong way to go around
> this problem. The real solution is to provide the various javascript
> access to a base_url-like variable. Otherwise every script will be
> dumping out even more junk HTML / JavaScript which shouldn't be
> needed

+1 (for a way to pass variables from Drupal to the current document, outputted in a single <script>. probably a hook like drupal_add_js() (which should actually be drupal_add_js_file()) which collects variables passed from modules and outputs them all at once at the end)

don't have resources for this myself, though :(. anyone?

ax’s picture

see http://drupal.org/node/76637 (Streamline JavaScript addition and add settings storage) :

As more JavaScript enabled modules are available, it's quite a problem to not get collisions between their configuration variables. This patch provides a centralized place where modules can put their settings that are required for the current page by putting them in the global (JavaScript) variable Drupal.

This patch also cleans up the act of adding a JavaScript file to the page by exposing the HTML code in a theme function for easy manipulation.