-58 Removals
+56 Additions

Created by:phpboost

1/*################################################## 1/**
2 * bbcode.js 2 * @copyright © 2005-2019 PHPBoost
3 * ------------------- 3 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
4 * begin : August 01, 2005 4 * @author Regis VIARRE <crowkait@phpboost.com>
5 * copyright : (C) 2005 Viarre Régis 5 * @version PHPBoost 5.2 - last update: 2018 11 18
6 * email : crowkait@phpboost.com 6 * @since PHPBoost 1.2 - 2005 08 01
7 * 7 * @contributor Julien BRISWALTER <j1.seth@phpboost.com>
8 * 8 * @contributor Arnaud GENET <elenwii@phpboost.com>
9################################################### 9 * @contributor Sebastien LARTIGUE <babsolune@phpboost.com>
10 * 10*/
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 *
25###################################################*/
26 11
27function textarea_resize(id, px, type) 12function textarea_resize(id, px, type)
28{ 13{
29 var textarea = document.getElementById(id); 14 var textarea = document.getElementById(id);
30 if( type == 'height' ) 15 if( type == 'height' )
31 { 16 {
32 var current_height = parseInt(textarea.style.height) ? parseInt(textarea.style.height) : 300; 17 var current_height = parseInt(textarea.style.height) ? parseInt(textarea.style.height) : 300;
33 var new_height = current_height + px; 18 var new_height = current_height + px;
34 19
35 if( new_height > 40 ) 20 if( new_height > 40 )
36 textarea.style.height = new_height + "px"; 21 textarea.style.height = new_height + "px";
37 } 22 }
38 else 23 else
39 { 24 {
40 var current_width = parseInt(textarea.style.width) ? parseInt(textarea.style.width) : 150; 25 var current_width = parseInt(textarea.style.width) ? parseInt(textarea.style.width) : 150;
41 var new_width = current_width + px; 26 var new_width = current_width + px;
42 27
43 if( new_width > 40 ) 28 if( new_width > 40 )
44 textarea.style.width = new_width + "px"; 29 textarea.style.width = new_width + "px";
45 } 30 }
46 31
47 return false; 32 return false;
48} 33}
49 34
50//Insertion dans le champs. 35//Insertion dans le champs.
51function simple_insert(open_balise, close_balise, field) 36function simple_insert(open_balise, close_balise, field)
52{ 37{
53 var textarea = document.getElementById(field); 38 var textarea = document.getElementById(field);
54 var scroll = textarea.scrollTop; 39 var scroll = textarea.scrollTop;
55 40
56 if( close_balise != "" && close_balise != "smile" ) 41 if( close_balise != "" && close_balise != "smile" )
57 textarea.value += '[' + open_balise + '][/' + close_balise + ']'; 42 textarea.value += '[' + open_balise + '][/' + close_balise + ']';
58 else if( close_balise == "smile" ) 43 else if( close_balise == "smile" )
59 textarea.value += ' ' + open_balise + ' '; 44 textarea.value += ' ' + open_balise + ' ';
60 45
61 textarea.focus(); 46 textarea.focus();
62 textarea.scrollTop = scroll; 47 textarea.scrollTop = scroll;
63 return; 48 return;
64} 49}
65 50
66//Récupération de la sélection sur netscape, ajout des balises autour. 51//Récupération de la sélection sur netscape, ajout des balises autour.
67function netscape_sel(target, open_balise, close_balise) 52function netscape_sel(target, open_balise, close_balise)
68{ 53{
69 var sel_length = target.textLength; 54 var sel_length = target.textLength;
70 var sel_start = target.selectionStart; 55 var sel_start = target.selectionStart;
71 var sel_end = target.selectionEnd; 56 var sel_end = target.selectionEnd;
72 var scroll = target.scrollTop; //Position verticale. 57 var scroll = target.scrollTop; //Position verticale.
73 58
74 if( sel_end == 1 || sel_end == 2 ) 59 if( sel_end == 1 || sel_end == 2 )
75 { 60 {
76 sel_end = sel_length; 61 sel_end = sel_length;
77 } 62 }
78 63
79 var string_start = (target.value).substring(0, sel_start); 64 var string_start = (target.value).substring(0, sel_start);
80 var selection = (target.value).substring(sel_start, sel_end); 65 var selection = (target.value).substring(sel_start, sel_end);
81 var string_end = (target.value).substring(sel_end, sel_length); 66 var string_end = (target.value).substring(sel_end, sel_length);
82 67
83 if( close_balise != "" && selection == "" && close_balise != "smile" ) 68 if( close_balise != "" && selection == "" && close_balise != "smile" )
84 { 69 {
85 target.value = string_start + open_balise + close_balise + string_end; 70 target.value = string_start + open_balise + close_balise + string_end;
86 target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length); 71 target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length);
87 target.focus(); 72 target.focus();
88 } 73 }
89 else if( close_balise == "smile" ) 74 else if( close_balise == "smile" )
90 { 75 {
91 target.value = string_start + selection + ' ' + open_balise + ' ' + string_end; 76 target.value = string_start + selection + ' ' + open_balise + ' ' + string_end;
92 target.setSelectionRange(string_start.length + open_balise.length + 2, target.value.length - string_end.length); 77 target.setSelectionRange(string_start.length + open_balise.length + 2, target.value.length - string_end.length);
93 target.focus(); 78 target.focus();
94 } 79 }
95 else 80 else
96 { 81 {
97 target.value = string_start + open_balise + selection + close_balise + string_end; 82 target.value = string_start + open_balise + selection + close_balise + string_end;
98 target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length); 83 target.setSelectionRange(string_start.length + open_balise.length, target.value.length - string_end.length - close_balise.length);
99 target.focus(); 84 target.focus();
100 } 85 }
101 86
102 target.scrollTop = scroll; //Remet à la bonne position le textarea. 87 target.scrollTop = scroll; //Remet à la bonne position le textarea.
103 88
104 return; 89 return;
105} 90}
106 91
107//Récupération de la sélection sur IE, ajout des balises autour. 92//Récupération de la sélection sur IE, ajout des balises autour.
108function ie_sel(target, open_balise, close_balise) 93function ie_sel(target, open_balise, close_balise)
109{ 94{
110 selText = false; 95 selText = false;
111 var scroll = target.scrollTop; //Position verticale. 96 var scroll = target.scrollTop; //Position verticale.
112 97
113 selection = document.selection.createRange().text; // Sélection 98 selection = document.selection.createRange().text; // Sélection
114 99
115 if( close_balise != "" && selection == "" && close_balise != "smile" ) 100 if( close_balise != "" && selection == "" && close_balise != "smile" )
116 document.selection.createRange().text = open_balise + close_balise; 101 document.selection.createRange().text = open_balise + close_balise;
117 else if( close_balise == "smile" ) 102 else if( close_balise == "smile" )
118 document.selection.createRange().text = selection + open_balise + ' '; 103 document.selection.createRange().text = selection + open_balise + ' ';
119 else 104 else
120 document.selection.createRange().text = open_balise + selection + close_balise; 105 document.selection.createRange().text = open_balise + selection + close_balise;
121 106
122 target.scrollTop = scroll; //Remet à la bonne position le textarea. 107 target.scrollTop = scroll; //Remet à la bonne position le textarea.
123 selText = ''; 108 selText = '';
124 109
125 return; 110 return;
126} 111}
127 112
128//Fonction de remplacement des caractères spéciaux 113//Fonction de remplacement des caractères spéciaux
129function url_encode_rewrite(link_name) 114function url_encode_rewrite(link_name)
130{ 115{
131 link_name = link_name.toLowerCase(link_name); 116 link_name = link_name.toLowerCase(link_name);
132 117
133 var chars_special = new Array(/ /g, /é/g, /è/g, /ê/g, /à/g, /â/g, /ù/g, /ü/g, /û/g, /ï/g, /î/g, /ô/g, /ç/g); 118 var chars_special = new Array(/ /g, /é/g, /è/g, /ê/g, /à/g, /â/g, /ù/g, /ü/g, /û/g, /ï/g, /î/g, /ô/g, /ç/g);
134 var chars_replace = new Array("-", "e", "e", "e", "a", "a", "u", "u", "u", "i", "i", "o", "c"); 119 var chars_replace = new Array("-", "e", "e", "e", "a", "a", "u", "u", "u", "i", "i", "o", "c");
135 var nbr_chars = chars_special.length; 120 var nbr_chars = chars_special.length;
136 for( var i = 0; i < nbr_chars; i++) 121 for( var i = 0; i < nbr_chars; i++)
137 { 122 {
138 link_name = link_name.replace(chars_special[i], chars_replace[i]); 123 link_name = link_name.replace(chars_special[i], chars_replace[i]);
139 } 124 }
140 125
141 link_name = link_name.replace(/([^a-z0-9]|[\s])/g, '-'); 126 link_name = link_name.replace(/([^a-z0-9]|[\s])/g, '-');
142 link_name = link_name.replace(/([-]{2,})/g, '-'); 127 link_name = link_name.replace(/([-]{2,})/g, '-');
143 return link_name.replace(/(^\s*)|(\s*$)/g,'').replace(/(^-)|(-$)/g,''); 128 return link_name.replace(/(^\s*)|(\s*$)/g,'').replace(/(^-)|(-$)/g,'');
144} 129}
145 130
146//Fonction d'insertion du BBcode dans le champs, tient compte du navigateur utilisé. 131//Fonction d'insertion du BBcode dans le champs, tient compte du navigateur utilisé.
147function insertbbcode(open_balise, close_balise, field) 132function insertbbcode(open_balise, close_balise, field)
148{ 133{
149 var area = document.getElementById(field); 134 var area = document.getElementById(field);
150 var nav = navigator.appName; //Recupère le nom du navigateur 135 var nav = navigator.appName; //Recupère le nom du navigateur
151 136
152 area.focus(); 137 area.focus();
153 138
154 if( nav == 'Microsoft Internet Explorer' ) // Internet Explorer 139 if( nav == 'Microsoft Internet Explorer' ) // Internet Explorer
155 ie_sel(area, open_balise, close_balise); 140 ie_sel(area, open_balise, close_balise);
156 else if( nav == 'Netscape' || nav == 'Opera' ) //Netscape ou opera 141 else if( nav == 'Netscape' || nav == 'Opera' ) //Netscape ou opera
157 netscape_sel(area, open_balise, close_balise); 142 netscape_sel(area, open_balise, close_balise);
158 else //insertion normale (autres navigateurs) 143 else //insertion normale (autres navigateurs)
159 simple_insert(open_balise, close_balise, field); 144 simple_insert(open_balise, close_balise, field);
160 145
161 return; 146 return;
162} 147}
163 148
164//Insertion dans le champs des codes de type select. 149//Insertion dans le champs des codes de type select.
165function insertbbcode_select(id_select, close_balise, field) 150function insertbbcode_select(id_select, close_balise, field)
166{ 151{
167 var select = document.getElementById(id_select + field); 152 var select = document.getElementById(id_select + field);
168 153
169 if( select.value != '' ) 154 if( select.value != '' )
170 insertbbcode('[' + id_select + '=' + select.value + ']', close_balise, field); 155 insertbbcode('[' + id_select + '=' + select.value + ']', close_balise, field);
171 156
172 //On remet la valeur par défaut. 157 //On remet la valeur par défaut.
173 select.options[0].selected = true; 158 select.options[0].selected = true;
174 159
175 return; 160 return;
176} 161}
177 162
178//Insertion dans le champs des codes de type select. 163//Insertion dans le champs des codes de type select.
179function insertbbcode_select2(id_select, field) 164function insertbbcode_select2(id_select, field)
180{ 165{
181 var select = document.getElementById(id_select + field); 166 var select = document.getElementById(id_select + field);
182 167
183 if( select.value != '' ) 168 if( select.value != '' )
184 insertbbcode('[' + select.value + ']', '[/' + select.value + ']', field); 169 insertbbcode('[' + select.value + ']', '[/' + select.value + ']', field);
185 170
186 //On remet la valeur par défaut. 171 //On remet la valeur par défaut.
187 select.options[0].selected = true; 172 select.options[0].selected = true;
188 173
189 return; 174 return;
190} 175}
191 176
192//Conserve la configuration de la barre bbcode. 177//Conserve la configuration de la barre bbcode.
193function set_bbcode_preference(divID) 178function set_bbcode_preference(divID)
194{ 179{
195 if( getCookie('hide-bbcode') == 0 ) 180 if( getCookie('hide-bbcode') == 0 )
196 { 181 {
197 jQuery('#bbcode-expanded').removeClass('expand'); 182 jQuery('#bbcode-expanded').removeClass('expand');
198 jQuery( "." + divID).each(function(){ 183 jQuery( "." + divID).each(function(){
199 jQuery( "." + divID).hide(); 184 jQuery( "." + divID).hide();
200 }); 185 });
201 } 186 }
202} 187}
203 188
204//Masquage du div. 189//Masquage du div.
205function show_bbcode_div(divID) 190function show_bbcode_div(divID)
206{ 191{
207 if( getCookie('hide-bbcode') == 0 ) 192 if( getCookie('hide-bbcode') == 0 )
208 { 193 {
209 jQuery('#bbcode-expanded').addClass('expand'); 194 jQuery('#bbcode-expanded').addClass('expand');
210 sendCookie('hide-bbcode', 1); //On envoi le cookie pour se souvenir du choix de l'utilisateur. 195 sendCookie('hide-bbcode', 1); //On envoi le cookie pour se souvenir du choix de l'utilisateur.
211 jQuery( "." + divID).each(function(){ 196 jQuery( "." + divID).each(function(){
212 jQuery( "." + divID).fadeIn(300); 197 jQuery( "." + divID).fadeIn(300);
213 }); 198 });
214 } 199 }
215 else 200 else
216 { 201 {
217 jQuery( "." + divID).each(function(){ 202 jQuery( "." + divID).each(function(){
218 jQuery( "." + divID).fadeOut(300); 203 jQuery( "." + divID).fadeOut(300);
219 }); 204 });
220 jQuery('#bbcode-expanded').removeClass('expand'); 205 jQuery('#bbcode-expanded').removeClass('expand');
221 sendCookie('hide-bbcode', 0); //On envoi le cookie pour se souvenir du choix de l'utilisateur. 206 sendCookie('hide-bbcode', 0); //On envoi le cookie pour se souvenir du choix de l'utilisateur.
222 } 207 }
223} 208}
224 209
225function bbcode_color(divID, field, type) 210function bbcode_color(divID, field, type)
226{ 211{
227 var i; 212 var i;
228 var br; 213 var br;
229 var contents; 214 var contents;
230 var color = new Array( 215 var color = new Array(
231 '#000000', '#433026', '#333300', '#003300', '#003366', '#000080', '#333399', '#333333', 216 '#000000', '#433026', '#333300', '#003300', '#003366', '#000080', '#333399', '#333333',
232 '#800000', '#FFA500', '#808000', '#008000', '#008080', '#0000FF', '#666699', '#808080', 217 '#800000', '#FFA500', '#808000', '#008000', '#008080', '#0000FF', '#666699', '#808080',
233 '#F04343', '#FF9900', '#99CC00', '#339966', '#33CCCC', '#3366FF', '#800080', '#ACA899', 218 '#F04343', '#FF9900', '#99CC00', '#339966', '#33CCCC', '#3366FF', '#800080', '#ACA899',
234 '#FFC0CB', '#FFCC00', '#FFFF00', '#00FF00', '#00FFFF', '#00CCFF', '#993366', '#C0C0C0', 219 '#FFC0CB', '#FFCC00', '#FFFF00', '#00FF00', '#00FFFF', '#00CCFF', '#993366', '#C0C0C0',
235 '#FF99CC', '#FFCC99', '#FFFF99', '#CCFFCC', '#CCFFFF', '#CC99FF', '#E3007B', '#FFFFFF'); 220 '#FF99CC', '#FFCC99', '#FFFF99', '#CCFFCC', '#CCFFFF', '#CC99FF', '#E3007B', '#FFFFFF');
236 221
237 contents = '<table><tr>'; 222 contents = '<table><tr>';
238 for(i = 0; i < 40; i++) 223 for(i = 0; i < 40; i++)
239 { 224 {
240 br = (i+1) % 8; 225 br = (i+1) % 8;
241 br = (br == 0 && i != 0 && i < 39) ? '</tr><tr>' : ''; 226 br = (br == 0 && i != 0 && i < 39) ? '</tr><tr>' : '';
242 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; 227 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;
243 } 228 }
244 document.getElementById("bb-"+ type + field).innerHTML = contents + '</tr></table>'; 229 document.getElementById("bb-"+ type + field).innerHTML = contents + '</tr></table>';
245} 230}
246 231
247function bbcode_table(field, head_name) 232function bbcode_table(field, head_name)
248{ 233{
249 var cols = document.getElementById('bb-cols' + field).value; 234 var cols = document.getElementById('bb-cols' + field).value;
250 var lines = document.getElementById('bb-lines' + field).value; 235 var lines = document.getElementById('bb-lines' + field).value;
251 var head = document.getElementById('bb-head' + field).checked; 236 var head = document.getElementById('bb-head' + field).checked;
252 var code = ''; 237 var code = '';
253 238
254 if( cols >= 0 && lines >= 0 ) 239 if( cols >= 0 && lines >= 0 )
255 { 240 {
256 var colspan = cols > 1 ? ' colspan="' + cols + '"' : ''; 241 var colspan = cols > 1 ? ' colspan="' + cols + '"' : '';
257 var pointor = head ? (59 + colspan.length) : 22; 242 var pointor = head ? (59 + colspan.length) : 22;
258 code = head ? '[table]\n\t[row]\n\t\t[head' + colspan + ']'+ head_name +'[/head]\n\t[/row]\n' : '[table]\n'; 243 code = head ? '[table]\n\t[row]\n\t\t[head' + colspan + ']'+ head_name +'[/head]\n\t[/row]\n' : '[table]\n';
259 244
260 for(var i = 0; i < lines; i++) 245 for(var i = 0; i < lines; i++)
261 { 246 {
262 code += '\t[row]\n'; 247 code += '\t[row]\n';
263 for(var j = 0; j < cols; j++) 248 for(var j = 0; j < cols; j++)
264 code += '\t\t[col][/col]\n'; 249 code += '\t\t[col][/col]\n';
265 code += '\t[/row]\n'; 250 code += '\t[/row]\n';
266 } 251 }
267 code += '[/table]'; 252 code += '[/table]';
268 253
269 insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field); 254 insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field);
270 } 255 }
271} 256}
272 257
273function bbcode_list(field) 258function bbcode_list(field)
274{ 259{
275 var elements = document.getElementById('bb_list' + field).value; 260 var elements = document.getElementById('bb_list' + field).value;
276 var ordered_list = document.getElementById('bb_ordered_list' + field).checked; 261 var ordered_list = document.getElementById('bb_ordered_list' + field).checked;
277 if( elements <= 0 ) 262 if( elements <= 0 )
278 elements = 1; 263 elements = 1;
279 264
280 var pointor = ordered_list ? 19 : 11; 265 var pointor = ordered_list ? 19 : 11;
281 266
282 code = '[list' + (ordered_list ? '=ordered' : '') + ']\n'; 267 code = '[list' + (ordered_list ? '=ordered' : '') + ']\n';
283 for(var j = 0; j < elements; j++) 268 for(var j = 0; j < elements; j++)
284 code += '\t[*]\n'; 269 code += '\t[*]\n';
285 code += '[/list]'; 270 code += '[/list]';
286 insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field); 271 insertbbcode(code.substring(0, pointor), code.substring(pointor, code.length), field);
287} 272}
288 273
289function bbcode_url(field, prompt_text) 274function bbcode_url(field, prompt_text)
290{ 275{
291 var url = prompt(prompt_text, ''); 276 var url = prompt(prompt_text, '');
292 if(url != '' && url != null) 277 if(url != '' && url != null)
293 insertbbcode('[url=' + url + ']', '[/url]', field); 278 insertbbcode('[url=' + url + ']', '[/url]', field);
294} 279}
295 280
281function bbcode_quote(field, prompt_text)
282{
283 var author = prompt(prompt_text, '');
284 if(author != null)
285 {
286 if(author != '')
287 insertbbcode('[quote=' + author + ']', '[/quote]', field);
288 else
289 insertbbcode('[quote]', '[/quote]', field);
290 }
291}
292
296function bbcode_lightbox(field, prompt_text) 293function bbcode_lightbox(field, prompt_text)
297{ 294{
298 var url = prompt(prompt_text, ''); 295 var url = prompt(prompt_text, '');
299 if(url != '' && url != null) 296 if(url != '' && url != null)
300 insertbbcode('[lightbox=' + url + '][img style="max-width: 150px;"]' + url, '[/img][/lightbox]', field); 297 insertbbcode('[lightbox=' + url + '][img style="max-width: 150px;"]' + url, '[/img][/lightbox]', field);
301} 298}
302 299
303function bbcode_anchor(field, prompt_text) 300function bbcode_anchor(field, prompt_text)
304{ 301{
305 var anchor = prompt(prompt_text, ''); 302 var anchor = prompt(prompt_text, '');
306 if(anchor != '' && anchor != null) 303 if(anchor != '' && anchor != null)
307 insertbbcode('[anchor=' + url_encode_rewrite(anchor) + ']', '[/anchor]', field); 304 insertbbcode('[anchor=' + url_encode_rewrite(anchor) + ']', '[/anchor]', field);
308 else 305 else
309 insertbbcode('[anchor]', '[/anchor]', field); 306 insertbbcode('[anchor]', '[/anchor]', field);
310} 307}
311 308
312function bbcode_abbr(field, prompt_text) 309function bbcode_abbr(field, prompt_text)
313{ 310{
314 var desc = prompt(prompt_text, ''); 311 var desc = prompt(prompt_text, '');
315 if(desc != '' && desc != null) 312 if(desc != '' && desc != null)
316 insertbbcode('[abbr=' + desc + ']', '[/abbr]', field); 313 insertbbcode('[abbr=' + desc + ']', '[/abbr]', field);
317 else 314 else
318 insertbbcode('[abbr]', '[/abbr]', field); 315 insertbbcode('[abbr]', '[/abbr]', field);
319} 316}
320 317
321function bbcode_acronym(field, prompt_text) 318function bbcode_acronym(field, prompt_text)
322{ 319{
323 var desc = prompt(prompt_text, ''); 320 var desc = prompt(prompt_text, '');
324 if(desc != '' && desc != null) 321 if(desc != '' && desc != null)
325 insertbbcode('[acronym=' + desc + ']', '[/acronym]', field); 322 insertbbcode('[acronym=' + desc + ']', '[/acronym]', field);
326 else 323 else
327 insertbbcode('[acronym]', '[/acronym]', field); 324 insertbbcode('[acronym]', '[/acronym]', field);
328} 325}
329 326
330function bbcode_fieldset(field, prompt_text) 327function bbcode_fieldset(field, prompt_text)
331{ 328{
332 var legend = prompt(prompt_text, ''); 329 var legend = prompt(prompt_text, '');
333 if(legend != '' && legend != null) 330 if(legend != '' && legend != null)
334 insertbbcode('[fieldset legend="' + legend + '"]', '[/fieldset]', field); 331 insertbbcode('[fieldset legend="' + legend + '"]', '[/fieldset]', field);
335 else 332 else
336 insertbbcode('[fieldset]', '[/fieldset]', field); 333 insertbbcode('[fieldset]', '[/fieldset]', field);
337} 334}
338 335
339function bbcode_mail(field, prompt_text) 336function bbcode_mail(field, prompt_text)
340{ 337{
341 var mail = prompt(prompt_text, ''); 338 var mail = prompt(prompt_text, '');
342 if(mail != '' && mail != null) 339 if(mail != '' && mail != null)
343 insertbbcode('[mail=' + mail + ']', '[/mail]', field); 340 insertbbcode('[mail=' + mail + ']', '[/mail]', field);
344} 341}
345 342
346function bbcode_feed(field, prompt_text) 343function bbcode_feed(field, prompt_text)
347{ 344{
348 var feed = prompt(prompt_text, ''); 345 var feed = prompt(prompt_text, '');
349 if(feed != '' && feed != null) 346 if(feed != '' && feed != null)
350 insertbbcode('[feed cat="0" number="5"]' + feed.toLowerCase(), '[/feed]', field); 347 insertbbcode('[feed cat="0" number="5"]' + feed.toLowerCase(), '[/feed]', field);
351} 348}
Editor
Original Text
Changed Text
Recommended videos