想做一个 JavaScript 书签,将当前阅读的微信标题提取出来,当我使用以下这段 js 代码时是可以正常运行的
javascript:(function(){
code = (document.documentElement.outerHTML);
title = code.match(/msg_title = ".*"/g);
window.open('omnifocus:///add?note='+encodeURIComponent(window.location)+'&name=🔖 '+title+'&context=📕📕 Reading Lists'+'&estimate=05 mins&autosave=true');
})();
但是一旦加上一个 replace 之后(如下),这个 js 书签点击就没有反应了,这可能是什么原因?
javascript:(function(){
code = (document.documentElement.outerHTML);
title = code.match(/msg_title = ".*"/g);
title = title.replace(/msg_title = |"/,'');
window.open('omnifocus:///add?note='+encodeURIComponent(window.location)+'&name=🔖 '+title+'&context=📕📕 Reading Lists'+'&estimate=05 mins&autosave=true');
})();