pretty-toc 1.1.5 → 1.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +12 -7
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -247,7 +247,6 @@ function prettyToc(option) {
|
|
|
247
247
|
<html>
|
|
248
248
|
<head><meta charset="utf-8"></head>
|
|
249
249
|
<body>
|
|
250
|
-
<strong>Hello from iframe!</strong>
|
|
251
250
|
<script is:inline data-astro-rerun>
|
|
252
251
|
const currentLocale = window.parent.location.pathname.split('/')[1] || '${opt.locale || "en-US"}';
|
|
253
252
|
const languageMap = ${JSON.stringify(opt.languageMap).replaceAll("\"", "'")} || ${JSON.stringify(DEFAULT_LANGUAGE_MAP).replaceAll("\"", "'")};
|
|
@@ -275,12 +274,18 @@ function prettyToc(option) {
|
|
|
275
274
|
}
|
|
276
275
|
}
|
|
277
276
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
277
|
+
window.addEventListener('load', function() {
|
|
278
|
+
if (window.parent.document.readyState === 'complete') {
|
|
279
|
+
syncTocTitle(currentLocale, languageMap);
|
|
280
|
+
toggleToc();
|
|
281
|
+
} else {
|
|
282
|
+
window.parent.document.addEventListener('readystatechange', event => {
|
|
283
|
+
if (event.target.readyState === 'complete') {
|
|
284
|
+
syncTocTitle(currentLocale, languageMap);
|
|
285
|
+
toggleToc();
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
}
|
|
284
289
|
});
|
|
285
290
|
<\/script>
|
|
286
291
|
</body>
|