element.scrollHeight,scrollTop
摘要:1\ var element = document.querySelector("section article .css-1dbjc4n div > div[role='group']"); element.scrollHeight = element.Height Element.scrollH
阅读全文
window.pageYOffset
摘要:1、window.pageYOffset == window.scrollY
阅读全文
msdn getBoundingClientRect()
摘要:rectObject = object.getBoundingClientRect(); 值 返回值是一个 DOMRect 对象,这个对象是由该元素的 getClientRects() 方法返回的一组矩形的集合,就是该元素的 CSS 边框大小。The result is the smallest r
阅读全文
js 原生滚动到指定元素(元素滚动到可视范围)
摘要:1、document.querySelector("section article .css-1dbjc4n div > div[role='group']").scrollIntoViewIfNeeded() 元素将在其所在滚动区的可视区域中居中对齐 好用 document.querySelect
阅读全文
scroll js 原生
摘要:1、当前位置滚动: document.documentElement.scrollTop 当前位置: 有可能是0 window.scrollTo(0,document.documentElement.scrollTop+document.documentElement.scrollTop) 所以:
阅读全文
js node 节点 原生遍历 createNodeIterator
摘要:1、createIterator msn: https://developer.mozilla.org/en-US/docs/Web/API/Document/createNodeIterator var filter = function(node){ 1、nodeFilter msn: http
阅读全文
w3 parse a url
摘要:最新链接:https://www.w3.org/TR/html53/ 2.6 URLs — HTML5 This is a work in progress! For the latest updates from the HTML WG, possibly including important
阅读全文
js emoji 过滤
摘要:function filteremoji(emojireg){ var ranges = [ '\ud83c[\udf00-\udfff]', '\ud83d[\udc00-\ude4f]', '\ud83d[\ude80-\udeff]' ]; emojiregRe = emojireg .replace(new RegExp(ranges.join('|'...
阅读全文
windows nodejs yarn 与hadoop yarn命令冲突
摘要:添加环境变量后 修改名字 1、修改前: 2、修改后:
阅读全文
chrome 扩展 调试
摘要:开发chrome扩展,有时候需要输出console.log 通常调试的popup.html.content_script.backgroup.html等 但是有一些是没有这些的 1、推荐一个扩展: https://chrome.google.com/webstore/detail/socketlog
阅读全文
Electron mouse events 参数解析
摘要:1、https://electronjs.org/docs/api/web-contents 2、通常用: monitorEvents(document.body, 'mouse') 检测正常的值: screenX 467 == globalXscreenY 301 == globalYclient
阅读全文
js indexOf within Switch
摘要:https://stackoverflow.com/questions/22277447/indexof-within-switch switch (true) { case (msgRes.indexOf("hi") !=-1): botResponse.push("HELLO. "); break; case (msgRes.indexOf("how are you") !...
阅读全文
js 开发注意事项
摘要:涉及api post 请求的, 涉及sqlite 存储的, conent 用encodeURIComponent, decodeURIComponent ,处理 JSON.parse 最好加上try {}catch(e){} //并写入日志
阅读全文
js 防止重复点击
摘要:1、添加flag 适用于ajax 表单提交,提交之前flag = false , 提及中,true ,提交后false 2、事件重复点击:
阅读全文
java script sleep synchronous
摘要:1 function sleep(milliseconds) { 2 var start = new Date().getTime(); 3 for (var i = 0; i milliseconds){ 5 break; 6 } 7 } 8 } other version to see https://stackoverflow.com/questio...
阅读全文
java script btoa与atob的
摘要:javascript原生的api本来就支持,Base64,但是由于之前的javascript局限性,导致Base64基本中看不中用。当前html5标准正式化之际,Base64将有较大的转型空间,对于Html5 Api中出现的如FileReader Api, 拖拽上传,甚至是Canvas,Video截
阅读全文
dom node 查找父级parentNode
摘要:var o = document.querySelectorAll("a[href='baidu.com']"); var p = o[o.length-1];console.log('i',o.length); console.log(p); if(p !== undefined){ while
阅读全文