JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.min.css">
<script src="https://jquery-elastic.googlecode.com/svn-history/r37/trunk/jquery.elastic.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script>
<!DOCTYPE html>
<div id="bar">
<h4>Tasks</h4>
<span id="actions">
<button id="undo" disabled>Undo</button>
<!--<input type="image" src="http://i.imgur.com/fyCSlvW.png" />-->
<button id="redo" disabled>Redo</button>
</span>
</div>
<p id="info"></p>
<div id="todo_list_container">
<ul id="todo_items">
</ul>
<span id="add_todo">
<span id="add_button_container"><button id="add" disabled><span id="small">+</span><br/><span id="smaller">ADD</span></button></span>
<span id="new_item_textarea_container"><textarea id="new_todo_item" placeholder="Create new task" spellcheck="true"></textarea></span>
<span id="star_container"><input type="checkbox" id="star" /><label>Star</label></span>
</span>
</div>
CSS
body{
font-family: "Arial";
font-size: 62.5%;
}
h4{
text-decoration: none;
display: inline-block;
margin-top: 2rem; /* = 20px */
color: white;
margin-left: 1.5rem;
font-size: 1.8rem;
line-height: 0px;
}
#actions {
float: right;
margin: 1.5rem 1.5rem 1.2rem auto;
/*vertical-align: middle;*/
/*line-height: 3.5rem;*/
}
#undo:disabled{
/*background: url("http://i.imgur.com/fyCSlvW.png");*/
}
#bar{
background-color: #4196C2;
margin: 0rem;
padding: 0rem;
}
.item_content{
display: inline;
font-size: 1.7rem;
word-break:break-all;
}
#todo_list_container{
width: 100%;
/*border: .1em solid black;*/
/*min-width: 42rem;*/
}
#todo_items{
/*border: .1em solid red;
display: inline-block;*/
}
ul
{
list-style-type: none;
}
label{
float: right;
}
.star{
float: right;
}
#add, #star, label, .done{
vertical-align: middle;
}
textarea{
width: 60%;
resize: none;
border: 0px solid red;
overflow: auto;
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
font-family: "Arial";
font-size: 1.5rem;
vertical-align: middle;
min-width: 0rem;
}
.done, #add{
height: 4rem;
width: 4rem;
border-radius: 50%;
color: #7CB8D4;
border: 0.1rem solid #7CB8D4;
background-color: #E7F7FF;
outline: none;
line-height:80%;
margin-right: 1rem;
}
.done:hover{
border: 0.3rem solid #7CB8D4;
}
#add_todo{
width: 100%;
/*border: 1px solid yellow;*/
}
#add_button_container{
width: 20%;
/*border: 1px solid blue;*/
}
#new_item_textarea_container{
width: 70%;
/*border: 1px solid blue;*/
}
#star_container{
width: 10%;
/*border: 1px solid blue;*/
}
#add{
color: #E7F7FF;
background-color: #7CB8D4;
margin-left: 1rem;
}
#add:disabled {
opacity: 0.5;
}
#small{
font-size: 1.2rem;
line-height:...
JavaScript
$(function(){
// declare an object literal
var todo_item = {
content: "", // default content
starred: false, // default star value
undoStack: [],
redoStack: [],
addItem: function(){
// collect new item data
todo_item.content = $("#new_todo_item").val();
todo_item.starred = $("#star").prop('checked');
addItem(todo_item);
},
toggleStar: function(element, addToUndoStack){
toggleStar(element, addToUndoStack);
},
editItem: function(element, addToUndoStack){
editItem(element, addToUndoStack);
},
markAsDone: function(element){
markAsDone(element);
},
renumberItems: function(){ // re-number items after populating from localStorage, marking as done and drag/drop
renumberItems();
},
checkLocalStorageBrowserSupport: function(){
checkLocalStorageBrowserSupport();
},
checkLocalStorageExistingData: function(){
checkLocalStorageExistingData();
},
getLocalStorageData: function(){
getLocalStorageData();
},
setLocalStorageData: function(data){
setLocalStorageData(data);
},
undo: function(undoStack){
undo(undoStack);
},
redo: function(redoStack){
redo(redoStack);
},
tweakMinorUIStuff: function(){
tweakMinorUIStuff();
}
};
// setup the UI
todo_item.checkLocalStorageBrowserSupport();
todo_item.checkLocalStorageExistingData();
todo_item.tweakMinorUIStuff();
todo_item.renumberItems();
// setup event listeners
$(document).on("click", "#add", function(){ todo_item.addItem(); });
$(document).on("click", ".star", function(){ todo_item.toggleStar(this, true); ...