Advertisement
metalx1000

URL Schedule

Feb 27th, 2020
862
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <!-- example
  3. http://filmsbykris.com/scripts/2020/schedule/?s=Monday^Ember|Connor^Math%20Sheets|Activity%20Sheets^Review^30%20Minute%20Break^Math%20Lesson|Reading%20Time
  4. -->
  5. <html lang="en">
  6.   <head>
  7.     <title>Schedule</title>
  8.     <meta charset="utf-8">
  9.     <meta name="viewport" content="width=device-width, initial-scale=1">
  10.     <style>
  11.       .grid-container {
  12.         display: grid;
  13.       }
  14.  
  15.       .grid-container--fill {
  16.         grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  17.       }
  18.  
  19.       .grid-container--fit {
  20.         grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  21.       }
  22.  
  23.       .grid-element {
  24.         background-color: blue;
  25.         padding: 20px;
  26.         font-size:50px;
  27.         color: #fff;
  28.         text-align: center;
  29.         border: 1px solid #fff;
  30.       }
  31.     </style>
  32.     <script src="https://code.jquery.com/jquery-3.1.1.min.js" crossorigin="anonymous"></script>
  33.     <script>
  34.       let id=0;
  35.       $(document).ready(function(){
  36.         let s=getVar("s");
  37.         s = decodeURIComponent(s);
  38.         console.log(s);
  39.         display(s);
  40.       });
  41.  
  42.       function display(s){
  43.         var line = s.split("^");
  44.         for( l of line ){
  45.           $("#main").append('<div class="grid-container grid-container--fit" id="'+id+'">');
  46.             var s = l.split("|");
  47.             for( i of s ){
  48.               console.log(i);
  49.               $("#" + id).append('<div class="grid-element">'+i+'</div>');
  50.             }
  51.             id++;
  52.           }
  53.         }
  54.  
  55.         function getVar(variable){
  56.           var query = window.location.search.substring(1);
  57.           var vars = query.split("&");
  58.           for (var i=0;i<vars.length;i++) {
  59.             var pair = vars[i].split("=");
  60.             if(pair[0] == variable){return pair[1];}
  61.           }
  62.           return(false);
  63.         }
  64.       </script>
  65.     </head>
  66.     <body>
  67.       <div id="main"></div>
  68.  
  69.  
  70.     </body>
  71.   </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement