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
}
else if (window.webkitNotifications) {
if (window.webkitNotifications.checkPermission() == 0) {
var popup = window.webkitNotifications.createNotification(
"http://static.usealice.org/image/alice.png",
message.window.title + ": " + message.nick,
message.body.unescapeHTML()
);
popup.ondisplay = function() {
setTimeout(function () {popup.cancel();}, 3000);
};
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
}
else if (image.width > maxWidth) {
image.style.height = 'auto';
image.style.width = maxWidth + 'px';
}
else {
image.style.height = 'auto';
}
image.style.display = 'block';
image.style.visibility = 'visible';
setTimeout(function () {
var messagelist = image.up(".message_wrap");
messagelist.scrollTop = messagelist.scrollHeight;
}, 50);
},
playAudio: function(image, audio) {
image.src = '/static/image/pause.png';
if (! audio) {
var url = image.nextSibling.href;
audio = new Audio(url);
share/static/alice.js view on Meta::CPAN
this.window_map = new Hash();
this.previousFocus = 0;
this.connection = new Alice.Connection(this);
this.filters = [];
this.keyboard = new Alice.Keyboard(this);
this.isPhone = window.navigator.platform.match(/(android|iphone)/i) ? 1 : 0;
this.isMobile = this.isPhone || Prototype.Browser.MobileSafari;
window.onload = function () {
setTimeout(this.connection.connect.bind(this.connection), 1000);
}.bind(this);
this.makeSortable();
},
actionHandlers: {
join: function (action) {
var win = this.getWindow(action['window'].id);
if (!win) {
this.insertWindow(action['window'].id, action.html);
share/static/alice.js view on Meta::CPAN
reconnect: function () {
this.reconnecting = true;
this.reconnect_count = 0;
this.connect();
},
handleException: function(request, exception) {
console.log("encountered an error with stream.");
if (!this.aborting)
setTimeout(this.connect.bind(this), 2000);
},
handleComplete: function(transport) {
console.log("connection was closed cleanly.");
if (!this.aborting)
setTimeout(this.connect.bind(this), 2000);
},
handleUpdate: function(transport) {
if (this.reconnecting) {
this.application.activeWindow().showHappyAlert("Reconnected to the Alice server");
this.reconnecting = false;
}
this.reconnect_count = 0;
var time = new Date();
var data = transport.responseText.slice(this.len);
share/static/alice.js view on Meta::CPAN
}
},
requestWindow: function(title, windowId, message) {
new Ajax.Request('/say', {
method: 'post',
parameters: {source: windowId, msg: "/create " + title},
onSuccess: function (transport) {
this.handleUpdate(transport);
if (message) {
setTimeout(function() {
this.application.displayMessage(message)
}.bind(this), 1000);
}
}.bind(this)
});
},
closeWindow: function(win) {
new Ajax.Request('/say', {
method: 'post',
share/static/alice.js view on Meta::CPAN
} else {
this.topic.setStyle({height: orig_height});
}
}.bind(this));
}
this.messages = this.element.down('.message_wrap');
this.submit = $(this.id + "_submit");
this.nicksVisible = false;
this.visibleNick = "";
this.visibleNickTimeout = "";
this.nicks = [];
this.messageLimit = 250;
this.submit.observe("click", function (e) {this.input.send(); e.stop()}.bind(this));
this.tab.observe("mousedown", function(e) {
if (!this.active) {this.focus(); this.focusing = true}
}.bind(this));
this.tab.observe("click", function(e) {this.focusing = false}.bind(this));
share/static/alice.js view on Meta::CPAN
}
else if (this.application.isMobile) {
this.messageLimit = 50;
this.messages.select("li").reverse().slice(50).invoke("remove");
}
if (this.active) this.scrollToBottom(true);
this.makeTopicClickable();
setTimeout(function () {
this.messages.select('li.message div.msg').each(function (msg) {
msg.innerHTML = application.applyFilters(msg.innerHTML);
});
}.bind(this), 1000);
},
isTabWrapped: function() {
return this.tab.offsetTop > 0;
share/static/alice.js view on Meta::CPAN
this.input.uncancelNextFocus();
this.element.removeClassName('active');
this.tab.removeClassName('active');
this.tabOverflowButton.selected = false;
},
showNick: function (e) {
var li = e.findElement("#" + this.id + " ul.messages li.message");
if (li) {
if (this.nicksVisible || li == this.visibleNick) return;
clearTimeout(this.visibleNickTimeout);
this.visibleNick = li;
var nick; var time;
if (li.hasClassName("consecutive")) {
var stem = li.previous("li:not(.consecutive)");
if (!stem) return;
nick = stem.down(".nickhint");
time = stem.down(".timehint");
} else {
nick = li.down(".nickhint");
time = li.down(".timehint");
}
if (nick || time) {
this.visibleNickTimeout = setTimeout(function(nick, time) {
if (nick) {
nick.style.opacity = 1;
nick.style.webkitTransition = "opacity 0.1s ease-in-out";
}
if (time) {
time.style.webkitTransition = "opacity 0.1s ease-in-out";
time.style.opacity = 1;
}
setTimeout(function(){
if (this.nicksVisible) return;
if (nick) {
nick.style.webkitTransition = "opacity 0.25s ease-in";
nick.style.opacity = 0;
}
if (time) {
time.style.webkitTransition = "opacity 0.25s ease-in";
time.style.opacity = 0;
}
}.bind(this, nick, time) , 1000);
}.bind(this, nick, time), 500);
}
}
else {
this.visibleNick = "";
clearTimeout(this.visibleNickTimeout);
}
},
toggleNicks: function () {
if (this.nicksVisible) {
this.messages.select("span.nickhint").each(function(span){
span.style.webkitTransition = "opacity 0.1s ease-in";
span.style.opacity = 0;
});
this.messages.select("div.timehint").each(function(span){
share/templates/index_footer.html view on Meta::CPAN
<? for my $window (@windows) { ?>
alice.openWindow(
'<?= $window->id ?>',
'<?= $window->title ?>',
<?= $window->{active} ? "true" : "false" ?>,
'<?= $window->hashtag ?>'
);
<? } ?>
alice.focusHash(orig_hash);
// required due to browser weirdness with scrolltobottom on initial focus
setTimeout(function(){alice.activeWindow().scrollToBottom(true)}, 1);
});
</script>
</div>
</div>
<?= $_mt->render_file('help.html', $_[0]) ?>
</body>
</html>