commit e7e0ea4f2a15d06c90a9a76aa8c9d0e34caa0f10 Author: Linus Miller Date: Wed Sep 2 11:04:34 2015 +0200 Initial shit i think. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ddd05a --- /dev/null +++ b/.gitignore @@ -0,0 +1,36 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git +node_modules + +# Bower dependency directory +bower_components + +/dump + +/public + +/server/uploads diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f3e1d1f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "gulp"] + path = gulp + url = https://github.com/thecodebureau/gulp.git diff --git a/gulp b/gulp new file mode 160000 index 0000000..57adc62 --- /dev/null +++ b/gulp @@ -0,0 +1 @@ +Subproject commit 57adc62ecbec966afa0f717e967287c820c09095 diff --git a/gulpconfig.js b/gulpconfig.js new file mode 100644 index 0000000..6874162 --- /dev/null +++ b/gulpconfig.js @@ -0,0 +1,12 @@ +module.exports = { + browserify: { + entries: [ + 'app.js', + 'admin/app.js' + ], + outputs: [ + 'app.js', + 'admin.js' + ] + } +}; diff --git a/gulpfile.js b/gulpfile.js new file mode 120000 index 0000000..0f1e7d6 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1 @@ +gulp/gulpfile.js \ No newline at end of file diff --git a/nodemon.json b/nodemon.json new file mode 100644 index 0000000..91d1562 --- /dev/null +++ b/nodemon.json @@ -0,0 +1,11 @@ +{ + "ext": "js,dust", + "ignore": [ + "bower_components", + "gulp", + "node_modules", + "public", + "samples", + "src" + ] +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..2ad554a --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "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": { + "hats": "^0.2.0", + "epiphany": "0.6.1", + "ridge": "0.5.3", + "dustjs-linkedin": "^2.7.2" + } +} 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..75f9f1a --- /dev/null +++ b/server/config/globals.js @@ -0,0 +1,10 @@ +var path = require('path'); + +module.exports = function(bind) { + bind = bind || global; + + bind.ENV = process.env.NODE_ENV || 'development'; + bind.PWD = process.env.PWD; + //bind.LOGIN_USER = 'username'; + //bind.LOGIN_USER = 'email@domain.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/modules.js b/server/modules.js new file mode 100644 index 0000000..e99577f --- /dev/null +++ b/server/modules.js @@ -0,0 +1,13 @@ +module.exports = [ + // hats > hats + //'hats/base', + //'hats/admin', + //'hats/errors', + //'hats/organization', + //'hats/news', + //'hats/gallery', + //'hats/employees', + + // hats > project + //'./hats/events', +]; diff --git a/server/pages.js b/server/pages.js new file mode 100644 index 0000000..e9f3217 --- /dev/null +++ b/server/pages.js @@ -0,0 +1,30 @@ +module.exports = function(mw) { + return { + public: [ + { + title: 'Start', + template: 'pages/index', + path: '/' + }, { + title: 'Spytext' + }, { + title: 'Playground' + }, { + title: 'CSS', + name: 'css' + } + ], + + //redirects: [ + // [ '/coupon','/kupongen' ], + //], + + //admin: [ + // { + // title: 'Dashboard', + // path: '/', + // template: 'admin/pages/index' + // } + //] + }; +}; diff --git a/server/server.js b/server/server.js new file mode 100644 index 0000000..bc5c183 --- /dev/null +++ b/server/server.js @@ -0,0 +1,9 @@ +var Epiphany = require('epiphany'); + +var server = new Epiphany({ + modules: require('./modules'), + pages: require('./pages'), + start: false +}); + +server.start(); diff --git a/server/templates/error.dust b/server/templates/error.dust new file mode 100644 index 0000000..b611abf --- /dev/null +++ b/server/templates/error.dust @@ -0,0 +1,9 @@ +
+
+

Oops!

+

Ett problem har tyvärr uppstått.

+

{error.status} : {error.statusText}

+

{error.message}

+

{error.stack}
+
+
diff --git a/server/templates/master.dust b/server/templates/master.dust new file mode 100644 index 0000000..c10f378 --- /dev/null +++ b/server/templates/master.dust @@ -0,0 +1,62 @@ + + + + TCB IT & Development AB + + + + + + + + + + +
+
+
+
+

TCB IT & Development

+
+ {>"partials/navigation":navigation page=page /} +
+
+
+
+ +{?error} + {>"error"/} +{:else} + {?template} + {>"{template}"/} + {/template} +{/error} + +
+
+
+
Copyright TCB IT & Development AB
+
Website by TCB.
+
+
+ + + + + + + + + + + + + + + diff --git a/server/templates/pages/css.dust b/server/templates/pages/css.dust new file mode 100644 index 0000000..915f265 --- /dev/null +++ b/server/templates/pages/css.dust @@ -0,0 +1,23 @@ +
+
+

CSS playground

+
+
One
+
Two
+
Three
+
Four
+
+
+
One
+
Two
+
Three
+
Four
+
+
+
One
+
Two
+
Three
+
Four
+
+
+
diff --git a/server/templates/pages/d3.dust b/server/templates/pages/d3.dust new file mode 100644 index 0000000..54cebc2 --- /dev/null +++ b/server/templates/pages/d3.dust @@ -0,0 +1,26 @@ +
+
+

D3 Testing Area

+ +
+
+
One
+
Two
+
Three
+
Four
+
+
+
One
+
Two
+
Three
+
Four
+
+
+
One
+
Two
+
Three
+
Four
+
+
+
+
diff --git a/server/templates/pages/index.dust b/server/templates/pages/index.dust new file mode 100644 index 0000000..822908c --- /dev/null +++ b/server/templates/pages/index.dust @@ -0,0 +1,95 @@ +
+
+
+

Welcome / Välkommen!

+

The Code Bureau: Advanced Web Development & Design

+
+
+

The Code Bureau is a web development & design firm based in Lund, + Sweden. Unlike most other web designers/developers, all our employees + have a background in mathematics or computer science.

+

We make it our business to stay up to date on the latest + trends and technologies. The applications we create are always + state-of-the-art and built for the future. When you employ us, you wont need to update your + products for years.

+
+
+

We cater a range of different services to our customers; + always focusing on the development of code for the web. Our love for code + and the new possibilities of the web enable us to do almost anything. Just ask.

+

The Code Bureau is a fairly new venture, and as such we + are still building a portfolio of show cases. During this time we + are offering our services at greatly reduced prices.

+
+
+
+
+

What We Do

+
+
+

Web Pages

+

Obviously we create websites. Essentially everything we create are + web sites of varying complexity. However, we refer to web sites as our + entry level products that mainly focus on presentation of information without excessive functionality.

+
+
+

Web Apps

+

Web apps are advanced web sites that emulate functionality usually + found in native apps or programs.

+ +

Web apps have, unlike native apps, the benefit of running on all + computers and devices. The users only need a browser to access its + functionality.

+
+
+

Web Games

+

As the name suggests, web games are games made to run in a browser on any device.

+
+
+
+
+

Why Choose Us?

+
+
+
    +
  1. +

    We know code

    +

    Most web designers or developers are artistically creative individuals. However, + to create stable, reliable web sites and apps you need to know more than design. We + are a collection of individuals that both truly love and know code, computers and the web.

    +
  2. +
  3. +

    SEO

    +

    Search Engine Optimization is probably the most important + factor for a web sites success. It is also constantly changing, and your web sites + need to be updated constantly to stay ahead of the competition.

    +

    One of the most important factors for good SEO today is the speed + of your website. Using a framework like WordPress will doom you to a + slow web site with poor search engine performance. Our web sites + are many, many times faster than those built with WordPress or similar.

    +
  4. +
  5. +

    Future Proof

    +

    The internet and web browsers have become infinately more advanced the last few years. Web sites are quickly becoming + more like apps and the user experience can be greatly improved. Our love for code means we understand the trends, and can + make decisions that ensure our products will be up to date for years to come. No WordPress or PHP here.

    +
  6. +
+
+
+
+
+

Contact

+
+
+

+46 (0) 708 922 122

+ +

TCB IT & Development AB
+ Ideon Agora
+ + Scheelevägen 15
+ 22363 Lund
+ Sweden

+ +
+
diff --git a/server/templates/pages/mod.dust b/server/templates/pages/mod.dust new file mode 100644 index 0000000..dae23f5 --- /dev/null +++ b/server/templates/pages/mod.dust @@ -0,0 +1,20 @@ +
+
+

MOD

+ +
+
+
One
+
Two
+
Three
+
Four
+
+
+
One
+
Two
+
Three
+
Four
+
+
+
+
diff --git a/server/templates/pages/playground.dust b/server/templates/pages/playground.dust new file mode 100644 index 0000000..8638336 --- /dev/null +++ b/server/templates/pages/playground.dust @@ -0,0 +1,9 @@ +
+
+

Playground

+

aaabbbcccdddeeefffggghhh456




aaa

+

aaabbbcccdddeeefffggghhh456




aaa

+ +
+
+ diff --git a/server/templates/pages/spytext.dust b/server/templates/pages/spytext.dust new file mode 100644 index 0000000..ce84303 --- /dev/null +++ b/server/templates/pages/spytext.dust @@ -0,0 +1,128 @@ +
+
+

Spytext

+
+
+
+
+

AAABBBCCC

+

DDD

+

EEEFFFGGG

+

HHHIIIKKKLLLMMM

+
    +
  • NNN
  • +

  • +
  • OOO
  • +
+

PPP

+
    +
  • RRR
  • +
  • SSS
  • +
  • TTT
  • +
+
+
+
+
+

One lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas semper turpis eros, sed rhoncus purus sodales sit amet.

+

Two quisque lacus est, B TWO this is some bold molestie et diam id, varius sagittis nisi. Donec placerat mi egestas, congue ligula non, lacinia tortor.

+

Three aecenas B U THREE laskjdf id sodales dui. Nulla ipsum justo, elementum in fermentum at, feugiat nec neque.

+

Four vestibulum B tempor U dolor vitae risus faucibus elementum. Aliquam leo odio, convallis non luctus eu, faucibus vel lorem.

+
    +
  • Top Menu Item 1
  • +
  • Top Menu Item 2
  • +
  • Top Menu Item 3
  • +
  • Top Menu Item 4
  • +
  • Top Menu Item 5
  • +
+

Paragraph 1

+

Para
graph 2

+

Paragraph 3

+

Paragraph 4

+

Paragraph 5

+

Paragraph 6

+
    +
  • Middle Menu Item 1
  • +
  • Middle Menu Item 2
  • +
  • Middle Menu Item 3
  • +
  • Middle Menu Item 4
  • +
  • Middle Menu Item 5
  • +
+

Paragraph 1

+

Paragraph 2

+

Paragraph 3

+

Paragraph 4

+

Paragraph 5

+

Paragraph 6

+
    +
  • Bottom Menu Item 1
  • +
  • Bottom Menu Item 2
  • +
  • Bottom Menu Item 3
  • +
  • Bottom Menu Item 4
  • +
  • Bottom Menu Item 5
  • +
+
+
+
+
+

One lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas semper turpis eros, sed rhoncus purus sodales sit amet.

+

Two quisque lacus est, B TWO this is some bold molestie et diam id, varius sagittis nisi. Donec placerat mi egestas, congue ligula non, lacinia tortor.

+

Three aecenas B U THREE laskjdf id sodales dui. Nulla ipsum justo, elementum in fermentum at, feugiat nec neque.

+

Four vestibulum B tempor U dolor vitae risus faucibus elementum. Aliquam leo odio, convallis non luctus eu, faucibus vel lorem.

+
    +
  • test
  • +

  • +
  • test
  • +
+

Test

+
    +
  • test
  • +
  • test
  • +
  • test
  • +
+
+
+
+
+

Hello

+
    +
  • List Item 1
  • +
  • List Item 2
  • +
  • List Item 3
  • +
  • Sublist +
      +
    • Sublist Item 1
    • +
    • Sublist Item 2
    • +
    • Sublist Item 3
    • +
    • Sublist +
        +
      • Sublist Item 1
      • +
      • Sublist Item 2
      • +
      • Sublist Item 3
      • +
      +
    • +
    +
  • +
+

Test 1

+

Test 2

+

Test 3

+

Test 4

+

Test 5

+

Test 6

+

Test 7

+
    +
  • test
  • +

  • +
  • test
  • +
+

Test

+
    +
  • test
  • +
  • test
  • +
  • test
  • +
+
+
+
+
diff --git a/server/templates/spytext-toolbar.bak.dust b/server/templates/spytext-toolbar.bak.dust new file mode 100644 index 0000000..1ee100d --- /dev/null +++ b/server/templates/spytext-toolbar.bak.dust @@ -0,0 +1,332 @@ +module.exports = function() { + events: { + 'click button': 'command' + }, + + template: 'spytext-toolbar', + + command: function() { + var command = $(e.currentTarget).attr('data-command'); + } +}; +var SpytextButton = function(config, spytext) { + this.spytext = spytext; + this.config = typeof config.preset === 'string' ? merge(this.presets[config.preset], config) : config; + this.element = $(' + +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • + + + + + + diff --git a/src/js/admin/app.js b/src/js/admin/app.js new file mode 100644 index 0000000..e654cb7 --- /dev/null +++ b/src/js/admin/app.js @@ -0,0 +1,32 @@ +var Ridge = require('ridge'); + +var app = new Ridge({ + router: { + root: '/admin' + }, + templateRoot: 'admin/', + models: require('../models'), + collections: require('../collections'), + views: require('./views'), + modules: [ + // hats > native + //require('hats/admin'), + //require('hats/organization/admin'), + //require('hats/errors/admin'), + //require('hats/news/admin'), + //require('hats/gallery/admin'), + //require('hats/employees/admin'), + + // hats > project + //require('../../../hats/events/admin'), + //require('../../../hats/sponsors/admin') + ] +}); + +window.broadcast = _.extend({}, Backbone.Events); + +$(function() { + app.navigation = new app.views.Navigation({ el: app.$('nav') }); + + Backbone.history.start({ silent: true, pushState: true }); +}); diff --git a/src/js/admin/views/index.js b/src/js/admin/views/index.js new file mode 100644 index 0000000..b3cdf92 --- /dev/null +++ b/src/js/admin/views/index.js @@ -0,0 +1,6 @@ +module.exports = { + Page: require('ridge/views/page'), + Model: require('ridge/views/model'), + Collection: require('ridge/views/collection'), + Navigation: require('./navigation') +}; diff --git a/src/js/admin/views/navigation.js b/src/js/admin/views/navigation.js new file mode 100644 index 0000000..3e64699 --- /dev/null +++ b/src/js/admin/views/navigation.js @@ -0,0 +1,22 @@ +module.exports = { + initialize: function() { + this.listenTo(this.app.router, 'route', this.onRouteChange); + }, + + onRouteChange: function(route, params) { + this.$('li.current').removeClass('current'); + + var path = (params[0] || 'dashboard').split('/'); + + var $ref = this.$el.children('ul'); + + while($ref.length > 0 && path.length > 0) { + var $el = $ref.children('.' + path.shift()); + + $el.addClass('current'); + + $ref = $el.children('ul'); + } + }, + +}; diff --git a/src/js/app.js b/src/js/app.js new file mode 100644 index 0000000..84bcacc --- /dev/null +++ b/src/js/app.js @@ -0,0 +1,16 @@ +var Ridge = require('ridge'); + +var app = new Ridge({ + collections: require('./collections'), + models: require('./models'), + views: require('./views') +}); + +app.module(require('spytext')); + +$(function() { + app.navigation = new app.views.Navigation({ el: app.$('nav') }); + + Backbone.history.start({ silent: true, pushState: true }); +}); + diff --git a/src/js/collections/index.js b/src/js/collections/index.js new file mode 100644 index 0000000..7be35b6 --- /dev/null +++ b/src/js/collections/index.js @@ -0,0 +1,2 @@ +module.exports = { +}; diff --git a/src/js/models/index.js b/src/js/models/index.js new file mode 100644 index 0000000..7be35b6 --- /dev/null +++ b/src/js/models/index.js @@ -0,0 +1,2 @@ +module.exports = { +}; diff --git a/src/js/views/index.js b/src/js/views/index.js new file mode 100644 index 0000000..e3901f9 --- /dev/null +++ b/src/js/views/index.js @@ -0,0 +1,6 @@ +module.exports = { + Page: require('ridge/views/page'), + Message: require('ridge/views/message'), + Navigation: require('./navigation'), + TreeWalker: require('./tree-walker') +}; diff --git a/src/js/views/navigation.js b/src/js/views/navigation.js new file mode 100644 index 0000000..418c050 --- /dev/null +++ b/src/js/views/navigation.js @@ -0,0 +1,53 @@ +module.exports = { + events: { + 'mouseover ul': 'dud', + 'mouseout ul': 'dud', + 'click i, div.cover, ul': 'toggleMobile', + }, + + toggleMobile: function(e) { + if(document.body.clientWidth < 640) { + this.$('ul').toggleClass('show').on('touchmove', function(e) { + e.preventDefault(); + }); + $(document.body).toggleClass('push'); + // breaks iOS: + this.$('div.cover').toggleClass('active'); + } + }, + + dud: function() { + var $element = this.$('li:hover'), + left, width; + + if($element.length === 0) + $element = this.$('li.current'); + + this.$el.children('.dud').toggleClass('active', $element.length !== 0).css({ + left: $element.length === 0 ? '' : $element[0].offsetLeft + 'px', + width: $element.length === 0 ? 0 : $element.width() + 'px' + }); + }, + + initialize: function(options) { + this.listenTo(this.app.router, 'route', this.onRouteChange); + }, + + attach: function() { + // wait for fonts to load + setTimeout(this.dud.bind(this), 300); + }, + + onRouteChange: function(route, params) { + $(document.body).removeClass('push'); + + var path = params[0]; + + path = path ? path.split('/')[0] : 'index'; + + this.$('li.current').removeClass('current'); + this.$('li.' + path).addClass('current'); + + this.dud(); + } +}; diff --git a/src/js/views/spytext.js b/src/js/views/spytext.js new file mode 100644 index 0000000..58d83df --- /dev/null +++ b/src/js/views/spytext.js @@ -0,0 +1,18 @@ +var Spytext = require('spytext'); + +module.exports = { + events: { + }, + + attach: function() { + var _view = this; + + _view.$('[data-spytext]').each(function(i, el) { + // TODO clear previous spytext fields + if(!_view.spytext) _view.spytext = new Spytext(); + + _view.spytext.addField(el); + }); + + } +}; diff --git a/src/js/views/tree-walker.js b/src/js/views/tree-walker.js new file mode 100644 index 0000000..83f22c0 --- /dev/null +++ b/src/js/views/tree-walker.js @@ -0,0 +1,53 @@ +var s = window.getSelection; +var selectron = require('spytext/selectron'); + +function offsetold(node, value, root) { + value = value || 0; + root = root || document.body; + + var tw = document.createTreeWalker(root); + var last = tw.currentNode = node; + + while(tw.previousNode() !== tw.root) { + //!getComputedStyle(node).display.match(/inline/); + var nodeType = tw.currentNode.nodeType; + if(nodeType === 1 && ( + last.nodeType === 1 && last === tw.currentNode.nextSibling || + last.nodeType === 3 && last === tw.currentNode.firstChild + ) || + nodeType === 3 && last !== tw.currentNode.nextSibling) + value++; + + if(tw.currentNode.nodeType === 3) { + value += tw.currentNode.textContent.length; + } + + //console.log(tw.currentNode); + //console.log('value: ' + value); + last = tw.currentNode; + } + + return value; +} + + +module.exports = { + attach: function() { + console.log('attach'); + var $root = this.$('#tree-walker'); + $root.on('keydown', function(e) { + if (e.ctrlKey && e.keyCode === 65) { + e.preventDefault(); + console.log(selectron.getOffset($root[0])); + //console.log(selectron.restore($root[0], selectron.getOffset($root[0]) + 1)); + var positions = selectron.get($root[0]); + s().removeAllRanges(); + setTimeout(function() { + selectron.set(positions); + }, 1000); + + } + }); + + } +}; diff --git a/src/sass/_content.scss b/src/sass/_content.scss new file mode 100644 index 0000000..d9d1f8d --- /dev/null +++ b/src/sass/_content.scss @@ -0,0 +1,20 @@ + +/* --------- MOD ------------------ */ + +div.mod { + .container { + width: 100%; + min-height: 300px; + > div { + float: left; + width: 25%; + min-height: 200px; + border: 1px solid black; + } + } +} +form.spytext { + .spytext-field { + min-height: 300px; + } +} diff --git a/src/sass/_layout.scss b/src/sass/_layout.scss new file mode 100644 index 0000000..329bae6 --- /dev/null +++ b/src/sass/_layout.scss @@ -0,0 +1,41 @@ +nav { + > ul { + @include wipe-list; + > li { + padding: 0 10px; + float: left; + &:first-child { padding-left: 0; } + } + } +} + +body { + overflow-x: hidden; + overflow-y: scroll; + > main { + overflow-x: hidden; + width: 100%; + max-width: $row-max-width; + margin: 0 auto; + > .page { + width: 100%; + &.animate { + transition: opacity 0.2s ease-out; + float: left; + position: relative; + } + &.leave { + margin-right: -100%; + } + &.leave.active { + opacity: 0; + } + &.enter { + opacity: 0; + } + &.enter.active, &.leave { + opacity: 1; + } + } + } +} diff --git a/src/sass/_variables_spysass.scss b/src/sass/_variables_spysass.scss new file mode 100644 index 0000000..2d3e42b --- /dev/null +++ b/src/sass/_variables_spysass.scss @@ -0,0 +1,78 @@ +// required for rem() and em() to work in this file +@import "spysass/functions"; + +// +// Base +// + +//$include-reset: true; +//$include-normalize: false; + +//$make-image-inline-block: false; +//$default-float: left; +//$opposite-direction: right; +//$text-direction: left; +//$global-radius: 0; +//$make-image-inline-block: false; + +//$color-main-1: #0066c6; +//$color-message: #333; +//$color-error: #c90000; +//$color-success: #628b1c; + +// This needs to be a px value since rem and em-calc use it. It is translated +// to a percante unit for html and body font-sizing like so: strip-unit($base-font-size) / 16 * 100%; +//$base-font-size: 16px; +//$base-line-height: 1.6; +//$base-line-height-computed: $base-line-height * 1rem; + +//$body-font-color: #222; +//$body-font-family: "Times New Roman", sans-serif; +//$body-font-weight: normal; +//$body-font-style: normal; +//$body-bg: #fff; + +//$font-smoothing: subpixel-antialiased; + +// Need to be in pixels for IE8 +//$small-range: 0px, 639px; +//$medium-range: 640px, 1023px; +//$large-range: 1024px, 1439px; +//$xlarge-range: 1440px, 1920px; +//$xxlarge-range: 1921px, 999999px; + +// +// Grid +// + +//$column-gutter: rem(30); +//$row-width: rem(1000); +//$total-columns: 12; + +// +// Type +// + +//$heading-font-family: $body-font-family; +//$heading-font-weight: bold; +//$heading-font-style: normal; +//$heading-font-color: $body-font-color; +//$heading-text-rendering: optimizeLegibility; +//$heading-top-margin: $base-line-height-computed; +//$heading-bottom-margin: $base-line-height-computed / 2; +//$heading-line-height: 1.2; + +//$h1-font-size: 2.5rem;//40px when base-font-size is 16px +//$h2-font-size: 2.0rem;//32px when base-font-size is 16px +//$h3-font-size: 1.7rem;//27.2px when base-font-size is 16px +//$h4-font-size: 1.4rem;//22.4px when base-font-size is 16px +//$h5-font-size: 1.2rem;//19.2px when base-font-size is 16px +//$h6-font-size: 1.0rem; + +//$paragraph-font-family: $body-font-family; +//$paragraph-font-weight: normal; +//$paragraph-font-size: 1.0rem; +//$paragraph-line-height: $base-line-height; +//$paragraph-margin: 0 0 ($base-line-height-computed / 2); +//$paragraph-text-rendering: optimizeLegibility; + diff --git a/src/sass/admin/main.scss b/src/sass/admin/main.scss new file mode 100644 index 0000000..69e93f8 --- /dev/null +++ b/src/sass/admin/main.scss @@ -0,0 +1,2 @@ +@import 'spysass'; +@import 'themes/admin/one'; diff --git a/src/sass/main.scss b/src/sass/main.scss new file mode 100644 index 0000000..bd137de --- /dev/null +++ b/src/sass/main.scss @@ -0,0 +1,15 @@ +@import "spysass"; + +@import "components/type"; +@import "components/grid"; + +@import "themes/spytext/niknus"; +@import "themes/form/foundation"; + +@import "layout"; +@import "content"; + +#tree-walker { + padding: 15px; + border: 1px solid black; +} diff --git a/src/static/robots.txt b/src/static/robots.txt new file mode 100644 index 0000000..adc3595 --- /dev/null +++ b/src/static/robots.txt @@ -0,0 +1,3 @@ +User-agent: * +Disallow: /admin/ +Disallow: /api/