{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-lang/ex_doc/issues/257","labels_url":"https://api.github.com/repos/elixir-lang/ex_doc/issues/257/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/ex_doc/issues/257/comments","events_url":"https://api.github.com/repos/elixir-lang/ex_doc/issues/257/events","html_url":"https://github.com/elixir-lang/ex_doc/pull/257","id":99788414,"number":257,"title":"Load Jquery from CDN only when using a remote site","user":{"login":"eksperimental","id":9133420,"avatar_url":"https://avatars.githubusercontent.com/u/9133420?v=3","gravatar_id":"","url":"https://api.github.com/users/eksperimental","html_url":"https://github.com/eksperimental","followers_url":"https://api.github.com/users/eksperimental/followers","following_url":"https://api.github.com/users/eksperimental/following{/other_user}","gists_url":"https://api.github.com/users/eksperimental/gists{/gist_id}","starred_url":"https://api.github.com/users/eksperimental/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eksperimental/subscriptions","organizations_url":"https://api.github.com/users/eksperimental/orgs","repos_url":"https://api.github.com/users/eksperimental/repos","events_url":"https://api.github.com/users/eksperimental/events{/privacy}","received_events_url":"https://api.github.com/users/eksperimental/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-08-08T09:53:54Z","updated_at":"2015-08-10T07:47:02Z","closed_at":"2015-08-10T07:33:26Z","pull_request":{"url":"https://api.github.com/repos/elixir-lang/ex_doc/pulls/257","html_url":"https://github.com/elixir-lang/ex_doc/pull/257","diff_url":"https://github.com/elixir-lang/ex_doc/pull/257.diff","patch_url":"https://github.com/elixir-lang/ex_doc/pull/257.patch"},"body":"A javascript function \"should_request_from_CDN\" has been created to determine\r\nwhether to load from the CDN or from a local copy.\r\nThe rules are. if the page is served via http or https, and the host is\r\nnot a private network (127.x.x.x, or 192.168.x.x., or others), and\r\nthe hostname is contains a \".\"  (to avoid loading from localhost and others\r\nuser may have configured), only then, it will load from the CDN.\r\n\r\nRange of private networks I am using: https://en.wikipedia.org/wiki/Private_network#Private_IPv4_address_spaces\r\n\r\nI have used parts of this code, to determine if it's a private network\r\nhttps://gist.github.com/dperini/729294\r\n\r\nThe other change is that now it requests from \"//\" and not from \"https://\"\r\n*****\r\n\r\nA second commit removes something that was remaning from I don't know where\r\nhttps://github.com/elixir-lang/ex_doc/commit/1bede82875d7a17bfb3642a4e44835f5ab831488\r\n"},"comment":{"url":"https://api.github.com/repos/elixir-lang/ex_doc/issues/comments/129342105","html_url":"https://github.com/elixir-lang/ex_doc/pull/257#issuecomment-129342105","issue_url":"https://api.github.com/repos/elixir-lang/ex_doc/issues/257","id":129342105,"user":{"login":"eksperimental","id":9133420,"avatar_url":"https://avatars.githubusercontent.com/u/9133420?v=3","gravatar_id":"","url":"https://api.github.com/users/eksperimental","html_url":"https://github.com/eksperimental","followers_url":"https://api.github.com/users/eksperimental/followers","following_url":"https://api.github.com/users/eksperimental/following{/other_user}","gists_url":"https://api.github.com/users/eksperimental/gists{/gist_id}","starred_url":"https://api.github.com/users/eksperimental/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eksperimental/subscriptions","organizations_url":"https://api.github.com/users/eksperimental/orgs","repos_url":"https://api.github.com/users/eksperimental/repos","events_url":"https://api.github.com/users/eksperimental/events{/privacy}","received_events_url":"https://api.github.com/users/eksperimental/received_events","type":"User","site_admin":false},"created_at":"2015-08-10T07:47:02Z","updated_at":"2015-08-10T07:47:02Z","body":"@josevalim We can leave it to catch only the scheme and if there is a \".\" in the hostname.\r\n\r\n    ( protocol == 'http:' || protocol == 'https:' ) && host.indexOf('.') !== -1 )\r\n\r\nor even this, if you want to still load from CDN when developing in localhost/\r\n\r\n    ( protocol == 'http:' || protocol == 'https:' )\r\n\r\nMy point is, calling https when viewing the docs from file:// is a clear loss to me.\r\nBut we can wait :-) "}}