Acme-MUDLike
view release on metacpan or search on metacpan
lib/Acme/MUDLike.pm view on Meta::CPAN
# $request->print("Got message.\n");
$request->print($self->get_html_messages());
$request->next;
}
}
#
# players get three execution contexts:
# * one for AJAX message posts without header/footer in the reply
# * one for COMET message pulls
# * the main HTML one below (which might only run once); arbitrarily selected as being the main one cuz its longest
#
$floor->insert($self);
while(1) {
$request->print(header);
#
# chat/commands
lib/Acme/MUDLike.pm view on Meta::CPAN
};
$self->current_item = $ob;
}
sub _eval {
my $self = shift;
my $cmd = join ' ', @_;
no warnings 'redefine';
# *print = sub { $self->tell_object(@_); }; # this doesn't work reliablely due to possible context changes but worth a shot
# *say = sub { $self->tell_object("@_\n"); }; # ack... doesn't work at all.
select $self->request->{request}->{conn}; # would rather it went into their message buffer but comprimising for now
my $res = eval($cmd) || "Error: ``$@''.";
$self->tell_object("eval:\n$res");
}
sub _who {
my $self = shift;
$self->_look(@_); # for now
}
sub _look {
lib/Acme/MUDLike.pm view on Meta::CPAN
* $Rev: 1465 $
*/
// Global undefined variable
window.undefined = window.undefined;
var jQuery = function(a,c) {
// If the context is global, return a new object
if ( window == this )
return new jQuery(a,c);
// Make sure that a selection was provided
a = a || document;
// HANDLE: $(function)
// Shortcut for document ready
if ( jQuery.isFunction(a) )
return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a );
// Handle HTML strings
if ( typeof a == "string" ) {
// HANDLE: $(html) -> $(array)
lib/Acme/MUDLike.pm view on Meta::CPAN
// HANDLE: $(expr)
else
return new jQuery( c ).find( a );
}
return this.setArray(
// HANDLE: $(array)
a.constructor == Array && a ||
// HANDLE: $(arraylike)
// Watch for when an array-like object is passed as the selector
(a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) ||
// HANDLE: $(*)
[ a ] );
};
// Map over the $ in case of overwrite
if ( typeof $ != "undefined" )
jQuery._$ = $;
lib/Acme/MUDLike.pm view on Meta::CPAN
arg = arg.toString();
// Convert html string into DOM nodes
if ( typeof arg == "string" ) {
// Trim whitespace, otherwise indexOf won't work as expected
var s = jQuery.trim(arg), div = document.createElement("div"), tb = [];
var wrap =
// option or optgroup
!s.indexOf("<opt") &&
[1, "<select>", "</select>"] ||
(!s.indexOf("<thead") || !s.indexOf("<tbody") || !s.indexOf("<tfoot")) &&
[1, "<table>", "</table>"] ||
!s.indexOf("<tr") &&
[2, "<table><tbody>", "</tbody></table>"] ||
// <thead> matched above
(!s.indexOf("<td") || !s.indexOf("<th")) &&
[3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
lib/Acme/MUDLike.pm view on Meta::CPAN
"for": "htmlFor",
"class": "className",
"float": jQuery.browser.msie ? "styleFloat" : "cssFloat",
cssFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
innerHTML: "innerHTML",
className: "className",
value: "value",
disabled: "disabled",
checked: "checked",
readonly: "readOnly",
selected: "selected"
};
// IE actually uses filters for opacity ... elem is actually elem.style
if ( name == "opacity" && jQuery.browser.msie && value != undefined ) {
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
elem.zoom = 1;
// Set the alpha filter to set the opacity
return elem.filter = elem.filter.replace(/alpha\([^\)]*\)/gi,"") +
lib/Acme/MUDLike.pm view on Meta::CPAN
contains: "jQuery.fn.text.apply([a]).indexOf(m[3])>=0",
// Visibility
visible: 'a.type!="hidden"&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"',
hidden: 'a.type=="hidden"||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',
// Form attributes
enabled: "!a.disabled",
disabled: "a.disabled",
checked: "a.checked",
selected: "a.selected||jQuery.attr(a,'selected')",
// Form elements
text: "a.type=='text'",
radio: "a.type=='radio'",
checkbox: "a.type=='checkbox'",
file: "a.type=='file'",
password: "a.type=='password'",
submit: "a.type=='submit'",
image: "a.type=='image'",
reset: "a.type=='reset'",
button: 'a.type=="button"||jQuery.nodeName(a,"button")',
input: "/input|select|textarea|button/i.test(a.nodeName)"
},
".": "jQuery.className.has(a,m[2])",
"@": {
"=": "z==m[4]",
"!=": "z!=m[4]",
"^=": "z&&!z.indexOf(m[4])",
"$=": "z&&z.substr(z.length - m[4].length,m[4].length)==m[4]",
"*=": "z&&z.indexOf(m[4])>=0",
"": "z",
_resort: function(m){
lib/Acme/MUDLike.pm view on Meta::CPAN
} else if ( !t.indexOf("/") ) {
context = context.documentElement;
t = t.substr(1,t.length);
if ( t.indexOf("/") >= 1 )
t = t.substr(t.indexOf("/"),t.length);
}
// Initialize the search
var ret = [context], done = [], last = null;
// Continue while a selector expression exists, and while
// we're no longer looping upon ourselves
while ( t && last != t ) {
var r = [];
last = t;
t = jQuery.trim(t).replace( /^\/\//i, "" );
var foundToken = false;
// An attempt at speeding up child selectors that
// point to a specific element tag
var re = /^[\/>]\s*([a-z0-9*-]+)/i;
var m = re.exec(t);
if ( m ) {
// Perform our own iteration and filter
jQuery.each( ret, function(){
for ( var c = this.firstChild; c; c = c.nextSibling )
if ( c.nodeType == 1 && ( jQuery.nodeName(c, m[1]) || m[1] == "*" ) )
r.push( c );
lib/Acme/MUDLike.pm view on Meta::CPAN
if ( !t.indexOf(",") ) {
// Clean the result set
if ( ret[0] == context ) ret.shift();
// Merge the result sets
jQuery.merge( done, ret );
// Reset the context
r = ret = [context];
// Touch up the selector string
t = " " + t.substr(1,t.length);
} else {
// Optomize for the case nodeName#idName
var re2 = /^([a-z0-9_-]+)(#)([a-z0-9\\*_-]*)/i;
var m = re2.exec(t);
// Re-organize the results, so that they're consistent
if ( m ) {
m = [ 0, m[2], m[3], m[1] ];
} else {
// Otherwise, do a traditional filter check for
// ID, class, and element selectors
re2 = /^([#.]?)([a-z0-9\\*_-]*)/i;
m = re2.exec(t);
}
// Try to do a global search by ID, where we can
if ( m[1] == "#" && ret[ret.length-1].getElementById ) {
// Optimization for HTML document case
var oid = ret[ret.length-1].getElementById(m[2]);
// Do a quick check for the existence of the actual ID attribute
// to avoid selecting by the name attribute in IE
if ( jQuery.browser.msie && oid && oid.id != m[2] )
oid = jQuery('[@id="'+m[2]+'"]', ret[ret.length-1])[0];
// Do a quick check for node name (where applicable) so
// that div#foo searches will be really fast
ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];
} else {
// Pre-compile a regular expression to handle class searches
if ( m[1] == "." )
lib/Acme/MUDLike.pm view on Meta::CPAN
}
ret = r;
}
t = t.replace( re2, "" );
}
}
// If a selector string still exists
if ( t ) {
// Attempt to filter it
var val = jQuery.filter(t,r);
ret = r = val.r;
t = jQuery.trim(val.t);
}
}
// Remove the root context
if ( ret && ret[0] == context ) ret.shift();
lib/Acme/MUDLike.pm view on Meta::CPAN
// Remove event lisenter to avoid memory leak
if ( jQuery.browser.mozilla || jQuery.browser.opera )
document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
}
}
});
new function(){
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," +
"submit,keydown,keypress,keyup,error").split(","), function(i,o){
// Handle event binding
jQuery.fn[o] = function(f){
return f ? this.bind(o, f) : this.trigger(o);
};
});
// If Mozilla is used
( run in 0.801 second using v1.01-cache-2.11-cpan-49f99fa48dc )