dev-ext / twitterjs

Automatically exported from code.google.com/p/twitterjs
MIT License
0 stars 0 forks source link

"newwindow: true" not working #32

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setting newwindow to true should force all links to open in a new window. 
This doesn't force links to open  in a new window.

What is the expected output? What do you see instead?
Links open in a new window. Links open in the same window.

What version of the product are you using? On what operating system?
2.0, Chrome, Mac OS Lion

Original issue reported on code.google.com by je...@madebyjesse.com on 29 Dec 2011 at 4:44

GoogleCodeExporter commented 9 years ago
Has anyone had the solution to this yet?

Original comment by faracasf...@gmail.com on 17 Jan 2012 at 1:01

GoogleCodeExporter commented 9 years ago
Go to line 201 and add the following after it:
if (options.newwindow) r = r.replace(/<a href/gi, '<a target="_blank" href');

Voila.

Original comment by christop...@gmail.com on 13 Feb 2012 at 10:03

GoogleCodeExporter commented 9 years ago
Did not work for me.

Original comment by gerben...@gmail.com on 23 Apr 2012 at 10:43

GoogleCodeExporter commented 9 years ago
Also option does not work for me either.

Original comment by vritc...@gmail.com on 18 Jun 2012 at 6:53

GoogleCodeExporter commented 9 years ago
I found that twitter is sending through some links with the title tag first, so 
in addition to the above (which seems to be included in v2.0.0) you also need 
to add something like r.replace(/<a title/gi, '<a target="_blank" title').

Finally, these functions don't seem to be called if you specify a template, so 
you may need to add this code manually elsewhere - hope this helps :)

Original comment by charlie....@gmail.com on 6 Aug 2012 at 3:33

GoogleCodeExporter commented 9 years ago
I was able to get this working by including a little jquery inside a callback 
function. This selects for all a tags inside #tweet (you could easily modify 
this selector to make it more specific) and adds the target="_blank" attribute 
to the markup. Wasn't working as a separate function, but works great as a 
callback function. Hope this helps someone else.

getTwitters('tweet', { 
  id: 'rem', 
  count: 5, 
  enableLinks: true, 
  ignoreReplies: true, 
  clearContents: true,
  newwindow: true,
  template: '%text% <a class="time"href="http://twitter.com/%user_screen_name%/statuses/%id_str%/">%time%</a>',
  callback: function() { 
         $('#tweet a').attr('target', '_blank');
        } 
});

Original comment by jessicag...@gmail.com on 13 Oct 2012 at 1:47

GoogleCodeExporter commented 9 years ago
Jquery callback functions don't work in my site

Original comment by andrea.b...@gmail.com on 2 Jan 2013 at 4:57