Diff
checker
Texto
Texto
Imágenes
Documentos
Excel
Carpetas
Legal
Enterprise
Aplicación de escritorio
Precios
Iniciar sesión
Descargar Diffchecker Desktop
Comparar texto
Encuentra la diferencia entre dos archivos de texto
Herramientas
Historial
Editor live
Ocultar sin cambios
Sin ajuste de línea
Vista
Dividido
Unificado
Nivel de detalle
Inteligente
Palabra
Letra
Resaltado de sintaxis
Elegir sintaxis
Ignorar
Transformar texto
Ir al primer cambio
Editar entrada
Diffchecker Desktop
La forma más segura de usar Diffchecker. ¡Obtén la app de Diffchecker Desktop: tus diffs nunca salen de tu computadora!
Obtener Desktop
Untitled diff
Creado
hace 7 años
El diff nunca expira
Borrar
Exportar
Compartir
Explicar
60 eliminaciones
Líneas
Total
Eliminado
Caracteres
Total
Eliminado
Para continuar usando esta función, actualice a
Diff
checker
Pro
Ver precios
352 líneas
Copiar todo
31 adiciones
Líneas
Total
Añadido
Caracteres
Total
Añadido
Para continuar usando esta función, actualice a
Diff
checker
Pro
Ver precios
349 líneas
Copiar todo
Copiar
Copiado
Copiar
Copiado
/*##################################################
/**
* bbcode.js
*
@
copyright
©
2005
-2019 PHPBoost
* -------------------
*
@license
https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
* begin : August 01, 2005
* @author
Regis VIARRE <
crowkait@phpboost.com
>
*
copyright
: (C)
2005
Viarre Régis
* @version PHPBoost 5.2 - last update: 2018 11 18
*
email
:
crowkait@phpboost.com
* @since PHPBoost 1.2 - 2005 08 01
*
* @contributor Julien BRISWALTER <j1.seth@phpboost.com>
*
* @contributor Arnaud GENET <elenwii@phpboost.com>
###################################################
* @contributor Sebastien LARTIGUE <babsolune@phpboost.com>
*
*/
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
###################################################*/
function textarea_resize(id, px, type)
function textarea_resize(id, px, type)
{
{
var textarea = document.getElementById(id);
var textarea = document.getElementById(id);
if( type == 'height' )
if( type == 'height' )
{
{
var current_height = parseInt(textarea.style.height) ? parseInt(textarea.style.height) : 300;
var current_height = parseInt(textarea.style.height) ? parseInt(textarea.style.height) : 300;
var new_height = current_height + px;
var new_height = current_height + px;
Copiar
Copiado
Copiar
Copiado
if( new_height > 40 )
if( new_height > 40 )
textarea.style.height = new_height + "px";
textarea.style.height = new_height + "px";
}
}
else
else
{
{
var current_width = parseInt(textarea.style.width) ? parseInt(textarea.style.width) : 150;
var current_width = parseInt(textarea.style.width) ? parseInt(textarea.style.width) : 150;
var new_width = current_width + px;
var new_width = current_width + px;
Copiar
Copiado
Copiar
Copiado
if( new_width > 40 )
if( new_width > 40 )
textarea.style.width = new_width + "px";
textarea.style.width = new_width + "px";
}
}
Copiar
Copiado
Copiar
Copiado
return false;
return false;
}
}
//Insertion dans le champs.
//Insertion dans le champs.
function simple_insert(open_balise, close_balise, field)
function simple_insert(open_balise, close_balise, field)
{
{
var textarea = document.getElementById(field);
var textarea = document.getElementById(field);
var scroll = textarea.scrollTop;
var scroll = textarea.scrollTop;
Copiar
Copiado
Copiar
Copiado
if( close_balise != "" && close_balise != "smile" )
if( close_balise != "" && close_balise != "smile" )
textarea.value += '[' + open_balise + '][/' + close_balise + ']';
textarea.value += '[' + open_balise + '][/' + close_balise + ']';
else if( close_balise == "smile" )
else if( close_balise == "smile" )
textarea.value += ' ' + open_balise + ' ';
textarea.value += ' ' + open_balise + ' ';
Copiar
Copiado
Copiar
Copiado
textarea.focus();
textarea.focus();
textarea.scrollTop = scroll;
textarea.scrollTop = scroll;
return;
return;
}
}
//Récupération de la sélection sur netscape, ajout des balises autour.
//Récupération de la sélection sur netscape, ajout des balises autour.
function netscape_sel(target, open_balise, close_balise)
function netscape_sel(target, open_balise, close_balise)
{
{
var sel_length = target.textLength;
var sel_length = target.textLength;
var sel_start = target.selectionStart;
var sel_start = target.selectionStart;
var sel_end = target.selectionEnd;
var sel_end = target.selectionEnd;
var scroll = target.scrollTop; //Position verticale.
var scroll = target.scrollTop; //Position verticale.
Copiar
Copiado
Copiar
Copiado
if( sel_end == 1 || sel_end == 2 )
if( sel_end == 1 || sel_end == 2 )
{
{
sel_end = sel_length;
sel_end = sel_length;
}
}
var string_start = (target.value).substring(0, sel_start);
var string_start = (target.value).substring(0, sel_start);
var selection = (target.value).substring(sel_start, sel_end);
var selection = (target.value).substring(sel_start, sel_end);
var string_end = (target.value).substring(sel_end, sel_length);
var string_end = (target.value).substring(sel_end, sel_length);
if( close_balise != "" && selection == "" && close_balise != "smile" )
if( close_balise != "" && selection == "" && close_balise != "smile" )
{
{
target.value = string_start + open_balise + close_balise + string_end;
target.value = string_start + open_balise + close_balise + string_end;
target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length);
target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length);
target.focus();
target.focus();
}
}
else if( close_balise == "smile" )
else if( close_balise == "smile" )
{
{
Copiar
Copiado
Copiar
Copiado
target.value = string_start + selection + ' ' + open_balise + ' ' + string_end;
target.value = string_start + selection + ' ' + open_balise + ' ' + string_end;
target.setSelectionRange(string_start.length + open_balise.length + 2, target.value.length - string_end.length);
target.setSelectionRange(string_start.length + open_balise.length + 2, target.value.length - string_end.length);
target.focus();
target.focus();
}
}
else
else
{
{
target.value = string_start + open_balise + selection + close_balise + string_end;
target.value = string_start + open_balise + selection + close_balise + string_end;
target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length);
target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length);
target.focus();
target.focus();
}
}
Copiar
Copiado
Copiar
Copiado
target.scrollTop = scroll; //Remet à la bonne position le textarea.
target.scrollTop = scroll; //Remet à la bonne position le textarea.
return;
return;
}
}
//Récupération de la sélection sur IE, ajout des balises autour.
//Récupération de la sélection sur IE, ajout des balises autour.
function ie_sel(target, open_balise, close_balise)
function ie_sel(target, open_balise, close_balise)
{
{
selText = false;
selText = false;
var scroll = target.scrollTop; //Position verticale.
var scroll = target.scrollTop; //Position verticale.
Copiar
Copiado
Copiar
Copiado
selection = document.selection.createRange().text; // Sélection
selection = document.selection.createRange().text; // Sélection
if( close_balise != "" && selection == "" && close_balise != "smile" )
if( close_balise != "" && selection == "" && close_balise != "smile" )
document.selection.createRange().text = open_balise + close_balise;
document.selection.createRange().text = open_balise + close_balise;
else if( close_balise == "smile" )
else if( close_balise == "smile" )
document.selection.createRange().text = selection + open_balise + ' ';
document.selection.createRange().text = selection + open_balise + ' ';
else
else
Copiar
Copiado
Copiar
Copiado
document.selection.createRange().text = open_balise + selection + close_balise;
document.selection.createRange().text = open_balise + selection + close_balise;
target.scrollTop = scroll; //Remet à la bonne position le textarea.
target.scrollTop = scroll; //Remet à la bonne position le textarea.
selText = '';
selText = '';
Copiar
Copiado
Copiar
Copiado
return;
return;
}
}
//Fonction de remplacement des caractères spéciaux
//Fonction de remplacement des caractères spéciaux
function url_encode_rewrite(link_name)
function url_encode_rewrite(link_name)
{
{
link_name = link_name.toLowerCase(link_name);
link_name = link_name.toLowerCase(link_name);
Copiar
Copiado
Copiar
Copiado
var chars_special = new Array(/ /g, /é/g, /è/g, /ê/g, /à/g, /â/g, /ù/g, /ü/g, /û/g, /ï/g, /î/g, /ô/g, /ç/g);
var chars_special = new Array(/ /g, /é/g, /è/g, /ê/g, /à/g, /â/g, /ù/g, /ü/g, /û/g, /ï/g, /î/g, /ô/g, /ç/g);
var chars_replace = new Array("-", "e", "e", "e", "a", "a", "u", "u", "u", "i", "i", "o", "c");
var chars_replace = new Array("-", "e", "e", "e", "a", "a", "u", "u", "u", "i", "i", "o", "c");
var nbr_chars = chars_special.length;
var nbr_chars = chars_special.length;
for( var i = 0; i < nbr_chars; i++)
for( var i = 0; i < nbr_chars; i++)
{
{
Copiar
Copiado
Copiar
Copiado
link_name = link_name.replace(chars_special[i], chars_replace[i]);
link_name = link_name.replace(chars_special[i], chars_replace[i]);
}
}
link_name = link_name.replace(/([^a-z0-9]|[\s])/g, '-');
link_name = link_name.replace(/([^a-z0-9]|[\s])/g, '-');
link_name = link_name.replace(/([-]{2,})/g, '-');
link_name = link_name.replace(/([-]{2,})/g, '-');
return link_name.replace(/(^\s*)|(\s*$)/g,'').replace(/(^-)|(-$)/g,'');
return link_name.replace(/(^\s*)|(\s*$)/g,'').replace(/(^-)|(-$)/g,'');
}
}
//Fonction d'insertion du BBcode dans le champs, tient compte du navigateur utilisé.
//Fonction d'insertion du BBcode dans le champs, tient compte du navigateur utilisé.
function insertbbcode(open_balise, close_balise, field)
function insertbbcode(open_balise, close_balise, field)
{
{
var area = document.getElementById(field);
var area = document.getElementById(field);
var nav = navigator.appName; //Recupère le nom du navigateur
var nav = navigator.appName; //Recupère le nom du navigateur
area.focus();
area.focus();
if( nav == 'Microsoft Internet Explorer' ) // Internet Explorer
if( nav == 'Microsoft Internet Explorer' ) // Internet Explorer
ie_sel(area, open_balise, close_balise);
ie_sel(area, open_balise, close_balise);
else if( nav == 'Netscape' || nav == 'Opera' ) //Netscape ou opera
else if( nav == 'Netscape' || nav == 'Opera' ) //Netscape ou opera
netscape_sel(area, open_balise, close_balise);
netscape_sel(area, open_balise, close_balise);
else //insertion normale (autres navigateurs)
else //insertion normale (autres navigateurs)
simple_insert(open_balise, close_balise, field);
simple_insert(open_balise, close_balise, field);
return;
return;
}
}
//Insertion dans le champs des codes de type select.
//Insertion dans le champs des codes de type select.
function insertbbcode_select(id_select, close_balise, field)
function insertbbcode_select(id_select, close_balise, field)
{
{
var select = document.getElementById(id_select + field);
var select = document.getElementById(id_select + field);
Copiar
Copiado
Copiar
Copiado
if( select.value != '' )
if( select.value != '' )
insertbbcode('[' + id_select + '=' + select.value + ']', close_balise, field);
insertbbcode('[' + id_select + '=' + select.value + ']', close_balise, field);
Copiar
Copiado
Copiar
Copiado
//On remet la valeur par défaut.
//On remet la valeur par défaut.
select.options[0].selected = true;
select.options[0].selected = true;
Copiar
Copiado
Copiar
Copiado
return;
return;
Copiar
Copiado
Copiar
Copiado
}
}
//Insertion dans le champs des codes de type select.
//Insertion dans le champs des codes de type select.
function insertbbcode_select2(id_select, field)
function insertbbcode_select2(id_select, field)
{
{
var select = document.getElementById(id_select + field);
var select = document.getElementById(id_select + field);
Copiar
Copiado
Copiar
Copiado
if( select.value != '' )
if( select.value != '' )
insertbbcode('[' + select.value + ']', '[/' + select.value + ']', field);
insertbbcode('[' + select.value + ']', '[/' + select.value + ']', field);
Copiar
Copiado
Copiar
Copiado
//On remet la valeur par défaut.
//On remet la valeur par défaut.
select.options[0].selected = true;
select.options[0].selected = true;
Copiar
Copiado
Copiar
Copiado
return;
return;
}
}
//Conserve la configuration de la barre bbcode.
//Conserve la configuration de la barre bbcode.
function set_bbcode_preference(divID)
function set_bbcode_preference(divID)
{
{
if( getCookie('hide-bbcode') == 0 )
if( getCookie('hide-bbcode') == 0 )
{
{
jQuery('#bbcode-expanded').removeClass('expand');
jQuery('#bbcode-expanded').removeClass('expand');
jQuery( "." + divID).each(function(){
jQuery( "." + divID).each(function(){
jQuery( "." + divID).hide();
jQuery( "." + divID).hide();
});
});
}
}
}
}
//Masquage du div.
//Masquage du div.
function show_bbcode_div(divID)
function show_bbcode_div(divID)
{
{
if( getCookie('hide-bbcode') == 0 )
if( getCookie('hide-bbcode') == 0 )
{
{
jQuery('#bbcode-expanded').addClass('expand');
jQuery('#bbcode-expanded').addClass('expand');
sendCookie('hide-bbcode', 1); //On envoi le cookie pour se souvenir du choix de l'utilisateur.
sendCookie('hide-bbcode', 1); //On envoi le cookie pour se souvenir du choix de l'utilisateur.
jQuery( "." + divID).each(function(){
jQuery( "." + divID).each(function(){
jQuery( "." + divID).fadeIn(300);
jQuery( "." + divID).fadeIn(300);
Copiar
Copiado
Copiar
Copiado
});
});
}
}
else
else
{
{
jQuery( "." + divID).each(function(){
jQuery( "." + divID).each(function(){
jQuery( "." + divID).fadeOut(300);
jQuery( "." + divID).fadeOut(300);
});
});
jQuery('#bbcode-expanded').removeClass('expand');
jQuery('#bbcode-expanded').removeClass('expand');
sendCookie('hide-bbcode', 0); //On envoi le cookie pour se souvenir du choix de l'utilisateur.
sendCookie('hide-bbcode', 0); //On envoi le cookie pour se souvenir du choix de l'utilisateur.
}
}
}
}
function bbcode_color(divID, field, type)
function bbcode_color(divID, field, type)
{
{
var i;
var i;
var br;
var br;
var contents;
var contents;
var color = new Array(
var color = new Array(
'#000000', '#433026', '#333300', '#003300', '#003366', '#000080', '#333399', '#333333',
'#000000', '#433026', '#333300', '#003300', '#003366', '#000080', '#333399', '#333333',
'#800000', '#FFA500', '#808000', '#008000', '#008080', '#0000FF', '#666699', '#808080',
'#800000', '#FFA500', '#808000', '#008000', '#008080', '#0000FF', '#666699', '#808080',
'#F04343', '#FF9900', '#99CC00', '#339966', '#33CCCC', '#3366FF', '#800080', '#ACA899',
'#F04343', '#FF9900', '#99CC00', '#339966', '#33CCCC', '#3366FF', '#800080', '#ACA899',
'#FFC0CB', '#FFCC00', '#FFFF00', '#00FF00', '#00FFFF', '#00CCFF', '#993366', '#C0C0C0',
'#FFC0CB', '#FFCC00', '#FFFF00', '#00FF00', '#00FFFF', '#00CCFF', '#993366', '#C0C0C0',
'#FF99CC', '#FFCC99', '#FFFF99', '#CCFFCC', '#CCFFFF', '#CC99FF', '#E3007B', '#FFFFFF');
'#FF99CC', '#FFCC99', '#FFFF99', '#CCFFCC', '#CCFFFF', '#CC99FF', '#E3007B', '#FFFFFF');
contents = '<table><tr>';
contents = '<table><tr>';
for(i = 0; i < 40; i++)
for(i = 0; i < 40; i++)
{
{
br = (i+1) % 8;
br = (i+1) % 8;
br = (br == 0 && i != 0 && i < 39) ? '</tr><tr>' : '';
br = (br == 0 && i != 0 && i < 39) ? '</tr><tr>' : '';
Copiar
Copiado
Copiar
Copiado
contents += '<td><a href="
" style="background
:' + color[i] + ';" onclick="insertbbcode(\'[' + type + '=' + color[i] + ']\', \'[/' + type + ']\', \'' + field + '\');bb_hide_block(\'' + divID + '\', \'' + field + '\', 0);return false;"></a></td>' + br;
contents += '<td><a href="
" aria-label="' + color[i] + '" title="' + color[i] + '
" style="background
-color
:' + color[i] + ';" onclick="insertbbcode(\'[' + type + '=' + color[i] + ']\', \'[/' + type + ']\', \'' + field + '\');bb_hide_block(\'' + divID + '\', \'' + field + '\', 0);return false;"></a></td>' + br;
}
}
document.getElementById("bb-"+ type + field).innerHTML = contents + '</tr></table>';
document.getElementById("bb-"+ type + field).innerHTML = contents + '</tr></table>';
}
}
function bbcode_table(field, head_name)
function bbcode_table(field, head_name)
{
{
var cols = document.getElementById('bb-cols' + field).value;
var cols = document.getElementById('bb-cols' + field).value;
var lines = document.getElementById('bb-lines' + field).value;
var lines = document.getElementById('bb-lines' + field).value;
var head = document.getElementById('bb-head' + field).checked;
var head = document.getElementById('bb-head' + field).checked;
var code = '';
var code = '';
Copiar
Copiado
Copiar
Copiado
if( cols >= 0 && lines >= 0 )
if( cols >= 0 && lines >= 0 )
{
{
var colspan = cols > 1 ? ' colspan="' + cols + '"' : '';
var colspan = cols > 1 ? ' colspan="' + cols + '"' : '';
var pointor = head ? (59 + colspan.length) : 22;
var pointor = head ? (59 + colspan.length) : 22;
code = head ? '[table]\n\t[row]\n\t\t[head' + colspan + ']'+ head_name +'[/head]\n\t[/row]\n' : '[table]\n';
code = head ? '[table]\n\t[row]\n\t\t[head' + colspan + ']'+ head_name +'[/head]\n\t[/row]\n' : '[table]\n';
Copiar
Copiado
Copiar
Copiado
for(var i = 0; i < lines; i++)
for(var i = 0; i < lines; i++)
{
{
code += '\t[row]\n';
code += '\t[row]\n';
for(var j = 0; j < cols; j++)
for(var j = 0; j < cols; j++)
code += '\t\t[col][/col]\n';
code += '\t\t[col][/col]\n';
code += '\t[/row]\n';
code += '\t[/row]\n';
}
}
code += '[/table]';
code += '[/table]';
Copiar
Copiado
Copiar
Copiado
insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field);
insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field);
}
}
}
}
function bbcode_list(field)
function bbcode_list(field)
{
{
var elements = document.getElementById('bb_list' + field).value;
var elements = document.getElementById('bb_list' + field).value;
var ordered_list = document.getElementById('bb_ordered_list' + field).checked;
var ordered_list = document.getElementById('bb_ordered_list' + field).checked;
if( elements <= 0 )
if( elements <= 0 )
elements = 1;
elements = 1;
Copiar
Copiado
Copiar
Copiado
var pointor = ordered_list ? 19 : 11;
var pointor = ordered_list ? 19 : 11;
Copiar
Copiado
Copiar
Copiado
code = '[list' + (ordered_list ? '=ordered' : '') + ']\n';
code = '[list' + (ordered_list ? '=ordered' : '') + ']\n';
for(var j = 0; j < elements; j++)
for(var j = 0; j < elements; j++)
code += '\t[*]\n';
code += '\t[*]\n';
code += '[/list]';
code += '[/list]';
insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field);
insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field);
}
}
function bbcode_url(field, prompt_text)
function bbcode_url(field, prompt_text)
{
{
var url = prompt(prompt_text, '');
var url = prompt(prompt_text, '');
if(url != '' && url != null)
if(url != '' && url != null)
insertbbcode('[url=' + url + ']', '[/url]', field);
insertbbcode('[url=' + url + ']', '[/url]', field);
}
}
Copiar
Copiado
Copiar
Copiado
function bbcode_quote(field, prompt_text)
{
var author = prompt(prompt_text, '');
if(author != null)
{
if(author != '')
insertbbcode('[quote=' + author + ']', '[/quote]', field);
else
insertbbcode('[quote]', '[/quote]', field);
}
}
function bbcode_lightbox(field, prompt_text)
function bbcode_lightbox(field, prompt_text)
{
{
var url = prompt(prompt_text, '');
var url = prompt(prompt_text, '');
if(url != '' && url != null)
if(url != '' && url != null)
insertbbcode('[lightbox=' + url + '][img style="max-width: 150px;"]' + url, '[/img][/lightbox]', field);
insertbbcode('[lightbox=' + url + '][img style="max-width: 150px;"]' + url, '[/img][/lightbox]', field);
}
}
function bbcode_anchor(field, prompt_text)
function bbcode_anchor(field, prompt_text)
{
{
var anchor = prompt(prompt_text, '');
var anchor = prompt(prompt_text, '');
if(anchor != '' && anchor != null)
if(anchor != '' && anchor != null)
insertbbcode('[anchor=' + url_encode_rewrite(anchor) + ']', '[/anchor]', field);
insertbbcode('[anchor=' + url_encode_rewrite(anchor) + ']', '[/anchor]', field);
else
else
insertbbcode('[anchor]', '[/anchor]', field);
insertbbcode('[anchor]', '[/anchor]', field);
}
}
function bbcode_abbr(field, prompt_text)
function bbcode_abbr(field, prompt_text)
{
{
var desc = prompt(prompt_text, '');
var desc = prompt(prompt_text, '');
Copiar
Copiado
Copiar
Copiado
if(desc != '' && desc != null)
if(desc != '' && desc != null)
insertbbcode('[abbr=' + desc + ']', '[/abbr]', field);
insertbbcode('[abbr=' + desc + ']', '[/abbr]', field);
else
else
insertbbcode('[abbr]', '[/abbr]', field);
insertbbcode('[abbr]', '[/abbr]', field);
}
}
function bbcode_acronym(field, prompt_text)
function bbcode_acronym(field, prompt_text)
{
{
var desc = prompt(prompt_text, '');
var desc = prompt(prompt_text, '');
Copiar
Copiado
Copiar
Copiado
if(desc != '' && desc != null)
if(desc != '' && desc != null)
insertbbcode('[acronym=' + desc + ']', '[/acronym]', field);
insertbbcode('[acronym=' + desc + ']', '[/acronym]', field);
else
else
insertbbcode('[acronym]', '[/acronym]', field);
insertbbcode('[acronym]', '[/acronym]', field);
}
}
function bbcode_fieldset(field, prompt_text)
function bbcode_fieldset(field, prompt_text)
{
{
var legend = prompt(prompt_text, '');
var legend = prompt(prompt_text, '');
if(legend != '' && legend != null)
if(legend != '' && legend != null)
insertbbcode('[fieldset legend="' + legend + '"]', '[/fieldset]', field);
insertbbcode('[fieldset legend="' + legend + '"]', '[/fieldset]', field);
else
else
insertbbcode('[fieldset]', '[/fieldset]', field);
insertbbcode('[fieldset]', '[/fieldset]', field);
}
}
function bbcode_mail(field, prompt_text)
function bbcode_mail(field, prompt_text)
{
{
var mail = prompt(prompt_text, '');
var mail = prompt(prompt_text, '');
if(mail != '' && mail != null)
if(mail != '' && mail != null)
insertbbcode('[mail=' + mail + ']', '[/mail]', field);
insertbbcode('[mail=' + mail + ']', '[/mail]', field);
}
}
function bbcode_feed(field, prompt_text)
function bbcode_feed(field, prompt_text)
{
{
var feed = prompt(prompt_text, '');
var feed = prompt(prompt_text, '');
if(feed != '' && feed != null)
if(feed != '' && feed != null)
insertbbcode('[feed cat="0" number="5"]' + feed.toLowerCase(), '[/feed]', field);
insertbbcode('[feed cat="0" number="5"]' + feed.toLowerCase(), '[/feed]', field);
}
}
Diferencias guardadas
Texto original
Abrir archivo
/*################################################## * bbcode.js * ------------------- * begin : August 01, 2005 * copyright : (C) 2005 Viarre Régis * email : crowkait@phpboost.com * * ################################################### * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ###################################################*/ function textarea_resize(id, px, type) { var textarea = document.getElementById(id); if( type == 'height' ) { var current_height = parseInt(textarea.style.height) ? parseInt(textarea.style.height) : 300; var new_height = current_height + px; if( new_height > 40 ) textarea.style.height = new_height + "px"; } else { var current_width = parseInt(textarea.style.width) ? parseInt(textarea.style.width) : 150; var new_width = current_width + px; if( new_width > 40 ) textarea.style.width = new_width + "px"; } return false; } //Insertion dans le champs. function simple_insert(open_balise, close_balise, field) { var textarea = document.getElementById(field); var scroll = textarea.scrollTop; if( close_balise != "" && close_balise != "smile" ) textarea.value += '[' + open_balise + '][/' + close_balise + ']'; else if( close_balise == "smile" ) textarea.value += ' ' + open_balise + ' '; textarea.focus(); textarea.scrollTop = scroll; return; } //Récupération de la sélection sur netscape, ajout des balises autour. function netscape_sel(target, open_balise, close_balise) { var sel_length = target.textLength; var sel_start = target.selectionStart; var sel_end = target.selectionEnd; var scroll = target.scrollTop; //Position verticale. if( sel_end == 1 || sel_end == 2 ) { sel_end = sel_length; } var string_start = (target.value).substring(0, sel_start); var selection = (target.value).substring(sel_start, sel_end); var string_end = (target.value).substring(sel_end, sel_length); if( close_balise != "" && selection == "" && close_balise != "smile" ) { target.value = string_start + open_balise + close_balise + string_end; target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length); target.focus(); } else if( close_balise == "smile" ) { target.value = string_start + selection + ' ' + open_balise + ' ' + string_end; target.setSelectionRange(string_start.length + open_balise.length + 2, target.value.length - string_end.length); target.focus(); } else { target.value = string_start + open_balise + selection + close_balise + string_end; target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length); target.focus(); } target.scrollTop = scroll; //Remet à la bonne position le textarea. return; } //Récupération de la sélection sur IE, ajout des balises autour. function ie_sel(target, open_balise, close_balise) { selText = false; var scroll = target.scrollTop; //Position verticale. selection = document.selection.createRange().text; // Sélection if( close_balise != "" && selection == "" && close_balise != "smile" ) document.selection.createRange().text = open_balise + close_balise; else if( close_balise == "smile" ) document.selection.createRange().text = selection + open_balise + ' '; else document.selection.createRange().text = open_balise + selection + close_balise; target.scrollTop = scroll; //Remet à la bonne position le textarea. selText = ''; return; } //Fonction de remplacement des caractères spéciaux function url_encode_rewrite(link_name) { link_name = link_name.toLowerCase(link_name); var chars_special = new Array(/ /g, /é/g, /è/g, /ê/g, /à/g, /â/g, /ù/g, /ü/g, /û/g, /ï/g, /î/g, /ô/g, /ç/g); var chars_replace = new Array("-", "e", "e", "e", "a", "a", "u", "u", "u", "i", "i", "o", "c"); var nbr_chars = chars_special.length; for( var i = 0; i < nbr_chars; i++) { link_name = link_name.replace(chars_special[i], chars_replace[i]); } link_name = link_name.replace(/([^a-z0-9]|[\s])/g, '-'); link_name = link_name.replace(/([-]{2,})/g, '-'); return link_name.replace(/(^\s*)|(\s*$)/g,'').replace(/(^-)|(-$)/g,''); } //Fonction d'insertion du BBcode dans le champs, tient compte du navigateur utilisé. function insertbbcode(open_balise, close_balise, field) { var area = document.getElementById(field); var nav = navigator.appName; //Recupère le nom du navigateur area.focus(); if( nav == 'Microsoft Internet Explorer' ) // Internet Explorer ie_sel(area, open_balise, close_balise); else if( nav == 'Netscape' || nav == 'Opera' ) //Netscape ou opera netscape_sel(area, open_balise, close_balise); else //insertion normale (autres navigateurs) simple_insert(open_balise, close_balise, field); return; } //Insertion dans le champs des codes de type select. function insertbbcode_select(id_select, close_balise, field) { var select = document.getElementById(id_select + field); if( select.value != '' ) insertbbcode('[' + id_select + '=' + select.value + ']', close_balise, field); //On remet la valeur par défaut. select.options[0].selected = true; return; } //Insertion dans le champs des codes de type select. function insertbbcode_select2(id_select, field) { var select = document.getElementById(id_select + field); if( select.value != '' ) insertbbcode('[' + select.value + ']', '[/' + select.value + ']', field); //On remet la valeur par défaut. select.options[0].selected = true; return; } //Conserve la configuration de la barre bbcode. function set_bbcode_preference(divID) { if( getCookie('hide-bbcode') == 0 ) { jQuery('#bbcode-expanded').removeClass('expand'); jQuery( "." + divID).each(function(){ jQuery( "." + divID).hide(); }); } } //Masquage du div. function show_bbcode_div(divID) { if( getCookie('hide-bbcode') == 0 ) { jQuery('#bbcode-expanded').addClass('expand'); sendCookie('hide-bbcode', 1); //On envoi le cookie pour se souvenir du choix de l'utilisateur. jQuery( "." + divID).each(function(){ jQuery( "." + divID).fadeIn(300); }); } else { jQuery( "." + divID).each(function(){ jQuery( "." + divID).fadeOut(300); }); jQuery('#bbcode-expanded').removeClass('expand'); sendCookie('hide-bbcode', 0); //On envoi le cookie pour se souvenir du choix de l'utilisateur. } } function bbcode_color(divID, field, type) { var i; var br; var contents; var color = new Array( '#000000', '#433026', '#333300', '#003300', '#003366', '#000080', '#333399', '#333333', '#800000', '#FFA500', '#808000', '#008000', '#008080', '#0000FF', '#666699', '#808080', '#F04343', '#FF9900', '#99CC00', '#339966', '#33CCCC', '#3366FF', '#800080', '#ACA899', '#FFC0CB', '#FFCC00', '#FFFF00', '#00FF00', '#00FFFF', '#00CCFF', '#993366', '#C0C0C0', '#FF99CC', '#FFCC99', '#FFFF99', '#CCFFCC', '#CCFFFF', '#CC99FF', '#E3007B', '#FFFFFF'); contents = '<table><tr>'; for(i = 0; i < 40; i++) { br = (i+1) % 8; br = (br == 0 && i != 0 && i < 39) ? '</tr><tr>' : ''; contents += '<td><a href="" style="background:' + color[i] + ';" onclick="insertbbcode(\'[' + type + '=' + color[i] + ']\', \'[/' + type + ']\', \'' + field + '\');bb_hide_block(\'' + divID + '\', \'' + field + '\', 0);return false;"></a></td>' + br; } document.getElementById("bb-"+ type + field).innerHTML = contents + '</tr></table>'; } function bbcode_table(field, head_name) { var cols = document.getElementById('bb-cols' + field).value; var lines = document.getElementById('bb-lines' + field).value; var head = document.getElementById('bb-head' + field).checked; var code = ''; if( cols >= 0 && lines >= 0 ) { var colspan = cols > 1 ? ' colspan="' + cols + '"' : ''; var pointor = head ? (59 + colspan.length) : 22; code = head ? '[table]\n\t[row]\n\t\t[head' + colspan + ']'+ head_name +'[/head]\n\t[/row]\n' : '[table]\n'; for(var i = 0; i < lines; i++) { code += '\t[row]\n'; for(var j = 0; j < cols; j++) code += '\t\t[col][/col]\n'; code += '\t[/row]\n'; } code += '[/table]'; insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field); } } function bbcode_list(field) { var elements = document.getElementById('bb_list' + field).value; var ordered_list = document.getElementById('bb_ordered_list' + field).checked; if( elements <= 0 ) elements = 1; var pointor = ordered_list ? 19 : 11; code = '[list' + (ordered_list ? '=ordered' : '') + ']\n'; for(var j = 0; j < elements; j++) code += '\t[*]\n'; code += '[/list]'; insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field); } function bbcode_url(field, prompt_text) { var url = prompt(prompt_text, ''); if(url != '' && url != null) insertbbcode('[url=' + url + ']', '[/url]', field); } function bbcode_lightbox(field, prompt_text) { var url = prompt(prompt_text, ''); if(url != '' && url != null) insertbbcode('[lightbox=' + url + '][img style="max-width: 150px;"]' + url, '[/img][/lightbox]', field); } function bbcode_anchor(field, prompt_text) { var anchor = prompt(prompt_text, ''); if(anchor != '' && anchor != null) insertbbcode('[anchor=' + url_encode_rewrite(anchor) + ']', '[/anchor]', field); else insertbbcode('[anchor]', '[/anchor]', field); } function bbcode_abbr(field, prompt_text) { var desc = prompt(prompt_text, ''); if(desc != '' && desc != null) insertbbcode('[abbr=' + desc + ']', '[/abbr]', field); else insertbbcode('[abbr]', '[/abbr]', field); } function bbcode_acronym(field, prompt_text) { var desc = prompt(prompt_text, ''); if(desc != '' && desc != null) insertbbcode('[acronym=' + desc + ']', '[/acronym]', field); else insertbbcode('[acronym]', '[/acronym]', field); } function bbcode_fieldset(field, prompt_text) { var legend = prompt(prompt_text, ''); if(legend != '' && legend != null) insertbbcode('[fieldset legend="' + legend + '"]', '[/fieldset]', field); else insertbbcode('[fieldset]', '[/fieldset]', field); } function bbcode_mail(field, prompt_text) { var mail = prompt(prompt_text, ''); if(mail != '' && mail != null) insertbbcode('[mail=' + mail + ']', '[/mail]', field); } function bbcode_feed(field, prompt_text) { var feed = prompt(prompt_text, ''); if(feed != '' && feed != null) insertbbcode('[feed cat="0" number="5"]' + feed.toLowerCase(), '[/feed]', field); }
Texto modificado
Abrir archivo
/** * @copyright © 2005-2019 PHPBoost * @license https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0 * @author Regis VIARRE <crowkait@phpboost.com> * @version PHPBoost 5.2 - last update: 2018 11 18 * @since PHPBoost 1.2 - 2005 08 01 * @contributor Julien BRISWALTER <j1.seth@phpboost.com> * @contributor Arnaud GENET <elenwii@phpboost.com> * @contributor Sebastien LARTIGUE <babsolune@phpboost.com> */ function textarea_resize(id, px, type) { var textarea = document.getElementById(id); if( type == 'height' ) { var current_height = parseInt(textarea.style.height) ? parseInt(textarea.style.height) : 300; var new_height = current_height + px; if( new_height > 40 ) textarea.style.height = new_height + "px"; } else { var current_width = parseInt(textarea.style.width) ? parseInt(textarea.style.width) : 150; var new_width = current_width + px; if( new_width > 40 ) textarea.style.width = new_width + "px"; } return false; } //Insertion dans le champs. function simple_insert(open_balise, close_balise, field) { var textarea = document.getElementById(field); var scroll = textarea.scrollTop; if( close_balise != "" && close_balise != "smile" ) textarea.value += '[' + open_balise + '][/' + close_balise + ']'; else if( close_balise == "smile" ) textarea.value += ' ' + open_balise + ' '; textarea.focus(); textarea.scrollTop = scroll; return; } //Récupération de la sélection sur netscape, ajout des balises autour. function netscape_sel(target, open_balise, close_balise) { var sel_length = target.textLength; var sel_start = target.selectionStart; var sel_end = target.selectionEnd; var scroll = target.scrollTop; //Position verticale. if( sel_end == 1 || sel_end == 2 ) { sel_end = sel_length; } var string_start = (target.value).substring(0, sel_start); var selection = (target.value).substring(sel_start, sel_end); var string_end = (target.value).substring(sel_end, sel_length); if( close_balise != "" && selection == "" && close_balise != "smile" ) { target.value = string_start + open_balise + close_balise + string_end; target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length); target.focus(); } else if( close_balise == "smile" ) { target.value = string_start + selection + ' ' + open_balise + ' ' + string_end; target.setSelectionRange(string_start.length + open_balise.length + 2, target.value.length - string_end.length); target.focus(); } else { target.value = string_start + open_balise + selection + close_balise + string_end; target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length); target.focus(); } target.scrollTop = scroll; //Remet à la bonne position le textarea. return; } //Récupération de la sélection sur IE, ajout des balises autour. function ie_sel(target, open_balise, close_balise) { selText = false; var scroll = target.scrollTop; //Position verticale. selection = document.selection.createRange().text; // Sélection if( close_balise != "" && selection == "" && close_balise != "smile" ) document.selection.createRange().text = open_balise + close_balise; else if( close_balise == "smile" ) document.selection.createRange().text = selection + open_balise + ' '; else document.selection.createRange().text = open_balise + selection + close_balise; target.scrollTop = scroll; //Remet à la bonne position le textarea. selText = ''; return; } //Fonction de remplacement des caractères spéciaux function url_encode_rewrite(link_name) { link_name = link_name.toLowerCase(link_name); var chars_special = new Array(/ /g, /é/g, /è/g, /ê/g, /à/g, /â/g, /ù/g, /ü/g, /û/g, /ï/g, /î/g, /ô/g, /ç/g); var chars_replace = new Array("-", "e", "e", "e", "a", "a", "u", "u", "u", "i", "i", "o", "c"); var nbr_chars = chars_special.length; for( var i = 0; i < nbr_chars; i++) { link_name = link_name.replace(chars_special[i], chars_replace[i]); } link_name = link_name.replace(/([^a-z0-9]|[\s])/g, '-'); link_name = link_name.replace(/([-]{2,})/g, '-'); return link_name.replace(/(^\s*)|(\s*$)/g,'').replace(/(^-)|(-$)/g,''); } //Fonction d'insertion du BBcode dans le champs, tient compte du navigateur utilisé. function insertbbcode(open_balise, close_balise, field) { var area = document.getElementById(field); var nav = navigator.appName; //Recupère le nom du navigateur area.focus(); if( nav == 'Microsoft Internet Explorer' ) // Internet Explorer ie_sel(area, open_balise, close_balise); else if( nav == 'Netscape' || nav == 'Opera' ) //Netscape ou opera netscape_sel(area, open_balise, close_balise); else //insertion normale (autres navigateurs) simple_insert(open_balise, close_balise, field); return; } //Insertion dans le champs des codes de type select. function insertbbcode_select(id_select, close_balise, field) { var select = document.getElementById(id_select + field); if( select.value != '' ) insertbbcode('[' + id_select + '=' + select.value + ']', close_balise, field); //On remet la valeur par défaut. select.options[0].selected = true; return; } //Insertion dans le champs des codes de type select. function insertbbcode_select2(id_select, field) { var select = document.getElementById(id_select + field); if( select.value != '' ) insertbbcode('[' + select.value + ']', '[/' + select.value + ']', field); //On remet la valeur par défaut. select.options[0].selected = true; return; } //Conserve la configuration de la barre bbcode. function set_bbcode_preference(divID) { if( getCookie('hide-bbcode') == 0 ) { jQuery('#bbcode-expanded').removeClass('expand'); jQuery( "." + divID).each(function(){ jQuery( "." + divID).hide(); }); } } //Masquage du div. function show_bbcode_div(divID) { if( getCookie('hide-bbcode') == 0 ) { jQuery('#bbcode-expanded').addClass('expand'); sendCookie('hide-bbcode', 1); //On envoi le cookie pour se souvenir du choix de l'utilisateur. jQuery( "." + divID).each(function(){ jQuery( "." + divID).fadeIn(300); }); } else { jQuery( "." + divID).each(function(){ jQuery( "." + divID).fadeOut(300); }); jQuery('#bbcode-expanded').removeClass('expand'); sendCookie('hide-bbcode', 0); //On envoi le cookie pour se souvenir du choix de l'utilisateur. } } function bbcode_color(divID, field, type) { var i; var br; var contents; var color = new Array( '#000000', '#433026', '#333300', '#003300', '#003366', '#000080', '#333399', '#333333', '#800000', '#FFA500', '#808000', '#008000', '#008080', '#0000FF', '#666699', '#808080', '#F04343', '#FF9900', '#99CC00', '#339966', '#33CCCC', '#3366FF', '#800080', '#ACA899', '#FFC0CB', '#FFCC00', '#FFFF00', '#00FF00', '#00FFFF', '#00CCFF', '#993366', '#C0C0C0', '#FF99CC', '#FFCC99', '#FFFF99', '#CCFFCC', '#CCFFFF', '#CC99FF', '#E3007B', '#FFFFFF'); contents = '<table><tr>'; for(i = 0; i < 40; i++) { br = (i+1) % 8; br = (br == 0 && i != 0 && i < 39) ? '</tr><tr>' : ''; contents += '<td><a href="" aria-label="' + color[i] + '" title="' + color[i] + '" style="background-color:' + color[i] + ';" onclick="insertbbcode(\'[' + type + '=' + color[i] + ']\', \'[/' + type + ']\', \'' + field + '\');bb_hide_block(\'' + divID + '\', \'' + field + '\', 0);return false;"></a></td>' + br; } document.getElementById("bb-"+ type + field).innerHTML = contents + '</tr></table>'; } function bbcode_table(field, head_name) { var cols = document.getElementById('bb-cols' + field).value; var lines = document.getElementById('bb-lines' + field).value; var head = document.getElementById('bb-head' + field).checked; var code = ''; if( cols >= 0 && lines >= 0 ) { var colspan = cols > 1 ? ' colspan="' + cols + '"' : ''; var pointor = head ? (59 + colspan.length) : 22; code = head ? '[table]\n\t[row]\n\t\t[head' + colspan + ']'+ head_name +'[/head]\n\t[/row]\n' : '[table]\n'; for(var i = 0; i < lines; i++) { code += '\t[row]\n'; for(var j = 0; j < cols; j++) code += '\t\t[col][/col]\n'; code += '\t[/row]\n'; } code += '[/table]'; insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field); } } function bbcode_list(field) { var elements = document.getElementById('bb_list' + field).value; var ordered_list = document.getElementById('bb_ordered_list' + field).checked; if( elements <= 0 ) elements = 1; var pointor = ordered_list ? 19 : 11; code = '[list' + (ordered_list ? '=ordered' : '') + ']\n'; for(var j = 0; j < elements; j++) code += '\t[*]\n'; code += '[/list]'; insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field); } function bbcode_url(field, prompt_text) { var url = prompt(prompt_text, ''); if(url != '' && url != null) insertbbcode('[url=' + url + ']', '[/url]', field); } function bbcode_quote(field, prompt_text) { var author = prompt(prompt_text, ''); if(author != null) { if(author != '') insertbbcode('[quote=' + author + ']', '[/quote]', field); else insertbbcode('[quote]', '[/quote]', field); } } function bbcode_lightbox(field, prompt_text) { var url = prompt(prompt_text, ''); if(url != '' && url != null) insertbbcode('[lightbox=' + url + '][img style="max-width: 150px;"]' + url, '[/img][/lightbox]', field); } function bbcode_anchor(field, prompt_text) { var anchor = prompt(prompt_text, ''); if(anchor != '' && anchor != null) insertbbcode('[anchor=' + url_encode_rewrite(anchor) + ']', '[/anchor]', field); else insertbbcode('[anchor]', '[/anchor]', field); } function bbcode_abbr(field, prompt_text) { var desc = prompt(prompt_text, ''); if(desc != '' && desc != null) insertbbcode('[abbr=' + desc + ']', '[/abbr]', field); else insertbbcode('[abbr]', '[/abbr]', field); } function bbcode_acronym(field, prompt_text) { var desc = prompt(prompt_text, ''); if(desc != '' && desc != null) insertbbcode('[acronym=' + desc + ']', '[/acronym]', field); else insertbbcode('[acronym]', '[/acronym]', field); } function bbcode_fieldset(field, prompt_text) { var legend = prompt(prompt_text, ''); if(legend != '' && legend != null) insertbbcode('[fieldset legend="' + legend + '"]', '[/fieldset]', field); else insertbbcode('[fieldset]', '[/fieldset]', field); } function bbcode_mail(field, prompt_text) { var mail = prompt(prompt_text, ''); if(mail != '' && mail != null) insertbbcode('[mail=' + mail + ']', '[/mail]', field); } function bbcode_feed(field, prompt_text) { var feed = prompt(prompt_text, ''); if(feed != '' && feed != null) insertbbcode('[feed cat="0" number="5"]' + feed.toLowerCase(), '[/feed]', field); }
Encontrar la diferencia