The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
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. . . |
#2
|
||||
|
||||
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.
|
#3
|
||||
|
||||
Quote:
wouldn't that change all links, not just internal ones? |
#4
|
||||
|
||||
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) |
#5
|
||||
|
||||
Quote:
|
#6
|
||||
|
||||
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. . . |
#7
|
||||
|
||||
Quote:
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. |
#8
|
||||
|
||||
I checked it and noticed this. . .
Quote:
Cheers. . . |
#9
|
||||
|
||||
oh cool. let us know how it goes
|
#10
|
||||
|
||||
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) 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> |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|