Javascript/AJAX Multiplayer Gaming Library?

Mar 15, 2007

does anyone know of any way to allow for multiplayer interaction using Javascript/AJAX calls?

I am looking at two (or more) players visiting the same webpage and interacting with one another to play a text/browser based game (non-Flashed based).

Any ideas on how to do this using JS/PHP and mySQL?

View 1 Replies


ADVERTISEMENT

Gaming In C# - Practice Mathematical Skills Through Gaming ?

Jun 18, 2011

I want to create a website where you can practice mathematical skills through gaming, but I don't know which web program will be the best for that type of game. I want to learn javascript because I know it is the most widely used language, but I also want to use c# because I have more knowledge in c++ so I'm guessing it will be easier for me to use. And then there's flashplayer, which I've heard is even more easier to use out of all of them. So I ask which console is the best choice?

View 1 Replies View Related

JavaScript GUI Library Idea

Mar 25, 2006

I've been asking questions about library design over the last week and
would like to get feedback on my overall idea for a JavaScript GUI
library. I need a nice GUI library so there is a good chance I will
write this as I need new widgets. I haven't found anything like this
and I'm surprised/disapointed this doesn't already exist. My library
prototype works nicely. I think parts of these ideas are not commonly
used for JavaScript library development and before I dive in too deeply
any experienced advice might make my efforts a lot better.

While trying to develop a rich GUI for a web app backend I started
needing a large set of GUI widgets that behaved and were coded
similarly. Things like flyout menus, drop down menubars, tree menus,
adjustable table widths, spinners...all the things that are in Java
Swing or other GUI widget libraries. Yes I know all of these things
exist individually as JavaScripts but I would like to build a library
that uses a class hierarchy structure and inheritance to take advantage
of all the nice OOP ideas of encapsulation etc. Certainly this library
will be different than a desktop app GUI library since HTML, CSS and
the browser already provide a lot of what is needed (<ul>'s for menus,
<table> for tables, all sorts of font display stuff, some form
elements). In JavaScript we are adding functionality on top of what the
browser already gives us.

This could end up being a big library but if each class is in it's own
file and the class hierarchy is known then people could string together
only the pieces they need. I would like a develop a way to automate
this step. Something like compiling one JavaScript file with all you
need for your page from the big library.....

View 21 Replies View Related

The JavaScript Library World Cup

Jun 14, 2006

This is an article discussion thread for discussing the SitePoint article, "The JavaScript Library World Cup"

View 24 Replies View Related

Classes In Javascript Using Prototype Library

Feb 9, 2006

I've been using the prototype.js library[1] to create classes. Something like:

var Sortable = Class.create();
Sortable.prototype = {
initialize: function(element) {
//...
},
// more methods...
}

All of my methods are instance methods. What is the tidiest way to
create class methods and variables?

View 6 Replies View Related

Library Of Practical JavaScript Examples

Jul 18, 2006

I'm looking for a library of practical JavaScript examples.

View 7 Replies View Related

JQuery :: Another JS Library : Target Element Added To Other JS Library?

Apr 8, 2010

I am using GreaseMonkey to load jQuery 1.3.2 (there is a bug with the latest version of jquery and GM) and jQuery UI 1.8.0.I am using jQuery via GM to manipulate the GUI of a content management system. This CMS uses its own JS library to dynamically add stuff to the dom.

Question:How can I target a dom element that was added to the dom via this other JS lib?In other words, the CMS will add a div to the dom, and I am not sure how to tell jquery to wait for these elements to "be there" before applying the jquery goodness. Specifically, I would like to do this:

$(function() {
$('#zen1227').resizable();
});

But "#zen1227" does not "appear" until later via this other JS library.

View 4 Replies View Related

Ajax :: How To Abort Request When Using Toolbox Library

May 31, 2009

Normally I would abort my request this way:
Code:
var myRequest=new XMLHttpRequest;
...
myRequest.abort();
But how would I abort my request when I'm making it using the Ajax Toolbox library? In their documentation I saw there is "aborted" which only tells me whether the request has been aborted or not so there must be a way to abort it.

View 2 Replies View Related

AJAX :: Call To Specific Funtion In Library

May 26, 2009

I want to make AJAX call to specific funtion in library. Is there a way not to create new file for this?

View 5 Replies View Related

AJAX, Eval(), And Javascript Within Javascript

Apr 28, 2006

Ok so, this is my purpose:
- to be able to load asynchronously (via AJAX) some javascript ads (like google's or adbrite) so as to make them be loaded in the background, then update the page after the ads have loaded via innerHTML

Why?
-Because 90% of the time in my newer sites, javascript ads are the major offender in terms of speed of page rendering

My problem:
Via ajax, I can call a php file that retrieves some javascript and outputs it, XMLhttprequest returns those javascript lines, but they don't render in the page, since they miss the whole page loading, and are apparently not parsed
For example, let's say I call a php file via ajax, and it returns the output into a variable named "text" containing "document.write('hello')"
if I use xxx.innerHTML=text, nothing happens

My 1st solution:
Passing those javascript lines to eval() [like eval(text) ], but this produces a second problem, that I couldn't solve (probably because of my lack of knowledge in javascipt):
if I eval the code, it deletes my current page and renders a new one
for example, if I parse a document.write, my page disappears, and a new one is rendered with the document.write text

What I want is basically to make that "document.write" appear inside a div in my page, adding to the content (and not overwriting the whole page), much like what happens when using innerHTML

Is this even possible? How would you go about it?
I tried xxx.innerHTML=eval(outputfromphpfile) but it overwrites my whole page...

View 3 Replies View Related

Css Library

Jun 14, 2006

I would like to know if there exists a javascript library (at least for
IE and Firefox) that let me get css properties in a more structured way.
I would like to have a css value that seperates the size/length value
from the type. For example:

width: 2.5em
size=2.5
type=em

And most importantly I would like a way to convert each such value into
pixels.

Does it exist? I am aware of the CSSStyleDeclaration and related methods
in Firefox.

If not, is it possible to convert such a value as 2.5em into pixels in
javascript? Sometimes the standard available methods that return pixels
cannot calculate the value I need. For example calculating the border size.

View 2 Replies View Related

Library

Jul 20, 2005

I want to have one statement in my web page that includes a single file (for
example "Mylib.inc" that contains a list of ".js" files to include. Is that possible? And if so can some one show me the basic format to use?

This would allow me to add and remove scripts from my pages without having to edit each page, only w3ouyld need to make a change in the MyLib.inc file I'm envisioning MyLib.inc to look something like this:

<script src="scriptname1.js"></script>
<script src="scriptname2.js"></script>
<script src="scriptname3.js"></script>
<script src="scriptname4.js"></script>

Another thought: Can .css files also be put in there? (probably not huh.) so
i could include everything with one include in my web page?

View 8 Replies View Related

Use Reg-ex Library ?

Nov 20, 2010

How to use reg-ex library in java script

View 2 Replies View Related

GUI For GD Library

Jan 11, 2007

I know nothing about javascript at the moment, but I've been hitting php very aggressively the past few months.

I've came across a challenge and I'm not sure how to go about fixing it.

Basically, I need to be able to drag an image into a box on my webpage, crop it, and then upload it. I've done basic image uploading and resizing with php. That's no big deal.

The problem is I may want to crop in different spots. The idea is to have some sort of box tool that is set at a given aspect ratio (like Photoshop does). Then, I could select the part of the image I wanted to keep, hit one button that would then crop, resize, and upload the image (storing the pathway to the MySQL database).

So does anyone know of any either standalone GUI's that work well for this sort of image manipulation or possibly a javascript that will allow me to select part of the image and spit out some co-ordinates that I could use with php's GD Library.

View 3 Replies View Related

Media Library

Nov 23, 2005

I would like to know if there is somewhere a JS library for managing
media content depends on the client's default media player. The player
can be QT, WMP, or any other players.

the idea is to code something like this :

var m = new MediaPlayer('my_media_file.ext');
m.display(); // generate a running code to display the media

and the object can be control by a set of method :
m.play();
m.pause();
m.stop();

View 1 Replies View Related

How To Build A Library In JS

Aug 16, 2006

I am new to javascript and intend to build a custom library. After
saving independent files which contain separate functions, how does one
build the library?

View 2 Replies View Related

Line Drawing Library

Jul 23, 2005

Is there a small graphics library that I can use? All I need to do is
draw a line of a nominated thickness and colour between two specified
points and to, at some later time, "delete" the line?

I've found a few offerings but either they weren't multi-browser
compatible or they were too big for me to consider (20K instead of 2 or 3K).

View 8 Replies View Related

Library For Unit Conversion?

Apr 20, 2007

Is there a free js library for doing unit conversions? I am putting
together an app that needs to convert volume and weight, among
others. You'd think that one exists, but I have yet to find it.

View 2 Replies View Related

How To Create A Virtual Library

Jun 7, 2011

I started studying javascript when I decided that I wanted to create a dynamic webpage after viewing some books that were made to pageflip with Javascript and after viewing a ton of animations. So I figured since everyone keeps saying Javascript is simple that if all I wanted to do was to make a book extend outwards on mouseover and then open up on click and flip pages which they already have a code for that it wouldn't be so difficult. I've read everything I could practiced a little bit, I'm not fluent but I do have a goal and a time. The problem for me comes up with figuring out what I need to do in order to make it appear as if the book is coming out of a book shelf. There is a lot of information on animations where flat objects rise above clouds.

I am thinking that I would have to use some sort of sprite of a row of books both sorta sideways where you can see the side of the book as well as the edge, and both a row of books on a shelf, or perhaps a row of books with some of the books being pulled out and then on mouse over animate the scene so that it looks like the book is being pulled out. Would that work? Or is there a simpler way? Another way or I don't know. Is there a code that can make it look like a book is extending outwards without an animation or would I need to create an animation for that?

View 3 Replies View Related

Drag And Drop Library

Jan 11, 2006

After a good deal of internal development, I've decided this library will do more good in the wild. It works in IE6, Safari 2, Opera 9, Firefox 1.5, and IE5.5/Mac (sort of buggy behavior with text selection in IE5.5/Mac though). It should also work in virtually any version of Gecko, Opera 6+, Safari 1, and IE5+ (anybody who wants to test those, feel free). The scripting is highly efficient, and only exposes two functions globally, Draggable and Droppable. The below code is licensed under the LGPL, though it is available under other licenses per request.

Let me know if you have any issues with it - this is something I'm interested in maintaining. Also, compared to other scripts, such as script.tac.ulo.us, this is much less code (lots of whitespace/comments could be taken out), and more widely supported across browsers.

Other than below, it can be found here: http://www.jasonkarldavis.com/scripts/dragdropable/dragdropable.html

// dragdropable.js (1.0.1)
//Copyright (C) 2006 Jason Davis, www.jasonkarldavis.com
//This code is licensed under the LGPL:
//http://www.gnu.org/licenses/lgpl.html
//
// Documentation:
//This script exposes two global variables, Draggable and Droppable. To make an
//element draggable, simply call `Draggable(element)`. This sets the necessary
//CSS properties and event handlers. It also overrides the addEventListener and
//and attachEvent methods (if present) to include the following events:
//onstart(When the element begins dragging)
//ondrag(When the element is being dragged)
//onstop(When the element has stopped dragging)
//You may also assign element.onstart, element.ondrag, and element.onstart to
//add event listeners.
//Lastly, if you need to physically prevent an element from dragging, you may
//call event.preventDefault() from within the onstart handler.
//
//To make an element droppable (have things dragged onto it), call
//`Droppable(element)`. This sets the necessary event handlers and coordinate
//searches. Once again, it overrides addEventListener and attachEvent to
//include the following events:
//onhover(When another element has been dragged over the element)
//ondrop(When another element has been dropped onto the element)
//onunhover(When another element has been dragged off the element)
//As before, you may also set element.onhover, element.ondrop, and
//element.onunhover directly.
//To remove all drop points from the current session, call `Droppable.reset()`.
//
//The event object is also extended with the following properties:
//dragTarget(The element being dragged)
//dropTarget(The element being dropped onto)
//
// Known bugs:
//* removeEventListener and detachEvent do not work with the custom events.
//Workaround: Use direct assignment (element.onevent) instead.
//* There is no way to remove a single drop point.
//Workaround: Call Droppable.reset(), then reinitialize the other drop points.
//* There is no way to remove dragging from an element.
//Workaround: element.onstart = function(event) { event.preventDefault() }
//* Changing position of droppable elements after initialization breaks drop
//Workaround: Static droppables are much faster than moving ones. Either call
//Droppable.reset() and reinitialize often, or ask the author to modify the
//script to account for this (and accept the resulting slowdown)


function Draggable(element) {
// initialize drag variable
var x = 0, y = 0, oldMouseMove, oldMouseUp;

// get style properties of element
var computedStyle;
if (typeof document.defaultView != "undefined" && typeof document.defaultView.getComputedStyle != "undefined")
computedStyle = document.defaultView.getComputedStyle(element, "");
else if (typeof element.currentStyle != "undefined")
computedStyle = element.currentStyle;
else
computedStyle = element.style;

// prep element for dragging
if (computedStyle.position == "static" || computedStyle.position == "")
element.style.position = "relative";
if (computedStyle.zIndex == "auto" || computedStyle.zIndex == "")
element.style.zIndex = 1;
element.style.left = isNaN(parseInt(computedStyle.left)) ? "0" : computedStyle.left;
element.style.top = isNaN(parseInt(computedStyle.top )) ? "0" : computedStyle.top;

// default event listeners
function onstart(event) {
event.dragTarget = element;
x = event.clientX;
y = event.clientY;

// Override preventDefault
event.preventDefault = (function(original) {
return function() {
element.ownerDocument.onmousemove = oldMouseMove;
element.ownerDocument.onmouseup = oldMouseUp;
original.call(event);
}
})(event.preventDefault || function() {});

if (element.onstart) element.onstart(event);
}
function ondrag(event) {
event.dragTarget = element;
element.style.left = parseInt(element.style.left) + event.clientX - x + "px";
element.style.top = parseInt(element.style.top) + event.clientY - y + "px";
x = event.clientX;
y = event.clientY;
Droppable.query(event);

if (element.ondrag) element.ondrag(event);
}
function onstop(event) {
event.dragTarget = element;
Droppable.query(event);

if (element.onstop) element.onstop(event);
}

// make listeners active
element.onmousedown = (function(oldMouseDown) {
return function() {
// Call old listener
if (oldMouseDown) oldMouseDown.apply(this, arguments);

// Store old event handlers
oldMouseMove = this.ownerDocument.onmousemove;
oldMouseUp = this.ownerDocument.onmouseup;

// Setup events
this.ownerDocument.onmousemove = function() {
// Call old listener
if (oldMouseMove) oldMouseMove.apply(this, arguments);

// Call ondrag
ondrag.call(element, arguments[0] || event);

return false;
}
this.ownerDocument.onmouseup = function() {
// Call old listener
if (oldMouseUp) oldMouseUp.apply(this, arguments);

// Call onstop
onstop.call(element, arguments[0] || event);

// Restore old event listeners
this.onmousemove = oldMouseMove;
this.onmouseup = oldMouseUp;

return false;
}

// Call onstart
onstart.call(this, arguments[0] || event);

return false;
}
})(element.onmousedown);

// override event attachers
if (element.addEventListener)
element.addEventListener = (function(original) {
return function(event, listener, useCapture) {
switch (event) {
case "start":
onstart = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(onstart);
break;
case "drag":
ondrag = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(ondrag);
break;
case "stop":
onstop = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(onstop);
break;
default:
original.call(element, event, listener, useCapture);
}
}
})(element.addEventListener);

if (element.attachEvent)
element.attachEvent = (function(original) {
return function(event, listener) {
switch (event) {
case "onstart":
onstart = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(onstart);
break;
case "ondrag":
ondrag = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(ondrag);
break;
case "onstop":
onstop = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(onstop);
break;
default:
original.call(element, event, listener);
}
}
})(element.attachEvent);


if (window.attachEvent)
window.attachEvent("onbeforeunload", function() {
onstart = ondrag = onstop = element.onmousedown = element.addEventListener = element.attachEvent = null;
element = null;
});
}


// initialize Droppable in the global scope
var Droppable;

(function() {
if (document.getBoxObjectFor) {
function getOffset(element) {
var box = document.getBoxObjectFor(element);
return { x: box.x, y: box.y };
}
}
else if (document.all && navigator.appName == "Microsoft Internet Explorer" && !window.opera) {
function getOffset(element) {
var range = document.body.createTextRange();
range.moveToElementText(element);
var rect = range.getBoundingClientRect();
return { x: rect.left, y: rect.top };
}
}
else {
function getOffset(element) {
var accumulator = arguments[1] || { x: 0, y: 0 };
if (element && element != document.body) {
accumulator.x += element.offsetLeft;
accumulator.y += element.offsetTop;
return getOffset(element.offsetParent, accumulator);
}
else {
return accumulator;
}
}
}

// initialize private pointers to current target information
var cTarget = null, cHover = null, cUnhover = null, cDrop = null;
function hotSpots(x,y) {
cTarget = cHover = cUnhover = cDrop = null;
}

// declare Droppable within the private scope
Droppable = function(element) {
// Calculate offset
var offset = getOffset(element);

// Calculate other edge offset
var edge = { x: offset.x + element.offsetWidth, y: offset.y + element.offsetHeight };

// Assign a finder function
hotSpots = (function(old) {
return function(x,y) {
if (offset.x <= x && x <= edge.x && offset.y <= y && y <= edge.y) {
cTarget = element;
cHover = onhover;
cUnhover = onunhover;
cDrop = ondrop;
}
else {
old(x,y);
}
}
})(hotSpots);

// default event listeners
function onhover(event) {
event.dropTarget = element;
if (element.onhover) element.onhover(event);
}
function onunhover(event) {
event.dropTarget = element;
if (element.onunhover) element.onunhover(event);
}
function ondrop(event) {
event.dropTarget = element;
if (element.ondrop) element.ondrop(event);
}

// override event attachers
if (element.addEventListener)
element.addEventListener = (function(original) {
return function(event, listener, useCapture) {
switch (event) {
case "hover":
onhover = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(onhover);
break;
case "unhover":
onunhover = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(onunhover);
break;
case "drop":
ondrop = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(ondrop);
break;
default:
original.call(element, event, listener, useCapture);
}
}
})(element.addEventListener);

if (element.attachEvent)
element.attachEvent = (function(original) {
return function(event, listener) {
switch (event) {
case "onhover":
onhover = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(onhover);
break;
case "onunhover":
onunhover = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(onunhover);
break;
case "ondrop":
ondrop = (function(old) {
return function(event) { old.call(element,event); listener.call(element,event); }
})(ondrop);
break;
default:
original.call(element, event, listener);
}
}
})(element.attachEvent);


if (window.attachEvent)
window.attachEvent("onbeforeunload", function() {
hotSpots = onhover = onunhover = ondrop = element.addEventListener = element.attachEvent = cTarget = cHover = cUnhover = cDrop = null;
element = null;
});
}

// Setup a query method
Droppable.query = function(event) {
var oTarget = cTarget,
oHover = cHover,
oUnhover = cUnhover,
oDrop = cDrop;

var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft,
scrollTop = document.documentElement.scrollTop || document.body.scrollTop;


hotSpots(event.clientX + scrollLeft, event.clientY + scrollTop);

switch (event.type) {
case "mousemove": // onhover & onunhover
if (oTarget != null && oTarget != cTarget)
oUnhover.call(oTarget, event);
if (oTarget == null && cTarget != null)
cHover.call(cTarget, event);
break;
case "mouseup": // ondrop
if (cTarget != null) {
cUnhover.call(cTarget, event);
cDrop.call(cTarget, event);
}
break;
}
}

Droppable.reset = function() {
hotSpots = function(x,y) {
cTarget = cHover = cUnhover = cDrop = null;
}
hotSpots();
}
})();

// Fix the function prototype for IE5/Mac
if (typeof Function.prototype.apply == "undefined")
Function.prototype.apply = function(scope, args) {
if (!args) args = [];
var index = 0, result;
do { -- index } while (typeof scope[index] != "undefined");
scope[index] = this;

switch (args.length) {
case 0:
result = scope[index]();
break;
case 1:
result = scope[index](args[0]);
break;
case 2:
result = scope[index](args[0], args[1]);
break;
case 3:
result = scope[index](args[0], args[1], args[2]);
break;
case 4:
result = scope[index](args[0], args[1], args[2], args[3]);
break;
default:
result = scope[index](args[0], args[1], args[2], args[3], args[4]);
break;
}

delete scope[index];
return result;
}

if (typeof Function.prototype.call == "undefined")
Function.prototype.call = function(scope) {
var args = new Array(Math.max(arguments.length-1, 0));
for (var i = 1; i < arguments.length; i++)
args[i-1] = arguments[i];
return this.apply(scope, args);
}

View 7 Replies View Related

Tablekit Library Not Sorting In Jsp?

Feb 3, 2010

I downloaded the tablekit javascript library and put it in the js directory which is in the jsp directory. i.e. the directory is

C:workspacecom.mycomp.data.warWEB-INFjspjs

The jsp page is as follows and display correctly with FF and chrome on Windows Vista.However, the column of the page is not sorted by clicking on the column. i.e. the tablekit javascript library sorting function does not work on the web page generated by jsp.

<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<table border="1" class="sortable resizable"

[code]...

View 2 Replies View Related

Animated X Library Resize

May 17, 2005

I'm using the function 'xResizeTo()' found in the X Javascript Library.

I'd just like to have it animated to the specified new size.

I would like to have something similar to the effect wich you can see in the above menu bar where it reads 'Quick Links' in sitepoint forums. At the right side of the search textarea.

View 6 Replies View Related

Uninstall The MSXML Library?

Sep 13, 2006

Is it possible to uninstall the MSXML library?

View 1 Replies View Related

JQuery :: Cannot Get The Library To Work

May 14, 2011

I am reading the book JQuery Novice To Ninja. I can upload the examples to mozzilla and they work but I down loaded the library to my folder and I wrote out the examples myself and put them in the same folder so I can get the practice and they will not work the code is exactly the same as the book I do not understand.

View 1 Replies View Related

JQuery :: Replace Hardcode_value In Library?

May 17, 2009

How to replace hardcode_value in jquery librarywith something more flexible value (for example something value fromhtml document)?For example I'd like to substitutethe "hardcode_value" (in jquery file)with the value "input1" (in html document).

"html document"
<div id='contactForm'>
<a href='#' class='contact' value='input1'>Demo</a>

[code]....

View 2 Replies View Related

JQuery :: $ Not Recognized Even Though Library Referenced

Oct 3, 2009

I my ASP.NET master page I've got the following:

and yes, the paths are right. I still get this error in firebug no matter what: $ is not defined

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved