changes indicator

This commit is contained in:
2018-07-23 08:49:38 +03:00
parent 57048f5fc3
commit c0ccc40d17
3 changed files with 32 additions and 8 deletions

View File

@@ -151,20 +151,40 @@ function UploadURL() {
}
function updateEditorPreview() {
function updateEditor() {
var input = document.getElementById("editor_area");
var preview = document.getElementById("editor_preview");
preview.innerHTML = md.render(input.value);
if (preview.style.display === 'block') {
preview.innerHTML = md.render(input.value);
}
var currentHash = hashCode(input.value);
if (currentHash == editorHash) {
document.getElementById("editor_save").value = "Save ";
} else {
document.getElementById("editor_save").value = "Save*";
}
}
function previewToggle() {
toggler("editor_preview");
if (document.getElementById("editor_preview").style.display === 'block') {
document.getElementById("editor_area").style.width = "40vw";
updateEditor();
} else {
document.getElementById("editor_area").style.width = "82vw";
}
}
function hashCode(s) {
var h = 0, l = s.length, i = 0;
if ( l > 0 )
while (i < l)
h = (h << 5) - h + s.charCodeAt(i++) | 0;
return h;
};
function changeTitle(newTitle) {
document.title = "Flees - " + newTitle;
}