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 class Server extends Spine.Model
@configure "Server", "name", "ip", "port", "index" @configure "Server", "name", "ip", "port", "index"
@extend Spine.Model.Ajax @extend Spine.Model.Ajax
...@@ -160,13 +170,13 @@ announcement_scroll = (obj)-> ...@@ -160,13 +170,13 @@ announcement_scroll = (obj)->
marginTop:"-25px" marginTop:"-25px"
,500,-> ,500,->
$(this).css({marginTop:"0px"}).find("li:first").appendTo(this) $(this).css({marginTop:"0px"}).find("li:first").appendTo(this)
announcement_scrolling = null #console.log this
@announcement_scrolling = null
setRosterHeight = -> setRosterHeight = ->
pageHight = (document.documentElement.clientHeight)-430 pageHight = (document.documentElement.clientHeight)-430
$("#roster").height(pageHight) $("#roster").height(pageHight)
$(document).ready -> $(document).ready =>
if Candy.Util.getCookie('jid') if Candy.Util.getCookie('jid')
login() login()
after_login() after_login()
...@@ -256,24 +266,25 @@ $(document).ready -> ...@@ -256,24 +266,25 @@ $(document).ready ->
$('#logout_button').click -> $('#logout_button').click ->
logout() logout()
$('#announcements li').hover (e)-> $('#announcements li').mouseover =>
if e.type == 'mouseenter' console.log 'mouseover'
clearInterval announcement_scrolling if announcement_scrolling #clearInterval(@announcement_scrolling) if @announcement_scrolling
else #@announcement_scrolling = null
announcement_scrolling = setInterval(announcement_scroll, 5000) if !announcement_scrolling $('#announcements li').mouseleave =>
announcement_scrolling = null #@announcement_scrolling = setInterval(announcement_scroll, 5000) if !@announcement_scrolling
setRosterHeight(); setRosterHeight();
$(window).resize(setRosterHeight); $(window).resize(setRosterHeight);
$.getJSON '/announcements.json', (data)-> $.getJSON '/announcements.json', (data)=>
for announcement in data for announcement in data
$('<li />').append($('<a />', $('<li />').append($('<a />',
href: announcement.url href: announcement.url
target: '_blank' target: '_blank'
text: announcement.title text: announcement.title
)).appendTo $('#announcements') )).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')) rooms = new Rooms(el: $('#rooms'))
servers = new Servers(el: $('#servers')) servers = new Servers(el: $('#servers'))
......
// Generated by CoffeeScript 1.4.0 // Generated by CoffeeScript 1.4.0
(function() { (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, __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; }, __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) { Server = (function(_super) {
...@@ -268,7 +269,7 @@ ...@@ -268,7 +269,7 @@
}); });
}; };
announcement_scrolling = null; this.announcement_scrolling = null;
setRosterHeight = function() { setRosterHeight = function() {
var pageHight; var pageHight;
...@@ -374,18 +375,10 @@ ...@@ -374,18 +375,10 @@
$('#logout_button').click(function() { $('#logout_button').click(function() {
return logout(); return logout();
}); });
$('#announcements li').hover(function(e) { $('#announcements li').mouseover(function() {
if (e.type === 'mouseenter') { return console.log('mouseover');
if (announcement_scrolling) {
return clearInterval(announcement_scrolling);
}
} else {
if (!announcement_scrolling) {
announcement_scrolling = setInterval(announcement_scroll, 5000);
}
return announcement_scrolling = null;
}
}); });
$('#announcements li').mouseleave(function() {});
setRosterHeight(); setRosterHeight();
$(window).resize(setRosterHeight); $(window).resize(setRosterHeight);
$.getJSON('/announcements.json', function(data) { $.getJSON('/announcements.json', function(data) {
...@@ -398,8 +391,8 @@ ...@@ -398,8 +391,8 @@
text: announcement.title text: announcement.title
})).appendTo($('#announcements')); })).appendTo($('#announcements'));
} }
if (!announcement_scrolling && data.length) { if (!_this.announcement_scrolling && data.length) {
return announcement_scrolling = setInterval(announcement_scroll, 5000); return _this.announcement_scrolling = setInterval(announcement_scroll, 5000);
} }
}); });
rooms = new Rooms({ 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