<NME> README.md
<BEF> jQuery Form Validation
======================

The jQuery Typeahead plugin unifies the way to validate HTML forms using JavaScript.
It is a simple clientside library that will save you a lot of time when it comes to adding validation on your HTML form inputs or selects!

The jQuery Typeahead plugin is released under the MIT License.

It is a simple clientside library that will improve the user experience on your website search input!

The jQuery Typeahead plugin is released under the MIT License.

The complete documentation, demo and further instructions can be found at www.runningcoder.org

## Installation

    npm install jquery-typeahead

or

    yarn add jquery-typeahead

## Documentation

You can find the complete documentation on www.runningcoder.org/jquerytypeahead/documentation/

## Demos

www.runningcoder.org/jquerytypeahead/demo/

## Version Notes

www.runningcoder.org/jquerytypeahead/version/

## Pull Requests

Please consider these points before creating a new pull request

- Pull request should be made from `develop` to `develop` branch so it can be tested properly and not be directly available to download on the `master`.
  The `master` branch should be a copy of the latest released `tag` without any additional new code that has not been released
- Add a descriptive note along with the PR and examples
- Only submit the changed lines and not the whole file(s)
- Follow the same coding conversions

<MSG> Added comments

<DFF> @@ -1,8 +1,8 @@
-jQuery Form Validation
+jQuery Typeahead
 ======================
 
-The jQuery Typeahead plugin unifies the way to validate HTML forms using JavaScript.
-It is a simple clientside library that will save you a lot of time when it comes to adding validation on your HTML form inputs or selects!
+The jQuery Typeahead plugin provides autocomplete preview on search inputs similar to google search with builtin options and deep customization.
+It is a simple clientside library that will add a better user experience to your website search input!
 
 The jQuery Typeahead plugin is released under the MIT License.
 

{'commit': 'diff --git a/README.md b/README.md\nindex e0d17c0..a983a51 100644\n--- a/README.md\n+++ b/README.md\n@@ -1,8 +1,8 @@\n-jQuery Form Validation\n+jQuery Typeahead\n ======================\n \n-The jQuery Typeahead plugin unifies the way to validate HTML forms using JavaScript.\n-It is a simple clientside library that will save you a lot of time when it comes to adding validation on your HTML form inputs or selects!\n+The jQuery Typeahead plugin provides autocomplete preview on search inputs similar to google search with builtin options and deep customization.\n+It is a simple clientside library that will add a better user experience to your website search input!\n \n The jQuery Typeahead plugin is released under the MIT License.\n \ndiff --git a/jquery.typeahead.js b/jquery.typeahead.js\nindex fa60075..abf943b 100644\n--- a/jquery.typeahead.js\n+++ b/jquery.typeahead.js\n@@ -2,7 +2,7 @@\n  * jQuery Typeahead\n  *\n  * @author Tom Bertrand\n- * @version 0.1.0 Beta (2014-08-1)\n+ * @version 0.1.0 Beta (2014-08-22)\n  *\n  * @copyright\n  * Copyright (C) 2014 Tom Bertrand.\n@@ -57,8 +57,6 @@\n             ttl: 3600,\n             backdrop: false,\n             input: null,\n-            trigger: "change",\n-            action: "click",\n             searchListClass: "typeahead-search",\n             jsonList: {}\n         },\n@@ -66,9 +64,7 @@\n             onInit: null,\n             onHover: null,\n             onHoverOut: null,\n-            onClick: null/*,\n-            onBeforeSubmit: null,\n-            onSubmit: null*/\n+            onClick: null\n         },\n         debug: false\n     };\n@@ -83,8 +79,6 @@\n             order: [null, \'asc\', \'desc\'],\n             group: [true, false],\n             backdrop: [true, false],\n-            //trigger: ["keypress", "keydown", "keyup"], // onChange?\n-            action: ["click", "dblclick", "mousedown", "mouseup"],\n             jsonList: ["storage", "pattern", "data", "url"]\n         },\n         debug: [true, false]\n@@ -280,10 +274,12 @@\n \n             });\n \n-\n-\n         }\n \n+        /**\n+         *\n+         * @returns {boolean}\n+         */\n         function search () {\n \n             if (query.trim() === "") {\n@@ -304,7 +300,6 @@\n                 }\n             }\n \n-\n             var foundItems = [],\n                 html = \'<div class="\' + options.settings.searchListClass + \'" \' + _data.searchList + \'><ul></ul></div>\',\n                 itemsHtml = "",\n@@ -324,18 +319,10 @@\n                         ))\n                     {\n \n-\n-\n-\n                         storageJsonList[list][i].list = list;\n \n                         foundItems.push(storageJsonList[list][i]);\n \n-                        //console.log("list")\n-                        //console.log(list)\n-                        //console.log("object")\n-                        //console.log(storageJsonList[list][i])\n-\n                     }\n                 }\n             }\n@@ -358,7 +345,6 @@\n             var searchContainer = $(node).parent(),\n                 object;\n \n-\n             searchContainer.append(html).find("ul").html(itemsHtml);\n \n             searchContainer.find(\'[\' + _data.searchList + \'] a\').hover(function () {\n@@ -374,9 +360,6 @@\n                 _executeCallback(options.callback.onHoverOut, [node, this, object]);\n             });\n \n-\n-\n-\n             searchContainer.find(\'[\' + _data.searchList + \'] a\').on("click", function (e) {\n \n                 e.preventDefault();\n@@ -395,26 +378,19 @@\n                     //console.log(\'no callback set\')\n                 }\n \n-\n             });\n \n-\n-\n-\n-\n-\n         }\n \n+        /**\n+         *\n+         */\n         function resetSearch () {\n \n             $(node).parent().find(\'[\' + _data.searchList + \']\').remove();\n \n-\n         }\n \n-\n-\n-\n         /**\n          *\n          */\n@@ -485,40 +461,15 @@\n                             ajaxPath: path\n                         }).done( function(data) {\n \n-\n                             _populateJsonList(data, this.ajaxList, this.ajaxPath);\n \n-\n-\n-                            //storageJsonList[list] = storageJsonList[list].concat(jsonList[list].data);\n-\n-                            //console.log(\'coucou :D\')\n-/*\n-                            // Status in not needed anymore\n-                            delete response.status;\n-\n-                            window.log(_class.name + \'._ajax - Populating storage with type: \' + this.ajaxI);\n-\n-                            _class.urlPattern[this.ajaxI] = response.urlPattern;\n-\n-                            if (_class.options.compression) {\n-                                window.time(\'compression\');\n-                                response = base64_encode(RawDeflate.deflate(escape(JSON.stringify(response))));\n-                                window.timeEnd(\'compression\');\n-                                window.log(_class.name + \'._ajax - Compressed response.\');\n-                            }\n-\n-                            $.jStorage.set(jsonList[this.ajaxI].storage, response);\n-                            $.jStorage.setTTL(jsonList[this.ajaxI].storage, _class.options.ttl);\n-*/\n-\n                             counter++;\n                             if (counter === length) {\n                                 //_class._object.properties._overrideTypeahead(jsonList);\n                             }\n \n                         }).fail( function (response) {\n-                            //window.debug(_class.name + \'._ajax - Error in ajax response for url \' + jsonList[this.ajaxI].url + \' ignoring type: \' + this.ajaxI);\n+\n                             counter++;\n                             //if (counter === length) {\n                             //    _class._object.properties._overrideTypeahead(jsonList);\n@@ -528,8 +479,6 @@\n \n                     }\n \n-                    //\n-\n                 }\n \n             }\n@@ -550,13 +499,40 @@\n \n         }\n \n+        /**\n+         * @public\n+         * This method will be called by the jsonP callback to populate the JSON list\n+         *\n+         * @param {object} data JSON response from the jsonP call\n+         */\n+        function populate (data) {\n \n-        var _populateJsonList = function (data, list, path) {\n+            var list = data.list || \'list\',\n+                path = (options.settings.jsonList[list].url instanceof Array) ?\n+                    options.settings.jsonList[list].url[1] : null;\n \n-            //console.log(data)\n-            //console.log(list)\n-            //console.log(path)\n \n+            _populateJsonList(data, list, path);\n+\n+            ++counter;\n+\n+            if (counter === listLength) {\n+                isListGenerated = true;\n+                console.log(\'ALL LIST FETCHED\')\n+            }\n+\n+        }\n+\n+        /**\n+         * @private\n+         * Common method to build the JSON lists to be cycled for matched results from data, url or cross domain url.\n+         *\n+         * @param {array} data The raw data to be formatted\n+         * @param {string} list The list name\n+         * @param {string} [path] Optional path if the list is not on the data root\n+         *\n+         */\n+        var _populateJsonList = function (data, list, path) {\n \n             var _isValid = true;\n \n@@ -672,7 +648,7 @@\n \n         /**\n          * @private\n-         * Private function to retreive data from a crossdomain jsonP call\n+         * Private function to retrieve data from a cross domain jsonP call\n          *\n          * @type {{fetch: fetch, evalJSONP: evalJSONP}}\n          * @url http://javascriptweblog.wordpress.com/2010/11/29/json-and-jsonp/\n@@ -720,61 +696,6 @@\n \n         }();\n \n-        function populate (data) {\n-\n-            var list = data.list || \'list\',\n-                path = (options.settings.jsonList[list].url instanceof Array) ?\n-                    options.settings.jsonList[list].url[1] : null;\n-\n-\n-            _populateJsonList(data, list, path);\n-\n-            /*\n-            if (!data) {\n-                return false;\n-            }\n-\n-            var list = data.list || \'list\';\n-\n-            if (storageJsonList[list]) {\n-\n-                if (options.settings.jsonList[list].url instanceof Array) {\n-\n-                    var jsonPath = options.settings.jsonList[list].url[1];\n-\n-                    if (jsonPath) {\n-\n-                        var _exploded = jsonPath.split(\'.\'),\n-                            _splitIndex = 0,\n-                            _isValid = true;\n-\n-                        while (_splitIndex < _exploded.length) {\n-                            if (typeof data !== \'undefined\') {\n-                                data = data[_exploded[_splitIndex++]];\n-                            } else {\n-                                _isValid = false;\n-                                break;\n-                            }\n-                        }\n-\n-                        if (_isValid) {\n-                            storageJsonList[list] = storageJsonList[list].concat(data);\n-                        }\n-                    }\n-                }\n-\n-            }\n-            */\n-\n-            ++counter;\n-\n-            if (counter === listLength) {\n-                isListGenerated = true;\n-                console.log(\'ALL LIST FETCHED\')\n-            }\n-\n-        }\n-\n         return {\n \n             /**\n', 'commit_subject': 'Added comments', 'repo_name': 'running-coder/jquery-typeahead', 'committer': {'name': 'tom bertrand', 'email': '62e04096bd3e61e14b81a9a2bf1dd91c47e603e3@hotmail.com', 'time_sec': '1408754985', 'tz_offset': '-240', 'date': {'seconds': '1408754985'}}, 'commit_tree': 'f26439e550a374eb6e0498eebf86792f10cdfe38', 'commit_message': 'Added comments\n', 'language_name': 'HTML', 'license': 'mit', 'hunks': '@@ -1,8 +1,8 @@\n-jQuery Form Validation\n+jQuery Typeahead\n ======================\n \n-The jQuery Typeahead plugin unifies the way to validate HTML forms using JavaScript.\n-It is a simple clientside library that will save you a lot of time when it comes to adding validation on your HTML form inputs or selects!\n+The jQuery Typeahead plugin provides autocomplete preview on search inputs similar to google search with builtin options and deep customization.\n+It is a simple clientside library that will add a better user experience to your website search input!\n \n The jQuery Typeahead plugin is released under the MIT License.\n \n', 'addition_count': 3, 'deletion_count': 3, 'src_file': 'a/README.md', 'tgt_file': 'b/README.md', 'file_extension': '.md', 'before_file': 'jQuery Form Validation\n======================\n\nThe jQuery Typeahead plugin unifies the way to validate HTML forms using JavaScript.\nIt is a simple clientside library that will save you a lot of time when it comes to adding validation on your HTML form inputs or selects!\n\nThe jQuery Typeahead plugin is released under the MIT License.\n\nIt is a simple clientside library that will improve the user experience on your website search input!\n\nThe jQuery Typeahead plugin is released under the MIT License.\n\nThe complete documentation, demo and further instructions can be found at www.runningcoder.org\n\n## Installation\n\n    npm install jquery-typeahead\n\nor\n\n    yarn add jquery-typeahead\n\n## Documentation\n\nYou can find the complete documentation on www.runningcoder.org/jquerytypeahead/documentation/\n\n## Demos\n\nwww.runningcoder.org/jquerytypeahead/demo/\n\n## Version Notes\n\nwww.runningcoder.org/jquerytypeahead/version/\n\n## Pull Requests\n\nPlease consider these points before creating a new pull request\n\n- Pull request should be made from `develop` to `develop` branch so it can be tested properly and not be directly available to download on the `master`.\n  The `master` branch should be a copy of the latest released `tag` without any additional new code that has not been released\n- Add a descriptive note along with the PR and examples\n- Only submit the changed lines and not the whole file(s)\n- Follow the same coding conversions\n', 'message': 'Added comments\n', 'author_name': 'tom bertrand', 'lang': 'md'}