1// $Id $ 2Drupal.behaviors.textResize = function(context) { 3 // Which div or page element are we resizing? 4 if (text_resize_scope) { // Admin-specified scope takes precedence. 5 if ($('#'+text_resize_scope).length > 0) { 6 var element_to_resize = $('#'+text_resize_scope); // ID specified by admin 7 } 8 else if ($('.'+text_resize_scope).length > 0) { 9 var element_to_resize = $('.'+text_resize_scope); // CLASS specified by admin 10 } 11 else { 12 var element_to_resize = $(text_resize_scope); // It's just a tag specified by admin 13 } 14 } 15 else { // Look for some default scopes that might exist. 16 if ($('DIV.left-corner').length > 0) { 17 var element_to_resize = $('DIV.left-corner'); // Main body div for Garland 18 } 19 else if ($('#content-inner').length > 0) { 20 var element_to_resize = $('#content-inner'); // Main body div for Zen-based themes 21 } 22 else if ($('#squeeze > #content').length > 0) { 23 var element_to_resize = $('#squeeze > #content'); // Main body div for Zen Classic 24 } 25 } 26 // Set the initial font size if necessary 27 if ($.cookie('text_resize') != null) { 28 element_to_resize.css('font-size', parseFloat($.cookie('text_resize')) + 'px'); 29 //alert( "Should be size: " + $.cookie('text_resize')); 30 } 31 else { 32 //alert('Couldn\'t find text_resize cookie.'); 33 } 34 if (text_resize_line_height_allow) { 35 //alert('line height adjustment allowed! The current line-height is '+parseFloat(element_to_resize.css('line-height'), 10)); 36 // Set the initial line height if necessary 37 if ($.cookie('text_resize_line_height') != null) { 38 element_to_resize.css('line-height', parseFloat($.cookie('text_resize_line_height')) + 'px'); 39 } 40 } 41 // Changer links will change the text size when clicked 42 $('a.changer').click(function() { 43 // Set the current font size of the specified section as a variable 44 var currentFontSize = parseFloat(element_to_resize.css('font-size'), 10); 45 //alert('currentFontSize = '+currentFontSize); 46 // Set the current line-height 47 var current_line_height = parseFloat(element_to_resize.css('line-height'), 10); 48 //alert('current_line_height = '+current_line_height); 49 // javascript lets us choose which link was clicked, by ID 50 if (this.id == 'text_resize_increase') { 51 var new_font_size = currentFontSize * 1.2; 52 if (text_resize_line_height_allow) { var new_line_height = current_line_height * 1.2; } 53 // Allow resizing as long as font size doesn't go above text_resize_maximum. 54 if (new_font_size <= text_resize_maximum) { 55 $.cookie('text_resize', new_font_size, { path: '/' }); 56 if (text_resize_line_height_allow) { $.cookie('text_resize_line_height', new_line_height, { path: '/' }); } 57 var allow_change = true; 58 } 59 else { 60 $.cookie('text_resize', text_resize_maximum, { path: '/' }); 61 if (text_resize_line_height_allow) { $.cookie('text_resize_line_height', text_resize_line_height_max, { path: '/' }); } 62 var reset_size_max = true; 63 } 64 } 65 else if (this.id == 'text_resize_decrease') { 66 var new_font_size = currentFontSize / 1.2; 67 if (text_resize_line_height_allow) { var new_line_height = current_line_height / 1.2; } 68 if (new_font_size >= text_resize_minimum) { 69 // Allow resizing as long as font size doesn't go below text_resize_minimum. 70 $.cookie('text_resize', new_font_size, { path: '/' }); 71 if (text_resize_line_height_allow) { $.cookie('text_resize_line_height', new_line_height, { path: '/' }); } 72 var allow_change = true; 73 } 74 else { 75 // If it goes below text_resize_minimum, just leave it at text_resize_minimum. 76 $.cookie('text_resize', text_resize_minimum, { path: '/' }); 77 if (text_resize_line_height_allow) { $.cookie('text_resize_line_height', text_resize_line_height_min, { path: '/' }); } 78 var reset_size_min = true; 79 } 80 } 81 else if (this.id == 'text_resize_reset') { 82 $.cookie('text_resize', text_resize_minimum, { path: '/' }); 83 if (text_resize_line_height_allow) { $.cookie('text_resize_line_height', text_resize_line_height_min, { path: '/' }); } 84 var reset_size_min = true; 85 } 86 // jQuery lets us set the font size value of the main text div 87 if (allow_change == true) { 88 element_to_resize.css('font-size', new_font_size + 'px'); // Add 'px' onto the end, otherwise ems are used as units by default 89 if (text_resize_line_height_allow) { element_to_resize.css('line-height', new_line_height + 'px'); } 90 return false;
91 } 92 else if (reset_size_min == true) { 93 element_to_resize.css('font-size', text_resize_minimum + 'px'); 94 if (text_resize_line_height_allow) { element_to_resize.css('line-height', text_resize_line_height_min + 'px'); } 95 return false; 96 } 97 else if (reset_size_max == true) { 98 element_to_resize.css('font-size', text_resize_maximum + 'px'); 99 if (text_resize_line_height_allow) { element_to_resize.css('line-height', text_resize_line_height_max + 'px'); } 100 return false; 101 } 102 }); 103}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.