Index: README =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/jtooltips/README,v retrieving revision 1.1.4.6 diff -u -r1.1.4.6 README --- README 22 Sep 2007 13:08:34 -0000 1.1.4.6 +++ README 14 Nov 2007 20:04:44 -0000 @@ -11,23 +11,34 @@ **WHAT THE MODULE IS -This plugin enhances the default tooltips. -You can style them via stylesheets and improve their behaviour. -The tooltip is shown at the mouse position and moves if there isn’t enough space. +This plugin enhances the default tooltips. +You can style them via stylesheets and improve their behavior. +The tooltip is shown at the mouse position and moves if there isn't enough space. **INSTALL INSTRUCTIONS -1. go to the modules page under the admin link. -2. enable the module -3. optionally configure the module under /admin/settings/jtooltips +1. Enable the module at -**ENABLE Tooltip for JQuery or SweetTitles + Adminster > Site building > Modules > Other -it's simple to enable tooltip for jquery. Default behavior is using jQuery tooltips. +2. Optional: install sweetTitles -using SweetTitles: you need to enable it at admin/settings/jtooltips, selecting "sweettitles" from the dropdown menu. -You should download the script pack from the official page and put it in the /js folder in modules/jtooltips -or sites/all/modules/jtooltips (depends on where the jtooltips module folder is). + - Download sweetTitles from: http://www.dustindiaz.com/sweet-titles-finalized + + - Copy addEvent.js and sweetTitles.js from the sweetTitles distribution + to the js directory of jTooltips. + +3. Optional: configure jTooltips at + + Administer > Site configuration > jQuery tooltips + +**ENABLE tooltip for jQuery or sweetTitles + +It's simple to enable tooltip for jQuery. Default behavior is using jQuery tooltips. + +Using SweetTitles: you need to enable it at admin/settings/jtooltips, selecting "sweetTitles" from the dropdown menu. +You should download the script pack from the official page and put it in the /js folder in modules/jtooltips +or sites/all/modules/jtooltips (depends on where the jTooltips module folder is). **WHERE DOWNLOADING SCRIPTS and getting Information @@ -39,14 +50,15 @@ **STYLING TOOLTIPS -to style tooltips, you should modify css in the module folder. (jtooltips.css for jQuery tooltips, sweettitles.css for SweetTitles) +To style tooltips, you should modify css in the module folder. (jtooltips.css for jQuery tooltips, sweetTitles.css for sweetTitles) **APPLY CUSTOM BEHAVIOR to Jquery Tooltips -in the settings page for this module (/admin/settings/jtooltips), if you select jQuery tooltips, you will find a textarea with a script. inside. You -you are able to modify the jquery tooltips behavior, adding or modifying some lines in. +In the settings page for this module (admin/settings/jtooltips), if you select +jQuery tooltips, you will find a textarea with a script inside. The textarea +can be modified to change the function of the jQuery tooltips. -Some examples could in this page +Some examples are listed in this page: http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/ There are some available options: @@ -54,8 +66,8 @@ * event (String): The event on which the tooltip is displayed, default is “mouseover”, “click” works fine, too * track (Boolean): If true, let the tooltip track the mousemovement, default is false * showURL (Boolean): If true, shows the href or src attribute within p.url, default is true - * showBody (String): If specified, uses the String to split the title, displaying the first part in the h3 tag, all following in the p.body tag, separated with - s, default is null + * showBody (String): If specified, uses the string to split the title, displaying the first + part in the h3 tag, all following in the p.body tag, default is null * extraClass (String): If specified, adds the class to the tooltip helper, default is null * fixPNG (Boolean): If true, fixes transparent PNGs in IE, default is false @@ -75,7 +87,7 @@ showURL: true, showBody: "; " }); - }); -} + }); +} Index: jtooltips.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/jtooltips/jtooltips.info,v retrieving revision 1.1.2.4 diff -u -r1.1.2.4 jtooltips.info --- jtooltips.info 18 Jun 2007 23:06:48 -0000 1.1.2.4 +++ jtooltips.info 14 Nov 2007 20:04:44 -0000 @@ -1,6 +1,4 @@ ; $Id: jtooltips.info,v 1.1.2.4 2007/06/18 23:06:48 dww Exp $ name = jtooltips -description = Tooltips with JQuery - -; Information added by drupal.org packaging script on 2007-03-14 - +description = Add tooltips to links using JQuery +core = 6.x Index: jtooltips.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/jtooltips/jtooltips.module,v retrieving revision 1.1.2.6 diff -u -r1.1.2.6 jtooltips.module --- jtooltips.module 22 Sep 2007 12:22:52 -0000 1.1.2.6 +++ jtooltips.module 14 Nov 2007 20:04:45 -0000 @@ -2,7 +2,7 @@ // $Id: jtooltips.module,v 1.1.2.6 2007/09/22 12:22:52 psicomante Exp $ /** - * @file + * @file * Configurable javascript tooltips over jQuery/SweetTitles * * Adds a tooltip (by default over tags), built over jQuery or SweetTitles. The code is configurable is using jQuery Tooltips. @@ -11,24 +11,26 @@ * @author Sweettitles - http://www.dustindiaz.com/sweet-titles-finalized */ +define('JQUERY_TOOLTIP', 1); +define('SWEETTITLES_TOOLTIP', 0); /** -* Valid permissions for this module -* @return array An array of valid permissions for the onthisdate module -*/ -function jtooltips_perm() { - return array('access jTooltips'); -} // function tlc_perm() - -/** - * Help hook for the module - * @params $section Drupal URL path (or: menu item) the help is being requested for, e.g. admin/node or user/edit. Recognizes special descriptors after a "#" sign. - * @return A localized string containing the help text. + * Adds CSS and JS to the top of pages. */ -function jtooltips_help($section) { - switch($section) { - case "admin/modules#jtooltips": - return t('Display a tooltip over links, themable with CSS

You can use Jquery tooltips or Sweettitles.
Jquery Tooltips: uses Jquery framework, supports configuration script but not supports fading in/out
Sweettitles: uses an internal library, supports fading, less customizable

'); +function jtooltips_init() { + if (arg(0) != 'admin' && arg(0) != 'img_assist' && arg(1) != 'add' && arg(2) != 'edit') { + $jtooltips_path = drupal_get_path('module', 'jtooltips'); + + if (variable_get('jtooltips_jstiptype', JQUERY_TOOLTIP)) { + drupal_add_css($jtooltips_path .'/jtooltips.css'); + drupal_add_js($jtooltips_path .'/js/jquery.tooltip.pack.js'); + drupal_add_js(_jtooltips_get_javascript(), 'inline', 'footer'); + } + else { + drupal_add_css($jtooltips_path .'/sweettitles.css'); + drupal_add_js($jtooltips_path .'/js/addEvent.js'); + drupal_add_js($jtooltips_path .'/js/sweettitles.js'); + } } } @@ -37,34 +39,17 @@ * @params $may_cache A boolean indicating whether cacheable menu items should be returned. * @return An array of menu items. */ - -function jtooltips_menu($may_cache) { +function jtooltips_menu() { $items = array(); - if ($may_cache){ - $items[] = array ( - 'path' => 'admin/settings/jtooltips', - 'title' => t('JQuery tooltips'), - 'description' => t('Show tooltips over links and other components. it supports Jquery tooltips and sweettitles'), - 'callback' => 'drupal_get_form', - 'callback arguments' => 'jtooltips_admin', - 'access' => user_access('access administration pages'), - 'type' => MENU_NORMAL_ITEM, - ); - } - else if (arg(0) != 'admin' && arg(0) != 'img_assist' && arg(1) != 'add' && arg(2) != 'edit') { - if (variable_get('jtooltips_jstiptype',1)) { - $css = drupal_get_path('module','jtooltips') .'/jtooltips.css'; - drupal_add_css($css); - drupal_add_js(drupal_get_path('module', 'jtooltips') . '/js/jquery.tooltip.pack.js'); - drupal_add_js(_jtooltips_get_javascript(), 'inline', 'footer'); - } - else { - $stylesheet = drupal_get_path('module','jtooltips') .'/sweettitles.css'; - drupal_add_css($stylesheet); - drupal_add_js(drupal_get_path('module', 'jtooltips') . '/js/addEvent.js'); - drupal_add_js(drupal_get_path('module', 'jtooltips') . '/js/sweettitles.js'); - } - } + $items['admin/settings/jtooltips'] = array ( + 'title' => 'JQuery tooltips', + 'description' => 'Show tooltips over links and other components. it supports Jquery tooltips and sweettitles', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('jtooltips_admin_settings'), + 'access callback' => 'user_access', + 'access arguments' => array('access administration pages'), + 'type' => MENU_NORMAL_ITEM, + ); return $items; } @@ -74,32 +59,43 @@ * @returns An array of form items, presented in the classic hook_form. */ -function jtooltips_admin(){ - $form=array(); - _jtooltips_get_banner($form); +function jtooltips_admin_settings(){ + $form = array(); $form['jtooltips_form'] = array( '#type' => 'fieldset', - '#collapsible' => TRUE, - '#collapsed' => FALSE, + '#collapsible' => false, + '#collapsed' => false, '#title' => t('jTooltips Configuration') ); + + $options = array(JQUERY_TOOLTIP => t('jQuery Tooltip')); + + $jtooltips_path = drupal_get_path('module', 'jtooltips') .'/js/'; + if (file_exists($jtooltips_path .'addEvent.js') && file_exists($jtooltips_path .'sweettitles.js')) { + $options += array(SWEETTITLES_TOOLTIP => t('sweetTitles')); + } + unset($jtooltips_path); + $form['jtooltips_form']['jtooltips_jstiptype'] = array( - '#type' => 'select', - '#title' => t('Tooltip type you can select'), + '#type' => 'radios', + '#title' => t('Tooltip type'), '#default_value' => variable_get('jtooltips_jstiptype', 1), - '#options' => array( - 1 => t('Use jQuery Tooltip'), - 0 => t('Use sweetTitles') - ), - '#description' => t("jQuery Tooltip: builded around jQuery, more versatile, but not supports fading
sweetTitles: uses a internal engine and supports fading. ") + '#options' => $options, + '#description' => t('jQuery Tooltip: builded around jQuery, more versatile, but does not support fading
sweetTitles: uses a internal engine and supports fading') ); - if (variable_get('jtooltips_jstiptype', 1)){ - $form['jtooltips_form']['jtooltips_javascript'] = - array('#type' => 'textarea', - '#title' => t('Javascript to initialize jquery tooltips'), - '#description' => t('The script here will be included in every page.'), - '#default_value' => _jtooltips_get_javascript(), + if (variable_get('jtooltips_jstiptype', JQUERY_TOOLTIP)) { + $form['jtooltips_form']['advanced'] = array( + '#type' => 'fieldset', + '#title' => t('Advanced jQuery tooltip configuration'), + '#collapsible' => true, + '#collapsed' => true + ); + $form['jtooltips_form']['advanced']['jtooltips_javascript'] = array( + '#type' => 'textarea', + '#title' => t('Javascript to initialize jquery tooltips'), + '#description' => t('The script here will be included in every page.'), + '#default_value' => _jtooltips_get_javascript(), ); } return system_settings_form($form); @@ -119,20 +115,9 @@ showURL: false, showBody: "; " }); - }); -} + }); +} END; return variable_get('jtooltips_javascript', $default); - } - -/** - * Get settings 'banner' - */ -function _jtooltips_get_banner(&$form) { - $name = 'jtooltips-d5'; - $d = 'Your donations support ongoing development'; - $form['module_banner'] = array('#type' => 'markup', - '#value' => '
' . $d . '
Module development by Psicomante
'); - $form['module_id'] = array('#type' => 'markup', '#value' => '1.0' . '
'); }