| We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Shorten Long URLs in Posts | |
|---|---|
| Tweet Topic Started: Apr 18 2013, 07:23 AM (1,773 Views) | |
| Cory | Apr 18 2013, 07:23 AM Post #1 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Code Name: Shorten Long URLs in Posts What the code does: Will turn this: http://www.thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com/ To this: http://www.thelongestdomainnameintheworldandthenso... How to use the code: Install as instructed, no editing is required. How to install the code: Admin CP Themes Board Template Below the BoardExtra notes: Very simple, just created for the convenience factor. Edited by Cory, Apr 25 2013, 05:27 PM.
|
![]() |
|
| pacisangelo | Apr 18 2013, 07:35 AM Post #2 |
![]()
Member
![]() ![]() ![]() ![]()
|
Nice code. thanks |
![]() |
|
| DaPizzaMan | Apr 25 2013, 03:46 PM Post #3 |
![]()
#TeamSupport
![]()
|
I should note that the topic buttons also have a rel that equals "nofollow" so this doesn't work too well unless you define it to the `td.c_post` area, or (what I did to the code to help someone) make it only for links that don't have any children element. |
![]() |
|
| Cory | Apr 25 2013, 05:32 PM Post #4 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Code has been updated. |
![]() |
|
| Ferby | Apr 26 2013, 04:51 PM Post #5 |
![]()
Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Are you sure? I don't see any difference. Also a variable to change the length limit would be helpful to most people. I'd change it to 15, personally. |
![]() |
|
| Cory | Apr 26 2013, 05:03 PM Post #6 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
The if statement should suffice. I don't think a variable is necessary when the code is that small. |
![]() |
|
| Ido | Sep 10 2016, 11:43 PM Post #7 |
|
Member
![]() ![]() ![]()
|
Can this code work in the shoutbox as well? |
![]() |
|
| Cory | Sep 15 2016, 02:33 AM Post #8 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Change that to this:
|
![]() |
|
| polocolo | Sep 17 2016, 05:48 PM Post #9 |
|
Member
![]() ![]() ![]() ![]() ![]()
|
Thank you! EDIT: I amended the code as follows but full URL link still shows in the shoutbox area. <script type="text/javascript"> //<![CDATA[ $('a[rel="nofollow"], #shoutbox a').each(function () { if ($(this).text().length > 30) { var text = $(this).text(); var subs = text.substring(0, 30); $(this).text(subs + '...'); } }); //]]> </script> Edited by polocolo, Sep 17 2016, 06:14 PM.
|
![]() |
|
| Cory | Sep 23 2016, 04:06 AM Post #10 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Is it only doing that when you submit a shout, or for every shout posted? |
![]() |
|
| polocolo | Sep 25 2016, 08:01 PM Post #11 |
|
Member
![]() ![]() ![]() ![]() ![]()
|
After I applied the code those url links already posted in the past didn't change (still with the full links). So I tested by making a few links but still no change. |
![]() |
|
| Cory | Sep 27 2016, 12:26 PM Post #12 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
Try this instead:
|
![]() |
|
| Skyon Archer | Oct 24 2016, 08:03 PM Post #13 |
![]()
Member
![]() ![]() ![]() ![]() ![]() ![]()
|
You could also add a shortened URL bbcode button to your forum as mentioned in this topic. |
![]() |
|
| Cory | Oct 25 2016, 07:19 PM Post #14 |
|
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
|
I'd personally prefer, if I added either version to my forum, this version because it is done automatically and doesn't rely on a third-party service. |
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · ZetaBoards Codes & Modifications · Next Topic » |
| Track Topic · E-mail Topic |
4:33 AM Jul 11
|



![]](http://b1.ifrm.com/0/1/0/p601690/pipright.png)
Themes








4:33 AM Jul 11