Testing open in new window/tab modification

Testing area for the DBB members and staff!
Post Reply
User avatar
KoolBear
DBB Co-Founder
DBB Co-Founder
Posts: 10132
Joined: Thu Nov 05, 1998 12:01 pm
Location: Houston, TX USA
Contact:

Testing open in new window/tab modification

Post by KoolBear » Wed Feb 09, 2011 8:00 am

http://www.KoolBear.com if mod works link should open in a new window or tab.
User avatar
Spidey
DBB Grand Master
DBB Grand Master
Posts: 10344
Joined: Thu Jun 28, 2001 2:01 am
Location: Earth

Re: Testing open in new window/tab modification

Post by Spidey » Wed Feb 09, 2011 9:09 am

Opened in new window.

IE
.
When Republicans go low...Democrats go even lower.
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7127
Joined: Mon Aug 01, 2005 8:47 am
Location: Ơ̸̦͇̲̬̭̱̰͎̞͈̣͎͚̳ͬ͋̃̀̇͊͂͋͐ͦ̽ͣ̂ͥ͊̅̀̚͠ B̶͖̯͉̜̰̲̓̔͋̈́ͅ È̯ Y̪̤̼͉̠̙͝

Re: Testing open in new window/tab modification

Post by Isaac » Wed Feb 09, 2011 9:39 am

Opened in a new tab. Chrome 9.0.597.84 Linux
s☼-£♦и̫͍ͥ̍ͪ͌̓͗͡о̡̹̱͊̅ͮ̓̕͢б̧̝̻̪̤̳̜͐̓̉ͤ͢͜ ͙̬͙̆̑ͮ̐ͭ̾̂́͘i̎̌̾̓̽̀̈̓̀҉͉̙̦͎̘̝͕f̻͕͔̘ͣͣ̓͊̿͢͜ ͍͔͈͕̮̫ͣ̆ͮ̊͋/♂6Æ!♪╩"▲L└уͭ̂͐̇҉̴̣̼̞̠̯͓̺̞ф̜̊͌̈́̋̏̐́ц̨͔̮̿̇ ̨̛͖̙͖̖̮̗̱ͩ̆͞ͅа̥͇̞̖͚̟̅͐ͤ͞͠͠э̜̘̩̳̬͔̾ͯ̀ͫ̒̐̿ͅͅг̭̖̀ͦ̒̑ͥ̌ͮͫ͞ё͔̟̃ͬ̾̓͟ё̦̞̙̫͔̩͑̀͂ͯ̄̔̃̑̀͠ͅͅ
User avatar
KoolBear
DBB Co-Founder
DBB Co-Founder
Posts: 10132
Joined: Thu Nov 05, 1998 12:01 pm
Location: Houston, TX USA
Contact:

Re: Testing open in new window/tab modification

Post by KoolBear » Wed Feb 09, 2011 9:52 am

The forums should open in a new window or tab too.

Any other links that we think should open in a new window please point them out. I know I need to get the BBCode link this is the link that shows up within the Post Topic page. Man that's a frustrating one to hit while you are editing :)
User avatar
Isaac
DBB Artist
DBB Artist
Posts: 7127
Joined: Mon Aug 01, 2005 8:47 am
Location: Ơ̸̦͇̲̬̭̱̰͎̞͈̣͎͚̳ͬ͋̃̀̇͊͂͋͐ͦ̽ͣ̂ͥ͊̅̀̚͠ B̶͖̯͉̜̰̲̓̔͋̈́ͅ È̯ Y̪̤̼͉̠̙͝

Re: Testing open in new window/tab modification

Post by Isaac » Wed Feb 09, 2011 10:54 am

This feature is one of my favorite things about this forum. Just about all the others I use don't have this.
s☼-£♦и̫͍ͥ̍ͪ͌̓͗͡о̡̹̱͊̅ͮ̓̕͢б̧̝̻̪̤̳̜͐̓̉ͤ͢͜ ͙̬͙̆̑ͮ̐ͭ̾̂́͘i̎̌̾̓̽̀̈̓̀҉͉̙̦͎̘̝͕f̻͕͔̘ͣͣ̓͊̿͢͜ ͍͔͈͕̮̫ͣ̆ͮ̊͋/♂6Æ!♪╩"▲L└уͭ̂͐̇҉̴̣̼̞̠̯͓̺̞ф̜̊͌̈́̋̏̐́ц̨͔̮̿̇ ̨̛͖̙͖̖̮̗̱ͩ̆͞ͅа̥͇̞̖͚̟̅͐ͤ͞͠͠э̜̘̩̳̬͔̾ͯ̀ͫ̒̐̿ͅͅг̭̖̀ͦ̒̑ͥ̌ͮͫ͞ё͔̟̃ͬ̾̓͟ё̦̞̙̫͔̩͑̀͂ͯ̄̔̃̑̀͠ͅͅ
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6415
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Re: Testing open in new window/tab modification

Post by fliptw » Wed Feb 09, 2011 1:03 pm

why are you using javascript? target="_blank" will work
User avatar
KoolBear
DBB Co-Founder
DBB Co-Founder
Posts: 10132
Joined: Thu Nov 05, 1998 12:01 pm
Location: Houston, TX USA
Contact:

Re: Testing open in new window/tab modification

Post by KoolBear » Wed Feb 09, 2011 1:26 pm

I'm not doing anything it's the way phpbb is assembling the url it in the program... and obviously I'm not a programmer. :D
User avatar
KoolBear
DBB Co-Founder
DBB Co-Founder
Posts: 10132
Joined: Thu Nov 05, 1998 12:01 pm
Location: Houston, TX USA
Contact:

Re: Testing open in new window/tab modification

Post by KoolBear » Wed Feb 09, 2011 1:28 pm

Isaac wrote:This feature is one of my favorite things about this forum. Just about all the others I use don't have this.


lol, that;s because most forums since 2008 have been using the new version of phpbb :D
User avatar
Krom
DBB Database Master
DBB Database Master
Posts: 15162
Joined: Sun Nov 29, 1998 3:01 am
Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
Contact:

Re: Testing open in new window/tab modification

Post by Krom » Wed Feb 09, 2011 2:26 pm

An alternative if you are a Firefox user is to install greasemonkey and set this as a user script:

Code: Select all

// ==UserScript==
// @name           DescentBB.net set link target attribute
// @namespace      descentbb.net
// @description    Fix the target of hyperlinks so they open in a new tab/window
// @include        http://descentbb.net/viewtopic.php*
// @include        http://www.descentbb.net/viewtopic.php*
// ==/UserScript==
var a = document.getElementsByTagName('a');
for (i = 0; i < a.length; i++) a[i].setAttribute('target','_blank');

The added bonus is you can edit in more: // @include http://someotherphpbbsite.com to make other phpbb3 based forums behave the same way. Or you can edit the script and replace the '_blank' with '_self' to reverse the behavior on sites that use new tabs/windows when you don't want them to.

Also with a little tweaking of the browser Google Chrome users can use this script too.
User avatar
KoolBear
DBB Co-Founder
DBB Co-Founder
Posts: 10132
Joined: Thu Nov 05, 1998 12:01 pm
Location: Houston, TX USA
Contact:

Re: Testing open in new window/tab modification

Post by KoolBear » Wed Feb 09, 2011 3:10 pm

Nice, any odea why XHTML dropped it? I guess it's a legacy feature and it has been replaced by something else?
User avatar
Aus-RED-5
DBB Friend
DBB Friend
Posts: 1604
Joined: Fri Apr 23, 2004 7:27 am
Location: Adelaide, South Australia
Contact:

Re: Testing open in new window/tab modification

Post by Aus-RED-5 » Wed Feb 09, 2011 3:27 pm

KB, it's works.

Thank you! :)
Prepare for DESCENT!
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6415
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Re: Testing open in new window/tab modification

Post by fliptw » Wed Feb 09, 2011 4:32 pm

KoolBear wrote:Nice, any odea why XHTML dropped it? I guess it's a legacy feature and it has been replaced by something else?


Its valid in transitional XHTML/HTML4, but not the strict versions.

Its back in HTML5. Go figure. I wonder if they had second thoughts on that one.
User avatar
Aus-RED-5
DBB Friend
DBB Friend
Posts: 1604
Joined: Fri Apr 23, 2004 7:27 am
Location: Adelaide, South Australia
Contact:

Re: Testing open in new window/tab modification

Post by Aus-RED-5 » Thu Feb 10, 2011 2:23 am

hummm... The link to KB's website opened in a new tab, but why didn't this one do the same?

EDIT: Well I ended up using Krom's suggestion. It works too, but if click on New Post, New Reply, PM, Quote or even Edit (pretty much anything with a link). They will be opened in a new tab.... Doh! Not sure I like this! :lol:
Prepare for DESCENT!
User avatar
KoolBear
DBB Co-Founder
DBB Co-Founder
Posts: 10132
Joined: Thu Nov 05, 1998 12:01 pm
Location: Houston, TX USA
Contact:

Re: Testing open in new window/tab modification

Post by KoolBear » Thu Feb 10, 2011 6:59 am

did you just paste the url straight in or did u enter the bbcode?

This is the url only pasted below...
http://www.youtube.com/watch?v=h7eREddMjt4

EDITED 2/10/11 10am cst
Sorry my bad that was a stupid question obviously you used the bbcode, let me see what else I can do:P
User avatar
Krom
DBB Database Master
DBB Database Master
Posts: 15162
Joined: Sun Nov 29, 1998 3:01 am
Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
Contact:

Re: Testing open in new window/tab modification

Post by Krom » Thu Feb 10, 2011 8:21 am

Yeah, that is the one downside of the script; its an all or nothing setting.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6415
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Re: Testing open in new window/tab modification

Post by fliptw » Thu Feb 10, 2011 12:16 pm

try this:

Code: Select all

// ==UserScript==
// @name           DescentBB.net set link target attribute
// @namespace      descentbb.net
// @description    Fix the target of hyperlinks so they open in a new tab/window
// @include        http://descentbb.net/viewtopic.php*
// @include        http://www.descentbb.net/viewtopic.php*
// ==/UserScript==
var a = document.getElementsByTagName('a');

for (i = 0; i < a.length; i++) if(a[i].className=='postlink') a[i].setAttribute('target','_blank');
User avatar
Krom
DBB Database Master
DBB Database Master
Posts: 15162
Joined: Sun Nov 29, 1998 3:01 am
Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
Contact:

Re: Testing open in new window/tab modification

Post by Krom » Thu Feb 10, 2011 12:22 pm

fliptw wrote:try this:

That works perfectly, good idea on checking the class name.

One question then, is it possible to run that script automatically by editing it into the header without requiring an extra browser plugin?
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6415
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Re: Testing open in new window/tab modification

Post by fliptw » Thu Feb 10, 2011 12:34 pm

You can.
User avatar
KoolBear
DBB Co-Founder
DBB Co-Founder
Posts: 10132
Joined: Thu Nov 05, 1998 12:01 pm
Location: Houston, TX USA
Contact:

Re: Testing open in new window/tab modification

Post by KoolBear » Thu Feb 10, 2011 12:37 pm

fliptw wrote:You can.


Will you share and I'll edited into the header.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6415
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Re: Testing open in new window/tab modification

Post by fliptw » Thu Feb 10, 2011 12:43 pm

Go ahead. Just put that code between the script tags and its golden.
User avatar
KoolBear
DBB Co-Founder
DBB Co-Founder
Posts: 10132
Joined: Thu Nov 05, 1998 12:01 pm
Location: Houston, TX USA
Contact:

Re: Testing open in new window/tab modification

Post by KoolBear » Thu Feb 10, 2011 12:49 pm

fliptw wrote:Go ahead. Just put that code between the script tags and its golden.


kool beans thanks
User avatar
Krom
DBB Database Master
DBB Database Master
Posts: 15162
Joined: Sun Nov 29, 1998 3:01 am
Location: Camping the energy center. BTW, did you know you can have up to 100 characters in this location box?
Contact:

Re: Testing open in new window/tab modification

Post by Krom » Thu Feb 10, 2011 1:50 pm

If that script works KB, you should probably remove the board modification you were trying just to play it safe.

Oh, and if you do put it in, you only need the two bottom lines, all the stuff at the top that starts with the // is irrelevant for a script that is built into the page.
User avatar
KoolBear
DBB Co-Founder
DBB Co-Founder
Posts: 10132
Joined: Thu Nov 05, 1998 12:01 pm
Location: Houston, TX USA
Contact:

Re: Testing open in new window/tab modification

Post by KoolBear » Thu Feb 10, 2011 2:42 pm

Krom wrote:If that script works KB, you should probably remove the board modification you were trying just to play it safe.

Oh, and if you do put it in, you only need the two bottom lines, all the stuff at the top that starts with the // is irrelevant for a script that is built into the page.


;) otay buckwheat :P
User avatar
Aus-RED-5
DBB Friend
DBB Friend
Posts: 1604
Joined: Fri Apr 23, 2004 7:27 am
Location: Adelaide, South Australia
Contact:

Re: Testing open in new window/tab modification

Post by Aus-RED-5 » Fri Feb 11, 2011 1:35 am

fliptw wrote:try this..........


Thanks fliptw, that worked! :)
Prepare for DESCENT!
Post Reply