aboutsummaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
authorraghunayyar <me@iraghu.com>2014-01-16 14:42:37 +0530
committerraghunayyar <me@iraghu.com>2014-01-16 14:42:37 +0530
commit775e08e0ee4125cc7b2a594771437686f6a21b56 (patch)
tree362f84449171898335dd3e8511b65c97c150e9e1 /core/js/js.js
parent4687d2dd0bde3f689eb57c90d0c4341cd00991bd (diff)
parentbd643c47f32ba6d7b3ba6a18ed1591aab0b81be8 (diff)
downloadnextcloud-server-775e08e0ee4125cc7b2a594771437686f6a21b56.tar.gz
nextcloud-server-775e08e0ee4125cc7b2a594771437686f6a21b56.zip
Merge branch 'master' into core-em-to-px
Conflicts: apps/files_sharing/css/public.css apps/user_ldap/css/settings.css core/css/multiselect.css core/css/share.css
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js48
1 files changed, 27 insertions, 21 deletions
diff --git a/core/js/js.js b/core/js/js.js
index b7f7ff1ac15..f380234af05 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -12,7 +12,14 @@ var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('dat
var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken');
if (typeof oc_webroot === "undefined") {
- oc_webroot = location.pathname.substr(0, location.pathname.lastIndexOf('/'));
+ oc_webroot = location.pathname;
+ var pos = oc_webroot.indexOf('/index.php/');
+ if (pos !== -1) {
+ oc_webroot = oc_webroot.substr(0, pos);
+ }
+ else {
+ oc_webroot = oc_webroot.substr(0, oc_webroot.lastIndexOf('/'));
+ }
}
if (oc_debug !== true || typeof console === "undefined" || typeof console.log === "undefined") {
if (!window.console) {
@@ -41,8 +48,8 @@ function initL10N(app) {
t.cache[app] = [];
}
}
- if (typeof t.plural_function == 'undefined') {
- t.plural_function = function (n) {
+ if (typeof t.plural_function[app] == 'undefined') {
+ t.plural_function[app] = function (n) {
var p = (n != 1) ? 1 : 0;
return { 'nplural' : 2, 'plural' : p };
};
@@ -67,7 +74,7 @@ function initL10N(app) {
Gettext._locale_data[domain].head.plural_func = eval("("+code+")");
*/
var code = 'var plural; var nplurals; '+pf+' return { "nplural" : nplurals, "plural" : (plural === true ? 1 : plural ? plural : 0) };';
- t.plural_function = new Function("n", code);
+ t.plural_function[app] = new Function("n", code);
} else {
console.log("Syntax error in language file. Plural-Forms header is invalid ["+t.plural_forms+"]");
}
@@ -103,6 +110,10 @@ function t(app, text, vars, count){
}
}
t.cache = {};
+// different apps might or might not redefine the nplurals function correctly
+// this is to make sure that a "broken" app doesn't mess up with the
+// other app's plural function
+t.plural_function = {};
/**
* translate a string
@@ -115,11 +126,11 @@ t.cache = {};
*/
function n(app, text_singular, text_plural, count, vars) {
initL10N(app);
- var identifier = '_' + text_singular + '__' + text_plural + '_';
+ var identifier = '_' + text_singular + '_::_' + text_plural + '_';
if( typeof( t.cache[app][identifier] ) !== 'undefined' ){
var translation = t.cache[app][identifier];
if ($.isArray(translation)) {
- var plural = t.plural_function(count);
+ var plural = t.plural_function[app](count);
return t(app, translation[plural.plural], vars, count);
}
}
@@ -471,11 +482,11 @@ OC.Breadcrumb={
},
_show:function(container, dir, leafname, leaflink){
var self = this;
-
+
this._clear(container);
-
+
// show home + path in subdirectories
- if (dir && dir !== '/') {
+ if (dir) {
//add home
var link = OC.linkTo('files','index.php');
@@ -502,7 +513,7 @@ OC.Breadcrumb={
}
});
}
-
+
//add leafname
if (leafname && leaflink) {
this._push(container, leafname, leaflink);
@@ -746,15 +757,7 @@ $(document).ready(function(){
});
var setShowPassword = function(input, label) {
- input.showPassword().keyup(function(){
- if (input.val().length == 0) {
- label.hide();
- }
- else {
- label.css("display", "inline").show();
- }
- });
- label.hide();
+ input.showPassword().keyup();
};
setShowPassword($('#adminpass'), $('label[for=show]'));
setShowPassword($('#pass2'), $('label[for=personal-show]'));
@@ -833,7 +836,10 @@ function humanFileSize(size) {
order = Math.min(humanList.length - 1, order);
var readableFormat = humanList[order];
var relativeSize = (size / Math.pow(1024, order)).toFixed(1);
- if(relativeSize.substr(relativeSize.length-2,2)=='.0'){
+ if(order < 2){
+ relativeSize = parseFloat(relativeSize).toFixed(0);
+ }
+ else if(relativeSize.substr(relativeSize.length-2,2)==='.0'){
relativeSize=relativeSize.substr(0,relativeSize.length-2);
}
return relativeSize + ' ' + readableFormat;
@@ -941,7 +947,7 @@ jQuery.fn.selectRange = function(start, end) {
*/
jQuery.fn.exists = function(){
return this.length > 0;
-}
+};
/**
* Calls the server periodically every 15 mins to ensure that session doesnt