Skip to content
Permalink
Browse files

allow to save tribune preferences in localStorage

  • Loading branch information...
devnewton committed Sep 15, 2018
1 parent cb9f874 commit 543415d9fd5bb9dbcb90c4c333842c9aaa7a3a93
Showing with 12 additions and 4 deletions.
  1. +4 −1 tribune.css
  2. +4 −0 tribune.js
  3. +4 −3 tribune.php
@@ -123,5 +123,8 @@

#palmipede-extras {
display: none;
margin-top: 8px;
margin-top: 4px;
margin-bottom: 4px;
padding-top: 4px;
padding-bottom: 4px;
}
@@ -41,6 +41,10 @@ document.addEventListener('DOMContentLoaded', function () {
console.log(palmipedeExtras.style.display);
palmipedeExtras.style.display = palmipedeExtras.style.display ? '' : 'block';
});
document.getElementById('palmipede-extras-info').value = localStorage.getItem('tribune-info');
document.getElementById('palmipede-extras-save').addEventListener("click", function (e) {
localStorage.setItem('tribune-info', document.getElementById('palmipede-extras-info').value);
});
},
refresh: function () {
var self = this;
@@ -62,11 +62,12 @@ public function onPageContentRaw(Event $e) {
<form id="palmipede" accept-charset="UTF-8" enctype="application/x-www-form-urlencoded" autofocus="autofocus" class="palmipede">
<input name="message" placeholder="message" spellcheck="true">
<button type="submit" class="button">Post</button>
<span id="palmipede-showextras-button">&#x2699;</span>
<span id="palmipede-showextras-button" title="Show/hide tribune preferences">&#x2699;</span>
<fieldset id="palmipede-extras">
<label>Info
<input id="palmipede-extras-info" name="info" placeholder="nickname or status">
<label class="form-label">Info
<input id="palmipede-extras-info" class="form-input" name="info" placeholder="nickname or status">
</label>
<button id="palmipede-extras-save" class="button">Save my preferences in local storage.</button>
</fieldset>
</form>
<div id="tribune" class="tribune"></div>

0 comments on commit 543415d

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.