15 progIds = [
'Msxml2.XMLHTTP',
'Microsoft.XMLHTTP',
'Msxml2.XMLHTTP.4.0'],
16 xmlRegExp = /^\s*<\?xml(\s)+
version=[\
'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, 17 bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im, 18 hasLocation = typeof location !== 'undefined
' && location.href, 19 defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''), 20 defaultHostName = hasLocation && location.hostname, 21 defaultPort = hasLocation && (location.port || undefined), 23 masterConfig = (module.config && module.config()) || {}; 28 strip: function (content) { 29 //Strips xml declarations so that external SVG and XML 30 //documents can be added to a document without worry. Also, if the string 31 //is an HTML document, only the part inside the body tag is returned. 33 content = content.replace(xmlRegExp, ""); 34 var matches = content.match(bodyRegExp); 44 jsEscape: function (content) { 45 return content.replace(/(['\\])/g,
'\\$1')
46 .replace(/[\f]/g,
"\\f")
47 .replace(/[\
b]/g,
"\\b")
48 .replace(/[\n]/g,
"\\n")
49 .replace(/[\t]/g,
"\\t")
50 .replace(/[\
r]/g,
"\\r")
51 .replace(/[\u2028]/g,
"\\u2028")
52 .replace(/[\u2029]/g,
"\\u2029");
55 createXhr: masterConfig.createXhr ||
function () {
58 if (typeof XMLHttpRequest !==
"undefined") {
59 return new XMLHttpRequest();
60 }
else if (typeof ActiveXObject !==
"undefined") {
61 for (i = 0; i < 3; i += 1) {
64 xhr =
new ActiveXObject(progId);
85 parseName:
function (
name) {
86 var modName, ext, temp,
89 isRelative =
name.indexOf(
'./') === 0 ||
90 name.indexOf(
'../') === 0;
92 if (
index !== -1 && (!isRelative ||
index > 1)) {
99 temp = ext || modName;
100 index = temp.indexOf(
"!");
103 strip = temp.substring(
index + 1) ===
"strip";
104 temp = temp.substring(0,
index);
119 xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
129 useXhr:
function (
url, protocol, hostname, port) {
130 var uProtocol, uHostName, uPort,
131 match =
text.xdRegExp.exec(
url);
135 uProtocol = match[2];
136 uHostName = match[3];
138 uHostName = uHostName.split(
':');
139 uPort = uHostName[1];
140 uHostName = uHostName[0];
142 return (!uProtocol || uProtocol === protocol) &&
143 (!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
144 ((!uPort && !uHostName) || uPort === port);
147 finishLoad:
function (
name, strip,
content, onLoad) {
149 if (masterConfig.isBuild) {
155 load:
function (
name, req, onLoad, config) {
165 if (config.isBuild && !config.inlineText) {
170 masterConfig.isBuild = config.isBuild;
173 nonStripName = parsed.moduleName +
174 (parsed.ext ?
'.' + parsed.ext :
''),
175 url = req.toUrl(nonStripName),
176 useXhr = (masterConfig.useXhr) ||
180 if (!hasLocation || useXhr(
url, defaultProtocol, defaultHostName, defaultPort)) {
181 text.get(
url,
function (content) {
182 text.finishLoad(
name, parsed.strip, content, onLoad);
193 req([nonStripName],
function (content) {
194 text.finishLoad(parsed.moduleName +
'.' + parsed.ext,
195 parsed.strip, content, onLoad);
200 write:
function (pluginName, moduleName, write, config) {
201 if (buildMap.hasOwnProperty(moduleName)) {
202 var content =
text.jsEscape(buildMap[moduleName]);
203 write.asModule(pluginName +
"!" + moduleName,
204 "define(function () { return '" +
210 writeFile:
function (pluginName, moduleName, req, write, config) {
211 var parsed =
text.parseName(moduleName),
212 extPart = parsed.ext ?
'.' + parsed.ext :
'',
213 nonStripName = parsed.moduleName + extPart,
216 fileName = req.toUrl(parsed.moduleName + extPart) +
'.js';
221 text.load(nonStripName, req,
function (value) {
225 var textWrite =
function (contents) {
226 return write(fileName, contents);
228 textWrite.asModule =
function (moduleName, contents) {
229 return write.asModule(moduleName, fileName, contents);
232 text.write(pluginName, nonStripName, textWrite, config);
237 if (masterConfig.env ===
'node' || (!masterConfig.env &&
238 typeof process !==
"undefined" &&
240 !!process.versions.node)) {
242 fs =
require.nodeRequire(
'fs');
244 text.get =
function (
url, callback) {
245 var file = fs.readFileSync(
url,
'utf8');
247 if (file.indexOf(
'\uFEFF') === 0) {
248 file = file.substring(1);
252 }
else if (masterConfig.env ===
'xhr' || (!masterConfig.env &&
254 text.get =
function (
url, callback, errback, headers) {
256 xhr.open(
'GET',
url,
true);
261 if (headers.hasOwnProperty(
header)) {
262 xhr.setRequestHeader(
header.toLowerCase(), headers[
header]);
268 if (masterConfig.onXhr) {
269 masterConfig.onXhr(xhr,
url);
272 xhr.onreadystatechange =
function (evt) {
276 if (xhr.readyState === 4) {
278 if (status > 399 && status < 600) {
280 err =
new Error(
url +
' HTTP status: ' + status);
284 callback(xhr.responseText);
290 }
else if (masterConfig.env ===
'rhino' || (!masterConfig.env &&
291 typeof Packages !==
'undefined' && typeof java !==
'undefined')) {
293 text.get =
function (
url, callback) {
294 var stringBuffer, line,
296 file =
new java.io.File(
url),
297 lineSeparator = java.lang.System.getProperty(
"line.separator"),
298 input =
new java.io.BufferedReader(
new java.io.InputStreamReader(
new java.io.FileInputStream(file), encoding)),
301 stringBuffer =
new java.lang.StringBuffer();
302 line =
input.readLine();
309 if (line && line.length() && line.charAt(0) === 0xfeff) {
313 line = line.substring(1);
316 stringBuffer.append(line);
318 while ((line =
input.readLine()) !== null) {
319 stringBuffer.append(lineSeparator);
320 stringBuffer.append(line);
323 content = String(stringBuffer.toString());
friends picker navigation friends picker navigation r
elgg require
Throw an error if the required package isn't present.
if(!is_file("$engine_dir/settings.php")) if(!is_readable("$engine_dir/settings.php"))
Interates through each element of an array and calls callback a function.
if(!$site) if(!($site instanceof ElggSite)) $site url
clearfix elgg elgg elgg elgg page header
elgg table input[type=checkbox]
define(function(require){var $=require('jquery');var active=false;var SHOW_DELAY=20;$('body').append('< div class="elgg-spinner">< div class="elgg-ajax-loader"></div ></div >');return{start:function(){active=true;setTimeout(function(){if(active){$('body').addClass('elgg-spinner-active');}}, SHOW_DELAY);}, stop:function(){active=false;$('body').removeClass('elgg-spinner-active');}};})