Skip to content

Commit

Permalink
Saved to date
Browse files Browse the repository at this point in the history
  • Loading branch information
cfree committed Mar 1, 2014
1 parent f1ab115 commit 0807eb1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 7 deletions.
38 changes: 34 additions & 4 deletions proj9/assets/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
max: (current.indexOf('max') !== -1) ? jq.trim(current.split('max-width:')[1].split('px')[0]) : 'none'
};

// Save whatcha got
// Save whatcha, whatcha, whatcha got (whatcha got)
layouts.push(mq);
}
});
Expand All @@ -48,12 +48,42 @@
return a.min - b.min;
});

// Send to server so it can be saved
// Send to server so it can be saved (...)
$.ajax({
url: 'heat-map.asmx/saveLayouts',
data: JSON.stringify({
url: url,
url: this.url,
layouts: layouts
})
});

// Wait for images to fully load...
$.imagesLoaded(function() {
// Listen for clicks on the page
doc.on('click.jqHeat', function(e) {
var x = e.pageX,
y = e.pageY,
docWidth = doc.outerWidth(),
docHeight = doc.outerHeight(),
layout,
click = {
url: url,
x: Math.ceil((x / docWidth) * 100),
y: Math.ceil((y / docHeight) * 100)
};

$.each(layouts, function(i, item) {
var min = item.min || 0,
max = item.max || docWidth,
bp = i + 1;

if (docWidth >= min && docWidth <= max) {
click.layout = bp;
}
else if (docWidth > max) {
click.layout = bp + 1;
}
});
});
})
});
})(jQuery);
8 changes: 5 additions & 3 deletions proj9/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

### Notes


### Problems

- Dude, I'm not on a Windows box
- Project requires saving to a database, but uses a `.asmx` file to do so. Not helpful.
- Will need to rewrite for MySQL or localStorage interfacing

### Dependencies
- jQuery
- imagesLoaded
- Simplex theme

### Status
In Progress
In Progress - p.217 - writing comments

0 comments on commit 0807eb1

Please sign in to comment.