? .DS_Store ? .buildpath ? .git ? .project ? .settings ? geshifilter.kpf Index: geshifilter.css =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/geshifilter/geshifilter.css,v retrieving revision 1.7 diff -u -b -u -p -r1.7 geshifilter.css --- geshifilter.css 18 Jan 2008 22:58:39 -0000 1.7 +++ geshifilter.css 13 Jul 2009 08:15:58 -0000 @@ -23,6 +23,7 @@ div.geshifilter { border: 1px solid #ccc; background-color: #f8f8f8; line-height: 1.3; + overflow: auto; } div.geshifilter > pre, div.geshifilter > div { @@ -41,3 +42,13 @@ div.geshifilter > pre ol, div.geshifilte line-height: 1.3; } +/* Styling for GeSHi filter code blocks tools (partial collapsing toggle) */ +div.geshifilter-tools { + margin: -0.5em 0.5em 0.5em 0.5em; + background-color: #ccc; + padding: 0.5ex 0.5em; +} + +div.geshifilter-collapsed { + overflow: hidden; +} Index: geshifilter.js =================================================================== RCS file: geshifilter.js diff -N geshifilter.js --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ geshifilter.js 13 Jul 2009 08:15:58 -0000 @@ -0,0 +1,46 @@ + +if (Drupal.jsEnabled) { + + // jQuery magic for partial collapsing/showing GeSHi filter code blocks. + $(document).ready(function() { + // The height to collapse to. + var geshifilter_collapse_height = 100; + var geshifilter_collapse_height_threshold = 150; + + $('div.geshifilter').each(function() { + // Get code container and its height. + var code_container = $(this); + var code_container_original_height = code_container.height(); + + // Only do the collapsing where it makes sense. + if (code_container_original_height > geshifilter_collapse_height_threshold) { + // Add more/less link. + $(this).after('
' + Drupal.t('Show more code') + '
'); + // Store the original heights of the geshifilter divs. + code_container.attr('original_height', code_container_original_height); + // Collapse by default. + code_container.addClass('geshifilter-collapsed').css("height", geshifilter_collapse_height); + } + }); + + // Add handler to read more/collapse link. + $("a.geshifilter-tools-collapsetoggle").click(function() { + // Get code container. + var code_container = $(this).parent().prev(); + + if (code_container.hasClass('geshifilter-collapsed')) { + // Show more (use original height). + var original_height = code_container.attr('original_height') + 'px'; + code_container.removeClass('geshifilter-collapsed').animate({height: original_height}, 'slow'); + $(this).text(Drupal.t('Show less code')); + } + else { + // Collapse. + code_container.addClass('geshifilter-collapsed').animate({height: geshifilter_collapse_height}, 'slow'); + $(this).text(Drupal.t('Show more code')); + } + // Return false so that the link is no followed. + return false; + }); + }); +} Index: geshifilter.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/geshifilter/geshifilter.module,v retrieving revision 1.48 diff -u -b -u -p -r1.48 geshifilter.module --- geshifilter.module 12 Jul 2009 15:00:28 -0000 1.48 +++ geshifilter.module 13 Jul 2009 08:15:59 -0000 @@ -154,6 +154,7 @@ function geshifilter_init() { drupal_add_css(file_directory_path() .'/geshifilter-languages.css'); } drupal_add_css(drupal_get_path('module', 'geshifilter') .'/geshifilter.css'); + drupal_add_js(drupal_get_path('module', 'geshifilter') .'/geshifilter.js'); } /**