From b0f166fc836129464a2bdfa03357e844568c1104 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 26 Jul 2011 16:43:12 +0200 Subject: some javascript changes --- core/js/js.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 9117f08349a..2dac6907d96 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -55,3 +55,22 @@ OC={ $('head').append(style); } } + +if (!Array.prototype.filter) { + Array.prototype.filter = function(fun /*, thisp*/) { + var len = this.length >>> 0; + if (typeof fun != "function") + throw new TypeError(); + + var res = []; + var thisp = arguments[1]; + for (var i = 0; i < len; i++) { + if (i in this) { + var val = this[i]; // in case fun mutates this + if (fun.call(thisp, val, i, this)) + res.push(val); + } + } + return res; + }; +} \ No newline at end of file -- cgit v1.2.3 From 606dec8da026d3aceb75abb64c936a09a3bd9133 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 27 Jul 2011 16:39:44 +0200 Subject: some minor changes in the javascript translation function also provide Array.prototype.indexOf for browser that don't support it nativale (IE) --- core/js/js.js | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 9117f08349a..593a637137c 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -1,26 +1,27 @@ -var _l10ncache = {}; function t(app,text){ - if( !( app in _l10ncache )){ - $.post( oc_webroot+'/core/ajax/translations.php', {'app': app}, function(jsondata){ - _l10ncache[app] = jsondata.data; + if( !( app in t.cache )){ + + $.post( OC.filePath('core','ajax','translations.php'), {'app': app}, function(jsondata){ + t.cache[app] = jsondata.data; }); // Bad answer ... - if( !( app in _l10ncache )){ - _l10ncache[app] = []; + if( !( app in t.cache )){ + t.cache[app] = []; } } - if( typeof( _l10ncache[app][text] ) !== 'undefined' ){ - return _l10ncache[app][text]; + if( typeof( t.cache[app][text] ) !== 'undefined' ){ + return t.cache[app][text]; } else{ return text; } } +t.cache={}; OC={ webroot:oc_webroot, - coreApps:['files','admin','log','search','settings'], + coreApps:['files','admin','log','search','settings','core'], linkTo:function(app,file){ return OC.filePath(app,'',file); }, @@ -55,3 +56,25 @@ OC={ $('head').append(style); } } + +if (!Array.prototype.indexOf){ + Array.prototype.indexOf = function(elt /*, from*/) + { + var len = this.length; + + var from = Number(arguments[1]) || 0; + from = (from < 0) + ? Math.ceil(from) + : Math.floor(from); + if (from < 0) + from += len; + + for (; from < len; from++) + { + if (from in this && + this[from] === elt) + return from; + } + return -1; + }; +} \ No newline at end of file -- cgit v1.2.3 From 556bf2ef4ddf1aa47f1ebd90494f562076fdeac2 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 27 Jul 2011 16:57:49 +0200 Subject: fix broken merge --- core/js/js.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 3a820544b78..2f74bda2588 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -73,6 +73,8 @@ if (!Array.prototype.filter) { } } return res; + } +} if (!Array.prototype.indexOf){ Array.prototype.indexOf = function(elt /*, from*/) { -- cgit v1.2.3 From 74249c65da5b21c4b191f9792b510268c4b83454 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 28 Jul 2011 04:28:04 +0200 Subject: give OC.imagePath the ability to detect whether to use svg or png images --- core/js/js.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 2f74bda2588..407c5708701 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -40,6 +40,9 @@ OC={ return link; }, imagePath:function(app,file){ + if(file.indexOf('.')==-1){//if no extention is given, use png or svg depending on browser support + file+=(SVGSupport())?'.svg':'.png' + } return OC.filePath(app,'img',file); }, addScript:function(app,script,ready){ @@ -95,4 +98,8 @@ if (!Array.prototype.indexOf){ } return -1; }; -} \ No newline at end of file +} + +function SVGSupport() { + return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") || document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Shape", "1.0"); +} -- cgit v1.2.3 From 2781fdeed8f1d45ebba23fb2b2e22aa3bbd5f2ff Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 29 Jul 2011 16:52:09 +0200 Subject: automatically replace svg images with png for browsers that dont support svg --- core/js/js.js | 10 ++++++++++ core/templates/layout.admin.php | 4 ++-- core/templates/layout.user.php | 4 ++-- files/templates/index.php | 4 ++-- 4 files changed, 16 insertions(+), 6 deletions(-) (limited to 'core/js/js.js') diff --git a/core/js/js.js b/core/js/js.js index 407c5708701..db96a1adb3e 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -103,3 +103,13 @@ if (!Array.prototype.indexOf){ function SVGSupport() { return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") || document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Shape", "1.0"); } + +$(document).ready(function(){ + if(!SVGSupport()){//replace all svg images with png images for browser that dont support svg + $('img.svg').each(function(index,element){ + element=$(element); + var src=element.attr('src'); + element.attr('src',src.substr(0,src.length-3)+'png'); + }); + }; +}); diff --git a/core/templates/layout.admin.php b/core/templates/layout.admin.php index 78ccf877221..8077fd304f3 100644 --- a/core/templates/layout.admin.php +++ b/core/templates/layout.admin.php @@ -30,8 +30,8 @@ diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index f8beb79e81e..a100eed96b1 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -31,8 +31,8 @@ ownCloud
    -
  • -
  • +
  • +
diff --git a/files/templates/index.php b/files/templates/index.php index 9bc939ee90a..df78cf0bb2d 100644 --- a/files/templates/index.php +++ b/files/templates/index.php @@ -28,12 +28,12 @@ t( 'Name' ); ?> - Download + Download t( 'Size MB' ); ?> - t( 'Modified' ); ?>Delete + t( 'Modified' ); ?>Delete -- cgit v1.2.3