mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
Adapt client code for its use in the server
This commit is contained in:
parent
4e5e5edc8e
commit
fd056cf09c
1 changed files with 11 additions and 1 deletions
|
@ -74,8 +74,12 @@ function isArray(testObject)
|
||||||
return testObject && typeof testObject === 'object' && !(testObject.propertyIsEnumerable('length')) && typeof testObject.length === 'number';
|
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)
|
// Figure out what browser is being used (stolen from jquery 1.2.1)
|
||||||
var userAgent = navigator.userAgent.toLowerCase();
|
userAgent = navigator.userAgent.toLowerCase();
|
||||||
var browser = {
|
var browser = {
|
||||||
version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
|
version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
|
||||||
safari: /webkit/.test(userAgent),
|
safari: /webkit/.test(userAgent),
|
||||||
|
@ -85,6 +89,7 @@ var browser = {
|
||||||
windows: /windows/.test(userAgent) // dgreensp
|
windows: /windows/.test(userAgent) // dgreensp
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function getAssoc(obj, name)
|
function getAssoc(obj, name)
|
||||||
{
|
{
|
||||||
return obj["_magicdom_" + 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');
|
return str.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/\r?\n/g, '\\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof exports !== "undefined")
|
||||||
|
{
|
||||||
|
exports.map = map;
|
||||||
|
}
|
Loading…
Reference in a new issue