Re: Duda sobre bbcode URL
Publicado: 11 Nov 2008, 22:44
Lo es, te lo puse para que lo leas, sino lees no sabras para que sirve todo el trabajo que realizo Mitch, veras como encuentras ahi lo que quieres.
Saludos!
Saludos!
phpBB España Oficial, Soporte Internacional Oficial del sistema de foros phpBB en Español, extensiones, estilos, traducciones, guías, tutoriales, videos, redes sociales, webmaster.
https://www.phpbb-es.com/foro/
Código: Seleccionar todo
onclick="bbstyle(14)"
Código: Seleccionar todo
onclick="BBcodeimg()"
Código: Seleccionar todo
onclick="bbstyle(16)"
Código: Seleccionar todo
onclick="BBcodeurl()"
Código: Seleccionar todo
onclick="bbstyle(18)"
Código: Seleccionar todo
onclick="BBcodeflash()"
Código: Seleccionar todo
// BBcodes por Mitch
function BBcodeimg() {
theSelection = false;
var textarea = document.forms[form_name].elements[text_name];
textarea.focus();
if ((clientVer >= 4) && is_ie && is_win)
{
theSelection = document.selection.createRange().text;
if (theSelection)
{
bbfontstyle('[img]','[/img]');
return;
}
}
else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0))
{
bbfontstyle('[img]','[/img]');
return;
}
var Errores = '';
var enterURL = prompt("Introduzca la URL de la imagen", "http://");
if (!enterURL) {
Errores += "Debes ingresar una URL para la imagen.";
alert("Error: "+Errores);
return;
}
var Post = "[img]"+enterURL+"[/img]";
insert_text(Post);
}
function BBcodeurl() {
theSelection = false;
var textarea = document.forms[form_name].elements[text_name];
textarea.focus();
if ((clientVer >= 4) && is_ie && is_win)
{
theSelection = document.selection.createRange().text;
if (theSelection)
{
bbfontstyle('[url]','[/url]');
return;
}
}
else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0))
{
bbfontstyle('[url]','[/url]');
return;
}
var Errores = '';
var enterURL = prompt("Introduzca la URL", "http://");
var enterTITULO = prompt("Introduzca el nombre del enlace (opcional)", "Nombre de la Página Web");
if (!enterURL) {
Errores += "Debes ingresar una URL.";
alert("Error: "+Errores);
return;
}
if (!enterTITULO) {
var Post = "[url]"+enterURL+"[/url]";
insert_text(Post);
}
else {
var Post = "[url="+enterURL+"]"+enterTITULO+"[/url]";
insert_text(Post);
}
}
function BBcodeflash() {
theSelection = false;
var textarea = document.forms[form_name].elements[text_name];
textarea.focus();
if ((clientVer >= 4) && is_ie && is_win)
{
theSelection = document.selection.createRange().text;
if (theSelection)
{
bbfontstyle('[flash=500,350]','[/flash]');
return;
}
}
else if (document.forms[form_name].elements[text_name].selectionEnd && (document.forms[form_name].elements[text_name].selectionEnd - document.forms[form_name].elements[text_name].selectionStart > 0))
{
bbfontstyle('[flash=320,285]','[/flash]');
return;
}
var Errores = '';
var enterURL = prompt("Introduzca la URL del Flash", "http://");
var enterWIDTH = prompt("Introduzca el ancho del flash, en pixeles", "500");
var enterHEIGHT = prompt("Introduzca el alto del flash, en pixeles", "350");
if (!enterURL) {
Errores += "Debes ingresar una URL.";
alert("Error: "+Errores);
return;
}
if (!enterWIDTH || !enterHEIGHT) {
Errores += "Debes ingresar un ancho o alto en pixeles para el archivo flash.";
alert("Error: "+Errores);
return;
}
else {
var Post = "[flash="+enterWIDTH+","+enterHEIGHT+"]"+enterURL+"[/flash]";
insert_text(Post);
}
}
// BBcodes por Mitch