Advertisement
Guest User

mutlioctoprint

a guest
Apr 25th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.44 KB | None | 0 0
  1. <head>
  2.     <title>Printer Management</title>
  3.     <style>
  4.         body {
  5.           position: absolute;
  6.           margin: 0;
  7.           border: 0;
  8.           padding: 0;
  9.           top: 0;
  10.           bottom: 0;
  11.           left: 0;
  12.           right: 0;
  13.           display: flex;
  14.           flex-direction: column;
  15.           justify-content: space-between;
  16.           align-items: stretch;
  17.         }
  18.  
  19.         #divPrinterSelect {
  20.           display: flex;
  21.           justify-content: space-around;
  22.           overflow-x: auto;
  23.         }
  24.         #divPrinterSelect > div {
  25.           /*text styling*/
  26.           text-align: center;
  27.           white-space: nowrap;
  28.           user-select: none;
  29.           font-family: helvetica;
  30.           color: white;
  31.  
  32.           /*div appearance*/
  33.           margin: 10px;
  34.           padding: 10px;
  35.           flex: 1 0 100px;
  36.           background-color: green;
  37.           cursor: pointer;
  38.         }
  39.         #divPrinterSelect > div:hover, #divPrinterSelect > div.active {
  40.           background-color: lightgreen;
  41.         }
  42.         #frameOctopi {
  43.           border: 0;
  44.           flex-grow: 1;
  45.         }
  46.     </style>
  47.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  48.     <script type="text/javascript">
  49.         var printers = [
  50.             {
  51.                 name: 'MK3 Alpha',
  52.                 host: 'http://192.168.1.220/'
  53.             },
  54.             {
  55.                 name: 'MK3 Bravo',
  56.                 host: 'http://192.168.1.218/'
  57.             },
  58.             {
  59.                 name: 'MK3 Charly',
  60.                 host: 'http://192.168.1.222/'
  61.             },
  62.             {
  63.                 name: 'MK3 Delta',
  64.                 host: 'http://192.168.1.221/'
  65.             }
  66.         ];
  67.  
  68.         $(document).ready(function() {
  69.             for (var p = 0; p < printers.length; p++) {
  70.                var printer = printers[p];
  71.                var buttonText = (printer.name == null ? printer.host : printer.name);
  72.                $('#divPrinterSelect').append('<div data-host="' + printer.host + '">' + buttonText + '</div>');
  73.             }
  74.             $(document).on('click', '#divPrinterSelect div', function() {
  75.                 var printerHost = $(this).attr('data-host');
  76.                 $('#frameOctopi').attr('src', printerHost);
  77.             });
  78.         });
  79.     </script>
  80. </head>
  81. <body>
  82.     <div id="divPrinterSelect"></div>
  83.     <iframe id="frameOctopi"></iframe>
  84. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement