-
Notifications
You must be signed in to change notification settings - Fork 0
/
new-place-maket.html
342 lines (316 loc) · 16.7 KB
/
new-place-maket.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<!doctype html>
<html lang="ru">
<head>
<title>Admire - #title#</title>
<meta charset="UTF-8">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-138158685-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-138158685-1');
</script>
<!-- Yandex.Metrika counter -->
<script type="text/javascript" >
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
m[i].l=1*new Date();k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
ym(53240083, "init", {
clickmap:true,
trackLinks:true,
accurateTrackBounce:true,
webvisor:true
});
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/53240083" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<meta charset="utf-8">
<meta name="keywords" content="#keywords#">
<meta name="description" content="#description#">
<meta name="viewport" content="initial-scale=1.0, width=device-width, shrink-to-fit=no" />
<meta name="yandex-verification" content="7919b11398717df1" />
<link rel="stylesheet" type="text/css" href="//js.api.here.com/v3/3.0/mapsjs-ui.css?dp-version=1549984893" />
<script type="text/javascript" src="//js.api.here.com/v3/3.0/mapsjs-core.js"></script>
<script type="text/javascript" src="//js.api.here.com/v3/3.0/mapsjs-service.js"></script>
<script type="text/javascript" src="//js.api.here.com/v3/3.0/mapsjs-ui.js"></script>
<script type="text/javascript" src="//js.api.here.com/v3/3.0/mapsjs-mapevents.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link href="//fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/vue.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.css" />
<script src="https://cdn.jsdelivr.net/gh/fancyapps/[email protected]/dist/jquery.fancybox.min.js"></script>
<style type="text/css">
.material-placeholder {
height: 200px;
display: inline-block;
opacity: 0;
}
.materialboxed {
height: 200px;
transition: initial;
}
.img-place-back {
overflow: hidden;
height: 200px;
}
</style>
<script type="text/javascript">
Vue.component('comment', {
props: ['comment'],
template: `<div class="w-100 row m-0">
<div class="col-auto alert border mb-1 p-0" :class="{'ml-auto': comment.login === me}" style="background: #555;">
<div class="row m-0">
<div class="col-auto p-0">
<div class="m-1" :style="'backgroundImage: url(' + avatar + ');'" style="background: no-repeat center / cover;
width: 50px; height: 50px; border-radius: 50%;"></div>
</div>
<div class="col-auto p-0 pt-1">
<small class="pl-3" style="color: #ff0;">от {{comment.login}}</small>
<small class="pr-3 right pt-1 ml-2">{{time_comment}}</small>
<hr class="m-0 mt-1 white" />
<pre class="m-0 px-3 pb-1" style="font-family: arial; color: white;">{{comment.message}}</pre>
</div>
</div>
</div>
</div>`,
computed: {
time_comment: function() {
let cash_date = new Date(+this.comment.time_comment);
return (cash_date.getDate()) + "." + (cash_date.getMonth() + 1) + "." + (cash_date.getFullYear())
},
me: function() {
return SeaplApp.login;
},
avatar: function() {
if(!this.comment.avatar && this.comment.sex === "male") {
return "https://i0.wp.com/www.winhelponline.com/blog/wp-content/uploads/2017/12/user.png?fit=256%2C256&quality=100&ssl=1";
} else if(!this.comment.avatar && this.comment.sex === "famale") {
return "https://iconfree.net/uploads/icon/2017/7/5/avatar-user-profile-icon-3763-512x512.png";
} else {
return '/avatars/' + this.comment.avatar;
}
}
}
});
</script>
</head>
<body>
<div id="SeaplApp">
<nav style="background: #666;">
<div class="container">
<a href="../" class="brand-logo">Admire</a>
<a href="#" data-target="mobile-demo" class="sidenav-trigger"><i class="material-icons">menu</i></a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li><a href="../map">Карта</a></li>
<li><a href="../add-place">Добавить</a></li>
</ul>
</div>
</nav>
<ul class="sidenav" id="mobile-demo">
<li><a href="../">Главная</a></li>
<li><a href="../map">Карта</a></li>
<li><a href="../add-place">Добавить</a></li>
</ul>
<div class="container-fluid py-3 px-0" style="background: #bbb;">
<div class="row m-0">
<div class="col-12 col-lg-9">
<div class="row m-0">
<h4 class="col p-0 m-0" style="flex-basis: 0;">#title#</h4>
<!--a class="waves-effect waves-light modal-close right col-auto p-0"
style="height: 44px; width: 44px; text-align: center; border-radius: 50%;">
<i class="material-icons text-white" style="height: 44px; line-height: 44px;">close</i>
</a-->
</div>
<hr class="" />
<div class="row m-0">
<div class="w-100 mb-4">
<div class="d-inline-block" style="max-width: 168px; cursor: pointer;" @click="AddRating($event)">
<div style="font-size: 34px; line-height: 34px; height: 34px; color: white; letter-spacing: 2px; max-width: 168px;">★★★★★</div>
<div style="font-size: 36px; line-height: 36px; height: 34px; margin-top: -34px; color: #666; max-width: 168px;">★★★★★</div>
<div style="font-size: 34px; line-height: 34px; height: 34px; margin-top: -34px; letter-spacing: 2px; color: #ff0;
overflow: hidden;" :style="'width: ' + (rating / 1000000 * 154) + 'px;'">★★★★★</div>
</div>
<a class="waves-effect waves-light right col-auto p-0"
style="height: 44px; width: 44px; text-align: center; border-radius: 50%;"
@click="CopyTextToClipboard">
<i class="material-icons" style="height: 44px; line-height: 44px;">share</i>
</a>
<a class="waves-effect waves-light right col-auto p-0"
style="height: 44px; width: 44px; text-align: center; border-radius: 50%;"
@click="ToLocations">
<i class="material-icons" style="height: 44px; line-height: 44px;">location_on</i>
</a>
</div>
<div class="w-100 mb-4" v-if="(social.length != 0)">
<p class="m-0 btn-flat p-0" style="color: white; cursor: initial;">Добавлено: </p>
<a v-for="(sn, index) in social" :href="'/link.php?i=' + sn.value + '&t=' + sn.type" target="_blank"
class="waves-effect waves-light btn-flat p-0 mx-3" style="color: white; font-size: 0;">
<img :src="snd[sn.type].src" style="width: 36px;">
</a>
</div>
<div v-for="(tag, i) in tags" class="chip yellow accent-2">{{tag}}</div>
</div>
<hr class="" />
<p style="white-space: pre-wrap;">#description#</p>
<div class="container-fluid p-0">
<div class="row">
<!--div v-for="(image, index) in images" class="col-lg-3 col-md-4 col-sm-6 col-12 p-1">
<div class="border rounded img-place-back" style="background: no-repeat center / cover; height: 200px; width: 100%;"
:style="'backgroundImage: url(' + image + ');'">
<div style="width: 400%; margin-left: -150%; height: 200px; text-align: center;">
<img :src="image" class="materialboxed" width="auto">
</div>
</div>
</div-->
<a v-for="(image, index) in images" :href="image" class="col-lg-3 col-md-4 col-sm-6 col-12 p-1"
data-fancybox="images">
<img class="img-fluid" :src="image" />
</a>
</div>
</div>
<hr class="" />
<div class="row m-0 p-2">
<h4 class="col p-0 pt-1 m-0" style="flex-basis: 0;">#title# - Комментарии</h4>
</div>
<hr class="mb-0" />
<div class="row m-0 p-4 grey lighten-4">
<comment v-if="(comments.length > 0)" v-for="(comment, index) in comments" :key="index" :comment="comment"></comment>
<p class="lead m-0" style="color: black;" v-if="(comments.length == 0)">Напишите комментарий к этому месту первым!</p>
</div>
<hr class="mt-0" />
<div class="row m-0 p-4">
<div v-if="!login" class="row m-0">
<p class="lead col" style="width: calc(100% - 90px);">Комментировать можно только зарегистрированным пользователям.</p>
<a class="btn-flat right waves-effect waves-light col-auto" style="background: #ff0;" href="/regist">Войти</a>
</div>
<div v-else class="w-100 pt-1">
<div class="input-field col p-0 m-0" style="width: calc(100% - 50px);">
<textarea id="comment" class="materialize-textarea" v-model="text_comment"></textarea>
<label for="comment" style="left: 0; color: black;">Ваш комментарий</label>
</div>
<a class="waves-effect waves-light right prefix col-auto p-0" @click="SendComment"
style="height: 44px; width: 44px; text-align: center; border-radius: 50%;">
<i class="material-icons" style="height: 44px; line-height: 44px; color: black;">send</i>
</a>
</div>
</div>
</div>
<div class="col-3 d-none d-lg-block">
<!--Места интересные рядом
<hr class="white" />
Реклама-->
</div>
</div>
</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.sidenav');
var instances = M.Sidenav.init(elems, {});
var elems = document.querySelectorAll('.materialboxed');
var instances = M.Materialbox.init(elems, {});
M.textareaAutoResize($('#comment'));
});
var SeaplApp = new Vue({
el: '#SeaplApp',
data: {
id: #id#,
login: localStorage.getItem('login'),
rating: #rating#,
count_rating: #count_rating#,
social: [],
tags: [#tags#],
images: [#images#],
route: #route#,
comments: [],
text_comment: ""
},
created() {
$.ajax({
url : '/back/get_comment.php',
type : 'POST',
data : {place_id: this.id},
success: function(data) {
SeaplApp.comments = JSON.parse(data);
}
});
},
methods: {
AddRating: function(event) {
if(this.count_rating.indexOf(localStorage.getItem('user_id') + "") < 0) {
let new_rating = Math.round((event.pageX - $(event.target).offset().left)/$(event.target).width()*5-0.5)+1;
this.rating = (this.rating * this.count_rating.length + new_rating * 200000) /
(this.count_rating.length + 1);
this.count_rating.push(localStorage.getItem('user_id'));
$.ajax({
url : '/back/change-place.php',
type : 'POST',
data : {data: "rating", id: this.id, rating: this.rating, count_rating: this.count_rating},
success: function(data) {
if(data == "well") {
alert("Спасибо! Ваше мнение очень важно для всех :)");
}
}
});
} else alert("Вы уже оценивали это место.");
},
CopyTextToClipboard: function() {
let copy = 'admire.social/link.php?p=' + this.id;
if (!!navigator.clipboard) {
navigator.clipboard.writeText(copy).then(function() {}, function(err) {
var textArea = document.createElement("textarea");
textArea.style.position = 'fixed';
textArea.style.top = 0;
textArea.style.left = 0;
textArea.style.width = '2em';
textArea.style.height = '2em';
textArea.style.padding = 0;
textArea.style.border = 'none';
textArea.style.outline = 'none';
textArea.style.boxShadow = 'none';
textArea.style.background = 'transparent';
textArea.value = copy;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
var successful = document.execCommand('copy');
document.body.removeChild(textArea);
});
}
M.toast({html: `Ссылка скопирована в буфер обмена`, classes: 'rounded'});
},
SendComment: function() {
if(!!this.text_comment) {
let new_comment = {
place_id : this.id,
login : this.login,
time_comment: new Date().getTime(),
message : this.text_comment
}
this.comments.push(new_comment);
this.text_comment = "";
$.ajax({
url : '/back/add_comment.php',
type : 'POST',
data : {new_comment: new_comment},
success: function(data) {}
});
}
},
ToLocations: function() {
localStorage.setItem('coord_x', this.route[0][0]);
localStorage.setItem('coord_y', this.route[0][1]);
location.href = "../map";
}
}
});
</script>
</body>
</html>