├── views ├── index.ejs ├── error.ejs ├── sbindex.ejs ├── registrationError.ejs ├── _registration_status.ejs ├── admin_nav.ejs ├── registration.ejs ├── ads │ └── show.ejs ├── history.ejs ├── auction.ejs └── ai_auctions.ejs ├── Procfile ├── Procfile-dev ├── auctionTest ├── .gitignore ├── config.json └── package.json ├── public ├── images │ ├── favicon.ico │ └── subtlenet2.png ├── css │ └── bootstrap │ │ └── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff └── scripts │ └── codemirror │ ├── theme │ ├── ambiance-mobile.css │ ├── neat.css │ ├── elegant.css │ ├── eclipse.css │ ├── cobalt.css │ ├── monokai.css │ ├── night.css │ ├── the-matrix.css │ ├── rubyblue.css │ ├── mbo.css │ ├── blackboard.css │ ├── 3024-day.css │ ├── paraiso-dark.css │ ├── 3024-night.css │ ├── paraiso-light.css │ ├── base16-dark.css │ ├── vibrant-ink.css │ ├── base16-light.css │ ├── twilight.css │ ├── midnight.css │ ├── erlang-dark.css │ ├── tomorrow-night-eighties.css │ ├── pastel-on-dark.css │ ├── xq-light.css │ └── lesser-dark.css │ ├── addon │ ├── display │ │ ├── fullscreen.css │ │ ├── fullscreen.js │ │ └── placeholder.js │ ├── fold │ │ ├── foldgutter.css │ │ ├── indent-fold.js │ │ └── comment-fold.js │ ├── edit │ │ ├── trailingspace.js │ │ ├── continuelist.js │ │ └── matchtags.js │ ├── lint │ │ ├── json-lint.js │ │ ├── css-lint.js │ │ └── coffeescript-lint.js │ ├── dialog │ │ └── dialog.css │ ├── mode │ │ ├── multiplex_test.js │ │ ├── loadmode.js │ │ └── overlay.js │ ├── hint │ │ ├── show-hint.css │ │ ├── anyword-hint.js │ │ └── css-hint.js │ ├── runmode │ │ ├── colorize.js │ │ └── runmode.js │ ├── scroll │ │ └── scrollpastend.js │ ├── tern │ │ ├── worker.js │ │ └── tern.css │ ├── selection │ │ └── active-line.js │ └── comment │ │ └── continuecomment.js │ ├── mode │ ├── rpm │ │ ├── spec │ │ │ └── spec.css │ │ └── changes │ │ │ ├── changes.js │ │ │ └── index.html │ ├── tiddlywiki │ │ └── tiddlywiki.css │ ├── tiki │ │ ├── tiki.css │ │ └── index.html │ ├── diff │ │ └── diff.js │ ├── ntriples │ │ └── index.html │ ├── http │ │ └── index.html │ ├── jinja2 │ │ ├── index.html │ │ └── jinja2.js │ ├── z80 │ │ └── index.html │ ├── ecl │ │ └── index.html │ ├── rust │ │ └── index.html │ ├── pascal │ │ └── index.html │ ├── pig │ │ └── index.html │ ├── turtle │ │ └── index.html │ ├── vbscript │ │ └── index.html │ ├── gherkin │ │ └── index.html │ ├── properties │ │ ├── index.html │ │ └── properties.js │ ├── javascript │ │ └── typescript.html │ ├── sparql │ │ └── index.html │ ├── sass │ │ └── index.html │ ├── perl │ │ └── index.html │ ├── css │ │ ├── less_test.js │ │ └── index.html │ ├── shell │ │ └── index.html │ ├── gas │ │ └── index.html │ ├── toml │ │ └── index.html │ ├── pegjs │ │ └── index.html │ ├── smalltalk │ │ └── index.html │ ├── xml │ │ └── index.html │ ├── php │ │ └── index.html │ ├── octave │ │ └── index.html │ ├── htmlembedded │ │ └── index.html │ ├── apl │ │ └── index.html │ ├── haml │ │ └── index.html │ ├── yaml │ │ └── index.html │ ├── lua │ │ └── index.html │ ├── erlang │ │ └── index.html │ ├── haskell │ │ └── index.html │ └── go │ │ └── index.html │ └── keymap │ └── extra.js ├── start.sh ├── .gitignore ├── setupdb.js ├── resque ├── jobs.js ├── auction_closing.js └── auction_recalculation.js ├── model ├── factoids.js ├── userAds.js ├── bid.js ├── ad.js ├── reservedAds.js ├── auctions.js ├── reservedAd.js ├── profileUser.js ├── ai_invoices.js ├── auction.js ├── bids.js ├── auctionUser.js ├── userBidsPerRegion.js ├── reviewAds.js ├── approvedAds.js ├── rejectedAds.js ├── randomFactoid.js └── auctionsTimeRelative.js ├── middleware ├── browse-prefix.js ├── ensure-auth.js ├── model-loader.js └── conditional-csrf.js ├── routes ├── api │ ├── index.js │ └── bids.js ├── rules.js ├── ad_upload.js ├── history.js ├── registration.js ├── bid.js └── factoids.js ├── repl.js ├── deployment └── adness-api.service ├── .travis.yml ├── deploy.conf ├── Dockerfile ├── test ├── smf-migration.js └── biddingAlgorithmTest.js ├── email-templates ├── reg-admin-paid.ejs ├── invalid-bid.ejs ├── user-invalidated.ejs ├── winner-admin-paid.ejs ├── reg-user-paid.ejs ├── notify-bidders.ejs ├── winner-user-paid.ejs ├── notify-winners.ejs ├── notify-winners-modified.ejs └── registration.ejs ├── index.js ├── model.js ├── package.json └── passport.js /views/index.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: node index.js 2 | -------------------------------------------------------------------------------- /Procfile-dev: -------------------------------------------------------------------------------- 1 | web: nodemon index.js 2 | -------------------------------------------------------------------------------- /auctionTest/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ -------------------------------------------------------------------------------- /public/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slickage/adness/HEAD/public/images/favicon.ico -------------------------------------------------------------------------------- /start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | export DB_URL=http://couchdb:5984 3 | 4 | cd /src 5 | node index 6 | 7 | -------------------------------------------------------------------------------- /public/images/subtlenet2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slickage/adness/HEAD/public/images/subtlenet2.png -------------------------------------------------------------------------------- /views/error.ejs: -------------------------------------------------------------------------------- 1 | <% layout('sblayout') %> 2 |
3 |

<%= errorMsg %>

4 |
-------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | tmp/* 4 | .npm-debug.log 5 | public/assets 6 | .vagrant 7 | .env 8 | /id_deploy 9 | -------------------------------------------------------------------------------- /public/css/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slickage/adness/HEAD/public/css/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /public/css/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slickage/adness/HEAD/public/css/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /public/css/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/slickage/adness/HEAD/public/css/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /auctionTest/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "numberOfUsers" : 4, 3 | "numberOfSlots" : 10, 4 | "timeLength" : 1, 5 | "btcStep" : 0.25, 6 | "timeInterval" : 1000 7 | } 8 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/ambiance-mobile.css: -------------------------------------------------------------------------------- 1 | .cm-s-ambiance.CodeMirror { 2 | -webkit-box-shadow: none; 3 | -moz-box-shadow: none; 4 | box-shadow: none; 5 | } 6 | -------------------------------------------------------------------------------- /setupdb.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var dbinit = require('./db-init'); 5 | 6 | // Setup Database without running adness 7 | dbinit.validateDBExist(function() {}); -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/display/fullscreen.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-fullscreen { 2 | position: fixed; 3 | top: 0; left: 0; right: 0; bottom: 0; 4 | height: auto; 5 | z-index: 9; 6 | } 7 | -------------------------------------------------------------------------------- /resque/jobs.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | module.exports = { 5 | 'auction_closing': { perform: require('./auction_closing') }, 6 | 'recalculation': { perform: require('./auction_recalculation') } 7 | }; 8 | -------------------------------------------------------------------------------- /model/factoids.js: -------------------------------------------------------------------------------- 1 | var db = require(__dirname + '/../db'); 2 | module.exports = function(req, cb) { 3 | db.getFactoids(function(err, facts) { 4 | if (err) { return cb(err, undefined); } 5 | if (facts) { return cb(null, facts); } 6 | }); 7 | }; -------------------------------------------------------------------------------- /middleware/browse-prefix.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var config = require(__dirname + '/../config'); 5 | 6 | module.exports = function(req, res, next) { 7 | req.browsePrefix = config.sbPrefix; 8 | return next(); 9 | }; 10 | -------------------------------------------------------------------------------- /model/userAds.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | db.getUserAds(req.params.userId, function(err, ads) { 7 | if (!err) { cb(null, ads); } 8 | else { cb(err, []); } 9 | }); 10 | }; -------------------------------------------------------------------------------- /model/bid.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | db.getBid(req.params.bidId, function(err, auction) { 7 | if (!err) { cb(null, auction); } 8 | else { cb(err, undefined); } 9 | }); 10 | }; -------------------------------------------------------------------------------- /middleware/ensure-auth.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var config = require(__dirname + '/../config'); 5 | 6 | module.exports = function(req, res, next) { 7 | if (req.isAuthenticated()) { 8 | return next(); 9 | } 10 | res.redirect(config.sbPrefix + '/'); 11 | }; 12 | -------------------------------------------------------------------------------- /routes/api/index.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var express = require('express'); 5 | var api = express.Router(); 6 | 7 | require(__dirname + '/auctions')(api); 8 | require(__dirname + '/bids')(api); 9 | require(__dirname + '/ads')(api); 10 | 11 | module.exports = api; 12 | -------------------------------------------------------------------------------- /model/ad.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | // database call 7 | db.getAd(req.params.adId, function(err, ad) { 8 | if (!err) { cb(null, ad); } 9 | else { cb(err, undefined); } 10 | }); 11 | }; -------------------------------------------------------------------------------- /model/reservedAds.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | db.getReservedAds(function(err, ads) { 7 | if (err) { return cb(err, undefined); } 8 | if (ads) { return cb(null, ads); } 9 | }); 10 | }; -------------------------------------------------------------------------------- /repl.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /* jshint node: true */ 3 | 'use strict'; 4 | 5 | var repl = require('repl'); 6 | var db = require('./db'); 7 | var closing = require('./events/auction-close'); 8 | 9 | var local = repl.start('adness> '); 10 | local.context.db = db; 11 | local.context.closing = closing; 12 | -------------------------------------------------------------------------------- /middleware/model-loader.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | //'use strict'; 3 | // FIXME: need jshint config to exclude modelLoader 4 | 5 | var MC = require(__dirname + '/../model'); 6 | 7 | module.exports = modelLoader = function(req, res, next) { 8 | req.model = res.model = new MC(); 9 | next(); 10 | }; 11 | -------------------------------------------------------------------------------- /deployment/adness-api.service: -------------------------------------------------------------------------------- 1 | [Service] 2 | ExecStart=/usr/bin/node /home/deploy/adness-api/current/index.js 3 | Restart=always 4 | StandardOutput=syslog 5 | SyslogIdentifier=adness-api 6 | User=deploy 7 | Group=deploy 8 | Environment=PATH=/usr/bin:/usr/local/bin 9 | 10 | [Install] 11 | WantedBy=multi-user.target 12 | -------------------------------------------------------------------------------- /model/auctions.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | // database call 7 | db.allAuctions(function(err, auctions) { 8 | if (!err) { cb(null, auctions); } 9 | else { cb(err, undefined); } 10 | }); 11 | }; 12 | -------------------------------------------------------------------------------- /model/reservedAd.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | db.getReservedAd(req.params.reservedAdId, function(err, ad) { 7 | if (err) { return cb(err, undefined); } 8 | if (ad) { return cb(null, ad); } 9 | }); 10 | }; -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/rpm/spec/spec.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-preamble {color: #b26818; font-weight: bold;} 2 | .cm-s-default span.cm-macro {color: #b218b2;} 3 | .cm-s-default span.cm-section {color: green; font-weight: bold;} 4 | .cm-s-default span.cm-script {color: red;} 5 | .cm-s-default span.cm-issue {color: yellow;} 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config 3 | language: node_js 4 | node_js: 5 | - 0.10 6 | notifications: 7 | email: 8 | - jw@slickage.com 9 | - ed@slickage.com 10 | - julie@slickage.com 11 | - anthony@slickage.com 12 | - warren@slickage.com 13 | 14 | -------------------------------------------------------------------------------- /model/profileUser.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | var userId = req.params.userId; 7 | db.getAuctionUser(userId, function(err, user) { 8 | if (!err) { cb(null, user); } 9 | else { cb(null, undefined); } 10 | }); 11 | }; -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/tiddlywiki/tiddlywiki.css: -------------------------------------------------------------------------------- 1 | span.cm-underlined { 2 | text-decoration: underline; 3 | } 4 | span.cm-strikethrough { 5 | text-decoration: line-through; 6 | } 7 | span.cm-brace { 8 | color: #170; 9 | font-weight: bold; 10 | } 11 | span.cm-table { 12 | color: blue; 13 | font-weight: bold; 14 | } 15 | -------------------------------------------------------------------------------- /model/ai_invoices.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | // database call 7 | db.getAuctionInvoices(req.params.auctionId, function(err, invoices) { 8 | if (!err) { cb(null, invoices); } 9 | else { cb(err, undefined); } 10 | }); 11 | }; 12 | -------------------------------------------------------------------------------- /model/auction.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | // database call 7 | db.getAuction(req.params.auctionId, function(err, auction) { 8 | if (!err) { db.appendBidsToAuction(auction, cb); } 9 | else { cb(err, undefined); } 10 | }); 11 | }; -------------------------------------------------------------------------------- /model/bids.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | // database call 7 | db.getBidsPerAuction(req.params.auctionId, function(err, auction) { 8 | if (!err) { cb(null, auction); } 9 | else { cb(err, undefined); } 10 | }); 11 | }; 12 | 13 | -------------------------------------------------------------------------------- /deploy.conf: -------------------------------------------------------------------------------- 1 | [staging] 2 | key ./id_deploy 3 | user deploy 4 | host staging.bitcointalk.org 5 | repo git://github.com/slickage/adness.git 6 | path /home/deploy/adness 7 | ref origin/master 8 | 9 | [prod] 10 | key ./id_deploy 11 | user deploy 12 | host adnessprod 13 | repo git://github.com/slickage/adness.git 14 | path /home/deploy/adness 15 | ref origin/master 16 | 17 | -------------------------------------------------------------------------------- /model/auctionUser.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | module.exports = function(req, cb) { 6 | // always return something 7 | if (!req.user) { return cb(null, undefined); } 8 | db.getAuctionUser(req.user.userId, function(err, user) { 9 | if (!err) { cb(null, user); } 10 | else { cb(null, undefined); } 11 | }); 12 | }; -------------------------------------------------------------------------------- /routes/rules.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var moment = require('moment'); 5 | 6 | module.exports = function(req, res) { 7 | 8 | // serverTime 9 | var serverTime = moment().utc().format('YYYY MMMM D, h:mm:ss A ZZ'); 10 | 11 | res.render('rules', { 12 | serverTime: serverTime, 13 | browsePrefix: req.browsePrefix, 14 | user: req.user 15 | }); 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:6.4 2 | 3 | # Enable EPEL for Node.js 4 | RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm 5 | # Install Node.js and npm 6 | RUN yum install -y npm 7 | RUN yum install git -y 8 | 9 | # Bundle app source 10 | ADD . /src 11 | # Install app dependencies 12 | RUN cd /src; npm install 13 | EXPOSE 8080 14 | 15 | CMD ["/bin/bash", "/src/start.sh"] 16 | -------------------------------------------------------------------------------- /views/sbindex.ejs: -------------------------------------------------------------------------------- 1 | <% layout('sblayout') %> 2 | 3 |
4 | <% include _registration_status %> 5 | <% if (auctionsOpen.length > 0) { %> 6 | 7 | <% auctionsOpen.forEach(function(auction) { %> 8 | <% include auctions/index_show %> 9 | <% }) %> 10 | <% } else { %> 11 | 12 |

13 | There are no open auctions today. Check back later. 14 |

15 |
16 | 17 | <% } %> 18 | -------------------------------------------------------------------------------- /model/userBidsPerRegion.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | 6 | module.exports = function(req, cb) { 7 | var userId = req.user.userId; 8 | var auctionId = req.body.auctionId; 9 | var region = req.body.region; 10 | db.getUserBidsPerRegion(auctionId, region, userId, function(err, bids) { 11 | if (err) { return cb(err, []); } 12 | else { return cb(null, bids); } 13 | }); 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /middleware/conditional-csrf.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var csrf = require('csurf'); 5 | 6 | module.exports = function(req, res, next) { 7 | // don't generate CSRF if api route 8 | if ( null !== req.path.match(/^\/api/) ) { 9 | return next(); 10 | } 11 | else if ( null !== req.path.match(/^\/hooks/) ) { 12 | return next(); 13 | } 14 | else { 15 | (csrf())(req, res, function(err) { 16 | res.locals.csrftoken = req.csrfToken(); 17 | return next(err); 18 | }); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /test/smf-migration.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var test = require('tap').test; 5 | require(__dirname + '/../integration/smf-auth.js'); 6 | 7 | test('Auth via PHP\'s CRYPT_SHA256', function (t) { 8 | var shacrypt = require('shacrypt'); 9 | var password = 'slickage1234'; 10 | var hash = '$5$rounds=7500$HYtR7tBVVIhaEOG3$aTD.SlfiUow2KcGJJ0fABo3y7GLGS.pr3vlZLCW8Cj1'; 11 | var result = shacrypt.sha256crypt(password, hash); 12 | t.ok(true, hash === result); 13 | t.end(); // but it must match the plan! 14 | }); 15 | -------------------------------------------------------------------------------- /routes/ad_upload.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var _ = require('lodash'); 5 | var config = require('../config'); 6 | 7 | exports = module.exports = function(req, res) { 8 | req.model.load('ad', req); 9 | req.model.end(function(err, models) { 10 | if (err) { console.log(err); } 11 | 12 | // cull regions 13 | var regions = _.pluck(config.regions, 'name'); 14 | res.render('ad_upload', { 15 | ad: models.ad, 16 | regions: regions, 17 | browsePrefix: req.browsePrefix, 18 | user: req.user 19 | }); 20 | }); 21 | }; 22 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/fold/foldgutter.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-foldmarker { 2 | color: blue; 3 | text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; 4 | font-family: arial; 5 | line-height: .3; 6 | cursor: pointer; 7 | } 8 | .CodeMirror-foldgutter { 9 | width: .7em; 10 | } 11 | .CodeMirror-foldgutter-open, 12 | .CodeMirror-foldgutter-folded { 13 | color: #555; 14 | cursor: pointer; 15 | } 16 | .CodeMirror-foldgutter-open:after { 17 | content: "\25BE"; 18 | } 19 | .CodeMirror-foldgutter-folded:after { 20 | content: "\25B8"; 21 | } 22 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/tiki/tiki.css: -------------------------------------------------------------------------------- 1 | .cm-tw-syntaxerror { 2 | color: #FFF; 3 | background-color: #900; 4 | } 5 | 6 | .cm-tw-deleted { 7 | text-decoration: line-through; 8 | } 9 | 10 | .cm-tw-header5 { 11 | font-weight: bold; 12 | } 13 | .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ 14 | padding-left: 10px; 15 | } 16 | 17 | .cm-tw-box { 18 | border-top-width: 0px ! important; 19 | border-style: solid; 20 | border-width: 1px; 21 | border-color: inherit; 22 | } 23 | 24 | .cm-tw-underline { 25 | text-decoration: underline; 26 | } -------------------------------------------------------------------------------- /resque/auction_closing.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | var timer = require('../events/event-timer'); 6 | 7 | module.exports = function(callback) { 8 | // get all auctions in full (with trueEnd property) 9 | db.fullAuctions(function(err, auctions) { 10 | if (err) { console.log(err); callback(null, false); } 11 | else { 12 | // for each auction 13 | auctions.forEach(function(auction) { 14 | timer.addAuction(auction); 15 | }); 16 | callback(null, true); 17 | } 18 | }); 19 | }; 20 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/edit/trailingspace.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) { 2 | if (prev == CodeMirror.Init) prev = false; 3 | if (prev && !val) 4 | cm.removeOverlay("trailingspace"); 5 | else if (!prev && val) 6 | cm.addOverlay({ 7 | token: function(stream) { 8 | for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {} 9 | if (i > stream.pos) { stream.pos = i; return null; } 10 | stream.pos = l; 11 | return "trailingspace"; 12 | }, 13 | name: "trailingspace" 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /views/registrationError.ejs: -------------------------------------------------------------------------------- 1 | <% layout('sblayout') %> 2 | 3 |
4 | 5 |
6 | 7 |
8 | 9 |
10 | Auction Registration Error 11 |
12 | 13 |
14 | We were not able to register you! 15 |

16 | Here's something to email to an administrator:
17 |
18 | <%= err %> 19 |
20 |
21 | 22 |
23 | 24 |
25 | 26 |
-------------------------------------------------------------------------------- /email-templates/reg-admin-paid.ejs: -------------------------------------------------------------------------------- 1 |

Registration Fee Paid for <%= username %>

2 | 3 |
4 | 5 |
6 | The auction system has been notified that the registration fee for <%= username %> has been paid. Here is the URL to the original invoice: 7 |

8 | 9 | Click here to view the invoice. 10 | 11 |

12 | Once they have put an advertisement into rotation (if they haven't done so already), they will be allowed to bid on auctions. 13 |
14 | 15 |

16 | 17 | This is a automated email. Please do not reply to this email. -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/lint/json-lint.js: -------------------------------------------------------------------------------- 1 | // Depends on jsonlint.js from https://github.com/zaach/jsonlint 2 | 3 | // declare global: jsonlint 4 | 5 | CodeMirror.registerHelper("lint", "json", function(text) { 6 | var found = []; 7 | jsonlint.parseError = function(str, hash) { 8 | var loc = hash.loc; 9 | found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column), 10 | to: CodeMirror.Pos(loc.last_line - 1, loc.last_column), 11 | message: str}); 12 | }; 13 | try { jsonlint.parse(text); } 14 | catch(e) {} 15 | return found; 16 | }); 17 | CodeMirror.jsonValidator = CodeMirror.lint.json; // deprecated 18 | -------------------------------------------------------------------------------- /views/_registration_status.ejs: -------------------------------------------------------------------------------- 1 | <% if (user) { %> 2 |
style="padding-bottom: 15px;" <% } %>> 3 | <% if (userMessage) { %> 4 | Current Account Status: 5 | 6 | <%- userMessage %> 7 | 8 | <% } else if (!registered) { %> 9 |
10 | 11 | 14 |
15 | <% } %> 16 |
17 | <% } %> -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/dialog/dialog.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-dialog { 2 | position: absolute; 3 | left: 0; right: 0; 4 | background: white; 5 | z-index: 15; 6 | padding: .1em .8em; 7 | overflow: hidden; 8 | color: #333; 9 | } 10 | 11 | .CodeMirror-dialog-top { 12 | border-bottom: 1px solid #eee; 13 | top: 0; 14 | } 15 | 16 | .CodeMirror-dialog-bottom { 17 | border-top: 1px solid #eee; 18 | bottom: 0; 19 | } 20 | 21 | .CodeMirror-dialog input { 22 | border: none; 23 | outline: none; 24 | background: transparent; 25 | width: 20em; 26 | color: inherit; 27 | font-family: monospace; 28 | } 29 | 30 | .CodeMirror-dialog button { 31 | font-size: 70%; 32 | } 33 | -------------------------------------------------------------------------------- /auctionTest/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "auctionTest", 3 | "version": "0.0.1", 4 | "description": "A test case for the auction bid system", 5 | "main": "app.js", 6 | "dependencies": { 7 | "charlatan": "~0.1.9", 8 | "request": "~2.33.0" 9 | }, 10 | "devDependencies": {}, 11 | "scripts": { 12 | "test": "echo \"Error: no test specified\" && exit 1" 13 | }, 14 | "repository": { 15 | "type": "git", 16 | "url": "https://github.com/slickage/smf" 17 | }, 18 | "keywords": [ 19 | "auction" 20 | ], 21 | "author": "Edward Kim", 22 | "license": "ISC", 23 | "bugs": { 24 | "url": "https://github.com/slickage/smf/issues" 25 | }, 26 | "homepage": "https://github.com/slickage/smf" 27 | } 28 | -------------------------------------------------------------------------------- /views/admin_nav.ejs: -------------------------------------------------------------------------------- 1 | 24 |
  • 25 | Auction Invoices 26 |
  • -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/rpm/changes/changes.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("changes", function() { 2 | var headerSeperator = /^-+$/; 3 | var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /; 4 | var simpleEmail = /^[\w+.-]+@[\w.-]+/; 5 | 6 | return { 7 | token: function(stream) { 8 | if (stream.sol()) { 9 | if (stream.match(headerSeperator)) { return 'tag'; } 10 | if (stream.match(headerLine)) { return 'tag'; } 11 | } 12 | if (stream.match(simpleEmail)) { return 'string'; } 13 | stream.next(); 14 | return null; 15 | } 16 | }; 17 | }); 18 | 19 | CodeMirror.defineMIME("text/x-rpm-changes", "changes"); 20 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/lint/css-lint.js: -------------------------------------------------------------------------------- 1 | // Depends on csslint.js from https://github.com/stubbornella/csslint 2 | 3 | // declare global: CSSLint 4 | 5 | CodeMirror.registerHelper("lint", "css", function(text) { 6 | var found = []; 7 | var results = CSSLint.verify(text), messages = results.messages, message = null; 8 | for ( var i = 0; i < messages.length; i++) { 9 | message = messages[i]; 10 | var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col; 11 | found.push({ 12 | from: CodeMirror.Pos(startLine, startCol), 13 | to: CodeMirror.Pos(endLine, endCol), 14 | message: message.message, 15 | severity : message.type 16 | }); 17 | } 18 | return found; 19 | }); 20 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/neat.css: -------------------------------------------------------------------------------- 1 | .cm-s-neat span.cm-comment { color: #a86; } 2 | .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } 3 | .cm-s-neat span.cm-string { color: #a22; } 4 | .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } 5 | .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } 6 | .cm-s-neat span.cm-variable { color: black; } 7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } 8 | .cm-s-neat span.cm-meta {color: #555;} 9 | .cm-s-neat span.cm-link { color: #3a3; } 10 | 11 | .cm-s-neat .CodeMirror-activeline-background {background: #e8f2ff !important;} 12 | .cm-s-neat .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;} 13 | -------------------------------------------------------------------------------- /model/reviewAds.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | var _ = require('lodash'); 6 | 7 | module.exports = function(req, cb) { 8 | db.getReviewAds(function(err, adsAndUsers) { 9 | if (err) { return cb(err, []); } 10 | else { 11 | // since we're using linked documents 12 | // we have a combination of ads and users 13 | 14 | // separate out users 15 | var users = []; 16 | users = _.remove(adsAndUsers, function(item) { 17 | return item.type === 'auctionUser'; 18 | }); 19 | 20 | // the rest is ads 21 | var ads = adsAndUsers; 22 | 23 | var results = { ads: ads, users: users }; 24 | return cb(null, results); 25 | } 26 | }); 27 | }; 28 | -------------------------------------------------------------------------------- /model/approvedAds.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | var _ = require('lodash'); 6 | 7 | module.exports = function(req, cb) { 8 | db.getApprovedAds(function(err, adsAndUsers) { 9 | if (err) { return cb(err, []); } 10 | else { 11 | // since we're using linked documents 12 | // we have a combination of ads and users 13 | 14 | // separate out users 15 | var users = []; 16 | users = _.remove(adsAndUsers, function(item) { 17 | return item.type === 'auctionUser'; 18 | }); 19 | 20 | // the rest is ads 21 | var ads = adsAndUsers; 22 | 23 | var results = { ads: ads, users: users }; 24 | return cb(null, results); 25 | } 26 | }); 27 | }; 28 | -------------------------------------------------------------------------------- /model/rejectedAds.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | var _ = require('lodash'); 6 | 7 | module.exports = function(req, cb) { 8 | db.getRejectedAds(function(err, adsAndUsers) { 9 | if (err) { return cb(err, []); } 10 | else { 11 | // since we're using linked documents 12 | // we have a combination of ads and users 13 | 14 | // separate out users 15 | var users = []; 16 | users = _.remove(adsAndUsers, function(item) { 17 | return item.type === 'auctionUser'; 18 | }); 19 | 20 | // the rest is ads 21 | var ads = adsAndUsers; 22 | 23 | var results = { ads: ads, users: users }; 24 | return cb(null, results); 25 | } 26 | }); 27 | }; 28 | -------------------------------------------------------------------------------- /email-templates/invalid-bid.ejs: -------------------------------------------------------------------------------- 1 | 2 |
    3 | Your bid has been removed from auction <%= auctionId %> 4 |
    5 | One or more of your bids has been removed by an administrator. If you didn't already know about this, then you should be contacted shortly with more info. 6 |

    7 | 8 | <% if (invoices && invoices.length > 0) { %> 9 | Here is a list of invalidated invoices:
    10 | <% invoices.forEach(function(invoice) { %> 11 | <%= invoice %>
    12 | <% }) %> 13 |
    If you have already paid an invalidated invoice, contact an administator for a refund. 14 | <% } %> 15 |
    16 | 17 |

    18 | Thank you for participating in this auction. 19 |

    20 | 21 | This is a automated email. Please do not reply to this email. -------------------------------------------------------------------------------- /email-templates/user-invalidated.ejs: -------------------------------------------------------------------------------- 1 | 2 |
    3 | You have been removed from auction <%= auctionId %> 4 |
    5 | An administrator has found your bids or your ads to be in violation of the terms of this auction. For this reason, all of your bids and invoices for this auction in region <%= region %> have been invalidated. If you have already paid an invoice, please contact an administator for a refund. We apologize for the inconvenience. 6 |

    7 | 8 | Here is a list of invalidated bids and invoices:
    9 | <% results.forEach(function(result) { %> 10 | <%= result %>
    11 | <% }) %> 12 |
    13 | 14 |

    15 | Thank you for participating in this auction. 16 |

    17 | 18 | This is a automated email. Please do not reply to this email. -------------------------------------------------------------------------------- /email-templates/winner-admin-paid.ejs: -------------------------------------------------------------------------------- 1 |

    Auction Invoice for <%= username %> has been paid

    2 | 3 |
    4 | 5 |
    6 | <%= username %> has paid the invoice sent for winning the slot(s) in auction <%= auctionId %>. A link to the original invoice is include. Please double check that the payment was made. The invoice also includes the address the payment was sent to. 7 |

    8 | 9 | Click here to view the invoice. 10 | 11 |

    12 | A link to the <%= username %>'s ads can be found below:
    13 | 14 | <%= username %>'s Ads 15 | 16 |
    17 | 18 |

    19 | 20 | This is a automated email. Please do not reply to this email. -------------------------------------------------------------------------------- /model/randomFactoid.js: -------------------------------------------------------------------------------- 1 | var db = require(__dirname + '/../db'); 2 | var _ = require('lodash'); 3 | 4 | module.exports = function(req, cb) { 5 | db.getFactoids(function(err, facts) { 6 | if (err) { 7 | console.log('There were no Factoids found. Returning error Factoid.'); 8 | var emptyFact = {}; 9 | emptyFact.css = ''; 10 | emptyFact.html = '
    There are no Factoids.
    '; 11 | return cb(null, emptyFact); 12 | } 13 | 14 | if (facts) { 15 | // pick a fact at random 16 | var randomFact = _.sample(facts.list); 17 | 18 | // edit html with fact 19 | facts.html = facts.html.replace('<%- text %>', randomFact.text); 20 | 21 | // return random fact 22 | delete facts.list; 23 | return cb(null, facts); 24 | } 25 | }); 26 | }; -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/elegant.css: -------------------------------------------------------------------------------- 1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} 2 | .cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;} 3 | .cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;} 4 | .cm-s-elegant span.cm-variable {color: black;} 5 | .cm-s-elegant span.cm-variable-2 {color: #b11;} 6 | .cm-s-elegant span.cm-qualifier {color: #555;} 7 | .cm-s-elegant span.cm-keyword {color: #730;} 8 | .cm-s-elegant span.cm-builtin {color: #30a;} 9 | .cm-s-elegant span.cm-link {color: #762;} 10 | .cm-s-elegant span.cm-error {background-color: #fdd;} 11 | 12 | .cm-s-elegant .CodeMirror-activeline-background {background: #e8f2ff !important;} 13 | .cm-s-elegant .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;} 14 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/diff/diff.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("diff", function() { 2 | 3 | var TOKEN_NAMES = { 4 | '+': 'positive', 5 | '-': 'negative', 6 | '@': 'meta' 7 | }; 8 | 9 | return { 10 | token: function(stream) { 11 | var tw_pos = stream.string.search(/[\t ]+?$/); 12 | 13 | if (!stream.sol() || tw_pos === 0) { 14 | stream.skipToEnd(); 15 | return ("error " + ( 16 | TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, ''); 17 | } 18 | 19 | var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd(); 20 | 21 | if (tw_pos === -1) { 22 | stream.skipToEnd(); 23 | } else { 24 | stream.pos = tw_pos; 25 | } 26 | 27 | return token_name; 28 | } 29 | }; 30 | }); 31 | 32 | CodeMirror.defineMIME("text/x-diff", "diff"); 33 | -------------------------------------------------------------------------------- /views/registration.ejs: -------------------------------------------------------------------------------- 1 | <% layout('sblayout') %> 2 | 3 |
    4 | 5 |
    6 | 7 |
    8 | Auction Registration 9 |
    10 | 11 |
    12 | You have started the registration process! 13 |

    14 | An email will be sent with instructions on paying the registration fee. Upon receiving your payment, your registration status will be updated. 15 |

    16 | In order to bid on auctions, you must also create an advertisement (if you have not done so already), have it approved by an admin, and then put it into rotation from your profile page. If you have not already created an advertisement, please do so now from the profile page. 17 |
    18 | 19 |
    20 | 21 |
    -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/mode/multiplex_test.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | CodeMirror.defineMode("markdown_with_stex", function(){ 3 | var inner = CodeMirror.getMode({}, "stex"); 4 | var outer = CodeMirror.getMode({}, "markdown"); 5 | 6 | var innerOptions = { 7 | open: '$', 8 | close: '$', 9 | mode: inner, 10 | delimStyle: 'delim', 11 | innerStyle: 'inner' 12 | }; 13 | 14 | return CodeMirror.multiplexingMode(outer, innerOptions); 15 | }); 16 | 17 | var mode = CodeMirror.getMode({}, "markdown_with_stex"); 18 | 19 | function MT(name) { 20 | test.mode( 21 | name, 22 | mode, 23 | Array.prototype.slice.call(arguments, 1), 24 | 'multiplexing'); 25 | } 26 | 27 | MT( 28 | "stexInsideMarkdown", 29 | "[strong **Equation:**] [delim $][inner&tag \\pi][delim $]"); 30 | })(); 31 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/hint/show-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-hints { 2 | position: absolute; 3 | z-index: 10; 4 | overflow: hidden; 5 | list-style: none; 6 | 7 | margin: 0; 8 | padding: 2px; 9 | 10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 13 | border-radius: 3px; 14 | border: 1px solid silver; 15 | 16 | background: white; 17 | font-size: 90%; 18 | font-family: monospace; 19 | 20 | max-height: 20em; 21 | overflow-y: auto; 22 | } 23 | 24 | .CodeMirror-hint { 25 | margin: 0; 26 | padding: 0 4px; 27 | border-radius: 2px; 28 | max-width: 19em; 29 | overflow: hidden; 30 | white-space: pre; 31 | color: black; 32 | cursor: pointer; 33 | } 34 | 35 | .CodeMirror-hint-active { 36 | background: #08f; 37 | color: white; 38 | } 39 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/edit/continuelist.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 'use strict'; 3 | 4 | var listRE = /^(\s*)([*+-]|(\d+)\.)(\s*)/, 5 | unorderedBullets = '*+-'; 6 | 7 | CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) { 8 | if (cm.getOption("disableInput")) return CodeMirror.Pass; 9 | 10 | var pos = cm.getCursor(), 11 | inList = cm.getStateAfter(pos.line).list !== false, 12 | match; 13 | 14 | if (!inList || !(match = cm.getLine(pos.line).match(listRE))) { 15 | cm.execCommand('newlineAndIndent'); 16 | return; 17 | } 18 | 19 | var indent = match[1], after = match[4]; 20 | var bullet = unorderedBullets.indexOf(match[2]) >= 0 21 | ? match[2] 22 | : (parseInt(match[3], 10) + 1) + '.'; 23 | 24 | cm.replaceSelection('\n' + indent + bullet + after, 'end'); 25 | }; 26 | 27 | }()); 28 | -------------------------------------------------------------------------------- /email-templates/reg-user-paid.ejs: -------------------------------------------------------------------------------- 1 |

    Your Registration Fee has been Processed

    2 | 3 |
    4 | 5 |
    6 | The auction system has received your registration fee.
    7 | Here is the URL to the original invoice: 8 |

    9 | 10 | Click here to view the invoice. 11 | 12 |

    13 | Next Steps:
    14 | - If you have not already done so, create and submit an advertisement via your profile page.
    15 | - Once it's been approved, put the approved advertisement into rotation by clicking on the advertisement on your profile page and clicking the "Add to rotation" button.
    16 | - Once you have an advertisement in rotation, you will be allowed to bid on auctions. 17 |
    18 | 19 |

    20 | 21 | This is a automated email. Please do not reply to this email. -------------------------------------------------------------------------------- /resque/auction_recalculation.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | var timer = require('../events/event-timer'); 6 | 7 | module.exports = function(callback) { 8 | // get all recalculations 9 | db.getRecalculations(function(err, recalculations) { 10 | if (err) { console.log(err); callback(null, false); } 11 | else { 12 | // for each auction 13 | recalculations.forEach(function(recalculation) { 14 | if (!recalculation.finished) { 15 | // adjust time if already expired 16 | var now = new Date().getTime(); 17 | if (recalculation.expiration < now) { 18 | recalculation.expiration = now + 1000 * 5; 19 | } 20 | 21 | timer.addRecalculation(recalculation); 22 | } 23 | }); 24 | 25 | return callback(null, true); 26 | } 27 | }); 28 | }; 29 | -------------------------------------------------------------------------------- /email-templates/notify-bidders.ejs: -------------------------------------------------------------------------------- 1 |
    2 | The most recent bitcointalk.org ad auction has ended. Thanks for participating! If you've won any ad slots in the auction, a separate email will be sent to you with instructions on how to make your payment. Additionally, if you had a reasonably high bid when the auction ended, but not all of your bids were filled, then you should keep your eyes open for emails over the next 24 hours in case one of the winning advertisers doesn't pay and you are next in line to pick up these extra slots. Extra slots are discounted, sometimes substantially. 3 |

    4 | <% if (nextAuction) { %> 5 | The next available auction will take place at <%= new Date(nextAuction.start).toUTCString() %>. 6 | <% } else { %> 7 | There are no auctions currently planned for the immediate future. 8 | <% } %> 9 |
    10 | 11 |

    12 | This is a automated email. Please do not reply to this email. -------------------------------------------------------------------------------- /email-templates/winner-user-paid.ejs: -------------------------------------------------------------------------------- 1 |
    2 | Your payment for auction <%= auctionId %> has been received. A link to the original invoice is included. Note that additional payments may be required if you won slots in several regions or if you also won extra slots. (You'll have received additional emails if this is the case.) 3 |

    4 | 5 | Click here to view the invoice. 6 | 7 |

    8 | Now that you've won, please remember to review you advertisements and ensure the correct number of advertisements are set to your rotation on your profile page. If you have less advertisements then the number of slots you've won, random multiples of the same ad will be displayed. If you have more advertisements than the number of slots you've won, a random selection of ads will be used. 9 |
    10 | 11 |

    12 | 13 | This is a automated email. Please do not reply to this email. -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/runmode/colorize.js: -------------------------------------------------------------------------------- 1 | CodeMirror.colorize = (function() { 2 | 3 | var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/; 4 | 5 | function textContent(node, out) { 6 | if (node.nodeType == 3) return out.push(node.nodeValue); 7 | for (var ch = node.firstChild; ch; ch = ch.nextSibling) { 8 | textContent(ch, out); 9 | if (isBlock.test(node.nodeType)) out.push("\n"); 10 | } 11 | } 12 | 13 | return function(collection, defaultMode) { 14 | if (!collection) collection = document.body.getElementsByTagName("pre"); 15 | 16 | for (var i = 0; i < collection.length; ++i) { 17 | var node = collection[i]; 18 | var mode = node.getAttribute("data-lang") || defaultMode; 19 | if (!mode) continue; 20 | 21 | var text = []; 22 | textContent(node, text); 23 | node.innerHTML = ""; 24 | CodeMirror.runMode(text.join(""), mode, node); 25 | 26 | node.className += " cm-s-default"; 27 | } 28 | }; 29 | })(); 30 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/lint/coffeescript-lint.js: -------------------------------------------------------------------------------- 1 | // Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js 2 | 3 | // declare global: coffeelint 4 | 5 | CodeMirror.registerHelper("lint", "coffeescript", function(text) { 6 | var found = []; 7 | var parseError = function(err) { 8 | var loc = err.lineNumber; 9 | found.push({from: CodeMirror.Pos(loc-1, 0), 10 | to: CodeMirror.Pos(loc, 0), 11 | severity: err.level, 12 | message: err.message}); 13 | }; 14 | try { 15 | var res = coffeelint.lint(text); 16 | for(var i = 0; i < res.length; i++) { 17 | parseError(res[i]); 18 | } 19 | } catch(e) { 20 | found.push({from: CodeMirror.Pos(e.location.first_line, 0), 21 | to: CodeMirror.Pos(e.location.last_line, e.location.last_column), 22 | severity: 'error', 23 | message: e.message}); 24 | } 25 | return found; 26 | }); 27 | CodeMirror.coffeeValidator = CodeMirror.lint.coffeescript; // deprecated 28 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var config = require('./config'); 5 | var async = require('async'); 6 | var dbinit = require('./db-init'); 7 | 8 | // Initialization Sanity Checks 9 | async.waterfall([ 10 | validateSessionSecret, 11 | dbinit.validateDBExist, 12 | dbinit.checkDBVersion, 13 | ], 14 | function(err) { 15 | if (err) { 16 | console.log('Adness Init ' + err); 17 | process.exit(1); 18 | } 19 | else { buildSite(); } 20 | } 21 | ); 22 | 23 | function validateSessionSecret(cb) { 24 | var secret = config.sessionSecret; 25 | var error = null; 26 | 27 | if (secret === 'secret string for adness 1234!') { 28 | var message = 'Do not use the default SESSION_SECRET'; 29 | error = new Error(message); 30 | } 31 | 32 | return cb(error); 33 | } 34 | 35 | function buildSite() { 36 | var site = require('./site'); 37 | if (config.debugMode) { console.log('Config: ' + JSON.stringify(config)); } 38 | site.listen(config.port); 39 | console.log('Listening at: http://0.0.0.0:' + config.port); 40 | } -------------------------------------------------------------------------------- /views/ads/show.ejs: -------------------------------------------------------------------------------- 1 |
    2 |
    3 | 4 |
    5 | 6 | Ad: 7 | 8 | <%= ad._id %> 9 | 10 | 11 | <% if (user && user.admin === true) { %> 12 | 13 |
    Edit
    14 |
    15 | <% } %> 16 |
    17 |

    18 | Regions: 19 | <%= ad.regions %> 20 |

    21 |
    22 | 23 |
    24 | Ad HTML:
    25 | <%=: ad.html | replace:/&/gi,'&' %> 26 |

    27 | Ad CSS:
    28 | <%= ad.css %> 29 |
    30 | 31 |
    32 | 33 |
    34 | Ad Preview (without css applied):
    35 | <%- ad.html %> 36 |
    37 | 38 |
    39 |
    -------------------------------------------------------------------------------- /model.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var MC = module.exports = require('emcee'); 5 | MC.model('auctions', require('./model/auctions')); 6 | MC.model('auction', require('./model/auction')); 7 | MC.model('auctionsTimeRelative', require('./model/auctionsTimeRelative')); 8 | MC.model('bids', require('./model/bids')); 9 | MC.model('bid', require('./model/bid')); 10 | MC.model('ad', require('./model/ad')); 11 | MC.model('userAds', require('./model/userAds')); 12 | MC.model('reviewAds', require('./model/reviewAds')); 13 | MC.model('approvedAds', require('./model/approvedAds')); 14 | MC.model('rejectedAds', require('./model/rejectedAds')); 15 | MC.model('auctionUser', require('./model/auctionUser')); 16 | MC.model('profileUser', require('./model/profileUser')); 17 | MC.model('auction_invoices', require('./model/ai_invoices')); 18 | MC.model('reservedAd', require('./model/reservedAd')); 19 | MC.model('reservedAds', require('./model/reservedAds')); 20 | MC.model('factoids', require('./model/factoids')); 21 | MC.model('randomFactoid', require('./model/randomFactoid')); 22 | MC.model('userBidsPerRegion', require('./model/userBidsPerRegion')); 23 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/scroll/scrollpastend.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | 4 | CodeMirror.defineOption("scrollPastEnd", false, function(cm, val, old) { 5 | if (old && old != CodeMirror.Init) { 6 | cm.off("change", onChange); 7 | cm.display.lineSpace.parentNode.style.paddingBottom = ""; 8 | cm.state.scrollPastEndPadding = null; 9 | } 10 | if (val) { 11 | cm.on("change", onChange); 12 | updateBottomMargin(cm); 13 | } 14 | }); 15 | 16 | function onChange(cm, change) { 17 | if (CodeMirror.changeEnd(change).line == cm.lastLine()) 18 | updateBottomMargin(cm); 19 | } 20 | 21 | function updateBottomMargin(cm) { 22 | var padding = ""; 23 | if (cm.lineCount() > 1) { 24 | var totalH = cm.display.scroller.clientHeight - 30, 25 | lastLineH = cm.getLineHandle(cm.lastLine()).height; 26 | padding = (totalH - lastLineH) + "px"; 27 | } 28 | if (cm.state.scrollPastEndPadding != padding) { 29 | cm.state.scrollPastEndPadding = padding; 30 | cm.display.lineSpace.parentNode.style.paddingBottom = padding; 31 | cm.setSize(); 32 | } 33 | } 34 | })(); 35 | -------------------------------------------------------------------------------- /views/history.ejs: -------------------------------------------------------------------------------- 1 | <% layout('sblayout') %> 2 |
    3 | 4 |

    5 | Auction History 6 |

    7 | 8 | Final Auction Results 9 | (Sorted by Auction End Time) 10 |
    11 | 12 | <% auctions.forEach(function(auction) { %> 13 |
    14 |
    15 |
    16 | Auction: 17 | 18 | <%= auction._id %> 19 | 20 |
    21 |
    22 | Start: 23 | <%= auction.start %> 24 |
    25 | End: 26 | <%= auction.end %> 27 | <% if (auction.regions) { %> 28 |
    29 | Regions: 30 | <% auction.regions.forEach(function(region) { %> 31 | <%= region.name %> 32 | <% }) %> 33 | <% } %> 34 |
    35 |
    36 |
    37 | <% }) %> 38 | 39 |
    -------------------------------------------------------------------------------- /email-templates/notify-winners.ejs: -------------------------------------------------------------------------------- 1 | You've won <%= user.lineItems.length %> ad slot(s) in auction <%= auctionId %>! 2 | 3 |
    4 | 5 |
    6 | Now that the auction has ended, please promptly pay for the slot(s) you've won using the invoice link below. This invoice will expire on: <%= expiration %>. If you do not pay in time, you will lose your slots, and you may be banned from future ad auctions. 7 |

    8 | 9 | Click here to view your invoice. 10 | 11 |

    12 | Please ensure that the ads you want on the forum are in rotation. Ads submitted and approved but not marked "in rotation" will not be advertised. Once your payment clears and the ad period begins, ads marked "In Rotation" on your profile page will start being displayed in the forum's ad area. If you have more ads than slots, then the forum will randomly rotate between your ads. Your ads can be updated during the ad period, though modifications and new ads require approval. 13 |
    14 | 15 |

    16 | Thanks for participating in this auction! 17 |

    18 | 19 | This is a automated email. Please do not reply to this email. -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/display/fullscreen.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | 4 | CodeMirror.defineOption("fullScreen", false, function(cm, val, old) { 5 | if (old == CodeMirror.Init) old = false; 6 | if (!old == !val) return; 7 | if (val) setFullscreen(cm); 8 | else setNormal(cm); 9 | }); 10 | 11 | function setFullscreen(cm) { 12 | var wrap = cm.getWrapperElement(); 13 | cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, 14 | width: wrap.style.width, height: wrap.style.height}; 15 | wrap.style.width = ""; 16 | wrap.style.height = "auto"; 17 | wrap.className += " CodeMirror-fullscreen"; 18 | document.documentElement.style.overflow = "hidden"; 19 | cm.refresh(); 20 | } 21 | 22 | function setNormal(cm) { 23 | var wrap = cm.getWrapperElement(); 24 | wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, ""); 25 | document.documentElement.style.overflow = ""; 26 | var info = cm.state.fullScreenRestore; 27 | wrap.style.width = info.width; wrap.style.height = info.height; 28 | window.scrollTo(info.scrollLeft, info.scrollTop); 29 | cm.refresh(); 30 | } 31 | })(); 32 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/eclipse.css: -------------------------------------------------------------------------------- 1 | .cm-s-eclipse span.cm-meta {color: #FF1717;} 2 | .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } 3 | .cm-s-eclipse span.cm-atom {color: #219;} 4 | .cm-s-eclipse span.cm-number {color: #164;} 5 | .cm-s-eclipse span.cm-def {color: #00f;} 6 | .cm-s-eclipse span.cm-variable {color: black;} 7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;} 8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;} 9 | .cm-s-eclipse span.cm-property {color: black;} 10 | .cm-s-eclipse span.cm-operator {color: black;} 11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;} 12 | .cm-s-eclipse span.cm-string {color: #2A00FF;} 13 | .cm-s-eclipse span.cm-string-2 {color: #f50;} 14 | .cm-s-eclipse span.cm-qualifier {color: #555;} 15 | .cm-s-eclipse span.cm-builtin {color: #30a;} 16 | .cm-s-eclipse span.cm-bracket {color: #cc7;} 17 | .cm-s-eclipse span.cm-tag {color: #170;} 18 | .cm-s-eclipse span.cm-attribute {color: #00c;} 19 | .cm-s-eclipse span.cm-link {color: #219;} 20 | .cm-s-eclipse span.cm-error {color: #f00;} 21 | 22 | .cm-s-eclipse .CodeMirror-activeline-background {background: #e8f2ff !important;} 23 | .cm-s-eclipse .CodeMirror-matchingbracket {outline:1px solid grey; color:black !important;} 24 | -------------------------------------------------------------------------------- /routes/history.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var _ = require('lodash'); 5 | var moment = require('moment'); 6 | 7 | module.exports = function(req, res) { 8 | req.model.load('auctionsTimeRelative', req); 9 | req.model.end(function(err, models) { 10 | if (err) { console.log('error: ' + JSON.stringify(err)); } 11 | 12 | var auctions = models.auctionsTimeRelative.past; 13 | var sortedPast = _.sortBy(auctions, function(auction) { 14 | return -auction.end; 15 | }); 16 | 17 | sortedPast.forEach(function(auction) { 18 | var startTime = moment(auction.start).utc().format('YYYY MMMM D, h:mm:ss A ZZ'); 19 | var endTime = moment(auction.end).utc().format('YYYY MMMM D, h:mm:ss A ZZ'); 20 | startTime += ' (' + moment(auction.start).fromNow() +')'; 21 | endTime += ' (' + moment(auction.end).fromNow() + ')'; 22 | auction.start = startTime; 23 | auction.end = endTime; 24 | }); 25 | 26 | // serverTime 27 | var serverTime = moment().utc().format('YYYY MMMM D, h:mm:ss A ZZ'); 28 | 29 | res.render('history', { 30 | auctions: sortedPast, 31 | serverTime: serverTime, 32 | browsePrefix: req.browsePrefix, 33 | user: req.user 34 | }); 35 | }); 36 | }; 37 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/tern/worker.js: -------------------------------------------------------------------------------- 1 | // declare global: tern, server 2 | 3 | var server; 4 | 5 | this.onmessage = function(e) { 6 | var data = e.data; 7 | switch (data.type) { 8 | case "init": return startServer(data.defs, data.plugins, data.scripts); 9 | case "add": return server.addFile(data.name, data.text); 10 | case "del": return server.delFile(data.name); 11 | case "req": return server.request(data.body, function(err, reqData) { 12 | postMessage({id: data.id, body: reqData, err: err && String(err)}); 13 | }); 14 | case "getFile": 15 | var c = pending[data.id]; 16 | delete pending[data.id]; 17 | return c(data.err, data.text); 18 | default: throw new Error("Unknown message type: " + data.type); 19 | } 20 | }; 21 | 22 | var nextId = 0, pending = {}; 23 | function getFile(file, c) { 24 | postMessage({type: "getFile", name: file, id: ++nextId}); 25 | pending[nextId] = c; 26 | } 27 | 28 | function startServer(defs, plugins, scripts) { 29 | if (scripts) importScripts.apply(null, scripts); 30 | 31 | server = new tern.Server({ 32 | getFile: getFile, 33 | async: true, 34 | defs: defs, 35 | plugins: plugins 36 | }); 37 | } 38 | 39 | var console = { 40 | log: function(v) { postMessage({type: "debug", message: v}); } 41 | }; 42 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/cobalt.css: -------------------------------------------------------------------------------- 1 | .cm-s-cobalt.CodeMirror { background: #002240; color: white; } 2 | .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; } 5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-cobalt span.cm-comment { color: #08f; } 8 | .cm-s-cobalt span.cm-atom { color: #845dc4; } 9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } 10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; } 11 | .cm-s-cobalt span.cm-string { color: #3ad900; } 12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; } 13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } 14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } 15 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; } 16 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } 17 | .cm-s-cobalt span.cm-link { color: #845dc4; } 18 | .cm-s-cobalt span.cm-error { color: #9d1e15; } 19 | 20 | .cm-s-cobalt .CodeMirror-activeline-background {background: #002D57 !important;} 21 | .cm-s-cobalt .CodeMirror-matchingbracket {outline:1px solid grey;color:white !important} 22 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/monokai.css: -------------------------------------------------------------------------------- 1 | /* Based on Sublime Text's Monokai theme */ 2 | 3 | .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;} 4 | .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} 5 | .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;} 6 | .cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;} 7 | .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;} 8 | 9 | .cm-s-monokai span.cm-comment {color: #75715e;} 10 | .cm-s-monokai span.cm-atom {color: #ae81ff;} 11 | .cm-s-monokai span.cm-number {color: #ae81ff;} 12 | 13 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;} 14 | .cm-s-monokai span.cm-keyword {color: #f92672;} 15 | .cm-s-monokai span.cm-string {color: #e6db74;} 16 | 17 | .cm-s-monokai span.cm-variable {color: #a6e22e;} 18 | .cm-s-monokai span.cm-variable-2 {color: #9effff;} 19 | .cm-s-monokai span.cm-def {color: #fd971f;} 20 | .cm-s-monokai span.cm-bracket {color: #f8f8f2;} 21 | .cm-s-monokai span.cm-tag {color: #f92672;} 22 | .cm-s-monokai span.cm-link {color: #ae81ff;} 23 | .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;} 24 | 25 | .cm-s-monokai .CodeMirror-activeline-background {background: #373831 !important;} 26 | .cm-s-monokai .CodeMirror-matchingbracket { 27 | text-decoration: underline; 28 | color: white !important; 29 | } 30 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/fold/indent-fold.js: -------------------------------------------------------------------------------- 1 | CodeMirror.registerHelper("fold", "indent", function(cm, start) { 2 | var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line); 3 | if (!/\S/.test(firstLine)) return; 4 | var getIndent = function(line) { 5 | return CodeMirror.countColumn(line, null, tabSize); 6 | }; 7 | var myIndent = getIndent(firstLine); 8 | var lastLineInFold = null; 9 | // Go through lines until we find a line that definitely doesn't belong in 10 | // the block we're folding, or to the end. 11 | for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) { 12 | var curLine = cm.getLine(i); 13 | var curIndent = getIndent(curLine); 14 | if (curIndent > myIndent) { 15 | // Lines with a greater indent are considered part of the block. 16 | lastLineInFold = i; 17 | } else if (!/\S/.test(curLine)) { 18 | // Empty lines might be breaks within the block we're trying to fold. 19 | } else { 20 | // A non-empty line at an indent equal to or less than ours marks the 21 | // start of another block. 22 | break; 23 | } 24 | } 25 | if (lastLineInFold) return { 26 | from: CodeMirror.Pos(start.line, firstLine.length), 27 | to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length) 28 | }; 29 | }); 30 | CodeMirror.indentRangeFinder = CodeMirror.fold.indent; // deprecated 31 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/night.css: -------------------------------------------------------------------------------- 1 | /* Loosely based on the Midnight Textmate theme */ 2 | 3 | .cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; } 4 | .cm-s-night div.CodeMirror-selected { background: #447 !important; } 5 | .cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } 6 | .cm-s-night .CodeMirror-linenumber { color: #f8f8f8; } 7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-night span.cm-comment { color: #6900a1; } 10 | .cm-s-night span.cm-atom { color: #845dc4; } 11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } 12 | .cm-s-night span.cm-keyword { color: #599eff; } 13 | .cm-s-night span.cm-string { color: #37f14a; } 14 | .cm-s-night span.cm-meta { color: #7678e2; } 15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } 16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } 17 | .cm-s-night span.cm-bracket { color: #8da6ce; } 18 | .cm-s-night span.cm-comment { color: #6900a1; } 19 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } 20 | .cm-s-night span.cm-link { color: #845dc4; } 21 | .cm-s-night span.cm-error { color: #9d1e15; } 22 | 23 | .cm-s-night .CodeMirror-activeline-background {background: #1C005A !important;} 24 | .cm-s-night .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} 25 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/hint/anyword-hint.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | 4 | var WORD = /[\w$]+/, RANGE = 500; 5 | 6 | CodeMirror.registerHelper("hint", "anyword", function(editor, options) { 7 | var word = options && options.word || WORD; 8 | var range = options && options.range || RANGE; 9 | var cur = editor.getCursor(), curLine = editor.getLine(cur.line); 10 | var start = cur.ch, end = start; 11 | while (end < curLine.length && word.test(curLine.charAt(end))) ++end; 12 | while (start && word.test(curLine.charAt(start - 1))) --start; 13 | var curWord = start != end && curLine.slice(start, end); 14 | 15 | var list = [], seen = {}; 16 | var re = new RegExp(word.source, "g"); 17 | for (var dir = -1; dir <= 1; dir += 2) { 18 | var line = cur.line, end = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir; 19 | for (; line != end; line += dir) { 20 | var text = editor.getLine(line), m; 21 | while (m = re.exec(text)) { 22 | if (line == cur.line && m[0] === curWord) continue; 23 | if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) { 24 | seen[m[0]] = true; 25 | list.push(m[0]); 26 | } 27 | } 28 | } 29 | } 30 | return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)}; 31 | }); 32 | })(); 33 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/the-matrix.css: -------------------------------------------------------------------------------- 1 | .cm-s-the-matrix.CodeMirror { background: #000000; color: #00FF00; } 2 | .cm-s-the-matrix div.CodeMirror-selected { background: #2D2D2D !important; } 3 | .cm-s-the-matrix .CodeMirror-gutters { background: #060; border-right: 2px solid #00FF00; } 4 | .cm-s-the-matrix .CodeMirror-linenumber { color: #FFFFFF; } 5 | .cm-s-the-matrix .CodeMirror-cursor { border-left: 1px solid #00FF00 !important; } 6 | 7 | .cm-s-the-matrix span.cm-keyword {color: #008803; font-weight: bold;} 8 | .cm-s-the-matrix span.cm-atom {color: #3FF;} 9 | .cm-s-the-matrix span.cm-number {color: #FFB94F;} 10 | .cm-s-the-matrix span.cm-def {color: #99C;} 11 | .cm-s-the-matrix span.cm-variable {color: #F6C;} 12 | .cm-s-the-matrix span.cm-variable-2 {color: #C6F;} 13 | .cm-s-the-matrix span.cm-variable-3 {color: #96F;} 14 | .cm-s-the-matrix span.cm-property {color: #62FFA0;} 15 | .cm-s-the-matrix span.cm-operator {color: #999} 16 | .cm-s-the-matrix span.cm-comment {color: #CCCCCC;} 17 | .cm-s-the-matrix span.cm-string {color: #39C;} 18 | .cm-s-the-matrix span.cm-meta {color: #C9F;} 19 | .cm-s-the-matrix span.cm-qualifier {color: #FFF700;} 20 | .cm-s-the-matrix span.cm-builtin {color: #30a;} 21 | .cm-s-the-matrix span.cm-bracket {color: #cc7;} 22 | .cm-s-the-matrix span.cm-tag {color: #FFBD40;} 23 | .cm-s-the-matrix span.cm-attribute {color: #FFF700;} 24 | .cm-s-the-matrix span.cm-error {color: #FF0000;} 25 | 26 | .cm-s-the-matrix .CodeMirror-activeline-background {background: #040;} 27 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/rubyblue.css: -------------------------------------------------------------------------------- 1 | .cm-s-rubyblue { font-family: Trebuchet, Verdana, sans-serif; } /* - customized editor font - */ 2 | 3 | .cm-s-rubyblue.CodeMirror { background: #112435; color: white; } 4 | .cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; } 5 | .cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; } 6 | .cm-s-rubyblue .CodeMirror-linenumber { color: white; } 7 | .cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; } 10 | .cm-s-rubyblue span.cm-atom { color: #F4C20B; } 11 | .cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; } 12 | .cm-s-rubyblue span.cm-keyword { color: #F0F; } 13 | .cm-s-rubyblue span.cm-string { color: #F08047; } 14 | .cm-s-rubyblue span.cm-meta { color: #F0F; } 15 | .cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; } 16 | .cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; } 17 | .cm-s-rubyblue span.cm-bracket { color: #F0F; } 18 | .cm-s-rubyblue span.cm-link { color: #F4C20B; } 19 | .cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; } 20 | .cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; } 21 | .cm-s-rubyblue span.cm-error { color: #AF2018; } 22 | 23 | .cm-s-rubyblue .CodeMirror-activeline-background {background: #173047 !important;} 24 | -------------------------------------------------------------------------------- /routes/registration.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var registration = require('../registration'); 5 | var moment = require('moment'); 6 | 7 | exports = module.exports = function(req, res) { 8 | req.model.load('auctionUser', req); 9 | req.model.end(function(err, models) { 10 | var view = 'registration'; 11 | var error = ''; 12 | 13 | // serverTime 14 | var serverTime = moment().utc().format('YYYY MMMM D, h:mm:ss A ZZ'); 15 | 16 | if (err) { 17 | console.log(err); 18 | view = 'registrationError'; 19 | error = err.message; 20 | return res.render(view, { 21 | err: error, 22 | serverTime: serverTime, 23 | browsePrefix: req.browsePrefix, 24 | user: req.user 25 | }); 26 | } 27 | 28 | if (models.auctionUser) { 29 | view = 'registrationError'; 30 | error = 'This user has already been registered'; 31 | return res.render(view, { 32 | err: error, 33 | serverTime: serverTime, 34 | browsePrefix: req.browsePrefix, 35 | user: req.user 36 | }); 37 | } 38 | 39 | registration.addUser(req.user, function(err) { 40 | if (err) { 41 | console.log(err); 42 | view = 'registrationError'; 43 | error = err.message; 44 | } 45 | 46 | return res.render(view, { 47 | err: error, 48 | serverTime: serverTime, 49 | browsePrefix: req.browsePrefix, 50 | user: req.user 51 | }); 52 | }); 53 | }); 54 | }; 55 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/mbo.css: -------------------------------------------------------------------------------- 1 | /* Based on mbonaci's Brackets mbo theme */ 2 | 3 | .cm-s-mbo.CodeMirror {background: #2c2c2c; color: #ffffe9;} 4 | .cm-s-mbo div.CodeMirror-selected {background: #716C62 !important;} 5 | .cm-s-mbo .CodeMirror-gutters {background: #4e4e4e; border-right: 0px;} 6 | .cm-s-mbo .CodeMirror-linenumber {color: #dadada;} 7 | .cm-s-mbo .CodeMirror-cursor {border-left: 1px solid #ffffec !important;} 8 | 9 | .cm-s-mbo span.cm-comment {color: #95958a;} 10 | .cm-s-mbo span.cm-atom {color: #00a8c6;} 11 | .cm-s-mbo span.cm-number {color: #00a8c6;} 12 | 13 | .cm-s-mbo span.cm-property, .cm-s-mbo span.cm-attribute {color: #9ddfe9;} 14 | .cm-s-mbo span.cm-keyword {color: #ffb928;} 15 | .cm-s-mbo span.cm-string {color: #ffcf6c;} 16 | 17 | .cm-s-mbo span.cm-variable {color: #ffffec;} 18 | .cm-s-mbo span.cm-variable-2 {color: #00a8c6;} 19 | .cm-s-mbo span.cm-def {color: #ffffec;} 20 | .cm-s-mbo span.cm-bracket {color: #fffffc; font-weight: bold;} 21 | .cm-s-mbo span.cm-tag {color: #9ddfe9;} 22 | .cm-s-mbo span.cm-link {color: #f54b07;} 23 | .cm-s-mbo span.cm-error {background: #636363; color: #ffffec;} 24 | 25 | .cm-s-mbo .CodeMirror-activeline-background {background: #494b41 !important;} 26 | .cm-s-mbo .CodeMirror-matchingbracket { 27 | text-decoration: underline; 28 | color: #f5e107 !important; 29 | } 30 | 31 | .cm-s-mbo .CodeMirror-matchingtag {background: #4e4e4e;} 32 | 33 | .cm-s-mbo span.cm-searching { 34 | background-color: none; 35 | background: none; 36 | box-shadow: 0 0 0 1px #ffffec; 37 | } 38 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/blackboard.css: -------------------------------------------------------------------------------- 1 | /* Port of TextMate's Blackboard theme */ 2 | 3 | .cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; } 4 | .cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; } 5 | .cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; } 6 | .cm-s-blackboard .CodeMirror-linenumber { color: #888; } 7 | .cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } 8 | 9 | .cm-s-blackboard .cm-keyword { color: #FBDE2D; } 10 | .cm-s-blackboard .cm-atom { color: #D8FA3C; } 11 | .cm-s-blackboard .cm-number { color: #D8FA3C; } 12 | .cm-s-blackboard .cm-def { color: #8DA6CE; } 13 | .cm-s-blackboard .cm-variable { color: #FF6400; } 14 | .cm-s-blackboard .cm-operator { color: #FBDE2D;} 15 | .cm-s-blackboard .cm-comment { color: #AEAEAE; } 16 | .cm-s-blackboard .cm-string { color: #61CE3C; } 17 | .cm-s-blackboard .cm-string-2 { color: #61CE3C; } 18 | .cm-s-blackboard .cm-meta { color: #D8FA3C; } 19 | .cm-s-blackboard .cm-builtin { color: #8DA6CE; } 20 | .cm-s-blackboard .cm-tag { color: #8DA6CE; } 21 | .cm-s-blackboard .cm-attribute { color: #8DA6CE; } 22 | .cm-s-blackboard .cm-header { color: #FF6400; } 23 | .cm-s-blackboard .cm-hr { color: #AEAEAE; } 24 | .cm-s-blackboard .cm-link { color: #8DA6CE; } 25 | .cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } 26 | 27 | .cm-s-blackboard .CodeMirror-activeline-background {background: #3C3636 !important;} 28 | .cm-s-blackboard .CodeMirror-matchingbracket {outline:1px solid grey;color:white !important} -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/ntriples/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: NTriples mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 28 | 29 |
    30 |

    NTriples mode

    31 |
    32 | 39 |
    40 | 41 | 44 |

    MIME types defined: text/n-triples.

    45 |
    46 | -------------------------------------------------------------------------------- /email-templates/notify-winners-modified.ejs: -------------------------------------------------------------------------------- 1 | You've won <%= user.lineItems.length %> more ad slot(s) in auction <%= auctionId %>! 2 | 3 |
    4 | 5 |
    6 | Because an advertiser failed to pay for their ads on time, their slots have become available, and you have a chance to buy them. You have a reduced window of time in which to pay for these ads, but your original bid has been discounted somewhat to offset this. These extra slots are exactly the same as regular slots -- they do not have reduced ad time. 7 | 8 | Please promptly pay for the slot(s) you've won using the invoice link below. This invoice will expire on: <%= expiration %>. If you do not pay in time, you will lose your chance at these slots, though you will not be penalized further. 9 |

    10 | 11 | Click here to view your invoice. 12 | 13 |

    14 | Please ensure that the ads you want on the forum are in rotation. Ads submitted and approved but not marked "in rotation" will not be advertised. Once your payment clears and the ad period begins, ads marked "In Rotation" on your profile page will start being displayed in the forum's ad area. If you have more ads than slots, then the forum will randomly rotate between your ads. Your ads can be updated during the ad period, though modifications and new ads require approval. 15 |
    16 | 17 |

    18 | Thanks for participating in this auction! 19 |

    20 | 21 | This is a automated email. Please do not reply to this email. -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/http/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: HTTP mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    HTTP mode

    27 | 28 | 29 |
    39 | 40 | 43 | 44 |

    MIME types defined: message/http.

    45 |
    46 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/jinja2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Jinja2 mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Jinja2 mode

    27 |
    45 | 50 |
    51 | -------------------------------------------------------------------------------- /routes/bid.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var bidsCommon = require(__dirname + '/common/bids'); 5 | 6 | module.exports = { 7 | // POST bid 8 | newBid: function(req, res) { 9 | req.model.load('userBidsPerRegion', req); 10 | req.model.load('auctionUser', req); 11 | req.model.end(function(err, models) { 12 | if (err) { console.log(err); } 13 | bidsCommon.newBid(req, models, function() { 14 | res.redirect(req.browsePrefix + '/auctions/' + req.body.auctionId); 15 | }); 16 | }); 17 | }, 18 | updateBid: function(req, res) { 19 | // updating bids are a admin only function for now 20 | if (!req.user.admin) { return res.redirect(req.browsePrefix); } 21 | req.params.bidId = req.body.bidId; // is this really needed? 22 | req.model.load('bid', req); 23 | req.model.end(function(err, models) { 24 | if (err) { console.log(err); res.redirect(req.browsePrefix); } 25 | else { 26 | bidsCommon.updateBid(req, models, function(err) { 27 | if(err) { console.log(err); } 28 | res.redirect(req.browsePrefix); 29 | }); 30 | } 31 | }); 32 | }, 33 | deleteBid: function(req, res) { 34 | // deleting bids is an admin only function 35 | if (!req.user.admin) { return res.redirect(req.browsePrefix); } 36 | 37 | req.model.load('bid', req); 38 | req.model.end(function(err, models) { 39 | bidsCommon.deleteBid(req, models, function(err, results) { 40 | if (err) { res.send(500, err.message); } 41 | if (results) { res.json(results); } 42 | }); 43 | }); 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/z80/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Z80 assembly mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Z80 assembly mode

    27 | 28 | 29 |
    44 | 45 | 50 | 51 |

    MIME type defined: text/x-z80.

    52 |
    53 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/ecl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: ECL mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    ECL mode

    27 |
    45 | 48 | 49 |

    Based on CodeMirror's clike mode. For more information see HPCC Systems web site.

    50 |

    MIME types defined: text/x-ecl.

    51 | 52 |
    53 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/3024-day.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: 3024 day 4 | Author: Jan T. Sott (http://github.com/idleberg) 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-3024-day.CodeMirror {background: #f7f7f7; color: #3a3432;} 12 | .cm-s-3024-day div.CodeMirror-selected {background: #d6d5d4 !important;} 13 | .cm-s-3024-day .CodeMirror-gutters {background: #f7f7f7; border-right: 0px;} 14 | .cm-s-3024-day .CodeMirror-linenumber {color: #807d7c;} 15 | .cm-s-3024-day .CodeMirror-cursor {border-left: 1px solid #5c5855 !important;} 16 | 17 | .cm-s-3024-day span.cm-comment {color: #cdab53;} 18 | .cm-s-3024-day span.cm-atom {color: #a16a94;} 19 | .cm-s-3024-day span.cm-number {color: #a16a94;} 20 | 21 | .cm-s-3024-day span.cm-property, .cm-s-3024-day span.cm-attribute {color: #01a252;} 22 | .cm-s-3024-day span.cm-keyword {color: #db2d20;} 23 | .cm-s-3024-day span.cm-string {color: #fded02;} 24 | 25 | .cm-s-3024-day span.cm-variable {color: #01a252;} 26 | .cm-s-3024-day span.cm-variable-2 {color: #01a0e4;} 27 | .cm-s-3024-day span.cm-def {color: #e8bbd0;} 28 | .cm-s-3024-day span.cm-bracket {color: #3a3432;} 29 | .cm-s-3024-day span.cm-tag {color: #db2d20;} 30 | .cm-s-3024-day span.cm-link {color: #a16a94;} 31 | .cm-s-3024-day span.cm-error {background: #db2d20; color: #5c5855;} 32 | 33 | .cm-s-3024-day .CodeMirror-activeline-background {background: #e8f2ff !important;} 34 | .cm-s-3024-day .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 35 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/rust/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Rust mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Rust mode

    27 | 28 | 29 |
    52 | 53 | 59 | 60 |

    MIME types defined: text/x-rustsrc.

    61 |
    62 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/hint/css-hint.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | "use strict"; 3 | 4 | var pseudoClasses = {link: 1, visited: 1, active: 1, hover: 1, focus: 1, 5 | "first-letter": 1, "first-line": 1, "first-child": 1, 6 | before: 1, after: 1, lang: 1}; 7 | 8 | CodeMirror.registerHelper("hint", "css", function(cm) { 9 | var cur = cm.getCursor(), token = cm.getTokenAt(cur); 10 | var inner = CodeMirror.innerMode(cm.getMode(), token.state); 11 | if (inner.mode.name != "css") return; 12 | 13 | var word = token.string, start = token.start, end = token.end; 14 | if (/[^\w$_-]/.test(word)) { 15 | word = ""; start = end = cur.ch; 16 | } 17 | 18 | var spec = CodeMirror.resolveMode("text/css"); 19 | 20 | var result = []; 21 | function add(keywords) { 22 | for (var name in keywords) 23 | if (!word || name.lastIndexOf(word, 0) == 0) 24 | result.push(name); 25 | } 26 | 27 | var st = token.state.state; 28 | if (st == "pseudo" || token.type == "variable-3") { 29 | add(pseudoClasses); 30 | } else if (st == "block" || st == "maybeprop") { 31 | add(spec.propertyKeywords); 32 | } else if (st == "prop" || st == "parens" || st == "at" || st == "params") { 33 | add(spec.valueKeywords); 34 | add(spec.colorKeywords); 35 | } else if (st == "media" || st == "media_parens") { 36 | add(spec.mediaTypes); 37 | add(spec.mediaFeatures); 38 | } 39 | 40 | if (result.length) return { 41 | list: result, 42 | from: CodeMirror.Pos(cur.line, start), 43 | to: CodeMirror.Pos(cur.line, end) 44 | }; 45 | }); 46 | })(); 47 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/paraiso-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Paraíso (Dark) 4 | Author: Jan T. Sott 5 | 6 | Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror) 7 | Inspired by the art of Rubens LP (http://www.rubenslp.com.br) 8 | 9 | */ 10 | 11 | .cm-s-paraiso-dark.CodeMirror {background: #2f1e2e; color: #b9b6b0;} 12 | .cm-s-paraiso-dark div.CodeMirror-selected {background: #41323f !important;} 13 | .cm-s-paraiso-dark .CodeMirror-gutters {background: #2f1e2e; border-right: 0px;} 14 | .cm-s-paraiso-dark .CodeMirror-linenumber {color: #776e71;} 15 | .cm-s-paraiso-dark .CodeMirror-cursor {border-left: 1px solid #8d8687 !important;} 16 | 17 | .cm-s-paraiso-dark span.cm-comment {color: #e96ba8;} 18 | .cm-s-paraiso-dark span.cm-atom {color: #815ba4;} 19 | .cm-s-paraiso-dark span.cm-number {color: #815ba4;} 20 | 21 | .cm-s-paraiso-dark span.cm-property, .cm-s-paraiso-dark span.cm-attribute {color: #48b685;} 22 | .cm-s-paraiso-dark span.cm-keyword {color: #ef6155;} 23 | .cm-s-paraiso-dark span.cm-string {color: #fec418;} 24 | 25 | .cm-s-paraiso-dark span.cm-variable {color: #48b685;} 26 | .cm-s-paraiso-dark span.cm-variable-2 {color: #06b6ef;} 27 | .cm-s-paraiso-dark span.cm-def {color: #f99b15;} 28 | .cm-s-paraiso-dark span.cm-bracket {color: #b9b6b0;} 29 | .cm-s-paraiso-dark span.cm-tag {color: #ef6155;} 30 | .cm-s-paraiso-dark span.cm-link {color: #815ba4;} 31 | .cm-s-paraiso-dark span.cm-error {background: #ef6155; color: #8d8687;} 32 | 33 | .cm-s-paraiso-dark .CodeMirror-activeline-background {background: #4D344A !important;} 34 | .cm-s-paraiso-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 35 | -------------------------------------------------------------------------------- /public/scripts/codemirror/keymap/extra.js: -------------------------------------------------------------------------------- 1 | // A number of additional default bindings that are too obscure to 2 | // include in the core codemirror.js file. 3 | 4 | (function() { 5 | "use strict"; 6 | 7 | var Pos = CodeMirror.Pos; 8 | 9 | function moveLines(cm, start, end, dist) { 10 | if (!dist || start > end) return 0; 11 | 12 | var from = cm.clipPos(Pos(start, 0)), to = cm.clipPos(Pos(end)); 13 | var text = cm.getRange(from, to); 14 | 15 | if (start <= cm.firstLine()) 16 | cm.replaceRange("", from, Pos(to.line + 1, 0)); 17 | else 18 | cm.replaceRange("", Pos(from.line - 1), to); 19 | var target = from.line + dist; 20 | if (target <= cm.firstLine()) { 21 | cm.replaceRange(text + "\n", Pos(target, 0)); 22 | return cm.firstLine() - from.line; 23 | } else { 24 | var targetPos = cm.clipPos(Pos(target - 1)); 25 | cm.replaceRange("\n" + text, targetPos); 26 | return targetPos.line + 1 - from.line; 27 | } 28 | } 29 | 30 | function moveSelectedLines(cm, dist) { 31 | var head = cm.getCursor("head"), anchor = cm.getCursor("anchor"); 32 | cm.operation(function() { 33 | var moved = moveLines(cm, Math.min(head.line, anchor.line), Math.max(head.line, anchor.line), dist); 34 | cm.setSelection(Pos(anchor.line + moved, anchor.ch), Pos(head.line + moved, head.ch)); 35 | }); 36 | } 37 | 38 | CodeMirror.commands.moveLinesUp = function(cm) { moveSelectedLines(cm, -1); }; 39 | CodeMirror.commands.moveLinesDown = function(cm) { moveSelectedLines(cm, 1); }; 40 | 41 | CodeMirror.keyMap["default"]["Alt-Up"] = "moveLinesUp"; 42 | CodeMirror.keyMap["default"]["Alt-Down"] = "moveLinesDown"; 43 | })(); 44 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/3024-night.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: 3024 night 4 | Author: Jan T. Sott (http://github.com/idleberg) 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-3024-night.CodeMirror {background: #090300; color: #d6d5d4;} 12 | .cm-s-3024-night div.CodeMirror-selected {background: #3a3432 !important;} 13 | .cm-s-3024-night .CodeMirror-gutters {background: #090300; border-right: 0px;} 14 | .cm-s-3024-night .CodeMirror-linenumber {color: #5c5855;} 15 | .cm-s-3024-night .CodeMirror-cursor {border-left: 1px solid #807d7c !important;} 16 | 17 | .cm-s-3024-night span.cm-comment {color: #cdab53;} 18 | .cm-s-3024-night span.cm-atom {color: #a16a94;} 19 | .cm-s-3024-night span.cm-number {color: #a16a94;} 20 | 21 | .cm-s-3024-night span.cm-property, .cm-s-3024-night span.cm-attribute {color: #01a252;} 22 | .cm-s-3024-night span.cm-keyword {color: #db2d20;} 23 | .cm-s-3024-night span.cm-string {color: #fded02;} 24 | 25 | .cm-s-3024-night span.cm-variable {color: #01a252;} 26 | .cm-s-3024-night span.cm-variable-2 {color: #01a0e4;} 27 | .cm-s-3024-night span.cm-def {color: #e8bbd0;} 28 | .cm-s-3024-night span.cm-bracket {color: #d6d5d4;} 29 | .cm-s-3024-night span.cm-tag {color: #db2d20;} 30 | .cm-s-3024-night span.cm-link {color: #a16a94;} 31 | .cm-s-3024-night span.cm-error {background: #db2d20; color: #807d7c;} 32 | 33 | .cm-s-3024-night .CodeMirror-activeline-background {background: #2F2F2F !important;} 34 | .cm-s-3024-night .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 35 | -------------------------------------------------------------------------------- /email-templates/registration.ejs: -------------------------------------------------------------------------------- 1 |
    2 | You are receiving this email because someone using your email address is attempting to register for the bitcointalk.org ad auction system. If you did not do this, then you can just ignore this email. If you receive many copies of this email, go here, enter your email address, and reset your password using the link that will be emailed to you. 3 | 4 | To participate in auctions, you must pay a one-time registration fee of <%= registrationFee %> BTC. This requirement is an automated means of allowing new bidders to easily join while also serving as an anti-spam measure to guard against the negative effects of non-serious bidders. This fee will be subtracted from your first invoice if you ever win any ad slots, so it is usually not an additional cost. However, it will not be refunded if you never win any ad slots or if you are banned from the auction system. 5 | 6 | In order to complete the registration process, please refer to the invoice link below. For your own protection, please verify that the URL begins with <%= invoiceUrl %>. 7 |

    8 | 9 | Click here to view your invoice. 10 | 11 |

    12 | Upon completion of the payment process, you will become eligible to submit ads for review. After at least one of your advertisements is approved by an administrator, you will be able to bid in ad auctions. You can start this process by going to your profile page and creating an advertisement. 13 |
    14 | 15 |

    16 | 17 | This is a automated email. Please do not reply. -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "adness-api", 3 | "version": "0.9.1", 4 | "repository": { 5 | "type": "git", 6 | "url": "https://github.com/slickage/adness.git" 7 | }, 8 | "description": "", 9 | "main": "index.js", 10 | "engines": { 11 | "node": ">=0.10.0", 12 | "npm": ">=1.3" 13 | }, 14 | "scripts": { 15 | "test": "tap ./test" 16 | }, 17 | "author": "James Wang ", 18 | "license": "MIT", 19 | "dependencies": { 20 | "async": "~0.2.10", 21 | "body-parser": "^1.4.3", 22 | "charlatan": "~0.1.9", 23 | "connect-assets": "~2.5.3", 24 | "connect-flash": "~0.1.1", 25 | "connect-redis": "^2.0.0", 26 | "cookie-parser": "^1.3.2", 27 | "csurf": "^1.3.0", 28 | "ejs": "~0.8.5", 29 | "ejs-locals": "~1.0.2", 30 | "emcee": "0.0.4", 31 | "errorhandler": "^1.1.1", 32 | "express": "~4.6.1", 33 | "express-jwt": "~0.1.0", 34 | "express-session": "^1.6.5", 35 | "geoip-lite": "~1.1.3", 36 | "google-caja": "0.0.2", 37 | "heckler": "slickage/heckler", 38 | "helmet": "^0.4.0", 39 | "jsonwebtoken": "~0.1.0", 40 | "lodash": "~2.4.1", 41 | "moment": "^2.6.0", 42 | "morgan": "^1.1.1", 43 | "mysql": "~2.0.1", 44 | "nano": "~4.4.0", 45 | "node-resque": "~0.5.1", 46 | "node-uuid": "~1.4.1", 47 | "nodemailer": "~0.6.0", 48 | "passport": "~0.1.18", 49 | "passport-local": "~0.1.6", 50 | "rate-limiter": "0.2.0", 51 | "request": "~2.34.0", 52 | "restify": "~2.6.1", 53 | "rework": "^1.0.0", 54 | "rework-walk": "^1.0.0", 55 | "serve-favicon": "^2.0.1", 56 | "shacrypt": "0.0.2" 57 | }, 58 | "devDependencies": { 59 | "tap": "~0.4.8" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/paraiso-light.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Paraíso (Light) 4 | Author: Jan T. Sott 5 | 6 | Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror) 7 | Inspired by the art of Rubens LP (http://www.rubenslp.com.br) 8 | 9 | */ 10 | 11 | .cm-s-paraiso-light.CodeMirror {background: #e7e9db; color: #41323f;} 12 | .cm-s-paraiso-light div.CodeMirror-selected {background: #b9b6b0 !important;} 13 | .cm-s-paraiso-light .CodeMirror-gutters {background: #e7e9db; border-right: 0px;} 14 | .cm-s-paraiso-light .CodeMirror-linenumber {color: #8d8687;} 15 | .cm-s-paraiso-light .CodeMirror-cursor {border-left: 1px solid #776e71 !important;} 16 | 17 | .cm-s-paraiso-light span.cm-comment {color: #e96ba8;} 18 | .cm-s-paraiso-light span.cm-atom {color: #815ba4;} 19 | .cm-s-paraiso-light span.cm-number {color: #815ba4;} 20 | 21 | .cm-s-paraiso-light span.cm-property, .cm-s-paraiso-light span.cm-attribute {color: #48b685;} 22 | .cm-s-paraiso-light span.cm-keyword {color: #ef6155;} 23 | .cm-s-paraiso-light span.cm-string {color: #fec418;} 24 | 25 | .cm-s-paraiso-light span.cm-variable {color: #48b685;} 26 | .cm-s-paraiso-light span.cm-variable-2 {color: #06b6ef;} 27 | .cm-s-paraiso-light span.cm-def {color: #f99b15;} 28 | .cm-s-paraiso-light span.cm-bracket {color: #41323f;} 29 | .cm-s-paraiso-light span.cm-tag {color: #ef6155;} 30 | .cm-s-paraiso-light span.cm-link {color: #815ba4;} 31 | .cm-s-paraiso-light span.cm-error {background: #ef6155; color: #776e71;} 32 | 33 | .cm-s-paraiso-light .CodeMirror-activeline-background {background: #CFD1C4 !important;} 34 | .cm-s-paraiso-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 35 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/selection/active-line.js: -------------------------------------------------------------------------------- 1 | // Because sometimes you need to style the cursor's line. 2 | // 3 | // Adds an option 'styleActiveLine' which, when enabled, gives the 4 | // active line's wrapping
    the CSS class "CodeMirror-activeline", 5 | // and gives its background
    the class "CodeMirror-activeline-background". 6 | 7 | (function() { 8 | "use strict"; 9 | var WRAP_CLASS = "CodeMirror-activeline"; 10 | var BACK_CLASS = "CodeMirror-activeline-background"; 11 | 12 | CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) { 13 | var prev = old && old != CodeMirror.Init; 14 | if (val && !prev) { 15 | updateActiveLine(cm, cm.getCursor().line); 16 | cm.on("beforeSelectionChange", selectionChange); 17 | } else if (!val && prev) { 18 | cm.off("beforeSelectionChange", selectionChange); 19 | clearActiveLine(cm); 20 | delete cm.state.activeLine; 21 | } 22 | }); 23 | 24 | function clearActiveLine(cm) { 25 | if ("activeLine" in cm.state) { 26 | cm.removeLineClass(cm.state.activeLine, "wrap", WRAP_CLASS); 27 | cm.removeLineClass(cm.state.activeLine, "background", BACK_CLASS); 28 | } 29 | } 30 | 31 | function updateActiveLine(cm, selectedLine) { 32 | var line = cm.getLineHandleVisualStart(selectedLine); 33 | if (cm.state.activeLine == line) return; 34 | cm.operation(function() { 35 | clearActiveLine(cm); 36 | cm.addLineClass(line, "wrap", WRAP_CLASS); 37 | cm.addLineClass(line, "background", BACK_CLASS); 38 | cm.state.activeLine = line; 39 | }); 40 | } 41 | 42 | function selectionChange(cm, sel) { 43 | updateActiveLine(cm, sel.head.line); 44 | } 45 | })(); 46 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/pascal/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Pascal mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Pascal mode

    27 | 28 | 29 |
    52 | 53 | 59 | 60 |

    MIME types defined: text/x-pascal.

    61 |
    62 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/pig/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Pig Latin mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Pig Latin mode

    27 |
    39 | 40 | 47 | 48 |

    49 | Simple mode that handles Pig Latin language. 50 |

    51 | 52 |

    MIME type defined: text/x-pig 53 | (PIG code) 54 | 55 |

    56 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/turtle/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Turtle mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Turtle mode

    27 |
    41 | 48 | 49 |

    MIME types defined: text/turtle.

    50 | 51 |
    52 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/base16-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Base16 Default Dark 4 | Author: Chris Kempson (http://chriskempson.com) 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-base16-dark.CodeMirror {background: #151515; color: #e0e0e0;} 12 | .cm-s-base16-dark div.CodeMirror-selected {background: #202020 !important;} 13 | .cm-s-base16-dark .CodeMirror-gutters {background: #151515; border-right: 0px;} 14 | .cm-s-base16-dark .CodeMirror-linenumber {color: #505050;} 15 | .cm-s-base16-dark .CodeMirror-cursor {border-left: 1px solid #b0b0b0 !important;} 16 | 17 | .cm-s-base16-dark span.cm-comment {color: #8f5536;} 18 | .cm-s-base16-dark span.cm-atom {color: #aa759f;} 19 | .cm-s-base16-dark span.cm-number {color: #aa759f;} 20 | 21 | .cm-s-base16-dark span.cm-property, .cm-s-base16-dark span.cm-attribute {color: #90a959;} 22 | .cm-s-base16-dark span.cm-keyword {color: #ac4142;} 23 | .cm-s-base16-dark span.cm-string {color: #f4bf75;} 24 | 25 | .cm-s-base16-dark span.cm-variable {color: #90a959;} 26 | .cm-s-base16-dark span.cm-variable-2 {color: #6a9fb5;} 27 | .cm-s-base16-dark span.cm-def {color: #d28445;} 28 | .cm-s-base16-dark span.cm-bracket {color: #e0e0e0;} 29 | .cm-s-base16-dark span.cm-tag {color: #ac4142;} 30 | .cm-s-base16-dark span.cm-link {color: #aa759f;} 31 | .cm-s-base16-dark span.cm-error {background: #ac4142; color: #b0b0b0;} 32 | 33 | .cm-s-base16-dark .CodeMirror-activeline-background {background: #2F2F2F !important;} 34 | .cm-s-base16-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 35 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/vibrant-ink.css: -------------------------------------------------------------------------------- 1 | /* Taken from the popular Visual Studio Vibrant Ink Schema */ 2 | 3 | .cm-s-vibrant-ink.CodeMirror { background: black; color: white; } 4 | .cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; } 5 | 6 | .cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 7 | .cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; } 8 | .cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; } 9 | 10 | .cm-s-vibrant-ink .cm-keyword { color: #CC7832; } 11 | .cm-s-vibrant-ink .cm-atom { color: #FC0; } 12 | .cm-s-vibrant-ink .cm-number { color: #FFEE98; } 13 | .cm-s-vibrant-ink .cm-def { color: #8DA6CE; } 14 | .cm-s-vibrant-ink span.cm-variable-2, .cm-s-vibrant span.cm-tag { color: #FFC66D } 15 | .cm-s-vibrant-ink span.cm-variable-3, .cm-s-vibrant span.cm-def { color: #FFC66D } 16 | .cm-s-vibrant-ink .cm-operator { color: #888; } 17 | .cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; } 18 | .cm-s-vibrant-ink .cm-string { color: #A5C25C } 19 | .cm-s-vibrant-ink .cm-string-2 { color: red } 20 | .cm-s-vibrant-ink .cm-meta { color: #D8FA3C; } 21 | .cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; } 22 | .cm-s-vibrant-ink .cm-tag { color: #8DA6CE; } 23 | .cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; } 24 | .cm-s-vibrant-ink .cm-header { color: #FF6400; } 25 | .cm-s-vibrant-ink .cm-hr { color: #AEAEAE; } 26 | .cm-s-vibrant-ink .cm-link { color: blue; } 27 | .cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; } 28 | 29 | .cm-s-vibrant-ink .CodeMirror-activeline-background {background: #27282E !important;} 30 | .cm-s-vibrant-ink .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} 31 | -------------------------------------------------------------------------------- /routes/factoids.js: -------------------------------------------------------------------------------- 1 | var moment = require('moment'); 2 | var db = require('../db'); 3 | 4 | module.exports = { 5 | showFacts: function(req, res) { 6 | // admin check 7 | if (!req.user.admin) { return res.redirect(req.browsePrefix); } 8 | req.model.load('factoids', req); 9 | req.model.end(function(err, models) { 10 | if (err) { 11 | console.log('No Factoids Found, creating new factoids object.'); 12 | models.factoids = {}; 13 | } 14 | 15 | // factoids 16 | var factoids = models.factoids; 17 | 18 | // serverTime 19 | var serverTime = moment().utc().format('YYYY MMMM D, h:mm:ss A ZZ'); 20 | 21 | res.render('factoids', { 22 | factoids: factoids, 23 | serverTime: serverTime, 24 | browsePrefix: req.browsePrefix, 25 | user: req.user 26 | }); 27 | }); 28 | }, 29 | updateFacts: function(req, res) { 30 | // admin check 31 | if (!req.user.admin) { return res.redirect(req.browsePrefix); } 32 | req.model.load('factoids', req); 33 | req.model.end(function(err, models) { 34 | if (err) { 35 | console.log('Factoids not found, inserting new Factoids'); 36 | models.factoids = {}; 37 | } 38 | 39 | var facts = models.factoids; 40 | 41 | if (req.body.html) { facts.html = req.body.html; } 42 | if (req.body.css) { facts.css = req.body.css; } 43 | if (req.body.list) { facts.list = req.body.list; } 44 | 45 | db.upsertFactoid(facts, function(err) { 46 | if (err) { 47 | console.log(err); 48 | return res.send(500, 'Could not update factoids.'); 49 | } 50 | return res.json({ok: true}); 51 | }); 52 | }); 53 | } 54 | }; 55 | -------------------------------------------------------------------------------- /test/biddingAlgorithmTest.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var bidding = require('../bidding'); 5 | 6 | var bidTest = function() { 7 | 8 | // need to test for no bid scenario 9 | // need to test for under filled slots 10 | // need to test for sorting by same price 11 | 12 | // test data 13 | var slots = 8; 14 | var bids = [ 15 | { 16 | created_at: new Date().getTime(), 17 | type: 'bid', 18 | price: 3, 19 | slots: 3, 20 | user: 'testuser', 21 | auctionId: 1, 22 | bidId: 1 23 | }, 24 | { 25 | created_at: new Date().getTime() + 1000, 26 | type: 'bid', 27 | price: 3, 28 | slots: 4, 29 | user: 'testuser', 30 | auctionId: 1, 31 | bidId: 2 32 | }, 33 | { 34 | created_at: new Date().getTime() + 2000, 35 | type: 'bid', 36 | price: 2.8, 37 | slots: 7, 38 | user: 'testuser', 39 | auctionId: 1, 40 | bidId: 3 41 | }, 42 | { 43 | created_at: new Date().getTime() + 3000, 44 | type: 'bid', 45 | price: 2.5, 46 | slots: 2, 47 | user: 'testuser', 48 | auctionId: 1, 49 | bidId: 4 50 | }, 51 | { 52 | created_at: new Date().getTime() + 4000, 53 | type: 'bid', 54 | price: 2, 55 | slots: 8, 56 | user: 'testuser', 57 | auctionId: 1, 58 | bidId: 5 59 | }, 60 | { 61 | created_at: new Date().getTime() + 5000, 62 | type: 'bid', 63 | price: 1, 64 | slots: 3, 65 | user: 'testuser', 66 | auctionId: 1, 67 | bidId: 6 68 | } 69 | ]; 70 | 71 | var results = bidding(slots, bids); 72 | console.log(results); 73 | }; 74 | 75 | // run test 76 | bidTest(); -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/fold/comment-fold.js: -------------------------------------------------------------------------------- 1 | CodeMirror.registerGlobalHelper("fold", "comment", function(mode) { 2 | return mode.blockCommentStart && mode.blockCommentEnd; 3 | }, function(cm, start) { 4 | var mode = cm.getModeAt(start), startToken = mode.blockCommentStart, endToken = mode.blockCommentEnd; 5 | if (!startToken || !endToken) return; 6 | var line = start.line, lineText = cm.getLine(line); 7 | 8 | var startCh; 9 | for (var at = start.ch, pass = 0;;) { 10 | var found = at <= 0 ? -1 : lineText.lastIndexOf(startToken, at - 1); 11 | if (found == -1) { 12 | if (pass == 1) return; 13 | pass = 1; 14 | at = lineText.length; 15 | continue; 16 | } 17 | if (pass == 1 && found < start.ch) return; 18 | if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)))) { 19 | startCh = found + startToken.length; 20 | break; 21 | } 22 | at = found - 1; 23 | } 24 | 25 | var depth = 1, lastLine = cm.lastLine(), end, endCh; 26 | outer: for (var i = line; i <= lastLine; ++i) { 27 | var text = cm.getLine(i), pos = i == line ? startCh : 0; 28 | for (;;) { 29 | var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); 30 | if (nextOpen < 0) nextOpen = text.length; 31 | if (nextClose < 0) nextClose = text.length; 32 | pos = Math.min(nextOpen, nextClose); 33 | if (pos == text.length) break; 34 | if (pos == nextOpen) ++depth; 35 | else if (!--depth) { end = i; endCh = pos; break outer; } 36 | ++pos; 37 | } 38 | } 39 | if (end == null || line == end && endCh == startCh) return; 40 | return {from: CodeMirror.Pos(line, startCh), 41 | to: CodeMirror.Pos(end, endCh)}; 42 | }); 43 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/base16-light.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Base16 Default Light 4 | Author: Chris Kempson (http://chriskempson.com) 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-chrome-devtools) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-base16-light.CodeMirror {background: #f5f5f5; color: #202020;} 12 | .cm-s-base16-light div.CodeMirror-selected {background: #e0e0e0 !important;} 13 | .cm-s-base16-light .CodeMirror-gutters {background: #f5f5f5; border-right: 0px;} 14 | .cm-s-base16-light .CodeMirror-linenumber {color: #b0b0b0;} 15 | .cm-s-base16-light .CodeMirror-cursor {border-left: 1px solid #505050 !important;} 16 | 17 | .cm-s-base16-light span.cm-comment {color: #8f5536;} 18 | .cm-s-base16-light span.cm-atom {color: #aa759f;} 19 | .cm-s-base16-light span.cm-number {color: #aa759f;} 20 | 21 | .cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute {color: #90a959;} 22 | .cm-s-base16-light span.cm-keyword {color: #ac4142;} 23 | .cm-s-base16-light span.cm-string {color: #f4bf75;} 24 | 25 | .cm-s-base16-light span.cm-variable {color: #90a959;} 26 | .cm-s-base16-light span.cm-variable-2 {color: #6a9fb5;} 27 | .cm-s-base16-light span.cm-def {color: #d28445;} 28 | .cm-s-base16-light span.cm-bracket {color: #202020;} 29 | .cm-s-base16-light span.cm-tag {color: #ac4142;} 30 | .cm-s-base16-light span.cm-link {color: #aa759f;} 31 | .cm-s-base16-light span.cm-error {background: #ac4142; color: #505050;} 32 | 33 | .cm-s-base16-light .CodeMirror-activeline-background {background: #DDDCDC !important;} 34 | .cm-s-base16-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 35 | -------------------------------------------------------------------------------- /passport.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var passport = require('passport'), 5 | LocalStrategy = require('passport-local').Strategy, 6 | smfAuth = require('./integration/smf-auth'), 7 | config = require('./config'); 8 | 9 | var users = {}; 10 | // Passport session setup. 11 | // To support persistent login sessions, Passport needs to be able to 12 | // serialize users into and deserialize users out of the session. Typically, 13 | // this will be as simple as storing the user ID when serializing, and finding 14 | // the user by ID when deserializing. 15 | passport.serializeUser(function(user, done) { 16 | done(null, user.username); 17 | }); 18 | 19 | passport.deserializeUser(function(id, done) { 20 | var user = users[id]; 21 | if (user) { done(null, user); } 22 | else { done(null, false); } 23 | }); 24 | 25 | passport.use(new LocalStrategy( 26 | function(username, password, done) { 27 | process.nextTick(function () { 28 | if (config.fakeAuth.enabled) { 29 | users[username] = { 30 | username: username, 31 | userId: config.fakeAuth.userId, 32 | email: config.fakeAuth.email, 33 | admin: config.fakeAuth.admin 34 | }; 35 | return done(null, users[username]); 36 | } 37 | else { 38 | smfAuth.authenticate(username, password, function(err, user) { 39 | if (err) { 40 | return done(err); 41 | } 42 | if (!user) { 43 | return done(null, false); 44 | } 45 | else { 46 | users[user.username] = user; 47 | return done(null, user); 48 | } 49 | }); 50 | } 51 | }); 52 | } 53 | )); 54 | 55 | module.exports = passport; 56 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/vbscript/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: VBScript mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    VBScript mode

    27 | 28 | 29 |
    46 | 47 | 53 | 54 |

    MIME types defined: text/vbscript.

    55 |
    56 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/twilight.css: -------------------------------------------------------------------------------- 1 | .cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/ 2 | .cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/ 3 | 4 | .cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; } 5 | .cm-s-twilight .CodeMirror-linenumber { color: #aaa; } 6 | .cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; } 7 | 8 | .cm-s-twilight .cm-keyword { color: #f9ee98; } /**/ 9 | .cm-s-twilight .cm-atom { color: #FC0; } 10 | .cm-s-twilight .cm-number { color: #ca7841; } /**/ 11 | .cm-s-twilight .cm-def { color: #8DA6CE; } 12 | .cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/ 13 | .cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/ 14 | .cm-s-twilight .cm-operator { color: #cda869; } /**/ 15 | .cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/ 16 | .cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/ 17 | .cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/ 18 | .cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/ 19 | .cm-s-twilight .cm-builtin { color: #cda869; } /*?*/ 20 | .cm-s-twilight .cm-tag { color: #997643; } /**/ 21 | .cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/ 22 | .cm-s-twilight .cm-header { color: #FF6400; } 23 | .cm-s-twilight .cm-hr { color: #AEAEAE; } 24 | .cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/ 25 | .cm-s-twilight .cm-error { border-bottom: 1px solid red; } 26 | 27 | .cm-s-twilight .CodeMirror-activeline-background {background: #27282E !important;} 28 | .cm-s-twilight .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} 29 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/gherkin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Gherkin mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Gherkin mode

    27 |
    42 | 45 | 46 |

    MIME types defined: text/x-feature.

    47 | 48 |
    49 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/display/placeholder.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | CodeMirror.defineOption("placeholder", "", function(cm, val, old) { 3 | var prev = old && old != CodeMirror.Init; 4 | if (val && !prev) { 5 | cm.on("blur", onBlur); 6 | cm.on("change", onChange); 7 | onChange(cm); 8 | } else if (!val && prev) { 9 | cm.off("blur", onBlur); 10 | cm.off("change", onChange); 11 | clearPlaceholder(cm); 12 | var wrapper = cm.getWrapperElement(); 13 | wrapper.className = wrapper.className.replace(" CodeMirror-empty", ""); 14 | } 15 | 16 | if (val && !cm.hasFocus()) onBlur(cm); 17 | }); 18 | 19 | function clearPlaceholder(cm) { 20 | if (cm.state.placeholder) { 21 | cm.state.placeholder.parentNode.removeChild(cm.state.placeholder); 22 | cm.state.placeholder = null; 23 | } 24 | } 25 | function setPlaceholder(cm) { 26 | clearPlaceholder(cm); 27 | var elt = cm.state.placeholder = document.createElement("pre"); 28 | elt.style.cssText = "height: 0; overflow: visible"; 29 | elt.className = "CodeMirror-placeholder"; 30 | elt.appendChild(document.createTextNode(cm.getOption("placeholder"))); 31 | cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild); 32 | } 33 | 34 | function onBlur(cm) { 35 | if (isEmpty(cm)) setPlaceholder(cm); 36 | } 37 | function onChange(cm) { 38 | var wrapper = cm.getWrapperElement(), empty = isEmpty(cm); 39 | wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : ""); 40 | 41 | if (empty) setPlaceholder(cm); 42 | else clearPlaceholder(cm); 43 | } 44 | 45 | function isEmpty(cm) { 46 | return (cm.lineCount() === 1) && (cm.getLine(0) === ""); 47 | } 48 | })(); 49 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/properties/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Properties files mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Properties files mode

    27 |
    46 | 49 | 50 |

    MIME types defined: text/x-properties, 51 | text/x-ini.

    52 | 53 |
    54 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/midnight.css: -------------------------------------------------------------------------------- 1 | /* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */ 2 | 3 | /**/ 4 | .cm-s-midnight span.CodeMirror-matchhighlight { background: #494949; } 5 | .cm-s-midnight.CodeMirror-focused span.CodeMirror-matchhighlight { background: #314D67 !important; } 6 | 7 | /**/ 8 | .cm-s-midnight .CodeMirror-activeline-background {background: #253540 !important;} 9 | 10 | .cm-s-midnight.CodeMirror { 11 | background: #0F192A; 12 | color: #D1EDFF; 13 | } 14 | 15 | .cm-s-midnight.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;} 16 | 17 | .cm-s-midnight div.CodeMirror-selected {background: #314D67 !important;} 18 | .cm-s-midnight .CodeMirror-gutters {background: #0F192A; border-right: 1px solid;} 19 | .cm-s-midnight .CodeMirror-linenumber {color: #D0D0D0;} 20 | .cm-s-midnight .CodeMirror-cursor { 21 | border-left: 1px solid #F8F8F0 !important; 22 | } 23 | 24 | .cm-s-midnight span.cm-comment {color: #428BDD;} 25 | .cm-s-midnight span.cm-atom {color: #AE81FF;} 26 | .cm-s-midnight span.cm-number {color: #D1EDFF;} 27 | 28 | .cm-s-midnight span.cm-property, .cm-s-midnight span.cm-attribute {color: #A6E22E;} 29 | .cm-s-midnight span.cm-keyword {color: #E83737;} 30 | .cm-s-midnight span.cm-string {color: #1DC116;} 31 | 32 | .cm-s-midnight span.cm-variable {color: #FFAA3E;} 33 | .cm-s-midnight span.cm-variable-2 {color: #FFAA3E;} 34 | .cm-s-midnight span.cm-def {color: #4DD;} 35 | .cm-s-midnight span.cm-bracket {color: #D1EDFF;} 36 | .cm-s-midnight span.cm-tag {color: #449;} 37 | .cm-s-midnight span.cm-link {color: #AE81FF;} 38 | .cm-s-midnight span.cm-error {background: #F92672; color: #F8F8F0;} 39 | 40 | .cm-s-midnight .CodeMirror-matchingbracket { 41 | text-decoration: underline; 42 | color: white !important; 43 | } 44 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/javascript/typescript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: TypeScript mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    TypeScript mode

    27 | 28 | 29 |
    51 | 52 | 59 | 60 |

    This is a specialization of the JavaScript mode.

    61 |
    62 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/sparql/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: SPARQL mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 25 | 26 |
    27 |

    SPARQL mode

    28 |
    44 | 51 | 52 |

    MIME types defined: application/x-sparql-query.

    53 | 54 |
    55 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/sass/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Sass mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 25 | 26 |
    27 |

    Sass mode

    28 |
    58 | 64 | 65 |

    MIME types defined: text/x-sass.

    66 |
    67 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/erlang-dark.css: -------------------------------------------------------------------------------- 1 | .cm-s-erlang-dark.CodeMirror { background: #002240; color: white; } 2 | .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; } 5 | .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-erlang-dark span.cm-atom { color: #f133f1; } 8 | .cm-s-erlang-dark span.cm-attribute { color: #ff80e1; } 9 | .cm-s-erlang-dark span.cm-bracket { color: #ff9d00; } 10 | .cm-s-erlang-dark span.cm-builtin { color: #eaa; } 11 | .cm-s-erlang-dark span.cm-comment { color: #77f; } 12 | .cm-s-erlang-dark span.cm-def { color: #e7a; } 13 | .cm-s-erlang-dark span.cm-keyword { color: #ffee80; } 14 | .cm-s-erlang-dark span.cm-meta { color: #50fefe; } 15 | .cm-s-erlang-dark span.cm-number { color: #ffd0d0; } 16 | .cm-s-erlang-dark span.cm-operator { color: #d55; } 17 | .cm-s-erlang-dark span.cm-property { color: #ccc; } 18 | .cm-s-erlang-dark span.cm-qualifier { color: #ccc; } 19 | .cm-s-erlang-dark span.cm-quote { color: #ccc; } 20 | .cm-s-erlang-dark span.cm-special { color: #ffbbbb; } 21 | .cm-s-erlang-dark span.cm-string { color: #3ad900; } 22 | .cm-s-erlang-dark span.cm-string-2 { color: #ccc; } 23 | .cm-s-erlang-dark span.cm-tag { color: #9effff; } 24 | .cm-s-erlang-dark span.cm-variable { color: #50fe50; } 25 | .cm-s-erlang-dark span.cm-variable-2 { color: #e0e; } 26 | .cm-s-erlang-dark span.cm-variable-3 { color: #ccc; } 27 | .cm-s-erlang-dark span.cm-error { color: #9d1e15; } 28 | 29 | .cm-s-erlang-dark .CodeMirror-activeline-background {background: #013461 !important;} 30 | .cm-s-erlang-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} 31 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/perl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Perl mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Perl mode

    27 | 28 | 29 |
    67 | 68 | 73 | 74 |

    MIME types defined: text/x-perl.

    75 |
    76 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/css/less_test.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | 4 | var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-less"); 5 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "less"); } 6 | 7 | MT("variable", 8 | "[variable-2 @base]: [atom #f04615];", 9 | "[qualifier .class] {", 10 | " [property width]: [variable percentage]([number 0.5]); [comment // returns `50%`]", 11 | " [property color]: [variable saturate]([variable-2 @base], [number 5%]);", 12 | "}"); 13 | 14 | MT("amp", 15 | "[qualifier .child], [qualifier .sibling] {", 16 | " [qualifier .parent] [atom &] {", 17 | " [property color]: [keyword black];", 18 | " }", 19 | " [atom &] + [atom &] {", 20 | " [property color]: [keyword red];", 21 | " }", 22 | "}"); 23 | 24 | MT("mixin", 25 | "[qualifier .mixin] ([variable dark]; [variable-2 @color]) {", 26 | " [property color]: [variable darken]([variable-2 @color], [number 10%]);", 27 | "}", 28 | "[qualifier .mixin] ([variable light]; [variable-2 @color]) {", 29 | " [property color]: [variable lighten]([variable-2 @color], [number 10%]);", 30 | "}", 31 | "[qualifier .mixin] ([variable-2 @_]; [variable-2 @color]) {", 32 | " [property display]: [atom block];", 33 | "}", 34 | "[variable-2 @switch]: [variable light];", 35 | "[qualifier .class] {", 36 | " [qualifier .mixin]([variable-2 @switch]; [atom #888]);", 37 | "}"); 38 | 39 | MT("nest", 40 | "[qualifier .one] {", 41 | " [def @media] ([property width]: [number 400px]) {", 42 | " [property font-size]: [number 1.2em];", 43 | " [def @media] [attribute print] [keyword and] [property color] {", 44 | " [property color]: [keyword blue];", 45 | " }", 46 | " }", 47 | "}"); 48 | })(); 49 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/tomorrow-night-eighties.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Tomorrow Night - Eighties 4 | Author: Chris Kempson 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-tomorrow-night-eighties.CodeMirror {background: #000000; color: #CCCCCC;} 12 | .cm-s-tomorrow-night-eighties div.CodeMirror-selected {background: #2D2D2D !important;} 13 | .cm-s-tomorrow-night-eighties .CodeMirror-gutters {background: #000000; border-right: 0px;} 14 | .cm-s-tomorrow-night-eighties .CodeMirror-linenumber {color: #515151;} 15 | .cm-s-tomorrow-night-eighties .CodeMirror-cursor {border-left: 1px solid #6A6A6A !important;} 16 | 17 | .cm-s-tomorrow-night-eighties span.cm-comment {color: #d27b53;} 18 | .cm-s-tomorrow-night-eighties span.cm-atom {color: #a16a94;} 19 | .cm-s-tomorrow-night-eighties span.cm-number {color: #a16a94;} 20 | 21 | .cm-s-tomorrow-night-eighties span.cm-property, .cm-s-tomorrow-night-eighties span.cm-attribute {color: #99cc99;} 22 | .cm-s-tomorrow-night-eighties span.cm-keyword {color: #f2777a;} 23 | .cm-s-tomorrow-night-eighties span.cm-string {color: #ffcc66;} 24 | 25 | .cm-s-tomorrow-night-eighties span.cm-variable {color: #99cc99;} 26 | .cm-s-tomorrow-night-eighties span.cm-variable-2 {color: #6699cc;} 27 | .cm-s-tomorrow-night-eighties span.cm-def {color: #f99157;} 28 | .cm-s-tomorrow-night-eighties span.cm-bracket {color: #CCCCCC;} 29 | .cm-s-tomorrow-night-eighties span.cm-tag {color: #f2777a;} 30 | .cm-s-tomorrow-night-eighties span.cm-link {color: #a16a94;} 31 | .cm-s-tomorrow-night-eighties span.cm-error {background: #f2777a; color: #6A6A6A;} 32 | 33 | .cm-s-tomorrow-night-eighties .CodeMirror-activeline-background {background: #343600 !important;} 34 | .cm-s-tomorrow-night-eighties .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 35 | -------------------------------------------------------------------------------- /model/auctionsTimeRelative.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var db = require(__dirname + '/../db'); 5 | var async = require('async'); 6 | 7 | module.exports = function(req, cb) { 8 | // database call 9 | db.auctionsTimeRelative(function(err, auctions) { 10 | if (!err) { 11 | // handle the each of the four arrays 12 | async.parallel({ 13 | open: function(callback) { 14 | async.map(auctions.open, db.appendBidsToAuction, function(err, results) { 15 | if (err) { auctions.open = []; } 16 | else { 17 | auctions.open = results; 18 | callback(null, auctions.open); 19 | } 20 | }); 21 | }, 22 | closed: function(callback) { 23 | async.map(auctions.closed, db.appendBidsToAuction, function(err, results) { 24 | if (err) { auctions.closed = []; } 25 | else { 26 | auctions.closed = results; 27 | callback(null, auctions.closed); 28 | } 29 | }); 30 | }, 31 | future: function(callback) { 32 | async.map(auctions.future, db.appendBidsToAuction, function(err, results) { 33 | if (err) { auctions.future = []; } 34 | else { 35 | auctions.future = results; 36 | callback(null, auctions.future); 37 | } 38 | }); 39 | }, 40 | past: function(callback) { 41 | async.map(auctions.past, db.appendBidsToAuction, function(err, results) { 42 | if (err) { auctions.past = []; } 43 | else { 44 | auctions.past = results; 45 | callback(null, auctions.past); 46 | } 47 | }); 48 | } 49 | }, 50 | function(err, results) { 51 | if (!err) { cb(null, auctions); } 52 | else { cb(err, []); } 53 | }); 54 | } // end if 55 | else { cb(err, []); } 56 | }); 57 | }; -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/css/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: CSS mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    CSS mode

    27 |
    62 | 65 | 66 |

    MIME types defined: text/css, text/x-scss (demo), text/x-less (demo).

    67 | 68 |

    Parsing/Highlighting Tests: normal, verbose.

    69 | 70 |
    71 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/mode/loadmode.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; 3 | 4 | var loading = {}; 5 | function splitCallback(cont, n) { 6 | var countDown = n; 7 | return function() { if (--countDown == 0) cont(); }; 8 | } 9 | function ensureDeps(mode, cont) { 10 | var deps = CodeMirror.modes[mode].dependencies; 11 | if (!deps) return cont(); 12 | var missing = []; 13 | for (var i = 0; i < deps.length; ++i) { 14 | if (!CodeMirror.modes.hasOwnProperty(deps[i])) 15 | missing.push(deps[i]); 16 | } 17 | if (!missing.length) return cont(); 18 | var split = splitCallback(cont, missing.length); 19 | for (var i = 0; i < missing.length; ++i) 20 | CodeMirror.requireMode(missing[i], split); 21 | } 22 | 23 | CodeMirror.requireMode = function(mode, cont) { 24 | if (typeof mode != "string") mode = mode.name; 25 | if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); 26 | if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); 27 | 28 | var script = document.createElement("script"); 29 | script.src = CodeMirror.modeURL.replace(/%N/g, mode); 30 | var others = document.getElementsByTagName("script")[0]; 31 | others.parentNode.insertBefore(script, others); 32 | var list = loading[mode] = [cont]; 33 | var count = 0, poll = setInterval(function() { 34 | if (++count > 100) return clearInterval(poll); 35 | if (CodeMirror.modes.hasOwnProperty(mode)) { 36 | clearInterval(poll); 37 | loading[mode] = null; 38 | ensureDeps(mode, function() { 39 | for (var i = 0; i < list.length; ++i) list[i](); 40 | }); 41 | } 42 | }, 200); 43 | }; 44 | 45 | CodeMirror.autoLoadMode = function(instance, mode) { 46 | if (!CodeMirror.modes.hasOwnProperty(mode)) 47 | CodeMirror.requireMode(mode, function() { 48 | instance.setOption("mode", instance.getOption("mode")); 49 | }); 50 | }; 51 | }()); 52 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/shell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Shell mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 27 | 28 |
    29 |

    Shell mode

    30 | 31 | 32 | 56 | 57 | 64 | 65 |

    MIME types defined: text/x-sh.

    66 |
    67 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/properties/properties.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("properties", function() { 2 | return { 3 | token: function(stream, state) { 4 | var sol = stream.sol() || state.afterSection; 5 | var eol = stream.eol(); 6 | 7 | state.afterSection = false; 8 | 9 | if (sol) { 10 | if (state.nextMultiline) { 11 | state.inMultiline = true; 12 | state.nextMultiline = false; 13 | } else { 14 | state.position = "def"; 15 | } 16 | } 17 | 18 | if (eol && ! state.nextMultiline) { 19 | state.inMultiline = false; 20 | state.position = "def"; 21 | } 22 | 23 | if (sol) { 24 | while(stream.eatSpace()); 25 | } 26 | 27 | var ch = stream.next(); 28 | 29 | if (sol && (ch === "#" || ch === "!" || ch === ";")) { 30 | state.position = "comment"; 31 | stream.skipToEnd(); 32 | return "comment"; 33 | } else if (sol && ch === "[") { 34 | state.afterSection = true; 35 | stream.skipTo("]"); stream.eat("]"); 36 | return "header"; 37 | } else if (ch === "=" || ch === ":") { 38 | state.position = "quote"; 39 | return null; 40 | } else if (ch === "\\" && state.position === "quote") { 41 | if (stream.next() !== "u") { // u = Unicode sequence \u1234 42 | // Multiline value 43 | state.nextMultiline = true; 44 | } 45 | } 46 | 47 | return state.position; 48 | }, 49 | 50 | startState: function() { 51 | return { 52 | position : "def", // Current position, "def", "quote" or "comment" 53 | nextMultiline : false, // Is the next line multiline value 54 | inMultiline : false, // Is the current line a multiline value 55 | afterSection : false // Did we just open a section 56 | }; 57 | } 58 | 59 | }; 60 | }); 61 | 62 | CodeMirror.defineMIME("text/x-properties", "properties"); 63 | CodeMirror.defineMIME("text/x-ini", "properties"); 64 | -------------------------------------------------------------------------------- /views/auction.ejs: -------------------------------------------------------------------------------- 1 | <% layout('sblayout') %> 2 | 3 |
    4 | 5 | <% include _registration_status %> 6 | <% if (auction.open) { %> 7 | 8 | Reminder: For each region in an auction, at least one approved ad for that region is also necessary to bid. 9 | 10 |
    11 | <% } %> 12 | 13 | <% include auctions/auction_show %> 14 | 15 |

    16 | 17 | <% if (bids) { %> 18 | 19 | <% for (var region in bids) { %> 20 | 21 |
    22 |
    23 | <%= region %> Bid History: 24 |
    25 | 26 |
    27 | <% for (var i=0; i < bids[region].length; i++) { %> 28 |
    29 |
    30 |
    31 | ID: <%= bids[region][i]._id %> 32 | <% if (bids[region][i].invalid === true) { %> 33 | INVALIDATED 34 | <% } %> 35 |
    36 | Date/Time: <%= bids[region][i].created_at %> 37 |
    38 |
    39 |
    40 | 47 |
    48 | Slots: <%= bids[region][i].slots %>
    49 |
    50 |
    51 | Price: <%= bids[region][i].price %>
    52 |
    53 |
    54 |
    55 | <% } %> 56 |
    57 |
    58 | <% } %> 59 | 60 | <% } %> 61 | 62 |
    63 | -------------------------------------------------------------------------------- /views/ai_auctions.ejs: -------------------------------------------------------------------------------- 1 | <% layout('sblayout') %> 2 |
    3 | 4 | 5 | 22 | 23 |
    24 |
    25 | Finished Auctions (Sorted by End Time) 26 |
    27 |
    28 | <% for (var i = 0; i < auctionsPast.length; i++) { %> 29 |
    30 | 31 | 37 | 38 |
    39 | Start: 40 | <%= auctionsPast[i].start %> 41 |
    42 | End: 43 | <%= auctionsPast[i].end %> 44 |
    45 | 46 |
    47 | Ads Start: 48 | <%= auctionsPast[i].adsStart %> 49 |
    50 | Ads End: 51 | <%= auctionsPast[i].adsEnd %> 52 |
    53 |
    54 | <% } %> 55 |
    56 |
    57 | 58 |
    59 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/edit/matchtags.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | 4 | CodeMirror.defineOption("matchTags", false, function(cm, val, old) { 5 | if (old && old != CodeMirror.Init) { 6 | cm.off("cursorActivity", doMatchTags); 7 | cm.off("viewportChange", maybeUpdateMatch); 8 | clear(cm); 9 | } 10 | if (val) { 11 | cm.state.matchBothTags = typeof val == "object" && val.bothTags; 12 | cm.on("cursorActivity", doMatchTags); 13 | cm.on("viewportChange", maybeUpdateMatch); 14 | doMatchTags(cm); 15 | } 16 | }); 17 | 18 | function clear(cm) { 19 | if (cm.state.tagHit) cm.state.tagHit.clear(); 20 | if (cm.state.tagOther) cm.state.tagOther.clear(); 21 | cm.state.tagHit = cm.state.tagOther = null; 22 | } 23 | 24 | function doMatchTags(cm) { 25 | cm.state.failedTagMatch = false; 26 | cm.operation(function() { 27 | clear(cm); 28 | if (cm.somethingSelected()) return; 29 | var cur = cm.getCursor(), range = cm.getViewport(); 30 | range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to); 31 | var match = CodeMirror.findMatchingTag(cm, cur, range); 32 | if (!match) return; 33 | if (cm.state.matchBothTags) { 34 | var hit = match.at == "open" ? match.open : match.close; 35 | if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"}); 36 | } 37 | var other = match.at == "close" ? match.open : match.close; 38 | if (other) 39 | cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"}); 40 | else 41 | cm.state.failedTagMatch = true; 42 | }); 43 | } 44 | 45 | function maybeUpdateMatch(cm) { 46 | if (cm.state.failedTagMatch) doMatchTags(cm); 47 | } 48 | 49 | CodeMirror.commands.toMatchingTag = function(cm) { 50 | var found = CodeMirror.findMatchingTag(cm, cm.getCursor()); 51 | if (found) { 52 | var other = found.at == "close" ? found.open : found.close; 53 | if (other) cm.setSelection(other.to, other.from); 54 | } 55 | }; 56 | })(); 57 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/gas/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Gas mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Gas mode

    27 |
    28 | 50 |
    51 | 52 | 58 | 59 |

    Handles AT&T assembler syntax (more specifically this handles 60 | the GNU Assembler (gas) syntax.) 61 | It takes a single optional configuration parameter: 62 | architecture, which can be one of "ARM", 63 | "ARMv6" or "x86". 64 | Including the parameter adds syntax for the registers and special 65 | directives for the supplied architecture. 66 | 67 |

    MIME types defined: text/x-gas

    68 |
    69 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/toml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: TOML Mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    TOML Mode

    27 |
    64 | 70 |

    The TOML Mode

    71 |

    Created by Forbes Lindesay.

    72 |

    MIME type defined: text/x-toml.

    73 |
    74 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/pegjs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeMirror: PEG.js Mode 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 28 | 29 |
    30 |

    PEG.js Mode

    31 |
    56 | 62 |

    The PEG.js Mode

    63 |

    Created by Forbes Lindesay.

    64 |
    65 | 66 | 67 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/tiki/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Tiki wiki mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 25 | 26 |
    27 |

    Tiki wiki mode

    28 | 29 | 30 |
    87 | 88 | 94 | 95 |
    96 | -------------------------------------------------------------------------------- /routes/api/bids.js: -------------------------------------------------------------------------------- 1 | /* jshint node: true */ 2 | 'use strict'; 3 | 4 | var auth = require(__dirname + '/../../middleware/ensure-auth'); 5 | var express = require('express'); 6 | var bids = express.Router(); 7 | var bidsCommon = require(__dirname + '/../common/bids'); 8 | 9 | module.exports = function(api) { 10 | // view bid 11 | bids.route('/:bidId') 12 | .get(function(req, res) { 13 | req.model.load('bid', req); 14 | req.model.end(function(err, models) { 15 | if (err) { console.log(err); res.json(err); } 16 | else { res.json({bid: models.bid}); } 17 | }); 18 | }); 19 | 20 | // update bid, admin only 21 | bids.route('/edit') 22 | .post(auth, function(req, res) { 23 | // updating bids is an admin only function 24 | if (!req.user.admin) { return res.redirect(req.browsePrefix); } 25 | req.params.bidId = req.body.bidId; 26 | req.model.load('bid', req); 27 | req.model.end(function(err, models) { 28 | if (err) { console.log(err); return res.json(err); } 29 | bidsCommon.updateBid(req, models, function(err, body) { 30 | if(err) { console.log(err); res.json(err); } 31 | else { res.json(body); } 32 | }); 33 | }); 34 | }); 35 | 36 | // create bid 37 | bids.route('/') 38 | .post(auth, function(req, res) { 39 | req.model.load('auctionUser', req); 40 | req.model.end(function(err, models) { 41 | if (err) { console.log(err); return res.json(err); } 42 | bidsCommon.newBid(req, models, function(err, body) { 43 | if (err) { console.log(err); res.json(err); } 44 | else { res.json(body); } 45 | }); 46 | }); 47 | }); 48 | 49 | // delete bid, admin only 50 | bids.route('/:bidId') 51 | .delete(auth, function(req, res) { 52 | // deleting bids is an admin only function 53 | if (!req.user.admin) { return res.redirect(req.browsePrefix); } 54 | 55 | req.model.load('bid', req); 56 | req.model.end(function(err, models) { 57 | bidsCommon.deleteBid(req, models, function(results) { 58 | if (err) { console.log(err); res.json(err); } 59 | else { res.json(results); } 60 | }); 61 | }); 62 | }); 63 | 64 | api.use('/bids', bids); 65 | }; 66 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/pastel-on-dark.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Pastel On Dark theme ported from ACE editor 3 | * @license MIT 4 | * @copyright AtomicPages LLC 2014 5 | * @author Dennis Thompson, AtomicPages LLC 6 | * @version 1.1 7 | * @source https://github.com/atomicpages/codemirror-pastel-on-dark-theme 8 | */ 9 | 10 | .cm-s-pastel-on-dark.CodeMirror { 11 | background: #2c2827; 12 | color: #8F938F; 13 | line-height: 1.5; 14 | font-family: consolas, Courier, monospace; 15 | font-size: 14px; 16 | } 17 | .cm-s-pastel-on-dark div.CodeMirror-selected { background: rgba(221,240,255,0.2) !important; } 18 | .cm-s-pastel-on-dark .CodeMirror-gutters { 19 | background: #34302f; 20 | border-right: 0px; 21 | padding: 0 3px; 22 | } 23 | .cm-s-pastel-on-dark .CodeMirror-linenumber { color: #8F938F; } 24 | .cm-s-pastel-on-dark .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } 25 | .cm-s-pastel-on-dark span.cm-comment { color: #A6C6FF; } 26 | .cm-s-pastel-on-dark span.cm-atom { color: #DE8E30; } 27 | .cm-s-pastel-on-dark span.cm-number { color: #CCCCCC; } 28 | .cm-s-pastel-on-dark span.cm-property { color: #8F938F; } 29 | .cm-s-pastel-on-dark span.cm-attribute { color: #a6e22e; } 30 | .cm-s-pastel-on-dark span.cm-keyword { color: #AEB2F8; } 31 | .cm-s-pastel-on-dark span.cm-string { color: #66A968; } 32 | .cm-s-pastel-on-dark span.cm-variable { color: #AEB2F8; } 33 | .cm-s-pastel-on-dark span.cm-variable-2 { color: #BEBF55; } 34 | .cm-s-pastel-on-dark span.cm-variable-3 { color: #DE8E30; } 35 | .cm-s-pastel-on-dark span.cm-def { color: #757aD8; } 36 | .cm-s-pastel-on-dark span.cm-bracket { color: #f8f8f2; } 37 | .cm-s-pastel-on-dark span.cm-tag { color: #C1C144; } 38 | .cm-s-pastel-on-dark span.cm-link { color: #ae81ff; } 39 | .cm-s-pastel-on-dark span.cm-qualifier,.cm-s-pastel-on-dark span.cm-builtin { color: #C1C144; } 40 | .cm-s-pastel-on-dark span.cm-error { 41 | background: #757aD8; 42 | color: #f8f8f0; 43 | } 44 | .cm-s-pastel-on-dark .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.031) !important; } 45 | .cm-s-pastel-on-dark .CodeMirror-matchingbracket { 46 | border: 1px solid rgba(255,255,255,0.25); 47 | color: #8F938F !important; 48 | margin: -1px -1px 0 -1px; 49 | } 50 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/smalltalk/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Smalltalk mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 29 | 30 |
    31 |

    Smalltalk mode

    32 |
    55 | 56 | 64 | 65 |

    Simple Smalltalk mode.

    66 | 67 |

    MIME types defined: text/x-stsrc.

    68 |
    69 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/xml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: XML mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    XML mode

    27 |
    39 | 45 |

    The XML mode supports two configuration parameters:

    46 |
    47 |
    htmlMode (boolean)
    48 |
    This switches the mode to parse HTML instead of XML. This 49 | means attributes do not have to be quoted, and some elements 50 | (such as br) do not require a closing tag.
    51 |
    alignCDATA (boolean)
    52 |
    Setting this to true will force the opening tag of CDATA 53 | blocks to not be indented.
    54 |
    55 | 56 |

    MIME types defined: application/xml, text/html.

    57 |
    58 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/php/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: PHP mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 30 | 31 |
    32 |

    PHP mode

    33 |
    44 | 45 | 56 | 57 |

    Simple HTML/PHP mode based on 58 | the C-like mode. Depends on XML, 59 | JavaScript, CSS, HTMLMixed, and C-like modes.

    60 | 61 |

    MIME types defined: application/x-httpd-php (HTML with PHP code), text/x-php (plain, non-wrapped PHP code).

    62 |
    63 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/tern/tern.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-Tern-completion { 2 | padding-left: 22px; 3 | position: relative; 4 | } 5 | .CodeMirror-Tern-completion:before { 6 | position: absolute; 7 | left: 2px; 8 | bottom: 2px; 9 | border-radius: 50%; 10 | font-size: 12px; 11 | font-weight: bold; 12 | height: 15px; 13 | width: 15px; 14 | line-height: 16px; 15 | text-align: center; 16 | color: white; 17 | -moz-box-sizing: border-box; 18 | box-sizing: border-box; 19 | } 20 | .CodeMirror-Tern-completion-unknown:before { 21 | content: "?"; 22 | background: #4bb; 23 | } 24 | .CodeMirror-Tern-completion-object:before { 25 | content: "O"; 26 | background: #77c; 27 | } 28 | .CodeMirror-Tern-completion-fn:before { 29 | content: "F"; 30 | background: #7c7; 31 | } 32 | .CodeMirror-Tern-completion-array:before { 33 | content: "A"; 34 | background: #c66; 35 | } 36 | .CodeMirror-Tern-completion-number:before { 37 | content: "1"; 38 | background: #999; 39 | } 40 | .CodeMirror-Tern-completion-string:before { 41 | content: "S"; 42 | background: #999; 43 | } 44 | .CodeMirror-Tern-completion-bool:before { 45 | content: "B"; 46 | background: #999; 47 | } 48 | 49 | .CodeMirror-Tern-completion-guess { 50 | color: #999; 51 | } 52 | 53 | .CodeMirror-Tern-tooltip { 54 | border: 1px solid silver; 55 | border-radius: 3px; 56 | color: #444; 57 | padding: 2px 5px; 58 | font-size: 90%; 59 | font-family: monospace; 60 | background-color: white; 61 | white-space: pre-wrap; 62 | 63 | max-width: 40em; 64 | position: absolute; 65 | z-index: 10; 66 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 67 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 68 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 69 | 70 | transition: opacity 1s; 71 | -moz-transition: opacity 1s; 72 | -webkit-transition: opacity 1s; 73 | -o-transition: opacity 1s; 74 | -ms-transition: opacity 1s; 75 | } 76 | 77 | .CodeMirror-Tern-hint-doc { 78 | max-width: 25em; 79 | } 80 | 81 | .CodeMirror-Tern-fname { color: black; } 82 | .CodeMirror-Tern-farg { color: #70a; } 83 | .CodeMirror-Tern-farg-current { text-decoration: underline; } 84 | .CodeMirror-Tern-type { color: #07c; } 85 | .CodeMirror-Tern-fhint-guess { opacity: .7; } 86 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/runmode/runmode.js: -------------------------------------------------------------------------------- 1 | CodeMirror.runMode = function(string, modespec, callback, options) { 2 | var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); 3 | var ie = /MSIE \d/.test(navigator.userAgent); 4 | var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9); 5 | 6 | if (callback.nodeType == 1) { 7 | var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; 8 | var node = callback, col = 0; 9 | node.innerHTML = ""; 10 | callback = function(text, style) { 11 | if (text == "\n") { 12 | // Emitting LF or CRLF on IE8 or earlier results in an incorrect display. 13 | // Emitting a carriage return makes everything ok. 14 | node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text)); 15 | col = 0; 16 | return; 17 | } 18 | var content = ""; 19 | // replace tabs 20 | for (var pos = 0;;) { 21 | var idx = text.indexOf("\t", pos); 22 | if (idx == -1) { 23 | content += text.slice(pos); 24 | col += text.length - pos; 25 | break; 26 | } else { 27 | col += idx - pos; 28 | content += text.slice(pos, idx); 29 | var size = tabSize - col % tabSize; 30 | col += size; 31 | for (var i = 0; i < size; ++i) content += " "; 32 | pos = idx + 1; 33 | } 34 | } 35 | 36 | if (style) { 37 | var sp = node.appendChild(document.createElement("span")); 38 | sp.className = "cm-" + style.replace(/ +/g, " cm-"); 39 | sp.appendChild(document.createTextNode(content)); 40 | } else { 41 | node.appendChild(document.createTextNode(content)); 42 | } 43 | }; 44 | } 45 | 46 | var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode); 47 | for (var i = 0, e = lines.length; i < e; ++i) { 48 | if (i) callback("\n"); 49 | var stream = new CodeMirror.StringStream(lines[i]); 50 | while (!stream.eol()) { 51 | var style = mode.token(stream, state); 52 | callback(stream.current(), style, i, stream.start, state); 53 | stream.start = stream.pos; 54 | } 55 | } 56 | }; 57 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/octave/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Octave mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    Octave mode

    27 | 28 |
    82 | 93 | 94 |

    MIME types defined: text/x-octave.

    95 |
    96 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/jinja2/jinja2.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineMode("jinja2", function() { 2 | var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif", 3 | "extends", "filter", "endfilter", "firstof", "for", 4 | "endfor", "if", "endif", "ifchanged", "endifchanged", 5 | "ifequal", "endifequal", "ifnotequal", 6 | "endifnotequal", "in", "include", "load", "not", "now", "or", 7 | "parsed", "regroup", "reversed", "spaceless", 8 | "endspaceless", "ssi", "templatetag", "openblock", 9 | "closeblock", "openvariable", "closevariable", 10 | "openbrace", "closebrace", "opencomment", 11 | "closecomment", "widthratio", "url", "with", "endwith", 12 | "get_current_language", "trans", "noop", "blocktrans", 13 | "endblocktrans", "get_available_languages", 14 | "get_current_language_bidi", "plural"]; 15 | keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b"); 16 | 17 | function tokenBase (stream, state) { 18 | var ch = stream.next(); 19 | if (ch == "{") { 20 | if (ch = stream.eat(/\{|%|#/)) { 21 | stream.eat("-"); 22 | state.tokenize = inTag(ch); 23 | return "tag"; 24 | } 25 | } 26 | } 27 | function inTag (close) { 28 | if (close == "{") { 29 | close = "}"; 30 | } 31 | return function (stream, state) { 32 | var ch = stream.next(); 33 | if ((ch == close || (ch == "-" && stream.eat(close))) 34 | && stream.eat("}")) { 35 | state.tokenize = tokenBase; 36 | return "tag"; 37 | } 38 | if (stream.match(keywords)) { 39 | return "keyword"; 40 | } 41 | return close == "#" ? "comment" : "string"; 42 | }; 43 | } 44 | return { 45 | startState: function () { 46 | return {tokenize: tokenBase}; 47 | }, 48 | token: function (stream, state) { 49 | return state.tokenize(stream, state); 50 | } 51 | }; 52 | }); 53 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/htmlembedded/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Html Embedded Scripts mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 28 | 29 |
    30 |

    Html Embedded Scripts mode

    31 |
    43 | 44 | 54 | 55 |

    Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on 56 | JavaScript, CSS and XML.
    Other dependancies include those of the scriping language chosen.

    57 | 58 |

    MIME types defined: application/x-aspx (ASP.NET), 59 | application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages)

    60 |
    61 | -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/xq-light.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2011 by MarkLogic Corporation 3 | Author: Mike Brevoort 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | */ 23 | .cm-s-xq-light span.cm-keyword {line-height: 1em; font-weight: bold; color: #5A5CAD; } 24 | .cm-s-xq-light span.cm-atom {color: #6C8CD5;} 25 | .cm-s-xq-light span.cm-number {color: #164;} 26 | .cm-s-xq-light span.cm-def {text-decoration:underline;} 27 | .cm-s-xq-light span.cm-variable {color: black; } 28 | .cm-s-xq-light span.cm-variable-2 {color:black;} 29 | .cm-s-xq-light span.cm-variable-3 {color: black; } 30 | .cm-s-xq-light span.cm-property {} 31 | .cm-s-xq-light span.cm-operator {} 32 | .cm-s-xq-light span.cm-comment {color: #0080FF; font-style: italic;} 33 | .cm-s-xq-light span.cm-string {color: red;} 34 | .cm-s-xq-light span.cm-meta {color: yellow;} 35 | .cm-s-xq-light span.cm-qualifier {color: grey} 36 | .cm-s-xq-light span.cm-builtin {color: #7EA656;} 37 | .cm-s-xq-light span.cm-bracket {color: #cc7;} 38 | .cm-s-xq-light span.cm-tag {color: #3F7F7F;} 39 | .cm-s-xq-light span.cm-attribute {color: #7F007F;} 40 | .cm-s-xq-light span.cm-error {color: #f00;} 41 | 42 | .cm-s-xq-light .CodeMirror-activeline-background {background: #e8f2ff !important;} 43 | .cm-s-xq-light .CodeMirror-matchingbracket {outline:1px solid grey;color:black !important;background:yellow;} -------------------------------------------------------------------------------- /public/scripts/codemirror/theme/lesser-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | http://lesscss.org/ dark theme 3 | Ported to CodeMirror by Peter Kroon 4 | */ 5 | .cm-s-lesser-dark { 6 | line-height: 1.3em; 7 | } 8 | .cm-s-lesser-dark { 9 | font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important; 10 | } 11 | 12 | .cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } 13 | .cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ 14 | .cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 15 | .cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/ 16 | 17 | .cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/ 18 | 19 | .cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; } 20 | .cm-s-lesser-dark .CodeMirror-linenumber { color: #777; } 21 | 22 | .cm-s-lesser-dark span.cm-keyword { color: #599eff; } 23 | .cm-s-lesser-dark span.cm-atom { color: #C2B470; } 24 | .cm-s-lesser-dark span.cm-number { color: #B35E4D; } 25 | .cm-s-lesser-dark span.cm-def {color: white;} 26 | .cm-s-lesser-dark span.cm-variable { color:#D9BF8C; } 27 | .cm-s-lesser-dark span.cm-variable-2 { color: #669199; } 28 | .cm-s-lesser-dark span.cm-variable-3 { color: white; } 29 | .cm-s-lesser-dark span.cm-property {color: #92A75C;} 30 | .cm-s-lesser-dark span.cm-operator {color: #92A75C;} 31 | .cm-s-lesser-dark span.cm-comment { color: #666; } 32 | .cm-s-lesser-dark span.cm-string { color: #BCD279; } 33 | .cm-s-lesser-dark span.cm-string-2 {color: #f50;} 34 | .cm-s-lesser-dark span.cm-meta { color: #738C73; } 35 | .cm-s-lesser-dark span.cm-qualifier {color: #555;} 36 | .cm-s-lesser-dark span.cm-builtin { color: #ff9e59; } 37 | .cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; } 38 | .cm-s-lesser-dark span.cm-tag { color: #669199; } 39 | .cm-s-lesser-dark span.cm-attribute {color: #00c;} 40 | .cm-s-lesser-dark span.cm-header {color: #a0a;} 41 | .cm-s-lesser-dark span.cm-quote {color: #090;} 42 | .cm-s-lesser-dark span.cm-hr {color: #999;} 43 | .cm-s-lesser-dark span.cm-link {color: #00c;} 44 | .cm-s-lesser-dark span.cm-error { color: #9d1e15; } 45 | 46 | .cm-s-lesser-dark .CodeMirror-activeline-background {background: #3C3A3A !important;} 47 | .cm-s-lesser-dark .CodeMirror-matchingbracket {outline:1px solid grey; color:white !important;} 48 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/apl/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: APL mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 27 | 28 |
    29 |

    APL mode

    30 |
    56 | 57 | 64 | 65 |

    Simple mode that tries to handle APL as well as it can.

    66 |

    It attempts to label functions/operators based upon 67 | monadic/dyadic usage (but this is far from fully fleshed out). 68 | This means there are meaningful classnames so hover states can 69 | have popups etc.

    70 | 71 |

    MIME types defined: text/apl (APL code)

    72 |
    73 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/comment/continuecomment.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var modes = ["clike", "css", "javascript"]; 3 | for (var i = 0; i < modes.length; ++i) 4 | CodeMirror.extendMode(modes[i], {blockCommentContinue: " * "}); 5 | 6 | function continueComment(cm) { 7 | var pos = cm.getCursor(), token = cm.getTokenAt(pos); 8 | if (token.type != "comment" || cm.getOption("disableInput")) return CodeMirror.Pass; 9 | var mode = CodeMirror.innerMode(cm.getMode(), token.state).mode; 10 | 11 | var insert; 12 | if (mode.blockCommentStart && mode.blockCommentContinue) { 13 | var end = token.string.indexOf(mode.blockCommentEnd); 14 | var full = cm.getRange(CodeMirror.Pos(pos.line, 0), CodeMirror.Pos(pos.line, token.end)), found; 15 | if (end != -1 && end == token.string.length - mode.blockCommentEnd.length) { 16 | // Comment ended, don't continue it 17 | } else if (token.string.indexOf(mode.blockCommentStart) == 0) { 18 | insert = full.slice(0, token.start); 19 | if (!/^\s*$/.test(insert)) { 20 | insert = ""; 21 | for (var i = 0; i < token.start; ++i) insert += " "; 22 | } 23 | } else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 && 24 | found + mode.blockCommentContinue.length > token.start && 25 | /^\s*$/.test(full.slice(0, found))) { 26 | insert = full.slice(0, found); 27 | } 28 | if (insert != null) insert += mode.blockCommentContinue; 29 | } 30 | if (insert == null && mode.lineComment) { 31 | var line = cm.getLine(pos.line), found = line.indexOf(mode.lineComment); 32 | if (found > -1) { 33 | insert = line.slice(0, found); 34 | if (/\S/.test(insert)) insert = null; 35 | else insert += mode.lineComment + line.slice(found + mode.lineComment.length).match(/^\s*/)[0]; 36 | } 37 | } 38 | 39 | if (insert != null) 40 | cm.replaceSelection("\n" + insert, "end"); 41 | else 42 | return CodeMirror.Pass; 43 | } 44 | 45 | CodeMirror.defineOption("continueComments", null, function(cm, val, prev) { 46 | if (prev && prev != CodeMirror.Init) 47 | cm.removeKeyMap("continueComment"); 48 | if (val) { 49 | var map = {name: "continueComment"}; 50 | map[typeof val == "string" ? val : "Enter"] = continueComment; 51 | cm.addKeyMap(map); 52 | } 53 | }); 54 | })(); 55 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/haml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: HAML mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 28 | 29 |
    30 |

    HAML mode

    31 |
    68 | 74 | 75 |

    MIME types defined: text/x-haml.

    76 | 77 |

    Parsing/Highlighting Tests: normal, verbose.

    78 | 79 |
    80 | -------------------------------------------------------------------------------- /public/scripts/codemirror/addon/mode/overlay.js: -------------------------------------------------------------------------------- 1 | // Utility function that allows modes to be combined. The mode given 2 | // as the base argument takes care of most of the normal mode 3 | // functionality, but a second (typically simple) mode is used, which 4 | // can override the style of text. Both modes get to parse all of the 5 | // text, but when both assign a non-null style to a piece of code, the 6 | // overlay wins, unless the combine argument was true, in which case 7 | // the styles are combined. 8 | 9 | // overlayParser is the old, deprecated name 10 | CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) { 11 | return { 12 | startState: function() { 13 | return { 14 | base: CodeMirror.startState(base), 15 | overlay: CodeMirror.startState(overlay), 16 | basePos: 0, baseCur: null, 17 | overlayPos: 0, overlayCur: null 18 | }; 19 | }, 20 | copyState: function(state) { 21 | return { 22 | base: CodeMirror.copyState(base, state.base), 23 | overlay: CodeMirror.copyState(overlay, state.overlay), 24 | basePos: state.basePos, baseCur: null, 25 | overlayPos: state.overlayPos, overlayCur: null 26 | }; 27 | }, 28 | 29 | token: function(stream, state) { 30 | if (stream.start == state.basePos) { 31 | state.baseCur = base.token(stream, state.base); 32 | state.basePos = stream.pos; 33 | } 34 | if (stream.start == state.overlayPos) { 35 | stream.pos = stream.start; 36 | state.overlayCur = overlay.token(stream, state.overlay); 37 | state.overlayPos = stream.pos; 38 | } 39 | stream.pos = Math.min(state.basePos, state.overlayPos); 40 | if (stream.eol()) state.basePos = state.overlayPos = 0; 41 | 42 | if (state.overlayCur == null) return state.baseCur; 43 | if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur; 44 | else return state.overlayCur; 45 | }, 46 | 47 | indent: base.indent && function(state, textAfter) { 48 | return base.indent(state.base, textAfter); 49 | }, 50 | electricChars: base.electricChars, 51 | 52 | innerMode: function(state) { return {state: state.base, mode: base}; }, 53 | 54 | blankLine: function(state) { 55 | if (base.blankLine) base.blankLine(state.base); 56 | if (overlay.blankLine) overlay.blankLine(state.overlay); 57 | } 58 | }; 59 | }; 60 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/yaml/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: YAML mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
    26 |

    YAML mode

    27 |
    74 | 77 | 78 |

    MIME types defined: text/x-yaml.

    79 | 80 |
    81 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/lua/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Lua mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 26 | 27 |
    28 |

    Lua mode

    29 |
    70 | 77 | 78 |

    Loosely based on Franciszek 79 | Wawrzak's CodeMirror 80 | 1 mode. One configuration parameter is 81 | supported, specials, to which you can provide an 82 | array of strings to have those identifiers highlighted with 83 | the lua-special style.

    84 |

    MIME types defined: text/x-lua.

    85 | 86 |
    87 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/rpm/changes/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: RPM changes mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 26 | 27 |
    28 |

    RPM changes mode

    29 | 30 |
    57 | 65 | 66 |

    MIME types defined: text/x-rpm-changes.

    67 |
    68 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/erlang/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Erlang mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 26 | 27 |
    28 |

    Erlang mode

    29 |
    65 | 66 | 74 | 75 |

    MIME types defined: text/x-erlang.

    76 |
    77 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/haskell/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Haskell mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 26 | 27 |
    28 |

    Haskell mode

    29 |
    63 | 64 | 71 | 72 |

    MIME types defined: text/x-haskell.

    73 |
    74 | -------------------------------------------------------------------------------- /public/scripts/codemirror/mode/go/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Go mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 26 | 27 |
    28 |

    Go mode

    29 |
    72 | 73 | 83 | 84 |

    MIME type: text/x-go

    85 |
    86 | --------------------------------------------------------------------------------