view-page.php
См. документацию.
1 <?php
2 
3 /**
4  * @file
5  * @brief окно с просмотром страницы в полный экран во фрейме
6  */
7 
8 isset($user) or require $_SERVER['DOCUMENT_ROOT'] . '/page/404.php';
9 
10 ?>
11 <div class="modal fade" id="<?= $basename ?>" tabindex="-1" data-backdrop="static">
12  <div class="modal-dialog modal-xl modal-dialog-centered modal-dialog-scrollable w-100 mw-100 h-100 p-0 m-0 position-fixed" style="max-width: 100%;max-height:100%;" role="document">
13  <div class="modal-content w-100 h-100 rounded-0 border-0">
14  <div id="drag-menu" class="position-absolute d-flex flex-column slide-in-elliptic-left-fwd" style="height:180px;row-gap:8px;z-index:11111111;left:15px;top:100px;">
15  <a class="btn btn-danger btn-sm" title="Закрыть" data-dismiss="modal" href=""><i class="fa fa-times-circle"></i></a>
16  <a id="reload-frame" class="btn btn-primary btn-sm" title="Перезагрузить" href=""><i class="fas fa-redo-alt"></i></a>
17  <a class="btn btn-primary btn-sm" title="Открыть вне фрейма" target="_blank" href="<?= htmlspecialchars($_GET['uri']) ?>"><i class="fa fa-external-link"></i></a>
18  <a data-toggle="modal" data-target="#view-page-mobile" class="btn btn-primary btn-sm" title="В мобильном" href="#"><i class="fa fa-mobile"></i></a>
19  <span id="drag-menu-button" class="btn btn-primary btn-sm" title="Переместить меню" style="cursor:move;user-select:none;"><i class="fa fa-arrows"></i></span>
20  </div>
21  <div class="modal-body p-0">
22  <iframe src="<?= htmlspecialchars($_GET['uri']) ?>" frameborder="0" class="w-100" style="min-height:100%;"></iframe>
23  </div>
24  </div>
25  </div>
26  <script>
27  $('#<?= $basename ?> iframe').on('load', function() {
28  this.contentWindow.$('head').append('<style>body::-webkit-scrollbar{width:0;}</style>');
29  });
30 
31  $(function() {
32  // The current position of mouse
33  let x = 0;
34  let y = 0;
35 
36  // Query the element
37  const ele = document.getElementById('drag-menu');
38  const drag = document.getElementById('drag-menu-button');
39 
40  // Handle the mousedown event
41  // that's triggered when user drags the element
42  const mouseDownHandler = function(e) {
43  // Get the current mouse position
44  x = e.clientX;
45  y = e.clientY;
46 
47  // Attach the listeners to `document`
48  document.addEventListener('mousemove', mouseMoveHandler);
49  document.addEventListener('mouseup', mouseUpHandler);
50  };
51 
52  const mouseMoveHandler = function(e) {
53  // How far the mouse has been moved
54  const dx = e.clientX - x;
55  const dy = e.clientY - y;
56 
57  // Set the position of element
58  ele.style.top = `${ele.offsetTop + dy}px`;
59  ele.style.left = `${ele.offsetLeft + dx}px`;
60 
61  // Reassign the position of mouse
62  x = e.clientX;
63  y = e.clientY;
64  };
65 
66  const mouseUpHandler = function() {
67  // Remove the handlers of `mousemove` and `mouseup`
68  document.removeEventListener('mousemove', mouseMoveHandler);
69  document.removeEventListener('mouseup', mouseUpHandler);
70  };
71 
72  drag.addEventListener('mousedown', mouseDownHandler);
73  });
74 
75  $(document).on("click", "#view-page #reload-frame", function(e) {
76  e.preventDefault();
77  let URL = $('#view-page iframe')[0].contentDocument.URL;
78  $("#view-page iframe").attr("src", "");
79  setTimeout(() => {
80  $("#view-page iframe").attr("src", URL);
81  }, 100);
82  });
83  </script>
84 </div>
$user
Definition: from-user.php:38
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' $_SERVER['HTTP_HOST']
Definition: from-user.php:36
if(! $user->id) демо версия data toggle
Definition: comments.php:17
href
Definition: main.php:21