summaryrefslogtreecommitdiff
path: root/public/assets/javascripts/ui
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2014-07-10 17:15:54 -0400
committerJules Laplace <jules@okfoc.us>2014-07-10 17:15:54 -0400
commitb19511eb75c6490ddc97ea59d82615ce4d9e0e91 (patch)
tree165e6230787db3ecf76058815eb226cb22ab3cc6 /public/assets/javascripts/ui
parent89d6385fe4eb58387d4ddca9d799d1b07ef727f0 (diff)
use view iframe on profile, spins on hover
Diffstat (limited to 'public/assets/javascripts/ui')
-rw-r--r--public/assets/javascripts/ui/_router.js7
-rw-r--r--public/assets/javascripts/ui/editor/EditorSettings.js2
-rw-r--r--public/assets/javascripts/ui/reader/ReaderView.js29
-rw-r--r--public/assets/javascripts/ui/site/ProfileView.js29
4 files changed, 61 insertions, 6 deletions
diff --git a/public/assets/javascripts/ui/_router.js b/public/assets/javascripts/ui/_router.js
index ce18b2a..b3e868a 100644
--- a/public/assets/javascripts/ui/_router.js
+++ b/public/assets/javascripts/ui/_router.js
@@ -49,6 +49,7 @@ var SiteRouter = Router.extend({
this.editProfileModal = new EditProfileModal()
this.passwordForgotModal = new PasswordForgot()
this.documentModal = new DocumentModal()
+ this.profileView = new ProfileView()
this.route()
@@ -155,11 +156,7 @@ var SiteRouter = Router.extend({
},
profile: function(e){
- var classes = ['one', 'two', 'three', 'four',
- 'five', 'six', 'seven', 'eight',
- 'nine', 'ten', 'eleven', 'twelve',
- 'thirteen'];
- $(".bio").addClass(choice(classes));
+ this.profileView.load()
},
editProfile: function(e){
diff --git a/public/assets/javascripts/ui/editor/EditorSettings.js b/public/assets/javascripts/ui/editor/EditorSettings.js
index 35bcbe0..1d68b1b 100644
--- a/public/assets/javascripts/ui/editor/EditorSettings.js
+++ b/public/assets/javascripts/ui/editor/EditorSettings.js
@@ -32,7 +32,7 @@ var EditorSettings = FormView.extend({
data.startPosition && scene.camera.move(data.startPosition)
if (! data.isNew) {
- console.log(data)
+ // console.log(data)
this.$id.val( data._id )
this.$name.val( data.name )
diff --git a/public/assets/javascripts/ui/reader/ReaderView.js b/public/assets/javascripts/ui/reader/ReaderView.js
index 860cc04..e86856c 100644
--- a/public/assets/javascripts/ui/reader/ReaderView.js
+++ b/public/assets/javascripts/ui/reader/ReaderView.js
@@ -26,6 +26,35 @@ var ReaderView = View.extend({
data.startPosition && scene.camera.move(data.startPosition)
editor.permissions.clear()
+
+ //
+
+ var base = this
+
+ $(window).on('message', function(event){
+ if (event.origin !== window.location.origin) {
+ return
+ }
+ var message = event.originalEvent.data
+ switch (message) {
+ case "spin-on":
+ base.spinning = true
+ break
+ case "spin-off":
+ base.spinning = false
+ break
+ }
+ })
+
+ requestAnimationFrame(this.spin.bind(this))
+ },
+
+ spinning: false,
+ spin: function(){
+ requestAnimationFrame(this.spin.bind(this))
+ if (this.spinning) {
+ scene.camera.rotationY -= 1/180
+ }
}
})
diff --git a/public/assets/javascripts/ui/site/ProfileView.js b/public/assets/javascripts/ui/site/ProfileView.js
new file mode 100644
index 0000000..41f04ef
--- /dev/null
+++ b/public/assets/javascripts/ui/site/ProfileView.js
@@ -0,0 +1,29 @@
+
+var ProfileView = View.extend({
+
+ initialize: function(){
+ },
+
+ load: function(){
+ var classes = ['one', 'two', 'three', 'four',
+ 'five', 'six', 'seven', 'eight',
+ 'nine', 'ten', 'eleven', 'twelve',
+ 'thirteen'];
+ $(".bio").addClass(choice(classes));
+
+ $("td.border").each(function(){
+ var iframe = $(this).find("iframe").get('0')
+ if (! iframe) return
+ console.log(iframe)
+ $(this).on({
+ mouseenter: function(e){
+ iframe.contentWindow.postMessage("spin-on", window.location.origin)
+ },
+ mouseleave: function(e){
+ iframe.contentWindow.postMessage("spin-off", window.location.origin)
+ }
+ })
+ })
+ }
+
+})