{"action":"created","comment":{"url":"https://api.github.com/repos/scrollback/scrollback/pulls/comments/27359667","id":27359667,"diff_hunk":"@@ -1,88 +1,73 @@\n /* jshint browser: true */\n-/* global $ */\n \n var appUtils = require(\"../../lib/app-utils.js\");\n \n module.exports = function(core, config, store) {\n-\tvar keys = [ \"view\", \"mode\" ];\n+\tvar keys = [ \"view\", \"mode\" ],\n+\t\ttypes = [ \"view\", \"mode\", \"color\", \"role\", \"embed\", \"toast\", \"canvas\" ],\n+\t\toldClassName;\n \n \t// Listen to navigate and add class names\n \tcore.on(\"statechange\", function(changes, next) {\n-\t\tvar classList, relation, value, nav, thread, form, minimize,\n-\t\t\tgetClassList = function() {\n-\t\t\t\tclassList = ((typeof classList === \"string\") ? classList : $(\"body\").attr(\"class\")) || \"\";\n+\t\tvar newClassList = [],\n+\t\t\tcurrentClassName, newClassName,\n+\t\t\trelation, value, nav, thread, form, minimize;\n \n-\t\t\t\treturn classList;\n-\t\t\t};\n+\t\tnav = store.get(\"nav\");\n \n-\t\tif (changes.nav && (\"view\" in changes.nav || \"mode\" in changes.nav || \"thread\" in changes.nav)) {\n-\t\t\tgetClassList();\n+\t\tfor (var i = 0, l = keys.length; i < l; i++) {\n+\t\t\tvalue = nav[keys[i]];\n \n-\t\t\tnav = store.get(\"nav\");\n-\n-\t\t\tfor (var i = 0, l = keys.length; i < l; i++) {\n-\t\t\t\tif (keys[i] in changes.nav) {\n-\t\t\t\t\tclassList = classList.replace(new RegExp(\"\\\\b\" + keys[i] + \"-\" + \"\\\\S+\", \"g\"), \"\");\n-\n-\t\t\t\t\tvalue = nav[keys[i]];\n-\n-\t\t\t\t\tclassList += value ? (\" \" + keys[i] + \"-\" + value) : \"\";\n-\t\t\t\t}\n+\t\t\tif (value) {\n+\t\t\t\tnewClassList.push(keys[i] + \"-\" + value);\n \t\t\t}\n+\t\t}\n \n-\t\t\tclassList = classList.replace(/\\bcolor-\\S+/g, \"\").replace(/^\\s+|\\s+$/g, \"\").trim();\n-\n-\t\t\tif (nav.mode === \"chat\" && nav.thread) {\n-\t\t\t\tthread = store.get(\"indexes\", \"threadsById\", nav.thread);\n+\t\tif (nav.mode === \"chat\" && nav.thread) {\n+\t\t\tthread = store.get(\"indexes\", \"threadsById\", nav.thread);\n \n-\t\t\t\tif (thread) {\n-\t\t\t\t\tclassList += \" color-\" + thread.color;\n-\t\t\t\t}\n+\t\t\tif (thread && thread.color) {\n+\t\t\t\tnewClassList.push(\"color-\" + thread.color);\n \t\t\t}\n \t\t}\n \n-\t\tif (changes.indexes && (\"roomUsers\" in changes.indexes || \"userRooms\" in changes.index)) {\n-\t\t\tgetClassList();\n-\n-\t\t\trelation = store.getRelation();\n-\n-\t\t\tclassList = classList.replace(/\\brole-\\S+/g, \"\").trim();\n+\t\trelation = store.getRelation();\n \n-\t\t\tif (relation && relation.role) {\n-\t\t\t\tclassList += \" role-\" + relation.role;\n-\t\t\t} else {\n-\t\t\t\tclassList += \" role-\" + (appUtils.isGuest(store.get(\"user\")) ? \"guest\" : \"user\" );\n-\t\t\t}\n+\t\tif (relation && relation.role) {\n+\t\t\tnewClassList.push(\"role-\" + relation.role);\n+\t\t} else {\n+\t\t\tnewClassList.push(\"role-\" + (appUtils.isGuest(store.get(\"user\")) ? \"guest\" : \"user\"));","path":"ui/modules/view-manager.js","position":76,"original_position":76,"commit_id":"86271ab88ddb37791e0c7a954d2fc30c4f22b7e7","original_commit_id":"86271ab88ddb37791e0c7a954d2fc30c4f22b7e7","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Line is too long.","created_at":"2015-03-29T21:56:54Z","updated_at":"2015-03-29T21:56:54Z","html_url":"https://github.com/scrollback/scrollback/pull/560#discussion_r27359667","pull_request_url":"https://api.github.com/repos/scrollback/scrollback/pulls/560","_links":{"self":{"href":"https://api.github.com/repos/scrollback/scrollback/pulls/comments/27359667"},"html":{"href":"https://github.com/scrollback/scrollback/pull/560#discussion_r27359667"},"pull_request":{"href":"https://api.github.com/repos/scrollback/scrollback/pulls/560"}}},"pull_request":{"url":"https://api.github.com/repos/scrollback/scrollback/pulls/560","id":32188697,"html_url":"https://github.com/scrollback/scrollback/pull/560","diff_url":"https://github.com/scrollback/scrollback/pull/560.diff","patch_url":"https://github.com/scrollback/scrollback/pull/560.patch","issue_url":"https://api.github.com/repos/scrollback/scrollback/issues/560","number":560,"state":"open","locked":false,"title":"Rework adding class names","user":{"login":"satya164","id":1174278,"avatar_url":"https://avatars.githubusercontent.com/u/1174278?v=3","gravatar_id":"","url":"https://api.github.com/users/satya164","html_url":"https://github.com/satya164","followers_url":"https://api.github.com/users/satya164/followers","following_url":"https://api.github.com/users/satya164/following{/other_user}","gists_url":"https://api.github.com/users/satya164/gists{/gist_id}","starred_url":"https://api.github.com/users/satya164/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/satya164/subscriptions","organizations_url":"https://api.github.com/users/satya164/orgs","repos_url":"https://api.github.com/users/satya164/repos","events_url":"https://api.github.com/users/satya164/events{/privacy}","received_events_url":"https://api.github.com/users/satya164/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-29T21:44:14Z","updated_at":"2015-03-29T21:56:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"49c2cb2420b49a38a9c60623d10b4b69dc0acaaf","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scrollback/scrollback/pulls/560/commits","review_comments_url":"https://api.github.com/repos/scrollback/scrollback/pulls/560/comments","review_comment_url":"https://api.github.com/repos/scrollback/scrollback/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scrollback/scrollback/issues/560/comments","statuses_url":"https://api.github.com/repos/scrollback/scrollback/statuses/86271ab88ddb37791e0c7a954d2fc30c4f22b7e7","head":{"label":"scrollback:views","ref":"views","sha":"86271ab88ddb37791e0c7a954d2fc30c4f22b7e7","user":{"login":"scrollback","id":4928074,"avatar_url":"https://avatars.githubusercontent.com/u/4928074?v=3","gravatar_id":"","url":"https://api.github.com/users/scrollback","html_url":"https://github.com/scrollback","followers_url":"https://api.github.com/users/scrollback/followers","following_url":"https://api.github.com/users/scrollback/following{/other_user}","gists_url":"https://api.github.com/users/scrollback/gists{/gist_id}","starred_url":"https://api.github.com/users/scrollback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrollback/subscriptions","organizations_url":"https://api.github.com/users/scrollback/orgs","repos_url":"https://api.github.com/users/scrollback/repos","events_url":"https://api.github.com/users/scrollback/events{/privacy}","received_events_url":"https://api.github.com/users/scrollback/received_events","type":"Organization","site_admin":false},"repo":{"id":11632485,"name":"scrollback","full_name":"scrollback/scrollback","owner":{"login":"scrollback","id":4928074,"avatar_url":"https://avatars.githubusercontent.com/u/4928074?v=3","gravatar_id":"","url":"https://api.github.com/users/scrollback","html_url":"https://github.com/scrollback","followers_url":"https://api.github.com/users/scrollback/followers","following_url":"https://api.github.com/users/scrollback/following{/other_user}","gists_url":"https://api.github.com/users/scrollback/gists{/gist_id}","starred_url":"https://api.github.com/users/scrollback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrollback/subscriptions","organizations_url":"https://api.github.com/users/scrollback/orgs","repos_url":"https://api.github.com/users/scrollback/repos","events_url":"https://api.github.com/users/scrollback/events{/privacy}","received_events_url":"https://api.github.com/users/scrollback/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scrollback/scrollback","description":"Embeddable cross-platform chat for communities","fork":false,"url":"https://api.github.com/repos/scrollback/scrollback","forks_url":"https://api.github.com/repos/scrollback/scrollback/forks","keys_url":"https://api.github.com/repos/scrollback/scrollback/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scrollback/scrollback/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scrollback/scrollback/teams","hooks_url":"https://api.github.com/repos/scrollback/scrollback/hooks","issue_events_url":"https://api.github.com/repos/scrollback/scrollback/issues/events{/number}","events_url":"https://api.github.com/repos/scrollback/scrollback/events","assignees_url":"https://api.github.com/repos/scrollback/scrollback/assignees{/user}","branches_url":"https://api.github.com/repos/scrollback/scrollback/branches{/branch}","tags_url":"https://api.github.com/repos/scrollback/scrollback/tags","blobs_url":"https://api.github.com/repos/scrollback/scrollback/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scrollback/scrollback/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scrollback/scrollback/git/refs{/sha}","trees_url":"https://api.github.com/repos/scrollback/scrollback/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scrollback/scrollback/statuses/{sha}","languages_url":"https://api.github.com/repos/scrollback/scrollback/languages","stargazers_url":"https://api.github.com/repos/scrollback/scrollback/stargazers","contributors_url":"https://api.github.com/repos/scrollback/scrollback/contributors","subscribers_url":"https://api.github.com/repos/scrollback/scrollback/subscribers","subscription_url":"https://api.github.com/repos/scrollback/scrollback/subscription","commits_url":"https://api.github.com/repos/scrollback/scrollback/commits{/sha}","git_commits_url":"https://api.github.com/repos/scrollback/scrollback/git/commits{/sha}","comments_url":"https://api.github.com/repos/scrollback/scrollback/comments{/number}","issue_comment_url":"https://api.github.com/repos/scrollback/scrollback/issues/comments{/number}","contents_url":"https://api.github.com/repos/scrollback/scrollback/contents/{+path}","compare_url":"https://api.github.com/repos/scrollback/scrollback/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scrollback/scrollback/merges","archive_url":"https://api.github.com/repos/scrollback/scrollback/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scrollback/scrollback/downloads","issues_url":"https://api.github.com/repos/scrollback/scrollback/issues{/number}","pulls_url":"https://api.github.com/repos/scrollback/scrollback/pulls{/number}","milestones_url":"https://api.github.com/repos/scrollback/scrollback/milestones{/number}","notifications_url":"https://api.github.com/repos/scrollback/scrollback/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scrollback/scrollback/labels{/name}","releases_url":"https://api.github.com/repos/scrollback/scrollback/releases{/id}","created_at":"2013-07-24T10:49:24Z","updated_at":"2015-03-28T09:11:38Z","pushed_at":"2015-03-29T21:56:52Z","git_url":"git://github.com/scrollback/scrollback.git","ssh_url":"git@github.com:scrollback/scrollback.git","clone_url":"https://github.com/scrollback/scrollback.git","svn_url":"https://github.com/scrollback/scrollback","homepage":null,"size":43692,"stargazers_count":422,"watchers_count":422,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":114,"mirror_url":null,"open_issues_count":33,"forks":114,"open_issues":33,"watchers":422,"default_branch":"master"}},"base":{"label":"scrollback:master","ref":"master","sha":"ae0928bdd0eff048a12a506a55f41cdcbde0978c","user":{"login":"scrollback","id":4928074,"avatar_url":"https://avatars.githubusercontent.com/u/4928074?v=3","gravatar_id":"","url":"https://api.github.com/users/scrollback","html_url":"https://github.com/scrollback","followers_url":"https://api.github.com/users/scrollback/followers","following_url":"https://api.github.com/users/scrollback/following{/other_user}","gists_url":"https://api.github.com/users/scrollback/gists{/gist_id}","starred_url":"https://api.github.com/users/scrollback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrollback/subscriptions","organizations_url":"https://api.github.com/users/scrollback/orgs","repos_url":"https://api.github.com/users/scrollback/repos","events_url":"https://api.github.com/users/scrollback/events{/privacy}","received_events_url":"https://api.github.com/users/scrollback/received_events","type":"Organization","site_admin":false},"repo":{"id":11632485,"name":"scrollback","full_name":"scrollback/scrollback","owner":{"login":"scrollback","id":4928074,"avatar_url":"https://avatars.githubusercontent.com/u/4928074?v=3","gravatar_id":"","url":"https://api.github.com/users/scrollback","html_url":"https://github.com/scrollback","followers_url":"https://api.github.com/users/scrollback/followers","following_url":"https://api.github.com/users/scrollback/following{/other_user}","gists_url":"https://api.github.com/users/scrollback/gists{/gist_id}","starred_url":"https://api.github.com/users/scrollback/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrollback/subscriptions","organizations_url":"https://api.github.com/users/scrollback/orgs","repos_url":"https://api.github.com/users/scrollback/repos","events_url":"https://api.github.com/users/scrollback/events{/privacy}","received_events_url":"https://api.github.com/users/scrollback/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scrollback/scrollback","description":"Embeddable cross-platform chat for communities","fork":false,"url":"https://api.github.com/repos/scrollback/scrollback","forks_url":"https://api.github.com/repos/scrollback/scrollback/forks","keys_url":"https://api.github.com/repos/scrollback/scrollback/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scrollback/scrollback/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scrollback/scrollback/teams","hooks_url":"https://api.github.com/repos/scrollback/scrollback/hooks","issue_events_url":"https://api.github.com/repos/scrollback/scrollback/issues/events{/number}","events_url":"https://api.github.com/repos/scrollback/scrollback/events","assignees_url":"https://api.github.com/repos/scrollback/scrollback/assignees{/user}","branches_url":"https://api.github.com/repos/scrollback/scrollback/branches{/branch}","tags_url":"https://api.github.com/repos/scrollback/scrollback/tags","blobs_url":"https://api.github.com/repos/scrollback/scrollback/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scrollback/scrollback/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scrollback/scrollback/git/refs{/sha}","trees_url":"https://api.github.com/repos/scrollback/scrollback/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scrollback/scrollback/statuses/{sha}","languages_url":"https://api.github.com/repos/scrollback/scrollback/languages","stargazers_url":"https://api.github.com/repos/scrollback/scrollback/stargazers","contributors_url":"https://api.github.com/repos/scrollback/scrollback/contributors","subscribers_url":"https://api.github.com/repos/scrollback/scrollback/subscribers","subscription_url":"https://api.github.com/repos/scrollback/scrollback/subscription","commits_url":"https://api.github.com/repos/scrollback/scrollback/commits{/sha}","git_commits_url":"https://api.github.com/repos/scrollback/scrollback/git/commits{/sha}","comments_url":"https://api.github.com/repos/scrollback/scrollback/comments{/number}","issue_comment_url":"https://api.github.com/repos/scrollback/scrollback/issues/comments{/number}","contents_url":"https://api.github.com/repos/scrollback/scrollback/contents/{+path}","compare_url":"https://api.github.com/repos/scrollback/scrollback/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scrollback/scrollback/merges","archive_url":"https://api.github.com/repos/scrollback/scrollback/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scrollback/scrollback/downloads","issues_url":"https://api.github.com/repos/scrollback/scrollback/issues{/number}","pulls_url":"https://api.github.com/repos/scrollback/scrollback/pulls{/number}","milestones_url":"https://api.github.com/repos/scrollback/scrollback/milestones{/number}","notifications_url":"https://api.github.com/repos/scrollback/scrollback/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scrollback/scrollback/labels{/name}","releases_url":"https://api.github.com/repos/scrollback/scrollback/releases{/id}","created_at":"2013-07-24T10:49:24Z","updated_at":"2015-03-28T09:11:38Z","pushed_at":"2015-03-29T21:56:52Z","git_url":"git://github.com/scrollback/scrollback.git","ssh_url":"git@github.com:scrollback/scrollback.git","clone_url":"https://github.com/scrollback/scrollback.git","svn_url":"https://github.com/scrollback/scrollback","homepage":null,"size":43692,"stargazers_count":422,"watchers_count":422,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":114,"mirror_url":null,"open_issues_count":33,"forks":114,"open_issues":33,"watchers":422,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scrollback/scrollback/pulls/560"},"html":{"href":"https://github.com/scrollback/scrollback/pull/560"},"issue":{"href":"https://api.github.com/repos/scrollback/scrollback/issues/560"},"comments":{"href":"https://api.github.com/repos/scrollback/scrollback/issues/560/comments"},"review_comments":{"href":"https://api.github.com/repos/scrollback/scrollback/pulls/560/comments"},"review_comment":{"href":"https://api.github.com/repos/scrollback/scrollback/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scrollback/scrollback/pulls/560/commits"},"statuses":{"href":"https://api.github.com/repos/scrollback/scrollback/statuses/86271ab88ddb37791e0c7a954d2fc30c4f22b7e7"}}}}