Alice

 view release on metacpan or  search on metacpan

share/static/alice.js  view on Meta::CPAN

10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
  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.open("GET", "https://noembed.com/providers");
  req.onreadystatechange = function(){

share/static/alice.js  view on Meta::CPAN

10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
    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

10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
openWindow: 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

11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
  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

11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
      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

11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
  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

11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
                           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

11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
    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

11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
  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

13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
var 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

13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
    };
  };
 
  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 )