Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/text.js URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/text.js?rev=1305566&r1=1305565&r2=1305566&view=diff ============================================================================== --- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/text.js (original) +++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/text.js Mon Mar 26 20:46:09 2012 @@ -1,5 +1,5 @@ /** - * @license RequireJS text 1.0.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. + * @license RequireJS text 1.0.7 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/requirejs for details */ @@ -41,7 +41,12 @@ fs = require.nodeRequire('fs'); get = function (url, callback) { - callback(fs.readFileSync(url, 'utf8')); + var file = fs.readFileSync(url, 'utf8'); + //Remove BOM (Byte Mark Order) from utf8 files if it is there. + if (file.indexOf('\uFEFF') === 0) { + file = file.substring(1); + } + callback(file); }; } else if (typeof Packages !== 'undefined') { //Why Java, why is this so awkward? @@ -84,7 +89,7 @@ } text = { - version: '1.0.0', + version: '1.0.7', strip: function (content) { //Strips <?xml ...?> declarations so that external SVG and XML @@ -197,7 +202,7 @@ finishLoad: function (name, strip, content, onLoad, config) { content = strip ? text.strip(content) : content; - if (config.isBuild && config.inlineText) { + if (config.isBuild) { buildMap[name] = content; } onLoad(content); @@ -211,6 +216,13 @@ //removing the <?xml ...?> declarations so the content can be inserted //into the current doc without problems. + // Do not bother with the work if a build and text will + // not be inlined. + if (config.isBuild && !config.inlineText) { + onLoad(); + return; + } + var parsed = text.parseName(name), nonStripName = parsed.moduleName + '.' + parsed.ext, url = req.toUrl(nonStripName),
