Files
EasySoft-ZenTaoPMS/module/doc/js/create.js
2019-03-18 09:46:41 +08:00

71 lines
2.1 KiB
JavaScript

$(function()
{
toggleAcl($('[name=acl]').val(), 'doc');
setTimeout(function(){initPage(docType)}, 50);
$('input[name="type"]').change(function()
{
var type = $(this).val();
if(type == 'text')
{
$('#contentBox').removeClass('hidden');
$('#urlBox').addClass('hidden');
}
else if(type == 'url')
{
$('#contentBox').addClass('hidden');
$('#urlBox').removeClass('hidden');
}
});
if(typeof(window.editor) != 'undefined')
{
window.editor['content'].addListener('ready', function()
{
$('div#content .edui-toolbar').append("<div class='edui-box edui-button edui-for-markdown edui-default'><div class='edui-default' onmouseover='toggleHover(this)' onmouseout='toggleHover(this)'><div class='edui-button-wrap edui-default' style='padding-right:4px;padding-left:4px;'><div class='edui-default' onclick='toggleEditor(\"markdown\")' title='Markdown'>Markdown</div></div></div></div>");
});
}
})
function toggleHover(obj)
{
if($(obj).hasClass('edui-state-hover')) return $(obj).removeClass('edui-state-hover');
return $(obj).addClass('edui-state-hover');
}
function toggleEditor(type)
{
if(type == 'html')
{
$('.contenthtml').removeClass('hidden');
$('.contentmarkdown').addClass('hidden');
}
else if(type == 'markdown')
{
$('.contenthtml').addClass('hidden');
$('.contentmarkdown').removeClass('hidden');
}
$('#contentType').val(type);
}
function initPage(type)
{
if(type == 'html' || type == 'markdown')
{
if(type == 'markdown')
{
$('#contentBox .contentmarkdown').removeClass('hidden');
$('#contentBox .contenthtml').addClass('hidden');
$('#contentBox #contentType').val(type);
}
}
else if(type == 'url')
{
$('#contentBox').addClass('hidden');
$('#urlBox').removeClass('hidden');
}
if(type == 'word' || type == 'ppt' || type == 'excel')
{
if($('#contentBox')).hide();
if($('#urlBox')).hide();
}
}