mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
cleaned the dropdown code a lot
This commit is contained in:
parent
271ee1776b
commit
cbbb0a4ed1
2 changed files with 45 additions and 49 deletions
|
@ -3464,6 +3464,9 @@ function OUTER(gscope)
|
||||||
|
|
||||||
function handleClick(evt)
|
function handleClick(evt)
|
||||||
{
|
{
|
||||||
|
//hide the dropdowns
|
||||||
|
window.top.padeditbar.toogleDropDown("none");
|
||||||
|
|
||||||
inCallStack("handleClick", function()
|
inCallStack("handleClick", function()
|
||||||
{
|
{
|
||||||
idleWorkTimer.atMost(200);
|
idleWorkTimer.atMost(200);
|
||||||
|
|
|
@ -94,59 +94,17 @@ var padeditbar = (function()
|
||||||
{
|
{
|
||||||
if (self.isEnabled())
|
if (self.isEnabled())
|
||||||
{
|
{
|
||||||
if (cmd == 'showusers')
|
if(cmd == "showusers")
|
||||||
{
|
{
|
||||||
// show users shows the current users on teh pad
|
self.toogleDropDown("users");
|
||||||
// get current height
|
|
||||||
var editbarheight = $('#users').css('display');
|
|
||||||
if (editbarheight == "none")
|
|
||||||
{
|
|
||||||
// increase the size of the editbar
|
|
||||||
//$('#editbar').animate({height:'72px'});
|
|
||||||
//$('#editorcontainerbox').animate({top:'72px'});
|
|
||||||
$('#embed').slideUp("fast");
|
|
||||||
$('#users').slideDown("fast");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// increase the size of the editbar
|
|
||||||
//$('#editbar').animate({height:'36px'});
|
|
||||||
//$('#editorcontainerbox').animate({top:'36px'});
|
|
||||||
$('#users').slideUp("fast");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (cmd == 'embed')
|
else if (cmd == 'embed')
|
||||||
{
|
{
|
||||||
// embed shows the embed link
|
var padurl = document.location;
|
||||||
// get current height
|
$('#embed').html('<div id="embedcode">Embed code:<input id="embedinput" type="text" value="<iframe src="' + padurl + '" width=500 height=400>"</iframe></div>');
|
||||||
var editbarheight = $('#embed').css('display');
|
self.toogleDropDown("embed");
|
||||||
if (editbarheight == "none")
|
|
||||||
{
|
|
||||||
// increase the size of the editbar
|
|
||||||
//$('#editbar').animate({height:'72px'});
|
|
||||||
$('#editorcontainerbox').animate(
|
|
||||||
{
|
|
||||||
top: '72px'
|
|
||||||
});
|
|
||||||
// get the pad url
|
|
||||||
padurl = document.location;
|
|
||||||
// change the div contents to include the pad url in an input box
|
|
||||||
$('#embed').html('<div id="embedcode">Embed code:<input id="embedinput" type="text" value="<iframe src="' + padurl + '" width=500 height=400>"</iframe></div>');
|
|
||||||
$('#users').slideUp("fast");
|
|
||||||
$('#embed').slideDown("fast");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// increase the size of the editbar
|
|
||||||
//$('#editbar').animate({height:'36px'});
|
|
||||||
$('#editorcontainerbox').animate(
|
|
||||||
{
|
|
||||||
top: '36px'
|
|
||||||
});
|
|
||||||
$('#embed').hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (cmd == 'save')
|
else if (cmd == 'save')
|
||||||
{
|
{
|
||||||
padsavedrevs.saveNow();
|
padsavedrevs.saveNow();
|
||||||
}
|
}
|
||||||
|
@ -189,6 +147,41 @@ var padeditbar = (function()
|
||||||
}
|
}
|
||||||
padeditor.ace.focus();
|
padeditor.ace.focus();
|
||||||
},
|
},
|
||||||
|
toogleDropDown: function(moduleName)
|
||||||
|
{
|
||||||
|
var modules = ["embed", "users"];
|
||||||
|
|
||||||
|
//hide all modules
|
||||||
|
if(moduleName == "none")
|
||||||
|
{
|
||||||
|
for(var i=0;i<modules.length;i++)
|
||||||
|
{
|
||||||
|
var module = $("#" + modules[i]);
|
||||||
|
|
||||||
|
if(module.css('display') != "none")
|
||||||
|
{
|
||||||
|
module.slideUp("fast");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//hide all modules that are not selected and show the selected one
|
||||||
|
for(var i=0;i<modules.length;i++)
|
||||||
|
{
|
||||||
|
var module = $("#" + modules[i]);
|
||||||
|
|
||||||
|
if(module.css('display') != "none")
|
||||||
|
{
|
||||||
|
module.slideUp("fast");
|
||||||
|
}
|
||||||
|
else if(modules[i]==moduleName)
|
||||||
|
{
|
||||||
|
module.slideDown("fast");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
setSyncStatus: function(status)
|
setSyncStatus: function(status)
|
||||||
{
|
{
|
||||||
if (status == "syncing")
|
if (status == "syncing")
|
||||||
|
|
Loading…
Reference in a new issue