by Ange Tuteur August 2nd 2014, 2:15 pm
Hi,
I made it a bit more simple to have multiple upload buttons, so delete both your scripts and create a script for the following code :
Title : your choice
Placement : in all the pages
- Code:
$(function(){$(function(){
newHost('imageUpload', 'http://lemon-13.com/up.png', 'http://lemon-13.com/upload-Center', '250px', '500px');
newHost('musicUpload', 'http://lemon-13.com/mu.jpg', 'http://lemon-13.com/m%20up/index.html', '400px', '600px');
function newHost(name, image, upload, height, width) {
$('.sceditor-button-servimg').after('<a class="sceditor-button sceditor-button-'+name+'"><div style="background-image:url('+image+')"></div></a>');
$('body').append('<div id="'+name+'_container" class="sceditor-dropdown" style="display:none;"></div>');
$('.sceditor-button-'+name+'').click(function() {
var X = $('.sceditor-button-'+name+'').offset().left;
var Y = $('.sceditor-button-'+name+'').offset().top + 25;
if (!document.getElementById(''+name+'_frame') && $('#'+name+'_container').css('display') == 'none') $('#'+name+'_container').show().css('left',X + 'px').css('top',Y + 'px').append('<iframe id="'+name+'_frame" style="border:none;height:'+height+';width:'+width+';" src="'+upload+'"></iframe>');
else if ($('#'+name+'_container').css('display') == 'none') $('#'+name+'_container').show().css('left',X + 'px').css('top',Y + 'px');
else $('#'+name+'_container').hide();
});
$('.sceditor-button:not(.sceditor-button-'+name+'), .sceditor-container textarea, .sceditor-container iframe').click(function() { $('#'+name+'_container').hide() });
$('.sceditor-container iframe').contents().mousedown(function() { $('#'+name+'_container').hide() });
$('.sceditor-button-source').click(function() { $('.sceditor-button-'+name+'').removeClass('disabled') });
}
})});
All you need to write is :
- Code:
newHost(name, image, upload, height, width)
In the following order :
name : the unique name of the button, it MUST NOT be the same as other host buttons.
image : the image of the button
upload : the url of the upload location
height : the height of the frame
width : the width of the frame
There's already two at the top to give an example. Hopefully this will work for you