{"action":"created","comment":{"url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/comments/51945447","id":51945447,"diff_hunk":"@@ -546,26 +546,38 @@ function OpenmrsSearch(div, showIncludeVoided, searchHandler, selectionHandler,\n             });\n \n             // Browser back button support, for preserve data\n-            if (lastSearchParams !== null) {\n-                $j('#inputNode').val(lastSearchParams.lastSearchText);\n-                if (lastSearchParams.includeVoided == 1) {\n+            var lastSearchText = decodeURIComponent((new RegExp('[?|&]' + 'lastSearchText' \n+            \t\t+ '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,\"\"])[1].replace(/\\+/g, '%20')) || null;\n+            var includeVoided = decodeURIComponent((new RegExp('[?|&]' + 'includeVoided' \n+            \t\t+ '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,\"\"])[1].replace(/\\+/g, '%20')) || null;\n+            var includeVerbose = decodeURIComponent((new RegExp('[?|&]' + 'includeVerbose' \n+            \t\t+ '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,\"\"])[1].replace(/\\+/g, '%20')) || null;\n+            \n+            //if we have lastSearchText then set input text, move cursor to the end and trigger a keyup event to load the search\n+            if (lastSearchText !== null) {\n+            \t\n+                $j('#inputNode').val(lastSearchText);\n+                if (includeVoided == 1) {\n                     $j('#includeVoided').attr('checked','checked');\n                 }\n-                if (lastSearchParams.includeVerbose == 1) {\n+                if (includeVerbose == 1) {\n                     $j('#includeVerbose').attr('checked','checked');\n                 }\n-                var keyEvent = jQuery.Event(\"keyup\");\n-\n-                var codex = 13;\n-\n-                // Patient search doesn't support for Enter Key. So invoke keyup\n-                // event with last character of searched text.\n-                if (el.attr('id') === \"findPatients\") {\n-                    var text = $j('#inputNode').val();\n-                    codex = $j('#inputNode').val().charCodeAt($j('#inputNode').val().length - 1);\n-                }\n-\n-                keyEvent.keyCode = codex;\n+                \n+                //setting the cursor to the end of search text\n+    \t\t//setSelectionRange is a method of the DOM element not the jQuery object so get the DOM element\n+\t\tinput.focus();\n+        \tvar inputNodeDOM = $j('#inputNode').get(0);\n+        \tif(inputNodeDOM){\n+        \t\tvar lastSearchTextLength = lastSearchText.length;\n+        \t\tif (inputNodeDOM.setSelectionRange) {\n+        \t\t\tinputNodeDOM.setSelectionRange(lastSearchTextLength,lastSearchTextLength);\n+        \t\t}\n+        \t}\n+       \n+                var keyEvent = jQuery.Event(\"keyup\");    \n+                //jQuery normalizes event.which fixing some issues with not being able to trigger enter key \n+                keyEvent.which = 13;\n                 $j(\"#inputNode\").trigger(keyEvent);\n             }\n ","path":"omod/src/main/webapp/resources/scripts/jquery-ui/js/openmrsSearch.js","position":54,"original_position":54,"commit_id":"84abb5a07999ab9c83032dc94af2aa11f9827467","original_commit_id":"84abb5a07999ab9c83032dc94af2aa11f9827467","user":{"login":"wluyima","id":1395907,"avatar_url":"https://avatars.githubusercontent.com/u/1395907?v=3","gravatar_id":"","url":"https://api.github.com/users/wluyima","html_url":"https://github.com/wluyima","followers_url":"https://api.github.com/users/wluyima/followers","following_url":"https://api.github.com/users/wluyima/following{/other_user}","gists_url":"https://api.github.com/users/wluyima/gists{/gist_id}","starred_url":"https://api.github.com/users/wluyima/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wluyima/subscriptions","organizations_url":"https://api.github.com/users/wluyima/orgs","repos_url":"https://api.github.com/users/wluyima/repos","events_url":"https://api.github.com/users/wluyima/events{/privacy}","received_events_url":"https://api.github.com/users/wluyima/received_events","type":"User","site_admin":false},"body":"We might want to do something similar for includeVoided and showVerbose, i think there is a commit that added an option for storing these","created_at":"2016-02-04T22:05:00Z","updated_at":"2016-02-04T22:05:00Z","html_url":"https://github.com/openmrs/openmrs-module-legacyui/pull/38#discussion_r51945447","pull_request_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/comments/51945447"},"html":{"href":"https://github.com/openmrs/openmrs-module-legacyui/pull/38#discussion_r51945447"},"pull_request":{"href":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/38","id":58260758,"html_url":"https://github.com/openmrs/openmrs-module-legacyui/pull/38","diff_url":"https://github.com/openmrs/openmrs-module-legacyui/pull/38.diff","patch_url":"https://github.com/openmrs/openmrs-module-legacyui/pull/38.patch","issue_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/issues/38","number":38,"state":"open","locked":false,"title":"[LUI-61] Add support for back button on patient search page","user":{"login":"jennparise","id":4134086,"avatar_url":"https://avatars.githubusercontent.com/u/4134086?v=3","gravatar_id":"","url":"https://api.github.com/users/jennparise","html_url":"https://github.com/jennparise","followers_url":"https://api.github.com/users/jennparise/followers","following_url":"https://api.github.com/users/jennparise/following{/other_user}","gists_url":"https://api.github.com/users/jennparise/gists{/gist_id}","starred_url":"https://api.github.com/users/jennparise/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jennparise/subscriptions","organizations_url":"https://api.github.com/users/jennparise/orgs","repos_url":"https://api.github.com/users/jennparise/repos","events_url":"https://api.github.com/users/jennparise/events{/privacy}","received_events_url":"https://api.github.com/users/jennparise/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-04T09:36:42Z","updated_at":"2016-02-04T22:05:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f63b1af74f428fa3133691c0a4673ca5508a0eaf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/38/commits","review_comments_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/38/comments","review_comment_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/issues/38/comments","statuses_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/statuses/84abb5a07999ab9c83032dc94af2aa11f9827467","head":{"label":"jennparise:master","ref":"master","sha":"84abb5a07999ab9c83032dc94af2aa11f9827467","user":{"login":"jennparise","id":4134086,"avatar_url":"https://avatars.githubusercontent.com/u/4134086?v=3","gravatar_id":"","url":"https://api.github.com/users/jennparise","html_url":"https://github.com/jennparise","followers_url":"https://api.github.com/users/jennparise/followers","following_url":"https://api.github.com/users/jennparise/following{/other_user}","gists_url":"https://api.github.com/users/jennparise/gists{/gist_id}","starred_url":"https://api.github.com/users/jennparise/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jennparise/subscriptions","organizations_url":"https://api.github.com/users/jennparise/orgs","repos_url":"https://api.github.com/users/jennparise/repos","events_url":"https://api.github.com/users/jennparise/events{/privacy}","received_events_url":"https://api.github.com/users/jennparise/received_events","type":"User","site_admin":false},"repo":{"id":51065160,"name":"openmrs-module-legacyui","full_name":"jennparise/openmrs-module-legacyui","owner":{"login":"jennparise","id":4134086,"avatar_url":"https://avatars.githubusercontent.com/u/4134086?v=3","gravatar_id":"","url":"https://api.github.com/users/jennparise","html_url":"https://github.com/jennparise","followers_url":"https://api.github.com/users/jennparise/followers","following_url":"https://api.github.com/users/jennparise/following{/other_user}","gists_url":"https://api.github.com/users/jennparise/gists{/gist_id}","starred_url":"https://api.github.com/users/jennparise/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jennparise/subscriptions","organizations_url":"https://api.github.com/users/jennparise/orgs","repos_url":"https://api.github.com/users/jennparise/repos","events_url":"https://api.github.com/users/jennparise/events{/privacy}","received_events_url":"https://api.github.com/users/jennparise/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jennparise/openmrs-module-legacyui","description":"The legacy user interface for OpenMRS 1.9 is chiefly comprised of administrative functions and the patient dashboard. Apparently, a new and more contemporary UI has been introduced via a UI framework and the legacy UI is kept around for administrative functions that are not yet implemented in the new UI. To retire the Legacy UI as planned, it is required to move the implementations and modules that still rely on it in order to maintain backwards compatibility. The main idea behind this project is to move legacy UI functions into an OpenMRS module that these implementations can install until they are able to migrate away from it, since most of the implementations of OpenMRS around the world are running OpenMRS 1.9.","fork":true,"url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui","forks_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/forks","keys_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/teams","hooks_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/hooks","issue_events_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/issues/events{/number}","events_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/events","assignees_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/assignees{/user}","branches_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/branches{/branch}","tags_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/tags","blobs_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/git/refs{/sha}","trees_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/statuses/{sha}","languages_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/languages","stargazers_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/stargazers","contributors_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/contributors","subscribers_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/subscribers","subscription_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/subscription","commits_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/commits{/sha}","git_commits_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/git/commits{/sha}","comments_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/comments{/number}","issue_comment_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/issues/comments{/number}","contents_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/contents/{+path}","compare_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/merges","archive_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/downloads","issues_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/issues{/number}","pulls_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/pulls{/number}","milestones_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/milestones{/number}","notifications_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/labels{/name}","releases_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/releases{/id}","deployments_url":"https://api.github.com/repos/jennparise/openmrs-module-legacyui/deployments","created_at":"2016-02-04T09:22:45Z","updated_at":"2016-02-04T09:22:49Z","pushed_at":"2016-02-04T09:28:08Z","git_url":"git://github.com/jennparise/openmrs-module-legacyui.git","ssh_url":"git@github.com:jennparise/openmrs-module-legacyui.git","clone_url":"https://github.com/jennparise/openmrs-module-legacyui.git","svn_url":"https://github.com/jennparise/openmrs-module-legacyui","homepage":"","size":1751,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openmrs:master","ref":"master","sha":"32fd04436dd851d5cfc195ad339840d048eb0511","user":{"login":"openmrs","id":860776,"avatar_url":"https://avatars.githubusercontent.com/u/860776?v=3","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"repo":{"id":35045181,"name":"openmrs-module-legacyui","full_name":"openmrs/openmrs-module-legacyui","owner":{"login":"openmrs","id":860776,"avatar_url":"https://avatars.githubusercontent.com/u/860776?v=3","gravatar_id":"","url":"https://api.github.com/users/openmrs","html_url":"https://github.com/openmrs","followers_url":"https://api.github.com/users/openmrs/followers","following_url":"https://api.github.com/users/openmrs/following{/other_user}","gists_url":"https://api.github.com/users/openmrs/gists{/gist_id}","starred_url":"https://api.github.com/users/openmrs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openmrs/subscriptions","organizations_url":"https://api.github.com/users/openmrs/orgs","repos_url":"https://api.github.com/users/openmrs/repos","events_url":"https://api.github.com/users/openmrs/events{/privacy}","received_events_url":"https://api.github.com/users/openmrs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openmrs/openmrs-module-legacyui","description":"The legacy user interface for OpenMRS 1.9 is chiefly comprised of administrative functions and the patient dashboard. Apparently, a new and more contemporary UI has been introduced via a UI framework and the legacy UI is kept around for administrative functions that are not yet implemented in the new UI. To retire the Legacy UI as planned, it is required to move the implementations and modules that still rely on it in order to maintain backwards compatibility. The main idea behind this project is to move legacy UI functions into an OpenMRS module that these implementations can install until they are able to migrate away from it, since most of the implementations of OpenMRS around the world are running OpenMRS 1.9.","fork":false,"url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui","forks_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/forks","keys_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/teams","hooks_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/hooks","issue_events_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/issues/events{/number}","events_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/events","assignees_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/assignees{/user}","branches_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/branches{/branch}","tags_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/tags","blobs_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/git/refs{/sha}","trees_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/statuses/{sha}","languages_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/languages","stargazers_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/stargazers","contributors_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/contributors","subscribers_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/subscribers","subscription_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/subscription","commits_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/commits{/sha}","git_commits_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/git/commits{/sha}","comments_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/comments{/number}","issue_comment_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/issues/comments{/number}","contents_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/contents/{+path}","compare_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/merges","archive_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/downloads","issues_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/issues{/number}","pulls_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls{/number}","milestones_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/milestones{/number}","notifications_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/labels{/name}","releases_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/releases{/id}","deployments_url":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/deployments","created_at":"2015-05-04T16:12:32Z","updated_at":"2016-01-19T14:07:06Z","pushed_at":"2016-02-04T21:11:19Z","git_url":"git://github.com/openmrs/openmrs-module-legacyui.git","ssh_url":"git@github.com:openmrs/openmrs-module-legacyui.git","clone_url":"https://github.com/openmrs/openmrs-module-legacyui.git","svn_url":"https://github.com/openmrs/openmrs-module-legacyui","homepage":"","size":1869,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":2,"forks":27,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/38"},"html":{"href":"https://github.com/openmrs/openmrs-module-legacyui/pull/38"},"issue":{"href":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/issues/38"},"comments":{"href":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/openmrs/openmrs-module-legacyui/statuses/84abb5a07999ab9c83032dc94af2aa11f9827467"}}}}