User:TheSpacebook/lifeline

A script and template to subtly embed a suicide crisis telephone number into a line of text. It assumes the number based on the geolocation of the IP and maps it to a number. The telephone numbers have been sourced from List of suicide crisis lines. The script also aims to mitigate WP:NOTDIRECTORY and WP:NODISCLAIMERS when discussions around this topic arise.

The intended usage is:. With the parameter  to display the name of the country if needed, and   if, for example, "the Netherlands" needs to be capitalized into "The Netherlands".

If used in the Suicide methods article
These include support, access to treatment, and calling a crisis hotline.

Would render in the US as: These include support, access to treatment, and calling a crisis hotline, such as 998 in the USA.

Would render in the UK as: These include support, access to treatment, and calling a crisis hotline, such as 0800 689 5652 in the UK.

Would render if not found as: These include support, access to treatment, and calling a crisis hotline.

Questions may arise if a VPN is detected, on whether it should default or display the country data of that VPN. To err on the side of caution, the VPN country data should just be displayed.

How it works
The script assumes the geolocation of the user by their IP address. It will return the ISO 3166-1 alpha-2 code, which is mapped to the suicide crisis telephone number of that country. It will output the telephone number.

Script
The last stable version of the script: version 1

The last stable version of the HTML tester: version 2.1

Template
This template will insert the suicide crisis telephone number relevant to the users geolocation, subtly in-text.

Usage
Use this template in-text, instead of a disclaimer or a banner. The is also default text if no number is found. It should be formatted like this:

Optional parameters
• – returns the name of the country if also needed.

• – returns the name of the country with the first letter is capitalized, for cases such as "the Netherlands".

Default behavior
These include support, access to treatment, and calling a crisis hotline .

Would render in the United States of America as: These include support, access to treatment, and calling a crisis hotline, such as 998 in the USA.

HTML page for testing
To test the script in a HTML webpage, copy-and-paste it into a text editor, save it with the extension ".html", and then open it in a web browser.