Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 General Discussions
  #1  
Old 12-14-2015, 02:49 PM
DemOnstar's Avatar
DemOnstar DemOnstar is offline
 
Join Date: Dec 2012
Posts: 859
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Internal links

How do I get links to open in the same tab instead of another one?
I think I remember having the same problem with 4 but it has been so long that I have forgotten.

Thanks. . .
Reply With Quote
  #2  
Old 12-14-2015, 03:25 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try changing the target attribute to target="_self" to the anchor (<a></a>) tag(s). Since this is the default, you could simply remove the target="_blank" from the anchor, and this should work too.
Reply With Quote
  #3  
Old 12-14-2015, 05:20 PM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DemOnstar View Post
How do I get links to open in the same tab instead of another one?
I think I remember having the same problem with 4 but it has been so long that I have forgotten.

Thanks. . .
earlier versions of vb4 had this issue, but it was later corrected. I used to have a plugin which fixed it, but not sure if I still have the code lying around.

Quote:
Originally Posted by MarkFL View Post
Try changing the target attribute to target="_self" to the anchor (<a></a>) tag(s). Since this is the default, you could simply remove the target="_blank" from the anchor, and this should work too.
wouldn't that change all links, not just internal ones?
Reply With Quote
  #4  
Old 12-14-2015, 05:33 PM
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Location: St. Augustine, FL
Posts: 3,853
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dragonsys View Post
...wouldn't that change all links, not just internal ones?
I wasn't sure, but I thought perhaps there was a specific link (or links) in certain templates that the OP wanted to change.

Otherwise, changing all internal links could likely be done using javascript, as expressed by Joe in his product:

Open Internal Links in Same Tab - Ported by BOP5 (VB 4.x & VB 3.x)
Reply With Quote
  #5  
Old 12-14-2015, 06:00 PM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Cool, I figured there was a plugin out there for it
Reply With Quote
  #6  
Old 12-14-2015, 08:12 PM
DemOnstar's Avatar
DemOnstar DemOnstar is offline
 
Join Date: Dec 2012
Posts: 859
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I used the the product mentioned but I thought it was for 4?
I notice that all links open up a new tab in 5 and perhaps 4 was the same? Sometimes it is useful and other times not, so I guess each individual link has to be changed rather than a global solution.

Okay. . . .Thanks for the pointers. . .
Reply With Quote
  #7  
Old 12-14-2015, 08:22 PM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DemOnstar View Post
I used the the product mentioned but I thought it was for 4?
I notice that all links open up a new tab in 5 and perhaps 4 was the same? Sometimes it is useful and other times not, so I guess each individual link has to be changed rather than a global solution.

Okay. . . .Thanks for the pointers. . .
The product linked is for 4, Mark was just giving it as an example.
I do not have a license for 5, so I really can't help much more, as I cannot look at the code, but I'm pretty sure a plugin will be required.
Reply With Quote
  #8  
Old 12-14-2015, 08:31 PM
DemOnstar's Avatar
DemOnstar DemOnstar is offline
 
Join Date: Dec 2012
Posts: 859
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I checked it and noticed this. . .

Quote:
Originally Posted by BirdOPrey5 View Post
Should be compatible with all vBulletins between 3.6.0 and 5.0.0. (So all 3.8.x and 4.x.x for sure.)
I think I may try it in 5 and see what happens . . .

Cheers. . .
Reply With Quote
  #9  
Old 12-14-2015, 08:51 PM
Dragonsys's Avatar
Dragonsys Dragonsys is offline
 
Join Date: Jan 2008
Location: DFW, Texas
Posts: 743
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by DemOnstar View Post
I checked it and noticed this. . .



I think I may try it in 5 and see what happens . . .

Cheers. . .
oh cool. let us know how it goes
Reply With Quote
  #10  
Old 12-15-2015, 10:43 AM
DemOnstar's Avatar
DemOnstar DemOnstar is offline
 
Join Date: Dec 2012
Posts: 859
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dragonsys View Post
oh cool. let us know how it goes
It went like this. . .

Code:
The following dependencies were not met:

    This product is not compatible with version 5.1.10 of vBulletin. (Compatible starting with 3.6.0 / Incompatible with 5.0.0 and greater)
Worth a try. . .

And for your curiosity, this is what the .xml looks like.

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>

<product productid="intextlinkingbop5" active="1">
	<title>Open Internal Links In Same Page  - Ported By BOP5</title>
	<description>This will add JavaScript to every page that will make all links to the same domain open in the same tab or window. Only external links will open in new tabs.</description>
	<version>1.0</version>
	<url><![CDATA[http://www.qapla.com/mods/misc.php?do=producthelp&pid=intextlinkingbop5]]></url>
	<versioncheckurl><![CDATA[http://www.qapla.com/mods/misc.php?do=productcheck&pid=intextlinkingbop5]]></versioncheckurl>
	<dependencies>
		<dependency dependencytype="vbulletin" minversion="3.6.0" maxversion="5.0.0" />
	</dependencies>
	<codes>
	</codes>
	<templates>
	</templates>
	<stylevardfns>
	</stylevardfns>
	<stylevars>
	</stylevars>
	<plugins>
		<plugin active="1" executionorder="5">
			<title>Add Internal Linking JavaScript</title>
			<hookname>replacement_vars</hookname>
			<phpcode><![CDATA[// 	Blankwin JavaScript function 
//	written by Alen Grakalic, provided by Css Globe (cssglobe.com)
//	please visit http://cssglobe.com/post/1281/open-external-links-in-new-window-automatically/ for more info
//      MODIFIED BY BirdOPrey5 (vbulletin.org / Qapla.com) for use on vBulletin forums	

global $vbulletin;

$ddom = $_SERVER['HTTP_HOST'];

if ($vbulletin->options['bop5bil_en'])
{
  $domainslist = explode("\r\n" , $vbulletin->options['bop5bil_domains']);
  if ($domainslist[0] == '')
    $domainslist[0] = str_ireplace('www.', '', $ddom);

  $di = 0;
  $js_vars = 'var dlists = new Array(); ' . " \r\n";

  $dmax = count($domainslist);

  //At least 1 domain in list
  while ($di < $dmax)
  {
     $js_vars .= " dlists[{$di}] = '" . $domainslist[$di] . "'; \r\n";
     $di++;
  } 

  $find = "</body>";

  $replace = ' 
<script type="text/javascript">
this.blankwin = function(){
        '. $js_vars . '
	var hostname = window.location.hostname;
	hostname = hostname.replace("www.","").toLowerCase();
	var a = document.getElementsByTagName("a");	
	this.check = function(obj){
		var href = obj.href.toLowerCase();
                var dbopcount = 0;
                if (href.indexOf("http://")!=-1)
                {
                   for (jdi = 0; jdi <= dlists.length; jdi++)
                   {
                      if (href.indexOf(dlists[jdi]) == -1)
                      {
                         //alert("NO MATCH " + dlists[jdi] + " " + href);
                         dbopcount = dbopcount;  //Do nothing
                      }
                      else
                      {
                         //alert("match " + dlists[jdi] + " " + href);
                         dbopcount++;
                      }
                   } 
                   if (dbopcount > 0)
                     return true; //If this link URL was an internal URL
                   else  //there were no matches to any internal domain, so leave it external
                     return false;
                }
                else
                {
                  return false;
                }
		//return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? false : true;				
	};
	this.set = function(obj){
		obj.target = "_self";
	};	
	for (var i=0;i<a.length;i++){
		if(check(a[i])) set(a[i]);
	};		
};

// script initiates on page load. 

this.addEvent = function(obj,type,fn){
	if(obj.attachEvent){
		obj[\'e\'+type+fn] = fn;
		obj[type+fn] = function(){obj[\'e\'+type+fn](window.event );}
		obj.attachEvent(\'on\'+type, obj[type+fn]);
	} else {
		obj.addEventListener(type,fn,false);
	};
};
addEvent(window,"load",blankwin);
</script>
';

  $newtext = str_replace ($find, $replace . $find, $newtext);
}]]></phpcode>
		</plugin>
	</plugins>
	<phrases>
		<phrasetype name="vBulletin Settings" fieldname="vbsettings">
			<phrase name="setting_bop5bil_domains_desc" date="1343585395" username="BirdOPrey5" version="1.0"><![CDATA[List of domains that should be considered internal (they will open in the current window or tab), <b>one per line.</b> Do not include the "www." if any, just the domain name and extension.<br />
<br />
Example: <br />
<br />
qapla.com <br />
birdoprey5.com <br />
<br />
If left blank the mod will attempt to auto-detect the domain name.]]></phrase>
			<phrase name="setting_bop5bil_domains_title" date="1343585395" username="BirdOPrey5" version="1.0"><![CDATA[List of Domains to Open in Same Tab/Window]]></phrase>
			<phrase name="setting_bop5bil_en_desc" date="1343585395" username="BirdOPrey5" version="1.0"><![CDATA[Enables or disables the entire mod.]]></phrase>
			<phrase name="setting_bop5bil_en_title" date="1343585395" username="BirdOPrey5" version="1.0"><![CDATA[Enable Mod?]]></phrase>
			<phrase name="settinggroup_betterintlinksbop5" date="1343585395" username="BirdOPrey5" version="1.0"><![CDATA[Open Internal Links In Same Page  - Ported By BOP5]]></phrase>
		</phrasetype>
	</phrases>
	<options>
		<settinggroup name="betterintlinksbop5" displayorder="65535">
			<setting varname="bop5bil_en" displayorder="10">
				<datatype>free</datatype>
				<optioncode>yesno</optioncode>
				<defaultvalue>1</defaultvalue>
			</setting>
			<setting varname="bop5bil_domains" displayorder="20">
				<datatype>free</datatype>
				<optioncode>textarea</optioncode>
			</setting>
		</settinggroup>
	</options>
	<helptopics>
	</helptopics>
	<cronentries>
	</cronentries>
	<faqentries>
	</faqentries>
	<navigation>
	</navigation>
</product>
Cheers.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06072 seconds
  • Memory Usage 2,283KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete