<commit_before>![plentymarkets Logo](http://www.plentymarkets.eu/layout/pm/images/logo/plentymarkets-logo.jpg)

# Additional tools

## Table of contents

- [ScriptLoader](#scriptloader)

## ScriptLoader

This snippet allows to define required JavaScript-files for different PageDesigns in a global .json-file.
Adding scripts to your plentymarkets Webshop does not require editing multiple layouts anymore.

### Usage
1. Define paths to required scripts in a .json-file, e.g. `scripts.json`.
```js
{
	"PageDesignGlobal": {		// These files will be loaded in all PageDesigns
		"head": [],				// Files to load in the <head> of the current page
		"body": []				// Files to load at the end of the <body> of the current page
	},
	"PageDesignContent": {		// These files will only be loaded in PageDesignContent
		"head": [],
		"body": []
	},
	"PageDesignCheckout": {
		"head": [],
		"body": []
	},
	"PageDesignMyAccount": {
		"head": [],
		"body": []
	}
}
```

2. Load the `ScriptLoader.js` inside the <head> of your different layouts

3. Call `ScriptLoader.load()` in your different layouts inside your <head> and <body> elements:
```js
ScriptLoader.load({
	// Define the design to load the scripts for, e.g. PageDesignContent
	layout: PageDesign$PageDesign,

	// The scripts to load of the currently selected design ("head" / "body")
	position: 'head',

	// The path to the folder containing all your JavaScript files
	rootPath: '{% GetGlobal('LayoutFolder'); %}',

	// The path to your .json-file. This parameter is not required if your .json-file is stored inside 'rootPath'
	sourceMap:'{% GetGlobal('LayoutFolder'); %}/js/plenty/scripts.json'
});
```<commit_msg>FIX inline code snippers in ScriptLoader documentation<commit_after>![plentymarkets Logo](http://www.plentymarkets.eu/layout/pm/images/logo/plentymarkets-logo.jpg)

# Additional tools

## Table of contents

- [ScriptLoader](#scriptloader)

## ScriptLoader

This snippet allows to define required JavaScript-files for different PageDesigns in a global .json-file.
Adding scripts to your plentymarkets Webshop does not require editing multiple layouts anymore.

### Usage
1. Define paths to required scripts in a .json-file, e.g. `scripts.json`.
```js
{
	"PageDesignGlobal": {		// These files will be loaded in all PageDesigns
		"head": [],				// Files to load in the <head> of the current page
		"body": []				// Files to load at the end of the <body> of the current page
	},
	"PageDesignContent": {		// These files will only be loaded in PageDesignContent
		"head": [],
		"body": []
	},
	"PageDesignCheckout": {
		"head": [],
		"body": []
	},
	"PageDesignMyAccount": {
		"head": [],
		"body": []
	}
}
```

2. Load the `ScriptLoader.js` inside the `<head>` of your different layouts

3. Call `ScriptLoader.load()` in your different layouts inside your `<head>` and `<body>` elements:
```js
ScriptLoader.load({
	// Define the design to load the scripts for, e.g. PageDesignContent
	layout: PageDesign$PageDesign,

	// The scripts to load of the currently selected design ("head" / "body")
	position: 'head',

	// The path to the folder containing all your JavaScript files
	rootPath: '{% GetGlobal('LayoutFolder'); %}',

	// The path to your .json-file. This parameter is not required if your .json-file is stored inside 'rootPath'
	sourceMap:'{% GetGlobal('LayoutFolder'); %}/js/plenty/scripts.json'
});
```
{'fraction_non_alphanumeric': 0.13610698365527488, 'fraction_numerical': 0.0017830609212481426, 'mean_word_length': 4.092284417549168, 'pattern_counts': {'":': 24, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3549671', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1017, 'n_words': 372}