-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
181 lines (140 loc) · 5.72 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width">
<!-- Use SimpLESS (Win/Linux/Mac) or LESS.app (Mac) to compile your .less files
<link rel="stylesheet/less" href="less/style.less">
<script src="js/libs/less-1.3.0.min.js"></script>
to style.css, and replace the 2 lines above by this one:
-->
<link rel="stylesheet" href="less/style.css">
<script src="js/libs/modernizr-2.5.3-respond-1.1.0.min.js"></script>
</head>
<body>
<!--[if lt IE 7]><p class=chromeframe>Your browser is <em>ancient!</em> <a href="http://browsehappy.com/">Upgrade to a different browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to experience this site.</p><![endif]-->
<div class="container">
<!--h1>TODO today/week/month</h1-->
<h2 id="day"><span>Sunday</span><a href="#clear" class="clear" rel="d">clear</a></h2>
<div>
<input type="text" id="d1" />
<input type="text" id="d2" />
<input type="text" id="d3" />
</div>
<hr>
<div class="row">
<div class="span6">
<h2>Week<a href="#clear" class="clear" rel="w">clear</a></h2>
<div>
<input type="text" id="w1"/>
<input type="text" id="w2" />
<input type="text" id="w3" />
</div>
</div>
<div class="span6">
<h2 id="month"><span>April</span><a href="#clear" class="clear" rel="m">clear</a></h2>
<div>
<input type="text" id="m1" />
<input type="text" id="m2" />
<input type="text" id="m3" />
</div>
</div>
</div>
<footer>
<p>© Oren Roth 2012</p>
</footer>
<a href="https://github.com/orenroth/3-things-todo"><img style="position: absolute; top: 0; left: 0; border: 0;" src="https://a248.e.akamai.net/assets.github.com/img/bec6c51521dcc8148146135149fe06a9cc737577/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f6c6566745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub"></a>
</div> <!-- /container -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.2.min.js"><\/script>')</script>
<script src="js/libs/bootstrap/bootstrap.min.js"></script>
<!--script src="js/script.js"></script-->
<script>
var date = new Date(),
month = date.getMonth(),
weekday = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"),
monthname = new Array("January","February","March","April","May","June","July","August","September","October","November","December"),
day = date.getDay(),
ctrlDown = false;
$("#month span").text(monthname[month]);
$("#day span").text(weekday[day]);
$('input').each(function(){
var $this = $(this),
id = $(this).attr('id'),
val = localStorage.getItem(id),
dir = localStorage.getItem(id + 'dir');
$this.keydown(function(event) {
var $note = $(this),
id = $note.attr('id');
//===================switch text direction=========================
if (event.which == 17) {
ctrlDown = true;
}
if (event.which == 16) {
if(ctrlDown){
setTimeout ( function(){saveNote(id + 'dir',$note.css('direction'));},200 );
$note.css('direction',$(this).css('direction')=="ltr" ? "rtl" : "ltr");
}
}
//event.preventDefault();
//save here
setTimeout ( function(){saveNote(id,$note.val());},10 );
})
.keyup(function(event) {
if (event.which == 17) {
ctrlDown = false;
}
})
.val(val)
.wrap('<div class="inputCon' + (localStorage.getItem( id + "complete") ? " complete" : "") + '" />');
if(dir){
$this.css('direction',dir);
}
});
function saveNote(noteId,msg){
if(msg === '')
localStorage.removeItem(noteId);
else
localStorage.setItem(noteId,msg);
}
function clearInput(el){
var id = el.attr('id');
el.parent().removeClass('complete');
localStorage.removeItem( id + "complete")
el.val('');
saveNote(id,el.val());
}
//set the body height to window height minus the padding
document.body.style.height = (document.height-100) +"px";
$(".clear").on('click',function(){
var elStart = $(this).attr('rel');
$("input[id^=" + elStart + "]").val('').each(function(){
clearInput($(this));
});
});
//=================== clear & done =========================
$(".inputCon").append('<span class="done">v</span><span class="clearOne">x</span>');
$(".done").on('click',function(){
var $this = $(this),
$parent = $this.parent();
$parent.toggleClass('complete');
var id = $this.siblings('input').attr('id');
if($parent.hasClass('complete'))
saveNote(id + "complete",true);
else
localStorage.removeItem( id + "complete");
});
$(".clearOne").on('click',function(){
var $this = $(this);
clearInput($this.siblings('input'));
});
</script>
</body>
</html>