比如这个页面(http://static.zhihu.com/static/img/reader/zhihu-reader.js?v=1.9),还有很多都跟这个一样,找到源代码页面想看看页面是怎么实现的,无奈毫无排版和缩进,看起来一头雾水啊,这种页面的js代码要怎样阅读?还是我获取源代码的方法本来就是错的?望解答。
回复内容:
打开chrome,打开一个页面,比如目前这个页面吧 http://www.zhihu.com/question/20195561按Ctrl+shift+I 打开开发者工具,点Scripts选项卡。
下面有一个图标为两个花括号的按钮{},鼠标放上去提示是pretty print,点一下,js代码就有换行了。

其他浏览器都有类似的开发者工具。试试吧。~ http://jsbeautifier.org/ 至于阅读,淘宝之前可以看到源代码的,现在也只有生产环境能看到了。
你可以找作者索取。或者看一些开源的代码 uglifyjs -b 赞同@天祁,可以用http://jsbeautifier.org/在线格式化代码。不过作用不是很大,因为很多线上产品即使格式化了也没法看,比如你说的这个链接,是经过goog closure compiler压缩过的, advance模式。
只是偶尔用来格式化下压缩的代码方便调试,或者看一些很短的代码片段才会用这个方法。 这是压缩后的产品代码。
开发环境的代码绝不会是这个样子的。
不然也太搞笑了。 这个显然是发布代码,会去掉注释,变量名都是用abcd之类的代替而非有意义的词,提高效率,减少网络传输。最好能找到开发代码,这个就算有缩进和换行,所有的变量都是不知道干嘛的魔法变量,只能猜,读起来很空难哎 Sublime Text里有个插件JsFormat,可以格式化Js代码。
比如开始时这样:


编辑器比如 Sublime Text 2 可以用包管理直接安装插件调用进行排版
https://github.com/jdc0589/JsFormat
当然在线版本更好
不济的话找个模块找 REPL 里面加载模块把文件办了 Online JavaScript beautifier DW或VS都有格式化功能

H5 is HTML5, the fifth version of HTML. HTML5 improves the expressiveness and interactivity of web pages, introduces new features such as semantic tags, multimedia support, offline storage and Canvas drawing, and promotes the development of Web technology.

Accessibility and compliance with network standards are essential to the website. 1) Accessibility ensures that all users have equal access to the website, 2) Network standards follow to improve accessibility and consistency of the website, 3) Accessibility requires the use of semantic HTML, keyboard navigation, color contrast and alternative text, 4) Following these principles is not only a moral and legal requirement, but also amplifying user base.

The H5 tag in HTML is a fifth-level title that is used to tag smaller titles or sub-titles. 1) The H5 tag helps refine content hierarchy and improve readability and SEO. 2) Combined with CSS, you can customize the style to enhance the visual effect. 3) Use H5 tags reasonably to avoid abuse and ensure the logical content structure.

The methods of building a website in HTML5 include: 1. Use semantic tags to define the web page structure, such as, , etc.; 2. Embed multimedia content, use and tags; 3. Apply advanced functions such as form verification and local storage. Through these steps, you can create a modern web page with clear structure and rich features.

A reasonable H5 code structure allows the page to stand out among a lot of content. 1) Use semantic labels such as, etc. to organize content to make the structure clear. 2) Control the rendering effect of pages on different devices through CSS layout such as Flexbox or Grid. 3) Implement responsive design to ensure that the page adapts to different screen sizes.

The main differences between HTML5 (H5) and older versions of HTML include: 1) H5 introduces semantic tags, 2) supports multimedia content, and 3) provides offline storage functions. H5 enhances the functionality and expressiveness of web pages through new tags and APIs, such as and tags, improving user experience and SEO effects, but need to pay attention to compatibility issues.

The difference between H5 and HTML5 is: 1) HTML5 is a web page standard that defines structure and content; 2) H5 is a mobile web application based on HTML5, suitable for rapid development and marketing.

The core features of HTML5 include semantic tags, multimedia support, form enhancement, offline storage and local storage. 1. Semantic tags such as, improve code readability and SEO effect. 2. Multimedia support simplifies the process of embedding media content through and tags. 3. Form Enhancement introduces new input types and verification properties, simplifying form development. 4. Offline storage and local storage improve web page performance and user experience through ApplicationCache and localStorage.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Dreamweaver CS6
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
