proto.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <title></title>
  7. <link rel="stylesheet" type="text/css" href="css/cmd.min.css">
  8. </head>
  9. <body>
  10. <style type="text/css">
  11. body {
  12. background: orange;
  13. }
  14. #cmd {
  15. width: 100%;
  16. height: 400px;
  17. transition: all .15s linear;
  18. }
  19. #cmd.fullscreen {
  20. z-index: 9998;
  21. width: 100%;
  22. height: 100%;
  23. top: 0 !important;
  24. left: 0 !important;
  25. }
  26. #loader {
  27. position: fixed;
  28. z-index: 9999;
  29. width: 100%;
  30. height: 100%;
  31. top: 0 !important;
  32. left: 0 !important;
  33. background: blue;
  34. }
  35. .window {
  36. border: 4px solid #f1f1f1;
  37. border-top-left-radius: 4px;
  38. border-top-right-radius: 4px;
  39. }
  40. .window-toolbar {
  41. padding: 10px;
  42. background: #f1f1f1;
  43. border-top-left-radius: 4px;
  44. border-top-right-radius: 4px;
  45. }
  46. /* Clear floats after the columns */
  47. .window-toolbar:after {
  48. content: "";
  49. display: table;
  50. clear: both;
  51. }
  52. .window-toolbar-left {
  53. float: left;
  54. width: 10%;
  55. }
  56. .window-toolbar-center {
  57. float: left;
  58. width: 75%;
  59. text-align: center;
  60. }
  61. .window-toolbar-right {
  62. float: left;
  63. width: 15%;
  64. text-align: right;
  65. }
  66. .dot {
  67. margin-top: 4px;
  68. height: 12px;
  69. width: 12px;
  70. background-color: #bbb;
  71. border-radius: 50%;
  72. display: inline-block;
  73. cursor: pointer;
  74. }
  75. .hide {
  76. display: none;
  77. }
  78. </style>
  79. <div id="loader"></div>
  80. <h1>Hello</h1>
  81. <div class="window">
  82. <div class="window-toolbar">
  83. <div class="window-toolbar-left">
  84. Cmd
  85. </div>
  86. <div class="window-toolbar-center">
  87. Je suis un titre
  88. </div>
  89. <div class="window-toolbar-right">
  90. <span class="dot" onclick="show()" style="background:#5AC05A;"></span>
  91. <span class="dot" onclick="test()" style="background:#FDD800;"></span>
  92. <span class="dot" onclick="window.close()" style="background:#ED594A;"></span>
  93. </div>
  94. </div>
  95. <div id="cmd">
  96. <button onclick="test()">FS</button>
  97. </div>
  98. </div>
  99. <script src="js/jquery.min.js"></script>
  100. <script src="js/cmd.js"></script>
  101. <script type="text/javascript">
  102. const shell = new Cmd({
  103. selector: '#cmd',
  104. busy_text: 'Traitement...',
  105. unknown_cmd: 'Commande non reconnue, tapez "aide" pour avoir la liste des commandes disponibles'
  106. });
  107. test();
  108. setTimeout(() => {
  109. $('#loader').remove();
  110. }, 500);
  111. function test() {
  112. const pos = $('#cmd').position();
  113. if (!$('#cmd').hasClass('fullscreen')) {
  114. $('#cmd').css('top', Math.trunc(pos.top) + 'px');
  115. $('#cmd').css('left', Math.trunc(pos.left) + 'px');
  116. $('#cmd').css('position', 'fixed');
  117. } else {
  118. $('#cmd').one('transitionend', function() {
  119. $('#cmd').css('top', '');
  120. $('#cmd').css('left', '');
  121. $('#cmd').css('position', '');
  122. });
  123. }
  124. $('#cmd').toggleClass('fullscreen');
  125. }
  126. function show() {
  127. if ($('#cmd').hasClass('pasla')) {
  128. //$('#cmd').toggleClass('hide');
  129. $('#cmd').css('height', '');
  130. } else {
  131. $('#cmd').css('height', '0');
  132. /*$('#cmd').one('transitionend', () => {
  133. $('#cmd').toggleClass('hide');
  134. });*/
  135. }
  136. $('#cmd').toggleClass('pasla');
  137. }
  138. </script>
  139. </body>
  140. </html>