diff options
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/js.js | 49 | ||||
-rw-r--r-- | core/js/oc-dialogs.js | 10 | ||||
-rw-r--r-- | core/js/oc-requesttoken.js | 3 | ||||
-rw-r--r-- | core/js/placeholder.js | 13 |
4 files changed, 43 insertions, 32 deletions
diff --git a/core/js/js.js b/core/js/js.js index af4a6d6b336..1999ff73d23 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -431,9 +431,16 @@ OC.Notification={ OC.Breadcrumb={ container:null, - crumbs:[], show:function(dir, leafname, leaflink){ - OC.Breadcrumb.clear(); + if(!this.container){//default + this.container=$('#controls'); + } + this._show(this.container, dir, leafname, leaflink); + }, + _show:function(container, dir, leafname, leaflink){ + var self = this; + + this._clear(container); // show home + path in subdirectories if (dir && dir !== '/') { @@ -450,8 +457,7 @@ OC.Breadcrumb={ crumbImg.attr('src',OC.imagePath('core','places/home')); crumbLink.append(crumbImg); crumb.append(crumbLink); - OC.Breadcrumb.container.prepend(crumb); - OC.Breadcrumb.crumbs.push(crumb); + container.prepend(crumb); //add path parts var segments = dir.split('/'); @@ -460,20 +466,23 @@ OC.Breadcrumb={ if (name !== '') { pathurl = pathurl+'/'+name; var link = OC.linkTo('files','index.php')+'?dir='+encodeURIComponent(pathurl); - OC.Breadcrumb.push(name, link); + self._push(container, name, link); } }); } //add leafname if (leafname && leaflink) { - OC.Breadcrumb.push(leafname, leaflink); + this._push(container, leafname, leaflink); } }, push:function(name, link){ - if(!OC.Breadcrumb.container){//default - OC.Breadcrumb.container=$('#controls'); + if(!this.container){//default + this.container=$('#controls'); } + return this._push(OC.Breadcrumb.container, name, link); + }, + _push:function(container, name, link){ var crumb=$('<div/>'); crumb.addClass('crumb').addClass('last'); @@ -482,30 +491,30 @@ OC.Breadcrumb={ crumbLink.text(name); crumb.append(crumbLink); - var existing=OC.Breadcrumb.container.find('div.crumb'); + var existing=container.find('div.crumb'); if(existing.length){ existing.removeClass('last'); existing.last().after(crumb); }else{ - OC.Breadcrumb.container.prepend(crumb); + container.prepend(crumb); } - OC.Breadcrumb.crumbs.push(crumb); return crumb; }, pop:function(){ - if(!OC.Breadcrumb.container){//default - OC.Breadcrumb.container=$('#controls'); + if(!this.container){//default + this.container=$('#controls'); } - OC.Breadcrumb.container.find('div.crumb').last().remove(); - OC.Breadcrumb.container.find('div.crumb').last().addClass('last'); - OC.Breadcrumb.crumbs.pop(); + this.container.find('div.crumb').last().remove(); + this.container.find('div.crumb').last().addClass('last'); }, clear:function(){ - if(!OC.Breadcrumb.container){//default - OC.Breadcrumb.container=$('#controls'); + if(!this.container){//default + this.container=$('#controls'); } - OC.Breadcrumb.container.find('div.crumb').remove(); - OC.Breadcrumb.crumbs=[]; + this._clear(this.container); + }, + _clear:function(container) { + container.find('div.crumb').remove(); } }; diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 4092b8d0746..f184a1022bc 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -77,7 +77,7 @@ var OCdialogs = { self.$filePicker = $tmpl.octemplate({ dialog_name: dialog_name, title: title - }).data('path', ''); + }).data('path', '').data('multiselect', multiselect).data('mimetype', mimetype_filter); if (modal === undefined) { modal = false; @@ -100,7 +100,7 @@ var OCdialogs = { self._handlePickerClick(event, $(this)); }); self._fillFilePicker(''); - }).data('multiselect', multiselect).data('mimetype',mimetype_filter); + }); // build buttons var functionToCall = function() { @@ -285,7 +285,11 @@ var OCdialogs = { filename: entry.name, date: OC.mtime2date(entry.mtime) }); - $li.find('img').attr('src', entry.mimetype_icon); + if (entry.mimetype === "httpd/unix-directory") { + $li.find('img').attr('src', OC.imagePath('core', 'filetypes/folder.png')); + } else { + $li.find('img').attr('src', OC.Router.generate('core_ajax_preview', {x:32, y:32, file:escapeHTML(dir+'/'+entry.name)}) ); + } self.$filelist.append($li); }); diff --git a/core/js/oc-requesttoken.js b/core/js/oc-requesttoken.js index 6cc6b5a855b..0d7f40c592a 100644 --- a/core/js/oc-requesttoken.js +++ b/core/js/oc-requesttoken.js @@ -1,3 +1,4 @@ -$(document).bind('ajaxSend', function(elm, xhr, s) { +$(document).on('ajaxSend',function(elm, xhr, s) { xhr.setRequestHeader('requesttoken', oc_requesttoken); }); + diff --git a/core/js/placeholder.js b/core/js/placeholder.js index 16543541cb4..d63730547d7 100644 --- a/core/js/placeholder.js +++ b/core/js/placeholder.js @@ -34,23 +34,20 @@ * * Which will result in: * - * <div id="albumart" style="background-color: rgb(123, 123, 123); ... ">T</div> + * <div id="albumart" style="background-color: hsl(123, 90%, 65%); ... ">T</div> * */ (function ($) { $.fn.placeholder = function(seed) { var hash = md5(seed), - maxRange = parseInt('ffffffffff', 16), - red = parseInt(hash.substr(0,10), 16) / maxRange * 256, - green = parseInt(hash.substr(10,10), 16) / maxRange * 256, - blue = parseInt(hash.substr(20,10), 16) / maxRange * 256, - rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)], + maxRange = parseInt('ffffffffffffffffffffffffffffffff', 16), + hue = parseInt(hash, 16) / maxRange * 256, height = this.height(); - this.css('background-color', 'rgb(' + rgb.join(',') + ')'); + this.css('background-color', 'hsl(' + hue + ', 90%, 65%)'); // CSS rules - this.css('color', 'rgb(255, 255, 255)'); + this.css('color', '#fff'); this.css('font-weight', 'bold'); this.css('text-align', 'center'); |