{"action":"created","comment":{"url":"https://api.github.com/repos/otwcode/otwarchive/pulls/comments/51048271","id":51048271,"diff_hunk":"@@ -164,69 +162,125 @@\n           error: function(xhr, status, error) {\n             element.trigger('ajax:error', [xhr, status, error]);\n           },\n-          xhrFields: {\n-            withCredentials: withCredentials\n-          },\n-          crossDomain: crossDomain\n+          crossDomain: rails.isCrossDomain(url)\n         };\n+\n+        // There is no withCredentials for IE6-8 when\n+        // \"Enable native XMLHTTP support\" is disabled\n+        if (withCredentials) {\n+          options.xhrFields = {\n+            withCredentials: withCredentials\n+          };\n+        }\n+\n         // Only pass url to `ajax` options if not blank\n         if (url) { options.url = url; }\n \n-        var jqxhr = rails.ajax(options);\n-        element.trigger('ajax:send', jqxhr);\n-        return jqxhr;\n+        return rails.ajax(options);\n       } else {\n         return false;\n       }\n     },\n \n+    // Determines if the request is a cross domain request.\n+    isCrossDomain: function(url) {\n+      var originAnchor = document.createElement('a');\n+      originAnchor.href = location.href;\n+      var urlAnchor = document.createElement('a');\n+\n+      try {\n+        urlAnchor.href = url;\n+        // This is a workaround to a IE bug.\n+        urlAnchor.href = urlAnchor.href;\n+\n+        // If URL protocol is false or is a string containing a single colon\n+        // *and* host are false, assume it is not a cross-domain request\n+        // (should only be the case for IE7 and IE compatibility mode).\n+        // Otherwise, evaluate protocol and host of the URL against the origin\n+        // protocol and host.\n+        return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) ||\n+          (originAnchor.protocol + '//' + originAnchor.host ===\n+            urlAnchor.protocol + '//' + urlAnchor.host));\n+      } catch (e) {\n+        // If there is an error parsing the URL, assume it is crossDomain.\n+        return true;\n+      }\n+    },\n+\n     // Handles \"data-method\" on links such as:\n     // <a href=\"/users/5\" data-method=\"delete\" rel=\"nofollow\" data-confirm=\"Are you sure?\">Delete</a>\n     handleMethod: function(link) {\n       var href = rails.href(link),\n         method = link.data('method'),\n         target = link.attr('target'),\n-        csrf_token = $('meta[name=csrf-token]').attr('content'),\n-        csrf_param = $('meta[name=csrf-param]').attr('content'),\n+        csrfToken = rails.csrfToken(),\n+        csrfParam = rails.csrfParam(),\n         form = $('<form method=\"post\" action=\"' + href + '\"></form>'),\n-        metadata_input = '<input name=\"_method\" value=\"' + method + '\" type=\"hidden\" />';\n+        metadataInput = '<input name=\"_method\" value=\"' + method + '\" type=\"hidden\" />';\n \n-      if (csrf_param !== undefined && csrf_token !== undefined) {\n-        metadata_input += '<input name=\"' + csrf_param + '\" value=\"' + csrf_token + '\" type=\"hidden\" />';\n+      if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) {\n+        metadataInput += '<input name=\"' + csrfParam + '\" value=\"' + csrfToken + '\" type=\"hidden\" />';\n       }\n \n       if (target) { form.attr('target', target); }\n \n-      form.hide().append(metadata_input).appendTo('body');\n+      form.hide().append(metadataInput).appendTo('body');\n       form.submit();\n     },\n \n+    // Helper function that returns form elements that match the specified CSS selector","path":"public/javascripts/rails.js","position":281,"original_position":281,"commit_id":"e2ab16833938f9231fd642637fabf3e57ae7e3c2","original_commit_id":"e2ab16833938f9231fd642637fabf3e57ae7e3c2","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":"2016-01-27T20:54:17Z","updated_at":"2016-01-27T20:54:17Z","html_url":"https://github.com/otwcode/otwarchive/pull/2327#discussion_r51048271","pull_request_url":"https://api.github.com/repos/otwcode/otwarchive/pulls/2327","_links":{"self":{"href":"https://api.github.com/repos/otwcode/otwarchive/pulls/comments/51048271"},"html":{"href":"https://github.com/otwcode/otwarchive/pull/2327#discussion_r51048271"},"pull_request":{"href":"https://api.github.com/repos/otwcode/otwarchive/pulls/2327"}}},"pull_request":{"url":"https://api.github.com/repos/otwcode/otwarchive/pulls/2327","id":57420957,"html_url":"https://github.com/otwcode/otwarchive/pull/2327","diff_url":"https://github.com/otwcode/otwarchive/pull/2327.diff","patch_url":"https://github.com/otwcode/otwarchive/pull/2327.patch","issue_url":"https://api.github.com/repos/otwcode/otwarchive/issues/2327","number":2327,"state":"open","locked":false,"title":"AO3-4465 Upgrade rails.js","user":{"login":"sarken","id":907055,"avatar_url":"https://avatars.githubusercontent.com/u/907055?v=3","gravatar_id":"","url":"https://api.github.com/users/sarken","html_url":"https://github.com/sarken","followers_url":"https://api.github.com/users/sarken/followers","following_url":"https://api.github.com/users/sarken/following{/other_user}","gists_url":"https://api.github.com/users/sarken/gists{/gist_id}","starred_url":"https://api.github.com/users/sarken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarken/subscriptions","organizations_url":"https://api.github.com/users/sarken/orgs","repos_url":"https://api.github.com/users/sarken/repos","events_url":"https://api.github.com/users/sarken/events{/privacy}","received_events_url":"https://api.github.com/users/sarken/received_events","type":"User","site_admin":false},"body":"https://otwarchive.atlassian.net/browse/AO3-4465","created_at":"2016-01-27T20:53:50Z","updated_at":"2016-01-27T20:54:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c78d32bc586223db5bf17c5e6a5ad795e4434865","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/otwcode/otwarchive/pulls/2327/commits","review_comments_url":"https://api.github.com/repos/otwcode/otwarchive/pulls/2327/comments","review_comment_url":"https://api.github.com/repos/otwcode/otwarchive/pulls/comments{/number}","comments_url":"https://api.github.com/repos/otwcode/otwarchive/issues/2327/comments","statuses_url":"https://api.github.com/repos/otwcode/otwarchive/statuses/e2ab16833938f9231fd642637fabf3e57ae7e3c2","head":{"label":"sarken:AO3-4465","ref":"AO3-4465","sha":"e2ab16833938f9231fd642637fabf3e57ae7e3c2","user":{"login":"sarken","id":907055,"avatar_url":"https://avatars.githubusercontent.com/u/907055?v=3","gravatar_id":"","url":"https://api.github.com/users/sarken","html_url":"https://github.com/sarken","followers_url":"https://api.github.com/users/sarken/followers","following_url":"https://api.github.com/users/sarken/following{/other_user}","gists_url":"https://api.github.com/users/sarken/gists{/gist_id}","starred_url":"https://api.github.com/users/sarken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarken/subscriptions","organizations_url":"https://api.github.com/users/sarken/orgs","repos_url":"https://api.github.com/users/sarken/repos","events_url":"https://api.github.com/users/sarken/events{/privacy}","received_events_url":"https://api.github.com/users/sarken/received_events","type":"User","site_admin":false},"repo":{"id":2028681,"name":"otwarchive","full_name":"sarken/otwarchive","owner":{"login":"sarken","id":907055,"avatar_url":"https://avatars.githubusercontent.com/u/907055?v=3","gravatar_id":"","url":"https://api.github.com/users/sarken","html_url":"https://github.com/sarken","followers_url":"https://api.github.com/users/sarken/followers","following_url":"https://api.github.com/users/sarken/following{/other_user}","gists_url":"https://api.github.com/users/sarken/gists{/gist_id}","starred_url":"https://api.github.com/users/sarken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sarken/subscriptions","organizations_url":"https://api.github.com/users/sarken/orgs","repos_url":"https://api.github.com/users/sarken/repos","events_url":"https://api.github.com/users/sarken/events{/privacy}","received_events_url":"https://api.github.com/users/sarken/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sarken/otwarchive","description":"The Organization for Transformative Works - Archive Project","fork":true,"url":"https://api.github.com/repos/sarken/otwarchive","forks_url":"https://api.github.com/repos/sarken/otwarchive/forks","keys_url":"https://api.github.com/repos/sarken/otwarchive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sarken/otwarchive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sarken/otwarchive/teams","hooks_url":"https://api.github.com/repos/sarken/otwarchive/hooks","issue_events_url":"https://api.github.com/repos/sarken/otwarchive/issues/events{/number}","events_url":"https://api.github.com/repos/sarken/otwarchive/events","assignees_url":"https://api.github.com/repos/sarken/otwarchive/assignees{/user}","branches_url":"https://api.github.com/repos/sarken/otwarchive/branches{/branch}","tags_url":"https://api.github.com/repos/sarken/otwarchive/tags","blobs_url":"https://api.github.com/repos/sarken/otwarchive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sarken/otwarchive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sarken/otwarchive/git/refs{/sha}","trees_url":"https://api.github.com/repos/sarken/otwarchive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sarken/otwarchive/statuses/{sha}","languages_url":"https://api.github.com/repos/sarken/otwarchive/languages","stargazers_url":"https://api.github.com/repos/sarken/otwarchive/stargazers","contributors_url":"https://api.github.com/repos/sarken/otwarchive/contributors","subscribers_url":"https://api.github.com/repos/sarken/otwarchive/subscribers","subscription_url":"https://api.github.com/repos/sarken/otwarchive/subscription","commits_url":"https://api.github.com/repos/sarken/otwarchive/commits{/sha}","git_commits_url":"https://api.github.com/repos/sarken/otwarchive/git/commits{/sha}","comments_url":"https://api.github.com/repos/sarken/otwarchive/comments{/number}","issue_comment_url":"https://api.github.com/repos/sarken/otwarchive/issues/comments{/number}","contents_url":"https://api.github.com/repos/sarken/otwarchive/contents/{+path}","compare_url":"https://api.github.com/repos/sarken/otwarchive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sarken/otwarchive/merges","archive_url":"https://api.github.com/repos/sarken/otwarchive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sarken/otwarchive/downloads","issues_url":"https://api.github.com/repos/sarken/otwarchive/issues{/number}","pulls_url":"https://api.github.com/repos/sarken/otwarchive/pulls{/number}","milestones_url":"https://api.github.com/repos/sarken/otwarchive/milestones{/number}","notifications_url":"https://api.github.com/repos/sarken/otwarchive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sarken/otwarchive/labels{/name}","releases_url":"https://api.github.com/repos/sarken/otwarchive/releases{/id}","deployments_url":"https://api.github.com/repos/sarken/otwarchive/deployments","created_at":"2011-07-11T05:42:20Z","updated_at":"2015-05-07T22:58:35Z","pushed_at":"2016-01-27T20:50:25Z","git_url":"git://github.com/sarken/otwarchive.git","ssh_url":"git@github.com:sarken/otwarchive.git","clone_url":"https://github.com/sarken/otwarchive.git","svn_url":"https://github.com/sarken/otwarchive","homepage":"http://transformativeworks.org/projects/archive","size":49059,"stargazers_count":1,"watchers_count":1,"language":"Ruby","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":1,"default_branch":"master"}},"base":{"label":"otwcode:master","ref":"master","sha":"53dd21b048988e07a4104861e0321c124f700313","user":{"login":"otwcode","id":408606,"avatar_url":"https://avatars.githubusercontent.com/u/408606?v=3","gravatar_id":"","url":"https://api.github.com/users/otwcode","html_url":"https://github.com/otwcode","followers_url":"https://api.github.com/users/otwcode/followers","following_url":"https://api.github.com/users/otwcode/following{/other_user}","gists_url":"https://api.github.com/users/otwcode/gists{/gist_id}","starred_url":"https://api.github.com/users/otwcode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otwcode/subscriptions","organizations_url":"https://api.github.com/users/otwcode/orgs","repos_url":"https://api.github.com/users/otwcode/repos","events_url":"https://api.github.com/users/otwcode/events{/privacy}","received_events_url":"https://api.github.com/users/otwcode/received_events","type":"Organization","site_admin":false},"repo":{"id":1338040,"name":"otwarchive","full_name":"otwcode/otwarchive","owner":{"login":"otwcode","id":408606,"avatar_url":"https://avatars.githubusercontent.com/u/408606?v=3","gravatar_id":"","url":"https://api.github.com/users/otwcode","html_url":"https://github.com/otwcode","followers_url":"https://api.github.com/users/otwcode/followers","following_url":"https://api.github.com/users/otwcode/following{/other_user}","gists_url":"https://api.github.com/users/otwcode/gists{/gist_id}","starred_url":"https://api.github.com/users/otwcode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otwcode/subscriptions","organizations_url":"https://api.github.com/users/otwcode/orgs","repos_url":"https://api.github.com/users/otwcode/repos","events_url":"https://api.github.com/users/otwcode/events{/privacy}","received_events_url":"https://api.github.com/users/otwcode/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/otwcode/otwarchive","description":"The Organization for Transformative Works (OTW) - Archive Of Our Own (AO3) Project","fork":false,"url":"https://api.github.com/repos/otwcode/otwarchive","forks_url":"https://api.github.com/repos/otwcode/otwarchive/forks","keys_url":"https://api.github.com/repos/otwcode/otwarchive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/otwcode/otwarchive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/otwcode/otwarchive/teams","hooks_url":"https://api.github.com/repos/otwcode/otwarchive/hooks","issue_events_url":"https://api.github.com/repos/otwcode/otwarchive/issues/events{/number}","events_url":"https://api.github.com/repos/otwcode/otwarchive/events","assignees_url":"https://api.github.com/repos/otwcode/otwarchive/assignees{/user}","branches_url":"https://api.github.com/repos/otwcode/otwarchive/branches{/branch}","tags_url":"https://api.github.com/repos/otwcode/otwarchive/tags","blobs_url":"https://api.github.com/repos/otwcode/otwarchive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/otwcode/otwarchive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/otwcode/otwarchive/git/refs{/sha}","trees_url":"https://api.github.com/repos/otwcode/otwarchive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/otwcode/otwarchive/statuses/{sha}","languages_url":"https://api.github.com/repos/otwcode/otwarchive/languages","stargazers_url":"https://api.github.com/repos/otwcode/otwarchive/stargazers","contributors_url":"https://api.github.com/repos/otwcode/otwarchive/contributors","subscribers_url":"https://api.github.com/repos/otwcode/otwarchive/subscribers","subscription_url":"https://api.github.com/repos/otwcode/otwarchive/subscription","commits_url":"https://api.github.com/repos/otwcode/otwarchive/commits{/sha}","git_commits_url":"https://api.github.com/repos/otwcode/otwarchive/git/commits{/sha}","comments_url":"https://api.github.com/repos/otwcode/otwarchive/comments{/number}","issue_comment_url":"https://api.github.com/repos/otwcode/otwarchive/issues/comments{/number}","contents_url":"https://api.github.com/repos/otwcode/otwarchive/contents/{+path}","compare_url":"https://api.github.com/repos/otwcode/otwarchive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/otwcode/otwarchive/merges","archive_url":"https://api.github.com/repos/otwcode/otwarchive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/otwcode/otwarchive/downloads","issues_url":"https://api.github.com/repos/otwcode/otwarchive/issues{/number}","pulls_url":"https://api.github.com/repos/otwcode/otwarchive/pulls{/number}","milestones_url":"https://api.github.com/repos/otwcode/otwarchive/milestones{/number}","notifications_url":"https://api.github.com/repos/otwcode/otwarchive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/otwcode/otwarchive/labels{/name}","releases_url":"https://api.github.com/repos/otwcode/otwarchive/releases{/id}","deployments_url":"https://api.github.com/repos/otwcode/otwarchive/deployments","created_at":"2011-02-07T14:50:58Z","updated_at":"2016-01-25T12:25:32Z","pushed_at":"2016-01-27T20:53:50Z","git_url":"git://github.com/otwcode/otwarchive.git","ssh_url":"git@github.com:otwcode/otwarchive.git","clone_url":"https://github.com/otwcode/otwarchive.git","svn_url":"https://github.com/otwcode/otwarchive","homepage":"http://transformativeworks.org/projects/archive","size":55174,"stargazers_count":180,"watchers_count":180,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":115,"mirror_url":null,"open_issues_count":67,"forks":115,"open_issues":67,"watchers":180,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/otwcode/otwarchive/pulls/2327"},"html":{"href":"https://github.com/otwcode/otwarchive/pull/2327"},"issue":{"href":"https://api.github.com/repos/otwcode/otwarchive/issues/2327"},"comments":{"href":"https://api.github.com/repos/otwcode/otwarchive/issues/2327/comments"},"review_comments":{"href":"https://api.github.com/repos/otwcode/otwarchive/pulls/2327/comments"},"review_comment":{"href":"https://api.github.com/repos/otwcode/otwarchive/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/otwcode/otwarchive/pulls/2327/commits"},"statuses":{"href":"https://api.github.com/repos/otwcode/otwarchive/statuses/e2ab16833938f9231fd642637fabf3e57ae7e3c2"}}}}