diff --git a/resources/report/js/jed.js b/resources/report/js/jed.js index dfb21e2c..fad370d8 100644 --- a/resources/report/js/jed.js +++ b/resources/report/js/jed.js @@ -1,5 +1,5 @@ /** - * @preserve jed.js v0.5.0beta https://github.com/SlexAxton/Jed + * @preserve jed.js https://github.com/SlexAxton/Jed */ /* ----------- @@ -222,9 +222,6 @@ in order to offer easy upgrades -- jsgettext.berlios.de // isn't explicitly passed in domain = domain || this._textdomain; - // Default the value to the singular case - val = typeof val == 'undefined' ? 1 : val; - var fallback; // Handle special cases @@ -258,24 +255,34 @@ in order to offer easy upgrades -- jsgettext.berlios.de throw new Error('No translation key found.'); } - // Handle invalid numbers, but try casting strings for good measure - if ( typeof val != 'number' ) { - val = parseInt( val, 10 ); - - if ( isNaN( val ) ) { - throw new Error('The number that was passed in is not a number.'); - } - } - var key = context ? context + Jed.context_delimiter + singular_key : singular_key, locale_data = this.options.locale_data, dict = locale_data[ domain ], defaultConf = (locale_data.messages || this.defaults.locale_data.messages)[""], - pluralForms = dict[""].plural_forms || dict[""]["Plural-Forms"] || defaultConf.plural_forms || defaultConf["Plural-Forms"], - val_idx = getPluralFormFunc(pluralForms)(val) + 1, + pluralForms = dict[""].plural_forms || dict[""]["Plural-Forms"] || dict[""]["plural-forms"] || defaultConf.plural_forms || defaultConf["Plural-Forms"] || defaultConf["plural-forms"], val_list, res; + var val_idx; + if (val === undefined) { + // No value passed in; assume singular key lookup. + val_idx = 0; + + } else { + // Value has been passed in; use plural-forms calculations. + + // Handle invalid numbers, but try casting strings for good measure + if ( typeof val != 'number' ) { + val = parseInt( val, 10 ); + + if ( isNaN( val ) ) { + throw new Error('The number that was passed in is not a number.'); + } + } + + val_idx = getPluralFormFunc(pluralForms)(val); + } + // Throw an error if a domain isn't found if ( ! dict ) { throw new Error('No domain named `' + domain + '` could be found.'); @@ -285,25 +292,25 @@ in order to offer easy upgrades -- jsgettext.berlios.de // If there is no match, then revert back to // english style singular/plural with the keys passed in. - if ( ! val_list || val_idx >= val_list.length ) { + if ( ! val_list || val_idx > val_list.length ) { if (this.options.missing_key_callback) { this.options.missing_key_callback(key, domain); } - res = [ null, singular_key, plural_key ]; + res = [ singular_key, plural_key ]; // collect untranslated strings if (this.options.debug===true) { - console.log(res[ getPluralFormFunc(pluralForms)( val ) + 1 ]); + console.log(res[ getPluralFormFunc(pluralForms)( val ) ]); } - return res[ getPluralFormFunc()( val ) + 1 ]; + return res[ getPluralFormFunc()( val ) ]; } res = val_list[ val_idx ]; // This includes empty strings on purpose if ( ! res ) { - res = [ null, singular_key, plural_key ]; - return res[ getPluralFormFunc()( val ) + 1 ]; + res = [ singular_key, plural_key ]; + return res[ getPluralFormFunc()( val ) ]; } return res; } diff --git a/resources/report/js/jedGettextParser.js b/resources/report/js/jedGettextParser.js index c46e4c99..2bea67a0 100644 --- a/resources/report/js/jedGettextParser.js +++ b/resources/report/js/jedGettextParser.js @@ -171,7 +171,7 @@ var msgBytes = this._readTranslationPair(originalOffset, translationOffset); var msg = this._splitPlurals( decoder.decode(msgBytes.id), decoder.decode(msgBytes.str) ); - jedLocaleData[msg.id] = [ null ].concat(msg.str); + jedLocaleData[msg.id] = [].concat(msg.str); originalOffset += 8; translationOffset += 8; @@ -207,4 +207,4 @@ } } }; -})); \ No newline at end of file +})); diff --git a/resources/report/js/order.js b/resources/report/js/order.js deleted file mode 100644 index e78c1836..00000000 --- a/resources/report/js/order.js +++ /dev/null @@ -1,8 +0,0 @@ -/* - RequireJS order 1.0.5 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 -*/ -(function(){function k(a){var b=a.currentTarget||a.srcElement,c;if(a.type==="load"||l.test(b.readyState)){a=b.getAttribute("data-requiremodule");j[a]=!0;for(a=0;c=g[a];a++)if(j[c.name])c.req([c.name],c.onLoad);else break;a>0&&g.splice(0,a);setTimeout(function(){b.parentNode.removeChild(b)},15)}}function m(a){var b,c;a.setAttribute("data-orderloaded","loaded");for(a=0;c=h[a];a++)if((b=i[c])&&b.getAttribute("data-orderloaded")==="loaded")delete i[c],require.addScriptToDom(b);else break;a>0&&h.splice(0, -a)}var f=typeof document!=="undefined"&&typeof window!=="undefined"&&document.createElement("script"),n=f&&(f.async||window.opera&&Object.prototype.toString.call(window.opera)==="[object Opera]"||"MozAppearance"in document.documentElement.style),o=f&&f.readyState==="uninitialized",l=/^(complete|loaded)$/,g=[],j={},i={},h=[],f=null;define({version:"1.0.5",load:function(a,b,c,e){var d;b.nameToUrl?(d=b.nameToUrl(a,null),require.s.skipAsync[d]=!0,n||e.isBuild?b([a],c):o?(e=require.s.contexts._,!e.urlFetched[d]&& -!e.loaded[a]&&(e.urlFetched[d]=!0,require.resourcesReady(!1),e.scriptCount+=1,d=require.attach(d,e,a,null,null,m),i[a]=d,h.push(a)),b([a],c)):b.specified(a)?b([a],c):(g.push({name:a,req:b,onLoad:c}),require.attach(d,null,a,k,"script/cache"))):b([a],c)}})})(); diff --git a/resources/report/js/require.js b/resources/report/js/require.js index a1099cfc..be103a74 100644 --- a/resources/report/js/require.js +++ b/resources/report/js/require.js @@ -1,5 +1,5 @@ /* - RequireJS 2.1.14 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. + RequireJS 2.1.15 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. Available via the MIT or new BSD license. see: http://github.com/jrburke/requirejs for details */ @@ -29,7 +29,7 @@ c,d=m(j.shim,a)||{},g=d.exports;for(x();A.length;){c=A.shift();if(null===c[0]){c e).join("/"),h=m(d,h)){H(h)&&(h=h[0]);a.splice(0,e,h);break}d=a.join("/");d+=b||(/^data\:|\?/.test(d)||c?"":".js");d=("/"===d.charAt(0)||d.match(/^[\w\+\.\-]+:/)?"":j.baseUrl)+d}return j.urlArgs?d+((-1===d.indexOf("?")?"?":"&")+j.urlArgs):d},load:function(a,b){g.load(i,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||ja.test((a.currentTarget||a.srcElement).readyState))N=null,a=I(a),i.completeLoad(a.id)},onScriptError:function(a){var b=I(a);if(!e(b.id))return w(C("scripterror", "Script error for: "+b.id,a,[b.id]))}};i.require=i.makeRequire();return i}var g,x,y,D,I,E,N,J,s,O,ka=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,la=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,Q=/\.js$/,ia=/^\.\//;x=Object.prototype;var K=x.toString,fa=x.hasOwnProperty,ha=Array.prototype.splice,z=!!("undefined"!==typeof window&&"undefined"!==typeof navigator&&window.document),ea=!z&&"undefined"!==typeof importScripts,ja=z&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/, Y="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),F={},q={},R=[],M=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(G(requirejs))return;q=requirejs;requirejs=void 0}"undefined"!==typeof require&&!G(require)&&(q=require,require=void 0);g=requirejs=function(b,c,d,e){var n,p="_";!H(b)&&"string"!==typeof b&&(n=b,H(c)?(b=c,c=d,d=e):b=[]);n&&n.context&&(p=n.context);(e=m(F,p))||(e=F[p]=g.s.newContext(p));n&&e.configure(n);return e.require(b,c,d)};g.config=function(b){return g(b)}; -g.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=g);g.version="2.1.14";g.jsExtRegExp=/^\/|:|\?|\.js$/;g.isBrowser=z;x=g.s={contexts:F,newContext:ga};g({});v(["toUrl","undef","defined","specified"],function(b){g[b]=function(){var c=F._;return c.require[b].apply(c,arguments)}});if(z&&(y=x.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))y=x.head=D.parentNode;g.onError=ca;g.createNode=function(b){var c= +g.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=g);g.version="2.1.15";g.jsExtRegExp=/^\/|:|\?|\.js$/;g.isBrowser=z;x=g.s={contexts:F,newContext:ga};g({});v(["toUrl","undef","defined","specified"],function(b){g[b]=function(){var c=F._;return c.require[b].apply(c,arguments)}});if(z&&(y=x.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))y=x.head=D.parentNode;g.onError=ca;g.createNode=function(b){var c= b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};g.load=function(b,c,d){var e=b&&b.config||{};if(z)return e=g.createNode(e,c,d),e.setAttribute("data-requirecontext",b.contextName),e.setAttribute("data-requiremodule",c),e.attachEvent&&!(e.attachEvent.toString&&0>e.attachEvent.toString().indexOf("[native code"))&&!Y?(M=!0,e.attachEvent("onreadystatechange",b.onScriptLoad)): (e.addEventListener("load",b.onScriptLoad,!1),e.addEventListener("error",b.onScriptError,!1)),e.src=d,J=e,D?y.insertBefore(e,D):y.appendChild(e),J=null,e;if(ea)try{importScripts(d),b.completeLoad(c)}catch(m){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,m,[c]))}};z&&!q.skipDataMain&&T(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(I=b.getAttribute("data-main"))return s=I,q.baseUrl||(E=s.split("/"),s=E.pop(),O=E.length?E.join("/")+"/":"./",q.baseUrl= O),s=s.replace(Q,""),g.jsExtRegExp.test(s)&&(s=I),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var e,g;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(ka,"").replace(la,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(M){if(!(e=J))N&&"interactive"===N.readyState||T(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return N=b}),e=N;e&&(b|| diff --git a/resources/report/js/script.js b/resources/report/js/script.js index 55fcab67..12806492 100644 --- a/resources/report/js/script.js +++ b/resources/report/js/script.js @@ -1481,7 +1481,7 @@ function onFocus(evt) { require.config({ baseUrl: "js", }); -require(['marked', 'l10n', 'order!custom', 'order!plugin'], function(markedResponse, l10nResponse) { +require(['marked', 'l10n', 'custom', 'plugin'], function(markedResponse, l10nResponse) { marked = markedResponse; l10n = l10nResponse; /* Make sure settings are what I want. */