{"action":"created","comment":{"url":"https://api.github.com/repos/jphacks/Patronus/pulls/comments/86667215","pull_request_review_id":7316326,"id":86667215,"diff_hunk":"@@ -0,0 +1,115 @@\n+const BrowserWindow = require('electron').BrowserWindow;\n+\n+const ipcMain = require('electron').ipcMain;\n+const client = require('socket.io-client');\n+const socket = client.connect('http://localhost:58100');\n+\n+let parentWindow;\n+let childWindow;\n+\n+const hona = function(){\n+ipcMain.on('openURL', (e, url) => {\n+    parentWindow.loadURL(url);\n+});\n+\n+socket.on('connect', () => {\n+    console.log('connected to socket.io server');\n+\n+    socket.on('createWindow', (opt) => {\n+        createChildWindow(opt);\n+    })\n+    socket.on('closeWindow', () => {\n+        if(childWindow != null){ childWindow.close(); }\n+    })\n+    socket.on('move', (pos) => {\n+        childWindow.setPosition(pos[0], pos[1], true);\n+    })\n+    socket.on('resize', (size) => {\n+        childWindow.setSize(size[0], size[1], true);\n+    })\n+    socket.on('updated', (url) => {\n+        childWindow.loadURL(url);\n+    })\n+\n+});\n+\n+\n+function createParentWindow(url){\n+    parentWindow = new BrowserWindow({\n+        // parent: mainWindow,\n+        x: 0,\n+        y: 0,\n+        width: 800,\n+        height: 600,\n+        alwaysOnTop: true\n+    });\n+    parentWindow.loadURL(url);\n+\n+    parentWindow.on('closed', () => {\n+        socket.emit('closeWindow', {});\n+        parentWindow = null;\n+    });\n+    parentWindow.on('move', () => {\n+        socket.emit('move', parentWindow.getPosition());\n+    });\n+    parentWindow.on('resize', () => {\n+        socket.emit('resize', parentWindow.getSize());\n+    });\n+    parentWindow.on('page-title-updated', (e, title) => {\n+        const url = parentWindow.webContents.getURL();\n+        console.log(url)\n+        socket.emit('updated', url);\n+    })\n+    const opt = {\n+        x: parentWindow.getPosition()[0],\n+        y: parentWindow.getPosition()[1],\n+        width: parentWindow.getSize()[0],\n+        height: parentWindow.getSize()[1],\n+        url: \"https://www.github.com/\"\n+    }\n+    socket.emit('createWindow', opt);\n+\n+\n+    // let child = new BrowserWindow({parent: parentWindow, modal: true, show: false})\n+    // child.loadURL(`file://${__dirname}/public/test.html`)\n+    // child.once('ready-to-show', () => {\n+    //   child.show()\n+    // })\n+    // child.on('closed', function() {\n+    //     const opt = {\n+    //         x: parentWindow.getPosition()[0],\n+    //         y: parentWindow.getPosition()[1],\n+    //         width: parentWindow.getSize()[0],\n+    //         height: parentWindow.getSize()[1],\n+    //         url: \"https://www.github.com/\"\n+    //     }\n+    //     socket.emit('createWindow', opt);\n+    //     child = null;\n+    // });\n+}\n+\n+function createChildWindow(opt){\n+    console.log(opt)\n+    childWindow = new BrowserWindow({\n+        x: opt.x,\n+        y: opt.y,\n+        width: opt.width,\n+        height: opt.height,\n+        // closable: false,\n+        movable: false,\n+        resizable: false\n+    });\n+    childWindow.loadURL(opt.url);\n+    childWindow.on('closed', () => {\n+        childWindow = null;\n+    });\n+}\n+\n+return{\n+    createParentWindow: createParentWindow,\n+    createChildWindow: createChildWindow\n+}\n+\n+}();\n+\n+module.exports = hona;","path":"application/modules/shareWindow.js","position":115,"original_position":115,"commit_id":"bffe10ce2466b2bc454231d748a253859299d410","original_commit_id":"bffe10ce2466b2bc454231d748a253859299d410","user":{"login":"sztm","id":12816160,"avatar_url":"https://avatars.githubusercontent.com/u/12816160?v=3","gravatar_id":"","url":"https://api.github.com/users/sztm","html_url":"https://github.com/sztm","followers_url":"https://api.github.com/users/sztm/followers","following_url":"https://api.github.com/users/sztm/following{/other_user}","gists_url":"https://api.github.com/users/sztm/gists{/gist_id}","starred_url":"https://api.github.com/users/sztm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sztm/subscriptions","organizations_url":"https://api.github.com/users/sztm/orgs","repos_url":"https://api.github.com/users/sztm/repos","events_url":"https://api.github.com/users/sztm/events{/privacy}","received_events_url":"https://api.github.com/users/sztm/received_events","type":"User","site_admin":false},"body":"EOFの改行","created_at":"2016-11-05T15:22:52Z","updated_at":"2016-11-05T15:22:52Z","html_url":"https://github.com/jphacks/Patronus/pull/3#discussion_r86667215","pull_request_url":"https://api.github.com/repos/jphacks/Patronus/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/jphacks/Patronus/pulls/comments/86667215"},"html":{"href":"https://github.com/jphacks/Patronus/pull/3#discussion_r86667215"},"pull_request":{"href":"https://api.github.com/repos/jphacks/Patronus/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/jphacks/Patronus/pulls/3","id":92456210,"html_url":"https://github.com/jphacks/Patronus/pull/3","diff_url":"https://github.com/jphacks/Patronus/pull/3.diff","patch_url":"https://github.com/jphacks/Patronus/pull/3.patch","issue_url":"https://api.github.com/repos/jphacks/Patronus/issues/3","number":3,"state":"open","locked":false,"title":"Share","user":{"login":"mopshi","id":22879261,"avatar_url":"https://avatars.githubusercontent.com/u/22879261?v=3","gravatar_id":"","url":"https://api.github.com/users/mopshi","html_url":"https://github.com/mopshi","followers_url":"https://api.github.com/users/mopshi/followers","following_url":"https://api.github.com/users/mopshi/following{/other_user}","gists_url":"https://api.github.com/users/mopshi/gists{/gist_id}","starred_url":"https://api.github.com/users/mopshi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mopshi/subscriptions","organizations_url":"https://api.github.com/users/mopshi/orgs","repos_url":"https://api.github.com/users/mopshi/repos","events_url":"https://api.github.com/users/mopshi/events{/privacy}","received_events_url":"https://api.github.com/users/mopshi/received_events","type":"User","site_admin":false},"body":"/modules/shareWindow.jsにguiderとtraineeの共有コンテンツ用ウィンドウ","created_at":"2016-11-05T15:09:59Z","updated_at":"2016-11-05T15:26:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1110b5d2c6868633edd97360df25a1b8223e5acc","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/jphacks/Patronus/pulls/3/commits","review_comments_url":"https://api.github.com/repos/jphacks/Patronus/pulls/3/comments","review_comment_url":"https://api.github.com/repos/jphacks/Patronus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jphacks/Patronus/issues/3/comments","statuses_url":"https://api.github.com/repos/jphacks/Patronus/statuses/bffe10ce2466b2bc454231d748a253859299d410","head":{"label":"jphacks:share","ref":"share","sha":"bffe10ce2466b2bc454231d748a253859299d410","user":{"login":"jphacks","id":10176253,"avatar_url":"https://avatars.githubusercontent.com/u/10176253?v=3","gravatar_id":"","url":"https://api.github.com/users/jphacks","html_url":"https://github.com/jphacks","followers_url":"https://api.github.com/users/jphacks/followers","following_url":"https://api.github.com/users/jphacks/following{/other_user}","gists_url":"https://api.github.com/users/jphacks/gists{/gist_id}","starred_url":"https://api.github.com/users/jphacks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jphacks/subscriptions","organizations_url":"https://api.github.com/users/jphacks/orgs","repos_url":"https://api.github.com/users/jphacks/repos","events_url":"https://api.github.com/users/jphacks/events{/privacy}","received_events_url":"https://api.github.com/users/jphacks/received_events","type":"Organization","site_admin":false},"repo":{"id":67371034,"name":"Patronus","full_name":"jphacks/Patronus","owner":{"login":"jphacks","id":10176253,"avatar_url":"https://avatars.githubusercontent.com/u/10176253?v=3","gravatar_id":"","url":"https://api.github.com/users/jphacks","html_url":"https://github.com/jphacks","followers_url":"https://api.github.com/users/jphacks/followers","following_url":"https://api.github.com/users/jphacks/following{/other_user}","gists_url":"https://api.github.com/users/jphacks/gists{/gist_id}","starred_url":"https://api.github.com/users/jphacks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jphacks/subscriptions","organizations_url":"https://api.github.com/users/jphacks/orgs","repos_url":"https://api.github.com/users/jphacks/repos","events_url":"https://api.github.com/users/jphacks/events{/privacy}","received_events_url":"https://api.github.com/users/jphacks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jphacks/Patronus","description":"名古屋のチーム8","fork":false,"url":"https://api.github.com/repos/jphacks/Patronus","forks_url":"https://api.github.com/repos/jphacks/Patronus/forks","keys_url":"https://api.github.com/repos/jphacks/Patronus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jphacks/Patronus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jphacks/Patronus/teams","hooks_url":"https://api.github.com/repos/jphacks/Patronus/hooks","issue_events_url":"https://api.github.com/repos/jphacks/Patronus/issues/events{/number}","events_url":"https://api.github.com/repos/jphacks/Patronus/events","assignees_url":"https://api.github.com/repos/jphacks/Patronus/assignees{/user}","branches_url":"https://api.github.com/repos/jphacks/Patronus/branches{/branch}","tags_url":"https://api.github.com/repos/jphacks/Patronus/tags","blobs_url":"https://api.github.com/repos/jphacks/Patronus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jphacks/Patronus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jphacks/Patronus/git/refs{/sha}","trees_url":"https://api.github.com/repos/jphacks/Patronus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jphacks/Patronus/statuses/{sha}","languages_url":"https://api.github.com/repos/jphacks/Patronus/languages","stargazers_url":"https://api.github.com/repos/jphacks/Patronus/stargazers","contributors_url":"https://api.github.com/repos/jphacks/Patronus/contributors","subscribers_url":"https://api.github.com/repos/jphacks/Patronus/subscribers","subscription_url":"https://api.github.com/repos/jphacks/Patronus/subscription","commits_url":"https://api.github.com/repos/jphacks/Patronus/commits{/sha}","git_commits_url":"https://api.github.com/repos/jphacks/Patronus/git/commits{/sha}","comments_url":"https://api.github.com/repos/jphacks/Patronus/comments{/number}","issue_comment_url":"https://api.github.com/repos/jphacks/Patronus/issues/comments{/number}","contents_url":"https://api.github.com/repos/jphacks/Patronus/contents/{+path}","compare_url":"https://api.github.com/repos/jphacks/Patronus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jphacks/Patronus/merges","archive_url":"https://api.github.com/repos/jphacks/Patronus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jphacks/Patronus/downloads","issues_url":"https://api.github.com/repos/jphacks/Patronus/issues{/number}","pulls_url":"https://api.github.com/repos/jphacks/Patronus/pulls{/number}","milestones_url":"https://api.github.com/repos/jphacks/Patronus/milestones{/number}","notifications_url":"https://api.github.com/repos/jphacks/Patronus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jphacks/Patronus/labels{/name}","releases_url":"https://api.github.com/repos/jphacks/Patronus/releases{/id}","deployments_url":"https://api.github.com/repos/jphacks/Patronus/deployments","created_at":"2016-09-04T22:16:33Z","updated_at":"2016-11-05T05:05:30Z","pushed_at":"2016-11-05T15:09:59Z","git_url":"git://github.com/jphacks/Patronus.git","ssh_url":"git@github.com:jphacks/Patronus.git","clone_url":"https://github.com/jphacks/Patronus.git","svn_url":"https://github.com/jphacks/Patronus","homepage":"https://www.google.co.jp/search?q=%E5%90%8D%E5%8F%A4%E5%B1%8B%E3%83%81%E3%83%BC%E3%83%A08","size":32,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"jphacks:dev","ref":"dev","sha":"e3b8c22a5feb45ec83734829e4a1fb773961e3da","user":{"login":"jphacks","id":10176253,"avatar_url":"https://avatars.githubusercontent.com/u/10176253?v=3","gravatar_id":"","url":"https://api.github.com/users/jphacks","html_url":"https://github.com/jphacks","followers_url":"https://api.github.com/users/jphacks/followers","following_url":"https://api.github.com/users/jphacks/following{/other_user}","gists_url":"https://api.github.com/users/jphacks/gists{/gist_id}","starred_url":"https://api.github.com/users/jphacks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jphacks/subscriptions","organizations_url":"https://api.github.com/users/jphacks/orgs","repos_url":"https://api.github.com/users/jphacks/repos","events_url":"https://api.github.com/users/jphacks/events{/privacy}","received_events_url":"https://api.github.com/users/jphacks/received_events","type":"Organization","site_admin":false},"repo":{"id":67371034,"name":"Patronus","full_name":"jphacks/Patronus","owner":{"login":"jphacks","id":10176253,"avatar_url":"https://avatars.githubusercontent.com/u/10176253?v=3","gravatar_id":"","url":"https://api.github.com/users/jphacks","html_url":"https://github.com/jphacks","followers_url":"https://api.github.com/users/jphacks/followers","following_url":"https://api.github.com/users/jphacks/following{/other_user}","gists_url":"https://api.github.com/users/jphacks/gists{/gist_id}","starred_url":"https://api.github.com/users/jphacks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jphacks/subscriptions","organizations_url":"https://api.github.com/users/jphacks/orgs","repos_url":"https://api.github.com/users/jphacks/repos","events_url":"https://api.github.com/users/jphacks/events{/privacy}","received_events_url":"https://api.github.com/users/jphacks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/jphacks/Patronus","description":"名古屋のチーム8","fork":false,"url":"https://api.github.com/repos/jphacks/Patronus","forks_url":"https://api.github.com/repos/jphacks/Patronus/forks","keys_url":"https://api.github.com/repos/jphacks/Patronus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jphacks/Patronus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jphacks/Patronus/teams","hooks_url":"https://api.github.com/repos/jphacks/Patronus/hooks","issue_events_url":"https://api.github.com/repos/jphacks/Patronus/issues/events{/number}","events_url":"https://api.github.com/repos/jphacks/Patronus/events","assignees_url":"https://api.github.com/repos/jphacks/Patronus/assignees{/user}","branches_url":"https://api.github.com/repos/jphacks/Patronus/branches{/branch}","tags_url":"https://api.github.com/repos/jphacks/Patronus/tags","blobs_url":"https://api.github.com/repos/jphacks/Patronus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jphacks/Patronus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jphacks/Patronus/git/refs{/sha}","trees_url":"https://api.github.com/repos/jphacks/Patronus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jphacks/Patronus/statuses/{sha}","languages_url":"https://api.github.com/repos/jphacks/Patronus/languages","stargazers_url":"https://api.github.com/repos/jphacks/Patronus/stargazers","contributors_url":"https://api.github.com/repos/jphacks/Patronus/contributors","subscribers_url":"https://api.github.com/repos/jphacks/Patronus/subscribers","subscription_url":"https://api.github.com/repos/jphacks/Patronus/subscription","commits_url":"https://api.github.com/repos/jphacks/Patronus/commits{/sha}","git_commits_url":"https://api.github.com/repos/jphacks/Patronus/git/commits{/sha}","comments_url":"https://api.github.com/repos/jphacks/Patronus/comments{/number}","issue_comment_url":"https://api.github.com/repos/jphacks/Patronus/issues/comments{/number}","contents_url":"https://api.github.com/repos/jphacks/Patronus/contents/{+path}","compare_url":"https://api.github.com/repos/jphacks/Patronus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jphacks/Patronus/merges","archive_url":"https://api.github.com/repos/jphacks/Patronus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jphacks/Patronus/downloads","issues_url":"https://api.github.com/repos/jphacks/Patronus/issues{/number}","pulls_url":"https://api.github.com/repos/jphacks/Patronus/pulls{/number}","milestones_url":"https://api.github.com/repos/jphacks/Patronus/milestones{/number}","notifications_url":"https://api.github.com/repos/jphacks/Patronus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jphacks/Patronus/labels{/name}","releases_url":"https://api.github.com/repos/jphacks/Patronus/releases{/id}","deployments_url":"https://api.github.com/repos/jphacks/Patronus/deployments","created_at":"2016-09-04T22:16:33Z","updated_at":"2016-11-05T05:05:30Z","pushed_at":"2016-11-05T15:09:59Z","git_url":"git://github.com/jphacks/Patronus.git","ssh_url":"git@github.com:jphacks/Patronus.git","clone_url":"https://github.com/jphacks/Patronus.git","svn_url":"https://github.com/jphacks/Patronus","homepage":"https://www.google.co.jp/search?q=%E5%90%8D%E5%8F%A4%E5%B1%8B%E3%83%81%E3%83%BC%E3%83%A08","size":32,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jphacks/Patronus/pulls/3"},"html":{"href":"https://github.com/jphacks/Patronus/pull/3"},"issue":{"href":"https://api.github.com/repos/jphacks/Patronus/issues/3"},"comments":{"href":"https://api.github.com/repos/jphacks/Patronus/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/jphacks/Patronus/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/jphacks/Patronus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jphacks/Patronus/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/jphacks/Patronus/statuses/bffe10ce2466b2bc454231d748a253859299d410"}}}}
{"actor":{"display_login":"sztm"}}