﻿{"id":1386,"date":"2026-10-19T19:41:13","date_gmt":"2026-10-19T11:41:13","guid":{"rendered":"https:\/\/www.tansoo.cn\/?p=1386"},"modified":"2026-10-19T19:41:13","modified_gmt":"2026-10-19T11:41:13","slug":"phpbb-112","status":"publish","type":"post","link":"https:\/\/www.tansoo.cn\/?p=1386","title":{"rendered":"\u66f4\u6362Home Assistant\u7684\u5730\u56fe\u4e3a\u9ad8\u5fb7\u5730\u56fe\uff0c\u5e76\u63a5\u5165Traccar\u670d\u52a1"},"content":{"rendered":"<p>\u770b\u4e86https:\/\/bbs.hassbian.com\/thread-29564-1-3.html\u8fd9\u4e2a\u5e16\u5b50\uff0c\u8fd9\u662f\u4e00\u4e2a\u975e\u5e38\u5de7\u5999\u7684\u201c\u5077\u6881\u6362\u67f1\u201d\u65b9\u6848\uff0c\u7528\u4e8e\u5728 Home Assistant \u7684\u5730\u56fe\u5361\u7247\u4e2d\u5c06 CartoCDN \u66ff\u6362\u4e3a\u5929\u5730\u56fe\uff0c\u5e76\u652f\u6301\u9ad8\u7f29\u653e\u7ea7\u522b\u7684\u964d\u7ea7\u6a21\u62df\u3002\u5b83\u901a\u8fc7 MutationObserver \u5b9e\u73b0\u4e86\u5bf9 Shadow DOM \u7684\u5b8c\u6574\u652f\u6301\uff0c\u9002\u7528\u4e8e\u524d\u7aef\u65e0\u6cd5\u76f4\u63a5\u4fee\u6539\u5730\u56fe\u914d\u7f6e\u7684\u573a\u666f\u3002<\/p>\n<div class=\"inline-attachment\"><!-- ia0 -->a.jpeg<!-- ia0 --><\/div>\n<p><span style=\"font-size:150%;line-height:116%\"><span style=\"color:#0000FF\">\u5728\u5b83\u7684\u65b9\u6848\u539f\u7406\u57fa\u7840\u4e0a\uff0c\u6211\u6539\u5199\u4e3a\u9ad8\u5fb7\u74e6\u7247\u5730\u56fe\u7684\u4ee3\u7801\uff0c\u5728HA\u7684\u914d\u7f6e\u76ee\u5f55config\u4e0b\u65b0\u5efawww\u76ee\u5f55\uff0c\u5c06hass_gaode.js\u590d\u5236\u5230www\u76ee\u5f55\u4e0b\u3002<\/span><\/span><br \/>\n\u4fee\u6539configuration.yaml\u6587\u4ef6<\/p>\n<div class=\"codebox_plus_wrap\">\n<div class=\"codebox_plus_header\"><strong>Code: <\/strong><a href=\"#\" onclick=\"codebox_plus_select(this, 1); return false;\">[\u5168\u9009]<\/a>&nbsp;<a href=\"#\" onclick=\"codebox_plus_toggle(this, 1); return false;\">[Expand\/Collapse]<\/a><\/div>\n<div>\n<div style=\"display: inline;\">\n<div class=\"ini\" style=\"font-family:monospace;\">\n<ol>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"># Loads default set of integrations. Do not remove.<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">default_config:<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"># Load frontend themes from the themes folder<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">frontend:<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; themes: !include_dir_merge_named themes<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"># *** \u6dfb\u52a0\u4e0b\u9762<span style=\"\">2<\/span>\u884c\u4ee3\u7801 ***<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; extra_module_url:<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp;&#8211; \/local\/hass_gaode.js<\/div>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"codebox_plus_footer\">GeSHi &copy; Codebox Plus Extension<\/div>\n<\/div>\n<p>hass_gaode.js \u6587\u4ef6\u5185\u5bb9\uff1a<\/p>\n<div class=\"codebox_plus_wrap\">\n<div class=\"codebox_plus_header\"><strong>Code: <\/strong><a href=\"#\" onclick=\"codebox_plus_select(this, 1); return false;\">[\u5168\u9009]<\/a>&nbsp;<a href=\"#\" onclick=\"codebox_plus_toggle(this, 1); return false;\">[Expand\/Collapse]<\/a><\/div>\n<div>\n<div style=\"display: inline;\">\n<div class=\"javascript\" style=\"font-family:monospace;\">\n<ol>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">\/\/ ========== &nbsp;config &nbsp;==========<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #000066; font-weight: bold;\">const<\/span> GAODE_KEY <span style=\"color: #339933;\">=<\/span> <span style=\"color: #3366CC;\">&#8217;21b3a11e940d284eecb6b66bdd090fcc&#8217;<\/span><span style=\"color: #339933;\">;<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"color: #006600; font-style: italic;\">\/\/ \u2190\u2190\u2190 \u6362\u6210\u81ea\u5df1\u7684<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #000066; font-weight: bold;\">const<\/span> MAX_Z &nbsp; &nbsp; <span style=\"color: #339933;\">=<\/span> <span style=\"color: #CC0000;\">18<\/span><span style=\"color: #339933;\">;<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #006600; font-style: italic;\">\/\/ \u9ad8\u5fb7\u6700\u5927\u652f\u6301 18 \u7ea7<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #000066; font-weight: bold;\">const<\/span> TILE_SIZE <span style=\"color: #339933;\">=<\/span> <span style=\"color: #CC0000;\">256<\/span><span style=\"color: #339933;\">;<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"color: #006600; font-style: italic;\">\/\/ \u6807\u51c6 256px \u74e6\u7247<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">\/\/ =================================<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">\/* \u964d\u7ea7\u7b97\u6cd5\uff1a\u628a\u9ad8 z \u6620\u5c04\u5230 maxZoom\uff0c\u5e76\u8fd4\u56de\u7f29\u653e\/\u504f\u79fb\u91cf *\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #000066; font-weight: bold;\">function<\/span> downgradeTile<span style=\"color: #009900;\">&#40;<\/span>x<span style=\"color: #339933;\">,<\/span> y<span style=\"color: #339933;\">,<\/span> z<span style=\"color: #339933;\">,<\/span> maxZoom<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>z <span style=\"color: #339933;\">&lt;=<\/span> maxZoom<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">return<\/span> <span style=\"color: #009900;\">&#123;<\/span> srcX<span style=\"color: #339933;\">:<\/span> x<span style=\"color: #339933;\">,<\/span> srcY<span style=\"color: #339933;\">:<\/span> y<span style=\"color: #339933;\">,<\/span> srcZ<span style=\"color: #339933;\">:<\/span> z<span style=\"color: #339933;\">,<\/span> scale<span style=\"color: #339933;\">:<\/span> <span style=\"color: #CC0000;\">1<\/span><span style=\"color: #339933;\">,<\/span> dx<span style=\"color: #339933;\">:<\/span> <span style=\"color: #CC0000;\">0<\/span><span style=\"color: #339933;\">,<\/span> dy<span style=\"color: #339933;\">:<\/span> <span style=\"color: #CC0000;\">0<\/span> <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> scale <span style=\"color: #339933;\">=<\/span> <span style=\"color: #CC0000;\">2<\/span> <span style=\"color: #339933;\">**<\/span> <span style=\"color: #009900;\">&#40;<\/span>z <span style=\"color: #339933;\">&#8211;<\/span> maxZoom<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> srcX &nbsp;<span style=\"color: #339933;\">=<\/span> <span style=\"\">Math<\/span>.<span style=\"color: #660066;\">floor<\/span><span style=\"color: #009900;\">&#40;<\/span>x <span style=\"color: #339933;\">\/<\/span> scale<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> srcY &nbsp;<span style=\"color: #339933;\">=<\/span> <span style=\"\">Math<\/span>.<span style=\"color: #660066;\">floor<\/span><span style=\"color: #009900;\">&#40;<\/span>y <span style=\"color: #339933;\">\/<\/span> scale<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> offsetX <span style=\"color: #339933;\">=<\/span> <span style=\"color: #009900;\">&#40;<\/span>x <span style=\"color: #339933;\">%<\/span> scale<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #339933;\">*<\/span> TILE_SIZE <span style=\"color: #339933;\">\/<\/span> scale<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> offsetY <span style=\"color: #339933;\">=<\/span> <span style=\"color: #009900;\">&#40;<\/span>y <span style=\"color: #339933;\">%<\/span> scale<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #339933;\">*<\/span> TILE_SIZE <span style=\"color: #339933;\">\/<\/span> scale<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">return<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; srcX<span style=\"color: #339933;\">,<\/span> srcY<span style=\"color: #339933;\">,<\/span> srcZ<span style=\"color: #339933;\">:<\/span> maxZoom<span style=\"color: #339933;\">,<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; scale<span style=\"color: #339933;\">,<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; dx<span style=\"color: #339933;\">:<\/span> <span style=\"color: #339933;\">&#8211;<\/span>offsetX <span style=\"color: #339933;\">*<\/span> scale<span style=\"color: #339933;\">,<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; dy<span style=\"color: #339933;\">:<\/span> <span style=\"color: #339933;\">&#8211;<\/span>offsetY <span style=\"color: #339933;\">*<\/span> scale<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">\/* \u9ad8\u5fb7\u4f7f\u7528 4 \u4e2a\u57df\u540d\u505a\u8d1f\u8f7d\u5747\u8861 *\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">let subDomain <span style=\"color: #339933;\">=<\/span> <span style=\"color: #CC0000;\">0<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #000066; font-weight: bold;\">function<\/span> nextSub<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span> subDomain <span style=\"color: #339933;\">=<\/span> <span style=\"color: #009900;\">&#40;<\/span>subDomain <span style=\"color: #339933;\">+<\/span> <span style=\"color: #CC0000;\">1<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #339933;\">%<\/span> <span style=\"color: #CC0000;\">4<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #000066; font-weight: bold;\">return<\/span> `wprd0$<span style=\"color: #009900;\">&#123;<\/span>subDomain <span style=\"color: #339933;\">+<\/span> <span style=\"color: #CC0000;\">1<\/span><span style=\"color: #009900;\">&#125;<\/span>`<span style=\"color: #339933;\">;<\/span> <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">\/* \u751f\u6210\u9ad8\u5fb7\u74e6\u7247\u5730\u5740<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">&nbsp; &nbsp;layer: vec \u77e2\u91cf\u5e95\u56fe &nbsp;| &nbsp;cva \u77e2\u91cf\u6ce8\u8bb0 &nbsp;| &nbsp;img \u5f71\u50cf\u5e95\u56fe &nbsp;| &nbsp;cia \u5f71\u50cf\u6ce8\u8bb0<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">*\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #000066; font-weight: bold;\">function<\/span> buildGaodeUrl<span style=\"color: #009900;\">&#40;<\/span>x<span style=\"color: #339933;\">,<\/span> y<span style=\"color: #339933;\">,<\/span> z<span style=\"color: #339933;\">,<\/span> layer<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">return<\/span> `https<span style=\"color: #339933;\">:<\/span><span style=\"color: #006600; font-style: italic;\">\/\/${nextSub()}.is.autonavi.com\/appmaptile?style=7&amp;tiletype=${layer}&amp;x=${x}&amp;y=${y}&amp;z=${z}&amp;lang=zh_cn&amp;size=1&amp;scale=1&amp;key=${GAODE_KEY}`;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">\/* \u8bb0\u5f55\u5df2\u964d\u7ea7\u8fc7\u7684 key\uff0c\u9632\u6b62\u91cd\u590d\u7ed8\u5236 *\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #000066; font-weight: bold;\">const<\/span> doneSet <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000066; font-weight: bold;\">new<\/span> Set<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">\/* \u521b\u5efa\u6ce8\u8bb0\u5c42 &lt;img&gt; *\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #000066; font-weight: bold;\">function<\/span> createCvaImg<span style=\"color: #009900;\">&#40;<\/span>cvaSrc<span style=\"color: #339933;\">,<\/span> templateImg<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> img &nbsp; &nbsp; &nbsp; <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000066; font-weight: bold;\">new<\/span> Image<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; img.<span style=\"color: #660066;\">src<\/span> &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #339933;\">=<\/span> cvaSrc<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; img.<span style=\"color: #660066;\">className<\/span> &nbsp; <span style=\"color: #339933;\">=<\/span> <span style=\"color: #3366CC;\">&#8216;leaflet-tile&#8217;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; img.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">cssText<\/span> <span style=\"color: #339933;\">=<\/span> templateImg.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">cssText<\/span><span style=\"color: #339933;\">;<\/span> &nbsp; <span style=\"color: #006600; font-style: italic;\">\/\/ \u590d\u5236\u4f4d\u7f6e\/\u53d8\u6362<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; img.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">mixBlendMode<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #3366CC;\">&#8216;unset&#8217;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; img.<span style=\"color: #660066;\">onload<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #339933;\">=&gt;<\/span> img.<span style=\"color: #660066;\">classList<\/span>.<span style=\"color: #660066;\">add<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;leaflet-tile-loaded&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">return<\/span> img<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">\/* \u6838\u5fc3\u66ff\u6362\u51fd\u6570 *\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #000066; font-weight: bold;\">function<\/span> transformCartoImg<span style=\"color: #009900;\">&#40;<\/span>img<span style=\"color: #339933;\">,<\/span> extraImgs<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> src <span style=\"color: #339933;\">=<\/span> img.<span style=\"color: #660066;\">src<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #339933;\">!<\/span>src.<span style=\"color: #660066;\">includes<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;basemaps.cartocdn.com&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #000066; font-weight: bold;\">return<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> m <span style=\"color: #339933;\">=<\/span> src.<span style=\"color: #660066;\">match<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009966; font-style: italic;\">\/\\\/(\\d+)\\\/(\\d+)\\\/(\\d+)(?:@2x)?\\.png\/<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #339933;\">!<\/span>m<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #000066; font-weight: bold;\">return<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; let <span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #339933;\">,<\/span> z<span style=\"color: #339933;\">,<\/span> x<span style=\"color: #339933;\">,<\/span> y<span style=\"color: #009900;\">&#93;<\/span> <span style=\"color: #339933;\">=<\/span> m.<span style=\"color: #660066;\">map<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"\">Number<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #006600; font-style: italic;\">\/* 1. \u9700\u8981\u964d\u7ea7\u7684\u60c5\u51b5 *\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>z <span style=\"color: #339933;\">&gt;<\/span> MAX_Z<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> <span style=\"color: #009900;\">&#123;<\/span> srcX<span style=\"color: #339933;\">,<\/span> srcY<span style=\"color: #339933;\">,<\/span> srcZ<span style=\"color: #339933;\">,<\/span> scale<span style=\"color: #339933;\">,<\/span> dx<span style=\"color: #339933;\">,<\/span> dy <span style=\"color: #009900;\">&#125;<\/span> <span style=\"color: #339933;\">=<\/span> downgradeTile<span style=\"color: #009900;\">&#40;<\/span>x<span style=\"color: #339933;\">,<\/span> y<span style=\"color: #339933;\">,<\/span> z<span style=\"color: #339933;\">,<\/span> MAX_Z<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> key <span style=\"color: #339933;\">=<\/span> `$<span style=\"color: #009900;\">&#123;<\/span>srcX<span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #339933;\">,<\/span>$<span style=\"color: #009900;\">&#123;<\/span>srcY<span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #339933;\">,<\/span>$<span style=\"color: #009900;\">&#123;<\/span>srcZ<span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #339933;\">,<\/span>$<span style=\"color: #009900;\">&#123;<\/span>z<span style=\"color: #009900;\">&#125;<\/span>`<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>doneSet.<span style=\"color: #660066;\">has<\/span><span style=\"color: #009900;\">&#40;<\/span>key<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=\"color: #006600; font-style: italic;\">\/\/ \u5df2\u5904\u7406\u8fc7\uff0c\u76f4\u63a5\u9690\u85cf<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; img.<span style=\"color: #660066;\">src<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #3366CC;\">&#8216;data:image\/gif;base64,R0lGODlhAQABAAD\/ACwAAAAAAQABAAACADs=&#8217;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; img.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">display<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #3366CC;\">&#8216;none&#8217;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">return<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; doneSet.<span style=\"color: #660066;\">add<\/span><span style=\"color: #009900;\">&#40;<\/span>key<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; img.<span style=\"color: #660066;\">downgradeKey<\/span> <span style=\"color: #339933;\">=<\/span> key<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; x <span style=\"color: #339933;\">=<\/span> srcX<span style=\"color: #339933;\">;<\/span> y <span style=\"color: #339933;\">=<\/span> srcY<span style=\"color: #339933;\">;<\/span> z <span style=\"color: #339933;\">=<\/span> srcZ<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #006600; font-style: italic;\">\/* \u53e0\u52a0\u7f29\u653e+\u504f\u79fb\u5230\u539f\u6709 transform \u4e0a *\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; let t <span style=\"color: #339933;\">=<\/span> img.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">transform<\/span> <span style=\"color: #339933;\">||<\/span> <span style=\"color: #3366CC;\">&#8221;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>t.<span style=\"color: #660066;\">includes<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;translate3d(&#8216;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> <span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #339933;\">,<\/span> tx<span style=\"color: #339933;\">,<\/span> ty<span style=\"color: #009900;\">&#93;<\/span> <span style=\"color: #339933;\">=<\/span> t.<span style=\"color: #660066;\">match<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009966; font-style: italic;\">\/translate3d\\(([^,]+),\\s*([^,]+)\/<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #339933;\">||<\/span> <span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #009900;\">&#93;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>tx <span style=\"color: #339933;\">!==<\/span> <span style=\"color: #003366; font-weight: bold;\">undefined<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> nx <span style=\"color: #339933;\">=<\/span> parseFloat<span style=\"color: #009900;\">&#40;<\/span>tx<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #339933;\">+<\/span> dx<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> ny <span style=\"color: #339933;\">=<\/span> parseFloat<span style=\"color: #009900;\">&#40;<\/span>ty<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #339933;\">+<\/span> dy<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; t <span style=\"color: #339933;\">=<\/span> t.<span style=\"color: #660066;\">replace<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009966; font-style: italic;\">\/translate3d\\([^)]+\\)\/<\/span><span style=\"color: #339933;\">,<\/span> `translate3d<span style=\"color: #009900;\">&#40;<\/span>$<span style=\"color: #009900;\">&#123;<\/span>nx<span style=\"color: #009900;\">&#125;<\/span>px<span style=\"color: #339933;\">,<\/span> $<span style=\"color: #009900;\">&#123;<\/span>ny<span style=\"color: #009900;\">&#125;<\/span>px<span style=\"color: #339933;\">,<\/span> 0px<span style=\"color: #009900;\">&#41;<\/span>`<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #339933;\">!<\/span>t.<span style=\"color: #660066;\">includes<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;scale(&#8216;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span> t <span style=\"color: #339933;\">+=<\/span> ` scale<span style=\"color: #009900;\">&#40;<\/span>$<span style=\"color: #009900;\">&#123;<\/span>scale<span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #009900;\">&#41;<\/span>`<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; img.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">transform<\/span> <span style=\"color: #339933;\">=<\/span> t<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; img.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">transformOrigin<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #3366CC;\">&#8216;top left&#8217;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; img.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">width<\/span> &nbsp;<span style=\"color: #339933;\">=<\/span> TILE_SIZE <span style=\"color: #339933;\">+<\/span> <span style=\"color: #3366CC;\">&#8216;px&#8217;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; img.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">height<\/span> <span style=\"color: #339933;\">=<\/span> TILE_SIZE <span style=\"color: #339933;\">+<\/span> <span style=\"color: #3366CC;\">&#8216;px&#8217;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #006600; font-style: italic;\">\/* 2. \u7ec4\u88c5\u9ad8\u5fb7\u5730\u5740 *\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> vecSrc <span style=\"color: #339933;\">=<\/span> buildGaodeUrl<span style=\"color: #009900;\">&#40;<\/span>x<span style=\"color: #339933;\">,<\/span> y<span style=\"color: #339933;\">,<\/span> z<span style=\"color: #339933;\">,<\/span> <span style=\"color: #3366CC;\">&#8216;vec&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> cvaSrc <span style=\"color: #339933;\">=<\/span> buildGaodeUrl<span style=\"color: #009900;\">&#40;<\/span>x<span style=\"color: #339933;\">,<\/span> y<span style=\"color: #339933;\">,<\/span> z<span style=\"color: #339933;\">,<\/span> <span style=\"color: #3366CC;\">&#8216;cva&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #006600; font-style: italic;\">\/* 3. \u6ce8\u5165 DOM *\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>extraImgs<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #006600; font-style: italic;\">\/\/ \u6765\u81ea appendChild \u62e6\u622a<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> cvaImg <span style=\"color: #339933;\">=<\/span> createCvaImg<span style=\"color: #009900;\">&#40;<\/span>cvaSrc<span style=\"color: #339933;\">,<\/span> img<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; cvaImg.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">transformOrigin<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #3366CC;\">&#8216;top left&#8217;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; extraImgs.<span style=\"color: #660066;\">push<\/span><span style=\"color: #009900;\">&#40;<\/span>cvaImg<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; img.<span style=\"color: #660066;\">src<\/span> <span style=\"color: #339933;\">=<\/span> vecSrc<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #009900;\">&#125;<\/span> <span style=\"color: #000066; font-weight: bold;\">else<\/span> <span style=\"color: #009900;\">&#123;<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #006600; font-style: italic;\">\/\/ \u76f4\u63a5\u4fee\u6539<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; img.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">backgroundImage<\/span> <span style=\"color: #339933;\">=<\/span> `url<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&quot;${vecSrc}&quot;<\/span><span style=\"color: #009900;\">&#41;<\/span>`<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; img.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">backgroundSize<\/span> &nbsp;<span style=\"color: #339933;\">=<\/span> `$<span style=\"color: #009900;\">&#123;<\/span>TILE_SIZE<span style=\"color: #009900;\">&#125;<\/span>px $<span style=\"color: #009900;\">&#123;<\/span>TILE_SIZE<span style=\"color: #009900;\">&#125;<\/span>px`<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; img.<span style=\"color: #660066;\">src<\/span> <span style=\"color: #339933;\">=<\/span> cvaSrc<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; console.<span style=\"color: #660066;\">debug<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;[\u9ad8\u5fb7\u66ff\u6362]&#8217;<\/span><span style=\"color: #339933;\">,<\/span> src<span style=\"color: #339933;\">,<\/span> <span style=\"color: #3366CC;\">&#8216;\u2192&#8217;<\/span><span style=\"color: #339933;\">,<\/span> vecSrc<span style=\"color: #339933;\">,<\/span> <span style=\"color: #3366CC;\">&#8216;+\u6ce8\u8bb0&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #006600; font-style: italic;\">\/* ========== &nbsp;DOM \u76d1\u542c\u90e8\u5206\uff08\u4e0e\u539f\u811a\u672c\u4e00\u81f4\uff0c\u4ec5\u51fd\u6570\u540d\u66ff\u6362\uff09 ========== *\/<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #000066; font-weight: bold;\">function<\/span> initDomObserver<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> _appendChild <span style=\"color: #339933;\">=<\/span> Element.<span style=\"color: #000066; font-weight: bold;\">prototype<\/span>.<span style=\"color: #660066;\">appendChild<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">function<\/span> onAdd<span style=\"color: #009900;\">&#40;<\/span>node<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>node.<span style=\"color: #660066;\">nodeType<\/span> <span style=\"color: #339933;\">!==<\/span> <span style=\"color: #CC0000;\">1<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #000066; font-weight: bold;\">return<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>node.<span style=\"color: #660066;\">classList<\/span>.<span style=\"color: #660066;\">contains<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;leaflet-layer&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; node.<span style=\"color: #660066;\">appendChild<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000066; font-weight: bold;\">function<\/span> <span style=\"color: #009900;\">&#40;<\/span>child<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>child.<span style=\"color: #660066;\">classList<\/span><span style=\"color: #339933;\">?<\/span>.<span style=\"color: #660066;\">contains<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;leaflet-tile-container&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; child.<span style=\"color: #660066;\">querySelectorAll<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;img&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span>.<span style=\"color: #660066;\">forEach<\/span><span style=\"color: #009900;\">&#40;<\/span>transformCartoImg<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; child.<span style=\"color: #660066;\">appendChild<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000066; font-weight: bold;\">function<\/span> <span style=\"color: #009900;\">&#40;<\/span>frag<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> addArr <span style=\"color: #339933;\">=<\/span> <span style=\"color: #009900;\">&#91;<\/span><span style=\"color: #009900;\">&#93;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #009900;\">&#91;<\/span>&#8230;<span style=\"color: #660066;\">frag<\/span>.<span style=\"color: #660066;\">children<\/span><span style=\"color: #009900;\">&#93;<\/span>.<span style=\"color: #660066;\">forEach<\/span><span style=\"color: #009900;\">&#40;<\/span>n <span style=\"color: #339933;\">=&gt;<\/span> n.<span style=\"color: #660066;\">tagName<\/span> <span style=\"color: #339933;\">===<\/span> <span style=\"color: #3366CC;\">&#8216;IMG&#8217;<\/span> <span style=\"color: #339933;\">&amp;&amp;<\/span> transformCartoImg<span style=\"color: #009900;\">&#40;<\/span>n<span style=\"color: #339933;\">,<\/span> addArr<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addArr.<span style=\"color: #660066;\">forEach<\/span><span style=\"color: #009900;\">&#40;<\/span>i <span style=\"color: #339933;\">=&gt;<\/span> frag.<span style=\"color: #660066;\">appendChild<\/span><span style=\"color: #009900;\">&#40;<\/span>i<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #009900;\">&#91;<\/span>&#8230;<span style=\"color: #660066;\">frag<\/span>.<span style=\"color: #660066;\">children<\/span><span style=\"color: #009900;\">&#93;<\/span>.<span style=\"color: #660066;\">forEach<\/span><span style=\"color: #009900;\">&#40;<\/span>n <span style=\"color: #339933;\">=&gt;<\/span> n.<span style=\"color: #660066;\">style<\/span>.<span style=\"color: #660066;\">display<\/span> <span style=\"color: #339933;\">===<\/span> <span style=\"color: #3366CC;\">&#8216;none&#8217;<\/span> <span style=\"color: #339933;\">&amp;&amp;<\/span> n.<span style=\"color: #660066;\">remove<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">return<\/span> _appendChild.<span style=\"color: #660066;\">call<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #000066; font-weight: bold;\">this<\/span><span style=\"color: #339933;\">,<\/span> frag<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">return<\/span> _appendChild.<span style=\"color: #660066;\">call<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #000066; font-weight: bold;\">this<\/span><span style=\"color: #339933;\">,<\/span> child<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> tc <span style=\"color: #339933;\">=<\/span> node.<span style=\"color: #660066;\">querySelector<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;.leaflet-tile-container&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>tc<span style=\"color: #009900;\">&#41;<\/span> tc.<span style=\"color: #660066;\">appendChild<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000066; font-weight: bold;\">function<\/span> <span style=\"color: #009900;\">&#40;<\/span>f<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span> <span style=\"color: #009900;\">&#91;<\/span>&#8230;<span style=\"color: #660066;\">f<\/span>.<span style=\"color: #660066;\">children<\/span><span style=\"color: #009900;\">&#93;<\/span>.<span style=\"color: #660066;\">forEach<\/span><span style=\"color: #009900;\">&#40;<\/span>n <span style=\"color: #339933;\">=&gt;<\/span> n.<span style=\"color: #660066;\">tagName<\/span> <span style=\"color: #339933;\">===<\/span> <span style=\"color: #3366CC;\">&#8216;IMG&#8217;<\/span> <span style=\"color: #339933;\">&amp;&amp;<\/span> transformCartoImg<span style=\"color: #009900;\">&#40;<\/span>n<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #000066; font-weight: bold;\">return<\/span> _appendChild.<span style=\"color: #660066;\">call<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #000066; font-weight: bold;\">this<\/span><span style=\"color: #339933;\">,<\/span> f<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #009900;\">&#125;<\/span> <span style=\"color: #000066; font-weight: bold;\">else<\/span> <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>node.<span style=\"color: #660066;\">classList<\/span><span style=\"color: #339933;\">?<\/span>.<span style=\"color: #660066;\">contains<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;leaflet-control-attribution&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; node.<span style=\"color: #660066;\">remove<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style=\"color: #006600; font-style: italic;\">\/\/ \u9690\u85cf\u539f\u7248\u6743<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>node.<span style=\"color: #660066;\">shadowRoot<\/span><span style=\"color: #009900;\">&#41;<\/span> initShadow<span style=\"color: #009900;\">&#40;<\/span>node.<span style=\"color: #660066;\">shadowRoot<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">function<\/span> onRemove<span style=\"color: #009900;\">&#40;<\/span>node<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>node.<span style=\"color: #660066;\">nodeType<\/span> <span style=\"color: #339933;\">!==<\/span> <span style=\"color: #CC0000;\">1<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #000066; font-weight: bold;\">return<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>node.<span style=\"color: #660066;\">tagName<\/span> <span style=\"color: #339933;\">===<\/span> <span style=\"color: #3366CC;\">&#8216;IMG&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">if<\/span> <span style=\"color: #009900;\">&#40;<\/span>node.<span style=\"color: #660066;\">downgradeKey<\/span><span style=\"color: #009900;\">&#41;<\/span> doneSet.<span style=\"color: #000066; font-weight: bold;\">delete<\/span><span style=\"color: #009900;\">&#40;<\/span>node.<span style=\"color: #660066;\">downgradeKey<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; &nbsp; node.<span style=\"color: #660066;\">cvaImgRef<\/span><span style=\"color: #339933;\">?<\/span>.<span style=\"color: #660066;\">remove<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> ob <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000066; font-weight: bold;\">new<\/span> MutationObserver<span style=\"color: #009900;\">&#40;<\/span>list <span style=\"color: #339933;\">=&gt;<\/span> list.<span style=\"color: #660066;\">forEach<\/span><span style=\"color: #009900;\">&#40;<\/span>m <span style=\"color: #339933;\">=&gt;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; m.<span style=\"color: #660066;\">addedNodes<\/span>.<span style=\"color: #660066;\">forEach<\/span><span style=\"color: #009900;\">&#40;<\/span>onAdd<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; m.<span style=\"color: #660066;\">removedNodes<\/span>.<span style=\"color: #660066;\">forEach<\/span><span style=\"color: #009900;\">&#40;<\/span>onRemove<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">function<\/span> initShadow<span style=\"color: #009900;\">&#40;<\/span>root<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; ob.<span style=\"color: #660066;\">observe<\/span><span style=\"color: #009900;\">&#40;<\/span>root<span style=\"color: #339933;\">,<\/span> <span style=\"color: #009900;\">&#123;<\/span> childList<span style=\"color: #339933;\">:<\/span> <span style=\"color: #003366; font-weight: bold;\">true<\/span><span style=\"color: #339933;\">,<\/span> subtree<span style=\"color: #339933;\">:<\/span> <span style=\"color: #003366; font-weight: bold;\">true<\/span> <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; root.<span style=\"color: #660066;\">querySelectorAll<\/span><span style=\"color: #339933;\">?<\/span>.<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #3366CC;\">&#8216;.leaflet-layer&#8217;<\/span><span style=\"color: #009900;\">&#41;<\/span>.<span style=\"color: #660066;\">forEach<\/span><span style=\"color: #009900;\">&#40;<\/span>onAdd<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; ob.<span style=\"color: #660066;\">observe<\/span><span style=\"color: #009900;\">&#40;<\/span>document<span style=\"color: #339933;\">,<\/span> <span style=\"color: #009900;\">&#123;<\/span> childList<span style=\"color: #339933;\">:<\/span> <span style=\"color: #003366; font-weight: bold;\">true<\/span><span style=\"color: #339933;\">,<\/span> subtree<span style=\"color: #339933;\">:<\/span> <span style=\"color: #003366; font-weight: bold;\">true<\/span> <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> orig <span style=\"color: #339933;\">=<\/span> Element.<span style=\"color: #000066; font-weight: bold;\">prototype<\/span>.<span style=\"color: #660066;\">attachShadow<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; Element.<span style=\"color: #000066; font-weight: bold;\">prototype<\/span>.<span style=\"color: #660066;\">attachShadow<\/span> <span style=\"color: #339933;\">=<\/span> <span style=\"color: #000066; font-weight: bold;\">function<\/span> <span style=\"color: #009900;\">&#40;<\/span>opt<span style=\"color: #009900;\">&#41;<\/span> <span style=\"color: #009900;\">&#123;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">const<\/span> sh <span style=\"color: #339933;\">=<\/span> orig.<span style=\"color: #660066;\">call<\/span><span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #000066; font-weight: bold;\">this<\/span><span style=\"color: #339933;\">,<\/span> opt<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; initShadow<span style=\"color: #009900;\">&#40;<\/span>sh<span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; &nbsp; <span style=\"color: #000066; font-weight: bold;\">return<\/span> sh<span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; <span style=\"color: #009900;\">&#125;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp; initShadow<span style=\"color: #009900;\">&#40;<\/span>document.<span style=\"color: #660066;\">body<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\"><span style=\"color: #009900;\">&#125;<\/span><\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">&nbsp;<\/div>\n<\/li>\n<li style=\"margin-left:20px;\">\n<div style=\"border-bottom: dotted 1px #cccccc;\">initDomObserver<span style=\"color: #009900;\">&#40;<\/span><span style=\"color: #009900;\">&#41;<\/span><span style=\"color: #339933;\">;<\/span><\/div>\n<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"codebox_plus_footer\">GeSHi &copy; Codebox Plus Extension<\/div>\n<\/div>\n<p><small>\u539f\u6587\u4f5c\u8005: BG6RSH | <a href=\"https:\/\/bbs.tansoo.cn\/viewtopic.php?t=112\" target=\"_blank\" rel=\"noopener\">\u67e5\u770b\u539f\u5e16<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u770b\u4e86https:\/\/bbs.hassbian.com\/thread-29564- &hellip; <a href=\"https:\/\/www.tansoo.cn\/?p=1386\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[104],"tags":[],"class_list":["post-1386","post","type-post","status-publish","format-standard","hentry","category-104"],"_links":{"self":[{"href":"https:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/posts\/1386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1386"}],"version-history":[{"count":0,"href":"https:\/\/www.tansoo.cn\/index.php?rest_route=\/wp\/v2\/posts\/1386\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tansoo.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}