Commit b10cddb0 authored by 神楽坂玲奈's avatar 神楽坂玲奈

temp

parent 284f7cae
#window.oldSetInterval = window.setInterval;
#window.setInterval = (func, interval)->
# interval = oldSetInterval(func, interval);
# console.log "setInteval called", func, interval
#window.oldClearInterval = window.setInterval;
#window.ClearInterval = (func, interval)->
# interval = oldClearInterval(func, interval);
# console.log "clearInteval called", func, interval
class Server extends Spine.Model
@configure "Server", "name", "ip", "port", "index"
@extend Spine.Model.Ajax
......@@ -160,13 +170,13 @@ announcement_scroll = (obj)->
marginTop:"-25px"
,500,->
$(this).css({marginTop:"0px"}).find("li:first").appendTo(this)
announcement_scrolling = null
#console.log this
@announcement_scrolling = null
setRosterHeight = ->
pageHight = (document.documentElement.clientHeight)-430
$("#roster").height(pageHight)
$(document).ready ->
$(document).ready =>
if Candy.Util.getCookie('jid')
login()
after_login()
......@@ -256,24 +266,25 @@ $(document).ready ->
$('#logout_button').click ->
logout()
$('#announcements li').hover (e)->
if e.type == 'mouseenter'
clearInterval announcement_scrolling if announcement_scrolling
else
announcement_scrolling = setInterval(announcement_scroll, 5000) if !announcement_scrolling
announcement_scrolling = null
$('#announcements li').mouseover =>
console.log 'mouseover'
#clearInterval(@announcement_scrolling) if @announcement_scrolling
#@announcement_scrolling = null
$('#announcements li').mouseleave =>
#@announcement_scrolling = setInterval(announcement_scroll, 5000) if !@announcement_scrolling
setRosterHeight();
$(window).resize(setRosterHeight);
$.getJSON '/announcements.json', (data)->
$.getJSON '/announcements.json', (data)=>
for announcement in data
$('<li />').append($('<a />',
href: announcement.url
target: '_blank'
text: announcement.title
)).appendTo $('#announcements')
announcement_scrolling = setInterval(announcement_scroll, 5000) if !announcement_scrolling and data.length
@announcement_scrolling = setInterval(announcement_scroll, 5000) if !@announcement_scrolling and data.length
rooms = new Rooms(el: $('#rooms'))
servers = new Servers(el: $('#servers'))
......
// Generated by CoffeeScript 1.4.0
(function() {
var Room, Rooms, Server, Servers, announcement_scroll, announcement_scrolling, login, logout, setRosterHeight,
var Room, Rooms, Server, Servers, announcement_scroll, login, logout, setRosterHeight,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
_this = this;
Server = (function(_super) {
......@@ -268,7 +269,7 @@
});
};
announcement_scrolling = null;
this.announcement_scrolling = null;
setRosterHeight = function() {
var pageHight;
......@@ -374,18 +375,10 @@
$('#logout_button').click(function() {
return logout();
});
$('#announcements li').hover(function(e) {
if (e.type === 'mouseenter') {
if (announcement_scrolling) {
return clearInterval(announcement_scrolling);
}
} else {
if (!announcement_scrolling) {
announcement_scrolling = setInterval(announcement_scroll, 5000);
}
return announcement_scrolling = null;
}
$('#announcements li').mouseover(function() {
return console.log('mouseover');
});
$('#announcements li').mouseleave(function() {});
setRosterHeight();
$(window).resize(setRosterHeight);
$.getJSON('/announcements.json', function(data) {
......@@ -398,8 +391,8 @@
text: announcement.title
})).appendTo($('#announcements'));
}
if (!announcement_scrolling && data.length) {
return announcement_scrolling = setInterval(announcement_scroll, 5000);
if (!_this.announcement_scrolling && data.length) {
return _this.announcement_scrolling = setInterval(announcement_scroll, 5000);
}
});
rooms = new Rooms({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment