Adapt client code for its use in the server
This commit is contained in:
parent
4e5e5edc8e
commit
fd056cf09c
|
@ -74,8 +74,12 @@ function isArray(testObject)
|
|||
return testObject && typeof testObject === 'object' && !(testObject.propertyIsEnumerable('length')) && typeof testObject.length === 'number';
|
||||
}
|
||||
|
||||
if (typeof exports !== "undefined")
|
||||
{
|
||||
var navigator = {userAgent: "node-js"};
|
||||
}
|
||||
// Figure out what browser is being used (stolen from jquery 1.2.1)
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
userAgent = navigator.userAgent.toLowerCase();
|
||||
var browser = {
|
||||
version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
|
||||
safari: /webkit/.test(userAgent),
|
||||
|
@ -85,6 +89,7 @@ var browser = {
|
|||
windows: /windows/.test(userAgent) // dgreensp
|
||||
};
|
||||
|
||||
|
||||
function getAssoc(obj, name)
|
||||
{
|
||||
return obj["_magicdom_" + name];
|
||||
|
@ -130,3 +135,8 @@ function htmlPrettyEscape(str)
|
|||
{
|
||||
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\r?\n/g, '\\n');
|
||||
}
|
||||
|
||||
if (typeof exports !== "undefined")
|
||||
{
|
||||
exports.map = map;
|
||||
}
|
Loading…
Reference in New Issue