pandora/static/js/backButton.js

37 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2011-11-05 17:04:10 +00:00
'use strict';
2018-06-19 06:33:26 +00:00
2011-05-25 19:42:45 +00:00
pandora.ui.backButton = function() {
var that = Ox.Button({
2016-10-04 22:00:03 +00:00
title: Ox._('Back to {0}', [
pandora.user.ui.section == 'items'
? Ox._(pandora.site.itemName.plural)
: Ox._(Ox.toTitleCase(pandora.user.ui.section))
]),
width: pandora.user.ui.section == 'documents' ? 124 : 96
2011-05-25 19:42:45 +00:00
}).css({
float: 'left',
2011-10-29 16:57:51 +00:00
margin: '4px 0 0 4px'
2011-05-25 19:42:45 +00:00
})
.bindEvent({
2011-09-17 17:40:15 +00:00
click: function() {
2011-10-19 13:00:10 +00:00
/*
FIXME: if, on page load, one clicks back quickly,
the item content may overwrite the list content.
but we cannot cancel all requests, since that
might keep the lists folders from loading.
so we'd have to cancel with a function -- and
it's unclear if the best place for that is here
*/
if (['accessed', 'timesaccessed'].indexOf(pandora.user.ui.listSort[0].key) > -1) {
Ox.Request.clearCache('find');
}
2016-10-04 22:00:03 +00:00
if (pandora.user.ui.section == 'documents') {
pandora.UI.set({document: ''});
} else {
pandora.UI.set({item: ''});
}
2011-05-25 19:42:45 +00:00
}
});
return that;
};