Forum closed. New forum available at http://community.wymeditor.org/

[Feature request] Adding rel-attribute to a-tag?

Discuss features, code, contributions, ideas, suggestions, ...
For bugs, patches and feature requests, please post on the Trac:
http://trac.wymeditor.org/

[Feature request] Adding rel-attribute to a-tag?

Postby DelTorro on Tue Dec 12, 2006 8:23 pm

I love this WYSIWYM editor and I am glad to see there is an editor which cares about semantics. I have one question though:

I guess a lot of people with XHTML strict websites use Javascript to open links in a new window (giving a-tags a rel-attribute, Javascript searches for links with this atrribute en puts a target="_blank" to it). Would it be possible to put this feature (giving a-tags a rel-attribute) in your editor? What's your opinion on this? Thanks in advance
DelTorro
 
Posts: 2
Joined: Tue Dec 12, 2006 8:15 pm

Re: [Feature request] Adding rel-attribute to a-tag?

Postby jfh on Tue Dec 12, 2006 10:22 pm

DelTorro wrote:I love this WYSIWYM editor and I am glad to see there is an editor which cares about semantics. I have one question though:

I guess a lot of people with XHTML strict websites use Javascript to open links in a new window (giving a-tags a rel-attribute, Javascript searches for links with this atrribute en puts a target="_blank" to it). Would it be possible to put this feature (giving a-tags a rel-attribute) in your editor? What's your opinion on this? Thanks in advance

An easier solution is to create a new class for links, i.e. "targetblank", so the js code will check for links with this class.
You just need to customize the 'Classes' menu.

See http://trac.wymeditor.org/trac/wiki/Customization and http://trac.wymeditor.org/trac/wiki/FAQ

HTH,
User avatar
jfh
Site Admin
 
Posts: 370
Joined: Sat Sep 23, 2006 8:43 pm
Location: Belgium

Re: [Feature request] Adding rel-attribute to a-tag?

Postby DelTorro on Wed Dec 13, 2006 6:18 pm

jfh wrote:
DelTorro wrote:I love this WYSIWYM editor and I am glad to see there is an editor which cares about semantics. I have one question though:

I guess a lot of people with XHTML strict websites use Javascript to open links in a new window (giving a-tags a rel-attribute, Javascript searches for links with this atrribute en puts a target="_blank" to it). Would it be possible to put this feature (giving a-tags a rel-attribute) in your editor? What's your opinion on this? Thanks in advance

An easier solution is to create a new class for links, i.e. "targetblank", so the js code will check for links with this class.
You just need to customize the 'Classes' menu.

See http://trac.wymeditor.org/trac/wiki/Customization and http://trac.wymeditor.org/trac/wiki/FAQ

HTH,


Why didn't I think of that before? Thanx, I'm now sure to use this editor
DelTorro
 
Posts: 2
Joined: Tue Dec 12, 2006 8:15 pm

Postby Daniel_R on Thu Dec 14, 2006 8:46 pm

Maybe this can be useful:

One of our clients absolutely wanted to have external links open in a separate window.

As I use Jquery, it was very easy to implement:

Code: Select all
   $(document).ready(function() {
      $("a[@href*='http://'],a[@class*='external']")
         .click(
            function(){
               window.open(this.href);
               return false;
            }
         );   
   });


The above code causes all external links, plus links with the class "external" to open in a new window.

The class "external" can be applied to links with WYMeditor if you simply configure the class panel as Jean-François explained.
Daniel_R
 
Posts: 10
Joined: Wed Sep 27, 2006 12:19 pm

URGENT !!!

Postby Fifi on Thu Nov 08, 2007 2:51 pm

Could you translate all this post in french and send the post in the french forum ? Please... My client want to have all external links open in a new window and I don't understand how to do this in WYNeditor.

Thx for your help !
Fifi
 
Posts: 32
Joined: Mon Nov 05, 2007 10:06 am

Postby captain_torche on Thu Nov 08, 2007 6:48 pm

You just have to copy/paste the above code in the page which displays the final code.
You have to install jquery first.

-----
Tu dois juste recopier ce code dans la page qui affiche le code final.
Il faut par contre que tu aies Jquery.
captain_torche
 
Posts: 6
Joined: Thu Nov 08, 2007 12:25 am

Postby Fifi on Thu Nov 08, 2007 9:56 pm

I have Jquery (I think...). I've got a repertory called Jquery with the WYMeditor's repertory, is that it ?

What do you mean by "in the page which displays the final code" ?
Is it the page where I include WYMeditor ?
And where, in this page do I paste the code ?
Sorry, I don't know a lot about javascript...

_______________________________________________________________

J'ai Jquery, je pense... J'ai un dossier Jquery avec le dossier WYMeditor, c'est ça ?

Que veux tu dire par "dans la page qui affiche le code final" ?
Est-ce la page qui contient l'éditeur WYMeditor ?
A quel endroit de la page dois-je coller ce code ?
Désolé, je n'y connais pas grand chose en javascript...
Fifi
 
Posts: 32
Joined: Mon Nov 05, 2007 10:06 am

Postby captain_torche on Fri Nov 09, 2007 6:51 am

You have to put the code in the page which will be displayed to visitors, it will be automatic.
In your Jquery folder, you should have got a file called jquery.js. In the page, you just have to make a link to this file, and therefore copy and paste the above code.

-----

Tu dois mettre le code dans la page qui sera affichée aux visiteurs, le traitement sera automatique.
Dans ton dossier Jquery, tu dois avoir un fichier jquery.js. Dans la page, tu dois juste faire un appel à ce fichier, avant d'y mettre le code susmentionné :
Code: Select all
<script type="text/javascript" src="wymeditor/jquery/jquery.js"></script>
<script type=text/javascript">
   $(document).ready(function() {
      $("a[@href*='http://'],a[@class*='external']")
         .click(
            function(){
               window.open(this.href);
               return false;
            }
         );   
   });
</script>
[/code]
captain_torche
 
Posts: 6
Joined: Thu Nov 08, 2007 12:25 am

Postby Fifi on Fri Nov 09, 2007 10:15 am

It doesn't work...
I paste the code in the header of my page :
________________________________________________________
ça ne marche pas... J'ai collé le code dans le header de ma page :

Code: Select all
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type=text/javascript">
$(document).ready(function() {
$("a[@href*='http://'],a[@class*='external']")
.click(
   function(){
    window.open(this.href);
    return false;
   }
  );   
});
</script>
</head>


The Jquery repertory and my page are in the same repertory.
I have this link in my page :
___________________________________________________
Le répertoire Jquery et ma page sont dans le même répertoire.
J'ai ce lien dans ma page :
Code: Select all
<a class="external" title="chaletfilms.com" href="http://www.chaletfilms.com">www.chaletfilms.com</a>


Did I miss anything ?
I'm using jQuery 1.1.4 (the version downloaded with WYMeditor 0.4)
_____________________________________________________
Ai-je commis une erreur ou un oubli ?
J'ai la jQuery 1.1.4 (la version livrée avec WYMeditor 0.4)

Another question... about the classes. I add the class "external' in jquery.wymeditor.js file : (line 338)
___________________________________________________________
Autre question... à propos des classes. J'ai ajouter la classe "external" dans le fichier jquery.wymeditor.js : (ligne 338)
Code: Select all
classesItems:      [{'name': 'external', 'title': 'lien:externe', 'expr': 'a'}],


The option "lien:externe" appears. I try to apply this class for my link... nothing happen... Did I mistake or miss anything anywhere ?
___________________________________________________________
L'option "lien:externe" apparait bien. J'essaie de l'appliquer à mon lien... il ne se passe rien... Ai-je loupé quelque chose quelque part ?

Is there anyone who can help me in the french forum ?? It's hard to explain all my problems in english !!

Is there any text in french about installation and customization like in the Wiki ? (here)

Perhaps this topics should be moved in Support forum ??
Fifi
 
Posts: 32
Joined: Mon Nov 05, 2007 10:06 am

Postby Fifi on Tue Nov 13, 2007 2:18 pm

Allo ? Nobody can help me ??
Fifi
 
Posts: 32
Joined: Mon Nov 05, 2007 10:06 am

Re: [Feature request] Adding rel-attribute to a-tag?

Postby imcmanus6 on Sat Nov 14, 2009 4:14 pm

Hello fifi, the code that was written in this thread did not work for me either, so I simply changed it to match my style sheet which was a.external { } to the following:
Code: Select all
$(document).ready(function() {
$("a.external")
.click(
   function(){
    window.open(this.href);
    return false;
   }
  );   
});


I hope that helps...Ian http://www.buzzherd.com/member/ian
imcmanus6
 
Posts: 1
Joined: Sat Nov 14, 2009 4:11 pm

Re: [Feature request] Adding rel-attribute to a-tag?

Postby Folken Laëneck on Fri Nov 27, 2009 6:07 pm

This is even simpler and work :
Code: Select all
$(document).ready( function() { $("a.external").attr('target', '_blank'); } );
Folken Laëneck
 
Posts: 13
Joined: Wed Jan 07, 2009 12:08 am

Re: [Feature request] Adding rel-attribute to a-tag?

Postby christracy123 on Wed Mar 31, 2010 3:24 pm

Folken Laëneck wrote:This is even simpler and work :
Code: Select all
$(document).ready( function() { $("a.external").attr('target', '_blank'); } );


This works.
Being stressed out and overweight may not be YOUR fault! It's true, a mysterious condition might be to blame. An estimated 70-80% are suffering from this condition, and don't even know it!

http://www.howtocurecandida.com/survey/
christracy123
 
Posts: 6
Joined: Sat Jan 23, 2010 6:04 am


Return to Developers

Who is online

Users browsing this forum: No registered users and 2 guests