|
|
@@ -13,17 +13,17 @@ var conf = { |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
$(document).ready(function() { |
|
|
|
$(document).ready(function () { |
|
|
|
|
|
|
|
change_page(); |
|
|
|
$(document).scroll(function() { |
|
|
|
upload_zone_init(); |
|
|
|
|
|
|
|
$(document).scroll(function () { |
|
|
|
page_home_scroll(); |
|
|
|
}); |
|
|
|
$('#autodoc_upload_zone').change(function() { |
|
|
|
console.log(this); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
$(window).bind("hashchange", function() { |
|
|
|
$(window).bind("hashchange", function () { |
|
|
|
change_page(); |
|
|
|
}); |
|
|
|
|
|
|
@@ -37,7 +37,7 @@ function change_page() { |
|
|
|
/* change menu highlights and content visibility */ |
|
|
|
$("#autodoc_navbar") |
|
|
|
.find("a") |
|
|
|
.each(function(id, obj) { |
|
|
|
.each(function (id, obj) { |
|
|
|
var curhash = $(obj) |
|
|
|
.attr("href") |
|
|
|
.substr(1); |
|
|
@@ -87,17 +87,17 @@ function document_load() { |
|
|
|
|
|
|
|
$.getJSON( |
|
|
|
conf.openapi + |
|
|
|
"/documents?pageSize=" + |
|
|
|
conf.home.width + |
|
|
|
"&pageIndex=" + |
|
|
|
conf.home.curpage, |
|
|
|
"/documents?pageSize=" + |
|
|
|
conf.home.width + |
|
|
|
"&pageIndex=" + |
|
|
|
conf.home.curpage, |
|
|
|
null, |
|
|
|
function(data, textStatus, jqXHR) { |
|
|
|
function (data, textStatus, jqXHR) { |
|
|
|
// last document was loaded, stop scrolling |
|
|
|
if (data.length < conf.home.width) { |
|
|
|
conf.home.end = 1; |
|
|
|
} |
|
|
|
$.each(data, function(id, doc) { |
|
|
|
$.each(data, function (id, doc) { |
|
|
|
var col = $(tmpl) |
|
|
|
.find(".autodoc_template_home_col") |
|
|
|
.clone(); |
|
|
@@ -106,10 +106,10 @@ function document_load() { |
|
|
|
.attr( |
|
|
|
"src", |
|
|
|
conf.openapi + |
|
|
|
"/documents/" + |
|
|
|
doc.id + |
|
|
|
"/image?maxWidth=" + |
|
|
|
Math.floor(1000 / conf.home.width) |
|
|
|
"/documents/" + |
|
|
|
doc.id + |
|
|
|
"/image?maxWidth=" + |
|
|
|
Math.floor(1000 / conf.home.width) |
|
|
|
); |
|
|
|
|
|
|
|
$(col) |
|
|
@@ -124,7 +124,7 @@ function document_load() { |
|
|
|
.find(".autodoc_template_home_name") |
|
|
|
.html(doc.name); |
|
|
|
|
|
|
|
$.each(doc.tags, function(id, tag) { |
|
|
|
$.each(doc.tags, function (id, tag) { |
|
|
|
$(col) |
|
|
|
.find(".autodoc_template_home_tag") |
|
|
|
.after( |
|
|
@@ -155,6 +155,25 @@ function page_home_scroll() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function file_upload() { |
|
|
|
console.log(this.files); |
|
|
|
function upload_zone_init() { |
|
|
|
$('.autodoc_upload_zone').on('dragenter', upload_zone_highlight); |
|
|
|
$('.autodoc_upload_zone').on('dragleave', upload_zone_normal); |
|
|
|
$('.autodoc_upload_zone').on('drop', upload_zone_drop); |
|
|
|
} |
|
|
|
|
|
|
|
function upload_zone_highlight(e) { |
|
|
|
$(e.target).addClass('autodoc_upload_zone_highlight'); |
|
|
|
} |
|
|
|
|
|
|
|
function upload_zone_normal(e) { |
|
|
|
$(e.target).removeClass('autodoc_upload_zone_highlight'); |
|
|
|
} |
|
|
|
|
|
|
|
function upload_zone_drop(e) { |
|
|
|
|
|
|
|
e.dataTransfer.effectAllowed = "none"; |
|
|
|
e.dataTransfer.dropEffect = "none"; |
|
|
|
|
|
|
|
console.log(e); |
|
|
|
return true; |
|
|
|
} |