summaryrefslogtreecommitdiff
path: root/public/assets
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets')
-rw-r--r--public/assets/javascripts/ui/_router.js26
-rw-r--r--public/assets/javascripts/ui/editor/ColorControl.js2
-rw-r--r--public/assets/javascripts/ui/reader/ReaderView.js1
-rw-r--r--public/assets/javascripts/ui/reader/ShareView.js27
-rw-r--r--public/assets/javascripts/ui/z_share.js25
5 files changed, 29 insertions, 52 deletions
diff --git a/public/assets/javascripts/ui/_router.js b/public/assets/javascripts/ui/_router.js
index c7b625a..0c95664 100644
--- a/public/assets/javascripts/ui/_router.js
+++ b/public/assets/javascripts/ui/_router.js
@@ -40,8 +40,6 @@ var SiteRouter = Router.extend({
"/project/:name": 'projectViewer',
"/project/:name/edit": 'projectEditor',
"/project/:name/view": 'projectViewer',
-
- "/test/wallpaper": 'testWallpaper',
},
mobileRoutes: {
@@ -213,29 +211,5 @@ var SiteRouter = Router.extend({
// this.documentModal.destroy(name)
},
- testWallpaper: function(e){
- var content = document.getElementById("content")
- content.style.width = "680px"
- content.style.margin = "0 auto"
- var wm = new WallpaperManager()
- app.on('wallpaper-ready', function(){
- var black = [0,0,0,0]
- var white = [255,255,255,1.0]
- var swatches = wm.buildSwatches(black, white, 4)
- document.body.style.backgroundColor = "#eee"
- swatches.forEach(function(swatch){
- swatch.style.margin = "4px"
- swatch.style.border = "1px solid lime"
- swatch.style.backgroundColor = "#888"
- content.appendChild(swatch)
- swatch.onclick = function(){
- dataUrl = swatch.toDataURL()
- document.body.style.backgroundImage = "url(" + dataUrl + ")"
- }
- })
- })
- wm.init()
- },
-
})
diff --git a/public/assets/javascripts/ui/editor/ColorControl.js b/public/assets/javascripts/ui/editor/ColorControl.js
index 72e9fb1..d1a8c7b 100644
--- a/public/assets/javascripts/ui/editor/ColorControl.js
+++ b/public/assets/javascripts/ui/editor/ColorControl.js
@@ -101,7 +101,7 @@ var ColorControl = View.extend({
initialState: null,
- begin: function(){
+ begin: function(){
this.initialState = this.serialize()
},
diff --git a/public/assets/javascripts/ui/reader/ReaderView.js b/public/assets/javascripts/ui/reader/ReaderView.js
index 8531244..4c53226 100644
--- a/public/assets/javascripts/ui/reader/ReaderView.js
+++ b/public/assets/javascripts/ui/reader/ReaderView.js
@@ -9,6 +9,7 @@ var ReaderView = View.extend({
initialize: function(){
this.mediaPlayer = new MediaPlayer ({ parent: this })
+ this.shareView = new shareView ({ parent: this })
},
load: function(name){
diff --git a/public/assets/javascripts/ui/reader/ShareView.js b/public/assets/javascripts/ui/reader/ShareView.js
new file mode 100644
index 0000000..ab358e3
--- /dev/null
+++ b/public/assets/javascripts/ui/reader/ShareView.js
@@ -0,0 +1,27 @@
+var ShareView = View.extend({
+ el: ".share",
+
+ events: {
+ "click #share_facebook": "facebook",
+ "click #share_twitter": "twitter",
+ }
+
+ initialize: function(opt){
+ this.parent = opt.parent
+ },
+
+ facebook: function (e) {
+ e.preventDefault()
+ var msg = $(".roomName").html() + " on VValls"
+ var url = "https://www.facebook.com/share.php?u=" + encodeURIComponent(window.location.origin + window.location.pathname) + "&t=" + encodeURIComponent(msg);
+ window.open(url, "_blank")
+ },
+
+ twitter: function (e) {
+ e.preventDefault()
+ var msg = $(".roomName").html() + " on VValls"
+ var url = "https://twitter.com/home?status=" + encodeURIComponent(window.location.origin + window.location.pathname + " " + msg);
+ window.open(url, "_blank")
+ }
+
+}
diff --git a/public/assets/javascripts/ui/z_share.js b/public/assets/javascripts/ui/z_share.js
deleted file mode 100644
index d31aa89..0000000
--- a/public/assets/javascripts/ui/z_share.js
+++ /dev/null
@@ -1,25 +0,0 @@
-var share = {
- init: function(){
- share.bind()
- },
- bind: function(){
- $("#facebook").click(share.facebook)
- $("#twitter").click(share.twitter)
- },
- url: "http://vvalls.com/",
- facebook_msg: "",
- twitter_msg: "",
- openLink: function (url) {
- window.open(url, "_blank");
- },
- facebook: function () {
- var url = "https://www.facebook.com/share.php?u=" + encodeURIComponent(share.url) + "&t=" + encodeURIComponent(share.facebook_msg);
- share.openLink(url);
- return false;
- },
- twitter: function () {
- var url = "https://twitter.com/home?status=" + encodeURIComponent(share.url + " " + share.twitter_msg);
- share.openLink(url);
- return false;
- }
-}