summaryrefslogtreecommitdiff
path: root/public/editor/editor.js
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2015-05-11 16:03:41 +0200
committerAaron Parecki <aaron@parecki.com>2015-05-11 16:03:41 +0200
commit475175da5fd90162930acc123712a529f809f961 (patch)
tree4bb9d78c98e19a3fe246ed39fe2d9114288eb194 /public/editor/editor.js
parent3b7d766c31314a3d42d651b8c8f643ff8d6e15bd (diff)
adds a "new version available" banner and a dropdown menu for publish
made a nice looking dropdown menu for the publish button
Diffstat (limited to 'public/editor/editor.js')
-rw-r--r--public/editor/editor.js23
1 files changed, 21 insertions, 2 deletions
diff --git a/public/editor/editor.js b/public/editor/editor.js
index 17cc24e..a0873d6 100644
--- a/public/editor/editor.js
+++ b/public/editor/editor.js
@@ -31,11 +31,19 @@ $(function () {
});
$.post('/editor/test-login', {}, function(response) {
- $('#publish_btn').text(response.logged_in ? 'Publish' : 'Sign In');
+ $('#publish_btn span').text(response.logged_in ? 'Publish' : 'Sign In');
});
$('#publish_btn').click(function(){
- if($('#publish_btn').text() == 'Publish') {
+ if($('.publish-dropdown').hasClass('hidden')) {
+ $('.publish-dropdown').removeClass('hidden');
+ } else {
+ $('.publish-dropdown').addClass('hidden');
+ }
+ });
+
+ $('#--publish_btn').click(function(){
+ if($('#publish_btn span').text() == 'Publish') {
$.post('/editor/publish', {
name: $("#post-name").val(),
@@ -57,6 +65,7 @@ $(function () {
$('#new_btn').click(function(){
reset_page();
});
+
});
function reset_page() {
@@ -66,6 +75,16 @@ function reset_page() {
return localforage.setItem('currentdraft', {});
}
+function onUpdateReady() {
+ // Show the notice that says there is a new version of the app
+ $("#new_version_available").show();
+}
+
+window.applicationCache.addEventListener('updateready', onUpdateReady);
+if(window.applicationCache.status === window.applicationCache.UPDATEREADY) {
+ onUpdateReady();
+}
+
/* ************************************************ */
/* autosave loop */
var autosaveTimeout = false;