|
|
@@ -42,54 +42,7 @@ $(document).ready(function () { |
|
|
|
page_home_scroll(); |
|
|
|
}); |
|
|
|
|
|
|
|
// modal left paging |
|
|
|
$('#autodoc_home_modal_left').mouseenter(function (e) { |
|
|
|
$(e.target).fadeTo("slow", 0.8); |
|
|
|
}) |
|
|
|
.mouseleave(function (e) { |
|
|
|
$(e.target).fadeTo("slow", 0.15); |
|
|
|
}) |
|
|
|
.click(function (e) { |
|
|
|
home_modal_page_prev(); |
|
|
|
}); |
|
|
|
|
|
|
|
// modal right paging |
|
|
|
$('#autodoc_home_modal_right') |
|
|
|
.mouseenter(function (e) { |
|
|
|
$(e.target).fadeTo("slow", 0.8); |
|
|
|
}) |
|
|
|
.mouseleave(function (e) { |
|
|
|
$(e.target).fadeTo("slow", 0.15); |
|
|
|
}) |
|
|
|
.click(function (e) { |
|
|
|
home_modal_page_next(); |
|
|
|
}); |
|
|
|
|
|
|
|
// modal resize buttons events |
|
|
|
$('.autodoc_home_modal_size').click(function (e) { |
|
|
|
$('.autodoc_home_modal_size').removeClass("active"); |
|
|
|
$(e.target).addClass("active"); |
|
|
|
home_modal_resize($(e.target).html()); |
|
|
|
}); |
|
|
|
|
|
|
|
// click to rename page in modal |
|
|
|
$('span.autodoc_home_modal_name').click(function (e) { |
|
|
|
$(e.target).addClass('d-none'); |
|
|
|
$('input.autodoc_home_modal_name').removeClass('d-none'); |
|
|
|
}); |
|
|
|
|
|
|
|
// [enter] event of modal name edit |
|
|
|
$('input.autodoc_home_modal_name').change(function (e) { |
|
|
|
var docid = $('#autodoc_home_modal').data('documentid'); |
|
|
|
document_update_name(docid, $(e.target).val(), docid); |
|
|
|
}); |
|
|
|
|
|
|
|
// modal show typeahead |
|
|
|
$('.autodoc_home_modal_tags_show').click(function (e) { |
|
|
|
$('.autodoc_home_modal_tags_show').addClass('d-none'); |
|
|
|
$('.autodoc_home_modal_tags_add').removeClass('d-none'); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// document page |
|
|
|
// make primary button |
|
|
|
$('.autodoc_document_btn_primary').click(function(e) { |
|
|
@@ -356,11 +309,15 @@ function page_load_tags() { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function document_load() { |
|
|
|
function document_load(filter) { |
|
|
|
if (conf.home.curpage == 0) { |
|
|
|
$("#autodoc_home_body").html(""); |
|
|
|
} |
|
|
|
|
|
|
|
if ( ! filter ) { |
|
|
|
filter = ''; |
|
|
|
} |
|
|
|
|
|
|
|
var tmpl = $("#autodoc_template_home"); |
|
|
|
var row = $(tmpl) |
|
|
|
.find(".autodoc_template_home_row") |
|
|
@@ -372,7 +329,9 @@ function document_load() { |
|
|
|
"/documents?pageSize=" + |
|
|
|
conf.home.width + |
|
|
|
"&pageIndex=" + |
|
|
|
conf.home.curpage, |
|
|
|
conf.home.curpage + |
|
|
|
"&filter=" + |
|
|
|
encodeURIComponent(filter), |
|
|
|
null, |
|
|
|
function (data, textStatus, jqXHR) { |
|
|
|
// last document was loaded, stop scrolling |
|
|
@@ -398,7 +357,6 @@ function document_load() { |
|
|
|
$(col).find(".autodoc_template_home_img").on('click', function (e) { |
|
|
|
window.location.hash = 'document_' + $(e.target).data("documentId"); |
|
|
|
e.preventDefault(); |
|
|
|
// home_modal_open($(e.target).data("documentId")); |
|
|
|
}); |
|
|
|
|
|
|
|
$(col) |
|
|
@@ -639,87 +597,6 @@ function upload_status() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function home_modal_page(pageNum) { |
|
|
|
var doc = $('#autodoc_home_modal').data('document'); |
|
|
|
var pageTotal = doc.pageId.length; |
|
|
|
|
|
|
|
if (pageNum < 0) { |
|
|
|
pageNum = pageTotal - 1; |
|
|
|
} |
|
|
|
|
|
|
|
if (pageNum > pageTotal - 1) { |
|
|
|
pageNum = 0; |
|
|
|
} |
|
|
|
|
|
|
|
$('.autodoc_home_modal_page').html(pageNum + 1); |
|
|
|
$('#autodoc_home_modal').data('pageNum', pageNum); |
|
|
|
|
|
|
|
$('#autodoc_home_modal_img').attr('src', |
|
|
|
conf.openapi + |
|
|
|
"/pages/" + |
|
|
|
doc.pageId[pageNum] + |
|
|
|
"/image"); |
|
|
|
} |
|
|
|
|
|
|
|
function home_modal_resize(size) { |
|
|
|
var newclass; |
|
|
|
|
|
|
|
$('#autodoc_home_modal').children().removeClass('modal-sm modal-lg modal-xl'); |
|
|
|
|
|
|
|
switch (size) { |
|
|
|
case "S": newclass = "modal-sm"; break; |
|
|
|
case "M": break; |
|
|
|
case "L": newclass = "modal-lg"; break; |
|
|
|
case "XL": newclass = "modal-xl"; break; |
|
|
|
} |
|
|
|
|
|
|
|
if (newclass) { |
|
|
|
$('#autodoc_home_modal').children().addClass(newclass); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function home_modal_page_prev() { |
|
|
|
home_modal_page( |
|
|
|
$('#autodoc_home_modal').data('pageNum') - 1); |
|
|
|
} |
|
|
|
|
|
|
|
function home_modal_page_next() { |
|
|
|
home_modal_page( |
|
|
|
$('#autodoc_home_modal').data('pageNum') + 1); |
|
|
|
} |
|
|
|
|
|
|
|
function home_modal_open(docid) { |
|
|
|
loader_icon_on(); |
|
|
|
$.getJSON(conf.openapi + "/documents/" + docid, function (data) { |
|
|
|
loader_icon_off(); |
|
|
|
$('#autodoc_home_modal').data('document', data); |
|
|
|
$('#autodoc_home_modal').data('documentid', docid); |
|
|
|
|
|
|
|
var pageNum; |
|
|
|
for (var i = 0; i < data.pageId.length; i++) { |
|
|
|
if (data.pageId[i] == data.primaryPage) { |
|
|
|
pageNum = i; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
$('span.autodoc_home_modal_name').html(data.name ? data.name : 'n/a'); |
|
|
|
$('input.autodoc_home_modal_name').val(data.name ? data.name : ''); |
|
|
|
$('.autodoc_home_modal_created').html(data.created); |
|
|
|
$('.autodoc_home_modal_languages').html(data.languages.join(' ')); |
|
|
|
$('.autodoc_home_modal_pages').html(data.pageId.length); |
|
|
|
$('.autodoc_home_modal_owner').html(data.owner); |
|
|
|
|
|
|
|
home_modal_page(pageNum); |
|
|
|
|
|
|
|
$('#autodoc_home_modal').modal('show'); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function home_modal_close(docid) { |
|
|
|
$('#autodoc_home_modal').modal('hide'); |
|
|
|
} |
|
|
|
|
|
|
|
function document_update_name(docid, name) { |
|
|
|
loader_icon_on(); |
|
|
|
$.ajax({ |
|
|
@@ -734,7 +611,6 @@ function document_update_name(docid, name) { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// handle ajax busy icon |
|
|
|
function loader_icon_on() { |
|
|
|
conf.busy++; |