1/* 2 * jQuery jFontSize Plugin 3 * Examples and documentation: http://jfontsize.com 4 * Original Author: Frederico Soares Vanelli 5 * [email protected] 6 * http://twitter.com/fredvanelli 7 * http://facebook.com/fred.vanelli 8 * 9 * Copyright (c) 2011 10 * Version: 1.0 (2011-07-15) 11 * Dual licensed under the MIT and GPL licenses. 12 * http://jfontsize.com/license 13 * Requires: jQuery v1.2.6 or later 14*/ 15 16 17(function($) { 18 return $.fn.jfontsize = function(opcoes) { 19 var $this, defaults, fontsize_padrao, limite; 20 $this = $(this); 21 defaults = { 22 btnMinusClasseId: "#jfontsize-minus", 23 btnDefaultClasseId: "#jfontsize-default", 24 btnPlusClasseId: "#jfontsize-plus", 25 btnMinusMaxHits: 10, 26 btnPlusMaxHits: 10, 27 sizeChange: 1 28 }; 29 if (opcoes) { 30 opcoes = $.extend(defaults, opcoes); 31 } 32 limite = new Array(); 33 fontsize_padrao = new Array(); 34 $(this).each(function(i) { 35 limite[i] = 0; 36 return fontsize_padrao[i]; 37 }); 38 $(opcoes.btnMinusClasseId + ", " + opcoes.btnDefaultClasseId + ", " + opcoes.btnPlusClasseId).removeAttr("href"); 39 $(opcoes.btnMinusClasseId + ", " + opcoes.btnDefaultClasseId + ", " + opcoes.btnPlusClasseId).css("cursor", "pointer"); 40 $(opcoes.btnMinusClasseId).click(function() { 41 $(opcoes.btnPlusClasseId).removeClass("jfontsize-disabled"); 42 return $this.each(function(i) { 43 var fontsize; 44 if (limite[i] > (-opcoes.btnMinusMaxHits)) { 45 fontsize_padrao[i] = $(this).css("font-size"); 46 fontsize_padrao[i] = fontsize_padrao[i].replace("px", ""); 47 fontsize = $(this).css("font-size"); 48 fontsize = parseInt(fontsize.replace("px", "")); 49 fontsize = fontsize - opcoes.sizeChange; 50 fontsize_padrao[i] = fontsize_padrao[i] - (limite[i] * opcoes.sizeChange); 51 limite[i]--; 52 $(this).css("font-size", fontsize + "px"); 53 if (limite[i] === (-opcoes.btnMinusMaxHits)) { 54 return $(opcoes.btnMinusClasseId).addClass("jfontsize-disabled"); 55 } 56 } 57 }); 58 }); 59 $(opcoes.btnDefaultClasseId).click(function() { 60 $(opcoes.btnMinusClasseId).removeClass("jfontsize-disabled"); 61 $(opcoes.btnPlusClasseId).removeClass("jfontsize-disabled"); 62 return $this.each(function(i) { 63 limite[i] = 0; 64 return $(this).css('font-size', ''); 65 }) 66 }); 67 return $(opcoes.btnPlusClasseId).click(function() { 68 $(opcoes.btnMinusClasseId).removeClass("jfontsize-disabled"); 69 return $this.each(function(i) { 70 var fontsize; 71 if (limite[i] < opcoes.btnPlusMaxHits) { 72 fontsize_padrao[i] = $(this).css("font-size"); 73 fontsize_padrao[i] = fontsize_padrao[i].replace("px", ""); 74 fontsize = $(this).css("font-size"); 75 fontsize = parseInt(fontsize.replace("px", "")); 76 fontsize = fontsize + opcoes.sizeChange; 77 fontsize_padrao[i] = fontsize_padrao[i] - (limite[i] * opcoes.sizeChange); 78 limite[i]++; 79 $(this).css("font-size", fontsize + "px"); 80 if (limite[i] === opcoes.btnPlusMaxHits) { 81 return $(opcoes.btnPlusClasseId).addClass("jfontsize-disabled"); 82 } 83 } 84 }); 85 }); 86 }; 87})(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.