mariovaldez.net

MV.net forums
It is currently 14 Jul 2016, 01:00

All times are UTC - 7 hours




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Link Insertion
PostPosted: 16 May 2003, 15:01 
I wanted to make it so that when users click on a link that a new window will open, so I added this to editor.php

Code:
case "A": {
          cm_newlink = prompt (cm_linkprompt, "");
          if (cm_newlink) {
            document.all("edittextarea").focus();    
            document.execCommand("CreateLink", false, cm_newlink);

// Added by Mark Coudriet - Date: May 16, 2003
// Insert target to open a new window
var eLink;
var aTag = document.all.tags("A"); 
 if (aTag != null) {   
  for (var i = aTag.length - 1; i >= 0; i--) {   
   if (aTag[i].href == cm_newlink) {           
    eLink = aTag[i];        
   }    
  } 
 }
eLink.target = "_new";
// End Modified

}
break;
}


Maybe this is something that you might like to add?

Best Regards,
Mark Coudriet


Report this post
Top
  
Reply with quote  
 Post subject: Added feature
PostPosted: 19 May 2003, 09:53 
Here is the same code as above, but with the link tracking feature added!

Code:
case "A": {
   cm_newlink = prompt (cm_linkprompt, "");
   if (cm_newlink) {
      document.all("edittextarea").focus();
      document.execCommand("CreateLink", false, cm_newlink);
         
      // Added by Mark Coudriet - Date: May 16, 2003
      // Insert target to open a new window
      var eLink; 
      var aTag = document.all.tags("A"); 
         if (aTag != null) {   
            for (var i = aTag.length - 1; i >= 0; i--) {   
               if (aTag[i].href == cm_newlink) {        
                  eLink = aTag[i];        
               }    
            } 
         }
         eLink.target = "_new";
         
        // Mark Coudriet - Date: May 19, 2003
       // Added link tracking to HTML editor
       var replaceTxt = new RegExp("http", "gi");
       eLink.href = eLink.href.replace(replaceTxt, "redir.php?cm_elink=http");
       // End Added
             
   // End Added
   }
break;
}


Hope this is useful! =]

Mark


Report this post
Top
  
Reply with quote  
 Post subject: Inserting links...
PostPosted: 22 May 2003, 01:50 
User avatar

Joined: 06 Mar 2003, 03:21
Posts: 447
Location: Monterrey, NL, Mexico
Psymon:

Hi. Good ideas. Actually, bug fixes.

In the latest 0.6.0-beta3 the editor ask you if the link will be opened in a new window or not. Also, the URLs are now fixed according to the type (http, ftp, mailto, local file) to use the redir or the getfile facility. Also, now you don't have to select text before inserting the URL. (This is more important with the Mozilla version).

In a future version it will display a form to enter data in a more elegant way.

Regards,

Mario A. Valdez-Ramirez.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group