view release on metacpan or search on metacpan
inc/Module/Install/Fetch.pm view on Meta::CPAN
require Cwd;
my $dir = Cwd::getcwd();
chdir $args{local_dir} or return if exists $args{local_dir};
if (eval { require LWP::Simple; 1 }) {
LWP::Simple::mirror($args{url}, $file);
}
elsif (eval { require Net::FTP; 1 }) { eval {
# use Net::FTP to get past firewall
my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600);
$ftp->login("anonymous", 'anonymous@example.com');
$ftp->cwd($path);
$ftp->binary;
$ftp->get($file) or (warn("$!\n"), return);
$ftp->quit;
} }
elsif (my $ftp = $self->can_run('ftp')) { eval {
# no Net::FTP, fallback to ftp.exe
require FileHandle;
my $fh = FileHandle->new;
share/static/alice.js view on Meta::CPAN
var __method = this, args = slice.call(arguments, 0);
return function() {
var a = merge(args, arguments);
return __method.apply(this, a);
}
}
function delay(timeout) {
var __method = this, args = slice.call(arguments, 1);
timeout = timeout * 1000;
return window.setTimeout(function() {
return __method.apply(__method, args);
}, timeout);
}
function defer() {
var args = update([0.01], arguments);
return this.delay.apply(this, args);
}
function wrap(wrapper) {
share/static/alice.js view on Meta::CPAN
this.start();
},
start: function() {
this.options.onComplete = this.updateComplete.bind(this);
this.onTimerEvent();
},
stop: function() {
this.updater.options.onComplete = undefined;
clearTimeout(this.timer);
(this.onComplete || Prototype.emptyFunction).apply(this, arguments);
},
updateComplete: function(response) {
if (this.options.decay) {
this.decay = (response.responseText == this.lastText ?
this.decay * this.options.decay : 1);
this.lastText = response.responseText;
}
share/static/alice.js view on Meta::CPAN
})();
(function() {
/* Support for the DOMContentLoaded event is based on work by Dan Webb,
Matthias Miller, Dean Edwards, John Resig, and Diego Perini. */
var timer;
function fireContentLoadedEvent() {
if (document.loaded) return;
if (timer) window.clearTimeout(timer);
document.loaded = true;
document.fire('dom:loaded');
}
function checkReadyState() {
if (document.readyState === 'complete') {
document.stopObserving('readystatechange', checkReadyState);
fireContentLoadedEvent();
}
}
share/static/alice.js view on Meta::CPAN
this.drags = this.drags.reject(function(d) { return d==draggable });
if(this.drags.length == 0) {
Event.stopObserving(document, "mouseup", this.eventMouseUp);
Event.stopObserving(document, "mousemove", this.eventMouseMove);
Event.stopObserving(document, "keypress", this.eventKeypress);
}
},
activate: function(draggable) {
if(draggable.options.delay) {
this._timeout = setTimeout(function() {
Draggables._timeout = null;
window.focus();
Draggables.activeDraggable = draggable;
}.bind(this), draggable.options.delay);
} else {
window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
this.activeDraggable = draggable;
}
},
share/static/alice.js view on Meta::CPAN
if(!this.activeDraggable) return;
var pointer = [Event.pointerX(event), Event.pointerY(event)];
if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
this._lastPointer = pointer;
this.activeDraggable.updateDrag(event, pointer);
},
endDrag: function(event) {
if(this._timeout) {
clearTimeout(this._timeout);
this._timeout = null;
}
if(!this.activeDraggable) return;
this._lastPointer = null;
this.activeDraggable.endDrag(event);
this.activeDraggable = null;
},
keyPress: function(event) {
if(this.activeDraggable)
share/static/alice.js view on Meta::CPAN
WysiHat.Toolbar.ButtonSets = {};
WysiHat.Toolbar.ButtonSets.Basic = $A([
{ label: "Bold" },
{ label: "Underline" },
{ label: "Italic" }
]);
/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,...
(function() {
if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) return;
var logger;
if (window.WEB_SOCKET_LOGGER) {
logger = WEB_SOCKET_LOGGER;
} else if (window.console && window.console.log && window.console.error) {
logger = window.console;
share/static/alice.js view on Meta::CPAN
self.__id = WebSocket.__nextId++;
WebSocket.__instances[self.__id] = self;
self.readyState = WebSocket.CONNECTING;
self.bufferedAmount = 0;
self.__events = {};
if (!protocols) {
protocols = [];
} else if (typeof protocols == "string") {
protocols = [protocols];
}
self.__createTask = setTimeout(function() {
WebSocket.__addTask(function() {
self.__createTask = null;
WebSocket.__flash.create(
self.__id, url, protocols, proxyHost || null, proxyPort || 0, headers || null);
});
}, 0);
};
/**
* Send data to the web socket.
share/static/alice.js view on Meta::CPAN
this.bufferedAmount += result;
return false;
}
};
/**
* Close this web socket gracefully.
*/
WebSocket.prototype.close = function() {
if (this.__createTask) {
clearTimeout(this.__createTask);
this.__createTask = null;
this.readyState = WebSocket.CLOSED;
return;
}
if (this.readyState == WebSocket.CLOSED || this.readyState == WebSocket.CLOSING) {
return;
}
this.readyState = WebSocket.CLOSING;
WebSocket.__flash.close(this.__id);
};
share/static/alice.js view on Meta::CPAN
logger.error("[WebSocket] swfobject.embedSWF failed");
}
});
};
/**
* Called by Flash to notify JS that it's fully loaded and ready
* for communication.
*/
WebSocket.__onFlashInitialized = function() {
setTimeout(function() {
WebSocket.__flash = document.getElementById("webSocketFlash");
WebSocket.__flash.setCallerUrl(location.href);
WebSocket.__flash.setDebug(!!window.WEB_SOCKET_DEBUG);
for (var i = 0; i < WebSocket.__tasks.length; ++i) {
WebSocket.__tasks[i]();
}
WebSocket.__tasks = [];
}, 0);
};
/**
* Called by Flash to notify WebSockets events are fired.
*/
WebSocket.__onFlashEvent = function() {
setTimeout(function() {
try {
var events = WebSocket.__flash.receiveEvents();
for (var i = 0; i < events.length; ++i) {
WebSocket.__instances[events[i].webSocketId].__handleEvent(events[i]);
}
} catch (e) {
logger.error(e);
}
}, 0);
return true;
share/static/alice.js view on Meta::CPAN
}
else if (window.webkitNotifications) {
if (window.webkitNotifications.checkPermission() == 0) {
var popup = window.webkitNotifications.createNotification(
"http://static.usealice.org/image/alice.png",
message.subject,
message.body
);
popup.ondisplay = function() {
setTimeout(function () {popup.cancel();}, 5000);
};
popup.show();
}
}
},
isSpecialKey: function(keyCode) {
var special_keys = [
16,27,9,32,13,8,145,20,144,19,45,36,46,35,33,34,37,38,39,
share/static/alice.js view on Meta::CPAN
var req = new XMLHttpRequest();
req.open("GET", "https://noembed.com/providers");
req.onreadystatechange = function(){
if (req.readyState == 4) {
try {
var providers = req.responseText.evalJSON();
this.oembeds = providers.inject([], function(acc, site){
return acc.concat(site.patterns.map(function(pat){return new RegExp(pat)}));
});
} catch (e) {}
setTimeout(this.fetchOembeds.bind(this), 1000 * 60 * 5);
if (cb) cb();
}
}.bind(this);
req.send();
},
embed: function(a, win) {
var params = {
url: a.href,
maxheight: 300,
share/static/alice.js view on Meta::CPAN
format: /(.+)/,
only: ["info_tab", "channel_tab", "privmsg_tab"],
onUpdate: function (res) {
var tabs = res.childElements();
var order = tabs.collect(function(t){
var m = t.id.match(/([^_]+)_tab/);
if (m) return m[1]
});
if (order.length) this.connection.sendTabOrder(order);
setTimeout(function(){
this.windows().invoke("updateTabLayout");
this.activeWindow().shiftTab();
}.bind(this), 100);
}.bind(this)
});
},
addMissed: function() {
if (!window.fluid) return;
window.fluid.dockBadge ? window.fluid.dockBadge++ :
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
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;
},
share/static/alice.js view on Meta::CPAN
this.reconnecting = true;
this.reconnect_count = 0;
this.connect();
},
handleException: function(request, exception) {
this.application.log("encountered an error with stream.");
this.application.log(exception);
this.connected = false;
if (!this.aborting)
setTimeout(this.connect.bind(this), 2000);
else
this.changeStatus("ok");
},
handleComplete: function(transport) {
this.application.log("connection was closed cleanly.");
this.connected = false;
if (!this.aborting)
setTimeout(this.connect.bind(this), 2000);
else
this.changeStatus("ok");
},
processQueue: function(data) {
try {
var queue = data.queue;
var length = queue.length;
for (var i=0; i<length; i++) {
if (queue[i].type == "identify") {
share/static/alice.js view on Meta::CPAN
this.changeStatus("ok");
var parameters = Object.toQueryString({
t: now.getTime() / 1000,
tab: this.application.activeWindow().id
});
var protocol = (window.location.protocol.match(/^https/) ? "wss://" : "ws://");
var url = protocol + window.location.host + "/wsstream?" + parameters;
this.request = new WebSocket(url);
this.request.onopen = function(){
this.connected = true;
setTimeout(cb, 100);
}.bind(this);
this.request.onmessage = this.handleUpdate.bind(this);
this.request.onerror = this.handleException.bind(this);
this.request.onclose = this.handleComplete.bind(this);
},
handleUpdate: function(e) {
var data = e.data.evalJSON();
this.processQueue(data);
},
share/static/alice.js view on Meta::CPAN
closeWindow: function(win) {
this.sendMessage({source: win.id, msg: "/close"});
},
handleException: function(exception) {
this.application.log("encountered an error with stream.");
this.application.log(exception);
this.connected = false;
if (!this.aborting)
setTimeout(this.connect.bind(this), 2000);
else
this.changeStatus("ok");
},
requestWindow: function(title, windowId, message) {
this.sendMessage({source: windowId, msg: "/create " + title});
if (message) {
setTimeout(function() {
this.application.displayMessage(message)
}.bind(this), 1000);
}
}
});
Alice.Connection.XHR = Class.create(Alice.Connection, {
initialize: function(application) {
this.type = "xhr";
this.pings = [];
share/static/alice.js view on Meta::CPAN
this.application = application;
this.connected = false;
this.aborting = false;
this.request = null;
this.reconnect_count = 0;
this.reconnecting = false;
},
_connect: function(cb) {
setTimeout(function () {
var now = new Date();
this.application.log("opening new xhr stream");
this.changeStatus("ok");
this.request = new Ajax.Request('/stream', {
method: 'get',
parameters: {
t: now.getTime() / 1000,
tab: this.application.activeWindow().id
},
on401: this.gotoLogin,
on500: this.gotoLogin,
on502: this.gotoLogin,
on503: this.gotoLogin,
onException: this.handleException.bind(this),
onInteractive: function(transport) {
if (!this.connected) {
this.connected = true;
setTimeout(cb, 0);
}
this.handleUpdate(transport);
}.bind(this),
onComplete: this.handleComplete.bind(this)
});
}.bind(this), this.application.loadDelay);
},
handleUpdate: function(transport) {
if (this.reconnecting) {
share/static/alice.js view on Meta::CPAN
method: 'post',
parameters: {
source: windowId,
msg: "/create " + title,
stream: this.id
},
on401: this.gotoLogin,
onSuccess: function (transport) {
this.handleUpdate(transport);
if (message) {
setTimeout(function() {
this.application.displayMessage(message)
}.bind(this), 1000);
}
}.bind(this)
});
}
});
Alice.Window = Class.create({
initialize: function(application, serialized, msgid) {
share/static/alice.js view on Meta::CPAN
this.type = serialized['type'];
this.hashtag = serialized['hashtag'];
this.id = this.element.identify();
this.active = false;
this.topic = serialized['topic'];
this.tab = $(this.id + "_tab");
this.tab_layout = this.tab.getLayout();
this.tabButton = $(this.id + "_tab_button");
this.messages = this.element.down('.messages');
this.visibleNick = "";
this.visibleNickTimeout = "";
this.lasttimestamp = new Date(0);
this.nicks = [];
this.nicks_order = [];
this.statuses = [];
this.messageLimit = this.application.isMobile ? 50 : 100;
this.chunkSize = this.messageLimit / 2;
this.msgid = msgid || 0;
this.visible = true;
this.forceScroll = false;
this.lastScrollPosition = 0;
share/static/alice.js view on Meta::CPAN
this.messageLimit += this.chunkSize;
}
else {
first = this.msgid;
}
this.application.log("requesting chunk" + first);
this.tab.addClassName("loading");
this.application.getBacklog(this, first, this.chunkSize);
}
else {
clearTimeout(this.scrollListener);
this.scrollListener = setTimeout(this.checkScrollBack.bind(this), 1000);
}
},
clearMessages: function() {
clearTimeout(this.scrollListener);
this.messages.update("");
this.lastNick = "";
},
updateTabLayout: function() {
this.tab_layout = this.tab.getLayout();
},
getTabPosition: function() {
var shift = this.application.tabShift();
share/static/alice.js view on Meta::CPAN
else if (pos.right) {
this.application.shiftTabs(-pos.right);
}
},
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);
this.visibleNick = li;
var nick;
if (li.hasClassName("consecutive")) {
var stem = li.previous("li:not(.consecutive)");
if (!stem) return;
nick = stem.down("span.nick");
} else {
nick = li.down("span.nick");
}
if (nick) {
this.visibleNickTimeout = setTimeout(function(nick) {
if (nick) nick.style.opacity = 1;
setTimeout(function(){
if (this.application.overlayVisible) return;
if (nick) nick.style.opacity = 0;
}.bind(this, nick) , 1000);
}.bind(this, nick), 500);
}
}
else {
this.visibleNick = "";
clearTimeout(this.visibleNickTimeout);
}
},
focus: function(event) {
if (!this.application.currentSetContains(this)) return;
this.application.previousFocus = this.application.activeWindow();
if (this != this.application.previousFocus)
this.application.previousFocus.unFocus();
this.element.addClassName('active');
this.tab.addClassName('active');
if (!this.active) {
this.active = true;
setTimeout(function(){
this.scrollToPosition(this.lastScrollPosition);
if (!this.scrollBackEmpty) this.checkScrollBack();
}.bind(this), 0);
}
this.application.setSource(this.id);
this.application.displayNicks(this.nicks);
this.markRead();
this.setWindowHash();
share/static/alice.js view on Meta::CPAN
);
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;
}
var position = this.captureScrollPosition();
if (chunk['range'][0] > this.msgid) {
share/static/alice.js view on Meta::CPAN
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);
},
addMessage: function(message) {
if (!message.html || message.msgid <= this.msgid) return;
if (message.msgid) this.msgid = message.msgid;
if (message.nicks) this.updateNicks(message.nicks);
var position = this.captureScrollPosition();
share/static/alice.js view on Meta::CPAN
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);
};
};
window.onresize = resize;
var move = function(e) {
var width = document.viewport.getWidth();
var left = windows.hasClassName('nicklist') ? 200 : 100;
var visible = toggle.hasClassName('visible');
if (!visible && width - e.pointerX() > left)
share/static/alice.js view on Meta::CPAN
toggle.addClassName('visible');
var end = function() {
toggle.removeClassName('visible');
window.onmousemove = move;
};
var end_timer;
window.onmousemove = function() {
clearTimeout(end_timer);
end_timer = setTimeout(end, 1000);
};
};
window.onmousemove = move;
window.onfocus = function () {
alice.input.focus();
alice.freeze();
alice.tabs_width = $('tabs_container').getWidth();
share/static/alice.js view on Meta::CPAN
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);