Links to _blank

Free Joomla module to create slideshow on your website which includes different data like part of articles or text defined by user.
Rate this topic: Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.Evaluations: 0, 0.00 on the average.
GK User
Fri Jan 10, 2014 1:06 am
Hello again,
Don't even know where should I post this question: Template discussion ((M)Social, Image Show discussion, or Grid discussion (you don't have it on this forum anyway)?
Here's the deal - playing around with those three, came accross this issue: If I put link into slide setting, when that slide is shown, clicking the link will open new page in the same window. How do I set it in such a way that it would open it with _blank setting, other words in new window?
Thanks. (Not to ruing the operational site, I've put example of what I am talking about at http://v-boge.org for now - the third slideshow with girls should open a new window when clicked).
Thanks.
User avatar
Platinum Boarder

GK User
Fri Jan 10, 2014 8:18 am
Right now none of those modules have that possibility.
You could change source code of the module, but then whenever you use the module - it will always open in new window.
There is a little JS trick method that allows to open outgoing links (links that don't link to your site) in new window - perhaps this could help you?
User avatar
Moderator

GK User
Fri Jan 10, 2014 9:04 am
Cyberek wrote:There is a little JS trick method - perhaps this could help you?

Yeah, will need some explanation as to where to put it in to as well. Thank you.
User avatar
Platinum Boarder

GK User
Fri Jan 10, 2014 4:50 pm
You need to edit this file:
/templates/gk_msocial/js/gk.scripts.js

Now add at it's end:
Code: Select all
jQuery(function() {

jQuery('a').each(function() {
   var a = new RegExp('/' + window.location.host + '/');
   if(!a.test(this.href)) {
       jQuery(this).click(function(event) {
           event.preventDefault();
           event.stopPropagation();
           window.open(this.href, '_blank');
       });
   }
});

});

This will work for all anchor elements on entire page. You can modify it to work just for gkGrid:

jQuery(function() {

jQuery('#gk-grid-134 a').each(function() {
var a = new RegExp('/' + window.location.host + '/');
if(!a.test(this.href)) {
jQuery(this).click(function(event) {
event.preventDefault();
event.stopPropagation();
window.open(this.href, '_blank');
});
}
});

});
[/code]
User avatar
Moderator

GK User
Sat Jan 11, 2014 3:11 pm
Tried to copypaste both of those versions - neither did work. ((( Still opens in the same window.
User avatar
Platinum Boarder

GK User
Sun Jan 12, 2014 12:51 pm
Yeah, its tricky, as grid elements are not available on dom load - they are loaded while site is ready.
You can check this code, it might work, but I'm not 100% sure:
Code: Select all
jQuery(function() {
   jQuery('#gk-grid-134').on('click', 'a', function(){
      var a = new RegExp('/' + window.location.host + '/');
      if(!a.test(this.href)) {
         event.preventDefault();
         event.stopPropagation();
         window.open(this.href, '_blank');
      }
   });
});

Again - put it at the end of gk.sripts.js file, and remove previous modifications.
User avatar
Moderator

GK User
Sun Jan 12, 2014 2:17 pm
Didn't work again... :) If there's any way I could use Image Show as plugin? I'd create article with this plugin string, and put article in the grid - then I'd be able to put one url in the article and that'd work...
User avatar
Platinum Boarder

GK User
Sun Jan 12, 2014 7:32 pm
Sadly, I don't have any other idea how this could be achieved :(.
User avatar
Moderator


cron