diff --git a/extlink.js b/extlink.js index 2fa46bf..609957b 100644 --- a/extlink.js +++ b/extlink.js @@ -85,7 +85,13 @@ function extlinkAttach(context) { $(external_links).not('[img]').addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after(''); }); } else { - $(external_links).not($(external_links).find('img').parents('a')).addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after(''); }); + if (Drupal.settings.extlink.extImgClass) { + // Apply the "ext" class to all links, not just images. + $(external_links).addClass(Drupal.settings.extlink.extClass); + } + else { + $(external_links).not($(external_links).find('img').parents('a')).addClass(Drupal.settings.extlink.extClass).each(function() { if ($(this).css('display') == 'inline') $(this).after(''); }); + } } } diff --git a/extlink.module b/extlink.module index 650920d..fc38255 100644 --- a/extlink.module +++ b/extlink.module @@ -25,6 +25,7 @@ function extlink_page_build() { 'extTarget' => variable_get('extlink_target', 0), 'extTargetValue'=> variable_get('extlink_target_value', ''), 'extClass' => variable_get('extlink_class', 'ext'), + 'extImgClass' => variable_get('extlink_img_class', FALSE), 'extSubdomains' => variable_get('extlink_subdomains', 1), 'extExclude' => variable_get('extlink_exclude', ''), 'extInclude' => variable_get('extlink_include', ''), @@ -55,6 +56,14 @@ function extlink_admin_settings() { '#description' => t('Places an !icon icon next to mailto links.', array('!icon' => theme('image',array('path' => drupal_get_path('module', 'extlink') . '/mailto.png', 'alt' => t('Email links icon'))))), ); + $form['extlink_img_class'] = array( + '#type' => 'checkbox', + '#title' => t('Imagelinks should be external links'), + '#return_value' => TRUE, + '#default_value' => variable_get('extlink_img_class', FALSE), + '#description' => t('If checked, imagelinks (images wrapped in an a tag) should be external links'), + ); + $form['extlink_subdomains'] = array( '#type' => 'checkbox', '#title' => t('Exclude links with the same primary domain.'),