diff options
Diffstat (limited to 'public/assets/javascripts')
| -rw-r--r-- | public/assets/javascripts/mx/primitives/mx.youtube.js | 29 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/_router.js | 29 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/editor/EditorToolbar.js | 1 | ||||
| -rw-r--r-- | public/assets/javascripts/ui/reader/ReaderView.js | 3 |
4 files changed, 42 insertions, 20 deletions
diff --git a/public/assets/javascripts/mx/primitives/mx.youtube.js b/public/assets/javascripts/mx/primitives/mx.youtube.js index b1d3dfb..9925c22 100644 --- a/public/assets/javascripts/mx/primitives/mx.youtube.js +++ b/public/assets/javascripts/mx/primitives/mx.youtube.js @@ -24,6 +24,7 @@ MX.Youtube = MX.Object3D.extend({ }, load: function (ops) { + var base = this var uid = 'player-' + Uid () var preload = document.createElement("div") preload.id = uid @@ -34,16 +35,22 @@ MX.Youtube = MX.Object3D.extend({ preload.className = "preload" this.el.appendChild(preload) - // simply defer if not loaded yet - YT = YT || { - Player: function(){ - var args = arguments - setTimeout(function(){ - base.player = YT.loading ? YT.Player (args) : new YT.Player(args) - }, 300) - } - } - + this.defer(uid) + }, + + defer: function (uid){ + if (! YT || ! YT.loaded) { + setTimeout(function(){ + console.log("hwat") + this.defer(uid) + }.bind(this), 300) + } + else { + this.build(uid) + } + }, + + build: function(uid){ this.player = new YT.Player(uid, { videoId: this.media.token, width: this.width, @@ -120,5 +127,5 @@ MX.Youtube = MX.Object3D.extend({ }) window.onYouTubePlayerAPIReady = function(){ - // console.log("youtube ready") + console.log("youtube ready") } diff --git a/public/assets/javascripts/ui/_router.js b/public/assets/javascripts/ui/_router.js index fdeafd5..ce18b2a 100644 --- a/public/assets/javascripts/ui/_router.js +++ b/public/assets/javascripts/ui/_router.js @@ -35,7 +35,8 @@ var SiteRouter = Router.extend({ "/project": 'projectPicker', "/project/new": 'newProject', "/project/new/:layout": 'projectNewWithLayout', - "/project/:name": 'projectEditor', + "/project/:name": 'project', + "/project/:name/view": 'projectViewer', }, initialize: function(){ @@ -94,21 +95,31 @@ var SiteRouter = Router.extend({ this.editorView.loadLayout(layout) }, - projectEditor: function(e, name){ - app.mode.editor = true - app.launch() - + project: function(e, name){ if ($(".aboutRoom").length) { - this.readerView = new ReaderView() - this.readerView.load(name) + this.projectViewer(e, name) } else { - this.editorView = new EditorView() - this.editorView.load(name) + this.projectEditor(e, name) } }, + projectEditor: function(e, name){ + app.mode.editor = true + app.launch() + + this.editorView = new EditorView() + this.editorView.load(name) + }, + projectViewer: function(e, name){ + app.mode.editor = true + app.launch() + + this.readerView = new ReaderView() + this.readerView.load(name) + }, + /* editProject: function(e){ e && e.preventDefault() diff --git a/public/assets/javascripts/ui/editor/EditorToolbar.js b/public/assets/javascripts/ui/editor/EditorToolbar.js index 210ef6c..4a7c3e8 100644 --- a/public/assets/javascripts/ui/editor/EditorToolbar.js +++ b/public/assets/javascripts/ui/editor/EditorToolbar.js @@ -87,6 +87,7 @@ var EditorToolbar = View.extend({ var editor = new function(){ this.permissions = new Permissions({ + 'pick': false, 'move': true, 'resize': false, 'destroy': false, diff --git a/public/assets/javascripts/ui/reader/ReaderView.js b/public/assets/javascripts/ui/reader/ReaderView.js index 7cd629b..860cc04 100644 --- a/public/assets/javascripts/ui/reader/ReaderView.js +++ b/public/assets/javascripts/ui/reader/ReaderView.js @@ -11,6 +11,9 @@ var ReaderView = View.extend({ }, load: function(name){ + if (window.location.search.indexOf("noui") !== -1) { + $(".logo,.topLinks,#editorView").hide() + } name = sanitize(name) $.get(this.projectAction + name, $.proxy(this.ready, this)) }, |
