May 27, 2018, 07:46:05 AM

News:

NEW! Minix Neo X-8H Plus support & Kodi 15.X+ support


Gearbest Banner

Recent Posts

Pages1 2 3 ... 10
1
Personalized BBC / Clickable phone number BBCode
Last post by Chen Zhen - May 20, 2018, 04:46:34 PM
name: phone
description: Call this number
type: [tag]{content}[/tag]
parsing: {content} only

Code Select
<script type="text/javascript">
var tel_id = Math.random().toString(36).replace(/[^a-z]+/g, '').substr(2, 10);
document.write('<div style="display: inline;" id="' + tel_id + '"></div>');
var link = document.createElement("a");
var tel_number1 = "{content}";
var tel_number2 = tel_number1;
var view_filter = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,3})|(\(?\d{2,3}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/g;
var tel_filter = /\D/g;
var tel_type = "tel://";
link.textContent = tel_number1.replace(view_filter, "");
link.href = tel_type + tel_number2.replace(tel_filter, "");
document.getElementById(tel_id).appendChild(link);
</script>

The regex in these variables can be altered:
view_filter -> what is displayed to members
tel_filter -> the number used in the clickable link

the type of call can also be altered:
tel_type -> ie. use "callto://" or "tel://"




other possible regex filter examples:

re. DISPLAY

U.S./Canada phone numbers ~ display:
Code Select
var view_filter = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;




re. CLICKABLE LINK
International ~ link filter:
Code Select
var tel_filter = /[\s()+\-\.]|ext/gi;

Code Select
var tel_filter = /^\+[0-9]?()[0-9](\s|\S)(\d[0-9]{9})$/gm;

Code Select
var tel_filter = /^[+]?([0-9]*[\.\s\-\(\)]|[0-9]+){3,24}$/gm;




If someone can reference a single javascript file phone number filter (using a jQuery library is fine) then I will test it and possibly include it in this example.

ref support thread: https://web-develop.ca/index.php?topic=239.0
2
Personalized BBC / Re: Clickable phone number BBC...
Last post by Chen Zhen - May 20, 2018, 04:23:35 PM

Yes here on this site.
The bbcode was made for you as requested and temporarily tested here as an example but I have no need for such a feature.
3
Personalized BBC / Re: Clickable phone number BBC...
Last post by jernatety - May 20, 2018, 04:03:29 PM
Quote from: Chen Zhen on May 20, 2018, 03:10:11 PMNote: The forementioned bbcode has been disabled and was only used at the time as a

Do you mean on your site?
4
Personalized BBC / Re: Clickable phone number BBC...
Last post by Chen Zhen - May 20, 2018, 03:10:11 PM
Note: The forementioned bbcode has been disabled and was only used at the time as an example.
5
Personalized BBC / Re: Clickable phone number BBC...
Last post by Chen Zhen - May 20, 2018, 03:02:38 PM
You're welcome.

If it isn't working unless the 1 is entered then it is an improper regex command.
I didn't thoroughly test the regex I gave you but I did give you the info you need to find other regex examples.
You'll just need to try other regex until you get the behavior you want.

Code Select
var view_filter = /^((\+\d{1,3}(-| )?\(?\d\)?(-| )?\d{1,3})|(\(?\d{2,3}\)?))(-| )?(\d{3,4})(-| )?(\d{4})(( x| ext)\d{1,5}){0,1}$/g;
var tel_filter = /\D/g;
6
Personalized BBC / Re: Clickable phone number BBC...
Last post by jernatety - May 20, 2018, 02:55:23 PM
Quote from: Chen Zhen on May 20, 2018, 02:49:03 PMHere is a test of entering 1-555-555-5555 in the discussed bbcode:

Phone: [phone]1(555)555-5555[/phone]

above is entered as:
Code Select
Here is a test of entering 1-555-555-5555 in the discussed bbcode:

Phone: [phone]1(555)555-5555[/phone]

It works for me locally & live on this site.

.. I also tested this on my mobile using chrome browser.

Ok, it works now. My number was (555)555-5555. I changed it to 1-555-555-5555 and put the tags on and it works now. GREAT! Thanks for your help and great mod.
7
Personalized BBC / Re: Clickable phone number BBC...
Last post by Chen Zhen - May 20, 2018, 02:49:03 PM
Here is a test of entering 1-555-555-5555 in the discussed bbcode:

Phone: [phone]1(555)555-5555[/phone]

above is entered as:
Code Select
Here is a test of entering 1-555-555-5555 in the discussed bbcode:

Phone: [phone]1(555)555-5555[/phone]

It works for me locally & live on this site.

.. I also tested this on my mobile using chrome browser.
8
Personalized BBC / Re: Clickable phone number BBC...
Last post by jernatety - May 20, 2018, 02:38:42 PM
Yup, that's what I have. When I put the tags around a phone number in a post, the phone number disappears.
9
Personalized BBC / Re: Clickable phone number BBC...
Last post by Chen Zhen - May 20, 2018, 02:20:34 PM
Make sure parsing is set to content only.
phone-bbcode-settings.png
10
Personalized BBC / Re: Clickable phone number BBC...
Last post by jernatety - May 20, 2018, 01:33:19 PM
Ok, I saved it. I went to my board and put the [phone][/phone] tags around a phone number and saved. The phone number disappears.
Pages1 2 3 ... 10