{"action":"created","comment":{"url":"https://api.github.com/repos/keithamus/LinkyPass/pulls/comments/22903409","id":22903409,"diff_hunk":"@@ -65,6 +73,15 @@\n             }\n         });\n \n+        SiteProfile.retreive(null, function (profiles) {\n+            profiles.forEach(function (profile, i) {\n+                if (profile.domain === $('#domain').val()) {\n+                    siteProfile = profile;\n+                    updateDomain();\n+                }\n+            });\n+        });\n+","path":"extension/js/popup.js","position":39,"original_position":39,"commit_id":"f1d636a0d623c862b81c6678201c220f93e2a0cd","original_commit_id":"f1d636a0d623c862b81c6678201c220f93e2a0cd","user":{"login":"keithamus","id":118266,"avatar_url":"https://avatars.githubusercontent.com/u/118266?v=3","gravatar_id":"","url":"https://api.github.com/users/keithamus","html_url":"https://github.com/keithamus","followers_url":"https://api.github.com/users/keithamus/followers","following_url":"https://api.github.com/users/keithamus/following{/other_user}","gists_url":"https://api.github.com/users/keithamus/gists{/gist_id}","starred_url":"https://api.github.com/users/keithamus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithamus/subscriptions","organizations_url":"https://api.github.com/users/keithamus/orgs","repos_url":"https://api.github.com/users/keithamus/repos","events_url":"https://api.github.com/users/keithamus/events{/privacy}","received_events_url":"https://api.github.com/users/keithamus/received_events","type":"User","site_admin":false},"body":"Couple of points with this:\r\n\r\n - This could be pretty slow with lots of domains. `$('#domain').val()` should be cached before the `forEach()` to make this comparison faster. \r\n - Also, rather than using `forEach`, consider using [`some`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/some) which will break on the first hit. \r\n - Rather than having the `siteProfile` var and running `updateDomain` as the side-effect, why not pass `siteProfile` to `updateDomain`?\r\n\r\nI would refactor this code with the above points, making it look like:\r\n\r\n```js\r\nSiteProfile.retreive(null, function (profiles) {\r\n    var domain = $('#domain').val();\r\n    profiles.some(function (profile) {\r\n        if (profile.domain === domain) {\r\n            updateDomain(profile);\r\n            return true;\r\n        }\r\n    });\r\n});\r\n```","created_at":"2015-01-13T23:03:17Z","updated_at":"2015-01-13T23:03:17Z","html_url":"https://github.com/keithamus/LinkyPass/pull/25#discussion_r22903409","pull_request_url":"https://api.github.com/repos/keithamus/LinkyPass/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/keithamus/LinkyPass/pulls/comments/22903409"},"html":{"href":"https://github.com/keithamus/LinkyPass/pull/25#discussion_r22903409"},"pull_request":{"href":"https://api.github.com/repos/keithamus/LinkyPass/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/keithamus/LinkyPass/pulls/25","id":27272026,"html_url":"https://github.com/keithamus/LinkyPass/pull/25","diff_url":"https://github.com/keithamus/LinkyPass/pull/25.diff","patch_url":"https://github.com/keithamus/LinkyPass/pull/25.patch","issue_url":"https://api.github.com/repos/keithamus/LinkyPass/issues/25","number":25,"state":"open","locked":false,"title":"Site-specific exceptions","user":{"login":"dswd","id":838447,"avatar_url":"https://avatars.githubusercontent.com/u/838447?v=3","gravatar_id":"","url":"https://api.github.com/users/dswd","html_url":"https://github.com/dswd","followers_url":"https://api.github.com/users/dswd/followers","following_url":"https://api.github.com/users/dswd/following{/other_user}","gists_url":"https://api.github.com/users/dswd/gists{/gist_id}","starred_url":"https://api.github.com/users/dswd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dswd/subscriptions","organizations_url":"https://api.github.com/users/dswd/orgs","repos_url":"https://api.github.com/users/dswd/repos","events_url":"https://api.github.com/users/dswd/events{/privacy}","received_events_url":"https://api.github.com/users/dswd/received_events","type":"User","site_admin":false},"body":"I have been using LP on lots of pages for a few years I really like it. However some sites cause me a lot of trouble. This is mostly because one of the following reasons:\r\n\r\n  * The site wants to have a special character in the password. Here I have to use LP and manually append a special character.\r\n  * The site uses the same login for multiple domains. Here I have to remember the *main domain* and change all others to it.\r\n  * The site changes the domain (e.g. from .com to .org). Normal users do not notice this but for me the password changes.\r\n\r\nAll of these problems can be *fixed* by memorizing all those exceptions but I think the extension could store them for me.\r\n\r\nI implemented site-specific exceptions that let you configure whether the domain should be changed or what characters should be appended.\r\n\r\nI tried to stick to the programming style of the project but please tell me if you want me to change something.","created_at":"2015-01-13T13:51:19Z","updated_at":"2015-01-13T23:03:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"37a799d74a53a290ad11c857c25e5a5f75c8439a","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/keithamus/LinkyPass/pulls/25/commits","review_comments_url":"https://api.github.com/repos/keithamus/LinkyPass/pulls/25/comments","review_comment_url":"https://api.github.com/repos/keithamus/LinkyPass/pulls/comments/{number}","comments_url":"https://api.github.com/repos/keithamus/LinkyPass/issues/25/comments","statuses_url":"https://api.github.com/repos/keithamus/LinkyPass/statuses/f1d636a0d623c862b81c6678201c220f93e2a0cd","head":{"label":"dswd:site-exceptions","ref":"site-exceptions","sha":"f1d636a0d623c862b81c6678201c220f93e2a0cd","user":{"login":"dswd","id":838447,"avatar_url":"https://avatars.githubusercontent.com/u/838447?v=3","gravatar_id":"","url":"https://api.github.com/users/dswd","html_url":"https://github.com/dswd","followers_url":"https://api.github.com/users/dswd/followers","following_url":"https://api.github.com/users/dswd/following{/other_user}","gists_url":"https://api.github.com/users/dswd/gists{/gist_id}","starred_url":"https://api.github.com/users/dswd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dswd/subscriptions","organizations_url":"https://api.github.com/users/dswd/orgs","repos_url":"https://api.github.com/users/dswd/repos","events_url":"https://api.github.com/users/dswd/events{/privacy}","received_events_url":"https://api.github.com/users/dswd/received_events","type":"User","site_admin":false},"repo":{"id":29190776,"name":"LinkyPass","full_name":"dswd/LinkyPass","owner":{"login":"dswd","id":838447,"avatar_url":"https://avatars.githubusercontent.com/u/838447?v=3","gravatar_id":"","url":"https://api.github.com/users/dswd","html_url":"https://github.com/dswd","followers_url":"https://api.github.com/users/dswd/followers","following_url":"https://api.github.com/users/dswd/following{/other_user}","gists_url":"https://api.github.com/users/dswd/gists{/gist_id}","starred_url":"https://api.github.com/users/dswd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dswd/subscriptions","organizations_url":"https://api.github.com/users/dswd/orgs","repos_url":"https://api.github.com/users/dswd/repos","events_url":"https://api.github.com/users/dswd/events{/privacy}","received_events_url":"https://api.github.com/users/dswd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dswd/LinkyPass","description":"LinkyPass Google Chrome Extension","fork":true,"url":"https://api.github.com/repos/dswd/LinkyPass","forks_url":"https://api.github.com/repos/dswd/LinkyPass/forks","keys_url":"https://api.github.com/repos/dswd/LinkyPass/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dswd/LinkyPass/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dswd/LinkyPass/teams","hooks_url":"https://api.github.com/repos/dswd/LinkyPass/hooks","issue_events_url":"https://api.github.com/repos/dswd/LinkyPass/issues/events{/number}","events_url":"https://api.github.com/repos/dswd/LinkyPass/events","assignees_url":"https://api.github.com/repos/dswd/LinkyPass/assignees{/user}","branches_url":"https://api.github.com/repos/dswd/LinkyPass/branches{/branch}","tags_url":"https://api.github.com/repos/dswd/LinkyPass/tags","blobs_url":"https://api.github.com/repos/dswd/LinkyPass/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dswd/LinkyPass/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dswd/LinkyPass/git/refs{/sha}","trees_url":"https://api.github.com/repos/dswd/LinkyPass/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dswd/LinkyPass/statuses/{sha}","languages_url":"https://api.github.com/repos/dswd/LinkyPass/languages","stargazers_url":"https://api.github.com/repos/dswd/LinkyPass/stargazers","contributors_url":"https://api.github.com/repos/dswd/LinkyPass/contributors","subscribers_url":"https://api.github.com/repos/dswd/LinkyPass/subscribers","subscription_url":"https://api.github.com/repos/dswd/LinkyPass/subscription","commits_url":"https://api.github.com/repos/dswd/LinkyPass/commits{/sha}","git_commits_url":"https://api.github.com/repos/dswd/LinkyPass/git/commits{/sha}","comments_url":"https://api.github.com/repos/dswd/LinkyPass/comments{/number}","issue_comment_url":"https://api.github.com/repos/dswd/LinkyPass/issues/comments/{number}","contents_url":"https://api.github.com/repos/dswd/LinkyPass/contents/{+path}","compare_url":"https://api.github.com/repos/dswd/LinkyPass/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dswd/LinkyPass/merges","archive_url":"https://api.github.com/repos/dswd/LinkyPass/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dswd/LinkyPass/downloads","issues_url":"https://api.github.com/repos/dswd/LinkyPass/issues{/number}","pulls_url":"https://api.github.com/repos/dswd/LinkyPass/pulls{/number}","milestones_url":"https://api.github.com/repos/dswd/LinkyPass/milestones{/number}","notifications_url":"https://api.github.com/repos/dswd/LinkyPass/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dswd/LinkyPass/labels{/name}","releases_url":"https://api.github.com/repos/dswd/LinkyPass/releases{/id}","created_at":"2015-01-13T13:21:04Z","updated_at":"2015-01-13T13:44:18Z","pushed_at":"2015-01-13T17:32:18Z","git_url":"git://github.com/dswd/LinkyPass.git","ssh_url":"git@github.com:dswd/LinkyPass.git","clone_url":"https://github.com/dswd/LinkyPass.git","svn_url":"https://github.com/dswd/LinkyPass","homepage":"http://github.com/keithamus/LinkyPass","size":405,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"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":"keithamus:master","ref":"master","sha":"5336a27a8152c4ab625dde89e36ce213790e876d","user":{"login":"keithamus","id":118266,"avatar_url":"https://avatars.githubusercontent.com/u/118266?v=3","gravatar_id":"","url":"https://api.github.com/users/keithamus","html_url":"https://github.com/keithamus","followers_url":"https://api.github.com/users/keithamus/followers","following_url":"https://api.github.com/users/keithamus/following{/other_user}","gists_url":"https://api.github.com/users/keithamus/gists{/gist_id}","starred_url":"https://api.github.com/users/keithamus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithamus/subscriptions","organizations_url":"https://api.github.com/users/keithamus/orgs","repos_url":"https://api.github.com/users/keithamus/repos","events_url":"https://api.github.com/users/keithamus/events{/privacy}","received_events_url":"https://api.github.com/users/keithamus/received_events","type":"User","site_admin":false},"repo":{"id":892306,"name":"LinkyPass","full_name":"keithamus/LinkyPass","owner":{"login":"keithamus","id":118266,"avatar_url":"https://avatars.githubusercontent.com/u/118266?v=3","gravatar_id":"","url":"https://api.github.com/users/keithamus","html_url":"https://github.com/keithamus","followers_url":"https://api.github.com/users/keithamus/followers","following_url":"https://api.github.com/users/keithamus/following{/other_user}","gists_url":"https://api.github.com/users/keithamus/gists{/gist_id}","starred_url":"https://api.github.com/users/keithamus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithamus/subscriptions","organizations_url":"https://api.github.com/users/keithamus/orgs","repos_url":"https://api.github.com/users/keithamus/repos","events_url":"https://api.github.com/users/keithamus/events{/privacy}","received_events_url":"https://api.github.com/users/keithamus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/keithamus/LinkyPass","description":"LinkyPass Google Chrome Extension","fork":false,"url":"https://api.github.com/repos/keithamus/LinkyPass","forks_url":"https://api.github.com/repos/keithamus/LinkyPass/forks","keys_url":"https://api.github.com/repos/keithamus/LinkyPass/keys{/key_id}","collaborators_url":"https://api.github.com/repos/keithamus/LinkyPass/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/keithamus/LinkyPass/teams","hooks_url":"https://api.github.com/repos/keithamus/LinkyPass/hooks","issue_events_url":"https://api.github.com/repos/keithamus/LinkyPass/issues/events{/number}","events_url":"https://api.github.com/repos/keithamus/LinkyPass/events","assignees_url":"https://api.github.com/repos/keithamus/LinkyPass/assignees{/user}","branches_url":"https://api.github.com/repos/keithamus/LinkyPass/branches{/branch}","tags_url":"https://api.github.com/repos/keithamus/LinkyPass/tags","blobs_url":"https://api.github.com/repos/keithamus/LinkyPass/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/keithamus/LinkyPass/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/keithamus/LinkyPass/git/refs{/sha}","trees_url":"https://api.github.com/repos/keithamus/LinkyPass/git/trees{/sha}","statuses_url":"https://api.github.com/repos/keithamus/LinkyPass/statuses/{sha}","languages_url":"https://api.github.com/repos/keithamus/LinkyPass/languages","stargazers_url":"https://api.github.com/repos/keithamus/LinkyPass/stargazers","contributors_url":"https://api.github.com/repos/keithamus/LinkyPass/contributors","subscribers_url":"https://api.github.com/repos/keithamus/LinkyPass/subscribers","subscription_url":"https://api.github.com/repos/keithamus/LinkyPass/subscription","commits_url":"https://api.github.com/repos/keithamus/LinkyPass/commits{/sha}","git_commits_url":"https://api.github.com/repos/keithamus/LinkyPass/git/commits{/sha}","comments_url":"https://api.github.com/repos/keithamus/LinkyPass/comments{/number}","issue_comment_url":"https://api.github.com/repos/keithamus/LinkyPass/issues/comments/{number}","contents_url":"https://api.github.com/repos/keithamus/LinkyPass/contents/{+path}","compare_url":"https://api.github.com/repos/keithamus/LinkyPass/compare/{base}...{head}","merges_url":"https://api.github.com/repos/keithamus/LinkyPass/merges","archive_url":"https://api.github.com/repos/keithamus/LinkyPass/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/keithamus/LinkyPass/downloads","issues_url":"https://api.github.com/repos/keithamus/LinkyPass/issues{/number}","pulls_url":"https://api.github.com/repos/keithamus/LinkyPass/pulls{/number}","milestones_url":"https://api.github.com/repos/keithamus/LinkyPass/milestones{/number}","notifications_url":"https://api.github.com/repos/keithamus/LinkyPass/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/keithamus/LinkyPass/labels{/name}","releases_url":"https://api.github.com/repos/keithamus/LinkyPass/releases{/id}","created_at":"2010-09-06T21:56:52Z","updated_at":"2015-01-13T22:47:32Z","pushed_at":"2015-01-13T22:47:32Z","git_url":"git://github.com/keithamus/LinkyPass.git","ssh_url":"git@github.com:keithamus/LinkyPass.git","clone_url":"https://github.com/keithamus/LinkyPass.git","svn_url":"https://github.com/keithamus/LinkyPass","homepage":"http://github.com/keithamus/LinkyPass","size":538,"stargazers_count":34,"watchers_count":34,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":6,"forks":15,"open_issues":6,"watchers":34,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/keithamus/LinkyPass/pulls/25"},"html":{"href":"https://github.com/keithamus/LinkyPass/pull/25"},"issue":{"href":"https://api.github.com/repos/keithamus/LinkyPass/issues/25"},"comments":{"href":"https://api.github.com/repos/keithamus/LinkyPass/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/keithamus/LinkyPass/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/keithamus/LinkyPass/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/keithamus/LinkyPass/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/keithamus/LinkyPass/statuses/f1d636a0d623c862b81c6678201c220f93e2a0cd"}}}}