{"action":"created","issue":{"url":"https://api.github.com/repos/amishiro/AmiTemplate-PHP/issues/61","repository_url":"https://api.github.com/repos/amishiro/AmiTemplate-PHP","labels_url":"https://api.github.com/repos/amishiro/AmiTemplate-PHP/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/amishiro/AmiTemplate-PHP/issues/61/comments","events_url":"https://api.github.com/repos/amishiro/AmiTemplate-PHP/issues/61/events","html_url":"https://github.com/amishiro/AmiTemplate-PHP/issues/61","id":142004225,"number":61,"title":"[viewport]指定方法のパターンを考える。","user":{"login":"amishiro","id":5564062,"avatar_url":"https://avatars.githubusercontent.com/u/5564062?v=3","gravatar_id":"","url":"https://api.github.com/users/amishiro","html_url":"https://github.com/amishiro","followers_url":"https://api.github.com/users/amishiro/followers","following_url":"https://api.github.com/users/amishiro/following{/other_user}","gists_url":"https://api.github.com/users/amishiro/gists{/gist_id}","starred_url":"https://api.github.com/users/amishiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amishiro/subscriptions","organizations_url":"https://api.github.com/users/amishiro/orgs","repos_url":"https://api.github.com/users/amishiro/repos","events_url":"https://api.github.com/users/amishiro/events{/privacy}","received_events_url":"https://api.github.com/users/amishiro/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-03-18T23:55:32Z","updated_at":"2016-03-28T23:53:10Z","closed_at":null,"body":""},"comment":{"url":"https://api.github.com/repos/amishiro/AmiTemplate-PHP/issues/comments/202631563","html_url":"https://github.com/amishiro/AmiTemplate-PHP/issues/61#issuecomment-202631563","issue_url":"https://api.github.com/repos/amishiro/AmiTemplate-PHP/issues/61","id":202631563,"user":{"login":"amishiro","id":5564062,"avatar_url":"https://avatars.githubusercontent.com/u/5564062?v=3","gravatar_id":"","url":"https://api.github.com/users/amishiro","html_url":"https://github.com/amishiro","followers_url":"https://api.github.com/users/amishiro/followers","following_url":"https://api.github.com/users/amishiro/following{/other_user}","gists_url":"https://api.github.com/users/amishiro/gists{/gist_id}","starred_url":"https://api.github.com/users/amishiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amishiro/subscriptions","organizations_url":"https://api.github.com/users/amishiro/orgs","repos_url":"https://api.github.com/users/amishiro/repos","events_url":"https://api.github.com/users/amishiro/events{/privacy}","received_events_url":"https://api.github.com/users/amishiro/received_events","type":"User","site_admin":false},"created_at":"2016-03-28T23:53:10Z","updated_at":"2016-03-28T23:53:10Z","body":"```\r\n$(function () {\r\n\r\n  //userAgent判定\r\n  var ua = {};\r\n  ua.name = window.navigator.userAgent.toLowerCase();\r\n\r\n  ua.isIE = (ua.name.indexOf('msie') >= 0 || ua.name.indexOf('trident') >= 0);\r\n  ua.isiPhone = ua.name.indexOf('iphone') >= 0;\r\n  ua.isiPod = ua.name.indexOf('ipod') >= 0;\r\n  ua.isiPad = ua.name.indexOf('ipad') >= 0;\r\n  ua.isiOS = (ua.isiPhone || ua.isiPod || ua.isiPad);\r\n  ua.isAndroid = ua.name.indexOf('android') >= 0;\r\n  ua.isTablet = (ua.isiPad || (ua.isAndroid && ua.name.indexOf('mobile') < 0));\r\n\r\n  //bodyにclass追加\r\n  if (ua.isiPad) {\r\n    $('body').addClass(\"ipad\");\r\n  }\r\n\r\n  //画面サイズ取得\r\n  var wSize = $(window).width();\r\n  var viewSize = '';\r\n\r\n  //横幅によってviewport切り替え\r\n  if (wSize >= 666) {\r\n    viewSize = 'width=980';\r\n  } else {\r\n    viewSize = 'width=device-width,initial-scale=1';\r\n  }\r\n\r\n  //viewportを差し替え\r\n  var metalist = document.getElementsByTagName('meta');\r\n  for (var i = 0; i < metalist.length; i++) {\r\n    var name = metalist[i].getAttribute('name');\r\n    if (name && name.toLowerCase() === 'viewport') {\r\n      metalist[i].setAttribute('content', viewSize);\r\n      break;\r\n    }\r\n  }\r\n\r\n  //スマホ縦横切替時にブラウザリロード\r\n  var timer = false;\r\n  $(window).on(\"orientationchange\", function () {\r\n    if (timer !== false) {\r\n      clearTimeout(timer);\r\n    }\r\n    timer = setTimeout(function () {\r\n      location.reload();\r\n    }, 100);\r\n  });\r\n\r\n});\r\n```"}}