From 661aeaf14303f77b5e3aa625155dd7ee83de6952 Mon Sep 17 00:00:00 2001 From: Phillip Gooch Date: Thu, 21 Sep 2017 18:19:25 -0700 Subject: [PATCH] Updated readme and JS map, fixed a bug and changed the example link. --- .gitignore | 3 ++- index.html | 5 ----- jquery-linenumbers.js | 2 ++ jquery-linenumbers.min.js | 4 ++-- jquery-linenumbers.min.js.map | 1 + readme.md | 3 ++- 6 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 jquery-linenumbers.min.js.map diff --git a/.gitignore b/.gitignore index 29b636a..871da3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea -*.iml \ No newline at end of file +*.iml +*.codekit3 diff --git a/index.html b/index.html index 1a138a3..76a70e5 100644 --- a/index.html +++ b/index.html @@ -110,10 +110,5 @@

jQuery linenumbers plugin

You'll need to give your text area a set width, or the two line numbers won't line up right with the text, this has been tested as a px value, but percents should be ok in any format as long as the col_width is the same. Other than that it should work just fine. Internet Explorer has not been fully tested (due to the lack of a machine that can run it) but should work.

Download

version 1.0.2 — Sep 17, 2017 — 4.80kb

-

Version History

- \ No newline at end of file diff --git a/jquery-linenumbers.js b/jquery-linenumbers.js index 12c343d..b448f07 100644 --- a/jquery-linenumbers.js +++ b/jquery-linenumbers.js @@ -18,6 +18,8 @@ $(this).before(''); // Edit the existing textarea's styles $(this).css({'width':new_textarea_width+'px','height':textarea_height+'px','float':'right'}); + // Add a clearing div. + $(this).after('
'); // Define a simple variable for the line-numbers box var lnbox = $(this).parent().find('textarea[disabled="disabled"]'); // Bind some actions to all sorts of events that may change it's contents diff --git a/jquery-linenumbers.min.js b/jquery-linenumbers.min.js index 3642999..66e90c9 100644 --- a/jquery-linenumbers.min.js +++ b/jquery-linenumbers.min.js @@ -1,2 +1,2 @@ -/* jquery linenumbers v1.0.2 - 09/17/2017 */ -(function($){ $.fn.linenumbers = function(in_opts){ var opt = $.extend({ col_width: '65px', start: 1, digits: 3. },in_opts); $("[data-name='linenumbers']").remove(); return this.each(function(){ var textarea_width = $(this).prop("offsetWidth"); var textarea_height = $(this).prop("offsetHeight"); var new_textarea_width = parseInt(textarea_width)-parseInt(opt.col_width); $(this).before(''); $(this).css({'width':new_textarea_width+'px','height':textarea_height+'px','float':'right'}); var lnbox = $(this).parent().find('textarea[disabled="disabled"]'); $(this).bind('blur focus change keyup keydown',function(){ var lines = "\n"+$(this).val(); lines = lines.match(/[^\n]*\n[^\n]*/gi); var line_number_output=''; var max_spacers = ''; var spacers = ''; for(i=0;i'),$(this).css({width:s+"px",height:r+"px",float:"right"}),$(this).after('
');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