Alice
view release on metacpan or search on metacpan
share/static/alice.js view on Meta::CPAN
106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717
this.submit.observe(
"click"
, function (e) {
this.input.
send
(); e.stop()}.
bind
(this));
this.tabs.observe(
"webkitTransitionEnd"
, this.shiftEnd.
bind
(this));
this.tabs.observe(
"transitionend"
, this.shiftEnd.
bind
(this));
this.makeSortable();
this.setupTopic();
this.setupNicklist();
this.setupMenus();
},
getBacklog: function (win, max, limit) {
this.connection.requestChunk(win.id, limit, max);
},
fetchOembeds: function(cb) {
var req = new XMLHttpRequest();
req.onreadystatechange = function(){
share/static/alice.js view on Meta::CPAN
107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813
win.scrollToPosition(position);
});
},
actionHandlers: {
join
: function (action) {
var win = this.getWindow(action[
'window'
].id);
if
(!win) {
this.insertWindow(action[
'window'
].id, action.html);
win = this.openWindow(action[
'window'
]);
this.updateOverflowMenus();
if
(this.selectedSet && !this.currentSetContains(win)) {
if
(confirm(
"You joined "
+win.title+
" which is not in the '"
+this.selectedSet+
"' set. Do you want to add it?"
)) {
this.tabsets[this.selectedSet].
push
(win.id);
win.show();
Alice.tabsets.submit(this.tabsets);
}
else
{
win.hide();
}
}
share/static/alice.js view on Meta::CPAN
10935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965openWindow: function(serialized, msgid) {
if
(!msgid) msgid = this.msgid();
var win = new Alice.Window(this, serialized, msgid);
this.addWindow(win);
return
win;
},
addWindow: function(win) {
this.window_map.set(win.id, win);
if
(window.fluid)
window.fluid.addDockMenuItem(win.title, win.focus.
bind
(win));
},
removeWindow: function(win) {
this.tabs_layout = this.tabs.getLayout();
this.windows().invoke(
"updateTabLayout"
);
if
(win.active) this.focusLast();
if
(window.fluid)
window.fluid.removeDockMenuItem(win.title);
if
(win.id == this.previousFocus.id) {
this.previousFocus = 0;
}
this.window_map.unset(win.id);
this.connection.closeWindow(win);
win = null;
},
getWindow: function(windowId) {
return
this.window_map.get(windowId);
share/static/alice.js view on Meta::CPAN
110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028
if
(!nextTab)
return
;
var id = nextTab.id.replace(
'_tab'
,
''
);
if
(id != active.id) {
var win = this.getWindow(id);
win.focus();
return
win;
}
},
updateOverflowMenus: function() {
var left = $(
'tab_menu_left'
);
var right = $(
'tab_menu_right'
);
left.removeClassName(
"unread"
);
left.removeClassName(
"highlight"
);
right.removeClassName(
"unread"
);
right.removeClassName(
"highlight"
);
var left_menu = left.down(
'ul'
);
var right_menu = right.down(
'ul'
);
share/static/alice.js view on Meta::CPAN
11042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066
left_menu.innerHTML +=
sprintf
(
'<li rel="%s" class="%s"><span>%s</span></a>'
, win.id, classes.
join
(
" "
), win.title)
}
else
if
(
pos
.right) {
var classes = win.statuses;
classes.
each
(function(c){right.addClassName(c)});
right_menu.innerHTML +=
sprintf
(
'<li rel="%s" class="%s"><span>%s</span></a>'
, win.id, classes.
join
(
" "
), win.title)
}
}.
bind
(this));
this.toggleMenu(left, !!left_menu.innerHTML);
this.toggleMenu(right, !!right_menu.innerHTML);
},
toggleMenu: function(menu, active) {
if
(active) {
menu.addClassName(
"active"
);
}
else
{
menu.removeClassName(
"active"
);
}
},
nextUnreadWindow: function() {
var active = this.activeWindow();
share/static/alice.js view on Meta::CPAN
112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245
var left = current +
shift
;
var
time
= Math.min(Math.max(0.1, Math.
abs
(
shift
) / 100), 0.5);
this.tabs.style.webkitTransitionDuration =
time
+
"s"
;
this.tabs.setStyle({left: left+
"px"
});
this.tabs_layout = this.tabs.getLayout();
},
shiftEnd: function(e) {
this.tabs_layout = this.tabs.getLayout();
this.updateOverflowMenus();
},
makeSortable: function() {
Sortable.create(
'tabs'
, {
overlap:
'horizontal'
,
constraint:
'horizontal'
,
format
: /(.+)/,
only: [
"info_tab"
,
"channel_tab"
,
"privmsg_tab"
],
onUpdate: function (res) {
var tabs = res.childElements();
share/static/alice.js view on Meta::CPAN
112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283
window.fluid.dockBadge = 1;
},
clearMissed: function() {
if
(!window.fluid)
return
;
window.fluid.dockBadge =
""
;
},
ready: function() {
this.freeze();
setTimeout(this.updateOverflowMenus.
bind
(this), 1000);
this.fetchOembeds(function() {
this.connection.
connect
(function() {
this.focusHash() || this.activeWindow().focus();
}.
bind
(this));
}.
bind
(this));
},
log
: function () {
share/static/alice.js view on Meta::CPAN
1132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357
this.selectSet(name);
var active = this.activeWindow();
if
(!active.visible) {
active = this.nextWindow();
}
if
(active) active.shiftTab();
setTimeout(this.updateOverflowMenus.
bind
(this), 2000);
}
},
selectSet: function(name) {
var hash = window.location.hash;
hash = hash.replace(/^[^\/]*/, name);
window.location.hash = hash;
window.location = window.location.toString();
this.selectedSet = name;
},
clearSet: function(elem) {
elem.up(
'ul'
).
select
(
'li'
).invoke(
'removeClassName'
,
'selectedset'
);
elem.addClassName(
'selectedset'
);
this.windows().invoke(
"show"
);
this.selectSet(
''
);
this.updateOverflowMenus();
this.activeWindow().shiftTab();
},
currentSetContains: function(win) {
var set = this.selectedSet;
if
(win.type ==
"channel"
&& set && this.tabsets[set]) {
return
(this.tabsets[set].indexOf(win.id) >= 0);
}
return
true;
},
share/static/alice.js view on Meta::CPAN
114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420
this.topic.observe(this.supportsTouch ?
"touchstart"
:
"click"
, function(e) {
if
(this.supportsTouch) e.stop();
if
(this.topic.getStyle(
"height"
) == this.topic_height) {
this.topic.setStyle({height:
"auto"
});
}
else
{
this.topic.setStyle({height: this.topic_height});
}
}.
bind
(this));
},
setupMenus: function() {
var click = this.supportsTouch ?
"touchend"
:
"mouseup"
;
$(
'join_button'
).observe(click, function (e) {
e.stop();
this.toggleJoin();
}.
bind
(this));
$(
'config_menu'
).on(click,
".dropdown li"
, function(e,li) {
e.stop();
var text = li.textContent;
share/static/alice.js view on Meta::CPAN
131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162var windows = $(
'windows'
);
var toggle = $(
'nicklist_toggle'
);
var resize = function () {
var active = alice.activeWindow();
var position = active.captureScrollPosition();
var end = function(){
alice.freeze();
alice.tabs_width = $(
'tabs_container'
).getWidth();
alice.updateOverflowMenus();
active.scrollToPosition(position);
active.shiftTab();
window.onresize = resize;
};
var end_timer;
window.onresize = function() {
clearTimeout(end_timer);
end_timer = setTimeout(end, 1000);
share/static/alice.js view on Meta::CPAN
131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206
};
};
window.onmousemove = move;
window.onfocus = function () {
alice.input.focus();
alice.freeze();
alice.tabs_width = $(
'tabs_container'
).getWidth();
alice.updateOverflowMenus();
alice.isFocused = true
alice.clearMissed();
};
window.status =
" "
;
window.onblur = function () {
alice.isFocused = false
};
}
( run in 0.277 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )