From ea8a49e6d94d15ba59c6dc486ff5bb6cb294720a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20H=C3=A4gg?= Date: Thu, 6 Aug 2015 17:45:04 +0200 Subject: [PATCH] Fuck you --- package.json | 15 +++ server/config/details.js | 5 + server/config/dir.js | 47 ++++++++ server/config/domain.js | 12 ++ server/config/error-handler.js | 23 ++++ server/config/globals.js | 13 +++ server/config/mongo.js | 10 ++ server/config/port.js | 8 ++ server/config/session.js | 14 +++ server/routes/_index.js | 7 ++ server/server.js | 3 + server/templates/pages/index.dust | 181 +++++++++++++++++++++++++++--- src/js/app.js | 12 ++ src/js/views/finger-me.js | 35 ++++++ src/js/views/index.js | 4 + src/sass/main.scss | 150 +++++++++++++++++++++++++ 16 files changed, 525 insertions(+), 14 deletions(-) create mode 100644 package.json create mode 100644 server/config/details.js create mode 100644 server/config/dir.js create mode 100644 server/config/domain.js create mode 100644 server/config/error-handler.js create mode 100644 server/config/globals.js create mode 100644 server/config/mongo.js create mode 100644 server/config/port.js create mode 100644 server/config/session.js create mode 100644 server/routes/_index.js create mode 100644 server/server.js create mode 100644 src/js/app.js create mode 100644 src/js/views/finger-me.js create mode 100644 src/js/views/index.js create mode 100644 src/sass/main.scss diff --git a/package.json b/package.json new file mode 100644 index 0000000..76ff99a --- /dev/null +++ b/package.json @@ -0,0 +1,15 @@ +{ + "name": "change-this-fool", + "version": "0.0.0", + "description": "", + "main": "./server/server.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "The Code Bureau (https://thecodebureau.com)", + "dependencies": { + "epiphany": "^0.5.3", + "lodash": "^3.10.1", + "ridge": "^0.5.1" + } +} diff --git a/server/config/details.js b/server/config/details.js new file mode 100644 index 0000000..e4f90ea --- /dev/null +++ b/server/config/details.js @@ -0,0 +1,5 @@ +module.exports = { + title: 'Epiphany', + name: 'epiphany' +}; + diff --git a/server/config/dir.js b/server/config/dir.js new file mode 100644 index 0000000..46fa20f --- /dev/null +++ b/server/config/dir.js @@ -0,0 +1,47 @@ +// MODULES + +// modules : NATIVE + +var path = require('path'); + +var PWD = process.env.PWD; + +// Server folders. All folder related to the Node server handling most things. +module.exports = { + // Any code that needs to a "middle landing spot" while built, place it anywhere here + build: { + root: path.join(PWD, 'build') + }, + + // public directories. Where all static/built/live content goes. + public: { + css: path.join(PWD, 'public', 'css'), + fonts: path.join(PWD, 'public', 'fonts'), + img: path.join(PWD, 'public', 'img'), + root: path.join(PWD, 'public'), + scripts: path.join(PWD, 'public', 'js') + }, + + root: PWD, + + server: { + middleware: path.join(PWD, 'server', 'middleware'), + models: path.join(PWD, 'server', 'models'), + routes: path.join(PWD, 'server', 'routes'), + root: path.join(PWD, 'server'), + schemas: path.join(PWD, 'server', 'schema.org'), + templates: path.join(PWD, 'server', 'templates'), + uploads: path.join(PWD, 'server', 'uploads') + }, + + // Source directories. This is where you put all content that needs to be built before use. + src: { + fonts: path.join(PWD, 'src', 'fonts'), + raster: path.join(PWD, 'src', 'raster'), + root: path.join(PWD, 'src'), + sass: path.join(PWD, 'src', 'sass'), + static: path.join(PWD, 'src', 'static'), + scripts: path.join(PWD, 'src', 'js'), + svg: path.join(PWD, 'src', 'svg'), + } +}; diff --git a/server/config/domain.js b/server/config/domain.js new file mode 100644 index 0000000..5c8f35d --- /dev/null +++ b/server/config/domain.js @@ -0,0 +1,12 @@ +var _ = require('lodash'); + +module.exports = function(config) { + if(!config.port || !_.isNumber(config.port)) throw new Error('Port undefined or not a number'); + + return { + development: 'localhost:' + config.port, + testing: 'changeThisFool.testing.thecodebureau.com', + staging: 'changeThisFool.thecodebureau.com', + production: 'www.changeThisFool.se' + }[ENV]; +}; diff --git a/server/config/error-handler.js b/server/config/error-handler.js new file mode 100644 index 0000000..f0d1f9d --- /dev/null +++ b/server/config/error-handler.js @@ -0,0 +1,23 @@ +module.exports = { + defaults: { + mystify: { + properties: [ 'message', 'name', 'status', 'statusText' ] + }, + log: { + // if database = true there has to be a mongoose model name ErrorModel + ignore: [], + } + }, + development: { + log: { + database: false, + console: true, + } + }, + production: { + log: { + database: true, + console: false, + } + }, +}; diff --git a/server/config/globals.js b/server/config/globals.js new file mode 100644 index 0000000..8386772 --- /dev/null +++ b/server/config/globals.js @@ -0,0 +1,13 @@ +var path = require('path'); + +module.exports = function(bind) { + bind = bind || global; + + bind.ENV = process.env.NODE_ENV || 'development'; + bind.PWD = process.env.PWD; + bind.DEBUG_ERROR_HANDLER = false; + bind.DEBUG_RESPONDER = false; + bind.LOGIN_USER = false; + //bind.LOGIN_USER = 'username'; + //bind.LOGIN_USER = 'linus.miller@thecodebureau.com'; +}; diff --git a/server/config/mongo.js b/server/config/mongo.js new file mode 100644 index 0000000..78eb84f --- /dev/null +++ b/server/config/mongo.js @@ -0,0 +1,10 @@ +module.exports = { + defaults: { + uri: 'mongodb://localhost/changeThisFool' + //uri: 'mongodb://user:password@tcb01.thecodebureau.com/changeThisFool' + }, + development: { + //uri: 'mongodb://user:password@tcb01.thecodebureau.com/changeThisFoolDev' + uri: 'mongodb://localhost/changeThisFoolDev' + } +}; diff --git a/server/config/port.js b/server/config/port.js new file mode 100644 index 0000000..56294a0 --- /dev/null +++ b/server/config/port.js @@ -0,0 +1,8 @@ +var basePort = 10000; + +module.exports = { + development: basePort, + testing: basePort + 1, + staging: basePort + 2, + production: basePort + 3 +}[ENV]; diff --git a/server/config/session.js b/server/config/session.js new file mode 100644 index 0000000..87a4180 --- /dev/null +++ b/server/config/session.js @@ -0,0 +1,14 @@ +module.exports = { + defaults: { + secret: 'changeThisFool', + resave: true, + saveUninitialized: true + }, + production: { + redis: { + port: 6379, + host: 'localhost' + } + } +}; + diff --git a/server/routes/_index.js b/server/routes/_index.js new file mode 100644 index 0000000..bd7e602 --- /dev/null +++ b/server/routes/_index.js @@ -0,0 +1,7 @@ +module.exports = function() { + return [ + [ 'get', '/', function(req, res) { + res.render('pages/index'); + } ] + ]; +}; \ No newline at end of file diff --git a/server/server.js b/server/server.js new file mode 100644 index 0000000..8b12034 --- /dev/null +++ b/server/server.js @@ -0,0 +1,3 @@ +var Epiphany = require('epiphany'); + +var server = new Epiphany(); diff --git a/server/templates/pages/index.dust b/server/templates/pages/index.dust index e46e007..41c0f8d 100644 --- a/server/templates/pages/index.dust +++ b/server/templates/pages/index.dust @@ -2,18 +2,182 @@ TCB Stomping Grounds : Resolution Test : No viewport option + + + + + + - +
+ SCREEN +

+ BODY +
+ DEVICE PIXEL RATIO +
+
-webkit-min-device-pixel-ratio +
+ 1.0 + 1.1 + 1.2 + 1.3 + 1.4 + 1.5 + 1.6 + 1.7 + 1.8 + 1.9 + 2.0 + 2.1 + 2.2 + 2.3 + 2.4 + 2.5 + 2.6 + 2.7 + 2.8 + 2.9 + 3.0 +
+ +
-moz-min-device-pixel-ratio +
+ 1.0 + 1.1 + 1.2 + 1.3 + 1.4 + 1.5 + 1.6 + 1.7 + 1.8 + 1.9 + 2.0 + 2.1 + 2.2 + 2.3 + 2.4 + 2.5 + 2.6 + 2.7 + 2.8 + 2.9 + 3.0 +
+ +
-o-min-device-pixel-ratio +
+ 1.0 + 1.1 + 1.2 + 1.3 + 1.4 + 1.5 + 1.6 + 1.7 + 1.8 + 1.9 + 2.0 + 2.1 + 2.2 + 2.3 + 2.4 + 2.5 + 2.6 + 2.7 + 2.8 + 2.9 + 3.0 +
+ +
(no-prefix)min-device-pixel-ratio +
+ 1.0 + 1.1 + 1.2 + 1.3 + 1.4 + 1.5 + 1.6 + 1.7 + 1.8 + 1.9 + 2.0 + 2.1 + 2.2 + 2.3 + 2.4 + 2.5 + 2.6 + 2.7 + 2.8 + 2.9 + 3.0 +
+ +
min-resolution dpi +
+ 96 + 105 + 115 + 125 + 135 + 144 + 154 + 163 + 173 + 182 + 192 + 202 + 211 + 221 + 230 + 240 + 250 + 259 + 267 + 278 + 288 +
+ +
min-resolution ddpx +
+ 1.0 + 1.1 + 1.2 + 1.3 + 1.4 + 1.5 + 1.6 + 1.7 + 1.8 + 1.9 + 2.0 + 2.1 + 2.2 + 2.3 + 2.4 + 2.5 + 2.6 + 2.7 + 2.8 + 2.9 + 3.0 +
+
+
+ + diff --git a/src/js/app.js b/src/js/app.js new file mode 100644 index 0000000..c0b5485 --- /dev/null +++ b/src/js/app.js @@ -0,0 +1,12 @@ +var Ridge = require('ridge'); + +var app = new Ridge({ + //collections: require('./collections'), + //models: require('./models'), + views: require('./views') +}); + +$(function() { + app.prevnext = new app.views.FingerMe({ el: app.$('.finger-me') }); + Backbone.history.start({ silent: true, pushState: true, hashChange: false }); +}) diff --git a/src/js/views/finger-me.js b/src/js/views/finger-me.js new file mode 100644 index 0000000..b9a931f --- /dev/null +++ b/src/js/views/finger-me.js @@ -0,0 +1,35 @@ +module.exports = { + events: + { + }, + initialize: function() + { + + this.screenInfoJSON = _.omit(window.screen) + this.screenInfoJSON.orientation = _.omit(window.screen.orientation) + + this.bodyInfoJSON = _.pick(document.body, 'clientWidth', 'clientHeight', 'offsetWidth', 'offsetHeight', 'scrollWidth', 'scrollHeight') + + this.deviceInfoJSON = window.devicePixelRatio + + $('.screenInfo').html(this.mkCodeBlock(this.screenInfoJSON)) + $('.bodyInfo').html(this.mkCodeBlock(this.bodyInfoJSON)) + // document.getElementById('screen-width').textContent = screen.width; + // document.getElementById('screen-height').textContent = screen.height; + // document.getElementById('screen-avail-width').textContent = screen.availWidth; + // document.getElementById('screen-avail-height').textContent = screen.availHeight; + // document.getElementById('body-client-width').textContent = document.body.clientWidth; + // document.getElementById('body-client-height').textContent = document.body.clientHeight; + // document.getElementById('body-offset-width').textContent = document.body.offsetWidth; + // document.getElementById('body-offset-height').textContent = document.body.offsetHeight; + // document.getElementById('body-scroll-width').textContent = document.body.scrollWidth; + // document.getElementById('body-scroll-height').textContent = document.body.scrollHeight; + }, + render: function(){}, + mkCodeBlock: function(jsonData) + { + var el = document.createElement('pre'); + el.innerText = JSON.stringify(jsonData, null, 2) + return el; + } +} \ No newline at end of file diff --git a/src/js/views/index.js b/src/js/views/index.js new file mode 100644 index 0000000..5a40407 --- /dev/null +++ b/src/js/views/index.js @@ -0,0 +1,4 @@ +module.exports = { + Page: require('ridge/views/page'), + FingerMe: require('./finger-me') +} \ No newline at end of file diff --git a/src/sass/main.scss b/src/sass/main.scss new file mode 100644 index 0000000..269fcf9 --- /dev/null +++ b/src/sass/main.scss @@ -0,0 +1,150 @@ +.dr {display:none;} +.wk-device-pixel-ratio +{ + @media all and(-webkit-min-device-pixel-ratio: 1.0) {.d10 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 1.1) {.d11 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 1.2) {.d12 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 1.3) {.d13 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 1.4) {.d14 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 1.5) {.d15 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 1.6) {.d16 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 1.7) {.d17 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 1.8) {.d18 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 1.9) {.d19 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 2.0) {.d20 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 2.1) {.d21 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 2.2) {.d22 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 2.3) {.d23 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 2.4) {.d24 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 2.5) {.d25 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 2.6) {.d26 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 2.7) {.d27 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 2.8) {.d28 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 2.9) {.d29 {display:inline;}} + @media all and(-webkit-min-device-pixel-ratio: 3.0) {.d30 {display:inline;}} +} + +.moz-device-pixel-ratio +{ + @media all and(-moz-min-device-pixel-ratio: 1.0) {.d10 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 1.1) {.d11 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 1.2) {.d12 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 1.3) {.d13 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 1.4) {.d14 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 1.5) {.d15 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 1.6) {.d16 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 1.7) {.d17 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 1.8) {.d18 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 1.9) {.d19 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 2.0) {.d20 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 2.1) {.d21 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 2.2) {.d22 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 2.3) {.d23 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 2.4) {.d24 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 2.5) {.d25 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 2.6) {.d26 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 2.7) {.d27 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 2.8) {.d28 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 2.9) {.d29 {display:inline;}} + @media all and(-moz-min-device-pixel-ratio: 3.0) {.d30 {display:inline;}} +} + +.o-device-pixel-ratio +{ + @media all and(-o-min-device-pixel-ratio: 1.0) {.d10 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 1.1) {.d11 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 1.2) {.d12 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 1.3) {.d13 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 1.4) {.d14 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 1.5) {.d15 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 1.6) {.d16 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 1.7) {.d17 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 1.8) {.d18 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 1.9) {.d19 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 2.0) {.d20 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 2.1) {.d21 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 2.2) {.d22 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 2.3) {.d23 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 2.4) {.d24 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 2.5) {.d25 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 2.6) {.d26 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 2.7) {.d27 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 2.8) {.d28 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 2.9) {.d29 {display:inline;}} + @media all and(-o-min-device-pixel-ratio: 3.0) {.d30 {display:inline;}} +} + +.device-pixel-ratio +{ + @media all and(min-device-pixel-ratio: 1.0) {.d10 {display:inline;}} + @media all and(min-device-pixel-ratio: 1.1) {.d11 {display:inline;}} + @media all and(min-device-pixel-ratio: 1.2) {.d12 {display:inline;}} + @media all and(min-device-pixel-ratio: 1.3) {.d13 {display:inline;}} + @media all and(min-device-pixel-ratio: 1.4) {.d14 {display:inline;}} + @media all and(min-device-pixel-ratio: 1.5) {.d15 {display:inline;}} + @media all and(min-device-pixel-ratio: 1.6) {.d16 {display:inline;}} + @media all and(min-device-pixel-ratio: 1.7) {.d17 {display:inline;}} + @media all and(min-device-pixel-ratio: 1.8) {.d18 {display:inline;}} + @media all and(min-device-pixel-ratio: 1.9) {.d19 {display:inline;}} + @media all and(min-device-pixel-ratio: 2.0) {.d20 {display:inline;}} + @media all and(min-device-pixel-ratio: 2.1) {.d21 {display:inline;}} + @media all and(min-device-pixel-ratio: 2.2) {.d22 {display:inline;}} + @media all and(min-device-pixel-ratio: 2.3) {.d23 {display:inline;}} + @media all and(min-device-pixel-ratio: 2.4) {.d24 {display:inline;}} + @media all and(min-device-pixel-ratio: 2.5) {.d25 {display:inline;}} + @media all and(min-device-pixel-ratio: 2.6) {.d26 {display:inline;}} + @media all and(min-device-pixel-ratio: 2.7) {.d27 {display:inline;}} + @media all and(min-device-pixel-ratio: 2.8) {.d28 {display:inline;}} + @media all and(min-device-pixel-ratio: 2.9) {.d29 {display:inline;}} + @media all and(min-device-pixel-ratio: 3.0) {.d30 {display:inline;}} +} + +.min-resolution +{ + @media all and(min-resolution: 96dpi) {.d96 {display:inline;}} + @media all and(min-resolution: 105dpi) {.d105 {display:inline;}} + @media all and(min-resolution: 115dpi) {.d115 {display:inline;}} + @media all and(min-resolution: 125dpi) {.d125 {display:inline;}} + @media all and(min-resolution: 135dpi) {.d135 {display:inline;}} + @media all and(min-resolution: 144dpi) {.d144 {display:inline;}} + @media all and(min-resolution: 154dpi) {.d154 {display:inline;}} + @media all and(min-resolution: 163dpi) {.d163 {display:inline;}} + @media all and(min-resolution: 173dpi) {.d173 {display:inline;}} + @media all and(min-resolution: 182dpi) {.d182 {display:inline;}} + @media all and(min-resolution: 192dpi) {.d192 {display:inline;}} + @media all and(min-resolution: 202dpi) {.d202 {display:inline;}} + @media all and(min-resolution: 211dpi) {.d211 {display:inline;}} + @media all and(min-resolution: 221dpi) {.d221 {display:inline;}} + @media all and(min-resolution: 230dpi) {.d230 {display:inline;}} + @media all and(min-resolution: 240dpi) {.d240 {display:inline;}} + @media all and(min-resolution: 250dpi) {.d250 {display:inline;}} + @media all and(min-resolution: 259dpi) {.d259 {display:inline;}} + @media all and(min-resolution: 267dpi) {.d267 {display:inline;}} + @media all and(min-resolution: 278dpi) {.d278 {display:inline;}} + @media all and(min-resolution: 288dpi) {.d288 {display:inline;}} +} + +.min-resolution-dppx +{ + @media all and(min-resolution: 1.0dppx) {.d10 {display:inline;}} + @media all and(min-resolution: 1.1dppx) {.d11 {display:inline;}} + @media all and(min-resolution: 1.2dppx) {.d12 {display:inline;}} + @media all and(min-resolution: 1.3dppx) {.d13 {display:inline;}} + @media all and(min-resolution: 1.4dppx) {.d14 {display:inline;}} + @media all and(min-resolution: 1.5dppx) {.d15 {display:inline;}} + @media all and(min-resolution: 1.6dppx) {.d16 {display:inline;}} + @media all and(min-resolution: 1.7dppx) {.d17 {display:inline;}} + @media all and(min-resolution: 1.8dppx) {.d18 {display:inline;}} + @media all and(min-resolution: 1.9dppx) {.d19 {display:inline;}} + @media all and(min-resolution: 2.0dppx) {.d20 {display:inline;}} + @media all and(min-resolution: 2.1dppx) {.d21 {display:inline;}} + @media all and(min-resolution: 2.2dppx) {.d22 {display:inline;}} + @media all and(min-resolution: 2.3dppx) {.d23 {display:inline;}} + @media all and(min-resolution: 2.4dppx) {.d24 {display:inline;}} + @media all and(min-resolution: 2.5dppx) {.d25 {display:inline;}} + @media all and(min-resolution: 2.6dppx) {.d26 {display:inline;}} + @media all and(min-resolution: 2.7dppx) {.d27 {display:inline;}} + @media all and(min-resolution: 2.8dppx) {.d28 {display:inline;}} + @media all and(min-resolution: 2.9dppx) {.d29 {display:inline;}} + @media all and(min-resolution: 3.0dppx) {.d30 {display:inline;}} +} \ No newline at end of file