MyBB Community Forums

Full Version: Way to recreate "Insert URL" for other BBcode?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I made a custom acronym tag (along with some other ones), and it uses the [bbcode="$1"]$2[/bbcode] coding.

I already hacked in the code for it, but someone has to know to put in the first value, then the other. Does anyone know what to add to the script call (in the .js file, I'd imagine) to create the Javascript pop-up that gets someone to insert the text for the field. So it would say...

Please enter the acronym.
(Field)

-after clicking enter/whatever-

Please enter the full term.
(Field)

And it would create the tag.

Any help is appreciated. Smile
Taken from http://www.w3schools.com/js/js_popup.asp
<html>
<head>
<script type="text/javascript">
function disp_prompt()
  {
  var name=prompt("Please enter your name","Harry Potter")
  if (name!=null && name!="")
    {
    document.write("Hello " + name + "! How are you today?")
    }
  }
</script>
</head>
<body>

<input type="button" onclick="disp_prompt()" value="Display a prompt box" />

</body>
</html>
Those only make a "Enter Text, Get Response", not a "enter this, enter that, format as so", from what I can see.
You could chain them together?

var acc=prompt("Please enter the acronym.","")
var term=prompt("Please enter the full term","")

alert("Acronym = " + acc);
alert("Term = " + term);

I don't think there is any other alternative with Javascript. Unless you start creating HTML DIV pop-ups that turn visible/invisible.
Hmm...I wonder how the MyBB guys did it, then...

Looks like I'll have to poke around the source code some more. XD