Or rather getting a premade solution to work with drupal...

Sorry guys, I'm rather new to the whole drupal thing and I'm having trouble getting a piece of javascript working. I'll try and be as precise with my problem as possible but im again rather new to anything 'javascripty'.

The Source Code

Heres the link explaining what I would like to do:
http://www.brandspankingnew.net/archive/2005/08/adding_an_os_x.html

If you scroll down to the comments there is an updated version of the script which validates XHTML 1.0 Strict which is the version im using so the link to the source files im using is:
http://zooley.net/downloads/searchbox.zip

What I've been able to do so far

Now I think I've been able to come half way to getting the script working as using the regular <script> link wont load the Javascript in Drupal so one has to use this link: <script src="<?php print base_path().path_to_theme().'/'; ?>includes/applesearch.js" type="text/javascript"></script> (I can tell the script is now working through drupal as it now displays the words search inside the form which is a plus

There are four main files

  • includes/dummy.css
  • includes/default.css
  • includes/applesearch.css
  • includes/applesearch.js

and then just the three images to be used in the /images folder

The Problem

Now if you look at the actual javascript that does all the magic 'applesearch.js' there is a link to 'applesearch.css' which includes all of the images (which to my untrained eye seem to be the only things not working. I cannot seem to figure out how to get it to read the css file (if thats even the problem)(remember the link to the css file is in the applesearch.js file). I should point out that when i run the provided index.html file everything works fine, so drupal must be doing something to mess it up.

Can anyone out there with a little drupal or javascript knowledge help me out here... this is just killing me.

The header in my page.tpl.php file

Just in case you need to see it:

<link rel="stylesheet" href="<?php print base_path() . path_to_theme() ?>/includes/default.css" id="default" media="screen" />
    <link rel="stylesheet" href="<?php print base_path() . path_to_theme() ?>/includes/dummy.css" id="dummy_css" media="screen" />    
	<script src="<?php print base_path().path_to_theme().'/'; ?>includes/applesearch.js" type="text/javascript"></script>

Thanks for any and all help, hope to hear back soon;
Paul

Comments

Christefano-oldaccount’s picture

That's a lot of work you've done. Have you tried the Safari Search module? There's a patch in the issue queue that makes it work with other browsers.

mitchepa’s picture

Hey thanks alot christefano, I hadn't actually found that solution... If I can get it to work it looks pretty awesome.

This may sound like a newbie question but I have looked at the page with the patch on it http://drupal.org/node/127770 but it just seems to be one file with a .patch extension and a few files listed in the comments, I have no idea how to actually go about installing the patch to work, any way you could help me understand how to do that? I feel I'm so close to finally get this working, thanks once again for the link.

Hope to hear back soon
Paul