{"action":"created","issue":{"url":"https://api.github.com/repos/project-hatohol/hatohol/issues/2132","repository_url":"https://api.github.com/repos/project-hatohol/hatohol","labels_url":"https://api.github.com/repos/project-hatohol/hatohol/issues/2132/labels{/name}","comments_url":"https://api.github.com/repos/project-hatohol/hatohol/issues/2132/comments","events_url":"https://api.github.com/repos/project-hatohol/hatohol/issues/2132/events","html_url":"https://github.com/project-hatohol/hatohol/pull/2132","id":138758159,"number":2132,"title":"[All page] Mistake window-close defender","user":{"login":"mmikan22","id":17230101,"avatar_url":"https://avatars.githubusercontent.com/u/17230101?v=3","gravatar_id":"","url":"https://api.github.com/users/mmikan22","html_url":"https://github.com/mmikan22","followers_url":"https://api.github.com/users/mmikan22/followers","following_url":"https://api.github.com/users/mmikan22/following{/other_user}","gists_url":"https://api.github.com/users/mmikan22/gists{/gist_id}","starred_url":"https://api.github.com/users/mmikan22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmikan22/subscriptions","organizations_url":"https://api.github.com/users/mmikan22/orgs","repos_url":"https://api.github.com/users/mmikan22/repos","events_url":"https://api.github.com/users/mmikan22/events{/privacy}","received_events_url":"https://api.github.com/users/mmikan22/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-06T06:00:52Z","updated_at":"2016-03-07T15:27:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/project-hatohol/hatohol/pulls/2132","html_url":"https://github.com/project-hatohol/hatohol/pull/2132","diff_url":"https://github.com/project-hatohol/hatohol/pull/2132.diff","patch_url":"https://github.com/project-hatohol/hatohol/pull/2132.patch"},"body":"#2052 『誤操作の抑止』\r\nのフロントエンド側実装です。\r\n\r\n以下のような仕様になっています。\r\n-サイト全体が対象。\r\n-ページ内のリンク要素などでの遷移は警告なし。\r\n-非ログイン時は警告なし。\r\n-ウインドウを閉じる、F5やCtrl+R（リロード）、戻る、進むに反応。\r\n\r\nよろしくおねがいします。"},"comment":{"url":"https://api.github.com/repos/project-hatohol/hatohol/issues/comments/193297967","html_url":"https://github.com/project-hatohol/hatohol/pull/2132#issuecomment-193297967","issue_url":"https://api.github.com/repos/project-hatohol/hatohol/issues/2132","id":193297967,"user":{"login":"mmikan22","id":17230101,"avatar_url":"https://avatars.githubusercontent.com/u/17230101?v=3","gravatar_id":"","url":"https://api.github.com/users/mmikan22","html_url":"https://github.com/mmikan22","followers_url":"https://api.github.com/users/mmikan22/followers","following_url":"https://api.github.com/users/mmikan22/following{/other_user}","gists_url":"https://api.github.com/users/mmikan22/gists{/gist_id}","starred_url":"https://api.github.com/users/mmikan22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmikan22/subscriptions","organizations_url":"https://api.github.com/users/mmikan22/orgs","repos_url":"https://api.github.com/users/mmikan22/repos","events_url":"https://api.github.com/users/mmikan22/events{/privacy}","received_events_url":"https://api.github.com/users/mmikan22/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T15:27:06Z","updated_at":"2016-03-07T15:27:06Z","body":"諸々盛り込みました。\r\nhookUnloadFlagAsync、素敵なのでいただきました！\r\n\r\n>この関数では、イベントが発生した際、falseにして、さらに非同期にtrueにしてますよね。\r\nこの動作が必要な理由\r\n\r\nまず本件の要件は、『誤操作によるページクローズの抑止』であります。\r\n$(window).on(\"beforeunload\",func)によりページクローズ前（遷移含む）にアラートを表示し、抑止することができます。\r\nしかし、このままだとページ内リンク等の『システム公式の操作による遷移』も抑止してしまうため、『誤操作ではない == ページ内操作があった』と定義し、ページ内操作時に一瞬だけ抑止ギミック実行フラグを切る仕組みをいれています。\r\nここでフラグを復活させないと誤操作を許す状態になってしまうため、setTimeoutにて復活させています。\r\n\r\n以上、よろしくおねがいします。\r\n"}}