-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpathcopy.html
63 lines (56 loc) · 2.23 KB
/
pathcopy.html
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>path copy</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="pathcopy_assets/primer.css">
<link rel="stylesheet" href="pathcopy_assets/main.css">
</head>
<body>
<h1>This is so you can copy a file path (local, not cloud link) to the clipboard, for pasting into windows exporer</h1><br>
<div id="example-target">
<div class="input-group" style="width: 400px;">
<input id="linkbox" type="text" value="file://none" >
<span class="input-group-button">
<button class="btn" type="button" data-clipboard-demo="" data-clipboard-target="#linkbox">
<img class="clippy" src="pathcopy_assets/clippy.svg" width="13" alt="Copy to clipboard">
</button>
</span>
</div>
</div>
<br>
<small>
<ol>
<li>Paste the link above into a Windows Explorer window</li>
<li>Pro tip: place a windows shortcut on your desktop with a keyboard shortcut to automate this. <a href="pathcopy_assets/get_me_clipboard">Download this</a>, then add ".lnk" as extension (to make it a windows shortcut).
Place it on your desktop, and now when you press <code>CTRL-Shift-o</code> an explorer window will open based on the path in your clipboard.</li>
<li></li>
</ol>
</small>
<script>
const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop),
});
// Get the value of "some_key" in eg "https://example.com/?some_key=some_value"
let value = params.some_key; // "some_value"
document.getElementById("linkbox").value = value;
</script>
<!-- 2. Include library -->
<script src="pathcopy_assets/clipboard.min.js"></script>
<!-- 3. Instantiate clipboard by passing a string selector -->
<script>
var clipboard = new ClipboardJS('.btn');
clipboard.on('success', function (e) {
console.info('Action:', e.action);
console.info('Text:', e.text);
console.info('Trigger:', e.trigger);
});
clipboard.on('error', function (e) {
console.info('Action:', e.action);
console.info('Text:', e.text);
console.info('Trigger:', e.trigger);
});
</script>
</body>
</html>