summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-09-09 02:58:16 +0200
committerRobin Appelman <icewind@owncloud.com>2012-09-09 03:00:01 +0200
commit0b2633a787b8c5944962f02740abf1f75b9035e0 (patch)
treea9ab6267a0a784989ef4de955770a728ddea7d38 /core
parentf23f719d99f43138739d3a77e2d63fede43e9687 (diff)
downloadnextcloud-server-0b2633a787b8c5944962f02740abf1f75b9035e0.tar.gz
nextcloud-server-0b2633a787b8c5944962f02740abf1f75b9035e0.zip
add breadcrumb controll to js
Diffstat (limited to 'core')
-rw-r--r--core/js/js.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/core/js/js.js b/core/js/js.js
index afc0732d661..e3c3716e055 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -244,6 +244,49 @@ OC.search.lastResults={};
OC.addStyle.loaded=[];
OC.addScript.loaded=[];
+OC.Breadcrumb={
+ container:null,
+ crumbs:[],
+ push:function(name, link){
+ if(!OC.Breadcrumb.container){//default
+ OC.Breadcrumb.container=$('#controls');
+ }
+ var crumb=$('<div/>');
+ crumb.addClass('crumb').addClass('last');
+ crumb.attr('style','background-image:url("'+OC.imagePath('core','breadcrumb')+'")');
+
+ var crumbLink=$('<a/>');
+ crumbLink.attr('href',link);
+ crumbLink.text(name);
+ crumb.append(crumbLink);
+
+ var existing=OC.Breadcrumb.container.find('div.crumb');
+ if(existing.length){
+ existing.removeClass('last');
+ existing.last().after(crumb);
+ }else{
+ OC.Breadcrumb.container.append(crumb);
+ }
+ OC.Breadcrumb.crumbs.push(crumb);
+ return crumb;
+ },
+ pop:function(){
+ if(!OC.Breadcrumb.container){//default
+ OC.Breadcrumb.container=$('#controls');
+ }
+ OC.Breadcrumb.container.find('div.crumb').last().remove();
+ OC.Breadcrumb.container.find('div.crumb').last().addClass('last');
+ OC.Breadcrumb.crumbs.pop();
+ },
+ clear:function(){
+ if(!OC.Breadcrumb.container){//default
+ OC.Breadcrumb.container=$('#controls');
+ }
+ OC.Breadcrumb.container.find('div.crumb').remove();
+ OC.Breadcrumb.crumbs=[];
+ }
+}
+
if(typeof localStorage !='undefined' && localStorage != null){
//user and instance awere localstorage
OC.localStorage={