fixing references

This commit is contained in:
Connor Turland 2016-09-22 21:40:49 -04:00
parent f59a5775ae
commit 499593fc82
2 changed files with 16 additions and 14 deletions

View file

@ -21,6 +21,9 @@ import Visualize from './Visualize'
*/ */
const _Router = Backbone.Router.extend({ const _Router = Backbone.Router.extend({
currentPage: '',
currentSection: '',
timeoutId: undefined,
routes: { routes: {
'': 'home', // #home '': 'home', // #home
'explore/:section': 'explore', // #explore/active 'explore/:section': 'explore', // #explore/active
@ -28,6 +31,7 @@ const _Router = Backbone.Router.extend({
'maps/:id': 'maps' // #maps/7 'maps/:id': 'maps' // #maps/7
}, },
home: function () { home: function () {
let self = this
clearTimeout(this.timeoutId) clearTimeout(this.timeoutId)
if (Active.Mapper) document.title = 'Explore Active Maps | Metamaps' if (Active.Mapper) document.title = 'Explore Active Maps | Metamaps'
@ -41,8 +45,8 @@ const _Router = Backbone.Router.extend({
$('.wrapper').addClass(classes) $('.wrapper').addClass(classes)
var navigate = function () { var navigate = function () {
this.timeoutId = setTimeout(function () { self.timeoutId = setTimeout(function () {
this.navigate('') self.navigate('')
}, 300) }, 300)
} }
@ -74,6 +78,7 @@ const _Router = Backbone.Router.extend({
Active.Topic = null Active.Topic = null
}, },
explore: function (section, id) { explore: function (section, id) {
var self = this
clearTimeout(this.timeoutId) clearTimeout(this.timeoutId)
// just capitalize the variable section // just capitalize the variable section
@ -115,17 +120,17 @@ const _Router = Backbone.Router.extend({
Views.ExploreMaps.setCollection(Metamaps.Maps[capitalize]) Views.ExploreMaps.setCollection(Metamaps.Maps[capitalize])
var navigate = function () { var navigate = function () {
var path = '/explore/' + this.currentPage var path = '/explore/' + self.currentPage
// alter url if for mapper profile page // alter url if for mapper profile page
if (this.currentPage === 'mapper') { if (self.currentPage === 'mapper') {
path += '/' + Metamaps.Maps.Mapper.mapperId path += '/' + Metamaps.Maps.Mapper.mapperId
} }
this.navigate(path) self.navigate(path)
} }
var navigateTimeout = function () { var navigateTimeout = function () {
this.timeoutId = setTimeout(navigate, 300) self.timeoutId = setTimeout(navigate, 300)
} }
if (Metamaps.Maps[capitalize].length === 0) { if (Metamaps.Maps[capitalize].length === 0) {
Metamaps.Loading.show() Metamaps.Loading.show()
@ -209,9 +214,6 @@ const _Router = Backbone.Router.extend({
}) })
const Router = new _Router() const Router = new _Router()
Router.currentPage = ''
Router.currentSection = undefined
Router.timeoutId = undefined
Router.intercept = function (evt) { Router.intercept = function (evt) {
var segments var segments

View file

@ -147,7 +147,7 @@ var Private = {
message: this.$messageInput.val(), message: this.$messageInput.val(),
}; };
this.$messageInput.val(''); this.$messageInput.val('');
$(document).trigger(chatView.events.message + '-' + this.room, [message]); $(document).trigger(ChatView.events.message + '-' + this.room, [message]);
}, },
addParticipant: function(participant) { addParticipant: function(participant) {
var p = _.clone(participant.attributes); var p = _.clone(participant.attributes);
@ -174,12 +174,12 @@ var Handlers = {
videoToggleClick: function() { videoToggleClick: function() {
this.$videoToggle.toggleClass('active'); this.$videoToggle.toggleClass('active');
this.videosShowing = !this.videosShowing; this.videosShowing = !this.videosShowing;
$(document).trigger(this.videosShowing ? chatView.events.videosOn : chatView.events.videosOff); $(document).trigger(this.videosShowing ? ChatView.events.videosOn : ChatView.events.videosOff);
}, },
cursorToggleClick: function() { cursorToggleClick: function() {
this.$cursorToggle.toggleClass('active'); this.$cursorToggle.toggleClass('active');
this.cursorsShowing = !this.cursorsShowing; this.cursorsShowing = !this.cursorsShowing;
$(document).trigger(this.cursorsShowing ? chatView.events.cursorsOn : chatView.events.cursorsOff); $(document).trigger(this.cursorsShowing ? ChatView.events.cursorsOn : ChatView.events.cursorsOff);
}, },
soundToggleClick: function() { soundToggleClick: function() {
this.alertSound = !this.alertSound; this.alertSound = !this.alertSound;
@ -193,10 +193,10 @@ var Handlers = {
} }
}, },
inputFocus: function() { inputFocus: function() {
$(document).trigger(chatView.events.inputFocus); $(document).trigger(ChatView.events.inputFocus);
}, },
inputBlur: function() { inputBlur: function() {
$(document).trigger(chatView.events.inputBlur); $(document).trigger(ChatView.events.inputBlur);
} }
}; };