From af487127925d16d631c5d8eb2e8e7b0ae3108204 Mon Sep 17 00:00:00 2001
From: Daniel Imhoff
Date: Fri, 28 Apr 2017 20:25:31 -0500
Subject: [PATCH 01/10] update date to 2017
---
LICENSE | 4 ++--
jquery-textrange.js | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/LICENSE b/LICENSE
index dcf879b..2e3a86d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2012 Daniel Imhoff
+Copyright (c) 2017 Daniel Imhoff
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
@@ -15,4 +15,4 @@ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/jquery-textrange.js b/jquery-textrange.js
index c66c6c9..97bfe34 100644
--- a/jquery-textrange.js
+++ b/jquery-textrange.js
@@ -1,9 +1,10 @@
/**
* jquery-textrange
+ *
* A jQuery plugin for getting, setting and replacing the selected text in input fields and textareas.
* See the [README](https://github.com/dwieeb/jquery-textrange/blob/1.x/README.md) for usage and examples.
*
- * (c) 2012-2014 Daniel Imhoff - danielimhoff.com
+ * (c) 2012-2017 Daniel Imhoff - danielimhoff.com
*/
(function(factory) {
From 283653460fc6474c02b48bb91aac40113f4df674 Mon Sep 17 00:00:00 2001
From: Daniel Imhoff
Date: Fri, 28 Apr 2017 20:46:11 -0500
Subject: [PATCH 02/10] it's 2017
---
README.md | 63 ++++++++++++++++++++-----------------------
demo.html | 4 +--
jquery-textrange.js | 4 +--
textrange.jquery.json | 6 ++---
4 files changed, 36 insertions(+), 41 deletions(-)
diff --git a/README.md b/README.md
index 8de815d..8a1934e 100644
--- a/README.md
+++ b/README.md
@@ -1,43 +1,40 @@
-This jQuery plugin is for easily finding the starting and ending positions of selected text in text fields and textareas. It can also be used to set the selection, and replace the selection with given text (or insert text wherever the cursor is in the text field or textarea).
+This jQuery plugin is for easily finding the starting and ending positions of
+selected text in text fields and textareas. It can also be used to set the
+selection, and replace the selection with given text (or insert text wherever
+the cursor is in the text field or textarea).
-* jquery-textrange may not work with WYSIWYG editors. See [issue #3](https://github.com/dwieeb/jquery-textrange/issues/3) and [this question](http://wordpress.stackexchange.com/questions/105961/insert-text-a-cursor-position-in-to-tinymce-text-editor).
+* jquery-textrange may not work with WYSIWYG editors. See [issue
+ #3](https://github.com/dwieeb/jquery-textrange/issues/3) and [this
+ question](https://wordpress.stackexchange.com/questions/105961/insert-text-a-cursor-position-in-to-tinymce-text-editor).
## Demo
-* http://dwieeb.github.com/jquery-textrange/
+* https://dwieeb.github.com/jquery-textrange/
## Browser Support
-Tested in the following major browsers:
-
-* Internet Explorer 5.5+
-* Firefox 2+
* Chrome
+* Firefox
+* Microsoft Edge
+* *yes, even* Internet Explorer 5.5+
## Include
Include the file directly using `
+
```
-Or, with RequireJS (**note**: jquery-textrange can be loaded through any [UMD](https://github.com/umdjs/umd/blob/master/README.md)-compatible Javascript Module Loader):
-
-```javascript
-requirejs.config({
- "baseUrl": "lib",
- "paths": {
- "jquery": "//code.jquery.com/jquery-latest.min.js",
- "jquery-textrange": "jquery-plugins/jquery-textrange"
- }
-});
-```
+:memo: *note*: jquery-textrange can be loaded through any
+[UMD](https://github.com/umdjs/umd/blob/master/README.md)-compatible Javascript
+Module Loader.
## Methods
-You can use this method to get all the information on the selected text of an element or a specific bit of information.
+You can use this method to get all the information on the selected text of an
+element or a specific bit of information.
### 'get'
@@ -77,11 +74,15 @@ var start = $('input[name="example"]').textrange('get', 'start');
### 'set'
-You can use this method to set the starting and ending locations of the selected text in an element.
+You can use this method to set the starting and ending locations of the
+selected text in an element.
-It works much like [PHP's substr()](http://php.net/manual/en/function.substr.php) and [Ruby's String#slice](http://ruby-doc.org/core-2.0/String.html#method-i-slice), so if you're familiar with one of those, it should be a breeze! Here are some examples, anyway.
+It works much like [PHP's
+substr()](https://secure.php.net/manual/en/function.substr.php), so if you're
+familiar with that, it should be a breeze! Here are some examples, anyway.
-For the following examples, let's say `input[name="example"]` contains the text `abcdef`.
+For the following examples, let's say `input[name="example"]` contains the text
+`abcdef`.
```javascript
$('input[name="example"]').textrange('set'); // selects "abcdef" (select all)
@@ -93,7 +94,8 @@ $('input[name="example"]').textrange('set', -2, 1); // selects "e"
$('input[name="example"]').textrange('set', -4, -1); // selects "cde"
```
-If you're looking to set the cursor at one specific location, you can use `0` for length, or you can use `$().textrange('setcursor')` (see below).
+If you're looking to set the cursor at one specific location, you can use `0`
+for length, or you can use `$().textrange('setcursor')` (see below).
### 'setcursor'
@@ -107,18 +109,11 @@ $('input[name="example"]').textrange('setcursor', 5);
### 'replace'
-You can use this method to replace the selection with given text.
+You can use this method to replace the selection with given text.
```javascript
$('input[name="example"]').textrange('replace', 'some text');
```
-There is also an `insert` alias for `replace` if you're using this method to insert text at the cursor location. They work the same way.
-
-## Minified Version
-A minified version of this plugin can be generated using UglifyJS during your build process or via CLI tools:
-
-```bash
-npm i -g uglify-js
-uglifyjs jquery-textrange.js > jquery-textrange.min.js
-```
+There is also an `insert` alias for `replace` if you're using this method to
+insert text at the cursor location. They work the same way.
diff --git a/demo.html b/demo.html
index a9ac206..af378c5 100644
--- a/demo.html
+++ b/demo.html
@@ -3,7 +3,7 @@
jquery-textrange
-
+
body, h1 { margin:0; }
@@ -74,7 +74,7 @@
-created by Daniel Imhoff
+created by Daniel Imhoff
See the wiki for all features and documentation.