insert hyperlink "with java script pop thing"

Started by piers38, October 30, 2008, 01:01:33 PM

Previous topic - Next topic

piers38

In previous versions of SMF I Used  the Enhanced Post Template Mod to add urls via a pop up box as pictured below.


I used to  add the js code manually to the Post.template.php however I am a little rusty and cant seem to find where to add the code in SMF 2.x

Can anyone help?
hxxp:askfaq.org/ [nonactive]

N3RVE

You should add the following to ./Themes/default/GenericControls.template.php, some of the Post.template.php functions were moved to that file in the current Beta.

Code (Find) Select

// End Print a drop down list for font size . . . . . . . .


Code ( Add after) Select

// Java script to handle URL input boxes ...
    echo '<script language="JavaScript" type="text/javascript">
          <!--
          function urlINPT(){
         var urlLINK = prompt("Please enter URL address:","http://");
          if (urlLINK == null ){ //cancel pressed . . .
          }
          else if (urlLINK == "" || urlLINK == " "){
                  alert("Sorry no text entered!");
          }
          else
          { //ok pressed and there is something :)
          var urlNAME = prompt("Please enter URL name:","");
          if (urlNAME == null ){ //cancel pressed . . .
          }
          else if (urlNAME == "" || urlNAME == " "){  //ok pressed but with notext so use URL only!
                    surroundText(\'[url]\'+urlLINK+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          else //ok pressed with text so use URL and Name!
                    surroundText(\'[url=\'+urlLINK+\']\'+urlNAME+\'\', \'[/url]\', document.', $context['post_form'], '.', $context['post_box_name'], ');
          }
          }
          // -->
          </script>';


-[n3rve]
Ralph "[n3rve]" Otowo
Former Marketing Co-ordinator, Simple Machines.
ralph [at] simplemachines [dot] org                       
Quote"Somewhere, something incredible is waiting to be known." - Carl Sagan

X3mE

I can't find that line in GenericControls.template.php, and I think this has to be done in some of the source files, but I don't have a clue where... Anyone?
Kids, you tried your best and you failed miserably. The lesson is - never try.

My mods:
OS & Browser Detection (1.5 is out!) | Skype Profile Field | GTalk Profile Field | AllCaps Blocker | SMF Syntax Highlighter (Beta) + 2 in development!

Personal websites:
Mobilize.rs (and forum) | Lolmao.info



piers38

I have not been around  for a while and yeah I could not find that line either the closest I could find was // Font sizes anyone?But adding the code there did not work.
hxxp:askfaq.org/ [nonactive]

Rumbaar

Well that should be the correct area for that part of the mods install.  But you need to alter the actual button as well to include the Javascript call.

Which seem to be generated differently, so no sure of how to add it to only one button in the array call.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

stormwatcher

Quote from: piers38 on October 30, 2008, 01:01:33 PM
In previous versions of SMF I Used  the Enhanced Post Template Mod to add urls via a pop up box as pictured below.


I used to  add the js code manually to the Post.template.php however I am a little rusty and cant seem to find where to add the code in SMF 2.x

Can anyone help?

I am using SMF 1.1.10 I have been searching for a mod or the info on the script and where to put it.

The script I am looking for will open a window like the one above. "enter URL address" after you hit enter.....a new window will open and ask........Enter URL name.

anyone? this script just turns an ordinary word into a hyperlink.

what script and where to put it?

Rumbaar

Of afore mentioned mod should do exactly what you want it to do.  It's written for the 1.1.x stream of SMF anyways.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

stormwatcher

Thanks Rumbaar........but My SMF 1.1.10 default theme does not have a ./Themes/default/GenericControls.template.php file.

Where should I write this code?

Rumbaar

Why are you trying to use 2.x code or templates?  Just click on the mod linked in the first post, that OP references and needs modifying to fit a 2.x build.

Just in case you miss it again: http://mods.simplemachines.org/index.php?mod=258
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

stormwatcher

I am not wanting 2.0 codes.........I am wanting code for 1.1.10 that has that hyperlink script that will work in 1.1.10 and no one seems to be able to help me.

Rumbaar

The linked mod does what you want, as per the original post.  They used that mod to add the popup dialog box to add the URL via a popup.  It is designed for 1.1.x.

If you want something different to the original OP, then create a new thread in the correct section for what you are after.  With exact details of what you want.  Also try searching, I'm sure it could have been asked for in the past.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]


Advertisement: