Tabs to spaces.

This commit is contained in:
Lars Jung 2014-08-15 22:07:53 +02:00
parent 49403ed07c
commit 9b5f6f3cad
108 changed files with 6176 additions and 6168 deletions

View file

@ -1,95 +1,96 @@
modulejs.define('ext/crumb', ['_', '$', 'core/settings', 'core/resource', 'core/event', 'core/location'], function (_, $, allsettings, resource, event, location) {
var settings = _.extend({
enabled: false
}, allsettings.crumb),
var settings = _.extend({
enabled: false
}, allsettings.crumb),
template = '<li class="crumb">' +
'<a>' +
'<img src="' + resource.image('crumb') + '" alt=">"/>' +
'<span/>' +
'</a>' +
'</li>',
pageHintTemplate = '<img class="hint" src="' + resource.image('page') + '" alt="has index page"/>',
statusHintTemplate = '<span class="hint"/>',
template =
'<li class="crumb">' +
'<a>' +
'<img src="' + resource.image('crumb') + '" alt=">"/>' +
'<span/>' +
'</a>' +
'</li>',
pageHintTemplate = '<img class="hint" src="' + resource.image('page') + '" alt="has index page"/>',
statusHintTemplate = '<span class="hint"/>',
update = function (item, force) {
update = function (item, force) {
if (!force && item.$crumb) {
return item.$crumb;
}
if (!force && item.$crumb) {
return item.$crumb;
}
var $html = $(template),
$a = $html.find('a');
var $html = $(template),
$a = $html.find('a');
$html
.addClass(item.isFolder() ? 'folder' : 'file')
.data('item', item);
$html
.addClass(item.isFolder() ? 'folder' : 'file')
.data('item', item);
location.setLink($a, item);
$a.find('span').text(item.label).end();
location.setLink($a, item);
$a.find('span').text(item.label).end();
if (item.isDomain()) {
$html.addClass('domain');
$a.find('img').attr('src', resource.image('home'));
}
if (item.isDomain()) {
$html.addClass('domain');
$a.find('img').attr('src', resource.image('home'));
}
if (item.isRoot()) {
$html.addClass('root');
$a.find('img').attr('src', resource.image('home'));
}
if (item.isRoot()) {
$html.addClass('root');
$a.find('img').attr('src', resource.image('home'));
}
if (item.isCurrentFolder()) {
$html.addClass('current');
}
if (item.isCurrentFolder()) {
$html.addClass('current');
}
if (!item.isManaged) {
$a.append($(pageHintTemplate));
}
if (!item.isManaged) {
$a.append($(pageHintTemplate));
}
if (item.$crumb) {
item.$crumb.replaceWith($html);
}
item.$crumb = $html;
if (item.$crumb) {
item.$crumb.replaceWith($html);
}
item.$crumb = $html;
return $html;
},
return $html;
},
onLocationChanged = function (item) {
onLocationChanged = function (item) {
var crumb = item.getCrumb(),
$ul = $('#navbar'),
found = false;
var crumb = item.getCrumb(),
$ul = $('#navbar'),
found = false;
$ul.find('.crumb').each(function () {
$ul.find('.crumb').each(function () {
var $html = $(this);
if ($html.data('item') === item) {
found = true;
$html.addClass('current');
} else {
$html.removeClass('current');
}
});
var $html = $(this);
if ($html.data('item') === item) {
found = true;
$html.addClass('current');
} else {
$html.removeClass('current');
}
});
if (!found) {
$ul.find('.crumb').remove();
_.each(crumb, function (e) {
if (!found) {
$ul.find('.crumb').remove();
_.each(crumb, function (e) {
$ul.append(update(e, true));
});
}
},
$ul.append(update(e, true));
});
}
},
init = function () {
init = function () {
if (!settings.enabled) {
return;
}
if (!settings.enabled) {
return;
}
event.sub('location.changed', onLocationChanged);
};
event.sub('location.changed', onLocationChanged);
};
init();
init();
});