Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

collection clean-up

  • Loading branch information...
commit 7d0a77af193b8f454d1500f4632b2c82618540cf 1 parent a308b1b
@mamund authored
View
17 nodejs/collection/app.js
@@ -58,7 +58,7 @@ app.get('/collection/tasks/;queries', function(req, res){
res.header('content-type',contentType);
res.render('queries', {
layout : 'item-layout',
- site : 'http://localhost:3000/collection/tasks/',
+ site : 'http://localhost:3000/collection/tasks/'
});
});
@@ -66,7 +66,7 @@ app.get('/collection/tasks/;template', function(req, res){
res.header('content-type',contentType);
res.render('template', {
layout : 'item-layout',
- site : 'http://localhost:3000/collection/tasks/',
+ site : 'http://localhost:3000/collection/tasks/'
});
});
@@ -141,7 +141,7 @@ app.get('/collection/tasks/:i', function(req, res){
res.render('task', {
layout : 'item-layout',
site : 'http://localhost:3000/collection/tasks/',
- item : doc,
+ item : doc
});
});
});
@@ -149,7 +149,7 @@ app.get('/collection/tasks/:i', function(req, res){
/* handle creating a new task */
app.post('/collection/tasks/', function(req, res){
- var description, completed, dateDue, data;
+ var description, completed, dateDue, data, i, x;
// get data array
data = req.body.template.data;
@@ -193,7 +193,7 @@ app.put('/collection/tasks/:i', function(req, res) {
var idx = (req.params.i || '');
var rev = req.header("if-match", "*");
- var description, completed, dateDue, data;
+ var description, completed, dateDue, data, i, x;
// get data array
data = req.body.template.data;
@@ -214,7 +214,6 @@ app.put('/collection/tasks/:i', function(req, res) {
}
// build JSON to write
- var dt = new Date();
var item = {};
item.description = description;
item.completed = completed;
@@ -257,11 +256,11 @@ function today() {
if(d.length===1) {
d = '0'+d;
}
- return y+'-'+m+'-'+d
-};
+ return y+'-'+m+'-'+d;
+}
// Only listen on $ node app.js
if (!module.parent) {
app.listen(3000);
console.log("Express server listening on port %d", app.address().port);
-}
+}
View
24 nodejs/collection/public/javascripts/collection.js
@@ -15,7 +15,7 @@ var cjs = function() {
function init() {
g.filterUrl = getArg('filter');
- if(g.filterUrl!='') {
+ if(g.filterUrl!=='') {
loadList(unescape(g.filterUrl));
}
else {
@@ -56,7 +56,7 @@ var cjs = function() {
}
function filterData(href, rel) {
- var url, coll, i, x, a, args, data, part;
+ var url, coll, i, x, a, args, data;
coll = document.getElementsByTagName('a');
for(i=0,x=coll.length;i<x;i++) {
@@ -66,9 +66,9 @@ var cjs = function() {
}
}
- url = window.location.href
+ url = window.location.href;
if(url.indexOf('?')!=-1) {
- url = url.substring(0,url.indexOf('?'))
+ url = url.substring(0,url.indexOf('?'));
}
args = (a.getAttribute('args') || '');
@@ -139,7 +139,7 @@ var cjs = function() {
}
function processLinks(coll) {
- var ul, li, i, x, a, args
+ var ul, li, i, x, a, args;
ul = document.createElement('ul');
@@ -254,7 +254,7 @@ var cjs = function() {
inp = document.createElement('input');
inp.type="text";
inp.name = item.name;
- if(inp.value!='') {
+ if(inp.value!=='') {
inp.value = item.value;
}
else {
@@ -317,7 +317,7 @@ var cjs = function() {
}
function showEditForm(href) {
- var coll, dd, i, x, str;
+ var coll, i, x, str, form, name, inp;
str = '';
form = document.getElementById('input-form');
@@ -352,7 +352,7 @@ var cjs = function() {
}
function toggleInputForm() {
- var elm, coll, i, x;
+ var elm, coll, i, x, inp;
elm = document.getElementById('input-form');
if(elm) {
@@ -378,7 +378,7 @@ var cjs = function() {
}
function submitInputForm() {
- var item, form, coll, nam, val, i, x, z, etag, href;
+ var item, form, coll, i, x, z, etag, href, ajax;
form = document.getElementById('input-form');
if(form) {
@@ -411,7 +411,7 @@ var cjs = function() {
else {
ajax.open('post',href,false);
}
- ajax.setRequestHeader('content-type',g.contentType)
+ ajax.setRequestHeader('content-type',g.contentType);
ajax.send(item);
if(ajax.status>399) {
alert('Error sending task!\n'+ajax.status);
@@ -458,7 +458,7 @@ var cjs = function() {
rex = new RegExp("(?:\\?|&){@arg}=([^&]*)".replace('{@arg}',arg));
match = rex.exec(location.search.replace("+"," "));
- if (match != null)
+ if (match !== null)
{
id=match[1];
}
@@ -478,4 +478,4 @@ window.onload = function() {
c = cjs();
c.g.collectionUrl = '/collection/tasks/';
c.init();
-};
+};
Please sign in to comment.
Something went wrong with that request. Please try again.