mirror of
https://github.com/owncloud/bookmarks.git
synced 2024-12-01 05:24:11 +01:00
ae81b9dcd2
Dependency Injection for user and db is used througout the controllers The Routing features a consistent rest api The Routing provides some legacy routes, so that for exampe the Android Bookmarks App still works. There is a publicly available api that provides access to bookmarks per user. (This is usefull in connection with the WP Plugin https://github.com/mario-nolte/oc2wp-bookmarks)
55 lines
1.2 KiB
JavaScript
55 lines
1.2 KiB
JavaScript
var ajaxCallCount = 0;
|
|
|
|
function increaseAjaxCallCount() {
|
|
ajaxCallCount++;
|
|
if (ajaxCallCount - 1 === 0) {
|
|
updateLoadingAnimation();
|
|
}
|
|
}
|
|
|
|
function decreaseAjaxCallCount() {
|
|
if (ajaxCallCount > 0) {
|
|
ajaxCallCount--;
|
|
updateLoadingAnimation();
|
|
}
|
|
}
|
|
|
|
function updateLoadingAnimation() {
|
|
if (ajaxCallCount === 0) {
|
|
$("#add_form_loading").css("visibility", "hidden");
|
|
} else {
|
|
$("#add_form_loading").css("visibility", "visible");
|
|
}
|
|
}
|
|
|
|
$(function () {
|
|
$(".submit").click(function () {
|
|
increaseAjaxCallCount();
|
|
var dataString = 'url=' + $("input#url").val() + '&description=' +
|
|
$("textarea#description").val() + '&title=' + $("input#title").val();
|
|
$.ajax({
|
|
type: "POST",
|
|
url: "bookmark",
|
|
data: dataString,
|
|
complete: function () {
|
|
decreaseAjaxCallCount();
|
|
},
|
|
success: function (data) {
|
|
if (data.status === 'success') {
|
|
$('#bookmarklet_form').html("");
|
|
OC.dialogs.alert(
|
|
t("bookmarks", "Bookmark added. You can close the window now."),
|
|
t("bookmarks", "Bookmark added successfully"), closeWindow, true);
|
|
} else {
|
|
OC.dialogs.alert(t("bookmarks", "Some Error happened."),
|
|
t("bookmarks", "Error"), null, true);
|
|
}
|
|
}
|
|
});
|
|
return false;
|
|
});
|
|
});
|
|
|
|
function closeWindow() {
|
|
window.close();
|
|
} |