HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

Change target on links in embed forum

jviljvil New
edited January 2014 in Tutorials

Is there any way to change target links (target = "_blank") when using embed forum? (using Vanilla 2.0.18.10)

I'm using CLEditor, but I didn't found a way to change the target links posted with this editor. Would be ideal to only add target="_blank" in the links on Vanilla iframe and not the entire page. (I'm using Drupal).

I'm missing something? I found similar threads but no real solution to this issue.

Thanks!

Best Answers

Answers

  • Options

    Tried editing: vanilla/themes/EmbedFriendly/views/default.master.tpl but as soon I started the jquery code $(document).ready(function() it throws an error 500. Adding normal Javascript code doesn't return error 500.

    I need to add the jquery libraries on this template?

  • Options

    Thank you so much, that worked perfect!

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    @hgtonight or @UnderDog could you please move this to the Tutorials ?

    Thanks :)

  • Options

    Does this apply to embedded comments? I've modified default.master.tpl and links have different targets in forum posts, but on the embedded comments, things still open within the iframe instead of on _top. If not, where can I modify attributes for Vanilla Embedded Comments for WordPress?

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    The same way , you just need to find the classes for the links you want to apply this to.

  • Options
    acctmanacctman New
    edited February 2014

    is there a way to set all anchors to _self, without having to identify each one? also I added the javascript above and it gave me an error "Something has gone wrong."

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    yes by simply using a and a:link. That will make all links open in the same window

    $('a').attr('target', '_self');

  • Options

    I tried adding the code under the head tag in the default.master.tpl, for my theme but I get a "Something has gone wrong." error page.

    {literal}

    $(document).ready(function() { $('a').attr('target', '_self'); });

    {/literal}

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    You need to use the javascript tags

    {literal}
    
    <script type="text/javascript"> 
    $(document).ready(function() { $('a').attr('target', '_self'); });
    </script>
    
    {/literal}
    
  • Options

    tried both $('a').attr('target', '_self'); and $("a.Title").attr("target", '_self'); still won't override it. do you know where at in the coding I can manually remove the target? This is for the Title name of the categories

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited February 2014

    try this

    {literal}
        <script type="text/javascript"> 
        $(document).ready(function() { 
        $('ul.Discussions div.ItemContent a.Title').attr("target",'_self'); 
        });
        </script>
        {/literal}
    
  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    for the Categories title link

    .DataList .ItemContent.Category a.Title

    {literal}
        <script type="text/javascript"> 
        $(document).ready(function() { 
        $('.DataList .ItemContent.Category a.Title').attr("target",'_self'); 
        });
        </script>
        {/literal}
    
Sign In or Register to comment.