Context Widgets:
How To Use

Description

Context Widgets are a tool that makes it possible to create pop-up context windows providing additional information about vehicles or players on web pages.

These widgets make it easier and faster for users to find useful information.
Example of usage (hover over a vehicle name underlined with dots)

Adding Widgets

To start using Context Widgets, add the following code to your web resource: <!-- CCW loader --> <script type="text/javascript"> (function(w,d,s,p){ var f=d.getElementsByTagName(s)[0],j=d.createElement(s),i; j.async=true;j.src='//'+p['server']+'/compiled/loader.min.js';j.setAttribute('id', 'ccw-loader'); for(i in p){if (p.hasOwnProperty(i)) {j.setAttribute('data-'+i,p[i]);}} f.parentNode.insertBefore(j,f); })(window,document,'script',{ 'server':'ccw-center.wargaming.net', 'language':'ru', 'service':'service_name' }); </script> <!-- /CCW loader -->

Specify the necessary values for the following variables:

  • 'language' — specify the language you want to use for this widget. For example, if you want to use Russian, enter ‘ru’. The list of supported languages: 'cs', 'de', 'en', 'es', 'es_AR', 'fr', 'pl', 'pt_BR', 'ru', 'tr'
  • 'service' — specify the domain name of the web resource the widget will be used for (do not include the http and www parts, for example: ‘mysite.ru’)

Usage

The script will automatically scan the page for tags with the class="ccw-word" attribute and add pop-up windows with additional information to the objects found. These pop-up windows will open when hovered over.

Vehicle Widget

<span class="ccw-word" data-type="vehicle_wot__ru">Tankname</span>

For the value of the data-type parameter, specify the vehicle_wot widget type and the necessary region. 4 regions are currently supported:

  • CIS — "vehicle_wot__ru"
  • Europe — "vehicle_wot__eu"
  • North America — "vehicle_wot__us"
  • Asia — "vehicle_wot__sg"

For the script to upload the information for the correct vehicles, use the following field values for Tankname:

  • Tag field value from the Vehicles method
  • Name field value from the Vehicles method

User Widget

<span class="ccw-word" data-type="user_wot__ru">Username</span>

For the value of the data-type parameter, specify the user_wot widget type and the necessary region. 4 regions are currently supported:

  • CIS — "user_wot__ru"
  • Europe — "user_wot__eu"
  • North America — "user_wot__us"
  • Asia — "user_wot__sg"

For the Username parameter, use a player’s nickname, for example, from the Players and Player Personal Data methods.