Created
February 3, 2011 18:11
-
-
Save skipjac/809895 to your computer and use it in GitHub Desktop.
detects the language of a zendesk enduser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="userNamewidget"> | |
| </div> | |
| <script> | |
| $j(document).ready(function() { | |
| function trim11 (str) { | |
| str = str.replace(/^\s+/, ''); | |
| for (var i = str.length - 1; i >= 0; i--) { | |
| if (/\S/.test(str.charAt(i))) { | |
| str = str.substring(0, i + 1); | |
| break; | |
| } | |
| } | |
| return str; | |
| } | |
| var selectedLang = ""; | |
| if('{{current_user.name}}' == 'Anonymous user'){ | |
| selectedLang = $j('li.main.right.language_selector a.tab').text(); | |
| $j('div#userNamewidget').html(selectedLang); | |
| if(trim11(selectedLang) == 'English'){ $j('div#userNamewidget').html('<p>Welcome to our Support Portal! Do you have a question?</p><p><strong>Our Support Team is happy to help you!</strong></p><p><img src="../../../attachments/token/fvmlyq19bnpr3fo/?name=Telefon.jpg" style="float: left; margin: 0px 5px 0px 0px;" border="0" alt="Telefon.jpg" width="25" height="25" />+49 (0)89 95414 800</p><p style="padding-left: 30px;">Monday to Friday</p><p style="padding-left: 30px;">7.30 a.m. to 6.00 p.m. (CET)</p><p><a href="mailto:support@conject.com"><img src="/attachments/token/xezlwqoiu74ia1v/?name=E-Mail_Icon.jpg" style="vertical-align: middle; margin-left: 0px; margin-right: 5px;" border="0" alt="E-Mail_Icon.jpg" width="25" height="25" /></a> <a href="mailto:support@conject.com">support@conject.com</a></p>');} | |
| else | |
| if(trim11(selectedLang) == 'Deutsch'){ $j('div#userNamewidget').html('<p>Willkommen auf unserem Support Portal! Haben Sie eine Frage?</p><p><strong>Unser Support Team hilft Ihnen gerne!</strong></p><p><img src="../../../attachments/token/fvmlyq19bnpr3fo/?name=Telefon.jpg" style="float: left; margin: 0px 5px 0px 0px;" border="0" alt="Telefon.jpg" width="25" height="25" />+49 (0)89 95414 800</p><p style="padding-left: 30px;">Mo.-Fr. von 7.30-18.00 (CET)</p><p><a href="mailto:support@conject.com"><img src="/attachments/token/xezlwqoiu74ia1v/?name=E-Mail_Icon.jpg" style="vertical-align: middle; margin-left: 0px; margin-right: 5px;" border="0" alt="E-Mail_Icon.jpg" width="25" height="25" /></a> <a href="mailto:support@conject.com">support@conject.com</a></p>');} | |
| } | |
| if('{{current_user.name}}' !== 'Anonymous user'){ | |
| selectedLang = $j('li.main.right.language_selector a.tab').text(); | |
| $j('div#userNamewidget').html(selectedLang); | |
| if(trim11(selectedLang) == 'English'){ $j('div#userNamewidget').html('<p>Hello <strong>{{current_user.name}}!</strong> Do you have a question?</p><p><strong>Our Support Team is happy to help you!</strong></p><p><img src="../../../attachments/token/fvmlyq19bnpr3fo/?name=Telefon.jpg" style="float: left; margin: 0px 5px 0px 0px;" border="0" alt="Telefon.jpg" width="25" height="25" />+49 (0)89 95414 800</p><p style="padding-left: 30px;">Monday to Friday</p><p style="padding-left: 30px;">7.30 a.m. to 6.00 p.m. (CET)</p><p><a href="mailto:support@conject.com"><img src="/attachments/token/xezlwqoiu74ia1v/?name=E-Mail_Icon.jpg" style="vertical-align: middle; margin-left: 0px; margin-right: 5px;" border="0" alt="E-Mail_Icon.jpg" width="25" height="25" /></a> <a href="mailto:support@conject.com">support@conject.com</a></p>');} | |
| else | |
| if(trim11(selectedLang) == 'Deutsch'){ $j('div#userNamewidget').html('<p>Hallo <strong>{{current_user.name}}!</strong> Haben Sie eine Frage?</p><p><strong>Unser Support Team hilft Ihnen gerne!</strong></p><p><img src="../../../attachments/token/fvmlyq19bnpr3fo/?name=Telefon.jpg" style="float: left; margin: 0px 5px 0px 0px;" border="0" alt="Telefon.jpg" width="25" height="25" />+49 (0)89 95414 800</p><p style="padding-left: 30px;">Mo.-Fr. von 7.30-18.00 (CET)</p><p><a href="mailto:support@conject.com"><img src="/attachments/token/xezlwqoiu74ia1v/?name=E-Mail_Icon.jpg" style="vertical-align: middle; margin-left: 0px; margin-right: 5px;" border="0" alt="E-Mail_Icon.jpg" width="25" height="25" /></a> <a href="mailto:support@conject.com">support@conject.com</a></p>');} | |
| } | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment