python: setFavorite

This commit is contained in:
Alexandr Fedorov
2020-12-24 22:51:35 +03:00
parent b197f4c258
commit fec328ad9d
2 changed files with 9 additions and 1 deletions

View File

@ -141,7 +141,7 @@ def edit(request):
'author': 'Me',
'created': datetime.today().strftime('%d.%m.%Y %H:%M:%S')
}
infObj['favorite'] = request.COOKIES.get('uid') == 'uid-2' if request.COOKIES.get('uid') else None
edConfig = {
'type': edType,
'documentType': fileType,

View File

@ -99,6 +99,13 @@
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
};
var onMetaChange = function (event) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
document.title = (favorite ? "☆" : "") + title;
docEditor.setFavorite(favorite);
};
var connectEditor = function () {
config = {{ cfg | safe }}
@ -111,6 +118,7 @@
'onError': onError,
'onOutdatedVersion': onOutdatedVersion,
'onMakeActionLink': onMakeActionLink,
'onMetaChange': onMetaChange,
};
{% if history and historyData %}