diff options
| author | Jules Laplace <jules@okfoc.us> | 2014-07-15 15:15:38 -0400 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2014-07-15 15:53:12 -0400 |
| commit | f97fffeebb0f764d1a8951c91d7b90cb9dcb7583 (patch) | |
| tree | 4fcd5094549f208ebcb478c8359e60205416305c /public/assets/javascripts/ui/_router.js | |
| parent | cdce6146956b5e6f335022631d9ffeae6c90efcc (diff) | |
build macpaint swatches
Diffstat (limited to 'public/assets/javascripts/ui/_router.js')
| -rw-r--r-- | public/assets/javascripts/ui/_router.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/public/assets/javascripts/ui/_router.js b/public/assets/javascripts/ui/_router.js index 2b2c7c0..b59d838 100644 --- a/public/assets/javascripts/ui/_router.js +++ b/public/assets/javascripts/ui/_router.js @@ -37,6 +37,8 @@ var SiteRouter = Router.extend({ "/project/new/:layout": 'projectNewWithLayout', "/project/:name": 'project', "/project/:name/view": 'projectViewer', + + "/test/wallpaper": 'testWallpaper', }, initialize: function(){ @@ -200,5 +202,30 @@ var SiteRouter = Router.extend({ // this.documentModal.destroy(name) }, + + testWallpaper: function(e){ + var content = document.getElementById("content") + content.style.width = "680px" + content.style.margin = "0 auto" + var wm = new WallpaperManager() + app.on('wallpaper-ready', function(){ + var black = [0,0,0,0] + var white = [255,255,255,1.0] + var swatches = wm.buildSwatches(black, white, 4) + document.body.style.backgroundColor = "#eee" + swatches.forEach(function(swatch){ + swatch.style.margin = "4px" + swatch.style.border = "1px solid lime" + swatch.style.backgroundColor = "#888" + content.appendChild(swatch) + swatch.onclick = function(){ + dataUrl = swatch.toDataURL() + document.body.style.backgroundImage = "url(" + dataUrl + ")" + } + }) + }) + wm.init() + }, + }) |
