简体   繁体   English

Google Chrome开发人员工具的源代码栏中的这些都是什么?

[英]What are all these things under the sources bar of Google Chrome developer tools?

I know this is a stupid question for an experienced developer, but I'm self-taught and really missing the gap between formality and practicality. 我知道对于一个经验丰富的开发人员来说这是一个愚蠢的问题,但是我是自学成才,并且确实缺少形式化和实用性之间的鸿沟。 I'm trying to understand some open sourced idle games that are put together with HTML, CSS, and JavaScript, and almost all of them are calling on these (what I'm assuming to be APIs) in the HTML. 我试图理解一些与HTML,CSS和JavaScript结合在一起的开源空闲游戏,并且几乎所有这些游戏都在HTML中调用这些(我假设是API)。 The raw HTML looks like this. 原始HTML看起来像这样。

<script>
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-47311210-3', 'auto');
    ga('send', 'pageview');
</script>

My question is kind of two part here. 我的问题在这里分为两部分。 I could ask you what these things are, but I know somebody doesn't want to take me on a tour down what you would consider basic development knowledge. 我可以问你这些东西是什么,但是我知道有人不想带我参观一下你认为是基础的开发知识。 So, where do I learn about this stuff? 那么,我在哪里可以学到这些东西?

I mean even if I knew what these were doing, where would I learn about more of them? 我的意思是,即使我知道这些程序在做什么,我将在哪里了解更多信息? Are they APIs? 它们是API吗? Because I hear that word thrown around a lot, but that doesn't mean I have experience with it. 因为我经常听到这个词,但这并不意味着我有经验。 If they are APIs, where would I find more of them? 如果它们是API,我在哪里可以找到更多? How would I know which APIs to use and which to not use? 我怎么知道要使用哪些API,哪些不使用? Could I theoretically make an entire program made solely from APIs? 从理论上讲,我可以制作仅由API组成的整个程序吗?

蜜蜂?和东西? Idk我在做什么。

Lastly, I just want to thank anyone who is patient enough to deal with a FNG. 最后,我只想感谢任何有足够耐心应对FNG的人。 I apologize for my ignorance. 我为自己的无知表示歉意。

The code you see starting with function(i,s,o,g,r,a,m) is Google Analytics. 您从function(i,s,o,g,r,a,m)开始看到的代码是Google Analytics(分析)。 You install this code in order to let Google gather information about your site usage and then display to you in a dashboard. 您安装此代码是为了让Google收集有关您的网站使用情况的信息,然后在仪表板上向您显示。

None of the other shown below appear to be directly needed for idle game development, well maybe jQuery. 空闲的游戏开发似乎不需要下面显示的其他任何东西,也许是jQuery。

The other groups are domains the web page loads data from. 其他组是网页从中加载数据的域。 The Google Analytics script will for example load data from apis.google.com , and the google fonts you have included will load from fonts.google.com . 例如,Google Analytics(分析)脚本将从apis.google.com加载数据,而您包含的google字体将从fonts.google.com加载。 The sources tab has conveniently grouped the resources from those domains together -- it's also quite useful for seeing if your site is loading content from spurious domains. “源”选项卡可方便地将这些域中的资源分组在一起-对于查看您的站点是否正在从虚假域中加载内容也非常有用。

Note that any JavaScript loaded from another source, could inject more link/html tags or request other resources to be loaded such as CSS or fonts. 请注意,从其他来源加载的任何JavaScript都可能注入更多的link / html标记或请求加载其他资源(例如CSS或字体)。 You can find out more from each of the individual files, but as for what loaded them you'll probably have to trawl through the files to see which file loads what. 您可以从每个单独的文件中找到更多信息,但是要了解加载了哪些文件,您可能不得不浏览文件以查看哪个文件加载了什么文件。

Also, as for your questions on "how would I know which APIs to use" — the simple answer is you don't use them. 另外,关于“我如何知道要使用哪些API”的问题,简单的答案是您不使用它们。 These are used by the other scripts you have added, and those scripts may not be under your control (such as the Google Analytics ones). 这些脚本已由您添加的其他脚本使用,这些脚本可能不受您的控制(例如Google Analytics(分析))。

To answer your title question, those are all of the sources that make up the page you are seeing. 为了回答您的标题问题,这些都是构成您所看到页面的所有资源。 They are grouped by the domain they are being hosted from. 它们按托管来源的域分组。 Some are HTML files, some are JavaScript files, and some are CSS files. 有些是HTML文件,有些是JavaScript文件,有些是CSS文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM