Browse Source

yeah

master
Pascal Gloor 5 years ago
parent
commit
763726df5c
1 changed files with 15 additions and 11 deletions
  1. 15
    11
      www/js/autodoc.js

+ 15
- 11
www/js/autodoc.js View File

}); });


// modal show typeahead // modal show typeahead
$('.autodoc_home_modal_tags_show').click(function(e) {
$('.autodoc_home_modal_tags_show').click(function (e) {
$('.autodoc_home_modal_tags_show').addClass('d-none'); $('.autodoc_home_modal_tags_show').addClass('d-none');
$('.autodoc_home_modal_tags_add').removeClass('d-none'); $('.autodoc_home_modal_tags_add').removeClass('d-none');
}) })
function change_page() { function change_page() {
var args = document.location.hash.substr(1).split('_') || conf.default_hash.split('_'); var args = document.location.hash.substr(1).split('_') || conf.default_hash.split('_');
var hash = args.shift(); var hash = args.shift();
if (!$("#autodoc_tab_" + hash).length) { if (!$("#autodoc_tab_" + hash).length) {
hash = conf.default_hash; hash = conf.default_hash;
} }
if (conf.pageinit[hash]) { if (conf.pageinit[hash]) {
var func = conf.pageinit[hash]; var func = conf.pageinit[hash];
console.log(func); console.log(func);
if ( window[func] ) {
if (window[func]) {
window[func](args); window[func](args);
} }
} }
function page_load_document(args) { function page_load_document(args) {
var [docid] = args; var [docid] = args;


if ( !docid ) { return false; }
if (!docid) { return false; }
$('.autodoc_document_empty').addClass('d-none'); $('.autodoc_document_empty').addClass('d-none');
$('.autodoc_document_body').removeClass('d-none'); $('.autodoc_document_body').removeClass('d-none');


$.getJSON( $.getJSON(
conf.openapi + "/documents/" + docid, conf.openapi + "/documents/" + docid,
function(doc) {
for(var i=0; i<doc.pageId.length; i++) {
$('.autodoc_document_carousel').append('<div><img /></div>');
$('.autodoc_document_carousel').children().last().children().attr('data-lazy',
function (doc) {
for (var i = 0; i < doc.pageId.length; i++) {
var item = $('.autodoc_document_template_carousel').clone();
$(item).children('img').attr('data-lazy',
conf.openapi + "/pages/" + doc.pageId[i] + "/image?maxWidth=100"); conf.openapi + "/pages/" + doc.pageId[i] + "/image?maxWidth=100");

$(item).children('span').html(i);
$('.autodoc_document_carousel').append(item);

} }
$('.autodoc_document_carousel').slick({ $('.autodoc_document_carousel').slick({
lazyLoad: 'ondemand', lazyLoad: 'ondemand',
slidesToShow: 4, slidesToShow: 4,
slidesToScroll: 4 slidesToScroll: 4
}); });
} }
); );
} }

Loading…
Cancel
Save