-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
151 lines (142 loc) · 4.03 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
151
<!DOCTYPE html>
<html lang="en">
<head>
<title>demo | boosted share library</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<link rel="stylesheet" href="cdn/default.css">
<meta name="viewport" content="initial-scale=1.0">
<script src="cdn/share.js">
</script>
<style>
div.form-floating{
margin:5px;
}
div.slide{
width:auto;max-width:calc(90vw-10px); overflow:scroll;margin:5px;
}
div[data-type=flex]{
display:flex;width:auto;
}
div[data-type=flex] .form-check{
margin:5px;
}
</style>
</head>
<body>
<!--
<!==
==>
-->
<h1 style="margin:5px;">Demo of boosted share.js</h1>
<div class="form-floating mb-3">
<input type="title" value="Gboard clipboard" class="form-control" id="title" placeholder="title">
<label for="title">Title to be shared</label>
</div>
<div class="form-floating mb-3">
<input class="form-control" placeholder="url" id="url" value="https://cutt.ly/tbWmOoi">
<label for="url">url to be shared</label>
</div>
<div class="form-floating">
<textarea class="form-control" placeholder="text" id="text" >I'm using Gboard to type.</textarea>
<label for="text">text to be shared</label>
</div>
<div class="slide">
<div data-type="flex">
<button class="btn btn-sm btn-outline-primary" style="margin:5px;" onclick="selAll(this)">all</button>
<div class="form-check">
<label>
<input class="form-check-input" type="checkbox" id="twitter">
twitter
</label>
</div>
<div class="form-check">
<label>
<input class="form-check-input" type="checkbox" id="whatsapp">
whatsapp
</label>
</div>
<div class="form-check">
<label>
<input class="form-check-input" type="checkbox" id="tumblr">
tumblr
</label>
</div>
<div class="form-check">
<label>
<input class="form-check-input" type="checkbox" id="mail">
mail
</label>
</div>
<div class="form-check">
<label>
<input class="form-check-input" type="checkbox" id="blogger">
blogger
</label>
</div>
<div class="form-check">
<label>
<input class="form-check-input" type="checkbox" id="sms">
sms
</label>
</div>
<div class="form-check">
<label>
<input class="form-check-input" type="checkbox" id="reddit">
reddit
</label>
</div>
<div class="form-check">
<label>
<input class="form-check-input" type="checkbox" id="search">
search
</label>
</div>
<div class="form-check">
<label>
<input class="form-check-input" type="checkbox" id="boosted">
boosted
</label>
</div>
</div>
</div>
<div class="form-floating">
<select class="form-select" id="mode" aria-label="Floating label select example">
<option selected>dark</option>
<option >light</option>
</select>
<label for="floatingSelect">select color scheme</label>
</div>
<div style="width:100%; display:flex; align-items: center;">
<button style="margin:auto;"class="btn btn-outline-primary" data-done>
Share
</button>
</div>
<script>
selAll=(obj)=>{
document.querySelectorAll(".form-check-input").forEach(function (e){
console.log(e);
e.checked=true;
});
}
document.querySelector("button[data-done]").addEventListener('click',()=>{
var socialMedias=[]; document.querySelectorAll('.form-check-input').forEach(function (e){
if(e.checked){
socialMedias.push(e.id);
}
});
if(socialMedias.length>0){
console.log(socialMedias);
Ted().share({
title: document.querySelector('#title').value,
text: document.querySelector('#text').value,
url: document.querySelector('#url').value,
allowTo:socialMedias,
mode: document.querySelector('select').value,
});
}else{
alert('please select medias');
}
});
</script>
</body>
</html>