11 2022 档案

摘要:使用replace(/[^0-9]/ig,"")将所有字符转换为空, 剩余只含数字的字符串, 然后再转换成数值类型就可以了,如下: let str = "jslfj560jasldf"; let newStr = +(str.replace(/[^0-9]/ig,"")); console.log( 阅读全文
posted @ 2022-11-15 20:44 uuxyz 阅读(490) 评论(0) 推荐(0) 编辑
摘要:注意使用chrome.tabs.onUpdated.addListener需要在manifest.json声明tabs权限 permissions: [‘tabs’] function handleUpdated(tabId, changeInfo, tabInfo) { console.log(` 阅读全文
posted @ 2022-11-14 22:52 uuxyz 阅读(93) 评论(0) 推荐(0) 编辑
摘要:I have used hash urls for my website and made safari extension for the same. For login/logout my extension opens ourdmain.in in new tab and listens to 阅读全文
posted @ 2022-11-14 21:13 uuxyz 阅读(12) 评论(0) 推荐(0) 编辑
摘要:Javascript 是异步的,一个常见的痛点是在页面上的 DOM 元素加载之前运行脚本。 处理此问题的一种方法是向文档中添加一个侦听器来侦听该DOMEContentLoaded事件。 document.addEventListener("DOMContentLoaded", function(){ 阅读全文
posted @ 2022-11-06 20:43 uuxyz 阅读(1007) 评论(0) 推荐(1) 编辑
摘要:Swap two nodes The function below swaps two given nodes, nodeA and nodeB: const swap = function (nodeA, nodeB) { const parentA = nodeA.parentNode; con 阅读全文
posted @ 2022-11-04 01:09 uuxyz 阅读(29) 评论(0) 推荐(0) 编辑

联系我
点击右上角即可分享
微信分享提示