-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy-current-url-md.js
More file actions
35 lines (33 loc) · 1.01 KB
/
Copy pathcopy-current-url-md.js
File metadata and controls
35 lines (33 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
javascript:
(
function(d){
let t = new String(d.title);
t.allReplace = function(t){
let b = this, c;
for(c in t){
b = b.replace(new RegExp(c, 'g'), t[c]);
}
return b;
}.bind(t);
let u = d.URL, s;
if(s = d.querySelector('link[rel="shortlink"]')){ u = s.href }
if(s = d.querySelector('link[rel="canonical"]')){ u = s.href }
u = u.replace(/#gid=\d+$/, '');
u = u.replace(/#slide=id\.[a-z0-9_]+$/, '');
u = u.replace(/#heading=h\.[a-z0-9_]+$/, '');
u = u.replace(/fbclid=[a-zA-Z0-9-]*/, '');
s = t.allReplace({
' - Confluence' : '',
' - Google スプレッドシート' : '',
' - Google スライド' : '',
' - Google ドライブ' : '',
' - Google ドキュメント' : '',
' - \\S+ Jira' : '',
' \\| Notion' : '',
'\\[(\\w+-\\d+)\\]' : '$1',
' . 課題の表示 . Backlog' : '',
'^(.*) · Issue #(\\d+).*' : '#$2 $1'
});
navigator.clipboard.writeText(`[${s}](${u})\n`);
}
)(document);