main.js is a file inside the whiteCollar that defines various elements of a customer's Marfeel Progressive WebApp (PWA) such as a publisher's commenting system, metrics configuration, and image galleries.
The following article provides usage examples of configurations in the main.js.
Embed custom commenting system
- Locate the commenting system to add in the publisher's articles.
- Identify the container for each comment and the answers form.
Select the containers and paste them in the definition.json.
In js/main.js before the return:
Image Gallery RegEx reSize
A RegEx can be added to resize gallery images by substituting "/small/" and "/big/" as appropriate:
To import the metrics used:
To pass metrics in main.js body:
Google Universal analytics are identified by the presence of the file "analytics.js" in the source code:
Otherwise the source code includes a "ga.js" file and is registered in Marfeel as:
The name of the tenant cannot contain capital letters or signs (for example, !,?,$,%,&, etc.).
The field name cannot contain any character such as “/,(,etc." It can only be letters and numbers.
Metrics in Charles
The URLs of the metrics are the following and should be treated with close attention:
To arrange tables and display it in an iframe:
Select the table with regular classes and ids. The name is unimportant.