-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
150 lines (134 loc) · 3.71 KB
/
index.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<!DOCTYPE html>
<html>
<head>
<title>Google Drive Image Viewer</title>
<style>
body {
background-color: #242526;
color: #FFFFFF;
font-family: Arial, sans-serif;
}
#main {
margin: auto;
max-width: 600px;
padding: 20px;
}
h1 {
text-align: center;
margin-top: 0;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"] {
padding: 8px;
font-size: 16px;
width: 100%;
box-sizing: border-box;
border: none;
border-radius: 4px;
background-color: #3A3B3C;
color: #FFFFFF;
}
input[type="submit"] {
padding: 8px 16px;
font-size: 16px;
background-color: #0A84FF;
color: #FFFFFF;
border: none;
border-radius: 4px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #0076FF;
}
#image-container {
margin-top: 20px;
}
img {
max-width: 250px;
max-height: 250px;
display: block;
margin: 0 auto;
box-shadow: 0 0 5px #FFFFFF;
}
a {
color: #0A84FF;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
button {
padding: 8px 16px;
font-size: 16px;
background-color: #3A3B3C;
color: #FFFFFF;
border: none;
border-radius: 4px;
cursor: pointer;
}
button:hover {
background-color: #4E4F50;
}
button.clicked {
background-color: #0076FF !important;
}
button {
/* existing styles */
display: block;
margin: 0 auto;
}
</style>
</head>
<body>
<div id="main">
<h1>Google Drive Image Viewer</h1>
<form onsubmit="showImage(); return false;">
<label for="image-link">Enter Google Drive image link:</label>
<input type="text" id="image-link" name="image-link">
<input type="submit" value="Show Image">
</form>
<div id="image-container" style="display:none;">
<img id="image">
<br>
<br>
<a id="image-link-url" target="_blank">
View Image on Google Drive
</a>
<button onclick="copyImageLink()">Copy Image Link</button>
</div>
</div>
<a href="test.html>test</a>
<script>
function showImage() {
var link = document.getElementById("image-link").value;
var fileId = link.match(/[-\w]{25,}/);
var imageUrl = "https://lh3.googleusercontent.com/d/" + fileId;
document.getElementById("image").src = imageUrl;
document.getElementById("image-link-url").href = link;
document.getElementById("image-container").style.display = "block";
}
function copyImageLink() {
var link = document.getElementById("image-link-url").href;
var fileId = link.match(/[-\w]{25,}/);
var imageUrl = "https://lh3.googleusercontent.com/d/" + fileId;
var markdown = "![](" + imageUrl + ")";
var tempInput = document.createElement("textarea");
tempInput.value = markdown;
document.body.appendChild(tempInput);
tempInput.select();
document.execCommand("copy");
document.body.removeChild(tempInput);
var copyButton = document.querySelector("button");
copyButton.style.backgroundColor = "#28a745";
copyButton.textContent = "Copied!";
setTimeout(function() {
copyButton.style.backgroundColor = "#3A3B3C";
copyButton.textContent = "Copy Image Link";
}, 3000);
}
</script>
</body>
</html>