vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Mini Mods - Same Window For Local Links (https://vborg.vbsupport.ru/showthread.php?t=130966)

Viper007Bond 11-06-2006 10:00 PM

Same Window For Local Links
 
Another really simple plugin from me.

I wanted local links (i.e. ones to other parts of the forum) to not open in a new tab. So, I wrote a little modifier to make that happen and decided to share the code.

Tested on my forum, but let me know if you encounter any issues. :)


How it works:

It hooks in at the end of the BBCode parser, after the parser has transformed the BBCode into HTML. My plugin then removes the target="_blank" off of links that start with your forum base URL.


Upgrading from version 1.0.1 or 1.0.0:

Delete the plugin and then install the new product.


It doesn't seem to be working on old posts!

The output of the BBCode parser and such is cached by vB. Just rebuilt your post cache (it's under "Update Counters") and all will be good.

==============================
DON'T FORGET TO CLICK INSTALL!

https://vborg.vbsupport.ru/
==============================

Viper007Bond 11-07-2006 06:22 AM

CHANGELOG:
  • v1.0.3: if your base URL contains "www.", it's now optional and this plugin will affect both www.yoursite.com as well as yoursite.com
  • v1.0.2: cached versions of posts were still having their links open in new windows, this is now hopefully fixed
  • v1.0.1: attachment.php links now continue to open in a new window
  • v1.0.0: initial release

Snake 11-07-2006 09:14 AM

Thanks buddy! :)

Cheertobi 11-07-2006 02:20 PM

/me clicks install!

Thanks!

4yBak 11-07-2006 05:01 PM

how this plugin know which links are local? Or this plugin use own bb-code? Also, can you do option like: not display local links for specific usergropus (for example: unregistering users) ?

TCattitude 11-07-2006 05:39 PM

Quote:

Originally Posted by 4yBak
how this plugin know which links are local? Or this plugin use own bb-code? Also, can you do option like: not display local links for specific usergropus (for example: unregistering users) ?

If the linked url have your vbulletin['bburl'] in that url, so the plugin re-write the "a href" code to change the "target" of the link, and left the link intact.

Nice and simple plugin ;)
This really need to be a standard vbulletin option (local links not use "_blank" target; local links open in the same window)

w1z4rd 11-07-2006 05:56 PM

Finally, ... this works great just remember it does'nt take effect on posts before the installation unless you edit them. Sweet little plugin, thanks.

Viper007Bond 11-07-2006 06:33 PM

Quote:

Originally Posted by w1z4rd
Finally, ... this works great just remember it does'nt take effect on posts before the installation unless you edit them. Sweet little plugin, thanks.

No, it does, just flush your post cache. ;)

This modifies the output of the BBCode parser (after the BBCode is applied) but that output gets cached by vB.

PsicoByte 11-07-2006 10:32 PM

<font color="Lime">*install*</font>

Thanks!! :laugh:

abramelin 11-08-2006 12:09 AM

good but its going to open the attachment images in the same window too so this is not good :/

Viper007Bond 11-08-2006 12:13 AM

Quote:

Originally Posted by abramelin
good but its going to open the attachment images in the same window too so this is not good :/

It shouldn't touch the items in the attachment box as I don't believe those are run though the BBCode parser (why would they be?).

However, yeah, [ATT ACH]12345[/ATTACH] would be probably be affected. I'll exclude attachment.php links.

abramelin 11-08-2006 12:17 AM

if you can exclude them then im going to install this lovely simple mod,thanks.

Viper007Bond 11-08-2006 01:57 AM

Gah, man I suck at regex. :(

Viper007Bond 11-08-2006 09:13 AM

Alright, attachment.php is now excluded and will continue to open in a new tab/window. :)

Nathan2006 11-10-2006 02:15 PM

Thank you Viper007Bond,

I requested something like this a long time ago because I hated new windows opening all the time on local links.

I always had to use the html code <a href=""><span style="color: blue;"> Here </span></a> to open links in the same window :(

But this great hack has now made me very happy:D

And also should be default on all VB boards.

Thanks again

Install:)

funkmeister 11-12-2006 04:56 AM

Quote:

Just rebuilt your post cache (it's under "Update Counters") and all will be good.
Dumb question - which option in "Update Counters" needs to be used? Only one closest to what you describe is "Update Post Counts" - is that the one or a different one?

Anyway, works great (on my new posts) - thanks.

Viper007Bond 11-12-2006 07:50 AM

Quote:

Originally Posted by funkmeister
Dumb question - which option in "Update Counters" needs to be used? Only one closest to what you describe is "Update Post Counts" - is that the one or a different one?

Anyway, works great (on my new posts) - thanks.

No, the "Rebuild Post Cache" one. 6th one down. ;)

funkmeister 11-12-2006 02:07 PM

Quote:

Originally Posted by Viper007Bond
No, the "Rebuild Post Cache" one. 6th one down. ;)

Ummm, I don't have that one as an option - the 6th one down on my list is "Empty Signature Cache" - I'm on 3.6.2 - is this a new option only in 3.6.3 or is it reliant on someother setting in order for it to be made available as an option?

Also, can you add a feature to take into a count those "showthread" posts that include the syntax "showthread.php?p=22946#post22946" - these "normally" open in a new window and include a "Close Window" button on the bottom of the displayed page. Of course, when a user clicks it and with this add-on installed, it will prompt them to close it and in turn close down the whole browser, since it actually now opens in the same page. So can you make it so that these type of URL's continue to open in a new window.

Thanks.

Viper007Bond 11-12-2006 09:41 PM

Quote:

Originally Posted by funkmeister (Post 1115471)
Ummm, I don't have that one as an option - the 6th one down on my list is "Empty Signature Cache" - I'm on 3.6.2 - is this a new option only in 3.6.3 or is it reliant on someother setting in order for it to be made available as an option?

No, I had the option in 3.6.2. Odd. *shrugs*

Quote:

Originally Posted by funkmeister (Post 1115471)
Also, can you add a feature to take into a count those "showthread" posts that include the syntax "showthread.php?p=22946#post22946" - these "normally" open in a new window and include a "Close Window" button on the bottom of the displayed page. Of course, when a user clicks it and with this add-on installed, it will prompt them to close it and in turn close down the whole browser, since it actually now opens in the same page. So can you make it so that these type of URL's continue to open in a new window.

Thanks.

showpost.php you mean? And good point. Thanks.

funkmeister 11-12-2006 11:28 PM

Quote:

Originally Posted by Viper007Bond (Post 1115741)
No, I had the option in 3.6.2. Odd. *shrugs*


showpost.php you mean? And good point. Thanks.

Yeah, I'm doing the same thing *shrug* and scratching my head :confused:

Yes, "showpost.php" is what I meant to say!

Viper007Bond 11-12-2006 11:29 PM

Quote:

Originally Posted by funkmeister (Post 1115832)
Yes, "showpost.php" is what I meant to say!

I just remembered -- upgrade to 3.6.3. That page doesn't show the "Close Window" button anymore unless it really is a pop-up. ;)

funkmeister 11-13-2006 03:45 AM

Quote:

Originally Posted by Viper007Bond (Post 1115833)
I just remembered -- upgrade to 3.6.3. That page doesn't show the "Close Window" button anymore unless it really is a pop-up. ;)

OK, thanks. If I see an issue after I upgrade I'll get back to you, but it sounds like it's sorted :)

Thanks.

Viper007Bond 11-25-2006 04:32 AM

Small update. Cached versions of posts were still having their links open in new windows, this is now hopefully fixed.

Nathan2006 11-25-2006 05:17 AM

Quote:

Originally Posted by Viper007Bond (Post 1124629)
Small update. Cached versions of posts were still having their links open in new windows, this is now hopefully fixed.

Thank you for the update Viper007Bond

All is working well :D

Viper007Bond 11-25-2006 05:37 AM

Oh, I also moved it from a plugin to a product to make things easier. Best to remove the old plugin (it won't hurt, but it'll just execute more code otherwise).

XFSImperial 11-26-2006 01:28 AM

I've installed this mo; do you think there's anyway to make it work http://mydomain.com the same way it currently works for http://www.mydomain.com?

R1lover 11-26-2006 03:15 AM

Im not sure what this does that you can't do with BBcode?

Viper007Bond 11-27-2006 08:39 PM

Quote:

Originally Posted by XFSImperial (Post 1125205)
I've installed this mo; do you think there's anyway to make it work http://mydomain.com the same way it currently works for http://www.mydomain.com?

Yeah, there is. I'll get to work on it. :)

Viper007Bond 11-27-2006 08:41 PM

Quote:

Originally Posted by R1lover (Post 1125251)
Im not sure what this does that you can't do with BBcode?

Do this on your forum:

Code:

[url]http://yoursite.com/forum/showthread.php?t=123[/url]
If you click that link, it opens in a new window. This makes it open in the same window.

You cannot do that with vB fresh outta the box as far as I'm aware.

Viper007Bond 11-30-2006 12:40 AM

Quote:

Originally Posted by XFSImperial (Post 1125205)
I've installed this mo; do you think there's anyway to make it work http://mydomain.com the same way it currently works for http://www.mydomain.com?

Updated. Should work fine now for this. :)

da420 11-30-2006 06:16 AM

I like the idea of this hack. Doesn't work for me on 3.6.4 unfortunately.

Viper007Bond 11-30-2006 10:21 AM

Quote:

Originally Posted by da420 (Post 1128534)
I like the idea of this hack. Doesn't work for me on 3.6.4 unfortunately.

Really? Works fine for me here in 3.6.4: http://forums.finalgear.com/showthread.php?t=15146

Did you read the part about how it doesn't affect posts posted before you installed the product unless you rebuild the post cache?

da420 11-30-2006 07:34 PM

Quote:

Originally Posted by Viper007Bond (Post 1128631)
Really? Works fine for me here in 3.6.4: http://forums.finalgear.com/showthread.php?t=15146

Did you read the part about how it doesn't affect posts posted before you installed the product unless you rebuild the post cache?

Yep, searched this entire thread.

I rebuilt the post cache, and it does not work on new or old posts. It's too bad, cuz this would be great to have working on the forum. :)

Viper007Bond 12-01-2006 03:37 AM

Quote:

Originally Posted by da420 (Post 1128919)
Yep, searched this entire thread.

I rebuilt the post cache, and it does not work on new or old posts. It's too bad, cuz this would be great to have working on the forum. :)

Temporarily disable any other products/plugins that are installed and see if that fixes it.

da420 12-01-2006 03:41 PM

Quote:

Originally Posted by Viper007Bond (Post 1129185)
Temporarily disable any other products/plugins that are installed and see if that fixes it.

Disabled everything, and it still is opening all local links in a new window. Even tried it in an unaltered, unedited, default vBulletin template.

Viper007Bond 12-02-2006 02:40 AM

Quote:

Originally Posted by da420 (Post 1129478)
Disabled everything, and it still is opening all local links in a new window. Even tried it in an unaltered, unedited, default vBulletin template.

Check your vB URL in your options page. This plugin uses it to determine if a link is local or not. For testing, make sure to use a URL that starts with EXACTLY that string.

da420 12-02-2006 03:35 AM

Quote:

Originally Posted by Viper007Bond (Post 1129770)
Check your vB URL in your options page. This plugin uses it to determine if a link is local or not. For testing, make sure to use a URL that starts with EXACTLY that string.

Tried exactly my site's url, copy and paste from ACP.

Still not opening up in same window.

Thanks for the help. :)

Viper007Bond 12-02-2006 07:35 AM

Quote:

Originally Posted by da420 (Post 1129797)
Tried exactly my site's url, copy and paste from ACP.

Still not opening up in same window.

Thanks for the help. :)

In your ACP, do you have "www." or no?

Try this simpler version of my product and see if it works or not.

da420 12-02-2006 07:20 PM

Quote:

Originally Posted by Viper007Bond (Post 1129875)
In your ACP, do you have "www." or no?

Try this simpler version of my product and see if it works or not.

I have www.

Still not working on my forum. Uninstalled the original product, and installed this lite one, and still not working.

Viper007Bond 12-03-2006 12:13 AM

I'm outta ideas then. It should be working. :(


All times are GMT. The time now is 04:54 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01452 seconds
  • Memory Usage 1,836KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (23)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete