[ABD] Opening External Link in New Window

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
TruckingAlong
Registered User
Posts: 3
Joined: Fri Nov 01, 2013 10:08 pm

Re: [RC] Opening External Link in New Window

Post by TruckingAlong »

Just a note: I've found this works great with "http://" or just "www." without "http://", but it doesn't work for "https://".

I assume that's missing in the ajax code, or something like that. I tried duplicating the second script tag group an changing the second group to ... $('a[href^="https://"]') ..., but that didn't work.

Oh well, that's not really very tragic, the rest works just fine, regardless of whether a forum member uses the url bbcode tags. Most don't. :|
bodiniusz
Registered User
Posts: 3
Joined: Fri Jan 10, 2014 5:35 pm

Re: [RC] Opening External Link in New Window

Post by bodiniusz »

Hello,

has anybody installed this through auto mod on 3.0.12?

Thanks
bubban
Registered User
Posts: 53
Joined: Tue Jan 14, 2014 4:19 pm

Re: [RC] Opening External Link in New Window

Post by bubban »

bodiniusz wrote:Hello,

has anybody installed this through auto mod on 3.0.12?

Thanks
Yes, I just did it now and it looks like it's working. Thanks Digioz, great mod!
User avatar
MarkDHamill
Registered User
Posts: 4933
Joined: Fri Aug 02, 2002 12:36 am
Location: Florence, MA USA

Re: [RC] Opening External Link in New Window

Post by MarkDHamill »

Deleted text. Issue was elsewhere.
Need phpBB services or a phpBB consultant? I offer most phpBB services. Getting lost managing phpBB? Buy my book, Mastering phpBB Administration. Covers through phpBB 3.3.7. eBook and paper versions available.
User avatar
judgedredd
Registered User
Posts: 46
Joined: Mon Mar 10, 2014 4:58 am

Re: [RC] Opening External Link in New Window

Post by judgedredd »

Its annoying when another forum using the older phpbb 2.x has links opening up in a new window and then I find that my forum using phpbb 3.0.12 doesn't have this ability.

Soooooooo coming here and finding this MOD I thought 'Great!'.

Installed it and it did not work. It was added by hand, not through AUTOMOD.

Here is where I put it (code is right at the bottom of the following code in the header section of the overall_header.html file):

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="{S_CONTENT_DIRECTION}" lang="{S_USER_LANG}" xml:lang="{S_USER_LANG}">
<head>

<meta http-equiv="content-type" content="text/html; charset={S_CONTENT_ENCODING}" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-language" content="{S_USER_LANG}" />
<meta http-equiv="imagetoolbar" content="no" />
<meta name="resource-type" content="document" />
<meta name="distribution" content="global" />
<meta name="keywords" content="" />
<meta name="description" content="" />
{META}
<title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title>

<!-- IF S_ENABLE_FEEDS -->
	<!-- IF S_ENABLE_FEEDS_OVERALL --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {SITENAME}" href="{U_FEED}" /><!-- ENDIF -->
	<!-- IF S_ENABLE_FEEDS_NEWS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_NEWS}" href="{U_FEED}?mode=news" /><!-- ENDIF -->
	<!-- IF S_ENABLE_FEEDS_FORUMS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_ALL_FORUMS}" href="{U_FEED}?mode=forums" /><!-- ENDIF -->
	<!-- IF S_ENABLE_FEEDS_TOPICS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_TOPICS_NEW}" href="{U_FEED}?mode=topics" /><!-- ENDIF -->
	<!-- IF S_ENABLE_FEEDS_TOPICS_ACTIVE --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_TOPICS_ACTIVE}" href="{U_FEED}?mode=topics_active" /><!-- ENDIF -->
	<!-- IF S_ENABLE_FEEDS_FORUM and S_FORUM_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FORUM} - {FORUM_NAME}" href="{U_FEED}?f={S_FORUM_ID}" /><!-- ENDIF -->
	<!-- IF S_ENABLE_FEEDS_TOPIC and S_TOPIC_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_TOPIC} - {TOPIC_TITLE}" href="{U_FEED}?f={S_FORUM_ID}&t={S_TOPIC_ID}" /><!-- ENDIF -->
<!-- ENDIF -->

<!--
	phpBB style name: prosilver
	Based on style:   prosilver (this is the default phpBB3 style)
	Original author:  Tom Beddard ( http://www.subBlue.com/ )
	Modified by:
-->

<script type="text/javascript">
// <![CDATA[
	var jump_page = '{LA_JUMP_PAGE}:';
	var on_page = '{ON_PAGE}';
	var per_page = '{PER_PAGE}';
	var base_url = '{A_BASE_URL}';
	var style_cookie = 'phpBBstyle';
	var style_cookie_settings = '{A_COOKIE_SETTINGS}';
	var onload_functions = new Array();
	var onunload_functions = new Array();

	<!-- IF S_USER_PM_POPUP and S_NEW_PM -->
		var url = '{UA_POPUP_PM}';
		window.open(url.replace(/&/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');
	<!-- ENDIF -->

	/**
	* Find a member
	*/
	function find_username(url)
	{
		popup(url, 760, 570, '_usersearch');
		return false;
	}

	/**
	* New function for handling multiple calls to window.onload and window.unload by pentapenguin
	*/
	window.onload = function()
	{
		for (var i = 0; i < onload_functions.length; i++)
		{
			eval(onload_functions[i]);
		}
	};

	window.onunload = function()
	{
		for (var i = 0; i < onunload_functions.length; i++)
		{
			eval(onunload_functions[i]);
		}
	};

// ]]>
</script>
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/styleswitcher.js"></script>
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/forum_fn.js"></script>

<link href="{T_THEME_PATH}/print.css" rel="stylesheet" type="text/css" media="print" title="printonly" />
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />

<link href="{T_THEME_PATH}/normal.css" rel="stylesheet" type="text/css" title="A" />
<link href="{T_THEME_PATH}/medium.css" rel="alternate stylesheet" type="text/css" title="A+" />
<link href="{T_THEME_PATH}/large.css" rel="alternate stylesheet" type="text/css" title="A++" />

<!-- IF S_CONTENT_DIRECTION eq 'rtl' -->
	<link href="{T_THEME_PATH}/bidi.css" rel="stylesheet" type="text/css" media="screen, projection" />
<!-- ENDIF -->

<!-- Added following script MOD code on 23 March 2014 -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>         
    <script type="text/javascript">                                         
       $(document).ready(function() {
          $('a[href^="http://"]').filter(function() {return this.hostname && this.hostname !== location.hostname;}).attr('target', '_blank');
       });                     
    </script>

</head>
Any idea why it doesn't work? Flushed cache twice, deleted file from server and re-uploaded the altered one. Still nothing.
User avatar
judgedredd
Registered User
Posts: 46
Joined: Mon Mar 10, 2014 4:58 am

Re: [RC] Opening External Link in New Window

Post by judgedredd »

Well..... I read another post about refreshing the template files, went and did it and the MOD worked. Wow!
Thank you for this MOD. Its awesome!

Here are the instructions I found:

Don't forget to refresh the appropriate style component after you have made all the changes by going to your Administration Control Panel => Styles => (Templates/Themes) => prosilver and click on refresh.
kaszkai
Registered User
Posts: 242
Joined: Wed Jun 29, 2011 11:44 pm

Re: [RC] Opening External Link in New Window

Post by kaszkai »

TruckingAlong wrote:Just a note: I've found this works great with "http://" or just "www." without "http://", but it doesn't work for "https://".

I assume that's missing in the ajax code, or something like that. I tried duplicating the second script tag group an changing the second group to ... $('a[href^="https://"]') ..., but that didn't work.

Oh well, that's not really very tragic, the rest works just fine, regardless of whether a forum member uses the url bbcode tags. Most don't. :|
find:

Code: Select all

$(document).ready(function() {
      $('a[href^="http://"]').filter(function() {return this.hostname && this.hostname !== location.hostname;}).attr('target', '_blank');
   }); 
add after:

Code: Select all

$(document).ready(function() {
      $('a[href^="https://"]').filter(function() {return this.hostname && this.hostname !== location.hostname;}).attr('target', '_blank');
   }); 
Poland ;)
clight77
Registered User
Posts: 907
Joined: Sun May 11, 2003 11:09 pm

Re: [RC] Opening External Link in New Window

Post by clight77 »

Nice :)
Thanks
I Follow Up On My Posts.
So Should Everybody...
User avatar
RMcGirr83
Former Team Member
Posts: 22061
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Opening External Link in New Window

Post by RMcGirr83 »

Code: Select all

$(document).ready(function() {
      $('a[href^="http://"], a[href^="https://"]').filter(function() {return this.hostname && this.hostname !== location.hostname;}).attr('target', '_blank');
   }); 
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
clight77
Registered User
Posts: 907
Joined: Sun May 11, 2003 11:09 pm

Re: [RC] Opening External Link in New Window

Post by clight77 »

After using for a bit I found that my collapse categories no longer work phpbb 3.0.12 SE_Gamer_Dark

Thanks
I Follow Up On My Posts.
So Should Everybody...
User avatar
RMcGirr83
Former Team Member
Posts: 22061
Joined: Wed Jun 22, 2005 4:33 pm
Location: Your display
Name: Rich McGirr

Re: [RC] Opening External Link in New Window

Post by RMcGirr83 »

Probably because of this line

Code: Select all

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>  
you probably have two jQuery libraries being loaded.
Former Modifications/Extensions Team Member | My extensions | github | All requests for support via PM will be ignored
Appreciate the extensions/mods/support then you can support me by buying a beer 🍺
clight77
Registered User
Posts: 907
Joined: Sun May 11, 2003 11:09 pm

Re: [RC] Opening External Link in New Window

Post by clight77 »

RMcGirr83 wrote:Probably because of this line

Code: Select all

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>  
you probably have two jQuery libraries being loaded.
Thanks :)

I have this:

Code: Select all

<script type="text/javascript" src="{T_TEMPLATE_PATH}/jquery-1.9.1.min.js"></script>
And this:

Code: Select all

<script type="text/javascript" src="{ROOT_PATH}mchat/jquery-1.10.2.min.js"></script>
Do I need them both ?

Cheers

EDIT: solved..
Just replaced my code

Code: Select all

<script type="text/javascript" src="{T_TEMPLATE_PATH}/jquery-1.9.1.min.js"></script>
with this:

Code: Select all

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>         
<script type="text/javascript">                                         
   $(document).ready(function() {
      $('a[href^="http://"]').filter(function() {return this.hostname && this.hostname !== location.hostname;}).attr('target', '_blank');
   });                     
</script>
I Follow Up On My Posts.
So Should Everybody...
User avatar
Derky
Development Team Member
Development Team Member
Posts: 4880
Joined: Sun Apr 10, 2005 9:58 am
Location: Netherlands

Re: [RC] Opening External Link in New Window

Post by Derky »

This topic has been marked as [ABD] - Abandoned as the MOD author has not replied here recently. If the author wishes to continue development, please PM anyone on the Extensions Team to request this topic be unlocked.

Thank you,
The phpBB Extensions Team

Return to “[3.0.x] Abandoned MODs”