Hi !!! First of all want to say Thanx a million for a very nice Forum software !!! Justin - well done !!! I got use to vBulletin forum and I find inserting Links and Images with Prompt pop-up window is much more comfortable rather then here. I use E-Blah Forum Software 10.3.5 (still not sure about updating it ... will wait for the next release  ) and I have spent couple of hours to modify bc.js file a bit. Now inserting links looks like that:   Here is modifications I made, in case if someone want to have it in this way also or maybe for Justin to review my code and insert it to the next release  Modified function use
|
Code
function use(u,c)
{
if (!u) u= '';
if (!c) c= '';
if(u == '[url]' && c =='[/url]') { use_url(); return; } // New
if(u == '[img]' && c =='[/img]') { use_img(); return; } // New
var bb_obj= document.forms['post'].message; /*document.getElementById('message');*/
bb_obj.focus();
...
...
|
|
and 2 new functions added to bc.js
|
Code
function use_url()
{
var u;
var c;
var bb_obj= document.forms['post'].message; /*document.getElementById('message');*/
bb_obj.focus();
if (typeof document.selection!= 'undefined')
{
u = prompt("Enter URL for this link", "http://");
var r= document.selection.createRange();
if (typeof u != 'undefined' && u!= 'http://')
{
var iT= r.text;
if (iT.length == 0)
{
c = prompt("Enter Name for this link", "");
if (typeof c == 'undefined') c = 'Link';
r.text= '[u][url='+ u +']'+ c+ '[/url][/u]';
}
else r.text= '[u][url='+ u +']'+ iT+ '[/url][/u]';
//if (iT.length!= 0) r.moveStart('character', bb_obj, iT.length);
}
r.select();
}
else if (bb_obj.selectionStart || bb_obj.selectionStart == '0')
{
u = prompt("Enter URL for this link", "http://");
if (typeof u != 'undefined' && u!= 'http://')
{
c = prompt("Enter Name for this link", "");
if (typeof c == 'undefined') c = 'Link';
var ia= bb_obj.selectionStart, iz= bb_obj.selectionEnd;
var iT= bb_obj.value.substring(ia, iz);
//bb_obj.value= bb_obj.value.substr(0,ia)+ '[u][URL='+ u +']'+ iT+ '[/URL][/u]'+ bb_obj.value.substr(iz);
bb_obj.value= bb_obj.value.substr(0,ia)+ '[u][url='+ u +']'+ c+ '[/url][/u]'+ bb_obj.value.substr(iz);
var p= ia+ u.length+ iT.length+ c.length;
bb_obj.focus();
bb_obj.selectionStart= p;
bb_obj.selectionEnd= p;
bb_obj.focus();
}
}
else
{
u = prompt("Enter URL for this link", "http://");
if (typeof u != 'undefined' && u!= 'http://')
{
c = prompt("Enter Name for this link", "");
bb_obj.value += '[u][url='+ u +']'+ c+ '[/url][/u]';
}
bb_obj.focus();
}
}
function use_img()
{
var u;
var c;
var bb_obj= document.forms['post'].message; /*document.getElementById('message');*/
bb_obj.focus();
if (typeof document.selection!= 'undefined')
{
var r= document.selection.createRange();
var iT= r.text;
if (iT.length == 0)
{
c = prompt("Enter URL for this Image", "http://");
if (typeof c != 'undefined' && c!= 'http://') r.text= '[img]'+ c+ '[/img]';
}
else r.text= '[img]'+ iT+ '[/img]';
//if (iT.length!= 0) r.moveStart('character', bb_obj, iT.length);
r.select();
}
else if (bb_obj.selectionStart || bb_obj.selectionStart == '0')
{
c = prompt("Enter URL for this Image", "http://");
var ia= bb_obj.selectionStart, iz= bb_obj.selectionEnd;
var iT= bb_obj.value.substring(ia, iz);
//bb_obj.value= bb_obj.value.substr(0,ia)+ '[u][URL='+ u +']'+ iT+ '[/URL][/u]'+ bb_obj.value.substr(iz);
if (c!= 'undefined')
{
bb_obj.value= bb_obj.value.substr(0,ia)+ '[img]'+ c+ '[/img]'+ bb_obj.value.substr(iz);
var p= ia+ u.length+ iT.length+ c.length;
bb_obj.focus();
bb_obj.selectionStart= p;
bb_obj.selectionEnd= p;
}
bb_obj.focus();
}
else
{
c = prompt("Enter URL for this Image", "http://");
if (c!= 'undefined') bb_obj.value += '[img]'+ c+ '[/img]';
bb_obj.focus();
}
}
|
|
Hope that will be helpful for someone !!!  |