function bookmark_us_block_code() {
  global $base_url;
  $path = drupal_get_path('module', 'bookmark_us');	
  $bmarkus_stitle = variable_get('bookmark_us_site', t('Bookmark Website'));
  $bmarkus_ptitle = variable_get('bookmark_us_page', t('Bookmark Page'));
  $bmarkus_icons = variable_get('bookmark_us_icons', 1);
  $sitename = variable_get('site_name', 'drupal');
  $slogan = variable_get('site_slogan', '');
  $pagetitle = strip_tags(drupal_get_title());
  $head_title = $pagetitle ? $pagetitle . ' | ' . $sitename : $sitename;

  $output = '';
  $output .= drupal_add_js($path . '/bookmark_us.js');
  if($bmarkus_icons) $output .= '<img src="' . $base_url. "/". $path . '/bookmark_site.gif" alt="' . $bmarkus_stitle . '" align="absmiddle" />';
  $output .= '&nbsp;';
  $output .= '<script type="text/javascript"> displayLink("1","' . $base_url . '","' . $sitename . '","' . $bmarkus_stitle . '"); </script>';
  $output .= '<br />';
  if($bmarkus_icons) $output .= '<img src="' . $base_url. "/". $path . '/bookmark_page.gif" alt="' . $bmarkus_ptitle . '" align="absmiddle" />';
  $output .= '&nbsp;';
  $output .= '<script type="text/javascript"> displayLink("3","","' . $head_title . '","' . $bmarkus_ptitle . '"); </script>';
return $output;

line $output .= drupal_add_js($path . '/bookmark_us.js'); won't do anything because it is called after drupal call to drupal_get_html_head and thus no additional scripts are put into html header.
this needs fixing but i have no idea where drupal_add_js($path . '/bookmark_us.js') should be to assure outputing bookmark_us.js script tag to the browser.

Comments

Gurpartap Singh’s picture

But the module seems to work fine most where. Can you be yor configuration/changes specific?

siliconmind’s picture

Title: Bookmark us wont work because bookmark_us.js is not loaded » Re: Updates

i have no idea why this is happening. i've installed bookmark_us on clean install of drupal 4.7.4. the line i mentioned, with call to drupal_add_js has no effect and the bookmark_us.js script is never added to the page head.

Gurpartap Singh’s picture

Please reopen is necessary. Seems to work fine.

Gurpartap Singh’s picture

Status: Active » Closed (fixed)