You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

2 lines
1.1 KiB

!function($){$.fn.linenumbers=function(t){var e=$.extend({col_width:"65px",start:1,digits:3},t);return $("[data-name='linenumbers']").remove(),this.each(function(){var t=$(this).prop("offsetWidth"),r=$(this).prop("offsetHeight"),s=parseInt(t)-parseInt(e.col_width);$(this).before('<textarea data-name="linenumbers" style="width:35px;height:'+r+'px;white-space:pre;overflow:hidden;" disabled="disabled"></textarea>'),$(this).css({width:s+"px",height:r+"px"}),$(this).after('<div style="clear:both;"></div>');var n=$(this).parent().find('textarea[disabled="disabled"]');$(this).bind("blur focus change keyup keydown",function(){var t="\n"+$(this).val();t=t.match(/[^\n]*\n[^\n]*/gi);var r="",s="",a="";for(i=0;i<e.digits;i++)s+=" ";$.each(t,function(t,i){0!=t&&(r+="\n"),lencheck=t+e.start+"!",a=s.substr(lencheck.length-1),r+=a+(t+e.start)+":"}),$(n).val(r),$(n).scrollTop($(this).scrollTop())}),$(this).scroll(function(){$(n).scrollTop($(this).scrollTop())}),$(this).trigger("keyup")})}}(jQuery),$("textarea").linenumbers();
//# sourceMappingURL=./jquery-linenumbers.min.js.map