From 2017cf240fc1576e81a6fb9a53439f9fe76653e5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 13 Nov 2014 14:29:25 -0500 Subject: minified js via grunt --- Gruntfile.js | 163 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 Gruntfile.js (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..bba8f22 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,163 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + pkg: grunt.file.readJSON('package.json'), + concat: { + options: { + separator: "\n;\n" + }, + js: { + src: [ + "public/assets/javascripts/vendor/bower_components/jquery/dist/jquery.min.js", + "public/assets/javascripts/vendor/bower_components/lodash/dist/lodash.min.js", + "public/assets/javascripts/vendor/bower_components/momentjs/min/moment.min.js", + "public/assets/javascripts/vendor/bower_components/fiber/src/fiber.min.js", + "public/assets/javascripts/vendor/bower_components/prefixfree/prefixfree.min.js", + "public/assets/javascripts/vendor/bower_components/marked/lib/marked.js", + "public/assets/javascripts/vendor/tube.js", + "public/assets/javascripts/vendor/loader.js", + "public/assets/javascripts/vendor/polyfill.js", + "public/assets/javascripts/vendor/chardinjs.min.js", + "public/assets/javascripts/vendor/sha1.js", + "public/assets/javascripts/vendor/dataUriToBlob.js", + "public/assets/javascripts/vendor/froogaloop.js", + "public/assets/javascripts/util.js", + + "public/assets/javascripts/mx/mx.js", + "public/assets/javascripts/mx/extensions/mx.scene.js", + "public/assets/javascripts/mx/extensions/mx.movements.js", + "public/assets/javascripts/mx/extensions/mx.movementsMobile.js", + "public/assets/javascripts/mx/primitives/mx.image.js", + "public/assets/javascripts/mx/primitives/mx.text.js", + "public/assets/javascripts/mx/primitives/mx.video.js", + "public/assets/javascripts/mx/primitives/mx.youtube.js", + "public/assets/javascripts/mx/primitives/mx.vimeo.js", + + "public/assets/javascripts/rectangles/_env.js", + + "public/assets/javascripts/rectangles/util/constants.js", + "public/assets/javascripts/rectangles/util/colors.js", + "public/assets/javascripts/rectangles/util/coords.js", + "public/assets/javascripts/rectangles/util/debug.js", + "public/assets/javascripts/rectangles/util/keys.js", + "public/assets/javascripts/rectangles/util/measurement.js", + "public/assets/javascripts/rectangles/util/minotaur.js", + "public/assets/javascripts/rectangles/util/mouse.js", + "public/assets/javascripts/rectangles/util/permissions.js", + "public/assets/javascripts/rectangles/util/sort.js", + "public/assets/javascripts/rectangles/util/uid.js", + "public/assets/javascripts/rectangles/util/undostack.js", + "public/assets/javascripts/rectangles/util/wheel.js", + + "public/assets/javascripts/rectangles/models/vec2.js", + "public/assets/javascripts/rectangles/models/vec3.js", + "public/assets/javascripts/rectangles/models/rect.js", + "public/assets/javascripts/rectangles/models/surface.js", + "public/assets/javascripts/rectangles/models/tree.js", + "public/assets/javascripts/rectangles/models/room.js", + "public/assets/javascripts/rectangles/models/wall.js", + "public/assets/javascripts/rectangles/models/floor.js", + + "public/assets/javascripts/rectangles/engine/rooms/_rooms.js", + "public/assets/javascripts/rectangles/engine/rooms/_walls.js", + "public/assets/javascripts/rectangles/engine/rooms/builder.js", + "public/assets/javascripts/rectangles/engine/rooms/clipper.js", + "public/assets/javascripts/rectangles/engine/rooms/grouper.js", + "public/assets/javascripts/rectangles/engine/rooms/mover.js", + + "public/assets/javascripts/rectangles/engine/scenery/_scenery.js", + "public/assets/javascripts/rectangles/engine/scenery/move.js", + "public/assets/javascripts/rectangles/engine/scenery/resize.js", + "public/assets/javascripts/rectangles/engine/scenery/randomize.js", + "public/assets/javascripts/rectangles/engine/scenery/undo.js", + "public/assets/javascripts/rectangles/engine/scenery/types/_object.js", + "public/assets/javascripts/rectangles/engine/scenery/types/image.js", + "public/assets/javascripts/rectangles/engine/scenery/types/text.js", + "public/assets/javascripts/rectangles/engine/scenery/types/video.js", + + "public/assets/javascripts/rectangles/engine/map/_map.js", + "public/assets/javascripts/rectangles/engine/map/ui_editor.js", + "public/assets/javascripts/rectangles/engine/map/ui_minimap.js", + "public/assets/javascripts/rectangles/engine/map/draw.js", + + "public/assets/javascripts/ui/lib/View.js", + "public/assets/javascripts/ui/lib/Router.js", + "public/assets/javascripts/ui/lib/ModalView.js", + "public/assets/javascripts/ui/lib/FormView.js", + "public/assets/javascripts/ui/lib/UploadView.js", + "public/assets/javascripts/ui/lib/AlertModal.js", + "public/assets/javascripts/ui/lib/ConfirmModal.js", + "public/assets/javascripts/ui/lib/ErrorModal.js", + "public/assets/javascripts/ui/lib/Parser.js", + "public/assets/javascripts/ui/lib/LabColorPicker.js", + + "public/assets/javascripts/ui/site/SignInModal.js", + "public/assets/javascripts/ui/site/SignUpModal.js", + "public/assets/javascripts/ui/site/UsernameTaken.js", + "public/assets/javascripts/ui/site/PasswordForgot.js", + "public/assets/javascripts/ui/site/PasswordReset.js", + "public/assets/javascripts/ui/site/LayoutsModal.js", + "public/assets/javascripts/ui/site/EditProjectModal.js", + "public/assets/javascripts/ui/site/EditProfileModal.js", + "public/assets/javascripts/ui/site/DocumentModal.js", + + "public/assets/javascripts/ui/site/HomeView.js", + "public/assets/javascripts/ui/site/ProfileView.js", + "public/assets/javascripts/ui/site/ProjectList.js", + + "public/assets/javascripts/ui/builder/BuilderView.js", + "public/assets/javascripts/ui/builder/BuilderSettings.js", + "public/assets/javascripts/ui/builder/BuilderToolbar.js", + "public/assets/javascripts/ui/builder/BuilderInfo.js", + + "public/assets/javascripts/ui/editor/EditorView.js", + "public/assets/javascripts/ui/editor/EditorSettings.js", + "public/assets/javascripts/ui/editor/EditorToolbar.js", + "public/assets/javascripts/ui/editor/HelpCursor.js", + "public/assets/javascripts/ui/editor/ColorControl.js", + "public/assets/javascripts/ui/editor/Collaborators.js", + "public/assets/javascripts/ui/editor/MediaEditor.js", + "public/assets/javascripts/ui/editor/MediaUpload.js", + "public/assets/javascripts/ui/editor/MediaViewer.js", + "public/assets/javascripts/ui/editor/Presets.js", + "public/assets/javascripts/ui/editor/TextEditor.js", + "public/assets/javascripts/ui/editor/WallpaperPicker.js", + + "public/assets/javascripts/ui/reader/ReaderView.js", + "public/assets/javascripts/ui/reader/ShareView.js", + "public/assets/javascripts/ui/reader/EmbedView.js", + "public/assets/javascripts/ui/reader/MediaPlayer.js", + "public/assets/javascripts/ui/reader/Tracker.js", + + "public/assets/javascripts/ui/_router.js", + + "public/assets/javascripts/app.js", + "public/assets/javascripts/defaults.js", + ], + dest: 'public/assets/javascripts/app.concat.js', + } + }, + uglify: { + options: { + banner: '/* vvalls by okfoc.us 2014 */\n' + }, + js: { + src: 'public/assets/javascripts/app.concat.js', + dest: 'public/assets/javascripts/app.min.js', + } + }, + clean: { + release: ["public/assets/javascripts/app.concat.js"], + } + }); + + // Load tasks that we'll be using + grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-uglify'); + grunt.loadNpmTasks('grunt-contrib-clean'); + + // Default task(s). + grunt.registerTask('js', ['concat:js', 'uglify:js', 'clean:release']); + grunt.registerTask('default', ['js']); +}; + -- cgit v1.2.3-70-g09d2 From d729d5f58fa4a4a30e252ab063bcf636559945b0 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 14 Nov 2014 16:43:26 -0500 Subject: soundcloud support --- Gruntfile.js | 2 + .../assets/javascripts/mx/primitives/mx.image.js | 2 +- .../javascripts/mx/primitives/mx.soundcloud.js | 122 +++++++++++++++++++++ .../rectangles/engine/scenery/_scenery.js | 5 + .../rectangles/engine/scenery/types/audio.js | 73 ++++++++++++ public/assets/javascripts/ui/editor/MediaViewer.js | 5 + public/assets/javascripts/ui/lib/Parser.js | 17 +-- public/assets/javascripts/ui/reader/MediaPlayer.js | 3 + views/partials/scripts.ejs | 3 + 9 files changed, 224 insertions(+), 8 deletions(-) create mode 100644 public/assets/javascripts/mx/primitives/mx.soundcloud.js create mode 100644 public/assets/javascripts/rectangles/engine/scenery/types/audio.js (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index bba8f22..c99976d 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -32,6 +32,7 @@ module.exports = function(grunt) { "public/assets/javascripts/mx/primitives/mx.video.js", "public/assets/javascripts/mx/primitives/mx.youtube.js", "public/assets/javascripts/mx/primitives/mx.vimeo.js", + "public/assets/javascripts/mx/primitives/mx.soundcloud.js", "public/assets/javascripts/rectangles/_env.js", @@ -74,6 +75,7 @@ module.exports = function(grunt) { "public/assets/javascripts/rectangles/engine/scenery/types/image.js", "public/assets/javascripts/rectangles/engine/scenery/types/text.js", "public/assets/javascripts/rectangles/engine/scenery/types/video.js", + "public/assets/javascripts/rectangles/engine/scenery/types/audio.js", "public/assets/javascripts/rectangles/engine/map/_map.js", "public/assets/javascripts/rectangles/engine/map/ui_editor.js", diff --git a/public/assets/javascripts/mx/primitives/mx.image.js b/public/assets/javascripts/mx/primitives/mx.image.js index 575e9c0..b8557bf 100644 --- a/public/assets/javascripts/mx/primitives/mx.image.js +++ b/public/assets/javascripts/mx/primitives/mx.image.js @@ -12,7 +12,7 @@ MX.Image = MX.Object3D.extend({ this.backface = ops.backface || false ops.className && this.el.classList.add(ops.className) - this.backface && this.el.classList.add("backface-visible") + this.backface && this.el.classList.add("backface-visible") this.el.classList.add("image") this.el.classList.add("mx-scenery") diff --git a/public/assets/javascripts/mx/primitives/mx.soundcloud.js b/public/assets/javascripts/mx/primitives/mx.soundcloud.js new file mode 100644 index 0000000..6ac64bb --- /dev/null +++ b/public/assets/javascripts/mx/primitives/mx.soundcloud.js @@ -0,0 +1,122 @@ +MX.Soundcloud = MX.Object3D.extend({ + init: function (ops) { + + this.type = "Soundcloud" + this.media = ops.media + this.width = 0 + this.height = 0 + this.x = ops.x || 0 + this.y = ops.y || 0 + this.z = ops.z || 0 + this.scale = ops.scale || 1 + this.backface = ops.backface || false + + ops.className && this.el.classList.add(ops.className) + this.backface && this.el.classList.add("backface-visible") + this.el.classList.add("audio") + this.el.classList.add("mx-scenery") + + this.el.style.backgroundRepeat = 'no-repeat' + + this.ops = ops + }, + + load: function(ops){ + if (ops) { + ops = this.ops = defaults(ops, this.ops) + } + else { + ops = this.ops + } + + this.width = ops.media.width + this.height = ops.media.height + + var tag = Parser.lookup.soundcloud.tag(ops.media) + var $iframe = $(tag) + var iframe = $iframe[0] + $iframe.css('z-index', '-1') + this.el.appendChild( iframe ) + + var overlay = this.overlay = document.createElement("div") + overlay.style.width = "100%" + overlay.style.height = "100%" + overlay.style.position = "absolute" + overlay.style.top = "0" + overlay.style.left = "0" + overlay.style.zIndex = "2" + overlay.className = "overlay" + this.el.appendChild(overlay) + + this.player = SC.Widget( iframe ) + this.player.setVolume(80) + + this.duration = 0 + + this.player.bind(SC.Widget.Events.READY, this.ready.bind(this)) +// this.player.bind(SC.Widget.Events.LOAD_PROGRESS, this.loadProgress.bind(this)) +// this.player.bind(SC.Widget.Events.PLAY_PROGRESS, this.playProgress.bind(this)) + this.player.bind(SC.Widget.Events.PLAY, this.didPlay.bind(this)) + this.player.bind(SC.Widget.Events.PAUSE, this.didPause.bind(this)) + this.player.bind(SC.Widget.Events.FINISH, this.finished.bind(this)) + }, + + ready: function(){ + if (this.media.autoplay) { + this.play() + } + + this.player.getDuration(function(duration){ + this.duration = duration + }.bind(this)) + }, + + play: function(){ + this.player.play() + }, + + pause: function(){ + this.player.pause() + }, + + toggle: function(state){ + if (typeof state === "boolean") { + if (state) this.play() + else this.pause() + } + else { + this.player.toggle() + } + }, + + seek: function(n){ + if (n < 1) { + n = n * this.duration + } + this.player.seekTo(n) + }, + + setLoop: function(state){ + this.media.loop = state + }, + + didPlay: function(){ + this.paused = false + }, + + didPause: function(){ + this.paused = true + }, + + finished: function(){ + console.log("soundcloud finished") + if (this.media.loop) { + this.seek(0) + this.play() + } + else if (this.bound) { + $(".playButton").removeClass('playing') + } + }, + +}) diff --git a/public/assets/javascripts/rectangles/engine/scenery/_scenery.js b/public/assets/javascripts/rectangles/engine/scenery/_scenery.js index 436712a..a0f5b35 100644 --- a/public/assets/javascripts/rectangles/engine/scenery/_scenery.js +++ b/public/assets/javascripts/rectangles/engine/scenery/_scenery.js @@ -27,6 +27,11 @@ var Scenery = new function(){ scene_media = new Scenery.types.video (opt) break + case 'soundcloud': + if (is_mobile) return + scene_media = new Scenery.types.audio (opt) + break + case 'text': scene_media = new Scenery.types.text (opt) scene_media.focused = true diff --git a/public/assets/javascripts/rectangles/engine/scenery/types/audio.js b/public/assets/javascripts/rectangles/engine/scenery/types/audio.js new file mode 100644 index 0000000..82f984e --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/scenery/types/audio.js @@ -0,0 +1,73 @@ + +Scenery.types.audio = Scenery.types.base.extend(function(base){ + + var exports = { + + type: 'audio', + + init: function(opt){ + + opt.scale = 1.0 + + base.init.call(this, opt) + + this.build() + this.bind() + this.place(opt) + }, + + build: function(){ + this.mx = new MX.Soundcloud({ + scale: this.scale, + media: this.media, + y: this.scale * this.media.height/2, + backface: false, + }) + scene.add( this.mx ) + this.mx.load() + }, + + serialize: function(){ + var data = base.serialize.call(this) + return data + }, + + deserialize: function(data){ + this.mx.move(data.position) + this.mx.ops.width = data.dimensions.a + this.mx.ops.height = data.dimensions.b + this.dimensions.deserialize(data.dimensions) + }, + + play: function(){ + this.mx.play() + }, + + pause: function(){ + this.mx.pause() + }, + + toggle: function(){ + this.mx.toggle() + }, + + paused: function(){ + return this.mx.paused + }, + + muted: function(){ + return this.mx.muted + }, + + seek: function(n){ + this.mx.seek(n) + }, + + setLoop: function(shouldLoop){ + this.mx.setLoop(shouldLoop) + }, + + } + + return exports +}) diff --git a/public/assets/javascripts/ui/editor/MediaViewer.js b/public/assets/javascripts/ui/editor/MediaViewer.js index 9593ab7..4af94e5 100644 --- a/public/assets/javascripts/ui/editor/MediaViewer.js +++ b/public/assets/javascripts/ui/editor/MediaViewer.js @@ -190,6 +190,10 @@ var MediaViewer = ModalView.extend({ image.src = media.url image.load() break + + case 'soundcloud': + image.src = media.thumbnail + break } $span.data("media", media) @@ -250,6 +254,7 @@ var MediaViewer = ModalView.extend({ switch (media.type) { case "video": + case "soundcloud": $floatingImg.attr('src', '/assets/img/playbutton.png') break diff --git a/public/assets/javascripts/ui/lib/Parser.js b/public/assets/javascripts/ui/lib/Parser.js index d68f58b..87d52ef 100644 --- a/public/assets/javascripts/ui/lib/Parser.js +++ b/public/assets/javascripts/ui/lib/Parser.js @@ -115,7 +115,6 @@ var Parser = { return '
' } }, - /* { type: 'soundcloud', regex: /soundcloud.com\/[-a-zA-Z0-9]+\/[-a-zA-Z0-9]+\/?$/i, @@ -127,24 +126,28 @@ var Parser = { + '&client_id=' + '0673fbe6fc794a7750f680747e863b10', success: function(result) { + // console.log(result) done({ url: url, type: "soundcloud", token: result.id, - thumbnail: "", - title: "", - width: 100, - height: 100, + thumbnail: result.artwork_url || result.user.avatar_url, + title: result.title, + description: result.user.username, + width: 166, + height: 166, }) } }); }, tag: function (media) { - return '' } - }, { + }, + /* + { type: 'link', regex: /^http.+/i, fetch: function(url, done) { diff --git a/public/assets/javascripts/ui/reader/MediaPlayer.js b/public/assets/javascripts/ui/reader/MediaPlayer.js index 42e7596..f5a0d2c 100644 --- a/public/assets/javascripts/ui/reader/MediaPlayer.js +++ b/public/assets/javascripts/ui/reader/MediaPlayer.js @@ -49,6 +49,9 @@ var MediaPlayer = FormView.extend({ return false } } + else if (media.type == "text") { + return false + } this.bind(scenery) this.$el.addClass("active") diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs index d5e8e5d..7391d36 100644 --- a/views/partials/scripts.ejs +++ b/views/partials/scripts.ejs @@ -26,6 +26,7 @@ + @@ -65,6 +66,7 @@ + @@ -130,3 +132,4 @@ [[ } ]] + -- cgit v1.2.3-70-g09d2 From dba52c100c5fa621c4c611effa8115dd7e6d10e6 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Tue, 18 Nov 2014 08:49:33 -0500 Subject: render howto explicitly --- Gruntfile.js | 2 +- server/lib/views/index.js | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index c99976d..59c2525 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -141,7 +141,7 @@ module.exports = function(grunt) { }, uglify: { options: { - banner: '/* vvalls by okfoc.us 2014 */\n' + banner: '/* vvalls by okfocus 2014 */\n' }, js: { src: 'public/assets/javascripts/app.concat.js', diff --git a/server/lib/views/index.js b/server/lib/views/index.js index 6f1305a..8ca2113 100644 --- a/server/lib/views/index.js +++ b/server/lib/views/index.js @@ -113,13 +113,11 @@ var views = module.exports = { docs: function (req, res){ var name = req.params.name || "index" - try { + if (name == "howto") { res.render('about/' + name) return } - catch (e) { - } - + if (name === "new") { res.render('docs', { doc: { name: "new" }, -- cgit v1.2.3-70-g09d2 From d9697721355606f03a433327e5579606993b20e5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 21 Nov 2014 17:36:50 -0500 Subject: removing chardinjs, prefixfree --- Gruntfile.js | 2 -- public/assets/stylesheets/app.css | 8 ++++++++ views/about/howto.ejs | 8 -------- views/partials/meta.ejs | 1 - views/partials/scripts.ejs | 4 ++-- 5 files changed, 10 insertions(+), 13 deletions(-) (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index 59c2525..68828e0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,12 +12,10 @@ module.exports = function(grunt) { "public/assets/javascripts/vendor/bower_components/lodash/dist/lodash.min.js", "public/assets/javascripts/vendor/bower_components/momentjs/min/moment.min.js", "public/assets/javascripts/vendor/bower_components/fiber/src/fiber.min.js", - "public/assets/javascripts/vendor/bower_components/prefixfree/prefixfree.min.js", "public/assets/javascripts/vendor/bower_components/marked/lib/marked.js", "public/assets/javascripts/vendor/tube.js", "public/assets/javascripts/vendor/loader.js", "public/assets/javascripts/vendor/polyfill.js", - "public/assets/javascripts/vendor/chardinjs.min.js", "public/assets/javascripts/vendor/sha1.js", "public/assets/javascripts/vendor/dataUriToBlob.js", "public/assets/javascripts/vendor/froogaloop.js", diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css index 9500b3b..201819d 100755 --- a/public/assets/stylesheets/app.css +++ b/public/assets/stylesheets/app.css @@ -2900,6 +2900,14 @@ a[data-role="forgot-password"] { 100%{height:500px;top:2px;} } +/* KEYBOARD SHORTCUTS */ + +.keyboard { float: left; width: 50%; margin-top: 50px; } +.keyboard tr { margin: 0; padding: 0; } +.keyboard td { padding: 2px 10px; margin: 0; } +.keyboard.first-keyboard td:nth-child(1) { text-align: center; width: 50px; padding-left: 100px; } +.keyboard td:nth-child(1) { text-align: right; width: 150px; } +.keyboard td:nth-child(2) { font-weight: 300; } /* MOBILE */ diff --git a/views/about/howto.ejs b/views/about/howto.ejs index 74009d1..5278a40 100644 --- a/views/about/howto.ejs +++ b/views/about/howto.ejs @@ -111,14 +111,6 @@   SpacebarJump - diff --git a/views/partials/meta.ejs b/views/partials/meta.ejs index d22022c..673ab64 100644 --- a/views/partials/meta.ejs +++ b/views/partials/meta.ejs @@ -32,7 +32,6 @@ - - + -- cgit v1.2.3-70-g09d2 From 64f99d71c9ff0d419fad080751ba02afe9f6f3df Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 1 Dec 2014 16:27:39 -0500 Subject: move tumblr load stuff into own modal; example tumblrs --- Gruntfile.js | 1 + .../assets/javascripts/ui/editor/EditorToolbar.js | 1 - public/assets/javascripts/ui/editor/EditorView.js | 1 + public/assets/javascripts/ui/editor/MediaTumblr.js | 53 ++++++++++++++++++++++ public/assets/javascripts/ui/editor/MediaUpload.js | 2 +- public/assets/javascripts/ui/editor/MediaViewer.js | 40 ++++++++-------- public/assets/javascripts/ui/lib/ModalView.js | 6 +-- public/assets/stylesheets/app.css | 11 ++++- views/controls/editor/media-drawer.ejs | 15 +++++- views/partials/scripts.ejs | 1 + 10 files changed, 104 insertions(+), 27 deletions(-) create mode 100644 public/assets/javascripts/ui/editor/MediaTumblr.js (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index 68828e0..21bbfb0 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -117,6 +117,7 @@ module.exports = function(grunt) { "public/assets/javascripts/ui/editor/ColorControl.js", "public/assets/javascripts/ui/editor/Collaborators.js", "public/assets/javascripts/ui/editor/MediaEditor.js", + "public/assets/javascripts/ui/editor/MediaTumblr.js", "public/assets/javascripts/ui/editor/MediaUpload.js", "public/assets/javascripts/ui/editor/MediaViewer.js", "public/assets/javascripts/ui/editor/Presets.js", diff --git a/public/assets/javascripts/ui/editor/EditorToolbar.js b/public/assets/javascripts/ui/editor/EditorToolbar.js index 277718a..a5ad2dd 100644 --- a/public/assets/javascripts/ui/editor/EditorToolbar.js +++ b/public/assets/javascripts/ui/editor/EditorToolbar.js @@ -59,7 +59,6 @@ var EditorToolbar = View.extend({ this.resetControls() this.toggleMap(false) this.parent.mediaViewer.show() - this.parent.mediaUpload.show() }, resetMode: function(){ diff --git a/public/assets/javascripts/ui/editor/EditorView.js b/public/assets/javascripts/ui/editor/EditorView.js index 4a2f712..50d3650 100644 --- a/public/assets/javascripts/ui/editor/EditorView.js +++ b/public/assets/javascripts/ui/editor/EditorView.js @@ -15,6 +15,7 @@ var EditorView = View.extend({ this.info = new BuilderInfo ({ parent: this }) this.mediaViewer = new MediaViewer ({ parent: this }) this.mediaUpload = new MediaUpload ({ parent: this }) + this.mediaTumblr = new MediaTumblr ({ parent: this }) this.mediaEditor = new MediaEditor ({ parent: this }) this.wallpaperPicker = new WallpaperPicker ({ parent: this }) this.colorControl = new ColorControl ({ parent: this }) diff --git a/public/assets/javascripts/ui/editor/MediaTumblr.js b/public/assets/javascripts/ui/editor/MediaTumblr.js new file mode 100644 index 0000000..47419ae --- /dev/null +++ b/public/assets/javascripts/ui/editor/MediaTumblr.js @@ -0,0 +1,53 @@ + +var MediaTumblr = ModalView.extend({ + el: "#tumblrUpload", + + events: { + 'mousedown': "stopPropagation", + "keydown .url": "enterSubmit", + "click .exampleTumblr": "loadExample", + }, + + initialize: function(opt){ + this.__super__.initialize.call(this) + this.parent = opt.parent + this.$url = this.$(".url") + }, + + show: function(){ + this.$el.addClass("active") + this.$url.val("") + }, + + hide: function(){ + this.$el.removeClass("active") + }, + + enterSubmit: function(e){ + e.stopPropagation() + if (e.keyCode == 13) { + e.preventDefault() + var url = this.$tumblrUrl.val() + this.loadTumblr(url) + } + }, + + loadTumblr: function(url){ + Parser.tumblr(url, function(media_list){ + console.log(media_list) + this.parent.mediaViewer.$foundMediaContainer.empty() + media_list.reverse().forEach(function(media){ + this.parent.mediaViewer.add(media, this.parent.mediaViewer.$foundMediaContainer) + }.bind(this)) + }.bind(this)) + }, + + loadExample: function(e){ + e.preventDefault() + var name = $(e.currentTarget).html() + var url = "http://" + name + ".tumblr.com/" + this.$url.val(url) + this.loadTumblr(url) + }, + +}) \ No newline at end of file diff --git a/public/assets/javascripts/ui/editor/MediaUpload.js b/public/assets/javascripts/ui/editor/MediaUpload.js index 9ae90e3..d09e38c 100644 --- a/public/assets/javascripts/ui/editor/MediaUpload.js +++ b/public/assets/javascripts/ui/editor/MediaUpload.js @@ -1,6 +1,6 @@ var MediaUpload = UploadView.extend({ - el: ".fileUpload", + el: "#fileUpload", createAction: "/api/media/new", uploadAction: "/api/media/upload", diff --git a/public/assets/javascripts/ui/editor/MediaViewer.js b/public/assets/javascripts/ui/editor/MediaViewer.js index 94a9d90..2ae5104 100644 --- a/public/assets/javascripts/ui/editor/MediaViewer.js +++ b/public/assets/javascripts/ui/editor/MediaViewer.js @@ -38,11 +38,11 @@ var MediaViewer = ModalView.extend({ this.$deleteMedia = this.$("#deleteMedia") this.$viewMore = this.$(".viewMore") this.$noMedia = this.$(".noMedia") - - this.$tumblrUrl = this.$("#tumblr-url") }, + mode: "user", wallpaperToggle: function(){ + this.mode = "wallpaper" this.$wallpaperMedia.addClass("active") this.$foundMedia.addClass("inactive") this.$myMedia.addClass("inactive").removeClass('active') @@ -51,19 +51,25 @@ var MediaViewer = ModalView.extend({ }, foundToggle: function(){ + this.mode = "found" this.$wallpaperMedia.removeClass("active") this.$foundMedia.addClass("active") this.$myMedia.addClass("inactive").removeClass('active') this.$("a").removeClass("active") this.$foundToggle.addClass("active") + this.parent.mediaUpload.hide() + this.parent.mediaTumblr.show() }, userToggle: function(){ + this.mode = "user" this.$wallpaperMedia.removeClass("active") this.$foundMedia.removeClass("active") this.$myMedia.removeClass("inactive").addClass('active') this.$("a").removeClass("active") this.$userToggle.addClass("active") + this.parent.mediaUpload.show() + this.parent.mediaTumblr.hide() }, show: function(){ @@ -72,8 +78,7 @@ var MediaViewer = ModalView.extend({ // this.loadTrending() } else { - this.parent.cursor.message("media") - this.__super__.show.call(this) + this.reallyShow() } }, @@ -81,8 +86,20 @@ var MediaViewer = ModalView.extend({ this.__super__.hide.call(this) this.deleteArmed(false) this.parent.mediaUpload.hide() + this.parent.mediaTumblr.hide() this.parent.cursor.message('start') }, + + reallyShow: function(){ + this.__super__.show.call(this) + if (this.mode == "user") { + this.userToggle() + } + else { + this.foundToggle() + } + this.parent.cursor.message("media") + }, load: function(){ $.get("/api/media/user", { offset: this.offset, limit: this.perPage }, this.populate.bind(this)) @@ -159,8 +176,7 @@ var MediaViewer = ModalView.extend({ } else { this.loaded = true - this.parent.cursor.message("media") - this.__super__.show.call(this) + this.reallyShow() } }, @@ -296,16 +312,4 @@ var MediaViewer = ModalView.extend({ _followCursor(e) }, - enterTumblrUrl: function(e){ - e.stopPropagation() - if (e.keyCode !== 13) { return } - var url = this.$tumblrUrl.val() - Parser.tumblr(url, function(media_list){ - console.log(media_list) - this.$foundMediaContainer.empty() - media_list.reverse().forEach(function(media){ - this.add(media, this.$foundMediaContainer) - }.bind(this)) - }.bind(this)) - }, }) diff --git a/public/assets/javascripts/ui/lib/ModalView.js b/public/assets/javascripts/ui/lib/ModalView.js index f70fbb3..6f1c729 100644 --- a/public/assets/javascripts/ui/lib/ModalView.js +++ b/public/assets/javascripts/ui/lib/ModalView.js @@ -14,10 +14,8 @@ var ModalView = View.extend({ show: function(){ $(".mediaDrawer").removeClass("active") - - if (! this.usesFileUpload) { - $(".fileUpload").removeClass("active") - } + $(".fileUpload").removeClass("active") + if (this.fixedClose) { $("#fixed_close").addClass("active") $("#fixed_close").bind("click", this.hide.bind(this)) diff --git a/public/assets/stylesheets/app.css b/public/assets/stylesheets/app.css index 5d69d75..07d1bbb 100755 --- a/public/assets/stylesheets/app.css +++ b/public/assets/stylesheets/app.css @@ -1720,7 +1720,16 @@ border-left: 1px solid black; padding-top: 2px; } - +.exampleTumblrs { + display: block; + margin-top: 10px; + font-weight: 300; + font-size: 0.8em; +} +.exampleTumblrs a { + border-bottom: 1px dotted; + margin-left: 5px; +} .vvbox .colors { max-width: 155px; diff --git a/views/controls/editor/media-drawer.ejs b/views/controls/editor/media-drawer.ejs index 3db71d5..f9bce61 100644 --- a/views/controls/editor/media-drawer.ejs +++ b/views/controls/editor/media-drawer.ejs @@ -23,7 +23,6 @@
-
@@ -33,7 +32,7 @@ - +

@@ -43,3 +42,15 @@ ~ or ~
+ + + + +
+ + or try one of these: + risingtensions + fixoid + nopattern + +
diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs index 61659f7..fc94992 100644 --- a/views/partials/scripts.ejs +++ b/views/partials/scripts.ejs @@ -113,6 +113,7 @@ + -- cgit v1.2.3-70-g09d2 From 5229023137d5d929db5ef7dcc8fd27d59676a99f Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 12 Jan 2015 14:14:29 -0500 Subject: bump year --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index 21bbfb0..f62cc82 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -140,7 +140,7 @@ module.exports = function(grunt) { }, uglify: { options: { - banner: '/* vvalls by okfocus 2014 */\n' + banner: '/* vvalls by okfocus 2015 */\n' }, js: { src: 'public/assets/javascripts/app.concat.js', -- cgit v1.2.3-70-g09d2 From 3059c3203d2cec4e2e745be8c21c6d3fbddb0c14 Mon Sep 17 00:00:00 2001 From: Julie Lala Date: Wed, 28 Jan 2015 01:39:28 -0500 Subject: rigging EditSubscriptionModal --- Gruntfile.js | 1 + config.json.example | 1 - public/assets/javascripts/ui/_router.js | 10 ++++++++++ server/index.js | 1 + server/lib/api/subscription.js | 19 ++++++++++++++++--- server/lib/webhook/webhook.js | 14 ++++++++++++++ views/about/brochure.ejs | 3 +++ views/partials/edit-subscription.ejs | 1 - views/partials/scripts.ejs | 1 + 9 files changed, 46 insertions(+), 5 deletions(-) (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index f62cc82..ed236c5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -99,6 +99,7 @@ module.exports = function(grunt) { "public/assets/javascripts/ui/site/LayoutsModal.js", "public/assets/javascripts/ui/site/EditProjectModal.js", "public/assets/javascripts/ui/site/EditProfileModal.js", + "public/assets/javascripts/ui/site/EditSubscriptionModal.js", "public/assets/javascripts/ui/site/DocumentModal.js", "public/assets/javascripts/ui/site/HomeView.js", diff --git a/config.json.example b/config.json.example index b8c310c..dc79edd 100644 --- a/config.json.example +++ b/config.json.example @@ -5,6 +5,5 @@ "socketPort": 1337, "webhookPort": 5000, "databaseHost": "lvh.me", - "pageSize": 10, "env": { "development": 1 } } diff --git a/public/assets/javascripts/ui/_router.js b/public/assets/javascripts/ui/_router.js index 3532428..9e7ce75 100644 --- a/public/assets/javascripts/ui/_router.js +++ b/public/assets/javascripts/ui/_router.js @@ -9,6 +9,7 @@ var SiteRouter = Router.extend({ "click [data-role='new-project-modal']": 'newProject', "click [data-role='edit-project-modal']": 'editProject', "click [data-role='edit-profile-modal']": 'editProfile', + "click [data-role='edit-subscription-modal']": 'editSubscription', "click [data-role='new-document-modal']": 'newDocument', "click [data-role='edit-document-modal']": 'editDocument', "click [data-role='destroy-document-modal']": 'destroyDocument', @@ -29,6 +30,7 @@ var SiteRouter = Router.extend({ "/profile": 'profile', "/profile/edit": 'editProfile', + "/profile/billing": 'editSubscription', "/profile/:name": 'profile', "/about/:name/edit": 'editDocument', "/about/new": 'newDocument', @@ -56,6 +58,7 @@ var SiteRouter = Router.extend({ "/profile": 'profile', "/profile/edit": 'editProfile', + "/profile/billing": 'editSubscription', "/profile/:name": 'profile', "/project/:name": 'projectViewer', @@ -69,6 +72,7 @@ var SiteRouter = Router.extend({ this.newProjectModal = new NewProjectModal() this.editProjectModal = new EditProjectModal() this.editProfileModal = new EditProfileModal() + this.editSubscriptionModal = new EditSubscriptionModal() this.passwordForgotModal = new PasswordForgot() this.documentModal = new DocumentModal() this.profileView = new ProfileView() @@ -195,6 +199,12 @@ var SiteRouter = Router.extend({ this.editProfileModal.load() }, + editSubscription: function(e){ + e && e.preventDefault() + window.history.pushState(null, document.title, "/profile/billing") + + this.editSubscriptionModal.load() + }, newDocument: function(e){ diff --git a/server/index.js b/server/index.js index 02fea3c..475054d 100644 --- a/server/index.js +++ b/server/index.js @@ -102,6 +102,7 @@ site.route = function () { app.get('/profile', views.profile) app.get('/profile/edit', views.profile) + app.get('/profile/billing', views.profile) app.get('/profile/:username', views.profile) app.get('/about', views.docs); diff --git a/server/lib/api/subscription.js b/server/lib/api/subscription.js index bd19127..83644cf 100644 --- a/server/lib/api/subscription.js +++ b/server/lib/api/subscription.js @@ -18,16 +18,29 @@ var subscription = module.exports = { }) }, */ - show: function(req,res){ + middleware: { + fetchAccount: function(req, res, next){ + recurly.subscriptions.listByAccount(req.user._id, function(data){ + }) + }, + }, + + // synchronise an account with recurly.. + // useful when testing locally (if webhooks do not fire) + sync: function(req, res){ + // fetch req.user._id + }, + + show: function(req, res){ // fetch from recurly }, - update: function(req,res){ + update: function(req, res){ // update plan_type on recurly // update add_ons on recurly }, - destroy: function(req,res){ + destroy: function(req, res){ // destroy on recurly }, diff --git a/server/lib/webhook/webhook.js b/server/lib/webhook/webhook.js index e9a7925..4f23d0b 100644 --- a/server/lib/webhook/webhook.js +++ b/server/lib/webhook/webhook.js @@ -134,7 +134,21 @@ var subscribe = module.exports = { }); }, + list: function(req, res){ + recurly.subscriptions.listByAccount(req.params.id, function(data){ + if (data.data != 404) { + res.json(data) + return + } + else { + res.json(data) + return + } + }) + }, + route: function(app){ app.post('/subscribe/webhook', subscribe.handle); + app.get('/subscribe/list/:id', subscribe.list); }, } diff --git a/views/about/brochure.ejs b/views/about/brochure.ejs index 1c808f8..49b03db 100644 --- a/views/about/brochure.ejs +++ b/views/about/brochure.ejs @@ -123,6 +123,9 @@ text-align: center; margin-bottom: 10px; } +.about_plan ul { + margin-bottom: 60px; +} .planbox li { list-style-type: none; margin-bottom: 5px; diff --git a/views/partials/edit-subscription.ejs b/views/partials/edit-subscription.ejs index 1f8db62..adc3f71 100644 --- a/views/partials/edit-subscription.ejs +++ b/views/partials/edit-subscription.ejs @@ -44,7 +44,6 @@ - [[ } ]] diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs index fc94992..04bd945 100644 --- a/views/partials/scripts.ejs +++ b/views/partials/scripts.ejs @@ -95,6 +95,7 @@ + -- cgit v1.2.3-70-g09d2 From 0cb3f8b480e46a3376b5accba18cde0c3cbdd13d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 2 Feb 2015 10:53:28 -0500 Subject: bower moved lodash --- Gruntfile.js | 2 +- views/partials/scripts.ejs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index ed236c5..f7af106 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -9,7 +9,7 @@ module.exports = function(grunt) { js: { src: [ "public/assets/javascripts/vendor/bower_components/jquery/dist/jquery.min.js", - "public/assets/javascripts/vendor/bower_components/lodash/dist/lodash.min.js", + "public/assets/javascripts/vendor/bower_components/lodash/lodash.min.js", "public/assets/javascripts/vendor/bower_components/momentjs/min/moment.min.js", "public/assets/javascripts/vendor/bower_components/fiber/src/fiber.min.js", "public/assets/javascripts/vendor/bower_components/marked/lib/marked.js", diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs index 04bd945..a58eca1 100644 --- a/views/partials/scripts.ejs +++ b/views/partials/scripts.ejs @@ -2,7 +2,7 @@ [[ } else { ]] - + -- cgit v1.2.3-70-g09d2 From 673cd38ccb8a9c6ba7ec0a879fc96dcc580b046c Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 3 Feb 2015 14:46:16 -0500 Subject: enable hidpi canvas in main app --- Gruntfile.js | 1 + bower.json | 2 +- .../javascripts/rectangles/engine/map/draw.js | 2 +- public/assets/javascripts/ui/lib/LabColorPicker.js | 26 ++++++++++++---------- public/assets/javascripts/ui/reader/Tracker.js | 14 +++++++----- public/assets/test/surface.html | 2 +- views/controls/editor/color-control.ejs | 2 +- views/partials/scripts.ejs | 1 + 8 files changed, 29 insertions(+), 21 deletions(-) (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index f7af106..70a8b13 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -13,6 +13,7 @@ module.exports = function(grunt) { "public/assets/javascripts/vendor/bower_components/momentjs/min/moment.min.js", "public/assets/javascripts/vendor/bower_components/fiber/src/fiber.min.js", "public/assets/javascripts/vendor/bower_components/marked/lib/marked.js", + "public/assets/javascripts/vendor/bower_components/hidpi-canvas/dist/hidpi-canvas.js", "public/assets/javascripts/vendor/tube.js", "public/assets/javascripts/vendor/loader.js", "public/assets/javascripts/vendor/polyfill.js", diff --git a/bower.json b/bower.json index c78310d..e3e83ca 100644 --- a/bower.json +++ b/bower.json @@ -10,6 +10,6 @@ "jquery-jsonview": "1.2.0", "prefixfree": "", "marked": "0.3.2", - "hidpi-canvas": "~1.0.9" + "hidpi-canvas": "git://github.com/julescarbon/hidpi-canvas-polyfill.git#master" } } diff --git a/public/assets/javascripts/rectangles/engine/map/draw.js b/public/assets/javascripts/rectangles/engine/map/draw.js index eceda3c..5a9b592 100644 --- a/public/assets/javascripts/rectangles/engine/map/draw.js +++ b/public/assets/javascripts/rectangles/engine/map/draw.js @@ -56,9 +56,9 @@ Map.Draw = function(map, opt){ } var canvas = document.createElement("canvas") - ctx = canvas.getContext('2d') canvas.width = thumbnail_width canvas.height = thumbnail_height + ctx = canvas.getContext('2d') draw.clear() diff --git a/public/assets/javascripts/ui/lib/LabColorPicker.js b/public/assets/javascripts/ui/lib/LabColorPicker.js index 7ddcdd5..2c8fb90 100644 --- a/public/assets/javascripts/ui/lib/LabColorPicker.js +++ b/public/assets/javascripts/ui/lib/LabColorPicker.js @@ -1,9 +1,12 @@ var LabColorPicker = function (parent, w, h) { var base = this var canvas = this.canvas = document.createElement('canvas') - var ctx = this.ctx = canvas.getContext('2d') - var imageData = ctx.createImageData(w,h) - var data = imageData.data + canvas.width = w + canvas.height = h + var ctx = this.ctx = canvas.getContext('2d-lodpi') +// canvas.className = "colorPicker" +// var imageData = ctx.createImageData(w, h) +// var data = imageData.data var cursor = this.cursor = document.createElement("div") cursor.className = "colorPickerCursor" @@ -15,10 +18,6 @@ var LabColorPicker = function (parent, w, h) { brightnessControl.setAttribute("max", "110") brightnessControl.setAttribute("value", "0") - canvas.width = w - canvas.height = h - canvas.className = "colorPicker" - var ww = w-1 var hh = h-1 @@ -84,11 +83,14 @@ var LabColorPicker = function (parent, w, h) { } this.paint = function() { val = clamp(val, L_range[0], L_range[1]) - var x, y, t - for (var i = 0; i < w; i++) { - for (var j = 0; j < h; j++) { - x = mix( i/ww, a_range[0], a_range[1] ) - y = mix( j/hh, b_range[0], b_range[1] ) + var imageData = ctx.createImageData(canvas.width, canvas.height) + var data = imageData.data + var x, y, t, cw = imageData.width, ch = imageData.height + var cww = cw-1, chh = ch-1 + for (var i = 0; i < cw; i++) { + for (var j = 0; j < ch; j++) { + x = mix( i/cww, a_range[0], a_range[1] ) + y = mix( j/chh, b_range[0], b_range[1] ) t = (j*w + i) * 4 rgb = xyz2rgb(hunterlab2xyz(val, x, y)) data[t] = Math.round( rgb[0] ) diff --git a/public/assets/javascripts/ui/reader/Tracker.js b/public/assets/javascripts/ui/reader/Tracker.js index ce32c59..d2dec39 100644 --- a/public/assets/javascripts/ui/reader/Tracker.js +++ b/public/assets/javascripts/ui/reader/Tracker.js @@ -1,8 +1,12 @@ -(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ -(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), -m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) -})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - +if (window.location.host.indexOf("lvh.me") === -1) { + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +} +else { + ga = function(){} +} ga('create', 'UA-56883705-1', 'auto'); ga('send', 'pageview'); diff --git a/public/assets/test/surface.html b/public/assets/test/surface.html index 02b473d..9e6abe8 100644 --- a/public/assets/test/surface.html +++ b/public/assets/test/surface.html @@ -2,7 +2,7 @@ - + diff --git a/views/controls/editor/color-control.ejs b/views/controls/editor/color-control.ejs index c035e24..bcc955d 100644 --- a/views/controls/editor/color-control.ejs +++ b/views/controls/editor/color-control.ejs @@ -1,4 +1,4 @@ -
+

Edit Room Colors

diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs index a58eca1..011644b 100644 --- a/views/partials/scripts.ejs +++ b/views/partials/scripts.ejs @@ -5,6 +5,7 @@ + -- cgit v1.2.3-70-g09d2 From f68450b1c3ece018009df5542b7e73b2b74852e7 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 3 Apr 2015 20:39:44 -0400 Subject: sculpture on reader --- Gruntfile.js | 7 +++++++ public/assets/javascripts/ui/reader/ReaderView.js | 1 + 2 files changed, 8 insertions(+) (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index 70a8b13..026ec6f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -32,6 +32,7 @@ module.exports = function(grunt) { "public/assets/javascripts/mx/primitives/mx.youtube.js", "public/assets/javascripts/mx/primitives/mx.vimeo.js", "public/assets/javascripts/mx/primitives/mx.soundcloud.js", + "public/assets/javascripts/mx/primitives/mx.grid.js", "public/assets/javascripts/rectangles/_env.js", @@ -76,6 +77,11 @@ module.exports = function(grunt) { "public/assets/javascripts/rectangles/engine/scenery/types/video.js", "public/assets/javascripts/rectangles/engine/scenery/types/audio.js", + "public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js", + "public/assets/javascripts/rectangles/engine/sculpture/move.js", + "public/assets/javascripts/rectangles/engine/sculpture/types/_object.js", + "public/assets/javascripts/rectangles/engine/sculpture/types/image.js", + "public/assets/javascripts/rectangles/engine/map/_map.js", "public/assets/javascripts/rectangles/engine/map/ui_editor.js", "public/assets/javascripts/rectangles/engine/map/ui_minimap.js", @@ -123,6 +129,7 @@ module.exports = function(grunt) { "public/assets/javascripts/ui/editor/MediaUpload.js", "public/assets/javascripts/ui/editor/MediaViewer.js", "public/assets/javascripts/ui/editor/Presets.js", + "public/assets/javascripts/ui/editor/SculptureEditor.js", "public/assets/javascripts/ui/editor/TextEditor.js", "public/assets/javascripts/ui/editor/WallpaperPicker.js", diff --git a/public/assets/javascripts/ui/reader/ReaderView.js b/public/assets/javascripts/ui/reader/ReaderView.js index 617a145..e3e27c3 100644 --- a/public/assets/javascripts/ui/reader/ReaderView.js +++ b/public/assets/javascripts/ui/reader/ReaderView.js @@ -74,6 +74,7 @@ var ReaderView = View.extend({ data.rooms && Rooms.deserialize(data.rooms) data.walls && Walls.deserialize(data.walls) data.media && Scenery.deserialize(data.media) + data.sculpture && Sculpture.deserialize(data.sculpture) data.startPosition && scene.camera.move(data.startPosition) cam.y = window.viewHeight = data.viewHeight || app.defaults.viewHeight -- cgit v1.2.3-70-g09d2 From 0b8b54e26aa7a40065a0be6f7708b7021e4fec13 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 20 Apr 2015 15:03:35 -0400 Subject: resize scenery --- Gruntfile.js | 1 + .../rectangles/engine/scenery/resize.js | 1 + .../rectangles/engine/sculpture/_sculpture.js | 4 + .../rectangles/engine/sculpture/move.js | 6 +- .../rectangles/engine/sculpture/resize.js | 207 +++++++++++++++++++++ .../rectangles/engine/sculpture/types/_object.js | 2 +- .../assets/javascripts/rectangles/models/floor.js | 2 +- public/assets/javascripts/ui/editor/EditorView.js | 1 + .../javascripts/ui/editor/SculptureEditor.js | 3 +- views/partials/scripts.ejs | 1 + 10 files changed, 221 insertions(+), 7 deletions(-) create mode 100644 public/assets/javascripts/rectangles/engine/sculpture/resize.js (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index 026ec6f..789ce6f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -79,6 +79,7 @@ module.exports = function(grunt) { "public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js", "public/assets/javascripts/rectangles/engine/sculpture/move.js", + "public/assets/javascripts/rectangles/engine/sculpture/resize.js", "public/assets/javascripts/rectangles/engine/sculpture/types/_object.js", "public/assets/javascripts/rectangles/engine/sculpture/types/image.js", diff --git a/public/assets/javascripts/rectangles/engine/scenery/resize.js b/public/assets/javascripts/rectangles/engine/scenery/resize.js index 006ff2a..8dac140 100644 --- a/public/assets/javascripts/rectangles/engine/scenery/resize.js +++ b/public/assets/javascripts/rectangles/engine/scenery/resize.js @@ -8,6 +8,7 @@ Scenery.resize = new function(){ var dragging = false var naturalDimension, naturalDimensionCopy, dimension, position, scale var oldState + var rotationY var dots = [], dot, selected_dot diff --git a/public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js b/public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js index 1543def..888b925 100644 --- a/public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js +++ b/public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js @@ -9,6 +9,7 @@ var Sculpture = new function(){ base.init = function(){ app.on("move", base.updateBillboards) + base.resize.init() } base.updateBillboards = function(){ @@ -17,6 +18,9 @@ var Sculpture = new function(){ sculpture.mx.rotationY = cam.rotationY } }) + if (Sculpture.resize.obj && Sculpture.resize.obj.billboard) { + Sculpture.resize.move_dots() + } } base.add = function(opt){ diff --git a/public/assets/javascripts/rectangles/engine/sculpture/move.js b/public/assets/javascripts/rectangles/engine/sculpture/move.js index 28d707e..f968bcf 100644 --- a/public/assets/javascripts/rectangles/engine/sculpture/move.js +++ b/public/assets/javascripts/rectangles/engine/sculpture/move.js @@ -66,9 +66,9 @@ Sculpture.move = function(base){ base.mx.x = x + delta.a * cos(cam.rotationY) - delta.b * sin(cam.rotationY) base.mx.z = z + delta.a * sin(cam.rotationY) + delta.b * cos(cam.rotationY) -// if (editor.permissions.resize) { -// Sculpture.resize.move_dots() -// } + if (editor.permissions.resize) { + Sculpture.resize.move_dots() + } } function up (e, cursor){ diff --git a/public/assets/javascripts/rectangles/engine/sculpture/resize.js b/public/assets/javascripts/rectangles/engine/sculpture/resize.js new file mode 100644 index 0000000..53b8b2d --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/sculpture/resize.js @@ -0,0 +1,207 @@ +Sculpture.resize = new function(){ + + var base = this + + var obj + var x, y, z, bounds + var dragging = false + var naturalDimension, naturalDimensionCopy, dimension, position, scale + var oldState + var rotationY + + var dots = [], dot, selected_dot + + base.init = function(){ + base.build() + base.bind() + } + + // create 9 dots at the corners of the div + base.build = function(){ + [ TOP, + TOP_RIGHT, + RIGHT, + BOTTOM_RIGHT, + BOTTOM, + BOTTOM_LEFT, + LEFT, + TOP_LEFT ].forEach(base.build_dot) + } + + // generate a dot element + base.build_dot = function(side) { + var dot = new MX.Object3D('.dot') + dot.width = dot.height = dot_side * 2 + dot.scale = 0.5 + dot.side = side + $(dot.el).on({ + mouseenter: function(){ base.hovering = true }, + mouseleave: function(){ base.hovering = false }, + }) + dots.push(dot) + } + + base.add_dots = function(){ + dots.forEach(function(dot){ + scene.add(dot) + }) + } + + // move all the dots to the object's current position + base.move_dots = function(){ + rotationY = obj.mx.rotationY + + var x = obj.mx.x + sin(rotationY) * dot_distance_from_picture + var y = obj.mx.y + var z = obj.mx.z - cos(rotationY) * dot_distance_from_picture + + dots.forEach(function(dot){ + base.move_dot(dot, { x: x, y: y, z: z, rotationY: rotationY }) + }) + } + + // move a dot .. to the initial position of the image + base.move_dot = function(dot, pos){ + if (dot.side & TOP) { + pos.y += obj.dimensions.b / 2 + } + if (dot.side & BOTTOM) { + pos.y -= obj.dimensions.b / 2 + } + if (dot.side & LEFT) { + pos.x -= cos(rotationY) * (obj.dimensions.a) / 2 + pos.z -= sin(rotationY) * (obj.dimensions.a) / 2 + } + if (dot.side & RIGHT) { + pos.x += cos(rotationY) * (obj.dimensions.a) / 2 + pos.z += sin(rotationY) * (obj.dimensions.a) / 2 + } + dot.move(pos) + } + + // pick a new object to focus on and show the dots + base.show = function(new_object) { + // if (obj === new_object) return + if (! new_object) return + base.obj = obj = new_object + base.add_dots() + base.move_dots() + } + + // dismiss the dots on blur + var dotsHideTimeout; + base.defer_hide = function(){ + clearTimeout(dotsHideTimeout) + + dotsHideTimeout = setTimeout(function(){ + if (Scenery.hovering || Scenery.resize.hovering || Scenery.mouse.down) return + Scenery.resize.hide() + }, dot_hide_delay) + } + + base.hide = function () { + if (! obj) return + base.obj = obj = null + dots.forEach(function(dot){ + scene.remove(dot) + }) + } + + base.bind = function(){ + dots.forEach(function(dot){ + Sculpture.mouse.bind_el(dot.el) + }) + Sculpture.mouse.on("down", down) + Sculpture.mouse.on("drag", drag) + Sculpture.mouse.on("up", up) + } + + base.unbind = function(){ + dots.forEach(function(dot){ + Sculpture.mouse.unbind_el(dot.el) + }) + Sculpture.mouse.off("down", down) + Sculpture.mouse.off("drag", drag) + Sculpture.mouse.off("up", up) + } + + function down (e, cursor){ + var selection = dots.filter(function(dot){return e.target == dot.el}) + if (! selection.length) return + + selected_dot = selection[0] + dragging = true + + naturalDimension = obj.naturalDimensions + dimension = obj.dimensions + position = new vec3(obj.mx.x, obj.mx.y, obj.mx.z) + oldState = obj.serialize() + + if (obj.type == "text") { + naturalDimensionCopy = naturalDimension.clone() + positionCopy = position.clone() + } + + document.body.classList.add("dragging") + } + + function drag (e, cursor){ + if (! dragging) return + + var x_sign = selected_dot.side & LEFT ? -1 : selected_dot.side & RIGHT ? 1 : 0 + var y_sign = selected_dot.side & TOP ? -1 : selected_dot.side & BOTTOM ? 1 : 0 + var width = cursor.x.magnitude() + var height = cursor.y.magnitude() + var mag = cursor.magnitude() + + if (abs(width) > abs(height)) { + mag = x_sign * mag * sign(width) + } + else { + mag = y_sign * mag * sign(height) + } + + if (obj.type == "text") { + obj.mx.width = obj.media.width = naturalDimension.a = naturalDimensionCopy.a + (mag * 2) + obj.mx.height = obj.media.height = naturalDimension.b = naturalDimensionCopy.b + (mag * 2) + dimension.a = naturalDimension.a * obj.scale + dimension.b = naturalDimension.b * obj.scale + } + else { + obj.set_scale( ( dimension.a + mag ) / naturalDimension.a ) + } + + if (selected_dot.side & LEFT_RIGHT) { + obj.mx.x = position.a + cos(rotationY) * mag/2 * (x_sign) + obj.mx.z = position.c + sin(rotationY) * mag/2 * (x_sign) + } + if (selected_dot.side & TOP_BOTTOM) { + obj.mx.y = position.b - mag/2 * y_sign + } + + base.move_dots() + + app.controller.sculptureEditor.setDimensions() + } + + function up (e, cursor){ + if (! dragging) return + dragging = false + if (! editor.permissions.resize) { return } + + obj.scale = obj.mx.ops.scale = obj.mx.scale + obj.dimensions.assign(obj.naturalDimensions).mul(obj.scale) + + UndoStack.push({ + type: 'update-sculpture', + undo: oldState, + redo: obj.serialize(), + }) + + // TODO: watch individual scenery object here + Minotaur.watch( app.router.editorView.settings ) + + document.body.classList.remove("dragging") + selected_dot = null + } +} \ No newline at end of file diff --git a/public/assets/javascripts/rectangles/engine/sculpture/types/_object.js b/public/assets/javascripts/rectangles/engine/sculpture/types/_object.js index b903c5b..390c42e 100644 --- a/public/assets/javascripts/rectangles/engine/sculpture/types/_object.js +++ b/public/assets/javascripts/rectangles/engine/sculpture/types/_object.js @@ -80,7 +80,7 @@ Sculpture.types.base = Fiber.extend(function(base){ Sculpture.remove(this.id) - // Sculpture.resize.hide() + Sculpture.resize.hide() if (app.controller.sculptureEditor) { app.controller.sculptureEditor.tainted = false app.controller.sculptureEditor.hide() diff --git a/public/assets/javascripts/rectangles/models/floor.js b/public/assets/javascripts/rectangles/models/floor.js index 530de2b..799bdc7 100644 --- a/public/assets/javascripts/rectangles/models/floor.js +++ b/public/assets/javascripts/rectangles/models/floor.js @@ -90,7 +90,7 @@ } app.controller.toolbar.resetPermissions() - // Sculpture.resize.show(sculpture) + Sculpture.resize.show(sculpture) Sculpture.hovering = true // app.controller.pick(sculpture) diff --git a/public/assets/javascripts/ui/editor/EditorView.js b/public/assets/javascripts/ui/editor/EditorView.js index a7b4f20..a2d84a6 100644 --- a/public/assets/javascripts/ui/editor/EditorView.js +++ b/public/assets/javascripts/ui/editor/EditorView.js @@ -84,6 +84,7 @@ var EditorView = View.extend({ this.mediaEditor.hide() this.textEditor.hide() this.share.hide() + Sculpture.resize.hide() Scenery.resize.hide() Scenery.hovering = false } diff --git a/public/assets/javascripts/ui/editor/SculptureEditor.js b/public/assets/javascripts/ui/editor/SculptureEditor.js index ff1e6b9..35abc00 100644 --- a/public/assets/javascripts/ui/editor/SculptureEditor.js +++ b/public/assets/javascripts/ui/editor/SculptureEditor.js @@ -67,7 +67,7 @@ var SculptureEditor = FormView.extend({ // app.controller.toolbar.resetMode() app.controller.toolbar.resetControls() - // Sculpture.resize.show(sculpture) + Sculpture.resize.show(sculpture) Sculpture.hovering = true var media = sculpture.media @@ -149,7 +149,6 @@ var SculptureEditor = FormView.extend({ this.tainted = true }, - setBillboard: function(){ var checked = this.$billboard.prop('checked') this.sculpture.setBillboard(checked) diff --git a/views/partials/scripts.ejs b/views/partials/scripts.ejs index 1eda8bd..6dfe912 100644 --- a/views/partials/scripts.ejs +++ b/views/partials/scripts.ejs @@ -75,6 +75,7 @@ + -- cgit v1.2.3-70-g09d2 From cfa83256c1af1c126f88ad5703c33db4abe4b154 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 20 Apr 2015 17:27:57 -0400 Subject: updating gruntfile --- Gruntfile.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index 789ce6f..93f13fe 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -70,6 +70,7 @@ module.exports = function(grunt) { "public/assets/javascripts/rectangles/engine/scenery/move.js", "public/assets/javascripts/rectangles/engine/scenery/resize.js", "public/assets/javascripts/rectangles/engine/scenery/randomize.js", + "public/assets/javascripts/rectangles/engine/scenery/sound.js", "public/assets/javascripts/rectangles/engine/scenery/undo.js", "public/assets/javascripts/rectangles/engine/scenery/types/_object.js", "public/assets/javascripts/rectangles/engine/scenery/types/image.js", @@ -148,6 +149,16 @@ module.exports = function(grunt) { dest: 'public/assets/javascripts/app.concat.js', } }, + copy: { + concat: { + files: [ + { + src: 'public/assets/javascripts/app.concat.js', + dest: 'public/assets/javascripts/app.min.js', + }, + ] + }, + }, uglify: { options: { banner: '/* vvalls by okfocus 2015 */\n' @@ -164,11 +175,13 @@ module.exports = function(grunt) { // Load tasks that we'll be using grunt.loadNpmTasks('grunt-contrib-concat'); + grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-clean'); // Default task(s). - grunt.registerTask('js', ['concat:js', 'uglify:js', 'clean:release']); + grunt.registerTask('js', ['concat:js', 'uglify:js', 'clean:release']); + grunt.registerTask('merge', ['concat:js', 'copy:concat']); grunt.registerTask('default', ['js']); }; -- cgit v1.2.3-70-g09d2 From 7fd34f49fea785f11320eec412a95726cbcf7349 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 20 Apr 2015 17:59:51 -0400 Subject: static build target --- .gitignore | 3 + Gruntfile.js | 130 +++++++++++++- public/assets/javascripts/ui/reader/MediaPlayer.js | 2 +- public/assets/javascripts/ui/reader/ReaderView.js | 12 +- public/assets/javascripts/ui/reader/_router.js | 16 ++ public/assets/test/static.html | 196 +++++++++++++++++++++ server/index.js | 4 + 7 files changed, 354 insertions(+), 9 deletions(-) create mode 100644 public/assets/javascripts/ui/reader/_router.js create mode 100644 public/assets/test/static.html (limited to 'Gruntfile.js') diff --git a/.gitignore b/.gitignore index 50f54f1..14d6d0f 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,6 @@ config.json app.concat.js app.min.js +reader.concat.js +reader.min.js + diff --git a/Gruntfile.js b/Gruntfile.js index 93f13fe..a3ef359 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -147,7 +147,110 @@ module.exports = function(grunt) { "public/assets/javascripts/defaults.js", ], dest: 'public/assets/javascripts/app.concat.js', + }, + + // this builds a static version of the vvalls code, suitable for embedding + // in another website. see assets/test/static.html + 'static': { + src: [ + "public/assets/javascripts/vendor/bower_components/jquery/dist/jquery.min.js", + "public/assets/javascripts/vendor/bower_components/lodash/lodash.min.js", + "public/assets/javascripts/vendor/bower_components/momentjs/min/moment.min.js", + "public/assets/javascripts/vendor/bower_components/fiber/src/fiber.min.js", + "public/assets/javascripts/vendor/bower_components/marked/lib/marked.js", + "public/assets/javascripts/vendor/bower_components/hidpi-canvas/dist/hidpi-canvas.js", + "public/assets/javascripts/vendor/tube.js", + "public/assets/javascripts/vendor/loader.js", + "public/assets/javascripts/vendor/polyfill.js", + "public/assets/javascripts/vendor/froogaloop.js", + "public/assets/javascripts/util.js", + + "public/assets/javascripts/mx/mx.js", + "public/assets/javascripts/mx/extensions/mx.scene.js", + "public/assets/javascripts/mx/extensions/mx.movements.js", + "public/assets/javascripts/mx/extensions/mx.movementsMobile.js", + "public/assets/javascripts/mx/primitives/mx.image.js", + "public/assets/javascripts/mx/primitives/mx.text.js", + "public/assets/javascripts/mx/primitives/mx.video.js", + "public/assets/javascripts/mx/primitives/mx.youtube.js", + "public/assets/javascripts/mx/primitives/mx.vimeo.js", + "public/assets/javascripts/mx/primitives/mx.soundcloud.js", + "public/assets/javascripts/mx/primitives/mx.grid.js", + + "public/assets/javascripts/rectangles/_env.js", + + "public/assets/javascripts/rectangles/util/constants.js", + "public/assets/javascripts/rectangles/util/colors.js", + "public/assets/javascripts/rectangles/util/coords.js", + "public/assets/javascripts/rectangles/util/debug.js", + "public/assets/javascripts/rectangles/util/keys.js", + "public/assets/javascripts/rectangles/util/measurement.js", + "public/assets/javascripts/rectangles/util/minotaur.js", + "public/assets/javascripts/rectangles/util/mouse.js", + "public/assets/javascripts/rectangles/util/permissions.js", + "public/assets/javascripts/rectangles/util/sort.js", + "public/assets/javascripts/rectangles/util/uid.js", + "public/assets/javascripts/rectangles/util/undostack.js", + "public/assets/javascripts/rectangles/util/wheel.js", + + "public/assets/javascripts/rectangles/models/vec2.js", + "public/assets/javascripts/rectangles/models/vec3.js", + "public/assets/javascripts/rectangles/models/rect.js", + "public/assets/javascripts/rectangles/models/surface.js", + "public/assets/javascripts/rectangles/models/tree.js", + "public/assets/javascripts/rectangles/models/room.js", + "public/assets/javascripts/rectangles/models/wall.js", + "public/assets/javascripts/rectangles/models/floor.js", + + "public/assets/javascripts/rectangles/engine/rooms/_rooms.js", + "public/assets/javascripts/rectangles/engine/rooms/_walls.js", + "public/assets/javascripts/rectangles/engine/rooms/builder.js", + "public/assets/javascripts/rectangles/engine/rooms/clipper.js", + "public/assets/javascripts/rectangles/engine/rooms/grouper.js", + "public/assets/javascripts/rectangles/engine/rooms/mover.js", + + "public/assets/javascripts/rectangles/engine/scenery/_scenery.js", + "public/assets/javascripts/rectangles/engine/scenery/move.js", + "public/assets/javascripts/rectangles/engine/scenery/resize.js", + "public/assets/javascripts/rectangles/engine/scenery/randomize.js", + "public/assets/javascripts/rectangles/engine/scenery/sound.js", + "public/assets/javascripts/rectangles/engine/scenery/undo.js", + "public/assets/javascripts/rectangles/engine/scenery/types/_object.js", + "public/assets/javascripts/rectangles/engine/scenery/types/image.js", + "public/assets/javascripts/rectangles/engine/scenery/types/text.js", + "public/assets/javascripts/rectangles/engine/scenery/types/video.js", + "public/assets/javascripts/rectangles/engine/scenery/types/audio.js", + + "public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js", + "public/assets/javascripts/rectangles/engine/sculpture/move.js", + "public/assets/javascripts/rectangles/engine/sculpture/resize.js", + "public/assets/javascripts/rectangles/engine/sculpture/types/_object.js", + "public/assets/javascripts/rectangles/engine/sculpture/types/image.js", + + "public/assets/javascripts/rectangles/engine/map/_map.js", + "public/assets/javascripts/rectangles/engine/map/ui_editor.js", + "public/assets/javascripts/rectangles/engine/map/ui_minimap.js", + "public/assets/javascripts/rectangles/engine/map/draw.js", + + "public/assets/javascripts/ui/lib/View.js", + "public/assets/javascripts/ui/lib/Router.js", + "public/assets/javascripts/ui/lib/ModalView.js", + + "public/assets/javascripts/ui/reader/ReaderView.js", + "public/assets/javascripts/ui/reader/ShareView.js", + "public/assets/javascripts/ui/reader/EmbedView.js", + "public/assets/javascripts/ui/reader/MediaPlayer.js", + "public/assets/javascripts/ui/reader/Tracker.js", + + "public/assets/javascripts/ui/reader/_router.js", + + "public/assets/javascripts/app.js", + "public/assets/javascripts/defaults.js", + ], + dest: 'public/assets/javascripts/reader.concat.js', } + + }, copy: { concat: { @@ -158,7 +261,15 @@ module.exports = function(grunt) { }, ] }, - }, + 'static': { + files: [ + { + src: 'public/assets/javascripts/static.concat.js', + dest: 'public/assets/javascripts/static.min.js', + }, + ] + }, + }, uglify: { options: { banner: '/* vvalls by okfocus 2015 */\n' @@ -166,10 +277,17 @@ module.exports = function(grunt) { js: { src: 'public/assets/javascripts/app.concat.js', dest: 'public/assets/javascripts/app.min.js', + }, + 'static': { + src: 'public/assets/javascripts/static.concat.js', + dest: 'public/assets/javascripts/static.min.js', } }, clean: { - release: ["public/assets/javascripts/app.concat.js"], + release: [ + "public/assets/javascripts/static.concat.js", + "public/assets/javascripts/app.concat.js", + ], } }); @@ -180,8 +298,10 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-clean'); // Default task(s). - grunt.registerTask('js', ['concat:js', 'uglify:js', 'clean:release']); - grunt.registerTask('merge', ['concat:js', 'copy:concat']); - grunt.registerTask('default', ['js']); + grunt.registerTask('js', ['concat:js', 'uglify:js', 'clean:release']); + grunt.registerTask('js-test', ['concat:js', 'copy:concat']); + grunt.registerTask('static', ['concat:static', 'uglify:static', 'clean:release']); + grunt.registerTask('static-test', ['concat:static', 'copy:static']); + grunt.registerTask('default', ['js']); }; diff --git a/public/assets/javascripts/ui/reader/MediaPlayer.js b/public/assets/javascripts/ui/reader/MediaPlayer.js index 8424d9c..8e65976 100644 --- a/public/assets/javascripts/ui/reader/MediaPlayer.js +++ b/public/assets/javascripts/ui/reader/MediaPlayer.js @@ -1,5 +1,5 @@ -var MediaPlayer = FormView.extend({ +var MediaPlayer = View.extend({ el: "#mediaPlayer", events: { diff --git a/public/assets/javascripts/ui/reader/ReaderView.js b/public/assets/javascripts/ui/reader/ReaderView.js index e3e27c3..55d2520 100644 --- a/public/assets/javascripts/ui/reader/ReaderView.js +++ b/public/assets/javascripts/ui/reader/ReaderView.js @@ -31,7 +31,12 @@ var ReaderView = View.extend({ this.tracker = new Tracker ({ mode: mode }) - $.get(this.projectAction + name, this.ready.bind(this)) + if ('vvalls_data' in window) { + this.ready(window.vvalls_data) + } + else { + $.get(this.projectAction + name, this.ready.bind(this)) + } }, getQS: function(){ @@ -85,9 +90,10 @@ var ReaderView = View.extend({ Walls.setColor[mode](colors[mode]) }) - editor.permissions.clear() + window.editor && editor.permissions.clear() - this.listen() + // disable until we start using spinning again + // this.listen() }, listen: function(){ diff --git a/public/assets/javascripts/ui/reader/_router.js b/public/assets/javascripts/ui/reader/_router.js new file mode 100644 index 0000000..a0e346a --- /dev/null +++ b/public/assets/javascripts/ui/reader/_router.js @@ -0,0 +1,16 @@ + +var SiteRouter = Router.extend({ + el: "body", + + initialize: function(){ + app.launch() + if (app.unsupported) return + + this.readerView = app.controller = new ReaderView() + this.readerView.load() + + $("body").removeClass("loading") + } + +}) + diff --git a/public/assets/test/static.html b/public/assets/test/static.html new file mode 100644 index 0000000..90871a5 --- /dev/null +++ b/public/assets/test/static.html @@ -0,0 +1,196 @@ + + + + VValls + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ + +
+
+

+ Leaves and such +
+ +
+ + asdf +

+ + + Last modified 4/20/2015 + + + + + Edit Room + +
+ +
+ + + + + + + + + + + + + +
+
+
+ +
+ +
+ X + +
+
+
+

Embed VValls

+ +

+ This code generates an iframe which will embed this room in your website or blog. +

+ + + dimensions: x + + + + test +
+
+
+
+ +
+ +
+ +
+
+ + + + + + + + + + diff --git a/server/index.js b/server/index.js index 7bc3f7f..391385c 100644 --- a/server/index.js +++ b/server/index.js @@ -66,6 +66,10 @@ site.setup = function(){ app.set('env', config.env.production ? "production" : "development") app.get('env') === 'development' && app.use(express.errorHandler()); + if (config.env.production) { + app.set('json spaces', 0) + } + // Essential middleware // app.all('*', middleware.enableCORS); app.all('*', middleware.ensureLocals); -- cgit v1.2.3-70-g09d2 From ce5fb676488648fa390bd0ebee0891abcd2c9290 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 20 Apr 2015 19:04:00 -0400 Subject: static project with demo data --- .gitignore | 4 +- Gruntfile.js | 2 +- public/assets/test/static.html | 238 +++++++++++++++++------------------------ 3 files changed, 100 insertions(+), 144 deletions(-) (limited to 'Gruntfile.js') diff --git a/.gitignore b/.gitignore index 14d6d0f..2a58e7f 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,6 @@ config.json app.concat.js app.min.js -reader.concat.js -reader.min.js +static.concat.js +static.min.js diff --git a/Gruntfile.js b/Gruntfile.js index a3ef359..a0f4d83 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -247,7 +247,7 @@ module.exports = function(grunt) { "public/assets/javascripts/app.js", "public/assets/javascripts/defaults.js", ], - dest: 'public/assets/javascripts/reader.concat.js', + dest: 'public/assets/javascripts/static.concat.js', } diff --git a/public/assets/test/static.html b/public/assets/test/static.html index 90871a5..dc098de 100644 --- a/public/assets/test/static.html +++ b/public/assets/test/static.html @@ -17,7 +17,7 @@ | | | | | | | | | | | | | | | | + | | + | | + | | + | | | | .' | |/ | | \| | `. | | -+------+' +------+ +------+ +------+ `+------> ++------+' +------+ +------+ +------+ `+-------> @@ -36,161 +36,117 @@ - -
- - -
- - -
-
-

- Leaves and such -
- -
- - asdf -

- - - Last modified 4/20/2015 - - - - - Edit Room - -
- -
- - - - - - - - - - - - - -
-
-
+
-
+
+ +
+ +
+
- + - -- cgit v1.2.3-70-g09d2 From 44642b48203b3ee2fa9e281f31ed9fed3f60ee79 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 21 Jul 2015 13:23:22 -0400 Subject: find closest segment --- Gruntfile.js | 8 +- .../assets/javascripts/mx/primitives/mx.point.js | 17 + .../javascripts/mx/primitives/mx.polyline.js | 48 +++ .../rectangles/engine/map/tools/_base.js | 11 + .../rectangles/engine/map/tools/arrow.js | 46 +++ .../rectangles/engine/map/tools/ortho.js | 115 +++++++ .../rectangles/engine/map/tools/polyline.js | 69 ++++ .../rectangles/engine/map/tools/position.js | 17 + .../javascripts/rectangles/engine/map/ui/editor.js | 284 ++++++++++++++++ .../rectangles/engine/map/ui/minimap.js | 81 +++++ .../javascripts/rectangles/engine/map/ui/ortho.js | 105 ++++++ .../javascripts/rectangles/engine/map/ui_editor.js | 284 ---------------- .../rectangles/engine/map/ui_minimap.js | 81 ----- .../javascripts/rectangles/engine/map/ui_ortho.js | 105 ------ public/assets/test/ortho3.html | 362 ++------------------- views/partials/scripts.ejs | 4 +- 16 files changed, 824 insertions(+), 813 deletions(-) create mode 100644 public/assets/javascripts/mx/primitives/mx.point.js create mode 100644 public/assets/javascripts/mx/primitives/mx.polyline.js create mode 100644 public/assets/javascripts/rectangles/engine/map/tools/_base.js create mode 100644 public/assets/javascripts/rectangles/engine/map/tools/arrow.js create mode 100644 public/assets/javascripts/rectangles/engine/map/tools/ortho.js create mode 100644 public/assets/javascripts/rectangles/engine/map/tools/polyline.js create mode 100644 public/assets/javascripts/rectangles/engine/map/tools/position.js create mode 100644 public/assets/javascripts/rectangles/engine/map/ui/editor.js create mode 100644 public/assets/javascripts/rectangles/engine/map/ui/minimap.js create mode 100644 public/assets/javascripts/rectangles/engine/map/ui/ortho.js delete mode 100644 public/assets/javascripts/rectangles/engine/map/ui_editor.js delete mode 100644 public/assets/javascripts/rectangles/engine/map/ui_minimap.js delete mode 100644 public/assets/javascripts/rectangles/engine/map/ui_ortho.js (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index a0f4d83..233c7ff 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -85,8 +85,8 @@ module.exports = function(grunt) { "public/assets/javascripts/rectangles/engine/sculpture/types/image.js", "public/assets/javascripts/rectangles/engine/map/_map.js", - "public/assets/javascripts/rectangles/engine/map/ui_editor.js", - "public/assets/javascripts/rectangles/engine/map/ui_minimap.js", + "public/assets/javascripts/rectangles/engine/map/ui/editor.js", + "public/assets/javascripts/rectangles/engine/map/ui/minimap.js", "public/assets/javascripts/rectangles/engine/map/draw.js", "public/assets/javascripts/ui/lib/View.js", @@ -228,8 +228,8 @@ module.exports = function(grunt) { "public/assets/javascripts/rectangles/engine/sculpture/types/image.js", "public/assets/javascripts/rectangles/engine/map/_map.js", - "public/assets/javascripts/rectangles/engine/map/ui_editor.js", - "public/assets/javascripts/rectangles/engine/map/ui_minimap.js", + "public/assets/javascripts/rectangles/engine/map/ui/editor.js", + "public/assets/javascripts/rectangles/engine/map/ui/minimap.js", "public/assets/javascripts/rectangles/engine/map/draw.js", "public/assets/javascripts/ui/lib/View.js", diff --git a/public/assets/javascripts/mx/primitives/mx.point.js b/public/assets/javascripts/mx/primitives/mx.point.js new file mode 100644 index 0000000..41a7732 --- /dev/null +++ b/public/assets/javascripts/mx/primitives/mx.point.js @@ -0,0 +1,17 @@ +MX.Point = MX.Object3D.extend({ + init: function(p){ + this.updateChildren = false + this.move({ + x: p.a, + y: 11, + z: p.b, + width: 20, + height: 20, + rotationX: PI/2, + }) + this.el.style.backgroundColor = 'rgb(' + [abs(floor(p.a*30)), 0, abs(floor(p.b*30))] + ')' + this.el.style.backfaceVisibility = "visible" + this.el.style.borderRadius = "50%" + scene.add(this) + } +}) diff --git a/public/assets/javascripts/mx/primitives/mx.polyline.js b/public/assets/javascripts/mx/primitives/mx.polyline.js new file mode 100644 index 0000000..555b3c6 --- /dev/null +++ b/public/assets/javascripts/mx/primitives/mx.polyline.js @@ -0,0 +1,48 @@ +MX.Polyline = MX.Object3D.extend({ + init: function(polyline){ + this.faces = [] + this.points = polyline.points + for (var i = 1; i < this.points.length; i++) { + var mx = new MX.Object3D() + var head = this.points[i-1] + var tail = this.points[i] + this.move_face(mx, head, tail) + this.faces.push(mx) + scene.add(mx) + } + }, + + rebuild: function(){ + for (var i = 1; i < this.points.length; i++) { + var mx = this.faces[i-1] + var head = this.points[i-1] + var tail = this.points[i] + this.move_face(mx, head, tail) + } + }, + + move_face: function (mx, head, tail){ + var mid_x = (head.a + tail.a) + var mid_z = (head.b + tail.b) + var len = head.distanceTo( tail ) + var angle = atan2( head.b - tail.b, head.a - tail.a ) + mx.move({ + x: mid_x / 2, + y: wall_height/2 + 1, + z: mid_z / 2, + width: ceil(len), + height: wall_height, + rotationY: angle + }) + var hue = abs(round( angle / PI * 90 + 300)) + mx.el.style.backgroundColor = 'hsl(' + [hue, "100%", "50%"] + ')' + }, + + destroy: function(){ + this.faces.forEach(function(mx){ + scene.remove(mx) + }) + this.faces = null + this.points = null + }, +}) diff --git a/public/assets/javascripts/rectangles/engine/map/tools/_base.js b/public/assets/javascripts/rectangles/engine/map/tools/_base.js new file mode 100644 index 0000000..17b247d --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/map/tools/_base.js @@ -0,0 +1,11 @@ +var MapTool = Fiber.extend(function(base){ + var exports = { + recenterCursor: true, + down: function(e, cursor){}, + move: function(e, cursor){}, + drag: function(e, cursor){}, + up: function(e, cursor, new_cursor){}, + cancel: function(){}, + } + return exports +}) \ No newline at end of file diff --git a/public/assets/javascripts/rectangles/engine/map/tools/arrow.js b/public/assets/javascripts/rectangles/engine/map/tools/arrow.js new file mode 100644 index 0000000..2a73954 --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/map/tools/arrow.js @@ -0,0 +1,46 @@ +var ArrowTool = MapTool.extend(function(base){ + var exports = {} + + var selected_point = null, original_point = null, selected_shape = null + + exports.down = function(e, cursor){ + last_point.a = cursor.x.a + last_point.b = cursor.y.a + var p = shapes.findClosestPoint(last_point) + if (p) { + selected_shape = p.shape + selected_point = p.point + original_point = selected_point.clone() + } + else { + map.ui.set_drag_tool("position") + } + } + + exports.move = function(e, cursor){ + last_point.a = cursor.x.a + last_point.b = cursor.y.a + var p = shapes.findClosestPoint(last_point) + if (p) { + document.body.style.cursor = "pointer" + last_point.assign(p.point) + cursor.x.a = cursor.x.b = last_point.a + cursor.y.a = cursor.y.b = last_point.b + } + else { + document.body.style.cursor = "crosshair" + } + } + + exports.drag = function(e, cursor){ + selected_point.a = original_point.a + cursor.x.magnitude() + selected_point.b = original_point.b + cursor.y.magnitude() + selected_shape.rebuild() + } + + exports.up = function(e, cursor){ + selected_point = selected_shape = original_point = null + } + + return exports +}) \ No newline at end of file diff --git a/public/assets/javascripts/rectangles/engine/map/tools/ortho.js b/public/assets/javascripts/rectangles/engine/map/tools/ortho.js new file mode 100644 index 0000000..be3d707 --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/map/tools/ortho.js @@ -0,0 +1,115 @@ +var OrthoPolylineTool = MapTool.extend(function (base) { + // this will work like normal polyline except all walls will be orthogonal + + var prev_point, horizontal = false, first_edge_is_horizontal = false + + var exports = {} + exports.down = function(e, cursor){ + // rightclick? + if (e.ctrlKey || e.which === 3) { + e.preventDefault() + e.stopPropagation() + if (map.ui.placing) { + // close polyline or cancel + map.ui.placing = false + if (line.points.length > 2) { + line.build() + } + else { + line.reset() + } + return + } + else { + map.ui.tools.position.rightclick(e, cursor) + } + return + } + + // compare to initial point + var p = last_point.clone() + if (map.ui.placing) { + if (line.lastPoint().eq(p)) { + return + } + else if (line.canCloseWith(p)) { + line.close() + line.build() + map.ui.placing = false + } + else { + line.add(p) + prev_point = p + horizontal = ! horizontal + } + } + else { + map.ui.placing = true + line = new Polyline () + line.add(p) + first_point = prev_point = p + horizontal = false + } + } + exports.move = function(e, cursor){ + last_point.a = cursor.x.a + last_point.b = cursor.y.a + if (map.ui.placing) { + if (line.points.length == 1) { + var x = abs(prev_point.a - last_point.a) + var y = abs(prev_point.b - last_point.b) + if (x > y) { + last_point.b = prev_point.b + first_edge_is_horizontal = horizontal = true + } + else { + last_point.a = prev_point.a + first_edge_is_horizontal = horizontal = false + } + } + else { + if (horizontal) { + last_point.b = prev_point.b + } + else { + last_point.a = prev_point.a + } + if (horizontal == first_edge_is_horizontal) { + // check if this point is within N pixels of the normal + // and lock it into place if so + if (horizontal && abs( first_point.a - last_point.a ) < 10/map.zoom) { + last_point.a = first_point.a + } + else if (! horizontal && abs( first_point.b - last_point.b ) < 10/map.zoom) { + last_point.b = first_point.b + } + } + } + + if (line.canCloseWith(last_point)) { + document.body.style.cursor = "pointer" + last_point.assign(first_point) + cursor.x.a = cursor.x.b = last_point.a + cursor.y.a = cursor.y.b = last_point.b + } + return + } + var end_point = shapes.findClosestEndPoint(last_point) + if (end_point) { + document.body.style.cursor = "pointer" + last_point.assign(end_point.point) + cursor.x.a = cursor.x.b = last_point.a + cursor.y.a = cursor.y.b = last_point.b + return + } + else { + document.body.style.cursor = "crosshair" + } + } + exports.cancel = function(){ + if (map.ui.placing) { line.reset() } + first_point = null + map.ui.placing = false + } + return exports +}) \ No newline at end of file diff --git a/public/assets/javascripts/rectangles/engine/map/tools/polyline.js b/public/assets/javascripts/rectangles/engine/map/tools/polyline.js new file mode 100644 index 0000000..559aea8 --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/map/tools/polyline.js @@ -0,0 +1,69 @@ +var PolylineTool = MapTool.extend(function (base) { + var exports = {} + exports.down = function(e, cursor){ + + // rightclick? + if (e.ctrlKey || e.which === 3) { + e.preventDefault() + e.stopPropagation() + if (map.ui.placing) { + // close polyline or cancel + map.ui.placing = false + if (line.points.length > 2) { + line.build() + } + else { + line.reset() + } + return + } + map.ui.tools.position.rightclick(e, cursor) + return + } + + // compare to initial point + var p = last_point.clone() + if (map.ui.placing) { + if (line.canCloseWith(p)) { + line.close() + line.build() + map.ui.placing = false + } + else { + line.add(p) + } + } + else { + map.ui.placing = true + line = new Polyline () + line.add(p) + } + } + exports.move = function(e, cursor){ + last_point.a = cursor.x.a + last_point.b = cursor.y.a + if (map.ui.placing && line.canCloseWith(last_point)) { + document.body.style.cursor = "pointer" + last_point.assign(line.points[0]) + cursor.x.a = cursor.x.b = last_point.a + cursor.y.a = cursor.y.b = last_point.b + return + } + var end_point = shapes.findClosestEndPoint(last_point) + if (end_point) { + document.body.style.cursor = "pointer" + last_point.assign(end_point.point) + cursor.x.a = cursor.x.b = last_point.a + cursor.y.a = cursor.y.b = last_point.b + return + } + else { + document.body.style.cursor = "crosshair" + } + } + exports.cancel = function(){ + if (map.ui.placing) { line.reset() } + map.ui.placing = false + } + return exports +}) \ No newline at end of file diff --git a/public/assets/javascripts/rectangles/engine/map/tools/position.js b/public/assets/javascripts/rectangles/engine/map/tools/position.js new file mode 100644 index 0000000..a994f5a --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/map/tools/position.js @@ -0,0 +1,17 @@ +var PositionTool = MapTool.extend(function(base){ + var exports = { + recenterCursor: false, + drag: function(e, cursor){ + map.center.a = -cursor.x.magnitude() + map.center.b = cursor.y.magnitude() + }, + rightclick: function(e, cursor){ + cursor.quantize(1/map.zoom) + map.center.a = cursor.x.a + map.center.b = -cursor.y.a + cursor.x.b = cursor.x.a + cursor.y.b = cursor.y.a + } + } + return exports +}) \ No newline at end of file diff --git a/public/assets/javascripts/rectangles/engine/map/ui/editor.js b/public/assets/javascripts/rectangles/engine/map/ui/editor.js new file mode 100644 index 0000000..7308344 --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/map/ui/editor.js @@ -0,0 +1,284 @@ + +Map.UI = Map.UI || {} +Map.UI.Editor = function(map){ + + var base = this + + base.creating = base.dragging = base.resizing = false + + base.mouse = new mouse({ + el: map.el, + down: down, + move: move, + drag: drag, + up: up, + rightclick: rightclick, + }) + + base.wheel = new wheel({ + el: map.el, + update: mousewheel, + }) + + base.permissions = new Permissions({ + create: true, + move: true, + resize: true, + destroy: false, + }) + + base.blur = function(){ + Rooms.forEach(function(r){ + return r.focused = false + }) + app.tube("builder-pick-nothing") + } + + // + + function down (e, cursor){ + var room + cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) + cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) + + if (e.ctrlKey || e.which === 3) { + if (Rooms.regions.length == 0) return + cursor.quantize(1/map.zoom) + map.center.a = cursor.x.a + map.center.b = -cursor.y.a + cursor.x.b = cursor.x.a + cursor.y.b = cursor.y.a + base.mouse.down = false + e.preventDefault() + e.stopPropagation() + return + } + + var intersects = Rooms.filter(function(r){ + return r.focused = r.rect.contains(cursor.x.a, cursor.y.a) + }) + + if (intersects.length && (base.permissions.destroy || e.altKey)) { + base.mouse.down = false + + room = intersects[0] + + UndoStack.push({ + type: "destroy-room", + undo: room.copy(), + redo: { id: room.id }, + }) + + Rooms.remove(room) + app.tube("builder-destroy-room", room) + + // TODO: watch individual scenery object here + Minotaur.watch( app.router.editorView.settings ) + return + } + else if (intersects.length) { + base.dragging = intersects[0] + base.resizing = base.dragging.rect.nearEdge(cursor.x.a, cursor.y.a, resize_margin / map.zoom) + base.dragging.rect.translation.sides = base.resizing + app.tube("builder-pick-room", intersects[0]) + } + else if (base.permissions.create) { + base.creating = true + } + + if (e.shiftKey && base.dragging) { + base.dragging.rect.quantize(10/map.zoom) + } + } + + function move (e, cursor) { + cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) + cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) + + var intersects = Rooms.filter(function(r){ + return r.rect.contains(cursor.x.a, cursor.y.a) + }) + + if (base.permissions.destroy) { + map.el.className = "destroy" + } + else if (intersects.length) { + var edges = intersects[0].rect.nearEdge(cursor.x.a, cursor.y.a, resize_margin / map.zoom) + switch (edges) { + case FRONT_LEFT: + case BACK_RIGHT: + map.el.className = "nesw-resize" + break + + case FRONT_RIGHT: + case BACK_LEFT: + map.el.className = "nwse-resize" + break + + case FRONT: + case BACK: + map.el.className = "ns-resize" + break + + case LEFT: + case RIGHT: + map.el.className = "ew-resize" + break + + default: + map.el.className = "move" + break + } + } + else { + map.el.className = "" + } + } + + function drag (e, cursor) { + cursor.x.b = ((cursor.x.b/map.dimensions.a)+0.5) * map.dimensions.a / map.zoom + map.center.a + cursor.y.b = ((cursor.y.b/map.dimensions.b)-0.5) * map.dimensions.b / map.zoom - map.center.b + + if (base.resizing) { + var x_length = base.dragging.rect.x.length(), + y_length = base.dragging.rect.y.length() + + if (base.resizing & LEFT) { + base.dragging.rect.translation.a = clamp( cursor.x.magnitude(), x_length - side_max, x_length - side_min ) + } + if (base.resizing & RIGHT) { + base.dragging.rect.translation.a = clamp( cursor.x.magnitude(), side_min - x_length, side_max - x_length ) + } + if (base.resizing & FRONT) { + base.dragging.rect.translation.b = clamp( cursor.y.magnitude(), y_length - side_max, y_length - side_min ) + } + if (base.resizing & BACK) { + base.dragging.rect.translation.b = clamp( cursor.y.magnitude(), side_min - y_length, side_max - y_length ) + } + } + else if (base.dragging) { + base.dragging.rect.translation.a = cursor.x.magnitude() + base.dragging.rect.translation.b = cursor.y.magnitude() + } + } + + function up (e, cursor, new_cursor) { + new_cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) + new_cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) + + if (base.creating) { + if (cursor.height() > side_min && cursor.width() > side_min) { + cursor.x.abs().quantize(1) + cursor.y.abs().quantize(1) + var room = Rooms.add_with_rect( cursor ) + + Rooms.rebuild() + + UndoStack.push({ + type: "create-room", + undo: { id: room.id }, + redo: room.copy() + }) + + Rooms.rebuild() + app.tube("builder-pick-room", room) + + // TODO: watch individual scenery object here + Minotaur.watch( app.controller.settings ) + } + } + if (base.resizing || base.dragging) { + var oldState = base.dragging.copy() + + if (base.resizing) { + base.dragging.rect.resize() + } + else if (base.dragging) { + base.dragging.rect.translate() + } + + UndoStack.push({ + type: "update-room", + undo: oldState, + redo: base.dragging.copy() + }) + Rooms.rebuild() + + // TODO: watch individual scenery object here + Minotaur.watch( app.router.editorView.settings ) + } + + var intersects = Rooms.filter(function(r){ + return r.focused = r.rect.contains(cursor.x.a, cursor.y.a) + }) + if (! intersects.length) { + app.tube("builder-pick-nothing") + } + + base.creating = base.dragging = base.resizing = false + } + + var wheelState, wheelTimeout + + function mousewheel (e, deltaY, deltaX){ + var cursor = base.mouse.cursor + + var intersects = Rooms.filter(function(r){ + return r.focused // = r.rect.contains(cursor.x.a, cursor.y.a) + }) + + if (intersects.length && window.heightIsGlobal) { + var rooms = Rooms.values() + wheelState = wheelState || rooms[0].height + var height = clamp( ~~(rooms[0].height + deltaY * 2), height_min, height_max ) + rooms.forEach(function(room){ + room.height = height + }) + + app.tube("builder-pick-room", intersects[0]) + + clearTimeout(wheelTimeout) + wheelTimeout = setTimeout(function(){ + UndoStack.push({ + type: "update-rooms-height", + undo: wheelState, + redo: height + }) + Rooms.rebuild() + + // TODO: watch individual scenery object here + Minotaur.watch( app.router.editorView.settings ) + + wheelState = null + }, 250) + } + else if (intersects.length) { + wheelState = wheelState || intersects[0].copy() + + intersects[0].height = clamp( ~~(intersects[0].height + deltaY * 2), height_min, height_max ) + app.tube("builder-pick-room", intersects[0]) + + clearTimeout(wheelTimeout) + wheelTimeout = setTimeout(function(){ + UndoStack.push({ + type: "update-room", + undo: wheelState, + redo: intersects[0].copy() + }) + Rooms.rebuild() + + // TODO: watch individual scenery object here + Minotaur.watch( app.router.editorView.settings ) + + wheelState = null + }, 250) + } + else { + map.set_zoom(map.zoom_exponent + deltaY/20) + } + } + + function rightclick (e){ + } + +} diff --git a/public/assets/javascripts/rectangles/engine/map/ui/minimap.js b/public/assets/javascripts/rectangles/engine/map/ui/minimap.js new file mode 100644 index 0000000..0fdd336 --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/map/ui/minimap.js @@ -0,0 +1,81 @@ + +Map.UI = Map.UI || {} + +Map.UI.Minimap = function(map){ + + var base = this + + base.creating = base.dragging = base.resizing = false + + base.mouse = new mouse({ + el: map.el, + down: down, + move: move, + drag: drag, + up: up, + rightclick: rightclick, + }) + + base.wheel = new wheel({ + el: map.el, + update: mousewheel, + }) + + var x, z + + // + + function down (e, cursor){ + cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) + cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) + + x = scene.camera.x + z = scene.camera.z + + if (e.ctrlKey || e.which === 3) { + cursor.quantize(1/map.zoom) + map.center.a = cursor.x.a + map.center.b = -cursor.y.a + console.log(map.center+"") + cursor.x.b = cursor.x.a + cursor.y.b = cursor.y.a + base.mouse.down = false + e.preventDefault() + e.stopPropagation() + return + } + } + + function move (e, cursor) { + cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) + cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) + } + + function drag (e, cursor) { + cursor.x.b = ((cursor.x.b/map.dimensions.a)+0.5) * map.dimensions.a / map.zoom + map.center.a + cursor.y.b = ((cursor.y.b/map.dimensions.b)-0.5) * map.dimensions.b / map.zoom - map.center.b + + scene.camera.x = x + cursor.x.magnitude() * map.zoom * 16 + scene.camera.z = z + cursor.y.magnitude() * map.zoom * 16 + Rooms.mover.room = null + + if (base.dragging) { + base.dragging.rect.translation.a = cursor.x.magnitude() + base.dragging.rect.translation.b = cursor.y.magnitude() + } + } + + function up (e, cursor, new_cursor) { + new_cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) + new_cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) + + base.dragging = false + } + + function mousewheel (e, deltaY, deltaX){ + map.set_zoom(map.zoom_exponent - deltaY/20) + } + + function rightclick (e){ + } +} diff --git a/public/assets/javascripts/rectangles/engine/map/ui/ortho.js b/public/assets/javascripts/rectangles/engine/map/ui/ortho.js new file mode 100644 index 0000000..52f7339 --- /dev/null +++ b/public/assets/javascripts/rectangles/engine/map/ui/ortho.js @@ -0,0 +1,105 @@ +Map.UI = Map.UI || {} +Map.UI.Ortho = function(map){ + + var base = this + var last_event = null + + base.creating = base.dragging = base.resizing = false + + base.mouse = new mouse({ + el: map.el, + down: function(e, cursor){ + last_event = e + cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom) + cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom) + if (tool.recenterCursor) { + cursor.x.add(map.center.a) + cursor.y.sub(map.center.b) + base.tools[currentTool].down(e, cursor) + } + else { + base.tools[currentTool].down(e, cursor) + cursor.x.add(map.center.a) + cursor.y.sub(map.center.b) + } + }, + move: function(e, cursor){ + last_event = e + cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom) + cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom) + if (tool.recenterCursor) { + cursor.x.add(map.center.a) + cursor.y.sub(map.center.b) + base.tools[currentTool].move(e, cursor) + } + else { + base.tools[currentTool].move(e, cursor) + cursor.x.add(map.center.a) + cursor.y.sub(map.center.b) + } + }, + drag: function(e, cursor){ + last_event = e + cursor.x.b = ((cursor.x.b/map.dimensions.a)+0.5) * map.dimensions.a / map.zoom + cursor.y.b = ((cursor.y.b/map.dimensions.b)-0.5) * map.dimensions.b / map.zoom + if (tool.recenterCursor) { + cursor.x.b += map.center.a + cursor.y.b -= map.center.b + base.tools[currentTool].drag(e, cursor) + } + else { + base.tools[currentTool].drag(e, cursor) + cursor.x.b += map.center.a + cursor.y.b -= map.center.b + } + }, + up: function(e, cursor, new_cursor){ + last_event = e + new_cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom) + new_cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom) + if (tool.recenterCursor) { + new_cursor.x.add(map.center.a) + new_cursor.y.sub(map.center.b) + base.tools[currentTool].up(e, cursor, new_cursor) + } + else { + base.tools[currentTool].up(e, cursor, new_cursor) + new_cursor.x.add(map.center.a) + new_cursor.y.sub(map.center.b) + } + if (nextTool) { + console.log('found nextTool') + base.set_tool(nextTool) + nextTool = null + } + } + }) + + var currentTool = "polyline", nextTool, tool + base.add_tool = function(name, tool){ + base.tools[name] = tool + } + base.set_tool = function(s){ + console.log("set tool to", s) + base.tools[currentTool].cancel() + currentTool = s + tool = base.tools[currentTool] + } + base.set_drag_tool = function(s){ + console.log('set drag tool to', s) + nextTool = currentTool + currentTool = s + tool = base.tools[currentTool] + base.tools[currentTool].down(last_event, base.mouse.cursor) + } + base.tools = {} + + base.wheel = new wheel({ + el: map.el, + update: mousewheel, + }) + + function mousewheel (e, deltaY, deltaX){ + map.set_zoom(map.zoom_exponent - deltaY/20) + } +} diff --git a/public/assets/javascripts/rectangles/engine/map/ui_editor.js b/public/assets/javascripts/rectangles/engine/map/ui_editor.js deleted file mode 100644 index 7308344..0000000 --- a/public/assets/javascripts/rectangles/engine/map/ui_editor.js +++ /dev/null @@ -1,284 +0,0 @@ - -Map.UI = Map.UI || {} -Map.UI.Editor = function(map){ - - var base = this - - base.creating = base.dragging = base.resizing = false - - base.mouse = new mouse({ - el: map.el, - down: down, - move: move, - drag: drag, - up: up, - rightclick: rightclick, - }) - - base.wheel = new wheel({ - el: map.el, - update: mousewheel, - }) - - base.permissions = new Permissions({ - create: true, - move: true, - resize: true, - destroy: false, - }) - - base.blur = function(){ - Rooms.forEach(function(r){ - return r.focused = false - }) - app.tube("builder-pick-nothing") - } - - // - - function down (e, cursor){ - var room - cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) - cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) - - if (e.ctrlKey || e.which === 3) { - if (Rooms.regions.length == 0) return - cursor.quantize(1/map.zoom) - map.center.a = cursor.x.a - map.center.b = -cursor.y.a - cursor.x.b = cursor.x.a - cursor.y.b = cursor.y.a - base.mouse.down = false - e.preventDefault() - e.stopPropagation() - return - } - - var intersects = Rooms.filter(function(r){ - return r.focused = r.rect.contains(cursor.x.a, cursor.y.a) - }) - - if (intersects.length && (base.permissions.destroy || e.altKey)) { - base.mouse.down = false - - room = intersects[0] - - UndoStack.push({ - type: "destroy-room", - undo: room.copy(), - redo: { id: room.id }, - }) - - Rooms.remove(room) - app.tube("builder-destroy-room", room) - - // TODO: watch individual scenery object here - Minotaur.watch( app.router.editorView.settings ) - return - } - else if (intersects.length) { - base.dragging = intersects[0] - base.resizing = base.dragging.rect.nearEdge(cursor.x.a, cursor.y.a, resize_margin / map.zoom) - base.dragging.rect.translation.sides = base.resizing - app.tube("builder-pick-room", intersects[0]) - } - else if (base.permissions.create) { - base.creating = true - } - - if (e.shiftKey && base.dragging) { - base.dragging.rect.quantize(10/map.zoom) - } - } - - function move (e, cursor) { - cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) - cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) - - var intersects = Rooms.filter(function(r){ - return r.rect.contains(cursor.x.a, cursor.y.a) - }) - - if (base.permissions.destroy) { - map.el.className = "destroy" - } - else if (intersects.length) { - var edges = intersects[0].rect.nearEdge(cursor.x.a, cursor.y.a, resize_margin / map.zoom) - switch (edges) { - case FRONT_LEFT: - case BACK_RIGHT: - map.el.className = "nesw-resize" - break - - case FRONT_RIGHT: - case BACK_LEFT: - map.el.className = "nwse-resize" - break - - case FRONT: - case BACK: - map.el.className = "ns-resize" - break - - case LEFT: - case RIGHT: - map.el.className = "ew-resize" - break - - default: - map.el.className = "move" - break - } - } - else { - map.el.className = "" - } - } - - function drag (e, cursor) { - cursor.x.b = ((cursor.x.b/map.dimensions.a)+0.5) * map.dimensions.a / map.zoom + map.center.a - cursor.y.b = ((cursor.y.b/map.dimensions.b)-0.5) * map.dimensions.b / map.zoom - map.center.b - - if (base.resizing) { - var x_length = base.dragging.rect.x.length(), - y_length = base.dragging.rect.y.length() - - if (base.resizing & LEFT) { - base.dragging.rect.translation.a = clamp( cursor.x.magnitude(), x_length - side_max, x_length - side_min ) - } - if (base.resizing & RIGHT) { - base.dragging.rect.translation.a = clamp( cursor.x.magnitude(), side_min - x_length, side_max - x_length ) - } - if (base.resizing & FRONT) { - base.dragging.rect.translation.b = clamp( cursor.y.magnitude(), y_length - side_max, y_length - side_min ) - } - if (base.resizing & BACK) { - base.dragging.rect.translation.b = clamp( cursor.y.magnitude(), side_min - y_length, side_max - y_length ) - } - } - else if (base.dragging) { - base.dragging.rect.translation.a = cursor.x.magnitude() - base.dragging.rect.translation.b = cursor.y.magnitude() - } - } - - function up (e, cursor, new_cursor) { - new_cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) - new_cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) - - if (base.creating) { - if (cursor.height() > side_min && cursor.width() > side_min) { - cursor.x.abs().quantize(1) - cursor.y.abs().quantize(1) - var room = Rooms.add_with_rect( cursor ) - - Rooms.rebuild() - - UndoStack.push({ - type: "create-room", - undo: { id: room.id }, - redo: room.copy() - }) - - Rooms.rebuild() - app.tube("builder-pick-room", room) - - // TODO: watch individual scenery object here - Minotaur.watch( app.controller.settings ) - } - } - if (base.resizing || base.dragging) { - var oldState = base.dragging.copy() - - if (base.resizing) { - base.dragging.rect.resize() - } - else if (base.dragging) { - base.dragging.rect.translate() - } - - UndoStack.push({ - type: "update-room", - undo: oldState, - redo: base.dragging.copy() - }) - Rooms.rebuild() - - // TODO: watch individual scenery object here - Minotaur.watch( app.router.editorView.settings ) - } - - var intersects = Rooms.filter(function(r){ - return r.focused = r.rect.contains(cursor.x.a, cursor.y.a) - }) - if (! intersects.length) { - app.tube("builder-pick-nothing") - } - - base.creating = base.dragging = base.resizing = false - } - - var wheelState, wheelTimeout - - function mousewheel (e, deltaY, deltaX){ - var cursor = base.mouse.cursor - - var intersects = Rooms.filter(function(r){ - return r.focused // = r.rect.contains(cursor.x.a, cursor.y.a) - }) - - if (intersects.length && window.heightIsGlobal) { - var rooms = Rooms.values() - wheelState = wheelState || rooms[0].height - var height = clamp( ~~(rooms[0].height + deltaY * 2), height_min, height_max ) - rooms.forEach(function(room){ - room.height = height - }) - - app.tube("builder-pick-room", intersects[0]) - - clearTimeout(wheelTimeout) - wheelTimeout = setTimeout(function(){ - UndoStack.push({ - type: "update-rooms-height", - undo: wheelState, - redo: height - }) - Rooms.rebuild() - - // TODO: watch individual scenery object here - Minotaur.watch( app.router.editorView.settings ) - - wheelState = null - }, 250) - } - else if (intersects.length) { - wheelState = wheelState || intersects[0].copy() - - intersects[0].height = clamp( ~~(intersects[0].height + deltaY * 2), height_min, height_max ) - app.tube("builder-pick-room", intersects[0]) - - clearTimeout(wheelTimeout) - wheelTimeout = setTimeout(function(){ - UndoStack.push({ - type: "update-room", - undo: wheelState, - redo: intersects[0].copy() - }) - Rooms.rebuild() - - // TODO: watch individual scenery object here - Minotaur.watch( app.router.editorView.settings ) - - wheelState = null - }, 250) - } - else { - map.set_zoom(map.zoom_exponent + deltaY/20) - } - } - - function rightclick (e){ - } - -} diff --git a/public/assets/javascripts/rectangles/engine/map/ui_minimap.js b/public/assets/javascripts/rectangles/engine/map/ui_minimap.js deleted file mode 100644 index 0fdd336..0000000 --- a/public/assets/javascripts/rectangles/engine/map/ui_minimap.js +++ /dev/null @@ -1,81 +0,0 @@ - -Map.UI = Map.UI || {} - -Map.UI.Minimap = function(map){ - - var base = this - - base.creating = base.dragging = base.resizing = false - - base.mouse = new mouse({ - el: map.el, - down: down, - move: move, - drag: drag, - up: up, - rightclick: rightclick, - }) - - base.wheel = new wheel({ - el: map.el, - update: mousewheel, - }) - - var x, z - - // - - function down (e, cursor){ - cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) - cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) - - x = scene.camera.x - z = scene.camera.z - - if (e.ctrlKey || e.which === 3) { - cursor.quantize(1/map.zoom) - map.center.a = cursor.x.a - map.center.b = -cursor.y.a - console.log(map.center+"") - cursor.x.b = cursor.x.a - cursor.y.b = cursor.y.a - base.mouse.down = false - e.preventDefault() - e.stopPropagation() - return - } - } - - function move (e, cursor) { - cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) - cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) - } - - function drag (e, cursor) { - cursor.x.b = ((cursor.x.b/map.dimensions.a)+0.5) * map.dimensions.a / map.zoom + map.center.a - cursor.y.b = ((cursor.y.b/map.dimensions.b)-0.5) * map.dimensions.b / map.zoom - map.center.b - - scene.camera.x = x + cursor.x.magnitude() * map.zoom * 16 - scene.camera.z = z + cursor.y.magnitude() * map.zoom * 16 - Rooms.mover.room = null - - if (base.dragging) { - base.dragging.rect.translation.a = cursor.x.magnitude() - base.dragging.rect.translation.b = cursor.y.magnitude() - } - } - - function up (e, cursor, new_cursor) { - new_cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom).add(map.center.a) - new_cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom).sub(map.center.b) - - base.dragging = false - } - - function mousewheel (e, deltaY, deltaX){ - map.set_zoom(map.zoom_exponent - deltaY/20) - } - - function rightclick (e){ - } -} diff --git a/public/assets/javascripts/rectangles/engine/map/ui_ortho.js b/public/assets/javascripts/rectangles/engine/map/ui_ortho.js deleted file mode 100644 index 52f7339..0000000 --- a/public/assets/javascripts/rectangles/engine/map/ui_ortho.js +++ /dev/null @@ -1,105 +0,0 @@ -Map.UI = Map.UI || {} -Map.UI.Ortho = function(map){ - - var base = this - var last_event = null - - base.creating = base.dragging = base.resizing = false - - base.mouse = new mouse({ - el: map.el, - down: function(e, cursor){ - last_event = e - cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom) - cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom) - if (tool.recenterCursor) { - cursor.x.add(map.center.a) - cursor.y.sub(map.center.b) - base.tools[currentTool].down(e, cursor) - } - else { - base.tools[currentTool].down(e, cursor) - cursor.x.add(map.center.a) - cursor.y.sub(map.center.b) - } - }, - move: function(e, cursor){ - last_event = e - cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom) - cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom) - if (tool.recenterCursor) { - cursor.x.add(map.center.a) - cursor.y.sub(map.center.b) - base.tools[currentTool].move(e, cursor) - } - else { - base.tools[currentTool].move(e, cursor) - cursor.x.add(map.center.a) - cursor.y.sub(map.center.b) - } - }, - drag: function(e, cursor){ - last_event = e - cursor.x.b = ((cursor.x.b/map.dimensions.a)+0.5) * map.dimensions.a / map.zoom - cursor.y.b = ((cursor.y.b/map.dimensions.b)-0.5) * map.dimensions.b / map.zoom - if (tool.recenterCursor) { - cursor.x.b += map.center.a - cursor.y.b -= map.center.b - base.tools[currentTool].drag(e, cursor) - } - else { - base.tools[currentTool].drag(e, cursor) - cursor.x.b += map.center.a - cursor.y.b -= map.center.b - } - }, - up: function(e, cursor, new_cursor){ - last_event = e - new_cursor.x.div(map.dimensions.a).add(0.5).mul(map.dimensions.a / map.zoom) - new_cursor.y.div(map.dimensions.b).sub(0.5).mul(map.dimensions.b / map.zoom) - if (tool.recenterCursor) { - new_cursor.x.add(map.center.a) - new_cursor.y.sub(map.center.b) - base.tools[currentTool].up(e, cursor, new_cursor) - } - else { - base.tools[currentTool].up(e, cursor, new_cursor) - new_cursor.x.add(map.center.a) - new_cursor.y.sub(map.center.b) - } - if (nextTool) { - console.log('found nextTool') - base.set_tool(nextTool) - nextTool = null - } - } - }) - - var currentTool = "polyline", nextTool, tool - base.add_tool = function(name, tool){ - base.tools[name] = tool - } - base.set_tool = function(s){ - console.log("set tool to", s) - base.tools[currentTool].cancel() - currentTool = s - tool = base.tools[currentTool] - } - base.set_drag_tool = function(s){ - console.log('set drag tool to', s) - nextTool = currentTool - currentTool = s - tool = base.tools[currentTool] - base.tools[currentTool].down(last_event, base.mouse.cursor) - } - base.tools = {} - - base.wheel = new wheel({ - el: map.el, - update: mousewheel, - }) - - function mousewheel (e, deltaY, deltaX){ - map.set_zoom(map.zoom_exponent - deltaY/20) - } -} diff --git a/public/assets/test/ortho3.html b/public/assets/test/ortho3.html index fa7e3c5..7e7e8ec 100644 --- a/public/assets/test/ortho3.html +++ b/public/assets/test/ortho3.html @@ -61,6 +61,8 @@ body { + + @@ -68,8 +70,13 @@ body { - + + + + + + - - + + -- cgit v1.2.3-70-g09d2 From d4a98f11e4557f21385a91266aeb198106edb62e Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 13 Jun 2016 13:18:02 -0400 Subject: gruntfile --- Gruntfile.js | 308 +++++++++++++++++++++++++--------------------- views/partials/footer.ejs | 2 +- 2 files changed, 171 insertions(+), 139 deletions(-) (limited to 'Gruntfile.js') diff --git a/Gruntfile.js b/Gruntfile.js index 233c7ff..988d040 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -8,143 +8,175 @@ module.exports = function(grunt) { }, js: { src: [ - "public/assets/javascripts/vendor/bower_components/jquery/dist/jquery.min.js", - "public/assets/javascripts/vendor/bower_components/lodash/lodash.min.js", - "public/assets/javascripts/vendor/bower_components/momentjs/min/moment.min.js", - "public/assets/javascripts/vendor/bower_components/fiber/src/fiber.min.js", - "public/assets/javascripts/vendor/bower_components/marked/lib/marked.js", - "public/assets/javascripts/vendor/bower_components/hidpi-canvas/dist/hidpi-canvas.js", - "public/assets/javascripts/vendor/tube.js", - "public/assets/javascripts/vendor/loader.js", - "public/assets/javascripts/vendor/polyfill.js", - "public/assets/javascripts/vendor/sha1.js", - "public/assets/javascripts/vendor/dataUriToBlob.js", - "public/assets/javascripts/vendor/froogaloop.js", - "public/assets/javascripts/util.js", - - "public/assets/javascripts/mx/mx.js", - "public/assets/javascripts/mx/extensions/mx.scene.js", - "public/assets/javascripts/mx/extensions/mx.movements.js", - "public/assets/javascripts/mx/extensions/mx.movementsMobile.js", - "public/assets/javascripts/mx/primitives/mx.image.js", - "public/assets/javascripts/mx/primitives/mx.text.js", - "public/assets/javascripts/mx/primitives/mx.video.js", - "public/assets/javascripts/mx/primitives/mx.youtube.js", - "public/assets/javascripts/mx/primitives/mx.vimeo.js", - "public/assets/javascripts/mx/primitives/mx.soundcloud.js", - "public/assets/javascripts/mx/primitives/mx.grid.js", - - "public/assets/javascripts/rectangles/_env.js", - - "public/assets/javascripts/rectangles/util/constants.js", - "public/assets/javascripts/rectangles/util/colors.js", - "public/assets/javascripts/rectangles/util/coords.js", - "public/assets/javascripts/rectangles/util/debug.js", - "public/assets/javascripts/rectangles/util/keys.js", - "public/assets/javascripts/rectangles/util/measurement.js", - "public/assets/javascripts/rectangles/util/minotaur.js", - "public/assets/javascripts/rectangles/util/mouse.js", - "public/assets/javascripts/rectangles/util/permissions.js", - "public/assets/javascripts/rectangles/util/sort.js", - "public/assets/javascripts/rectangles/util/uid.js", - "public/assets/javascripts/rectangles/util/undostack.js", - "public/assets/javascripts/rectangles/util/wheel.js", - - "public/assets/javascripts/rectangles/models/vec2.js", - "public/assets/javascripts/rectangles/models/vec3.js", - "public/assets/javascripts/rectangles/models/rect.js", - "public/assets/javascripts/rectangles/models/surface.js", - "public/assets/javascripts/rectangles/models/tree.js", - "public/assets/javascripts/rectangles/models/room.js", - "public/assets/javascripts/rectangles/models/wall.js", - "public/assets/javascripts/rectangles/models/floor.js", - - "public/assets/javascripts/rectangles/engine/rooms/_rooms.js", - "public/assets/javascripts/rectangles/engine/rooms/_walls.js", - "public/assets/javascripts/rectangles/engine/rooms/builder.js", - "public/assets/javascripts/rectangles/engine/rooms/clipper.js", - "public/assets/javascripts/rectangles/engine/rooms/grouper.js", - "public/assets/javascripts/rectangles/engine/rooms/mover.js", - - "public/assets/javascripts/rectangles/engine/scenery/_scenery.js", - "public/assets/javascripts/rectangles/engine/scenery/move.js", - "public/assets/javascripts/rectangles/engine/scenery/resize.js", - "public/assets/javascripts/rectangles/engine/scenery/randomize.js", - "public/assets/javascripts/rectangles/engine/scenery/sound.js", - "public/assets/javascripts/rectangles/engine/scenery/undo.js", - "public/assets/javascripts/rectangles/engine/scenery/types/_object.js", - "public/assets/javascripts/rectangles/engine/scenery/types/image.js", - "public/assets/javascripts/rectangles/engine/scenery/types/text.js", - "public/assets/javascripts/rectangles/engine/scenery/types/video.js", - "public/assets/javascripts/rectangles/engine/scenery/types/audio.js", - - "public/assets/javascripts/rectangles/engine/sculpture/_sculpture.js", - "public/assets/javascripts/rectangles/engine/sculpture/move.js", - "public/assets/javascripts/rectangles/engine/sculpture/resize.js", - "public/assets/javascripts/rectangles/engine/sculpture/types/_object.js", - "public/assets/javascripts/rectangles/engine/sculpture/types/image.js", - - "public/assets/javascripts/rectangles/engine/map/_map.js", - "public/assets/javascripts/rectangles/engine/map/ui/editor.js", - "public/assets/javascripts/rectangles/engine/map/ui/minimap.js", - "public/assets/javascripts/rectangles/engine/map/draw.js", - - "public/assets/javascripts/ui/lib/View.js", - "public/assets/javascripts/ui/lib/Router.js", - "public/assets/javascripts/ui/lib/ModalView.js", - "public/assets/javascripts/ui/lib/FormView.js", - "public/assets/javascripts/ui/lib/UploadView.js", - "public/assets/javascripts/ui/lib/AlertModal.js", - "public/assets/javascripts/ui/lib/ConfirmModal.js", - "public/assets/javascripts/ui/lib/ErrorModal.js", - "public/assets/javascripts/ui/lib/Parser.js", - "public/assets/javascripts/ui/lib/LabColorPicker.js", - - "public/assets/javascripts/ui/site/SignInModal.js", - "public/assets/javascripts/ui/site/SignUpModal.js", - "public/assets/javascripts/ui/site/UsernameTaken.js", - "public/assets/javascripts/ui/site/PasswordForgot.js", - "public/assets/javascripts/ui/site/PasswordReset.js", - "public/assets/javascripts/ui/site/LayoutsModal.js", - "public/assets/javascripts/ui/site/EditProjectModal.js", - "public/assets/javascripts/ui/site/EditProfileModal.js", - "public/assets/javascripts/ui/site/EditSubscriptionModal.js", - "public/assets/javascripts/ui/site/DocumentModal.js", - - "public/assets/javascripts/ui/site/HomeView.js", - "public/assets/javascripts/ui/site/ProfileView.js", - "public/assets/javascripts/ui/site/ProjectList.js", - - "public/assets/javascripts/ui/builder/BuilderView.js", - "public/assets/javascripts/ui/builder/BuilderSettings.js", - "public/assets/javascripts/ui/builder/BuilderToolbar.js", - "public/assets/javascripts/ui/builder/BuilderInfo.js", - - "public/assets/javascripts/ui/editor/EditorView.js", - "public/assets/javascripts/ui/editor/EditorSettings.js", - "public/assets/javascripts/ui/editor/EditorToolbar.js", - "public/assets/javascripts/ui/editor/HelpCursor.js", - "public/assets/javascripts/ui/editor/ColorControl.js", - "public/assets/javascripts/ui/editor/Collaborators.js", - "public/assets/javascripts/ui/editor/MediaEditor.js", - "public/assets/javascripts/ui/editor/MediaTumblr.js", - "public/assets/javascripts/ui/editor/MediaUpload.js", - "public/assets/javascripts/ui/editor/MediaViewer.js", - "public/assets/javascripts/ui/editor/Presets.js", - "public/assets/javascripts/ui/editor/SculptureEditor.js", - "public/assets/javascripts/ui/editor/TextEditor.js", - "public/assets/javascripts/ui/editor/WallpaperPicker.js", - - "public/assets/javascripts/ui/reader/ReaderView.js", - "public/assets/javascripts/ui/reader/ShareView.js", - "public/assets/javascripts/ui/reader/EmbedView.js", - "public/assets/javascripts/ui/reader/MediaPlayer.js", - "public/assets/javascripts/ui/reader/Tracker.js", - - "public/assets/javascripts/ui/_router.js", - - "public/assets/javascripts/app.js", - "public/assets/javascripts/defaults.js", + "/assets/javascripts/vendor/bower_components/jquery/dist/jquery.min.js" + "/assets/javascripts/vendor/bower_components/lodash/lodash.min.js", + "/assets/javascripts/vendor/bower_components/momentjs/min/moment.min.js", + "/assets/javascripts/vendor/bower_components/fiber/src/fiber.min.js", + "/assets/javascripts/vendor/bower_components/hidpi-canvas/dist/hidpi-canvas.js", + "/assets/javascripts/vendor/bower_components/marked/lib/marked.js", + "/assets/javascripts/vendor/tube.js", + "/assets/javascripts/vendor/loader.js", + "/assets/javascripts/vendor/polyfill.js", + "/assets/javascripts/vendor/sha1.js", + "/assets/javascripts/vendor/dataUriToBlob.js", + "/assets/javascripts/vendor/froogaloop.js", + "/assets/javascripts/util.js", + + "/assets/javascripts/mx/mx.js", + + "/assets/javascripts/mx/extensions/mx.scene.js", + "/assets/javascripts/mx/extensions/mx.movements.js", + "/assets/javascripts/mx/extensions/mx.movementsMobile.js", + "/assets/javascripts/mx/extensions/mx.orbitCamera.js", + + "/assets/javascripts/mx/primitives/mx.image.js", + "/assets/javascripts/mx/primitives/mx.text.js", + "/assets/javascripts/mx/primitives/mx.video.js", + "/assets/javascripts/mx/primitives/mx.youtube.js", + "/assets/javascripts/mx/primitives/mx.vimeo.js", + "/assets/javascripts/mx/primitives/mx.soundcloud.js", + "/assets/javascripts/mx/primitives/mx.grid.js", + "/assets/javascripts/mx/primitives/mx.point.js", + "/assets/javascripts/mx/primitives/mx.polyline.js", + + "/assets/javascripts/rectangles/_env.js", + + "/assets/javascripts/rectangles/util/constants.js", + "/assets/javascripts/rectangles/util/colors.js", + "/assets/javascripts/rectangles/util/coords.js", + "/assets/javascripts/rectangles/util/debug.js", + "/assets/javascripts/rectangles/util/keys.js", + "/assets/javascripts/rectangles/util/measurement.js", + "/assets/javascripts/rectangles/util/minotaur.js", + "/assets/javascripts/rectangles/util/mouse.js", + "/assets/javascripts/rectangles/util/permissions.js", + "/assets/javascripts/rectangles/util/sort.js", + "/assets/javascripts/rectangles/util/uid.js", + "/assets/javascripts/rectangles/util/undostack.js", + "/assets/javascripts/rectangles/util/wheel.js", + + "/assets/javascripts/rectangles/models/vec2.js", + "/assets/javascripts/rectangles/models/vec3.js", + "/assets/javascripts/rectangles/models/rect.js", + "/assets/javascripts/rectangles/models/surface.js", + "/assets/javascripts/rectangles/models/tree.js", + "/assets/javascripts/rectangles/models/room.js", + "/assets/javascripts/rectangles/models/wall.js", + "/assets/javascripts/rectangles/models/floor.js", + + "/assets/javascripts/rectangles/engine/rooms/_rooms.js", + "/assets/javascripts/rectangles/engine/rooms/_walls.js", + "/assets/javascripts/rectangles/engine/rooms/builder.js", + "/assets/javascripts/rectangles/engine/rooms/clipper.js", + "/assets/javascripts/rectangles/engine/rooms/grouper.js", + "/assets/javascripts/rectangles/engine/rooms/mover.js", + + "/assets/javascripts/rectangles/engine/scenery/_scenery.js", + "/assets/javascripts/rectangles/engine/scenery/move.js", + "/assets/javascripts/rectangles/engine/scenery/resize.js", + "/assets/javascripts/rectangles/engine/scenery/randomize.js", + "/assets/javascripts/rectangles/engine/scenery/sound.js", + "/assets/javascripts/rectangles/engine/scenery/undo.js", + "/assets/javascripts/rectangles/engine/scenery/types/_object.js", + "/assets/javascripts/rectangles/engine/scenery/types/audio.js", + "/assets/javascripts/rectangles/engine/scenery/types/image.js", + "/assets/javascripts/rectangles/engine/scenery/types/text.js", + "/assets/javascripts/rectangles/engine/scenery/types/video.js", + + "/assets/javascripts/rectangles/engine/sculpture/_sculpture.js", + "/assets/javascripts/rectangles/engine/sculpture/move.js", + "/assets/javascripts/rectangles/engine/sculpture/resize.js", + "/assets/javascripts/rectangles/engine/sculpture/types/_object.js", + "/assets/javascripts/rectangles/engine/sculpture/types/image.js", + + "/assets/javascripts/rectangles/engine/shapes/polyline.js", + "/assets/javascripts/rectangles/engine/shapes/ortho.js", + "/assets/javascripts/rectangles/engine/shapes/shapelist.js", + "/assets/javascripts/rectangles/engine/shapes/regionlist.js", + + "/assets/javascripts/rectangles/engine/map/_map.js", + "/assets/javascripts/rectangles/engine/map/draw.js", + "/assets/javascripts/rectangles/engine/map/ui/editor.js", + "/assets/javascripts/rectangles/engine/map/ui/minimap.js", + "/assets/javascripts/rectangles/engine/map/ui/ortho.js", + "/assets/javascripts/rectangles/engine/map/tools/_base.js", + "/assets/javascripts/rectangles/engine/map/tools/arrow.js", + "/assets/javascripts/rectangles/engine/map/tools/line.js", + "/assets/javascripts/rectangles/engine/map/tools/eraser.js", + "/assets/javascripts/rectangles/engine/map/tools/ortho.js", + "/assets/javascripts/rectangles/engine/map/tools/polyline.js", + "/assets/javascripts/rectangles/engine/map/tools/position.js", + "/assets/javascripts/rectangles/engine/map/tools/start.js", + + "/assets/javascripts/ui/lib/View.js", + "/assets/javascripts/ui/lib/Router.js", + "/assets/javascripts/ui/lib/ModalView.js", + "/assets/javascripts/ui/lib/FormView.js", + "/assets/javascripts/ui/lib/UploadView.js", + "/assets/javascripts/ui/lib/AnimatedView.js", + "/assets/javascripts/ui/lib/ToggleableView.js", + "/assets/javascripts/ui/lib/AlertModal.js", + "/assets/javascripts/ui/lib/ConfirmModal.js", + "/assets/javascripts/ui/lib/ErrorModal.js", + "/assets/javascripts/ui/lib/Parser.js", + "/assets/javascripts/ui/lib/LabColorPicker.js", + + "/assets/javascripts/ui/site/SignInModal.js", + "/assets/javascripts/ui/site/SignUpModal.js", + "/assets/javascripts/ui/site/UsernameTaken.js", + "/assets/javascripts/ui/site/PasswordForgot.js", + "/assets/javascripts/ui/site/PasswordReset.js", + "/assets/javascripts/ui/site/LayoutsIndex.js", + "/assets/javascripts/ui/site/LayoutsModal.js", + "/assets/javascripts/ui/site/NewProjectModal.js", + "/assets/javascripts/ui/site/EditProjectModal.js", + "/assets/javascripts/ui/site/EditProfileModal.js", + "/assets/javascripts/ui/site/EditSubscriptionModal.js", + "/assets/javascripts/ui/site/DocumentModal.js", + + "/assets/javascripts/ui/site/HomeView.js", + "/assets/javascripts/ui/site/ProfileView.js", + "/assets/javascripts/ui/site/ProjectList.js", + + "/assets/javascripts/ui/builder/BuilderView.js", + "/assets/javascripts/ui/builder/BuilderSettings.js", + "/assets/javascripts/ui/builder/BuilderToolbar.js", + "/assets/javascripts/ui/builder/BuilderInfo.js", + + "/assets/javascripts/ui/blueprint/BlueprintView.js", + "/assets/javascripts/ui/blueprint/BlueprintInfo.js", + "/assets/javascripts/ui/blueprint/BlueprintSettings.js", + "/assets/javascripts/ui/blueprint/BlueprintEditor.js", + "/assets/javascripts/ui/blueprint/BlueprintScaler.js", + "/assets/javascripts/ui/blueprint/BlueprintToolbar.js", + "/assets/javascripts/ui/blueprint/BlueprintUploader.js", + "/assets/javascripts/ui/blueprint/BlueprintNotice.js", + + "/assets/javascripts/ui/editor/EditorView.js", + "/assets/javascripts/ui/editor/EditorSettings.js", + "/assets/javascripts/ui/editor/EditorToolbar.js", + "/assets/javascripts/ui/editor/HelpCursor.js", + "/assets/javascripts/ui/editor/ColorControl.js", + "/assets/javascripts/ui/editor/Collaborators.js", + "/assets/javascripts/ui/editor/MediaEditor.js", + "/assets/javascripts/ui/editor/MediaTumblr.js", + "/assets/javascripts/ui/editor/MediaUpload.js", + "/assets/javascripts/ui/editor/MediaViewer.js", + "/assets/javascripts/ui/editor/Presets.js", + "/assets/javascripts/ui/editor/SculptureEditor.js", + "/assets/javascripts/ui/editor/TextEditor.js", + "/assets/javascripts/ui/editor/WallpaperPicker.js", + + "/assets/javascripts/ui/reader/ReaderView.js", + "/assets/javascripts/ui/reader/ShareView.js", + "/assets/javascripts/ui/reader/EmbedView.js", + "/assets/javascripts/ui/reader/MediaPlayer.js", + "/assets/javascripts/ui/reader/Tracker.js", + + "/assets/javascripts/ui/_router.js", + + "/assets/javascripts/app.js", + "/assets/javascripts/defaults.js", ], dest: 'public/assets/javascripts/app.concat.js', }, @@ -272,7 +304,7 @@ module.exports = function(grunt) { }, uglify: { options: { - banner: '/* vvalls by okfocus 2015 */\n' + banner: '/* vvalls by okfocus 2016 */\n' }, js: { src: 'public/assets/javascripts/app.concat.js', diff --git a/views/partials/footer.ejs b/views/partials/footer.ejs index 05bc128..2d9fb59 100644 --- a/views/partials/footer.ejs +++ b/views/partials/footer.ejs @@ -25,7 +25,7 @@ Privacy Contact

- © 2015 Dot Dash 3, Inc. + © 2016 Dot Dash 3, Inc. Site by OKFocus
-- cgit v1.2.3-70-g09d2