<commit_before>tcs_notifier
============

A simple chrome extension that notifies you about ...? ( Depends on you ;) )  
The extension will send a request every x minutes to a specified URL and will pass the response data (array of objects) to a Handlebars Template which you can modify for your purposes.

## Specification

It's an extension for the **Browser Google Chrome**.  
Don't even try running this extension in Firefox, it won't work! (Well, i guess, you can't even load it.)


## Installation

### 1. Get the Extension from github

	git clone https://github.com/catyphram/tcs_notifier
	
### 2. Better make a copy of the folder since you may modify the files (especially the template)

	cp -aR tcs_notifier copy_of_tcs_notifier
	
### 3. And change into the directory

	cd copy_of_tcs_notifier

### 4. Install the depencencies via npm

	npm install
	
### 5. Modify the template (optional)

The enclosed template example expects an array of `{ title: '', date: '', subscriber: 0 }` objects.  
Since your api node may most likely response with different objects you need to modify the template to display the desired attributes. See [here](#template) for further instructions.

### 6. Rebuild the source files (optional)

If you modified any source files ( all files that are in `src/` ) you need to rebuild the `build` folder. See [here](#build).

### 7. Load the extension into Google Chrome

* Type `chrome://extensions/` into your Google Chrome browser
* Check the `developer mode` checkbox
* `load unpacked extension` and select `copy_of_tcs_notifier/build`

### 8. Celebrate!


## <a name="template"></a>Template

To define which data should be displayed in the popup (The window that open when you click the icon.) you need to modify the Handlebars template `src/popup.hbs` The response of the requested api node will be passed to the template, so you can define which data to be displayed.

The whole object passed to the template:

```
{
	data: {
		items: [] # The response from the api node
	},
	buttonURL: '' # The URL the button will lead to
}
```

Visit `http://handlebarsjs.com/` for the Handlebars Syntax.

Don't forget to rebuild the extension!!


## <a name="build"></a>Build

If you manually change the source files ( everything in `src/` ) you need to rebuild the `build/` folder. Gulp will do this work for us.

You can either install gulp global (if not already installed) via 
	
	npm install -g gulp

or use the local version already downloaded with the `npm install` before.

Run global version:

	gulp

Run local version:

	./node_modules/.bin/gulp
	
The `build/` folder is completely built from the `src/` folder. Please only modify the files in `src/`!
	
	
## API Node

The api node defined via the exstension setting 'Request URL' will be requested with an empty GET request.

Example Requeset:

	GET host:port/your/node/
	
The API needs to respond with an array of objects (pure JSON, not stringified). The attributes of the objects are not defined and can be handled in the [Popup-Template](#template). If there are no objects available, please respond with an empty array.

Example Response Array (directly passed to the template) :

```
[
	{ title: 'First Object Title', 'count': 5 },
	{ title: 'Sedond Object Title', 'count': 7 },
	...
]
```


## Extension Settings

* Request Interval  
The time in minutes the extension will request the data from the specified URL.
* Request URL  
URL to the api node that will return an array of objects.
* Popup Button URL  
URL that will open in a new window when clicked on the Button in the Popup-Window.
* Notification Title  
Title of the desktop notification, displayed above the item list.
* Enable Notifications  
Whether to display a desktop notification or not when new data is available.

## settings.json

This JSON formatted file contains the default values of the extension settings.

If you have never saved your settings ( value of a option is `undefined` ) these settings will be used instead. ( Note: Empty Strings are not `undefined`. )

That means: If you load this extension the first time these settings will be loaded till you once saved the extension settings in the settings page.

Feel free to modify them, so you don't need to reconfigure your settings every time you reinstall the extension.<commit_msg>Added link option to readme<commit_after>tcs_notifier
============

A simple chrome extension that notifies you about ...? ( Depends on you ;) )  
The extension will send a request every x minutes to a specified URL and will pass the response data (array of objects) to a Handlebars Template which you can modify for your purposes.

## Specification

It's an extension for the **Browser Google Chrome**.  
Don't even try running this extension in Firefox, it won't work! (Well, i guess, you can't even load it.)


## Installation

### 1. Get the Extension from github

	git clone https://github.com/catyphram/tcs_notifier
	
### 2. Better make a copy of the folder since you may modify the files (especially the template)

	cp -aR tcs_notifier copy_of_tcs_notifier
	
### 3. And change into the directory

	cd copy_of_tcs_notifier

### 4. Install the depencencies via npm

	npm install
	
### 5. Modify the template (optional)

The enclosed template example expects an array of `{ title: '', date: '', subscriber: 0 }` objects.  
Since your api node may most likely response with different objects you need to modify the template to display the desired attributes. See [here](#template) for further instructions.

### 6. Rebuild the source files (optional)

If you modified any source files ( all files that are in `src/` ) you need to rebuild the `build` folder. See [here](#build).

### 7. Load the extension into Google Chrome

* Type `chrome://extensions/` into your Google Chrome browser
* Check the `developer mode` checkbox
* `load unpacked extension` and select `copy_of_tcs_notifier/build`

### 8. Celebrate!


## <a name="template"></a>Template

To define which data should be displayed in the popup (The window that open when you click the icon.) you need to modify the Handlebars template `src/popup.hbs` The response of the requested api node will be passed to the template, so you can define which data to be displayed.

The whole object passed to the template:

```
{
	data: {
		items: [] # The response from the api node
	},
	buttonURL: '' # The URL the button will lead to
}
```

Visit `http://handlebarsjs.com/` for the Handlebars Syntax.

Don't forget to rebuild the extension!!


## <a name="build"></a>Build

If you manually change the source files ( everything in `src/` ) you need to rebuild the `build/` folder. Gulp will do this work for us.

You can either install gulp global (if not already installed) via 
	
	npm install -g gulp

or use the local version already downloaded with the `npm install` before.

Run global version:

	gulp

Run local version:

	./node_modules/.bin/gulp
	
The `build/` folder is completely built from the `src/` folder. Please only modify the files in `src/`!
	
	
## API Node

The api node defined via the exstension setting 'Request URL' will be requested with an empty GET request.

Example Requeset:

	GET host:port/your/node/
	
The API needs to respond with an array of objects (pure JSON, not stringified). The attributes of the objects are not defined and can be handled in the [Popup-Template](#template). If there are no objects available, please respond with an empty array.

Example Response Array (directly passed to the template) :

```
[
	{ title: 'First Object Title', 'count': 5 },
	{ title: 'Sedond Object Title', 'count': 7 },
	...
]
```


## Extension Settings

* Request Interval  
The time in minutes the extension will request the data from the specified URL.
* Request URL  
URL to the api node that will return an array of objects.
* Popup Button URL  
URL that will open in a new window when clicked on the Button in the Popup-Window.  
* Browser Button Action
Action that should be performed when clicked on the button in the browser bar.
	* Open Popup Window (internal: `openPopup`)
	Open the Popup Window with the list of available items.
	* Open Popup Button Link (internal: `openLink`)
	Open the link specified in `Popup Button URL` in a new tab.
* Notification Title  
Title of the desktop notification, displayed above the item list.
* Enable Notifications  
Whether to display a desktop notification or not when new data is available.

## settings.json

This JSON formatted file contains the default values of the extension settings.

If you have never saved your settings ( value of a option is `undefined` ) these settings will be used instead. ( Note: Empty Strings are not `undefined`. )

That means: If you load this extension the first time these settings will be loaded till you once saved the extension settings in the settings page.

Feel free to modify them, so you don't need to reconfigure your settings every time you reinstall the extension.
{'fraction_non_alphanumeric': 0.07555605230803622, 'fraction_numerical': 0.0024589247792556166, 'mean_word_length': 3.9960915689558907, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2781563', 'n_tokens_mistral': 2470, 'n_tokens_neox': 2334, 'n_words': 1311}