view.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <?php
  2. /**
  3. * @var $this \yii\web\View
  4. * @var $model \app\models\front\News
  5. */
  6. use yii\web\View;
  7. use yii\helpers\ArrayHelper;
  8. use app\modules\ldjson\jsonLD;
  9. use yii\web\UrlManager;
  10. use app\models\Authors;
  11. use app\models\base\Image;
  12. use \app\models\news;
  13. use yii\helpers\Url;
  14. /*
  15. $this->registerJsFile('https://platform-api.sharethis.com/js/sharethis.js#property=63ecb32f4a4876001374e328&product=inline-reaction-buttons', [
  16. 'position' => $this::POS_END,
  17. 'async' => 'async',
  18. 'defer' => 'defer'
  19. ]);
  20. */
  21. $preview = $model->image;
  22. $retina = $preview->getUrl(Image::SIZE_1040x586,"jpg");
  23. $normal = $preview->getUrl(Image::SIZE_841x473,"webp");
  24. $bad = $preview->getUrl(Image::SIZE_680x383,'jpg');
  25. $bad = $bad?$bad:'/images/default.jpg';
  26. if( $retina === false || $normal === false ){
  27. $normal = $bad;
  28. $retina = $bad;
  29. }
  30. $normal .= "?v=".$model->rev;
  31. $retina .= "?v=".$model->rev;
  32. $bad .= "?v=".$model->rev;
  33. /*
  34. После этой даты не выводить фото до подтверждения юриста
  35. if( isset( $model->dt_pub ) && strtotime( $model->dt_pub ) < strtotime('2015-01-01 00:00:00') ){
  36. $bad = '/images/default.jpg';
  37. $normal = $bad;
  38. $retina = $bad;
  39. };
  40. */
  41. $txt_date = date( "[Y-m-d] ", strtotime( $model->dt_pub ) );
  42. Yii::$app->og->title =($model->meta_title)?$model->meta_title:$model->title;
  43. Yii::$app->og->description = ($model->lid && trim($model->lid) <> '')?str_replace( '"', "&quot;", strip_tags($model->lid) ):$txt_date.trim(str_replace( '"',"'",substr(strip_tags( $model->text ),0,150)))."...";
  44. if( $model->active == 'N' || $model->dt_pub > date("Y-m-d H:i:s") || $model->noindex == 'Y' ){
  45. Yii::$app->og->noindex = 'Y';
  46. }else{
  47. \Yii::$app->og->canonical = $model->getUrl(true);
  48. \Yii::$app->og->amp = Url::base('https').'/amp/news/'.$model->id;
  49. \Yii::$app->og->og_url = $model->getUrl(true);
  50. \Yii::$app->og->og_image = $model->image->url;
  51. \Yii::$app->og->og_type = "article";
  52. \Yii::$app->og->og_title = htmlspecialchars(($model->meta_title)?strip_tags(str_replace( '"',"&quot;",$model->meta_title)):strip_tags(str_replace( '"',"&quot;",$model->title)));
  53. \Yii::$app->og->og_description = ($model->lid && trim($model->lid) <> '')?str_replace( '"',"&quot;",strip_tags($model->lid)):$txt_date.trim(str_replace( '"',"&quot;",substr(strip_tags( $model->text ),0,150)))."...";
  54. \Yii::$app->og->dtpub = date( "r", strtotime( $model->dt_pub ) );
  55. }
  56. jsonLD::addAmicORG();
  57. jsonLD::news( $model->title, preg_replace('/\s+/', ' ', str_replace( ["\n","\r"],' ',Yii::$app->og->description)), $model->image->url, $model->dt_pub, $model->getUrl(), $model->uid, $model->text, $model->meta_title);
  58. jsonLD::addfaq($model->text, $model->title);
  59. $story = new \app\models\base\Story();
  60. $this->params['breadcrumbs'] = [
  61. [
  62. "text"=>"НОВОСТИ",
  63. "url"=>"/news"
  64. ]
  65. ];
  66. $this->params['context'] = "post-view";
  67. //$topic = ArrayHelper::getValue($model->topics,0);
  68. $topic = Yii::$app->cache->getOrSet('topic-news-'.$model->id, function () use($model){
  69. return $model->getTopics()->andWhere(['show'=>"Y","active"=>1])->orderBy('order asc')->one();
  70. }, News::$keysCache['topic-news-##']);
  71. if($topic instanceof \app\models\base\NewsTopic){
  72. $this->params['breadcrumbs'][] =
  73. [
  74. "text"=>$topic->title,
  75. "url"=>"/news/".mb_strtolower($topic->url)
  76. ];
  77. }
  78. $i = 1;
  79. foreach($this->params['breadcrumbs'] as $el){
  80. jsonLD::addBreadcrumb($i, $el['url'], $el['text']);
  81. $i++;
  82. }
  83. if( $model->show_author == 'Y' )
  84. {
  85. $author = Authors::getAuthor( $model->author );
  86. $authorName = $author->name;
  87. \Yii::$app->og->author =$authorName;
  88. jsonLD::author( $authorName );
  89. }else{
  90. $authorName = 'ИА Амител';
  91. jsonLD::author( $authorName, false );
  92. }
  93. if( strstr( $model->text, 'id="widgetseting"' ) && strstr( $model->text, 'windows="100"' ) ) $model->type = 2; //старый стиль широкой страницы
  94. $GLOBALS['type_long'] = ($model->type == 6); //лонгрид
  95. ?>
  96. <?php if(!is_null($model->embed_url) && $model->embed_url!=''):?>
  97. <div class="row">
  98. <div class="col-md-12 mb-5">
  99. <div class="picture-cont-16x9">
  100. <picture class="w-100 youtube-iframe-placeholder" data-link="<?=$model->getYoutubeEmbedLink()?>">
  101. <source srcset="<?=$preview->getUrl(Image::SIZE_1040x586,"jpg")?>" media="(min-width: 600px)">
  102. <source srcset="<?=$preview->getUrl(Image::SIZE_841x473,"webp")?>" media="(min-width: 600px)">
  103. <source srcset="<?=$preview->getUrl(Image::SIZE_680x383,"webp")?>" media="(min-width: 500px)">
  104. <img src="<?=$preview->getUrl(Image::SIZE_841x473)?>" alt="<?=$model->photo_title?>" srcset="<?=$preview->getUrl(Image::SIZE_841x473)?> 841w, <?=$preview->getUrl(Image::SIZE_1040x586)?> 2x, <?=$preview->getUrl(Image::SIZE_680x383,"webp")?> 680w" class="w-100" loading="lazy">
  105. </picture>
  106. </div>
  107. </div>
  108. </div>
  109. <?php endif;?>
  110. <div class="row">
  111. <div class="<?=($model->type == 2 || $model->type == 6)?'col-md-12':'col-md-8'?>">
  112. <div id="post" class="post">
  113. <?
  114. if( Yii::$app->user->can('editor') ){
  115. ?>
  116. <span style="position: absolute;background-color: #a9a9a924;right: 30px;top: 10px; box-shadow: 2px 5px 5px 3px #888;"><img onclick="location='/manager/news/update?id=<?=$model['id']?>'" src="/img/edit.svg" width="25px" height="25px" style="padding:3px;cursor:pointer;"><img onclick="navigator.clipboard.writeText('https://www.amic.ru/news/<?=$model['id']?>');elementPopup(this,'Ссылка скопирована в буфер обмена');" src="/img/share-boxed.svg" width="25px" height="25px" style="padding:3px;margin-top: 2px;cursor:pointer;" ></span>
  117. <?
  118. }
  119. ?>
  120. <?=$this->render("/layouts/breadcrumbs")?>
  121. <h1><?=$model->title?></h1>
  122. <p class="lead"><?=$model->lid?></p>
  123. <p class="published_at"><?=$model->getPublishedNorm()?>, <?=$authorName?> <?= ($model->mark!="" && !is_null($model->mark)) ? \yii\helpers\Html::tag('span', 'erid: '.$model->mark,['class'=>'float-right']) : ""?></p>
  124. <p class="share_and_comment">
  125. <a href="#comments" class="comments_btn">Комментировать</a>
  126. <a onclick="Share.vkontakte('<?=Yii::$app->og->og_url?>','<?=addslashes(Yii::$app->og->og_title)?>','<?=Yii::$app->og->og_image?>','<?=str_replace( '"',"&quot; ",Yii::$app->og->og_description)?>')" href="#">
  127. <svg class="icon icon-vk"><use xlink:href="/svg/symbol/sprite-clear.svg#vk"></use></svg>
  128. </a>
  129. <a onclick="Share.odnoklassniki('<?=Yii::$app->og->og_url?>','<?=addslashes(Yii::$app->og->og_title)?>','<?=Yii::$app->og->og_image?>','<?=str_replace( '"',"&quot; ",Yii::$app->og->og_description)?>')" href="#">
  130. <svg class="icon icon-ok"><use xlink:href="/svg/symbol/sprite-clear.svg#ok"></use></svg>
  131. </a>
  132. <a onclick="navigator.clipboard.writeText('<?=Yii::$app->og->og_url?>'); elementPopup(this,'Ссылка скопирована в буфер обмена')" class="copy-link" href="#">
  133. <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 8 8">
  134. <use href="/img/share-boxed.svg#share"></use>
  135. </svg>
  136. </a>
  137. </p>
  138. <p>
  139. <?php if($model->photo_include == 'Y' && $model->image instanceof \app\models\base\Image):?>
  140. <div class="picture-cont-16x9">
  141. <picture class="w-100">
  142. <source srcset="<?=$normal?>, <?=$retina?> 2x" media="(min-width: 600px)">
  143. <img src="<?=$bad?>" alt="<?=htmlentities($model->photo_title,ENT_QUOTES)?>" srcset="<?=$normal?>, <?=$retina?> x2" title="<?=htmlentities($model->photo_title,ENT_QUOTES)?>" class="w-100">
  144. </picture>
  145. </div>
  146. <div class="image-title"><?=$model->photo_title?></div>
  147. <?php endif;?>
  148. </p>
  149. <section class="text">
  150. <?=$model->renderBody()?>
  151. <?=($model->inscription == 2)?'<span class="advertisement">Реклама</span>':''?>
  152. <?=($model->inscription == 1)?'<span class="advertisement">Реклама</span><br><span class="med_advertisement">Имеются противопоказания, необходима консультация специалиста</span>':''?>
  153. <?=($model->inscription == 3)?'<span class="advertisement">Партнёр amic.ru</span>':''?>
  154. </section>
  155. <?php
  156. echo $this->render("@app/views/news/view/tags",["model"=>$model]);
  157. ?>
  158. <section class="share-this">
  159. <?=$this->render("@app/views/reaction-buttons/button",["id"=>$model->id,"type"=>'news']);?><div id="ok_shareWidget" style="display: inline;"></div>
  160. <div style="clear: both;"></div>
  161. </section>
  162. <?
  163. // Временно ок для конкурса
  164. ?>
  165. <script>
  166. !function (d, id, did, st, title, description, image) {
  167. function init(){
  168. OK.CONNECT.insertShareWidget(id,did,st, title, description, image);
  169. }
  170. if (!window.OK || !OK.CONNECT || !OK.CONNECT.insertShareWidget) {
  171. var js = d.createElement("script");
  172. js.src = "https://connect.ok.ru/connect.js";
  173. js.onload = js.onreadystatechange = function () {
  174. if (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") {
  175. if (!this.executed) {
  176. this.executed = true;
  177. setTimeout(init, 0);
  178. }
  179. }};
  180. d.documentElement.appendChild(js);
  181. } else {
  182. init();
  183. }
  184. }(document,"ok_shareWidget",document.URL,'{"sz":30,"st":"oval","ck":1,"bgclr":"ED8207","txclr":"FFFFFF"}',"","","");
  185. </script>
  186. <?
  187. $stn = $story->getForNews($model->id);
  188. if( count($stn) > 0 ){
  189. echo $this->render("@app/views/news/view/story",["model"=>$stn, "id"=>$model->id]);
  190. foreach( $stn as $a ){
  191. jsonLD::story( trim( stripslashes( $a['title'] ) ) );
  192. }
  193. }
  194. ?>
  195. <?php if(Yii::$app->deviceDetect->isMobile()): ?>
  196. <section style="height: 300px;">
  197. <?=$this->render('@app/views/_etc/banners/bannerMobile3')?>
  198. </section>
  199. <?php else:?>
  200. <section style="height: 100px;">
  201. <?=$this->render('@app/views/_etc/banners/transparant5')?>
  202. </section>
  203. <?php endif;?>
  204. <section class="comments" id="comments">
  205. <?=$this->render("view/comments/list",["model"=>$model])?>
  206. </section>
  207. </div>
  208. </div>
  209. <script>
  210. (function (){
  211. let main_view_cont = document.getElementById('post');
  212. let height = main_view_cont.offsetHeight;
  213. console.log(height)
  214. let style = document.createElement("style");
  215. style.innerHTML = "#lenta-container{ max-height:"+height+"px;}";
  216. main_view_cont.parentNode.append(style);
  217. })()
  218. </script>
  219. <div class="<?=($model->type == 2 || $model->type == 6)?'hidden':'col-md-4'?>" id="lenta-container">
  220. <?=$this->render("/layouts/lenta/lenta_right")?>
  221. </div>
  222. <div class="col-md-12">
  223. <h3 class="mt-3" style="font-family: Helvetica,Arial,sans-serif;
  224. font-size: 20px;
  225. font-weight: 700;
  226. line-height: 24px;
  227. color: #373e44;
  228. padding-bottom: 12px;
  229. padding-top: 12px;">Новости партнеров</h3>
  230. <?//=$this->render('@app/views/_etc/banners/partnermetrics')?>
  231. <div id="ferst_partner_block"></div>
  232. <?/*
  233. <?=$this->render('@app/views/_etc/banners/partner3D')?>
  234. <?=$this->render('@app/views/_etc/banners/partner2D')?>
  235. <?=$this->render('@app/views/_etc/banners/partner1D')?>
  236. */?>
  237. <?php
  238. if(Yii::$app->deviceDetect->isMobile()){
  239. echo $this->render('@app/views/_etc/banners/moevideo');
  240. }
  241. ?>
  242. </div>
  243. <div class="col-md-12" id="infinity_newsfeed">
  244. <?=$this->render("view/infinity_newsfeed",['model'=>$model])?>
  245. </div>
  246. <div id="main-carousel" class="splide"></div>
  247. </div>
  248. <?php
  249. if( strpos( $model->text, 'class="InviewElement' ) !== false ){
  250. echo $this->render('view/inview');
  251. }
  252. ?>
  253. <?php
  254. $this->registerJsFile("/js/splide/dist/js/splide.min.js");
  255. $this->registerCssFile("/js/splide/dist/css/splide.min.css")
  256. ?>
  257. <script>
  258. var intersectionObserver = new IntersectionObserver(function(entries) {
  259. if (entries[0].intersectionRatio <= 0 || $(entries[0].target).html().length > 10 ) return;
  260. <?$code = $this->render('@app/views/_etc/banners/mytarget')?>
  261. <?$code .= $this->render('@app/views/_etc/banners/partner3D')?>
  262. <?$code .= $this->render('@app/views/_etc/banners/partner2D')?>
  263. <?$code .= $this->render('@app/views/_etc/banners/partner1D')?>
  264. <?$code .= $this->render('@app/views/_etc/banners/partner4D')?>
  265. var code = <?=json_encode($code)?>;
  266. $(entries[0].target).html(code);
  267. console.log('загрузить партнёрский блок');
  268. });
  269. (function (){
  270. intersectionObserver.observe(document.querySelector('#ferst_partner_block'));
  271. var gallery = document.getElementById("gallery-0");
  272. g = Array.from(document.getElementsByClassName('gallery'));
  273. g.forEach( (gallery) =>{ console.log(gallery);
  274. if(gallery!==null && !gallery.classList.contains("splide")) {
  275. var wrapper = document.createElement("div");
  276. wrapper.classList.add('gallery-wrapper')
  277. gallery.parentNode.insertBefore(wrapper, gallery)
  278. wrapper.append(gallery)
  279. var gallery_items = gallery.getElementsByTagName("img");
  280. var track = document.createElement("div");
  281. var list = document.createElement('ul');
  282. gallery.classList.add("splide")
  283. list.classList.add("splide__list")
  284. track.classList.add("splide__track")
  285. gallery.prepend(track)
  286. track.prepend(list)
  287. for (var i = 0; i < gallery_items.length; i++) {
  288. var img = gallery_items[i];
  289. var img_cont = document.createElement('li')
  290. img_cont.classList.add("splide__slide")
  291. img_cont.append(img)
  292. list.append(img_cont)
  293. }
  294. var main_view = document.createElement("div")
  295. main_view.classList.add("splide", "gallery-view");
  296. main_view.innerHTML = gallery.innerHTML;
  297. gallery.style.paddingBottom = "18px";
  298. gallery.style.marginBottom = 0;
  299. wrapper.prepend(main_view)
  300. }});
  301. document.addEventListener( 'DOMContentLoaded', function () {
  302. //return true;
  303. const galleries = document.querySelectorAll('.gallery-view');
  304. if(galleries.length>0){
  305. for (let i=0; i < galleries.length; i++){
  306. let element = galleries[i];
  307. if(element !== null){
  308. var main = new Splide(element, {
  309. type : 'fade',
  310. rewind : true,
  311. pagination: false,
  312. arrows : true,
  313. speed: 1000
  314. } );
  315. var thumbnails =new Splide( element.parentNode.querySelector('.gallery'), {
  316. fixedWidth: 100,
  317. fixedHeight: 60,
  318. gap : 10,
  319. rewind : true,
  320. pagination: false,
  321. isNavigation: true,
  322. arrows : false,
  323. } );
  324. main.sync( thumbnails );
  325. main.mount();
  326. thumbnails.mount();
  327. }
  328. }
  329. }
  330. if(document.querySelector('.gallery-view') !== null){
  331. // var main = new Splide( '.gallery-view', {
  332. // type : 'fade',
  333. // rewind : true,
  334. // pagination: false,
  335. // arrows : true,
  336. // speed: 1000
  337. // } );
  338. // var thumbnails =new Splide( '.gallery', {
  339. // fixedWidth: 100,
  340. // fixedHeight: 60,
  341. // gap : 10,
  342. // rewind : true,
  343. // pagination: false,
  344. // isNavigation: true,
  345. // arrows : false,
  346. // } );
  347. //
  348. // main.sync( thumbnails );
  349. // main.mount();
  350. // thumbnails.mount();
  351. }
  352. let fullscreenBtn = null;
  353. let gallery_wrappers = document.querySelectorAll('.gallery-wrapper');
  354. for (let i = 0; i < gallery_wrappers.length; i++) {
  355. fullscreenBtn = document.createElement('div');
  356. fullscreenBtn.classList.add('fullscreenButton');
  357. gallery_wrappers[i].append(fullscreenBtn)
  358. fullscreenBtn.onclick = function (){
  359. gallery_wrappers[i].classList.toggle('fullscreen')
  360. gallery_wrappers[i].querySelectorAll('.gallery-view img').forEach(function (elem) {
  361. elem.setAttribute('src', elem.dataset.original);
  362. })
  363. }
  364. }
  365. } );
  366. })()
  367. </script>
  368. <script>
  369. Share = {
  370. vkontakte: function(purl, ptitle, pimg, text) {
  371. url = 'https://vkontakte.ru/share.php?';
  372. url += 'url=' + encodeURIComponent(purl);
  373. url += '&title=' + encodeURIComponent(ptitle);
  374. url += '&description=' + encodeURIComponent(text);
  375. url += '&image=' + encodeURIComponent(pimg);
  376. url += '&noparse=true';
  377. Share.popup(url);
  378. },
  379. odnoklassniki: function(purl, text) {
  380. //url = 'https://www.odnoklassniki.ru/dk?st.cmd=addShare&st.s=1';
  381. url = 'https://connect.ok.ru/offer?';
  382. url += '&st.comments=' + encodeURIComponent(text);
  383. url += '&url=' + encodeURIComponent(purl);
  384. Share.popup(url);
  385. },
  386. facebook: function(purl, ptitle, pimg, text) {
  387. url = 'http://www.facebook.com/sharer.php?s=100';
  388. url += '&p[title]=' + encodeURIComponent(ptitle);
  389. url += '&p[summary]=' + encodeURIComponent(text);
  390. url += '&p[url]=' + encodeURIComponent(purl);
  391. url += '&p[images][0]=' + encodeURIComponent(pimg);
  392. Share.popup(url);
  393. },
  394. twitter: function(purl, ptitle) {
  395. url = 'https://twitter.com/share?';
  396. url += 'text=' + encodeURIComponent(ptitle);
  397. url += '&url=' + encodeURIComponent(purl);
  398. url += '&counturl=' + encodeURIComponent(purl);
  399. Share.popup(url);
  400. },
  401. mailru: function(purl, ptitle, pimg, text) {
  402. url = 'http://connect.mail.ru/share?';
  403. url += 'url=' + encodeURIComponent(purl);
  404. url += '&title=' + encodeURIComponent(ptitle);
  405. url += '&description=' + encodeURIComponent(text);
  406. url += '&imageurl=' + encodeURIComponent(pimg);
  407. Share.popup(url)
  408. },
  409. popup: function(url) {
  410. window.open(url,'','toolbar=0,status=0,width=626,height=436');
  411. }
  412. };
  413. const elementPopup = function (element, text)
  414. {
  415. console.log(element)
  416. const positionY = element.offsetTop;
  417. const positionX = element.offsetLeft;
  418. let popup = document.createElement("div")
  419. popup.style.position = 'absolute';
  420. popup.style.top = (positionY - 35) + 'px';
  421. popup.style.left = positionX + "px";
  422. popup.style.color = "white";
  423. popup.style.background = "#00000052";
  424. popup.style.borderRadius = "5px";
  425. popup.style.padding = "1px 20px";
  426. popup.style.opacity = "1";
  427. popup.style.transition = "0.3s";
  428. popup.innerHTML = text
  429. popup.classList.add('element-popup')
  430. element.parentNode.append(popup)
  431. setTimeout(function (){
  432. popup.style.opacity=0
  433. console.log(popup.style.transition)
  434. },3000)
  435. }
  436. </script>
  437. <?php if($model->mark!="" && !is_null($model->mark) && is_null(\Yii::$app->request->get('erid'))):?>
  438. <script>
  439. (function (){
  440. const url = new URL(location.href);
  441. url.searchParams.append('erid','<?=$model->mark?>')
  442. window.history.pushState({},'',url);
  443. })()
  444. </script>
  445. <?php endif;?>
  446. <script>
  447. (function (){
  448. const placeholders = document.getElementsByClassName('youtube-iframe-placeholder');
  449. if(placeholders.length>0){
  450. for(let i =0;i<placeholders.length;i++){
  451. placeholders[i].onclick = function (){
  452. const waiting = document.createElement("div");
  453. waiting.style.position = "absolute";
  454. waiting.style.width = "100%";
  455. waiting.style.height = "100%";
  456. waiting.style.background = "url('/img/loading.gif')";
  457. waiting.style.backgroundPosition = "center";
  458. waiting.style.backgroundRepeat = "no-repeat";
  459. waiting.style.backgroundSize = "contain";
  460. waiting.style.zIndex = 1;
  461. this.replaceWith(waiting);
  462. const iframe = document.createElement("iframe");
  463. iframe.src = this.dataset.link+"?autoplay=1";
  464. iframe.style.position = "absolute";
  465. iframe.style.zIndex = 2;
  466. iframe.width = "100%";
  467. iframe.height = "100%";
  468. iframe.title = "YouTube video player";
  469. iframe.frameBorder = "0";
  470. iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture";
  471. iframe.allowFullscreen = true;
  472. waiting.parentNode.append(iframe);
  473. }
  474. }
  475. }
  476. })()
  477. </script>
  478. <?
  479. // загрузить fotorama.js если есть тригер
  480. $c = Yii::$app->acache;
  481. if( $c->get('fotorama') === true || 1){
  482. $this->registerJsFile(
  483. '@web/js/fotorama/fotorama.js',
  484. [
  485. 'depends' => [\yii\web\JqueryAsset::class],
  486. 'defer' =>true,
  487. 'position' => View::POS_END
  488. ],
  489. 'js-fotorama'
  490. );
  491. $this->registerCssFile("@web/js/fotorama/fotorama.css", [], 'css-fotorama');
  492. }
  493. /*
  494. if( Yii::$app->deviceDetect->isMobile() ){
  495. $this->registerJs(
  496. <<<JS
  497. $(function () {
  498. loadScript( 'https://platform-api.sharethis.com/js/sharethis.js#property=63ecb32f4a4876001374e328&product=inline-reaction-buttons', 8000 );
  499. });
  500. JS
  501. ,
  502. $this::POS_READY,
  503. 'sharethis'
  504. );
  505. }else{
  506. $this->registerJs(
  507. <<<JS
  508. $(function () {
  509. loadScript( 'https://platform-api.sharethis.com/js/sharethis.js#property=63ecb32f4a4876001374e328&product=inline-reaction-buttons', 100 );
  510. });
  511. JS
  512. ,
  513. $this::POS_READY,
  514. 'sharethis'
  515. );
  516. }
  517. */