<commit_before># Analog Time Picker

Show an analog time picker so that users can input time more intuitively with a
clock-style interface.

[View documentation with interactive examples.](http://analogtimepicker.z10.us/)

## Dependencies

The analog time picker has no external dependencies. You'll just need to add the
following lines to your HTML to start using the analog time picker component.

```html
<link rel="stylesheet" href="analogtimepicker.css">
<script src="analogtimepicker.js"></script>
```

## Examples

### Inline time picker

```html
<div id="inlinepicker"></div>
<script>
  var container = document.getElementById('inlinepicker');
  new AnalogTimePicker(container);
</script>
```

### Popup time picker

```html
<input type="text" id="time">
<script>
  var input = document.getElementById('time');
  new AnalogTimePicker(input);
</script>
```

## Usage

### Methods

#### AnalogTimePicker(element)
Initializes a time picker. If the element supplied is an `<input>`, the time
picker will be created in a popup shown when the user starts to edit the
`<input>`. Otherwise, the element will be a container for the time picker.
```javascript
var container = document.getElementById('timepicker');
var picker = new AnalogTimePicker(container);
```

#### .getHour()
Gets the currently selected hour.
```javascript
picker.getHour()
```

#### .setHour(number)
Sets the currently selected hour to the specified number.
```javascript
picker.setHour(12)
```

#### .getMinute()
Gets the currently selected minute.
```javascript
picker.getMinute()
```

#### .setMinute(number)
Sets the currently selected minute to the specified number.
```javascript
picker.setMinute(59)
```

#### .getMode()
Gets whether the time picker is currently set to pick an hour or a minute. The
returned value is 'hour' or 'minute'.
```javascript
picker.getMode()
```

#### .setMode('hour' | 'minute')
Sets whether the time picker should be set to pick an hour or a minute.
```javascript
picker.setMode('hour')
```

#### .showPopup()
Reveals the popup.
```javascript
picker.showPopup()
```

#### .hidePopup()
Hides the popup.
```javascript
picker.hidePopup()
```

#### .addEventListener(type, function)
Specify a function to call when an event of the specified type is triggered.
```javascript
picker.addEventListener('timechange', function() {
  console.log('hour: ' + this.getHour() + ' minute: ' + this.getMinute());
});
```

#### .removeEventListener(type, function)
Remove a previously added function from being called when an event is triggered.
```javascript
picker.removeEventListener('timechange', previouslyAddedListener);
```<commit_msg>Fix formatting on JavaScript snippets.<commit_after># Analog Time Picker

Show an analog time picker so that users can input time more intuitively with a
clock-style interface.

[View documentation with interactive examples.](http://analogtimepicker.z10.us/)

## Dependencies

The analog time picker has no external dependencies. You'll just need to add the
following lines to your HTML to start using the analog time picker component.

```html
<link rel="stylesheet" href="analogtimepicker.css">
<script src="analogtimepicker.js"></script>
```

## Examples

### Inline time picker

```html
<div id="inlinepicker"></div>
<script>
  var container = document.getElementById('inlinepicker');
  new AnalogTimePicker(container);
</script>
```

### Popup time picker

```html
<input type="text" id="time">
<script>
  var input = document.getElementById('time');
  new AnalogTimePicker(input);
</script>
```

## Usage

### Methods

#### AnalogTimePicker(element)
Initializes a time picker. If the element supplied is an `<input>`, the time
picker will be created in a popup shown when the user starts to edit the
`<input>`. Otherwise, the element will be a container for the time picker.
```javascript
var container = document.getElementById('timepicker');
var picker = new AnalogTimePicker(container);
```

#### .getHour()
Gets the currently selected hour.
```javascript
picker.getHour()
```

#### .setHour(number)
Sets the currently selected hour to the specified number.
```javascript
picker.setHour(12)
```

#### .getMinute()
Gets the currently selected minute.
```javascript
picker.getMinute()
```

#### .setMinute(number)
Sets the currently selected minute to the specified number.
```javascript
picker.setMinute(59)
```

#### .getMode()
Gets whether the time picker is currently set to pick an hour or a minute. The
returned value is 'hour' or 'minute'.
```javascript
picker.getMode()
```

#### .setMode('hour' | 'minute')
Sets whether the time picker should be set to pick an hour or a minute.
```javascript
picker.setMode('hour')
```

#### .showPopup()
Reveals the popup.
```javascript
picker.showPopup()
```

#### .hidePopup()
Hides the popup.
```javascript
picker.hidePopup()
```

#### .addEventListener(type, function)
Specify a function to call when an event of the specified type is triggered.
```javascript
picker.addEventListener('timechange', function() {
  console.log('hour: ' + this.getHour() + ' minute: ' + this.getMinute());
})
```

#### .removeEventListener(type, function)
Remove a previously added function from being called when an event is triggered.
```javascript
picker.removeEventListener('timechange', previouslyAddedListener)
```
{'fraction_non_alphanumeric': 0.13902023832040855, 'fraction_numerical': 0.0022697181766597315, 'mean_word_length': 5.4330900243309, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3329025', 'n_tokens_mistral': 1566, 'n_tokens_neox': 1479, 'n_words': 556}