view release on metacpan or search on metacpan
share/static/alice-dark.css view on Meta::CPAN
div#tab_menu_right {
  position: absolute;
  right: 36px;
  bottom: 0px;
  border-left: 1px solid #222222; }
div#tab_menu_right ul {
  right: -1px;
  left: auto; }
.dropdown li.selectedset,
.dropdown li.unread {
  font-weight: bold; }
.tab_menu.active {
  background: url(image/sprites.png) 4px -275px no-repeat; }
#tab_menu_left.tab_menu.active {
  background: url(image/sprites.png) -29px -275px no-repeat; }
.tab_menu:hover,
share/static/alice-dark.css view on Meta::CPAN
div#input div.editor_toolbar button.colors:hover {
  background: none; }
div#input div.editor_toolbar button.colors {
  width: 14px;
  height: 14px;
  border: 2px solid white;
  margin: 4px;
  padding: 0; }
div#input div.editor_toolbar button.selected {
  color: white; }
.bold {
  font-weight: bold; }
.italic {
  font-style: italic; }
.underline {
  text-decoration: underline; }
share/static/alice-dark.css view on Meta::CPAN
div.config_body table table td {
  padding: 0 0 5px 0; }
div.config label, div.config input {
  display: block;
  font-size: 0.8em; }
div.config span {
  font-size: 0.8em; }
div.config select {
  width: 135px;
  font-size: 0.8em;
  outline: 0 none; }
div.config select[multiple] {
  height: 70px;
  background: black;
  color: white; }
div.config div.sidebar div.controls {
  position: absolute;
  bottom: 0px;
  left: 0px;
  right: 0px;
  padding: 5px 8px;
share/static/alice-default.css view on Meta::CPAN
div#tab_menu_right {
  position: absolute;
  right: 36px;
  bottom: 0px;
  border-left: 1px solid #999999; }
div#tab_menu_right ul {
  right: -1px;
  left: auto; }
.dropdown li.selectedset,
.dropdown li.unread {
  font-weight: bold; }
.tab_menu.active {
  background: url(image/sprites.png) 4px -275px no-repeat; }
#tab_menu_left.tab_menu.active {
  background: url(image/sprites.png) -29px -275px no-repeat; }
.tab_menu:hover,
share/static/alice-default.css view on Meta::CPAN
div#input div.editor_toolbar button.colors:hover {
  background: none; }
div#input div.editor_toolbar button.colors {
  width: 14px;
  height: 14px;
  border: 2px solid black;
  margin: 4px;
  padding: 0; }
div#input div.editor_toolbar button.selected {
  color: black; }
.bold {
  font-weight: bold; }
.italic {
  font-style: italic; }
.underline {
  text-decoration: underline; }
share/static/alice-default.css view on Meta::CPAN
div.config_body table table td {
  padding: 0 0 5px 0; }
div.config label, div.config input {
  display: block;
  font-size: 0.8em; }
div.config span {
  font-size: 0.8em; }
div.config select {
  width: 135px;
  font-size: 0.8em;
  outline: 0 none; }
div.config select[multiple] {
  height: 70px;
  background: white;
  color: black; }
div.config div.sidebar div.controls {
  position: absolute;
  bottom: 0px;
  left: 0px;
  right: 0px;
  padding: 5px 8px;
share/static/alice-solarized.css view on Meta::CPAN
@charset "UTF-8";
div.msg a {
  color: #cb4b16; }
div.msg a:hover {
  color: #B6461E; }
div.left span.nick, div#input button, #tabs li, #topic {
  -webkit-font-smoothing: antialiased; }
::selection {
  background: #FF5E99;
  color: #fff;
  text-shadow: none; }
input[type="hidden"] {
  display: none; }
body {
  margin: 0;
  padding: 0;
share/static/alice-solarized.css view on Meta::CPAN
div#tab_menu_right {
  position: absolute;
  right: 36px;
  bottom: 0px;
  border-left: 1px solid #44555a; }
div#tab_menu_right ul {
  right: -1px;
  left: auto; }
.dropdown li.selectedset,
.dropdown li.unread {
  font-weight: bold; }
.tab_menu.active {
  background: url(image/sprites.png) 4px -275px no-repeat; }
#tab_menu_left.tab_menu.active {
  background: url(image/sprites.png) -29px -275px no-repeat; }
.tab_menu:hover,
share/static/alice-solarized.css view on Meta::CPAN
div#input div.editor_toolbar button.colors:hover {
  background: none; }
div#input div.editor_toolbar button.colors {
  width: 14px;
  height: 14px;
  border: 2px solid #073642;
  margin: 4px;
  padding: 0; }
div#input div.editor_toolbar button.selected {
  color: #586e75; }
.bold {
  font-weight: bold; }
.italic {
  font-style: italic; }
.underline {
  text-decoration: underline; }
share/static/alice-solarized.css view on Meta::CPAN
div.config_body table table td {
  padding: 0 0 5px 0; }
div.config label, div.config input {
  display: block;
  font-size: 0.8em; }
div.config span {
  font-size: 0.8em; }
div.config select {
  width: 135px;
  font-size: 0.8em;
  outline: 0 none; }
div.config select[multiple] {
  height: 70px;
  background: #fdf6e3;
  color: #073642; }
div.config div.sidebar div.controls {
  position: absolute;
  bottom: 0px;
  left: 0px;
  right: 0px;
  padding: 5px 8px;
share/static/alice.js view on Meta::CPAN
    each:       each,
    eachSlice:  eachSlice,
    all:        all,
    every:      all,
    any:        any,
    some:       any,
    collect:    collect,
    map:        collect,
    detect:     detect,
    findAll:    findAll,
    select:     findAll,
    filter:     findAll,
    grep:       grep,
    include:    include,
    member:     include,
    inGroupsOf: inGroupsOf,
    inject:     inject,
    invoke:     invoke,
    max:        max,
    min:        min,
    partition:  partition,
share/static/alice.js view on Meta::CPAN
  function first() {
    return this[0];
  }
  function last() {
    return this[this.length - 1];
  }
  function compact() {
    return this.select(function(value) {
      return value != null;
    });
  }
  function flatten() {
    return this.inject([], function(array, value) {
      if (Object.isArray(value))
        return array.concat(value.flatten());
      array.push(value);
      return array;
    });
  }
  function without() {
    var values = slice.call(arguments, 0);
    return this.select(function(value) {
      return !values.include(value);
    });
  }
  function reverse(inline) {
    return (inline === false ? this.toArray() : this)._reverse();
  }
  function uniq(sorted) {
    return this.inject([], function(array, value, index) {
share/static/alice.js view on Meta::CPAN
    DOCUMENT_TYPE_NODE: 10,
    DOCUMENT_FRAGMENT_NODE: 11,
    NOTATION_NODE: 12
  });
}
(function(global) {
  function shouldUseCache(tagName, attributes) {
    if (tagName === 'select') return false;
    if ('type' in attributes) return false;
    return true;
  }
  var HAS_EXTENDED_CREATE_ELEMENT_SYNTAX = (function(){
    try {
      var el = document.createElement('<input name="x">');
      return el.tagName.toLowerCase() === 'input' && el.name === 'x';
    }
    catch(err) {
share/static/alice.js view on Meta::CPAN
  remove: function(element) {
    element = $(element);
    element.parentNode.removeChild(element);
    return element;
  },
  update: (function(){
    var SELECT_ELEMENT_INNERHTML_BUGGY = (function(){
      var el = document.createElement("select"),
          isBuggy = true;
      el.innerHTML = "<option value=\"test\">test</option>";
      if (el.options && el.options[0]) {
        isBuggy = el.options[0].nodeName.toUpperCase() !== "OPTION";
      }
      el = null;
      return isBuggy;
    })();
    var TABLE_ELEMENT_INNERHTML_BUGGY = (function(){
share/static/alice.js view on Meta::CPAN
    return update;
  })(),
  replace: function(element, content) {
    element = $(element);
    if (content && content.toElement) content = content.toElement();
    else if (!Object.isElement(content)) {
      content = Object.toHTML(content);
      var range = element.ownerDocument.createRange();
      range.selectNode(element);
      content.evalScripts.bind(content).defer();
      content = range.createContextualFragment(content.stripScripts());
    }
    element.parentNode.replaceChild(content, element);
    return element;
  },
  insert: function(element, insertions) {
    element = $(element);
share/static/alice.js view on Meta::CPAN
    }
    return elements;
  },
  ancestors: function(element) {
    return Element.recursivelyCollect(element, 'parentNode');
  },
  descendants: function(element) {
    return Element.select(element, "*");
  },
  firstDescendant: function(element) {
    element = $(element).firstChild;
    while (element && element.nodeType != 1) element = element.nextSibling;
    return $(element);
  },
  immediateDescendants: function(element) {
    var results = [], child = $(element).firstChild;
share/static/alice.js view on Meta::CPAN
  nextSiblings: function(element) {
    return Element.recursivelyCollect(element, 'nextSibling');
  },
  siblings: function(element) {
    element = $(element);
    return Element.previousSiblings(element).reverse()
      .concat(Element.nextSiblings(element));
  },
  match: function(element, selector) {
    element = $(element);
    if (Object.isString(selector))
      return Prototype.Selector.match(element, selector);
    return selector.match(element);
  },
  up: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return $(element.parentNode);
    var ancestors = Element.ancestors(element);
    return Object.isNumber(expression) ? ancestors[expression] :
      Prototype.Selector.find(ancestors, expression, index);
  },
  down: function(element, expression, index) {
    element = $(element);
    if (arguments.length == 1) return Element.firstDescendant(element);
    return Object.isNumber(expression) ? Element.descendants(element)[expression] :
      Element.select(element, expression)[index || 0];
  },
  previous: function(element, expression, index) {
    element = $(element);
    if (Object.isNumber(expression)) index = expression, expression = false;
    if (!Object.isNumber(index)) index = 0;
    if (expression) {
      return Prototype.Selector.find(element.previousSiblings(), expression, index);
    } else {
share/static/alice.js view on Meta::CPAN
    if (expression) {
      return Prototype.Selector.find(element.nextSiblings(), expression, index);
    } else {
      var maximumLength = Object.isNumber(index) ? index + 1 : 1;
      return element.recursivelyCollect("nextSibling", index + 1)[index];
    }
  },
  select: function(element) {
    element = $(element);
    var expressions = Array.prototype.slice.call(arguments, 1).join(', ');
    return Prototype.Selector.select(expressions, element);
  },
  adjacent: function(element) {
    element = $(element);
    var expressions = Array.prototype.slice.call(arguments, 1).join(', ');
    return Prototype.Selector.select(expressions, element.parentNode).without(element);
  },
  identify: function(element) {
    element = $(element);
    var id = Element.readAttribute(element, 'id');
    if (id) return id;
    do { id = 'anonymous_element_' + Element.idCounter++ } while ($(id));
    Element.writeAttribute(element, 'id', id);
    return id;
  },
share/static/alice.js view on Meta::CPAN
    if (options.setLeft)   element.style.left  = (p[0] - delta[0] + options.offsetLeft) + 'px';
    if (options.setTop)    element.style.top   = (p[1] - delta[1] + options.offsetTop) + 'px';
    if (options.setWidth)  element.style.width = source.offsetWidth + 'px';
    if (options.setHeight) element.style.height = source.offsetHeight + 'px';
    return element;
  }
};
Object.extend(Element.Methods, {
  getElementsBySelector: Element.Methods.select,
  childElements: Element.Methods.immediateDescendants
});
Element._attributeTranslations = {
  write: {
    names: {
      className: 'class',
      htmlFor:   'for'
    },
share/static/alice.js view on Meta::CPAN
      onmouseover: v._getEv,
      onmousemove: v._getEv,
      onmouseout:  v._getEv,
      onfocus:     v._getEv,
      onblur:      v._getEv,
      onkeypress:  v._getEv,
      onkeydown:   v._getEv,
      onkeyup:     v._getEv,
      onsubmit:    v._getEv,
      onreset:     v._getEv,
      onselect:    v._getEv,
      onchange:    v._getEv
    });
  })(Element._attributeTranslations.read.values);
  if (Prototype.BrowserFeatures.ElementExtensions) {
    (function() {
      function _descendants(element) {
        var nodes = element.getElementsByTagName('*'), results = [];
        for (var i = 0, node; node = nodes[i]; i++)
          if (node.tagName !== "!") // Filter out comment nodes.
            results.push(node);
        return results;
      }
      Element.Methods.down = function(element, expression, index) {
        element = $(element);
        if (arguments.length == 1) return element.firstDescendant();
        return Object.isNumber(expression) ? _descendants(element)[expression] :
          Element.select(element, expression)[index || 0];
      }
    })();
  }
}
else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
  Element.Methods.setOpacity = function(element, value) {
    element = $(element);
    element.style.opacity = (value == 1) ? 0.999999 :
share/static/alice.js view on Meta::CPAN
    element.appendChild(node);
  },
  after: function(element, node) {
    element.parentNode.insertBefore(node, element.nextSibling);
  },
  tags: {
    TABLE:  ['<table>',                '</table>',                   1],
    TBODY:  ['<table><tbody>',         '</tbody></table>',           2],
    TR:     ['<table><tbody><tr>',     '</tr></tbody></table>',      3],
    TD:     ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
    SELECT: ['<select>',               '</select>',                  1]
  }
};
(function() {
  var tags = Element._insertionTranslations.tags;
  Object.extend(tags, {
    THEAD: tags.TBODY,
    TFOOT: tags.TBODY,
    TH:    tags.TD
  });
share/static/alice.js view on Meta::CPAN
    }
    return value;
  },
  clone: function(element, deep) {
    if (!(element = $(element))) return;
    var clone = element.cloneNode(deep);
    clone._prototypeUID = void 0;
    if (deep) {
      var descendants = Element.select(clone, '*'),
          i = descendants.length;
      while (i--) {
        descendants[i]._prototypeUID = void 0;
      }
    }
    return Element.extend(clone);
  },
  purge: function(element) {
    if (!(element = $(element))) return;
share/static/alice.js view on Meta::CPAN
        var rect = element.getBoundingClientRect(),
         docEl = document.documentElement;
        return new Element.Offset(rect.left - docEl.clientLeft,
         rect.top - docEl.clientTop);
      }
    });
  }
})();
window.$$ = function() {
  var expression = $A(arguments).join(', ');
  return Prototype.Selector.select(expression, document);
};
Prototype.Selector = (function() {
  function select() {
    throw new Error('Method "Prototype.Selector.select" must be defined.');
  }
  function match() {
    throw new Error('Method "Prototype.Selector.match" must be defined.');
  }
  function find(elements, expression, index) {
    index = index || 0;
    var match = Prototype.Selector.match, length = elements.length, matchIndex = 0, i;
share/static/alice.js view on Meta::CPAN
    for (var i = 0, length = elements.length; i < length; i++) {
      Element.extend(elements[i]);
    }
    return elements;
  }
  var K = Prototype.K;
  return {
    select: select,
    match: match,
    find: find,
    extendElements: (Element.extend === K) ? K : extendElements,
    extendElement: Element.extend
  };
})();
/*!
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
share/static/alice.js view on Meta::CPAN
	done = 0,
	toString = Object.prototype.toString,
	hasDuplicate = false,
	baseHasDuplicate = true;
[0, 0].sort(function(){
	baseHasDuplicate = false;
	return 0;
});
var Sizzle = function(selector, context, results, seed) {
	results = results || [];
	var origContext = context = context || document;
	if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
		return [];
	}
	if ( !selector || typeof selector !== "string" ) {
		return results;
	}
	var parts = [], m, set, checkSet, check, mode, extra, prune = true, contextXML = isXML(context),
		soFar = selector;
	while ( (chunker.exec(""), m = chunker.exec(soFar)) !== null ) {
		soFar = m[3];
		parts.push( m[1] );
		if ( m[2] ) {
			extra = m[3];
			break;
		}
	}
	if ( parts.length > 1 && origPOS.exec( selector ) ) {
		if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
			set = posProcess( parts[0] + parts[1], context );
		} else {
			set = Expr.relative[ parts[0] ] ?
				[ context ] :
				Sizzle( parts.shift(), context );
			while ( parts.length ) {
				selector = parts.shift();
				if ( Expr.relative[ selector ] )
					selector += parts.shift();
				set = posProcess( selector, set );
			}
		}
	} else {
		if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
				Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
			var ret = Sizzle.find( parts.shift(), context, contextXML );
			context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
		}
		if ( context ) {
share/static/alice.js view on Meta::CPAN
		} else {
			checkSet = parts = [];
		}
	}
	if ( !checkSet ) {
		checkSet = set;
	}
	if ( !checkSet ) {
		throw "Syntax error, unrecognized expression: " + (cur || selector);
	}
	if ( toString.call(checkSet) === "[object Array]" ) {
		if ( !prune ) {
			results.push.apply( results, checkSet );
		} else if ( context && context.nodeType === 1 ) {
			for ( var i = 0; checkSet[i] != null; i++ ) {
				if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && contains(context, checkSet[i])) ) {
					results.push( set[i] );
				}
share/static/alice.js view on Meta::CPAN
				break;
			}
		}
		old = expr;
	}
	return curLoop;
};
var Expr = Sizzle.selectors = {
	order: [ "ID", "NAME", "TAG" ],
	match: {
		ID: /#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
		CLASS: /\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,
		NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,
		ATTR: /\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,
		TAG: /^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,
		CHILD: /:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,
		POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,
		PSEUDO: /:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/
share/static/alice.js view on Meta::CPAN
	filters: {
		enabled: function(elem){
			return elem.disabled === false && elem.type !== "hidden";
		},
		disabled: function(elem){
			return elem.disabled === true;
		},
		checked: function(elem){
			return elem.checked === true;
		},
		selected: function(elem){
			elem.parentNode.selectedIndex;
			return elem.selected === true;
		},
		parent: function(elem){
			return !!elem.firstChild;
		},
		empty: function(elem){
			return !elem.firstChild;
		},
		has: function(elem, i, match){
			return !!Sizzle( match[3], elem ).length;
		},
share/static/alice.js view on Meta::CPAN
		image: function(elem){
			return "image" === elem.type;
		},
		reset: function(elem){
			return "reset" === elem.type;
		},
		button: function(elem){
			return "button" === elem.type || elem.nodeName.toUpperCase() === "BUTTON";
		},
		input: function(elem){
			return /input|select|textarea|button/i.test(elem.nodeName);
		}
	},
	setFilters: {
		first: function(elem, i){
			return i === 0;
		},
		last: function(elem, i, match, array){
			return i === array.length - 1;
		},
		even: function(elem, i){
share/static/alice.js view on Meta::CPAN
	return a.compareDocumentPosition(b) & 16;
} : function(a, b){
	return a !== b && (a.contains ? a.contains(b) : true);
};
var isXML = function(elem){
	return elem.nodeType === 9 && elem.documentElement.nodeName !== "HTML" ||
		!!elem.ownerDocument && elem.ownerDocument.documentElement.nodeName !== "HTML";
};
var posProcess = function(selector, context){
	var tmpSet = [], later = "", match,
		root = context.nodeType ? [context] : context;
	while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
		later += match[0];
		selector = selector.replace( Expr.match.PSEUDO, "" );
	}
	selector = Expr.relative[selector] ? selector + "*" : selector;
	for ( var i = 0, l = root.length; i < l; i++ ) {
		Sizzle( selector, root[i], tmpSet );
	}
	return Sizzle.filter( later, tmpSet );
};
window.Sizzle = Sizzle;
})();
Prototype._original_property = window.Sizzle;
;(function(engine) {
  var extendElements = Prototype.Selector.extendElements;
  function select(selector, scope) {
    return extendElements(engine(selector, scope || document));
  }
  function match(element, selector) {
    return engine.matches(selector, [element]).length == 1;
  }
  Prototype.Selector.engine = engine;
  Prototype.Selector.select = select;
  Prototype.Selector.match = match;
})(Sizzle);
window.Sizzle = Prototype._original_property;
delete Prototype._original_property;
var Form = {
  reset: function(form) {
    form = $(form);
    form.reset();
share/static/alice.js view on Meta::CPAN
  findFirstElement: function(form) {
    var elements = $(form).getElements().findAll(function(element) {
      return 'hidden' != element.type && !element.disabled;
    });
    var firstByIndex = elements.findAll(function(element) {
      return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
    }).sortBy(function(element) { return element.tabIndex }).first();
    return firstByIndex ? firstByIndex : elements.find(function(element) {
      return /^(?:input|select|textarea)$/i.test(element.tagName);
    });
  },
  focusFirstElement: function(form) {
    form = $(form);
    var element = form.findFirstElement();
    if (element) element.activate();
    return form;
  },
share/static/alice.js view on Meta::CPAN
/*--------------------------------------------------------------------------*/
Form.Element = {
  focus: function(element) {
    $(element).focus();
    return element;
  },
  select: function(element) {
    $(element).select();
    return element;
  }
};
Form.Element.Methods = {
  serialize: function(element) {
    element = $(element);
    if (!element.disabled && element.name) {
      var value = element.getValue();
share/static/alice.js view on Meta::CPAN
  },
  present: function(element) {
    return $(element).value != '';
  },
  activate: function(element) {
    element = $(element);
    try {
      element.focus();
      if (element.select && (element.tagName.toLowerCase() != 'input' ||
          !(/^(?:button|reset|submit)$/i.test(element.type))))
        element.select();
    } catch (e) { }
    return element;
  },
  disable: function(element) {
    element = $(element);
    element.disabled = true;
    return element;
  },
share/static/alice.js view on Meta::CPAN
    if (Object.isUndefined(value))
      return element.checked ? element.value : null;
    else element.checked = !!value;
  }
  function valueSelector(element, value) {
    if (Object.isUndefined(value)) return element.value;
    else element.value = value;
  }
  function select(element, value) {
    if (Object.isUndefined(value))
      return (element.type === 'select-one' ? selectOne : selectMany)(element);
    var opt, currentValue, single = !Object.isArray(value);
    for (var i = 0, length = element.length; i < length; i++) {
      opt = element.options[i];
      currentValue = this.optionValue(opt);
      if (single) {
        if (currentValue == value) {
          opt.selected = true;
          return;
        }
      }
      else opt.selected = value.include(currentValue);
    }
  }
  function selectOne(element) {
    var index = element.selectedIndex;
    return index >= 0 ? optionValue(element.options[index]) : null;
  }
  function selectMany(element) {
    var values, length = element.length;
    if (!length) return null;
    for (var i = 0, values = []; i < length; i++) {
      var opt = element.options[i];
      if (opt.selected) values.push(optionValue(opt));
    }
    return values;
  }
  function optionValue(opt) {
    return Element.hasAttribute(opt, 'value') ? opt.value : opt.text;
  }
  return {
    input:         input,
    inputSelector: inputSelector,
    textarea:      valueSelector,
    select:        select,
    selectOne:     selectOne,
    selectMany:    selectMany,
    optionValue:   optionValue,
    button:        valueSelector
  };
})();
/*--------------------------------------------------------------------------*/
Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
  initialize: function($super, element, frequency, callback) {
share/static/alice.js view on Meta::CPAN
    if (document.createEvent)
      element.dispatchEvent(event);
    else
      element.fireEvent(event.eventType, event);
    return Event.extend(event);
  }
  Event.Handler = Class.create({
    initialize: function(element, eventName, selector, callback) {
      this.element   = $(element);
      this.eventName = eventName;
      this.selector  = selector;
      this.callback  = callback;
      this.handler   = this.handleEvent.bind(this);
    },
    start: function() {
      Event.observe(this.element, this.eventName, this.handler);
      return this;
    },
    stop: function() {
      Event.stopObserving(this.element, this.eventName, this.handler);
      return this;
    },
    handleEvent: function(event) {
      var element = Event.findElement(event, this.selector);
      if (element) this.callback.call(this.element, event, element);
    }
  });
  function on(element, eventName, selector, callback) {
    element = $(element);
    if (Object.isFunction(selector) && Object.isUndefined(callback)) {
      callback = selector, selector = null;
    }
    return new Event.Handler(element, eventName, selector, callback).start();
  }
  Object.extend(Event, Event.Methods);
  Object.extend(Event, {
    fire:          fire,
    observe:       observe,
    stopObserving: stopObserving,
    on:            on
  });
share/static/alice.js view on Meta::CPAN
/*--------------------------------------------------------------------------*/
Element.ClassNames = Class.create();
Element.ClassNames.prototype = {
  initialize: function(element) {
    this.element = $(element);
  },
  _each: function(iterator) {
    this.element.className.split(/\s+/).select(function(name) {
      return name.length > 0;
    })._each(iterator);
  },
  set: function(className) {
    this.element.className = className;
  },
  add: function(classNameToAdd) {
    if (this.include(classNameToAdd)) return;
share/static/alice.js view on Meta::CPAN
/*--------------------------------------------------------------------------*/
(function() {
  window.Selector = Class.create({
    initialize: function(expression) {
      this.expression = expression.strip();
    },
    findElements: function(rootElement) {
      return Prototype.Selector.select(this.expression, rootElement);
    },
    match: function(element) {
      return Prototype.Selector.match(element, this.expression);
    },
    toString: function() {
      return this.expression;
    },
share/static/alice.js view on Meta::CPAN
      var matchIndex = 0, element;
      for (var i = 0, length = elements.length; i < length; i++) {
        element = elements[i];
        if (Prototype.Selector.match(element, expression) && index === matchIndex++) {
          return Element.extend(element);
        }
      }
    },
    findChildElements: function(element, expressions) {
      var selector = expressions.toArray().join(', ');
      return Prototype.Selector.select(selector, element || document);
    }
  });
})();
String.prototype.parseColor = function() {
  var color = '#';
  if (this.slice(0,4) == 'rgb(') {
    var cols = this.slice(4,this.length-1).split(',');
    var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
  } else {
share/static/alice.js view on Meta::CPAN
  notify: function(eventName, draggable, event) {  // 'onStart', 'onEnd', 'onDrag'
    if(this[eventName+'Count'] > 0)
      this.observers.each( function(o) {
        if(o[eventName]) o[eventName](eventName, draggable, event);
      });
    if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
  },
  _cacheObserverCallbacks: function() {
    ['onStart','onEnd','onDrag'].each( function(eventName) {
      Draggables[eventName+'Count'] = Draggables.observers.select(
        function(o) { return o[eventName]; }
      ).length;
    });
  }
};
/*--------------------------------------------------------------------------*/
var Draggable = Class.create({
  initialize: function(element) {
share/static/alice.js view on Meta::CPAN
    options.draggables = [];
    options.droppables = [];
    if(options.dropOnEmpty || options.tree) {
      Droppables.add(element, options_for_tree);
      options.droppables.push(element);
    }
    (options.elements || this.findElements(element, options) || []).each( function(e,i) {
      var handle = options.handles ? $(options.handles[i]) :
        (options.handle ? $(e).select('.' + options.handle)[0] : e);
      options.draggables.push(
        new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
      Droppables.add(e, options_for_droppable);
      if(options.tree) e.treeNode = element;
      options.droppables.push(e);
    });
    if(options.tree) {
      (Sortable.findTreeElements(element, options) || []).each( function(e) {
        Droppables.add(e, options_for_tree);
share/static/alice.js view on Meta::CPAN
      },
      setStartAfter: function(refNode) {
        this.setStart(refNode.parentNode, findChildPosition(refNode) + 1);
      },
      setEndBefore: function(refNode) {
        this.setEnd(refNode.parentNode, findChildPosition(refNode));
      },
      setEndAfter: function(refNode) {
        this.setEnd(refNode.parentNode, findChildPosition(refNode) + 1);
      },
      selectNode: function(refNode) {
        this.setStartBefore(refNode);
        this.setEndAfter(refNode);
      },
      selectNodeContents: function(refNode) {
        this.setStart(refNode, 0);
        this.setEnd(refNode, DOMUtils.getNodeLength(refNode));
      },
      collapse: function(toStart) {
        if (toStart)
          this.setEnd(this.startContainer, this.startOffset);
        else
          this.setStart(this.endContainer, this.endOffset);
      },
share/static/alice.js view on Meta::CPAN
          } else {
            this.startContainer.appendChild(newNode);
          }
        }
        this.setStart(this.startContainer, this.startOffset);
      },
      surroundContents: function(newNode) {
        var content = this.extractContents();
        this.insertNode(newNode);
        newNode.appendChild(content);
        this.selectNode(newNode);
      },
      compareBoundaryPoints: function(how, sourceRange) {
        var containerA, offsetA, containerB, offsetB;
        switch (how) {
            case Range.START_TO_START:
            case Range.START_TO_END:
          containerA = this.startContainer;
          offsetA = this.startOffset;
          break;
share/static/alice.js view on Meta::CPAN
        } else
          this._current.parentNode.removeChild(this._current);
      },
      hasPartialSubtree: function() {
        return !DOMUtils.isDataNode(this._current) &&
            (DOMUtils.isAncestorOrSelf(this._current, this.range.startContainer) ||
                DOMUtils.isAncestorOrSelf(this._current, this.range.endContainer));
      },
      getSubtreeIterator: function() {
        var subRange = new Range(this.range._document);
        subRange.selectNodeContents(this._current);
        if (DOMUtils.isAncestorOrSelf(this._current, this.range.startContainer))
          subRange.setStart(this.range.startContainer, this.range.startOffset);
        if (DOMUtils.isAncestorOrSelf(this._current, this.range.endContainer))
          subRange.setEnd(this.range.endContainer, this.range.endOffset);
        return new RangeIterator(subRange);
      }
    };
    return Range;
  })();
share/static/alice.js view on Meta::CPAN
  }
  document.createRange = function() {
    return new Range(document);
  };
  window.Selection = (function() {
    function Selection(document) {
      this._document = document;
      var selection = this;
      document.attachEvent('onselectionchange', function() {
        selection._selectionChangeHandler();
      });
    }
    Selection.prototype = {
      rangeCount: 0,
      _document: null,
      _selectionChangeHandler: function() {
        this.rangeCount = this._selectionExists(this._document.selection.createRange()) ? 1 : 0;
      },
      _selectionExists: function(textRange) {
        return textRange.compareEndPoints('StartToEnd', textRange) != 0 ||
            textRange.parentElement().isContentEditable;
      },
      addRange: function(range) {
        var selection = this._document.selection.createRange(), textRange = range._toTextRange();
        if (!this._selectionExists(selection)) {
          textRange.select();
        } else {
          if (textRange.compareEndPoints('StartToStart', selection) == -1)
            if (textRange.compareEndPoints('StartToEnd', selection) > -1 &&
                textRange.compareEndPoints('EndToEnd', selection) == -1)
              selection.setEndPoint('StartToStart', textRange);
          else
            if (textRange.compareEndPoints('EndToStart', selection) < 1 &&
                textRange.compareEndPoints('EndToEnd', selection) > -1)
              selection.setEndPoint('EndToEnd', textRange);
          selection.select();
        }
      },
      removeAllRanges: function() {
        this._document.selection.empty();
      },
      getRangeAt: function(index) {
        var textRange = this._document.selection.createRange();
        if (this._selectionExists(textRange))
          return Range._fromTextRange(textRange, this._document);
        return null;
      },
      toString: function() {
        return this._document.selection.createRange().text;
      }
    };
    return Selection;
  })();
  window.getSelection = (function() {
    var selection = new Selection(document);
    return function() { return selection; };
  })();
}
Object.extend(Range.prototype, (function() {
  function beforeRange(range) {
    if (!range || !range.compareBoundaryPoints) return false;
    return (this.compareBoundaryPoints(this.START_TO_START, range) == -1 &&
      this.compareBoundaryPoints(this.START_TO_END, range) == -1 &&
      this.compareBoundaryPoints(this.END_TO_END, range) == -1 &&
      this.compareBoundaryPoints(this.END_TO_START, range) == -1);
share/static/alice.js view on Meta::CPAN
  }
  function getNode() {
    var parent = this.commonAncestorContainer;
    while (parent.nodeType == Node.TEXT_NODE)
      parent = parent.parentNode;
    var child = parent.childElements().detect(function(child) {
      var range = document.createRange();
      range.selectNodeContents(child);
      return this.betweenRange(range);
    }.bind(this));
    return $(child || parent);
  }
  return {
    beforeRange:  beforeRange,
    afterRange:   afterRange,
    betweenRange: betweenRange,
    equalRange:   equalRange,
    getNode:      getNode
  };
})());
if (Prototype.Browser.IE) {
  Object.extend(Selection.prototype, (function() {
    function getNode() {
      var range = this._document.selection.createRange();
      return $(range.parentElement());
    }
    function selectNode(element) {
      var range = this._document.body.createTextRange();
      range.moveToElementText(element);
      range.select();
    }
    return {
      getNode:    getNode,
      selectNode: selectNode
    }
  })());
} else {
  if (typeof Selection == 'undefined') {
    var Selection = {}
    Selection.prototype = window.getSelection().__proto__;
  }
  Object.extend(Selection.prototype, (function() {
    function getNode() {
      if (this.rangeCount > 0)
        return this.getRangeAt(0).getNode();
      else
        return null;
    }
    function selectNode(element) {
      var range = document.createRange();
      range.selectNode(element);
      this.removeAllRanges();
      this.addRange(range);
    }
    return {
      getNode:    getNode,
      selectNode: selectNode
    }
  })());
}
document.on("dom:loaded", function() {
  function fieldChangeHandler(event, element) {
    var value;
    if (element.contentEditable == 'true')
      value = element.innerHTML;
    else if (element.getValue)
share/static/alice.js view on Meta::CPAN
  function italicSelected() {
    return this.queryCommandState('italic');
  }
  function strikethroughSelection() {
    this.execCommand('strikethrough', false, null);
  }
  function indentSelection() {
    if (Prototype.Browser.Gecko) {
      var selection, range, node, blockquote;
      selection = window.getSelection();
      range     = selection.getRangeAt(0);
      node      = selection.getNode();
      if (range.collapsed) {
        range = document.createRange();
        range.selectNodeContents(node);
        selection.removeAllRanges();
        selection.addRange(range);
      }
      blockquote = new Element('blockquote');
      range = selection.getRangeAt(0);
      range.surroundContents(blockquote);
    } else {
      this.execCommand('indent', false, null);
    }
  }
  function outdentSelection() {
    this.execCommand('outdent', false, null);
  }
share/static/alice.js view on Meta::CPAN
    return Element.getStyle(node, 'textAlign');
  }
  function linkSelection(url) {
    this.execCommand('createLink', false, url);
  }
  function unlinkSelection() {
    var node = window.getSelection().getNode();
    if (this.linkSelected())
      window.getSelection().selectNode(node);
    this.execCommand('unlink', false, null);
  }
  function linkSelected() {
    var node = window.getSelection().getNode();
    return node ? node.tagName.toUpperCase() == 'A' : false;
  }
  function formatblockSelection(element){
    this.execCommand('formatblock', false, element);
  }
  function toggleOrderedList() {
    var selection, node;
    selection = window.getSelection();
    node      = selection.getNode();
    if (this.orderedListSelected() && !node.match("ol li:last-child, ol li:last-child *")) {
      selection.selectNode(node.up("ol"));
    } else if (this.unorderedListSelected()) {
      selection.selectNode(node.up("ul"));
    }
    this.execCommand('insertorderedlist', false, null);
  }
  function insertOrderedList() {
    this.toggleOrderedList();
  }
  function orderedListSelected() {
    var element = window.getSelection().getNode();
    if (element) return element.match('*[contenteditable=""] ol, *[contenteditable=true] ol, *[contenteditable=""] ol *, *[contenteditable=true] ol *');
    return false;
  }
  function toggleUnorderedList() {
    var selection, node;
    selection = window.getSelection();
    node      = selection.getNode();
    if (this.unorderedListSelected() && !node.match("ul li:last-child, ul li:last-child *")) {
      selection.selectNode(node.up("ul"));
    } else if (this.orderedListSelected()) {
      selection.selectNode(node.up("ol"));
    }
    this.execCommand('insertunorderedlist', false, null);
  }
  function insertUnorderedList() {
    this.toggleUnorderedList();
  }
  function unorderedListSelected() {
share/static/alice.js view on Meta::CPAN
    if (element) return element.match('*[contenteditable=""] ul, *[contenteditable=true] ul, *[contenteditable=""] ul *, *[contenteditable=true] ul *');
    return false;
  }
  function insertImage(url) {
    this.execCommand('insertImage', false, url);
  }
  function insertHTML(html) {
    if (Prototype.Browser.IE) {
      var range = window.document.selection.createRange();
      range.pasteHTML(html);
      range.collapse(false);
      range.select();
    } else {
      this.execCommand('insertHTML', false, html);
    }
  }
  function execCommand(command, ui, value) {
    var handler = this.commands.get(command);
    if (handler) {
      handler.bind(this)(value);
    } else {
share/static/alice.js view on Meta::CPAN
      try {
        return window.document.queryCommandState(state);
      } catch(e) { return null; }
    }
  }
  function getSelectedStyles() {
    var styles = $H({});
    var editor = this;
    editor.styleSelectors.each(function(style){
      var node = editor.selection.getNode();
      styles.set(style.first(), Element.getStyle(node, style.last()));
    });
    return styles;
  }
  return {
     boldSelection:            boldSelection,
     boldSelected:             boldSelected,
     underlineSelection:       underlineSelection,
     underlineSelected:        underlineSelected,
share/static/alice.js view on Meta::CPAN
if (Prototype.Browser.IE) {
  Object.extend(Selection.prototype, (function() {
    function setBookmark() {
      var bookmark = $('bookmark');
      if (bookmark) bookmark.remove();
      bookmark = new Element('span', { 'id': 'bookmark' }).update(" ");
      var parent = new Element('div');
      parent.appendChild(bookmark);
      var range = this._document.selection.createRange();
      range.collapse();
      range.pasteHTML(parent.innerHTML);
    }
    function moveToBookmark() {
      var bookmark = $('bookmark');
      if (!bookmark) return;
      var range = this._document.selection.createRange();
      range.moveToElementText(bookmark);
      range.collapse();
      range.select();
      bookmark.remove();
    }
    return {
      setBookmark:    setBookmark,
      moveToBookmark: moveToBookmark
    }
  })());
} else {
share/static/alice.js view on Meta::CPAN
  Element.addMethods({
    sanitizeContents: function(element, options) {
      element = $(element);
      var tagsToRemove = {};
      (options.remove || "").split(",").each(function(tagName) {
        tagsToRemove[tagName.strip()] = true;
      });
      var tagsToAllow = {};
      (options.allow || "").split(",").each(function(selector) {
        var parts = selector.strip().split(/[\[\]]/);
        var tagName = parts[0], allowedAttributes = parts.slice(1).grep(/./);
        tagsToAllow[tagName] = allowedAttributes;
      });
      var tagsToSkip = options.skip;
      withEachChildNodeOf(element, function(childNode) {
        sanitizeNode(childNode, tagsToRemove, tagsToAllow, tagsToSkip);
      });
share/static/alice.js view on Meta::CPAN
    element.on('frame:loaded', callback);
    element.observeFrameContentLoaded();
  }
  Element.addMethods({
    observeFrameContentLoaded: observeFrameContentLoaded,
    onFrameLoaded: onFrameLoaded
  });
})();
document.on("dom:loaded", function() {
  if ('selection' in document && 'onselectionchange' in document) {
    var selectionChangeHandler = function() {
      var range   = document.selection.createRange();
      var element = range.parentElement();
      $(element).fire("selection:change");
    }
    document.on("selectionchange", selectionChangeHandler);
  } else {
    var previousRange;
    var selectionChangeHandler = function() {
      var element        = document.activeElement;
      var elementTagName = element.tagName.toLowerCase();
      if (elementTagName == "textarea" || elementTagName == "input") {
        previousRange = null;
        $(element).fire("selection:change");
      } else {
        var selection = window.getSelection();
        if (selection.rangeCount < 1) return;
        var range = selection.getRangeAt(0);
        if (range && range.equalRange(previousRange)) return;
        previousRange = range;
        element = range.commonAncestorContainer;
        while (element.nodeType == Node.TEXT_NODE)
          element = element.parentNode;
        $(element).fire("selection:change");
      }
    };
    document.on("mouseup", selectionChangeHandler);
    document.on("keyup", selectionChangeHandler);
  }
});
WysiHat.Formatting = (function() {
  var ACCUMULATING_LINE      = {};
  var EXPECTING_LIST_ITEM    = {};
  var ACCUMULATING_LIST_ITEM = {};
  return {
    getBrowserMarkupFrom: function(applicationMarkup) {
      var container = new Element("div").update(applicationMarkup);
      function spanify(element, style) {
        element.replace(
          '<span style="' + style +
          '" class="Apple-style-span">' +
          element.innerHTML + '</span>'
        );
      }
      function convertStrongsToSpans() {
        container.select("strong").each(function(element) {
          spanify(element, "font-weight: bold");
        });
      }
      function convertEmsToSpans() {
        container.select("em").each(function(element) {
          spanify(element, "font-style: italic");
        });
      }
      function convertDivsToParagraphs() {
        container.select("div").each(function(element) {
          element.replace("<p>" + element.innerHTML + "</p>");
        });
      }
      if (Prototype.Browser.WebKit || Prototype.Browser.Gecko) {
        convertStrongsToSpans();
        convertEmsToSpans();
      } else if (Prototype.Browser.IE || Prototype.Browser.Opera) {
        convertDivsToParagraphs();
      }
share/static/alice.js view on Meta::CPAN
    if (options.query)
      return options.query;
    else if (options.get('query'))
      return options.get('query');
    else
      return function(editor) { return editor.queryCommandState(name); };
  }
  function observeStateChanges(element, name, handler) {
    var previousState;
    this.editor.on("selection:change", function(event) {
      var state = handler(this.editor);
      if (state != previousState) {
        previousState = state;
        this.updateButtonState(element, name, state);
      }
    }.bind(this));
  }
  function updateButtonState(element, name, state) {
    if (state)
      element.addClassName('selected');
    else
      element.removeClassName('selected');
  }
  return {
    initialize:           initialize,
    createToolbarElement: createToolbarElement,
    addButtonSet:         addButtonSet,
    addButton:            addButton,
    createButtonElement:  createButtonElement,
    buttonHandler:        buttonHandler,
    observeButtonClick:   observeButtonClick,
share/static/alice.js view on Meta::CPAN
var Alice = { };
Object.extend(Alice, {
  RE: {
    img: /^http[^\s]*\.(?:jpe?g|gif|png|bmp|svg)[^\/]*$/i,
    audio: /^http[^\s]*\.(?:wav|mp3|ogg|aiff?|m4[ar])[^\/]*$/i,
    url: /(https?:\/\/[^\s<"]*)/ig
  },
  cleanupCopy: function(node) {
    if (!node.select("li.message").length) return;
    var lines = [];
    node.select("li.message").each(function(line) {
      var left = line.down("div.left span.nick");
      var message = line.down("div.msg");
      var clean = [];
      if (left) {
        var nick = left.innerHTML.stripTags();
        nick = nick.replace(/^\s+/, "");
        nick = nick.replace(/\s+$/, "");
        clean.push("<"+nick+">");
      }
      if (message) {
share/static/alice.js view on Meta::CPAN
      audio.pause();
      this.src = '/static/image/play.png';
      this.onclick = function () { Alice.playAudio(this, audio) };
    };
  },
  joinChannel: function() {
    var network = $('join_network').value;
    var channel = $('join_channel').value;
    if (!network || !channel) {
      alert("Must select a channel and network!");
      return;
    }
    var win = alice.activeWindow();
    alice.connection.sendMessage({
      source: win.id,
      msg: "/join -"+network+" "+channel
    });
    alice.input.disabled = false;
    $('join').remove();
  },
share/static/alice.js view on Meta::CPAN
    params: function () {
      var values = Alice.tabsets.values();
      return Alice.tabsets.sets().inject({}, function(acc, set, index) {
        acc[set] = values[index];
        return acc;
      });
    },
    sets: function () {
      if (!$('sets')) return [];
      return $('sets').select('li').map(function(li) {return li.innerHTML.unescapeHTML()});
    },
    values: function () {
      if (!$('tabset_data')) return [];
      return $$('#tabset_data ul').map(function(ul) {
        var windows = ul.select('input').filter(function(input) {
          return input.checked;
        }).map(function(input){return input.name});
        return windows.length ? windows : 'empty';
      });
    },
    remove: function () {
      alice.input.disabled = false;
      $('tabsets').remove();
    },
    clearActive: function () {
      $('tabset_data').select('.active').invoke('removeClassName', 'active');
      $('sets').select('.active').invoke('removeClassName', 'active');
    },
    removeSet: function () {
      $('tabsets').down('.active').remove();
      $('tabset_data').down('.active').remove();
    },
    focusIndex: function (i) {
      Alice.tabsets.clearActive();
      $('tabset_data').select('ul')[i].addClassName('active');
      $('sets').select('li')[i].addClassName('active');
    },
    focusSet: function (e) {
      var li = e.findElement('li');
      if (li) {
        Alice.tabsets.focusIndex(li.previousSiblings().length);
      }
    },
  },
  prefs: {
    addHighlight: function (alias) {
		  var channel = prompt("Enter a word to highlight.");
		  if (channel)
		    $('highlights').insert("<option value=\""+channel+"\">"+channel+"</option>");
		  return false;
		},
    removeHighlights: function (alias) {
		  $A($('highlights').options).each(function (option) {
		    if (option.selected) option.remove()});
		  return false;
		},
    addNick: function (nick) {
      var nick = prompt("Enter a nick.");
      if (nick)
        $('monospace_nicks').insert("<option value=\""+nick+"\">"+nick+"</option>");
      return false;
    },
    removeNicks: function (nick) {
      $A($('monospace_nicks').options).each(function (option) {
        if (option.selected) option.remove()});
      return false;
    },
    remove: function() {
      alice.input.disabled = false;
      $('prefs').remove();
    },
    submit: function(form) {
      var options = {highlights: [], monospace_nicks: []};
share/static/alice.js view on Meta::CPAN
    addCommand: function (alias) {
			var command = prompt("Please enter a command.");
			if (command)
			  $("on_connect_" + alias).insert("<option value=\""+command+"\">"+command+"</option>");
			return false;
		},
    removeCommands: function (alias) {
			$A($("on_connect_" + alias).options).each(function (option) {
			if (option.selected) option.remove()});
			  return false;
		},
    removeChannels: function (alias) {
			$A($("channels_" + alias).options).each(function (option) {
			if (option.selected) option.remove()});
			  return false;
		},
    addServer: function () {
			var name = prompt("Please enter a name for this server.");
			if (! name) return;
			new Ajax.Request("/serverconfig", {
			  parameters: {name: name},
			  method: 'get',
			  onSuccess: function (trans) {
share/static/alice.js view on Meta::CPAN
			if (alias && confirm("Are you sure you want to remove "+alias+"?")) {
			  $("menu_"+alias).remove();
			  $("setting_"+alias).remove();
			  $("connections").down("li").addClassName("active");
			  $("config_data").down("table").addClassName("active");
			}
	  },
    submit: function(form) {
      var params = form.serialize(true);
      form.select(".channelselect").each(function(select) {
        params[select.name] = $A(select.options).map(function(opt){return opt.value});
      });
      new Ajax.Request('/save', {
        method: 'post',
        parameters: params,
        onSuccess: function(){Alice.connections.remove()}
      });
      return false;
    },
share/static/alice.js view on Meta::CPAN
    (function(){n.parentNode.removeChild(n)}).defer();
    return element;
  }
});
Alice.Application = Class.create({
  initialize: function() {
    this.options = {};
    this.isFocused = true;
    this.window_map = new Hash();
    this.previousFocus = 0;
    this.selectedSet = '';
    this.tabs = $('tabs');
    this.topic = $('topic');
    this.nicklist = $('nicklist');
    this.overlayVisible = false;
    this.lastnotify = 0;
    this.topic_height = "14px";
    this.beep = new Audio("/static/beep.mp3");
    this.oembeds = [];
    this.jsonp_callbacks = {};
share/static/alice.js view on Meta::CPAN
      e.stop();
      var position = win.captureScrollPosition();
      if (elem.innerHTML) {
        elem.innerHTML = "";
        elem.style.display = "none";
        return;
      }
      elem.style.display = "block";
      elem.innerHTML = html;
      Alice.makeLinksClickable(elem);
      var images = elem.select("img");
      if (images.length) {
        images.each(function(img) {
          img.observe("load", function(e) {
            win.scrollToPosition(position);
            img.stopObserving(img, "load");
          });
        });
      }
      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();
          }
        }
      }
      else {
        win.enable();
share/static/alice.js view on Meta::CPAN
    if (this.previousFocus && this.previousFocus.id != this.activeWindow().id)
      this.previousFocus.focus();
    else
      this.previousWindow();
  },
  previousWindow: function() {
    var active = this.activeWindow();
    var previousTab = this.activeWindow().tab.previous('.visible');
    if (!previousTab) previousTab = this.tabs.select('.visible').last();
    if (!previousTab) return;
    var id = previousTab.id.replace('_tab','');
    if (id != active.id) this.getWindow(id).focus();
  },
  closeWindow: function(windowId) {
    var win = this.getWindow(windowId);
    if (win) win.close();
  },
share/static/alice.js view on Meta::CPAN
  unHighlightChannelSelect: function(id) {
    ['tab_menu_left', 'tab_menu_right'].find(function(menu) {
      menu = $(menu);
      var li = menu.down('li[rel='+id+']');
      if (li) {
        li.removeClassName("unread");
        li.removeClassName("highlight");
        ["unread", "highlight"].each(function(c) {
          if (!menu.select('li').any(function(li) {return li.hasClassName(c)})) {
            menu.removeClassName(c);
          }
        });
        return true;
      }
      return false;
    });
  },
  handleAction: function(action) {
share/static/alice.js view on Meta::CPAN
  focusHash: function(hash) {
    if (!hash) hash = window.location.hash;
    if (hash) {
      hash = decodeURI(hash);
      hash = hash.replace(/^#/, "");
      if (hash.substr(0,1) != "/") {
        var name = hash.match(/^([^\/]+)/)[0];
        hash = hash.substr(name.length);
        if (this.tabsets[name]) {
          if (this.selectedSet != name) this.showSet(name);
        }
        else {
          window.location.hash = hash;
          window.location = window.location.toString();
          return false;
        }
      }
      var windows = this.windows();
      for (var i = 0; i < windows.length; i++) {
share/static/alice.js view on Meta::CPAN
    return Math.max.apply(Math, ids);
  },
  setSource: function(id) {
    $('source').value = id;
  },
  showSet: function(name) {
    var ids = this.tabsets[name];
    if (ids) {
      var elem = $('tabset_menu').select('li').find(function(li) {
        return li.innerHTML.unescapeHTML() == name;
      });
      elem.up('ul').select('li').invoke('removeClassName', 'selectedset');
      elem.addClassName('selectedset');
      this.windows().each(function(win) {
        ids.indexOf(win.id) >= 0 || win.type == "privmsg" ? win.show() : win.hide();
      });
      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;
  },
  displayTopic: function(new_topic) {
    this.topic.update(new_topic || "no topic set");
    Alice.makeLinksClickable(this.topic);
  },
share/static/alice.js view on Meta::CPAN
  unFocus: function() {
    this.lastScrollPosition = this.captureScrollPosition();
    this.active = false;
    this.element.removeClassName('active');
    this.tab.removeClassName('active');
    clearTimeout(this.scrollListener);
    this.addFold();
  },
  addFold: function() {
    this.messages.select("li.fold").invoke("removeClassName", "fold");
    var last = this.messages.childElements().last();
    if (last) last.addClassName("fold");
  },
  showNick: function (e) {
    var li = e.findElement("li.message");
    if (li && li.hasClassName("avatar")) {
      if (this.application.overlayVisible || li == this.visibleNick) return;
      clearTimeout(this.visibleNickTimeout);
share/static/alice.js view on Meta::CPAN
    var last = this.messages.childElements().last();
    if (last && last.hasClassName("fold"))
      last.removeClassName("fold");
    this.application.displayTopic(this.topic);
    document.title = this.title;
    return this;
  },
  setWindowHash: function () {
    var new_hash = "#" + this.application.selectedSet + this.hashtag;
    if (new_hash != window.location.hash) {
      window.location.hash = encodeURI(new_hash);
      window.location = window.location.toString();
    }
  },
  markRead: function () {
    this.tab.removeClassName("unread");
    this.tab.removeClassName("highlight");
    this.statuses = [];
share/static/alice.js view on Meta::CPAN
  announce: function (message) {
    message = message.escapeHTML();
    this.messages.insert(
      "<li class='message monospaced announce'><div class='msg'>"+message+"</div></li>"
    );
    this.scrollToPosition(0);
  },
  trimMessages: function() {
    this.messages.select("li").reverse().slice(this.messageLimit).invoke("remove");
  },
  addChunk: function(chunk) {
    if (chunk.nicks) this.updateNicks(chunk.nicks);
    clearTimeout(this.scrollListener);
    if (chunk.range.length == 0) {
      this.scrollBackEmpty = true;
      this.tab.removeClassName("loading");
      return;
share/static/alice.js view on Meta::CPAN
    if (chunk['range'][0] > this.msgid) {
      this.messages.insert({"bottom": chunk['html']});
      this.trimMessages();
      this.msgid = chunk['range'][1];
    }
    else {
      this.bulk_insert = true;
      this.messages.insert({"top": chunk['html']});
    }
    this.messages.select("li:not(.filtered)").each(function (li) {
      this.application.applyFilters(li, this);
    }.bind(this));
    this.bulk_insert = false;
    this.scrollToPosition(position);
    setTimeout(function(){this.removeClassName("loading")}.bind(this.tab), 1000);
    this.scrollListener = setTimeout(this.checkScrollBack.bind(this), 1000);
  },
share/static/alice.js view on Meta::CPAN
    if (message.msgid) this.msgid = message.msgid;
    if (message.nicks) this.updateNicks(message.nicks);
    var position = this.captureScrollPosition();
    this.messages.insert(message.html);
    this.trimMessages();
    this.scrollToPosition(position);
    var li = this.messages.select("li").last();
    this.application.applyFilters(li, this);
    this.scrollToPosition(position);
    if (message.event == "topic") {
      this.topic = message.body;
      if (this.active) this.application.displayTopic(this.topic);
    }
    this.element.redraw();
share/static/alice.js view on Meta::CPAN
    return button;
  },
  observeButtonClick: function(element, handler) {
    element.on('click', function(e) {e.stop()});
    element.on('mouseup', function(event) {
      alice.input.focus();
      handler(this.editor, element, this);
      this.editor.fire("selection:change");
      event.stop();
    }.bind(this));
  },
});
Object.extend(Alice.Toolbar, {
  updateColors: function (editor) {
    var range = alice.input.range || editor;
    if (range) {
share/static/alice.js view on Meta::CPAN
    name: "italic",
    handler: function (editor, button, toolbar) {
      editor.italicSelection();
    }
  },
  {
    label: "u",
    name: "underline",
    handler: function (editor, button, toolbar) {
      var elem = toolbar.element.down(".underline");
      if (elem.hasClassName("selected"))
       elem.removeClassName("selected");
      else
       elem.addClassName("selected");
      editor.underlineSelection();
    }
  }
];
Alice.Colorpicker = Class.create({
  initialize: function(button, callback) {
    var elem = new Element("div").addClassName("color_picker");
share/static/alice.js view on Meta::CPAN
      if (this.skipThisFocus) {
        this.skipThisFocus = false;
        return;
      }
    }
    this.focused = true;
    if (this.editor) {
      var selection = window.getSelection();
      selection.removeAllRanges();
      if (this.range) {
        selection.addRange(this.range);
      } else {
        var text = document.createTextNode("");
        this.editor.appendChild(text);
        selection.selectNode(text);
        this.range = selection.getRangeAt(0);
      }
      this.editor.focus();
    } else {
      this.textarea.focus();
    }
  },
  onBlur: function(e) {
    this.focused = false;
  },
share/static/alice.js view on Meta::CPAN
    element.remove();
    return height;
  },
  canContentEditable: function() {
    var element = new Element("div", {contentEditable: "true"});
    return  ! (element.contentEditable == null || this.application.isMobile || Prototype.Browser.IE);
  },
  updateRange: function (e) {
    var selection = window.getSelection();
    if (selection.rangeCount > 0) {
      var range = selection.getRangeAt(0);
      this.range = range;
    }
  },
  pasteHandler: function(e) {
    if (!e.clipboardData) return;
    var items = e.clipboardData.items;
    if (items) {
      var output = "";
share/static/alice.js view on Meta::CPAN
    this.findStem();
    this.matches = this.matchAgainst(candidates);
    this.matchIndex = -1;
  },
  addTextNode: function() {
    this.editor.innerHTML = "";
    var node = document.createTextNode("");
    this.editor.appendChild(node);
    var selection = window.getSelection();
    selection.removeAllRanges();
    selection.selectNode(node);
    range = selection.getRangeAt(0);
    this.element = node;
  },
  getRange: function() {
    var selection = window.getSelection();
    if (selection.rangeCount > 0) {
      return selection.getRangeAt(0);
    }
    if (document.createRange) {
      return document.createRange();
    }
    return null;
  },
  setRange: function(range) {
    if (!range) return;
    var selection = window.getSelection();
    selection.removeAllRanges();
    selection.addRange(range);
  },
  next: function() {
    if (!this.matches.length) return;
    if (++this.matchIndex == this.matches.length) this.matchIndex = 0;
    this.complete();
  },
  prev: function() {
    if (!this.matches.length) return;
share/static/alice.js view on Meta::CPAN
    document.observe("copy", function(e) {
      if (!e.findElement("ul.messages")) return;
      if(!Prototype.Browser.IE && typeof window.getSelection !== 'undefined') {
        var buffer = new Element("DIV", {"class": "copybuffer"});
        document.getElementsByTagName("body")[0].appendChild(buffer);
        var sel = window.getSelection();
        var range = sel.getRangeAt(0);
        buffer.appendChild(range.cloneContents());
        Alice.cleanupCopy(buffer);
        sel.selectAllChildren(buffer);
        setTimeout(function() {
          if(typeof window.getSelection().setBaseAndExtent !== 'undefined') {
            sel.setBaseAndExtent(
              range.startContainer,
              range.startOffset,
              range.endContainer,
              range.endOffset
            );
          }
        }, 0);
      }
    });
    if (alice.isMobile) return;
    alice.addFilters([
      function(msg, win) {
        msg.select("a").filter(function(a) {
          return Alice.RE.audio.match(a.href);
        }).each(function(a) {
          var img = new Element("IMG", {"class": "audio", src: "/static/image/play.png"});
          img.onclick = function(){ Alice.playAudio(img) };
          a.insert({before: img})
        });
      },
      function (msg, win) {
        if (alice.options.images == "show") {
          var matches = msg.select("a").inject(0, function(acc, a) {
            var oembed = alice.oembeds.find(function(service) {
              return service.match(a.href);
            });
            if (oembed) {
              alice.embed(a, win);
              acc++;
            }
            return acc;
          });
          return matches > 0;
        }
      },
      function (msg, win) {
        msg.select("a").filter(function(a) {
          var img = a.readAttribute("img") || a.innerHTML;
          return img.match(Alice.RE.img);
        }).each(function(a) {
          var image = a.readAttribute("img") || a.href;
          if (alice.options.images == "show" && !image.match(/#(nsfw|hide)$/))
            win.inlineImage(a);
          else
            a.observe("click", function(e){e.stop();win.inlineImage(a)});
        });
      }
share/templates/config.html view on Meta::CPAN
          <label>Password</label>
          <input type="text" name="<?= $network ?>_password" value="<?= $config->{password} || ""?>" size="15" />
        </td>
      </tr>
      <tr>
        <td>
          <label>Channels
            <span style="font-size:0.8em">(e.g. <span style="font-family:monospace;font-size:1em">#alice</span>)</span>
          </label>
          <select name="<?= $network ?>_channels" multiple="multiple" id="channels_<?= $network ?>" class="channelselect">
            <? for my $channel (@{$config->{channels}}) { ?>
            <option value="<?= $channel ?>"><?= $channel ?></option>
            <? } ?>
          </select>
          <div class="controls">
            <a href="#" onclick="return Alice.connections.addChannel('<?= $network ?>')">Add</a>
            <a href="#" onclick="return Alice.connections.removeChannels('<?= $network ?>')">Remove</a>
          </div>
        </td>
        <td>
          <label>Commands</label>
          <select name="<?= $network ?>_on_connect" multiple="multiple" id="on_connect_<?= $network ?>" class="channelselect">
            <? for my $command (@{ $config->{on_connect} }) { ?>
            <option value="<?= $command ?>"><?= $command ?></option>
            <? } ?>
          </select>
          <div class="controls">
            <a href="#" onclick="return Alice.connections.addCommand('<?= $network ?>')">Add</a>
            <a href="#" onclick="return Alice.connections.removeCommands('<?= $network ?>')">Remove</a>
          </div>
        </td>
      </tr>
    </table>
? }
share/templates/help.html view on Meta::CPAN
        <dd><?= $command->{desc} ?></dd>
      <? } ?>
    </dl>
    <dl id="shortcuts">
      <h2>Shortcuts</h2>
      <dt>Tab</dt>
      <dd>Cycle to next nick completion</dd>
      <dt>[Mod1] K</dt>
      <dd>Clear current tab</dd>
      <dt>[Mod1] B</dt>
      <dd>Bold selection</dd>
      <dt>[Mod1] I</dt>
      <dd>Italicize selection</dd>
      <dt>[Mod1] U</dt>
      <dd>Underline selection</dd>
      <dt>[Mod1] â  or  [Mod1] [Shift] H</dt>
      <dd>Previous tab</dd>
      <dt>[Mod1] â  or  [Mod1] [Shift] L</dt>
      <dd>Next tab</dd>
      <dt>[Mod1] [Shift] U</dt>
      <dd>Next unread tab</dd>
      <dt>[Meta] [Up]</dt>
      <dd>Cycle through previous message</dd>
      <dt>[Meta] [Down]</dt>
      <dd>Cycle to next message</dd>
share/templates/help.html view on Meta::CPAN
    <script type="text/javascript">
      var isMac = navigator.platform.match(/mac/i);
      var modmap = {
        "[Meta]":   isMac ? "â¥" : "<Alt>",
        "[Mod1]":   isMac ? "â" : "<Ctrl>",
        "[Shift]":  isMac ? "â§" : "<Shift>",
        "[Up]":     isMac ? "â" : "<Up>",
        "[Down]":   isMac ? "â" : "<Down>",
        "[Return]": isMac ? "âµ" : "<Return>",
      };
      $('shortcuts').select("dt").each(function(dt) {
        var terms = dt.innerHTML.split(" ");
        terms = terms.map(function(term) {
          return modmap[term] ? modmap[term] : term;  
        });
        dt.innerHTML = terms.join(isMac ? "" : " ");
      });
    </script>
  </div>
</div>
share/templates/join.html view on Meta::CPAN
? my $app = shift;
<div id="join" class="config config_body">
  <table>
    <tr>
      <td>
        <label for="join_network">Network</label>
        <select id="join_network">
          <? my @ircs = sort {$a->name cmp $b->name} $app->connected_ircs ?>
          <? for my $irc (@ircs) { ?>
            <option name="<?= $irc->name ?>"><?= $irc->name ?></option>
          <? } ?>
        </select>
      </td>
    </tr>
    <tr>
      <td style="padding-top:0">
        <label for="join_channel">Channel</label>
        <input type="text" id="join_channel" style="width:150px" value=""/>
      </td>
    </tr>
  </table>
share/templates/new_server.html view on Meta::CPAN
          <label>Password</label>
          <input type="text" name="<?= $alias ?>_password" value="" size="15" />
        </td>
      </tr>
      <tr>
        <td>
          <label>Channels
            <span style="font-size:0.8em">(e.g. <span style="font-family:monospace;font-size:1em">#alice</span>)</span>
          </label>
          <select name="<?= $alias ?>_channels" multiple="multiple" id="channels_<?= $alias ?>" class="channelselect">
          </select>
          <div class="controls">
            <a href="#" onclick="return Alice.connections.addChannel('<?= $alias ?>')">Add</a>
            <a href="#" onclick="return Alice.connections.removeChannels('<?= $alias ?>')">Remove</a>
          </div>
        </td>
        <td>
          <label>Commands</label>
          <select name="<?= $alias ?>_on_connect" multiple="multiple" id="on_connect_<?= $alias ?>" class="channelselect">
          </select>
          <div class="controls">
            <a href="#" onclick="return Alice.connections.addCommand('<?= $alias ?>')">Add</a>
            <a href="#" onclick="return Alice.connections.removeCommands('<?= $alias ?>')">Remove</a>
          </div>
        </td>
      </tr>
    </table>
share/templates/prefs.html view on Meta::CPAN
              <a style="font-size:10px" href="javascript:void(0)" onclick="window.webkitNotifications.requestPermission()">Grant permission</a>
            </td></tr>
            <tr><td>
              <input type="checkbox"<? if ($app->config->audio eq "show") { ?> checked="checked"<? } ?> name="audio" id="audio" />
              <label for="audio">Enable audio?</label>
            </td></tr>
            <tr><td>
              <label for="style">Style</label>
              <select name="style" id="style">
                <option value="default"<? if ($app->config->style eq "default") {?> selected<? } ?>>Default</option>
                <option value="dark"<? if ($app->config->style eq "dark") {?> selected<? } ?>>Dark</option>
                <option value="solarized"<? if ($app->config->style eq "solarized") {?> selected<? } ?>>Solarized</option>
              </select>
            </td></tr>
            <tr><td>
              <label for="timeformat">Time Format</label>
              <select name="timeformat" id="timeformat">
                <option value="12"<? if ($app->config->timeformat eq "12") {?> selected<? } ?>>12 Hour</option>
                <option value="24"<? if ($app->config->timeformat eq "24") {?> selected<? } ?>>24 Hour</option>
              </select>
            </td></tr>
          </table>
        </td>
        <td>
          <table>
            <tr><td>
              <label>Highlights</label>
              <select name="highlights" multiple="multiple" id="highlights">
                <? for my $highlight (@{$app->config->highlights}) { ?>
                <option value="<?= $highlight ?>"><?= $highlight ?></option>
                <? } ?>
              </select>
              <div class="controls">
                <a href="#" onclick="return Alice.prefs.addHighlight()">Add</a>
                <a href="#" onclick="return Alice.prefs.removeHighlights()">Remove</a>
              </div>
            </td></tr>
            <tr><td>
              <label>Monospace Nicks</label>
              <select name="monospace_nicks" multiple="multiple" id="monospace_nicks">
                <? for my $nick (@{$app->config->monospace_nicks}) { ?>
                <option value="<?= $nick ?>"><?= $nick ?></option>
                <? } ?>
              </select>
              <div class="controls">
                <a href="#" onclick="return Alice.prefs.addNick()">Add</a>
                <a href="#" onclick="return Alice.prefs.removeNicks()">Remove</a>
              </div>
            </td></tr>
          </table>
        </td>
      </tr>
      <tr>
        <td style="padding-top:0" colspan="2">
share/templates/tabset_menu.html view on Meta::CPAN
<ul id="tabset_menu">
  <li class="separate-bottom"><span>Edit Sets</span></li>
  <li><span>All tabs</span></li>
  <? for my $set ($app->tabsets) { ?>
    <li><span><?= $set->name ?></span></li>
  <? } ?>
  <script type="text/javascript">
    if (window.alice) {
      <? my $tabsets = {map {$_->name => $_->windows } $app->tabsets}; ?>
      alice.tabsets = <?= Text::MicroTemplate::encoded_string(JSON::encode_json $tabsets) ?>;
      alice.showSet(alice.selectedSet);
    }
  </script>
</ul>