44 lines
1.7 KiB
HTML
44 lines
1.7 KiB
HTML
[viewBag]
|
|
==
|
|
{% put scripts %}
|
|
<script>
|
|
getAdvs('{{groupId}}');
|
|
// console.log("qqq");
|
|
function getAdvs(groupId) {
|
|
//console.log(query.html());
|
|
$(document).ready(function () {
|
|
$.ajax({
|
|
url: `https://orient.tm/api/group/advertisements?group_id=`+groupId,
|
|
type: 'GET',
|
|
dataType: 'json',
|
|
success: function (data, textStatus, xhr) {
|
|
|
|
var advs = data.data.data;
|
|
|
|
for (var adv of advs) {
|
|
|
|
//console.log(adv);
|
|
$('#adv_{{groupId}}').append(`
|
|
|
|
<div class="swiper-slide">
|
|
<a `+ (adv.enable_stats && adv.url ? `data-request="onRedirect" data-request-data='[{id:` + adv.id + `},{url:"` + adv.url + `"}]' onclick='window.open("` + adv.url + `", "_blank");'` : href="#" ) + `>
|
|
<picture>
|
|
<source media="(min-width:700px)" srcset="`+adv.media+`">
|
|
<img src="`+ adv.media +`" alt="`+ adv.title +`" style="width: 100%;">
|
|
</picture>
|
|
</a>
|
|
</div>
|
|
`);
|
|
}
|
|
|
|
|
|
},
|
|
error: function (xhr, textStatus, errorThrown) {
|
|
console.log('Error in Operation');
|
|
}
|
|
});
|
|
});
|
|
}
|
|
</script>
|
|
|
|
{% endput %} |