Skip to content

Instantly share code, notes, and snippets.

@binary4cat
Last active April 25, 2018 03:18
Show Gist options
  • Save binary4cat/16f41a1ca3f0230431f58b9f26ec7de1 to your computer and use it in GitHub Desktop.
Save binary4cat/16f41a1ca3f0230431f58b9f26ec7de1 to your computer and use it in GitHub Desktop.
微信公众号文章页自动滚动到底部
var jumpScript = '<script>'+
'function jumpIf(date=2000, jumpUrl=""){'+
'var doc = document.all[0].innerHTML;'+
'if( /<span[^>]*display\\:\\s*none[^>]*>\\.*?已无更多\\.*?<\\\/span>/i.test(doc) ){'+
'document.body.scrollTop = document.body.scrollHeight - (document.body.clientHeight && document.documentElement.clientHeight);'+
'setTimeout(jumpIf, date);'+
'}else{'+
'setTimeout(function(){window.location.href=jumpUrl}, date);'+
'};'+
'}'+
'window.onload = function(){'+
'jumpIf([#dateJump]);'+
'}'+
'</script>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment