view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
# It's in core of perl >= 5.9.3, and should be installed
# as one of the Pod::Simple's prereqs, which is a prereq
# of Pod::Text 3.x (see also below).
$author =~ s{ E<( (\d+) | ([A-Za-z]+) )> }
{
defined $2
? chr($2)
: defined $Pod::Escapes::Name2character_number{$1}
? chr($Pod::Escapes::Name2character_number{$1})
: do {
warn "Unknown escape: E<$1>";
"E<$1>";
};
}gex;
}
elsif (eval "require Pod::Text; 1" && $Pod::Text::VERSION < 3) {
# Pod::Text < 3.0 has yet another mapping table,
# though the table name of 2.x and 1.x are different.
# (1.x is in core of Perl < 5.6, 2.x is in core of
# Perl < 5.9.3)
my $mapping = ($Pod::Text::VERSION < 2)
? \%Pod::Text::HTML_Escapes
: \%Pod::Text::ESCAPES;
$author =~ s{ E<( (\d+) | ([A-Za-z]+) )> }
{
defined $2
? chr($2)
: defined $mapping->{$1}
? $mapping->{$1}
: do {
warn "Unknown escape: E<$1>";
"E<$1>";
};
}gex;
}
else {
$author =~ s{E<lt>}{<}g;
$author =~ s{E<gt>}{>}g;
}
$self->author($author);
} else {
share/static/alice.js view on Meta::CPAN
}
if (!proto.toISOString) proto.toISOString = toISOString;
if (!proto.toJSON) proto.toJSON = toJSON;
})(Date.prototype);
RegExp.prototype.match = RegExp.prototype.test;
RegExp.escape = function(str) {
return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
};
var PeriodicalExecuter = Class.create({
initialize: function(callback, frequency) {
this.callback = callback;
this.frequency = frequency;
this.currentlyExecuting = false;
this.registerCallback();
},
share/static/alice.js view on Meta::CPAN
if (Object.isFunction(replacement)) return replacement;
var template = new Template(replacement);
return function(match) { return template.evaluate(match) };
}
function gsub(pattern, replacement) {
var result = '', source = this, match;
replacement = prepareReplacement(replacement);
if (Object.isString(pattern))
pattern = RegExp.escape(pattern);
if (!(pattern.length || pattern.source)) {
replacement = replacement('');
return replacement + source.split('').join(replacement) + replacement;
}
while (source.length > 0) {
if (match = source.match(pattern)) {
result += source.slice(0, match.index);
result += String.interpret(replacement(match));
share/static/alice.js view on Meta::CPAN
matchOne = new RegExp(Prototype.ScriptFragment, 'im');
return (this.match(matchAll) || []).map(function(scriptTag) {
return (scriptTag.match(matchOne) || ['', ''])[1];
});
}
function evalScripts() {
return this.extractScripts().map(function(script) { return eval(script) });
}
function escapeHTML() {
return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
}
function unescapeHTML() {
return this.stripTags().replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&');
}
function toQueryParams(separator) {
var match = this.strip().match(/([^?#]*)(#.*)?$/);
if (!match) return { };
return match[1].split(separator || '&').inject({ }, function(hash, pair) {
if ((pair = pair.split('='))[0]) {
share/static/alice.js view on Meta::CPAN
.replace(/([a-z\d])([A-Z])/g, '$1_$2')
.replace(/-/g, '_')
.toLowerCase();
}
function dasherize() {
return this.replace(/_/g, '-');
}
function inspect(useDoubleQuotes) {
var escapedString = this.replace(/[\x00-\x1f\\]/g, function(character) {
if (character in String.specialChar) {
return String.specialChar[character];
}
return '\\u00' + character.charCodeAt().toPaddedString(2, 16);
});
if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
return "'" + escapedString.replace(/'/g, '\\\'') + "'";
}
function unfilterJSON(filter) {
return this.replace(filter || Prototype.JSONFilter, '$1');
}
function isJSON() {
var str = this;
if (str.blank()) return false;
str = str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@');
share/static/alice.js view on Meta::CPAN
return {
gsub: gsub,
sub: sub,
scan: scan,
truncate: truncate,
strip: String.prototype.trim || strip,
stripTags: stripTags,
stripScripts: stripScripts,
extractScripts: extractScripts,
evalScripts: evalScripts,
escapeHTML: escapeHTML,
unescapeHTML: unescapeHTML,
toQueryParams: toQueryParams,
parseQuery: toQueryParams,
toArray: toArray,
succ: succ,
times: times,
camelize: camelize,
capitalize: capitalize,
underscore: underscore,
dasherize: dasherize,
inspect: inspect,
share/static/alice.js view on Meta::CPAN
results.push(value);
});
return results;
}
function grep(filter, iterator, context) {
iterator = iterator || Prototype.K;
var results = [];
if (Object.isString(filter))
filter = new RegExp(RegExp.escape(filter));
this.each(function(value, index) {
if (filter.match(value))
results.push(iterator.call(context, value, index));
});
return results;
}
function include(object) {
if (Object.isFunction(this.indexOf))
share/static/alice.js view on Meta::CPAN
return this.transport.getResponseHeader(name);
},
getAllResponseHeaders: function() {
return this.transport.getAllResponseHeaders();
},
_getHeaderJSON: function() {
var json = this.getHeader('X-JSON');
if (!json) return null;
json = decodeURIComponent(escape(json));
try {
return json.evalJSON(this.request.options.sanitizeJSON ||
!this.request.isSameOrigin());
} catch (e) {
this.request.dispatchException(e);
}
},
_getResponseJSON: function() {
var options = this.request.options;
share/static/alice.js view on Meta::CPAN
"=":"+",
";":":",
"'":"\"",
",":"<",
".":">",
"/":"?",
"\\":"|"
}
var special_keys = {
'esc':27,
'escape':27,
'tab':9,
'space':32,
'return':13,
'enter':13,
'backspace':8,
'scrolllock':145,
'scroll_lock':145,
'scroll':145,
'capslock':20,
share/static/alice.js view on Meta::CPAN
nick = nick.replace(/\s+$/, "");
clean.push("<"+nick+">");
}
if (message) {
var body = message.innerHTML.stripTags();
body = body.replace(/^\s+/, "");
body = body.replace(/\s+$/, "");
clean.push(body);
}
if (clean.length) lines.push(
clean.join(" ").replace(/\n/g, "").escapeHTML());
});
node.update(lines.join("<br>"));
node.cleanWhitespace();
},
epochToLocal: function(epoch, format) {
var date = new Date(parseInt(epoch) * 1000);
if (!date) return epoch;
var hours = date.getHours();
share/static/alice.js view on Meta::CPAN
var children = elem.childNodes;
var length = children.length;
for (var i=0; i < length; i++) {
var node = children[i];
if (node.nodeName != "#text") {
Alice.makeLinksClickable(node);
}
else if (node.nodeValue.match(Alice.RE.url)) {
var span = new Element("SPAN");
span.innerHTML = node.nodeValue.escapeHTML().replace(
Alice.RE.url, '<a href="$1" target="_blank" rel="noreferrer">$1</a>');
node.parentNode.replaceChild(span, node);
}
}
},
growlNotify: function(message) {
if (window.fluid) {
window.fluid.showGrowlNotification({
title: message.subject,
share/static/alice.js view on Meta::CPAN
});
alice.input.disabled = false;
$('join').remove();
},
tabsets: {
addSet: function () {
var name = prompt("Please enter a name for this tab set.");
if (name && !Alice.tabsets.hasTabset(name)) {
Alice.tabsets.clearActive();
$('sets').insert('<li class="active">'+name.escapeHTML()+'</li>');
var list = $('empty_tabset').clone(true).addClassName('active').show();
list.id = null;
$('tabset_data').insert(list);
}
else {
alert("Invalid tab set name.");
}
},
hasTabset: function (name) {
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';
share/static/alice.js view on Meta::CPAN
},
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);
share/static/alice.js view on Meta::CPAN
displayNicks: function(nicks) {
this.nicklist.innerHTML = nicks.sort(function(a, b) {
a = a.toLowerCase();
b = b.toLowerCase();
if (a > b)
return 1
if (a < b)
return -1
return 0;
}).map(function(nick) {
return '<li><a>'+nick.escapeHTML()+'</a></li>';
}).join("");
},
toggleNicklist: function() {
var windows = $('windows');
var win = this.activeWindow();
var position = win.captureScrollPosition();
if (windows.hasClassName('nicklist'))
windows.removeClassName('nicklist');
else
share/static/alice.js view on Meta::CPAN
this.togglePrefs();
} else if (text.match(/Connections/)) {
this.toggleConfig();
}
$$('.dropdown.open').invoke("removeClassName", "open");
}.bind(this));
$('tabset_dropdown').on(click, ".dropdown li span", function(e,li) {
e.stop();
var name = li.innerHTML.unescapeHTML();
if (name == "Edit Sets")
this.toggleTabsets();
else if (name == "All tabs")
this.clearSet(li);
else if (this.tabsets[name])
this.showSet(name);
$$('.dropdown.open').invoke("removeClassName", "open");
}.bind(this));
share/static/alice.js view on Meta::CPAN
},
function(li, win) {
if (this.options.alerts != "show" && this.options.audio != "show") return;
if (this.isFocused || win.bulk_insert || li.hasClassName("self")) return;
if (li.hasClassName("highlight") || win.type == "privmsg") {
var prefix = "";
if (win.type != "privmsg")
prefix = li.down("span.nick").innerHTML.stripTags().unescapeHTML() + " in ";
var message = {
body: li.down(".msg").innerHTML.stripTags().unescapeHTML(),
subject: prefix + win.title.stripTags().unescapeHTML()
};
var time = (new Date()).getTime();
if (time - this.lastnotify > 5000) {
this.lastnotify = time;
if (this.options.alerts == "show")
Alice.growlNotify(message);
if (this.options.audio == "show") {
this.beep.currentTime = 0;
this.beep.play();
share/static/alice.js view on Meta::CPAN
},
showAlert: function (message) {
this.messages.insert(
"<li class='event notice'><div class='msg'>"+message+"</div></li>"
);
this.scrollToPosition(0);
},
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");
},
share/static/alice.js view on Meta::CPAN
}.bind(this);
xhr.send(fd);
return;
}
}
}
var text = e.clipboardData.getData("Text");
if (text) {
e.preventDefault();
text = text.escapeHTML().replace(/\n+/g, "<br>\n");
this.editor.insertHTML(text);
this.updateRange();
return;
}
var url = e.clipboardData.getData("URL");
if (url) {
e.preventDefault();
this.editor.insertHTML(url);
this.updateRange();
share/static/alice.js view on Meta::CPAN
right.push(chr);
}
this.stem = left.concat(right).join("");
this.stemLeft = this.value.substr(0, this.index - left.length);
this.stemRight = this.value.substr(this.index + right.length);
this.leftOffset = this.index - left.length;
},
matchAgainst: function(candidates) {
return candidates.grep(new RegExp("^" + RegExp.escape(this.stem), "i"));
}
});
Alice.Completion.PATTERN = /[A-Za-z0-9\[\\\]^_{|}-]/;
if (window == window.parent) {
document.observe("dom:loaded", function () {
var alice = new Alice.Application();
window.alice = alice;