{"action":"created","comment":{"url":"https://api.github.com/repos/privly/privly-safari/pulls/comments/36036348","id":36036348,"diff_hunk":"@@ -0,0 +1,52 @@\n+/**\n+ * @fileOverview This file handles the context menu item, \"Privly New Message\"\n+ *\n+ * Workflow of the script:\n+ * 1. When the user right clicks on the host page, the context information\n+ *    is sent from post_new_link.js. The validate event is fired on right\n+ *    click and the context information is checked if the content is editable.\n+ *    If the content is not editable, the Privly New Message context menu\n+ *    item is not shown.\n+ * 2. If the content is editable, the context information is passed to the\n+ *    posting_process.js file to finally open the posting application.\n+ */\n+\n+\n+/**\n+ * @namespace For functionality related to the handling of context menu\n+ */\n+var contextMenu = {\n+\n+  /**\n+   * If the content is not editable, do not show the Privly New Message\n+   * context menu item.\n+   *\n+   * @param evt the validate event that is fired\n+   *\n+   */\n+  onValidate: function(evt) {\n+    if (evt.command === \"new_message\") {\n+      if (evt.userInfo === undefined || evt.userInfo === null ||\n+          evt.userInfo.isEditable === undefined) {\n+            evt.target.disabled = true;\n+      }\n+    }\n+  },\n+\n+  /**\n+   * Pass the context information to posting_process.js\n+   *\n+   * @param evt the command event that is fired\n+   *\n+   */\n+  performCommand: function(evt) {","path":"privly.safariextension/scripts/background_scripts/handle_context_menu.js","position":42,"original_position":42,"commit_id":"2201cb729cc64d1ae9315d010cc6a182255fff00","original_commit_id":"2201cb729cc64d1ae9315d010cc6a182255fff00","user":{"login":"smcgregor","id":64780,"avatar_url":"https://avatars.githubusercontent.com/u/64780?v=3","gravatar_id":"","url":"https://api.github.com/users/smcgregor","html_url":"https://github.com/smcgregor","followers_url":"https://api.github.com/users/smcgregor/followers","following_url":"https://api.github.com/users/smcgregor/following{/other_user}","gists_url":"https://api.github.com/users/smcgregor/gists{/gist_id}","starred_url":"https://api.github.com/users/smcgregor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smcgregor/subscriptions","organizations_url":"https://api.github.com/users/smcgregor/orgs","repos_url":"https://api.github.com/users/smcgregor/repos","events_url":"https://api.github.com/users/smcgregor/events{/privacy}","received_events_url":"https://api.github.com/users/smcgregor/received_events","type":"User","site_admin":false},"body":"`onCommand` is a better name because it is consistent with the other name.","created_at":"2015-08-01T19:28:14Z","updated_at":"2015-08-01T19:28:14Z","html_url":"https://github.com/privly/privly-safari/pull/36#discussion_r36036348","pull_request_url":"https://api.github.com/repos/privly/privly-safari/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/privly/privly-safari/pulls/comments/36036348"},"html":{"href":"https://github.com/privly/privly-safari/pull/36#discussion_r36036348"},"pull_request":{"href":"https://api.github.com/repos/privly/privly-safari/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/privly/privly-safari/pulls/36","id":41082684,"html_url":"https://github.com/privly/privly-safari/pull/36","diff_url":"https://github.com/privly/privly-safari/pull/36.diff","patch_url":"https://github.com/privly/privly-safari/pull/36.patch","issue_url":"https://api.github.com/repos/privly/privly-safari/issues/36","number":36,"state":"open","locked":false,"title":"Added posting from the context menu Privly New Message","user":{"login":"sammyshj","id":4390022,"avatar_url":"https://avatars.githubusercontent.com/u/4390022?v=3","gravatar_id":"","url":"https://api.github.com/users/sammyshj","html_url":"https://github.com/sammyshj","followers_url":"https://api.github.com/users/sammyshj/followers","following_url":"https://api.github.com/users/sammyshj/following{/other_user}","gists_url":"https://api.github.com/users/sammyshj/gists{/gist_id}","starred_url":"https://api.github.com/users/sammyshj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sammyshj/subscriptions","organizations_url":"https://api.github.com/users/sammyshj/orgs","repos_url":"https://api.github.com/users/sammyshj/repos","events_url":"https://api.github.com/users/sammyshj/events{/privacy}","received_events_url":"https://api.github.com/users/sammyshj/received_events","type":"User","site_admin":false},"body":"Changes made in the PR:\r\n* Updated the privly-applications submodule to commit, https://github.com/privly/privly-applications/commit/05eb2410fa88c952319602ab618601f8d22336ff\r\n* Changed the context menu item to `Privly New Message`\r\n* Modified the previously called, `handle_command_event.js` and split the file into 2 new files, `show_popover.js` and `handle_context_menu.js`. The `show_popover.js` file now handles showing the popover. The `handle_context_menu.js` file handles the context menu events, `validate` and `command`\r\n* Added a content script `post_new_link.js`. The file stores the node on which the context menu has been clicked so that the privlyURL can later me injected in the same place\r\n* Added background script, `posting_process.js`. The file handles getting the information about the content and opens a new tab for posting the content. After the content has been posted, when it receives the privlyURL, the privlyURL is then sent back to the content script, `post_new_link.js`","created_at":"2015-07-29T02:52:31Z","updated_at":"2015-08-01T19:28:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"087fe6d69705ed8a512875db2c8f1ae854cae1d0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/privly/privly-safari/pulls/36/commits","review_comments_url":"https://api.github.com/repos/privly/privly-safari/pulls/36/comments","review_comment_url":"https://api.github.com/repos/privly/privly-safari/pulls/comments{/number}","comments_url":"https://api.github.com/repos/privly/privly-safari/issues/36/comments","statuses_url":"https://api.github.com/repos/privly/privly-safari/statuses/2201cb729cc64d1ae9315d010cc6a182255fff00","head":{"label":"sammyshj:postingprocess","ref":"postingprocess","sha":"2201cb729cc64d1ae9315d010cc6a182255fff00","user":{"login":"sammyshj","id":4390022,"avatar_url":"https://avatars.githubusercontent.com/u/4390022?v=3","gravatar_id":"","url":"https://api.github.com/users/sammyshj","html_url":"https://github.com/sammyshj","followers_url":"https://api.github.com/users/sammyshj/followers","following_url":"https://api.github.com/users/sammyshj/following{/other_user}","gists_url":"https://api.github.com/users/sammyshj/gists{/gist_id}","starred_url":"https://api.github.com/users/sammyshj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sammyshj/subscriptions","organizations_url":"https://api.github.com/users/sammyshj/orgs","repos_url":"https://api.github.com/users/sammyshj/repos","events_url":"https://api.github.com/users/sammyshj/events{/privacy}","received_events_url":"https://api.github.com/users/sammyshj/received_events","type":"User","site_admin":false},"repo":{"id":31713080,"name":"privly-safari","full_name":"sammyshj/privly-safari","owner":{"login":"sammyshj","id":4390022,"avatar_url":"https://avatars.githubusercontent.com/u/4390022?v=3","gravatar_id":"","url":"https://api.github.com/users/sammyshj","html_url":"https://github.com/sammyshj","followers_url":"https://api.github.com/users/sammyshj/followers","following_url":"https://api.github.com/users/sammyshj/following{/other_user}","gists_url":"https://api.github.com/users/sammyshj/gists{/gist_id}","starred_url":"https://api.github.com/users/sammyshj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sammyshj/subscriptions","organizations_url":"https://api.github.com/users/sammyshj/orgs","repos_url":"https://api.github.com/users/sammyshj/repos","events_url":"https://api.github.com/users/sammyshj/events{/privacy}","received_events_url":"https://api.github.com/users/sammyshj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sammyshj/privly-safari","description":"Official Safari Browser Extension","fork":true,"url":"https://api.github.com/repos/sammyshj/privly-safari","forks_url":"https://api.github.com/repos/sammyshj/privly-safari/forks","keys_url":"https://api.github.com/repos/sammyshj/privly-safari/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sammyshj/privly-safari/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sammyshj/privly-safari/teams","hooks_url":"https://api.github.com/repos/sammyshj/privly-safari/hooks","issue_events_url":"https://api.github.com/repos/sammyshj/privly-safari/issues/events{/number}","events_url":"https://api.github.com/repos/sammyshj/privly-safari/events","assignees_url":"https://api.github.com/repos/sammyshj/privly-safari/assignees{/user}","branches_url":"https://api.github.com/repos/sammyshj/privly-safari/branches{/branch}","tags_url":"https://api.github.com/repos/sammyshj/privly-safari/tags","blobs_url":"https://api.github.com/repos/sammyshj/privly-safari/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sammyshj/privly-safari/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sammyshj/privly-safari/git/refs{/sha}","trees_url":"https://api.github.com/repos/sammyshj/privly-safari/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sammyshj/privly-safari/statuses/{sha}","languages_url":"https://api.github.com/repos/sammyshj/privly-safari/languages","stargazers_url":"https://api.github.com/repos/sammyshj/privly-safari/stargazers","contributors_url":"https://api.github.com/repos/sammyshj/privly-safari/contributors","subscribers_url":"https://api.github.com/repos/sammyshj/privly-safari/subscribers","subscription_url":"https://api.github.com/repos/sammyshj/privly-safari/subscription","commits_url":"https://api.github.com/repos/sammyshj/privly-safari/commits{/sha}","git_commits_url":"https://api.github.com/repos/sammyshj/privly-safari/git/commits{/sha}","comments_url":"https://api.github.com/repos/sammyshj/privly-safari/comments{/number}","issue_comment_url":"https://api.github.com/repos/sammyshj/privly-safari/issues/comments{/number}","contents_url":"https://api.github.com/repos/sammyshj/privly-safari/contents/{+path}","compare_url":"https://api.github.com/repos/sammyshj/privly-safari/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sammyshj/privly-safari/merges","archive_url":"https://api.github.com/repos/sammyshj/privly-safari/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sammyshj/privly-safari/downloads","issues_url":"https://api.github.com/repos/sammyshj/privly-safari/issues{/number}","pulls_url":"https://api.github.com/repos/sammyshj/privly-safari/pulls{/number}","milestones_url":"https://api.github.com/repos/sammyshj/privly-safari/milestones{/number}","notifications_url":"https://api.github.com/repos/sammyshj/privly-safari/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sammyshj/privly-safari/labels{/name}","releases_url":"https://api.github.com/repos/sammyshj/privly-safari/releases{/id}","created_at":"2015-03-05T12:39:43Z","updated_at":"2015-04-27T23:41:32Z","pushed_at":"2015-08-01T13:08:33Z","git_url":"git://github.com/sammyshj/privly-safari.git","ssh_url":"git@github.com:sammyshj/privly-safari.git","clone_url":"https://github.com/sammyshj/privly-safari.git","svn_url":"https://github.com/sammyshj/privly-safari","homepage":"https://priv.ly","size":1050,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"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":"privly:master","ref":"master","sha":"646347d7971475bb1e3c3e78369b67288a02ffe4","user":{"login":"privly","id":1761186,"avatar_url":"https://avatars.githubusercontent.com/u/1761186?v=3","gravatar_id":"","url":"https://api.github.com/users/privly","html_url":"https://github.com/privly","followers_url":"https://api.github.com/users/privly/followers","following_url":"https://api.github.com/users/privly/following{/other_user}","gists_url":"https://api.github.com/users/privly/gists{/gist_id}","starred_url":"https://api.github.com/users/privly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/privly/subscriptions","organizations_url":"https://api.github.com/users/privly/orgs","repos_url":"https://api.github.com/users/privly/repos","events_url":"https://api.github.com/users/privly/events{/privacy}","received_events_url":"https://api.github.com/users/privly/received_events","type":"Organization","site_admin":false},"repo":{"id":3260595,"name":"privly-safari","full_name":"privly/privly-safari","owner":{"login":"privly","id":1761186,"avatar_url":"https://avatars.githubusercontent.com/u/1761186?v=3","gravatar_id":"","url":"https://api.github.com/users/privly","html_url":"https://github.com/privly","followers_url":"https://api.github.com/users/privly/followers","following_url":"https://api.github.com/users/privly/following{/other_user}","gists_url":"https://api.github.com/users/privly/gists{/gist_id}","starred_url":"https://api.github.com/users/privly/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/privly/subscriptions","organizations_url":"https://api.github.com/users/privly/orgs","repos_url":"https://api.github.com/users/privly/repos","events_url":"https://api.github.com/users/privly/events{/privacy}","received_events_url":"https://api.github.com/users/privly/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/privly/privly-safari","description":"Official Safari Browser Extension","fork":false,"url":"https://api.github.com/repos/privly/privly-safari","forks_url":"https://api.github.com/repos/privly/privly-safari/forks","keys_url":"https://api.github.com/repos/privly/privly-safari/keys{/key_id}","collaborators_url":"https://api.github.com/repos/privly/privly-safari/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/privly/privly-safari/teams","hooks_url":"https://api.github.com/repos/privly/privly-safari/hooks","issue_events_url":"https://api.github.com/repos/privly/privly-safari/issues/events{/number}","events_url":"https://api.github.com/repos/privly/privly-safari/events","assignees_url":"https://api.github.com/repos/privly/privly-safari/assignees{/user}","branches_url":"https://api.github.com/repos/privly/privly-safari/branches{/branch}","tags_url":"https://api.github.com/repos/privly/privly-safari/tags","blobs_url":"https://api.github.com/repos/privly/privly-safari/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/privly/privly-safari/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/privly/privly-safari/git/refs{/sha}","trees_url":"https://api.github.com/repos/privly/privly-safari/git/trees{/sha}","statuses_url":"https://api.github.com/repos/privly/privly-safari/statuses/{sha}","languages_url":"https://api.github.com/repos/privly/privly-safari/languages","stargazers_url":"https://api.github.com/repos/privly/privly-safari/stargazers","contributors_url":"https://api.github.com/repos/privly/privly-safari/contributors","subscribers_url":"https://api.github.com/repos/privly/privly-safari/subscribers","subscription_url":"https://api.github.com/repos/privly/privly-safari/subscription","commits_url":"https://api.github.com/repos/privly/privly-safari/commits{/sha}","git_commits_url":"https://api.github.com/repos/privly/privly-safari/git/commits{/sha}","comments_url":"https://api.github.com/repos/privly/privly-safari/comments{/number}","issue_comment_url":"https://api.github.com/repos/privly/privly-safari/issues/comments{/number}","contents_url":"https://api.github.com/repos/privly/privly-safari/contents/{+path}","compare_url":"https://api.github.com/repos/privly/privly-safari/compare/{base}...{head}","merges_url":"https://api.github.com/repos/privly/privly-safari/merges","archive_url":"https://api.github.com/repos/privly/privly-safari/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/privly/privly-safari/downloads","issues_url":"https://api.github.com/repos/privly/privly-safari/issues{/number}","pulls_url":"https://api.github.com/repos/privly/privly-safari/pulls{/number}","milestones_url":"https://api.github.com/repos/privly/privly-safari/milestones{/number}","notifications_url":"https://api.github.com/repos/privly/privly-safari/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/privly/privly-safari/labels{/name}","releases_url":"https://api.github.com/repos/privly/privly-safari/releases{/id}","created_at":"2012-01-24T22:48:35Z","updated_at":"2015-07-13T18:45:49Z","pushed_at":"2015-08-01T13:08:34Z","git_url":"git://github.com/privly/privly-safari.git","ssh_url":"git@github.com:privly/privly-safari.git","clone_url":"https://github.com/privly/privly-safari.git","svn_url":"https://github.com/privly/privly-safari","homepage":"https://priv.ly","size":3013,"stargazers_count":8,"watchers_count":8,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":5,"forks":4,"open_issues":5,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/privly/privly-safari/pulls/36"},"html":{"href":"https://github.com/privly/privly-safari/pull/36"},"issue":{"href":"https://api.github.com/repos/privly/privly-safari/issues/36"},"comments":{"href":"https://api.github.com/repos/privly/privly-safari/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/privly/privly-safari/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/privly/privly-safari/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/privly/privly-safari/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/privly/privly-safari/statuses/2201cb729cc64d1ae9315d010cc6a182255fff00"}}}}