Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/momentjs/2.14.1/moment-with-locales.min.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Tveeder scroll back</title>
</head>
<body>
  <form>
    <h1>Tvrn back time</h1>
    <p>
      <strong>Generate tveeder scrollback links</strong>
    </p>
    <p>
      Dates must be in the format yyyy-mm-dd hh:mm <strong>using 24 hour time</strong> in your local time zone.
    </p>
    <p>
      <label for="from_date">From date </label>
      <input id="from_date" />
    </p>
    <p>
      <label for="to_date">To date</label>
      <input id="to_date" />
    </p>
    <p>
      <label for="channel">Channel</label>
      <select id="channel">
        <option value="560">ABC News 24</option>
        <option value="561">ABC</option>
        <option value="1589">Ten</option>
        <option value="1072">Nine</option>
        <option value="1328">Seven</option>
        <option value="785">SBS 1</option>
        <!--
        <option value=""></option>
        <option value=""></option>
        <option value=""></option>
        <option value=""></option>
        -->
      </select>
    </p>
    
    <p>
      <button id="make_it">Generate tveeder link</button>
    </p>
  </form>
  
  <p><a id="link" target="_blank">Click here</a></p>
</body>
</html>
 
var button = document.querySelector( '#make_it' );
var generateDates = function( event ) {
  event.preventDefault();
  
  var fromInput = document.querySelector( '#from_date' );
  var toInput = document.querySelector( '#to_date' );
  var channelInput = document.querySelector( '#channel' );
  var linkElement = document.querySelector( '#link' );
  
  var fromTime = moment( fromInput.value ).unix();
  var toTime = moment( toInput.value ).unix();
  var channel = channelInput.options[channelInput.selectedIndex].value;
  
  var href = "http://www.tveeder.com/" + 
    channel + "/byrange/?from=" + 
    fromTime + "&to=" + 
    toTime;
  
  linkElement.href = href;
};
button.addEventListener( 'click', generateDates );
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
peterwilsonccpro
0viewers