diff --git a/index.html b/index.html index 52cd7d0541c65b91f62fa932bac2feb598da6dfc..e0ff647ad5730dd5857ad376f4e4e309ec7cf9d2 100644 --- a/index.html +++ b/index.html @@ -78,6 +78,34 @@ }, plugins: [ function (hook, vm) { + hook.ready(function (){ + // true = show debug log + let TARGET_QUERY = 'id' + let SCROLL_DELAY = 1500 // in milisecond + let location = window.location + let currentUrlWithoutHash = new URL( + location.origin+location.pathname+ + location.search+location.hash.substring(1) + ) + let urlQueryParam = currentUrlWithoutHash.searchParams + let isUrlHasIdQuery = urlQueryParam.has(TARGET_QUERY) + if(isUrlHasIdQuery){ + let urlId = urlQueryParam.get(TARGET_QUERY) + // run delayed, to make sure everything loaded + setTimeout(function() { + try{ + if(window.localStorage.getItem(urlId)==undefined) + { + location.reload() + window.localStorage.setItem(urlId, '1'); + } + } catch(e){} + }, SCROLL_DELAY); + setTimeout(function(){ + window.localStorage.removeItem(urlId) + },2000) + } + }), hook.beforeEach(function (html) { var url = 'https://gitee.com/rtthread/docs-online/blob/master/' + vm.route.file var editHtml = '[:pencil: 修改此文档 ](' + url + ')      [:page_with_curl:《修改规范说明》](/README?id=在线文档开发介绍)\n' @@ -86,7 +114,7 @@ editHtml + html + '\n\n----\n' + - '>我有疑问: [RT-Thread 官方论坛](https://club.rt-thread.org/)'+'