Auth bug fixed
This commit is contained in:
parent
f331533a29
commit
f92693d847
|
@ -10,7 +10,7 @@ _settings = null
|
||||||
|
|
||||||
$ ->
|
$ ->
|
||||||
l = document.location
|
l = document.location
|
||||||
if l.host not in ['beathaven.org', 'local.beathaven.org']
|
if l.host not in ['beathaven.org', 'dev.beathaven.org']
|
||||||
l.href = 'http://beathaven.org/'+ l.hash
|
l.href = 'http://beathaven.org/'+ l.hash
|
||||||
|
|
||||||
_beathaven = new BeatHaven()
|
_beathaven = new BeatHaven()
|
||||||
|
@ -18,6 +18,7 @@ $ ->
|
||||||
|
|
||||||
$(window).resize ->
|
$(window).resize ->
|
||||||
_beathaven.adjustSizes()
|
_beathaven.adjustSizes()
|
||||||
|
_beathaven.redrawScrollbar()
|
||||||
false
|
false
|
||||||
window.setTimeout ->
|
window.setTimeout ->
|
||||||
_beathaven.checkRedrawScrollbar()
|
_beathaven.checkRedrawScrollbar()
|
||||||
|
@ -65,9 +66,9 @@ class BeatHaven
|
||||||
if document.activeElement.id?
|
if document.activeElement.id?
|
||||||
focused_id = document.activeElement.id;
|
focused_id = document.activeElement.id;
|
||||||
outer_height = $('.data-container > div').outerHeight()
|
outer_height = $('.data-container > div').outerHeight()
|
||||||
if outer_height > 300 and outer_height != @last_height
|
if outer_height > 300 and outer_height != _beathaven.last_height
|
||||||
@last_height = outer_height
|
_beathaven.last_height = outer_height
|
||||||
this.redrawScrollbar()
|
_beathaven.redrawScrollbar()
|
||||||
if focused_id
|
if focused_id
|
||||||
document.getElementById(focused_id).focus()
|
document.getElementById(focused_id).focus()
|
||||||
focused_id = false
|
focused_id = false
|
||||||
|
@ -82,15 +83,17 @@ class BeatHaven
|
||||||
$('.data-container').scrollbar()
|
$('.data-container').scrollbar()
|
||||||
false
|
false
|
||||||
|
|
||||||
localizeHTML: (obj) ->
|
localizeHTML: (obj, lang) ->
|
||||||
unless obj?
|
unless obj?
|
||||||
obj = $('body')
|
obj = $('body')
|
||||||
|
unless lang?
|
||||||
|
lang = _beathaven.lang
|
||||||
$(obj).find('[data-ls]').each ->
|
$(obj).find('[data-ls]').each ->
|
||||||
if _locale[$(this).attr 'data-ls']? and _locale[$(this).attr 'data-ls'][_beathaven.lang]?
|
if _locale[$(this).attr 'data-ls']? and _locale[$(this).attr 'data-ls'][lang]?
|
||||||
if this.nodeName is 'INPUT'
|
if this.nodeName is 'INPUT'
|
||||||
$(this).val _locale[$(this).attr 'data-ls'][_beathaven.lang]
|
$(this).val _locale[$(this).attr 'data-ls'][lang]
|
||||||
else
|
else
|
||||||
$(this).text _locale[$(this).attr 'data-ls'][_beathaven.lang]
|
$(this).text _locale[$(this).attr 'data-ls'][lang]
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
ls: (id, lang) ->
|
ls: (id, lang) ->
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Session
|
||||||
|
|
||||||
setUser: (user) ->
|
setUser: (user) ->
|
||||||
@user = user
|
@user = user
|
||||||
_beathaven.lang = @user.lang
|
_beathaven.lang = @user.lang || 'ru'
|
||||||
_beathaven.localizeHTML()
|
_beathaven.localizeHTML()
|
||||||
false
|
false
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,14 @@ _settings = null;
|
||||||
$(function() {
|
$(function() {
|
||||||
var l, _ref;
|
var l, _ref;
|
||||||
l = document.location;
|
l = document.location;
|
||||||
if ((_ref = l.host) !== 'beathaven.org' && _ref !== 'local.beathaven.org') {
|
if ((_ref = l.host) !== 'beathaven.org' && _ref !== 'dev.beathaven.org') {
|
||||||
l.href = 'http://beathaven.org/' + l.hash;
|
l.href = 'http://beathaven.org/' + l.hash;
|
||||||
}
|
}
|
||||||
_beathaven = new BeatHaven();
|
_beathaven = new BeatHaven();
|
||||||
_beathaven.init();
|
_beathaven.init();
|
||||||
$(window).resize(function() {
|
$(window).resize(function() {
|
||||||
_beathaven.adjustSizes();
|
_beathaven.adjustSizes();
|
||||||
|
_beathaven.redrawScrollbar();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
return window.setTimeout(function() {
|
return window.setTimeout(function() {
|
||||||
|
@ -57,9 +58,9 @@ BeatHaven = (function() {
|
||||||
focused_id = document.activeElement.id;
|
focused_id = document.activeElement.id;
|
||||||
}
|
}
|
||||||
outer_height = $('.data-container > div').outerHeight();
|
outer_height = $('.data-container > div').outerHeight();
|
||||||
if (outer_height > 300 && outer_height !== this.last_height) {
|
if (outer_height > 300 && outer_height !== _beathaven.last_height) {
|
||||||
this.last_height = outer_height;
|
_beathaven.last_height = outer_height;
|
||||||
this.redrawScrollbar();
|
_beathaven.redrawScrollbar();
|
||||||
}
|
}
|
||||||
if (focused_id) {
|
if (focused_id) {
|
||||||
document.getElementById(focused_id).focus();
|
document.getElementById(focused_id).focus();
|
||||||
|
@ -76,16 +77,19 @@ BeatHaven = (function() {
|
||||||
$('.data-container').scrollbar();
|
$('.data-container').scrollbar();
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
BeatHaven.prototype.localizeHTML = function(obj) {
|
BeatHaven.prototype.localizeHTML = function(obj, lang) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
obj = $('body');
|
obj = $('body');
|
||||||
}
|
}
|
||||||
|
if (lang == null) {
|
||||||
|
lang = _beathaven.lang;
|
||||||
|
}
|
||||||
$(obj).find('[data-ls]').each(function() {
|
$(obj).find('[data-ls]').each(function() {
|
||||||
if ((_locale[$(this).attr('data-ls')] != null) && (_locale[$(this).attr('data-ls')][_beathaven.lang] != null)) {
|
if ((_locale[$(this).attr('data-ls')] != null) && (_locale[$(this).attr('data-ls')][lang] != null)) {
|
||||||
if (this.nodeName === 'INPUT') {
|
if (this.nodeName === 'INPUT') {
|
||||||
return $(this).val(_locale[$(this).attr('data-ls')][_beathaven.lang]);
|
return $(this).val(_locale[$(this).attr('data-ls')][lang]);
|
||||||
} else {
|
} else {
|
||||||
return $(this).text(_locale[$(this).attr('data-ls')][_beathaven.lang]);
|
return $(this).text(_locale[$(this).attr('data-ls')][lang]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@ Session = (function() {
|
||||||
}
|
}
|
||||||
Session.prototype.setUser = function(user) {
|
Session.prototype.setUser = function(user) {
|
||||||
this.user = user;
|
this.user = user;
|
||||||
_beathaven.lang = this.user.lang;
|
_beathaven.lang = this.user.lang || 'ru';
|
||||||
_beathaven.localizeHTML();
|
_beathaven.localizeHTML();
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue