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