Browser plug - Chrome statement on UserScript head (metadata) Compatibility List

1. Here UserScript means that the oil plug, or monkey Tampermonkey plug-ins supported formats are examples:

// ==UserScript==
// @name       
// @namespace  http://AsionTang.CN
// @version    0.1
// @description  
// @match      <$URL$>
// @copyright  2013+, AsionTang
// @grant none
// ==/UserScript==

The Google browser directly support script install this extension. So when writing this script, questions arise: how Google browser compatibility UserScript script?

The answer is not simple net search to get an answer, but thanks to the advantages of open source, direct reading Chrome source code to get the answer:

Chrome relevant reference source address: the Log of /trunk/src/chrome/browser/extensions/user_script_master.cc

The current version can be seen the following code to 201855:

 static const base::StringPiece kUserScriptBegin("// ==UserScript==");
72      static const base::StringPiece kUserScriptEng("// ==/UserScript==");
73      static const base::StringPiece kNamespaceDeclaration("// @namespace");
74      static const base::StringPiece kNameDeclaration("// @name");
75      static const base::StringPiece kVersionDeclaration("// @version");
76      static const base::StringPiece kDescriptionDeclaration("// @description");
77      static const base::StringPiece kIncludeDeclaration("// @include");
78      static const base::StringPiece kExcludeDeclaration("// @exclude");
79      static const base::StringPiece kMatchDeclaration("// @match");
80      static const base::StringPiece kExcludeMatchDeclaration("// @exclude_match");
81      static const base::StringPiece kRunAtDeclaration("// @run-at");
82      static const base::StringPiece kRunAtDocumentStartValue("document-start");
83      static const base::StringPiece kRunAtDocumentEndValue("document-end");
84      static const base::StringPiece kRunAtDocumentIdleValue("document-idle");

Finally, there is one in the source:

// TODO(aa): Handle more types of metadata.

So be seen, there are a lot of UserScript current head of the statement was not supported.

 

Reproduced in: https: //www.cnblogs.com/AsionTang/p/3442969.html

Guess you like

Origin blog.csdn.net/weixin_33923148/article/details/93270657