{"action":"created","comment":{"url":"https://api.github.com/repos/cheeaun/max-tabs/pulls/comments/35520691","id":35520691,"diff_hunk":"@@ -11,19 +11,42 @@ var chroma = require('chroma-js');\n \n exports.main = function(){\n \tvar maxTabs = simplePrefs.prefs.maxTabs;\n-\tvar max = (maxTabs > 1) ? maxTabs : 10; // Max at least 2 tabs please\n+\tvar max = (maxTabs > 1) ? maxTabs : 2; // Max at least 2 tabs please\n \tvar maxPrivateBrowsing = simplePrefs.prefs.maxPrivateBrowsing;\n+    var maxOpenInNextWindow = simplePrefs.prefs.maxOpenInNextWindow;\n+    var maxExcludePinnedTabs = simplePrefs.prefs.maxExcludePinnedTabs;\n \n \tvar button = ActionButton({\n \t\tid: 'max-tabs-button',\n-\t  label: title,\n+\t    label: title,\n \t\ticon: './icon.svg',\n \t\tdisabled: true\n \t});\n \n+    var calcTabsLen = function(win){\n+        let len = win.tabs.length;\n+        if(maxExcludePinnedTabs){\n+            let pinned = 0;\n+            for(let i = 0; i < len; i++){\n+                if(win.tabs[i].isPinned)\n+                    pinned++;\n+            }\n+            len -= pinned;","path":"index.js","position":26,"original_position":26,"commit_id":"75d21b472bb7f474f5e9aee0ba85a0bc539c8e89","original_commit_id":"75d21b472bb7f474f5e9aee0ba85a0bc539c8e89","user":{"login":"rindeal","id":5360877,"avatar_url":"https://avatars.githubusercontent.com/u/5360877?v=3","gravatar_id":"","url":"https://api.github.com/users/rindeal","html_url":"https://github.com/rindeal","followers_url":"https://api.github.com/users/rindeal/followers","following_url":"https://api.github.com/users/rindeal/following{/other_user}","gists_url":"https://api.github.com/users/rindeal/gists{/gist_id}","starred_url":"https://api.github.com/users/rindeal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rindeal/subscriptions","organizations_url":"https://api.github.com/users/rindeal/orgs","repos_url":"https://api.github.com/users/rindeal/repos","events_url":"https://api.github.com/users/rindeal/events{/privacy}","received_events_url":"https://api.github.com/users/rindeal/received_events","type":"User","site_admin":false},"body":"Nevermind, I mistook it too. You still have the overhead of calling callback and creating a new array. calcTabsLen() is called quite often throughout the code and as such should be optimized.","created_at":"2015-07-27T09:56:21Z","updated_at":"2015-07-27T09:56:21Z","html_url":"https://github.com/cheeaun/max-tabs/pull/19#discussion_r35520691","pull_request_url":"https://api.github.com/repos/cheeaun/max-tabs/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/cheeaun/max-tabs/pulls/comments/35520691"},"html":{"href":"https://github.com/cheeaun/max-tabs/pull/19#discussion_r35520691"},"pull_request":{"href":"https://api.github.com/repos/cheeaun/max-tabs/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/cheeaun/max-tabs/pulls/19","id":40839191,"html_url":"https://github.com/cheeaun/max-tabs/pull/19","diff_url":"https://github.com/cheeaun/max-tabs/pull/19.diff","patch_url":"https://github.com/cheeaun/max-tabs/pull/19.patch","issue_url":"https://api.github.com/repos/cheeaun/max-tabs/issues/19","number":19,"state":"open","locked":false,"title":"major rewrite, fixes #16 and #17","user":{"login":"rindeal","id":5360877,"avatar_url":"https://avatars.githubusercontent.com/u/5360877?v=3","gravatar_id":"","url":"https://api.github.com/users/rindeal","html_url":"https://github.com/rindeal","followers_url":"https://api.github.com/users/rindeal/followers","following_url":"https://api.github.com/users/rindeal/following{/other_user}","gists_url":"https://api.github.com/users/rindeal/gists{/gist_id}","starred_url":"https://api.github.com/users/rindeal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rindeal/subscriptions","organizations_url":"https://api.github.com/users/rindeal/orgs","repos_url":"https://api.github.com/users/rindeal/repos","events_url":"https://api.github.com/users/rindeal/events{/privacy}","received_events_url":"https://api.github.com/users/rindeal/received_events","type":"User","site_admin":false},"body":"- feature #17 is not complete\r\n    - needs to set up hooks to update counters on pinned/unpinned events\r\n- code tested on FF 39.0","created_at":"2015-07-25T16:23:35Z","updated_at":"2015-07-27T09:56:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2f567ed66e8d30f44a5f66d1aca37b6afc127dd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cheeaun/max-tabs/pulls/19/commits","review_comments_url":"https://api.github.com/repos/cheeaun/max-tabs/pulls/19/comments","review_comment_url":"https://api.github.com/repos/cheeaun/max-tabs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cheeaun/max-tabs/issues/19/comments","statuses_url":"https://api.github.com/repos/cheeaun/max-tabs/statuses/75d21b472bb7f474f5e9aee0ba85a0bc539c8e89","head":{"label":"rindeal:master","ref":"master","sha":"75d21b472bb7f474f5e9aee0ba85a0bc539c8e89","user":{"login":"rindeal","id":5360877,"avatar_url":"https://avatars.githubusercontent.com/u/5360877?v=3","gravatar_id":"","url":"https://api.github.com/users/rindeal","html_url":"https://github.com/rindeal","followers_url":"https://api.github.com/users/rindeal/followers","following_url":"https://api.github.com/users/rindeal/following{/other_user}","gists_url":"https://api.github.com/users/rindeal/gists{/gist_id}","starred_url":"https://api.github.com/users/rindeal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rindeal/subscriptions","organizations_url":"https://api.github.com/users/rindeal/orgs","repos_url":"https://api.github.com/users/rindeal/repos","events_url":"https://api.github.com/users/rindeal/events{/privacy}","received_events_url":"https://api.github.com/users/rindeal/received_events","type":"User","site_admin":false},"repo":{"id":39680054,"name":"max-tabs","full_name":"rindeal/max-tabs","owner":{"login":"rindeal","id":5360877,"avatar_url":"https://avatars.githubusercontent.com/u/5360877?v=3","gravatar_id":"","url":"https://api.github.com/users/rindeal","html_url":"https://github.com/rindeal","followers_url":"https://api.github.com/users/rindeal/followers","following_url":"https://api.github.com/users/rindeal/following{/other_user}","gists_url":"https://api.github.com/users/rindeal/gists{/gist_id}","starred_url":"https://api.github.com/users/rindeal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rindeal/subscriptions","organizations_url":"https://api.github.com/users/rindeal/orgs","repos_url":"https://api.github.com/users/rindeal/repos","events_url":"https://api.github.com/users/rindeal/events{/privacy}","received_events_url":"https://api.github.com/users/rindeal/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rindeal/max-tabs","description":"A no-restart Firefox extension to set maximum number of opened tabs in a window.","fork":true,"url":"https://api.github.com/repos/rindeal/max-tabs","forks_url":"https://api.github.com/repos/rindeal/max-tabs/forks","keys_url":"https://api.github.com/repos/rindeal/max-tabs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rindeal/max-tabs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rindeal/max-tabs/teams","hooks_url":"https://api.github.com/repos/rindeal/max-tabs/hooks","issue_events_url":"https://api.github.com/repos/rindeal/max-tabs/issues/events{/number}","events_url":"https://api.github.com/repos/rindeal/max-tabs/events","assignees_url":"https://api.github.com/repos/rindeal/max-tabs/assignees{/user}","branches_url":"https://api.github.com/repos/rindeal/max-tabs/branches{/branch}","tags_url":"https://api.github.com/repos/rindeal/max-tabs/tags","blobs_url":"https://api.github.com/repos/rindeal/max-tabs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rindeal/max-tabs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rindeal/max-tabs/git/refs{/sha}","trees_url":"https://api.github.com/repos/rindeal/max-tabs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rindeal/max-tabs/statuses/{sha}","languages_url":"https://api.github.com/repos/rindeal/max-tabs/languages","stargazers_url":"https://api.github.com/repos/rindeal/max-tabs/stargazers","contributors_url":"https://api.github.com/repos/rindeal/max-tabs/contributors","subscribers_url":"https://api.github.com/repos/rindeal/max-tabs/subscribers","subscription_url":"https://api.github.com/repos/rindeal/max-tabs/subscription","commits_url":"https://api.github.com/repos/rindeal/max-tabs/commits{/sha}","git_commits_url":"https://api.github.com/repos/rindeal/max-tabs/git/commits{/sha}","comments_url":"https://api.github.com/repos/rindeal/max-tabs/comments{/number}","issue_comment_url":"https://api.github.com/repos/rindeal/max-tabs/issues/comments{/number}","contents_url":"https://api.github.com/repos/rindeal/max-tabs/contents/{+path}","compare_url":"https://api.github.com/repos/rindeal/max-tabs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rindeal/max-tabs/merges","archive_url":"https://api.github.com/repos/rindeal/max-tabs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rindeal/max-tabs/downloads","issues_url":"https://api.github.com/repos/rindeal/max-tabs/issues{/number}","pulls_url":"https://api.github.com/repos/rindeal/max-tabs/pulls{/number}","milestones_url":"https://api.github.com/repos/rindeal/max-tabs/milestones{/number}","notifications_url":"https://api.github.com/repos/rindeal/max-tabs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rindeal/max-tabs/labels{/name}","releases_url":"https://api.github.com/repos/rindeal/max-tabs/releases{/id}","created_at":"2015-07-25T09:55:32Z","updated_at":"2015-07-25T09:55:33Z","pushed_at":"2015-07-25T16:20:40Z","git_url":"git://github.com/rindeal/max-tabs.git","ssh_url":"git@github.com:rindeal/max-tabs.git","clone_url":"https://github.com/rindeal/max-tabs.git","svn_url":"https://github.com/rindeal/max-tabs","homepage":"https://addons.mozilla.org/en-US/firefox/addon/max-tabs/","size":185,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"cheeaun:master","ref":"master","sha":"7d65e51ad19c1f026e8d1a5efc909d853080ca17","user":{"login":"cheeaun","id":2296,"avatar_url":"https://avatars.githubusercontent.com/u/2296?v=3","gravatar_id":"","url":"https://api.github.com/users/cheeaun","html_url":"https://github.com/cheeaun","followers_url":"https://api.github.com/users/cheeaun/followers","following_url":"https://api.github.com/users/cheeaun/following{/other_user}","gists_url":"https://api.github.com/users/cheeaun/gists{/gist_id}","starred_url":"https://api.github.com/users/cheeaun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cheeaun/subscriptions","organizations_url":"https://api.github.com/users/cheeaun/orgs","repos_url":"https://api.github.com/users/cheeaun/repos","events_url":"https://api.github.com/users/cheeaun/events{/privacy}","received_events_url":"https://api.github.com/users/cheeaun/received_events","type":"User","site_admin":false},"repo":{"id":4433488,"name":"max-tabs","full_name":"cheeaun/max-tabs","owner":{"login":"cheeaun","id":2296,"avatar_url":"https://avatars.githubusercontent.com/u/2296?v=3","gravatar_id":"","url":"https://api.github.com/users/cheeaun","html_url":"https://github.com/cheeaun","followers_url":"https://api.github.com/users/cheeaun/followers","following_url":"https://api.github.com/users/cheeaun/following{/other_user}","gists_url":"https://api.github.com/users/cheeaun/gists{/gist_id}","starred_url":"https://api.github.com/users/cheeaun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cheeaun/subscriptions","organizations_url":"https://api.github.com/users/cheeaun/orgs","repos_url":"https://api.github.com/users/cheeaun/repos","events_url":"https://api.github.com/users/cheeaun/events{/privacy}","received_events_url":"https://api.github.com/users/cheeaun/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cheeaun/max-tabs","description":"A no-restart Firefox extension to set maximum number of opened tabs in a window.","fork":false,"url":"https://api.github.com/repos/cheeaun/max-tabs","forks_url":"https://api.github.com/repos/cheeaun/max-tabs/forks","keys_url":"https://api.github.com/repos/cheeaun/max-tabs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cheeaun/max-tabs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cheeaun/max-tabs/teams","hooks_url":"https://api.github.com/repos/cheeaun/max-tabs/hooks","issue_events_url":"https://api.github.com/repos/cheeaun/max-tabs/issues/events{/number}","events_url":"https://api.github.com/repos/cheeaun/max-tabs/events","assignees_url":"https://api.github.com/repos/cheeaun/max-tabs/assignees{/user}","branches_url":"https://api.github.com/repos/cheeaun/max-tabs/branches{/branch}","tags_url":"https://api.github.com/repos/cheeaun/max-tabs/tags","blobs_url":"https://api.github.com/repos/cheeaun/max-tabs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cheeaun/max-tabs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cheeaun/max-tabs/git/refs{/sha}","trees_url":"https://api.github.com/repos/cheeaun/max-tabs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cheeaun/max-tabs/statuses/{sha}","languages_url":"https://api.github.com/repos/cheeaun/max-tabs/languages","stargazers_url":"https://api.github.com/repos/cheeaun/max-tabs/stargazers","contributors_url":"https://api.github.com/repos/cheeaun/max-tabs/contributors","subscribers_url":"https://api.github.com/repos/cheeaun/max-tabs/subscribers","subscription_url":"https://api.github.com/repos/cheeaun/max-tabs/subscription","commits_url":"https://api.github.com/repos/cheeaun/max-tabs/commits{/sha}","git_commits_url":"https://api.github.com/repos/cheeaun/max-tabs/git/commits{/sha}","comments_url":"https://api.github.com/repos/cheeaun/max-tabs/comments{/number}","issue_comment_url":"https://api.github.com/repos/cheeaun/max-tabs/issues/comments{/number}","contents_url":"https://api.github.com/repos/cheeaun/max-tabs/contents/{+path}","compare_url":"https://api.github.com/repos/cheeaun/max-tabs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cheeaun/max-tabs/merges","archive_url":"https://api.github.com/repos/cheeaun/max-tabs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cheeaun/max-tabs/downloads","issues_url":"https://api.github.com/repos/cheeaun/max-tabs/issues{/number}","pulls_url":"https://api.github.com/repos/cheeaun/max-tabs/pulls{/number}","milestones_url":"https://api.github.com/repos/cheeaun/max-tabs/milestones{/number}","notifications_url":"https://api.github.com/repos/cheeaun/max-tabs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cheeaun/max-tabs/labels{/name}","releases_url":"https://api.github.com/repos/cheeaun/max-tabs/releases{/id}","created_at":"2012-05-24T14:04:39Z","updated_at":"2015-04-13T05:14:27Z","pushed_at":"2015-07-25T16:23:35Z","git_url":"git://github.com/cheeaun/max-tabs.git","ssh_url":"git@github.com:cheeaun/max-tabs.git","clone_url":"https://github.com/cheeaun/max-tabs.git","svn_url":"https://github.com/cheeaun/max-tabs","homepage":"https://addons.mozilla.org/en-US/firefox/addon/max-tabs/","size":235,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":13,"forks":5,"open_issues":13,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cheeaun/max-tabs/pulls/19"},"html":{"href":"https://github.com/cheeaun/max-tabs/pull/19"},"issue":{"href":"https://api.github.com/repos/cheeaun/max-tabs/issues/19"},"comments":{"href":"https://api.github.com/repos/cheeaun/max-tabs/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/cheeaun/max-tabs/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/cheeaun/max-tabs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cheeaun/max-tabs/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/cheeaun/max-tabs/statuses/75d21b472bb7f474f5e9aee0ba85a0bc539c8e89"}}}}