1 |
85ad3d82
|
Assos Assos
|
(function ($) {
|
2 |
|
|
|
3 |
|
|
Drupal.toolbar = Drupal.toolbar || {};
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
Drupal.behaviors.toolbar = {
|
9 |
|
|
attach: function(context) {
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
$('#toolbar', context).once('toolbar', Drupal.toolbar.init);
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
$('#toolbar a.toggle', context).once('toolbar-toggle').click(function(e) {
|
16 |
|
|
Drupal.toolbar.toggle();
|
17 |
|
|
|
18 |
|
|
$(window).triggerHandler('resize');
|
19 |
|
|
return false;
|
20 |
|
|
});
|
21 |
|
|
}
|
22 |
|
|
};
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
Drupal.toolbar.init = function() {
|
28 |
|
|
|
29 |
|
|
var collapsed = $.cookie('Drupal.toolbar.collapsed');
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
if (collapsed == 1) {
|
33 |
|
|
Drupal.toolbar.collapse();
|
34 |
|
|
}
|
35 |
|
|
else {
|
36 |
|
|
Drupal.toolbar.expand();
|
37 |
|
|
}
|
38 |
|
|
};
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
Drupal.toolbar.collapse = function() {
|
44 |
|
|
var toggle_text = Drupal.t('Show shortcuts');
|
45 |
|
|
$('#toolbar div.toolbar-drawer').addClass('collapsed');
|
46 |
|
|
$('#toolbar a.toggle')
|
47 |
|
|
.removeClass('toggle-active')
|
48 |
|
|
.attr('title', toggle_text)
|
49 |
|
|
.html(toggle_text);
|
50 |
|
|
$('body').removeClass('toolbar-drawer').css('paddingTop', Drupal.toolbar.height());
|
51 |
|
|
$.cookie(
|
52 |
|
|
'Drupal.toolbar.collapsed',
|
53 |
|
|
1,
|
54 |
|
|
{
|
55 |
|
|
path: Drupal.settings.basePath,
|
56 |
|
|
|
57 |
|
|
expires: 36500
|
58 |
|
|
}
|
59 |
|
|
);
|
60 |
|
|
};
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
Drupal.toolbar.expand = function() {
|
66 |
|
|
var toggle_text = Drupal.t('Hide shortcuts');
|
67 |
|
|
$('#toolbar div.toolbar-drawer').removeClass('collapsed');
|
68 |
|
|
$('#toolbar a.toggle')
|
69 |
|
|
.addClass('toggle-active')
|
70 |
|
|
.attr('title', toggle_text)
|
71 |
|
|
.html(toggle_text);
|
72 |
|
|
$('body').addClass('toolbar-drawer').css('paddingTop', Drupal.toolbar.height());
|
73 |
|
|
$.cookie(
|
74 |
|
|
'Drupal.toolbar.collapsed',
|
75 |
|
|
0,
|
76 |
|
|
{
|
77 |
|
|
path: Drupal.settings.basePath,
|
78 |
|
|
|
79 |
|
|
expires: 36500
|
80 |
|
|
}
|
81 |
|
|
);
|
82 |
|
|
};
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
Drupal.toolbar.toggle = function() {
|
88 |
|
|
if ($('#toolbar div.toolbar-drawer').hasClass('collapsed')) {
|
89 |
|
|
Drupal.toolbar.expand();
|
90 |
|
|
}
|
91 |
|
|
else {
|
92 |
|
|
Drupal.toolbar.collapse();
|
93 |
|
|
}
|
94 |
|
|
};
|
95 |
|
|
|
96 |
|
|
Drupal.toolbar.height = function() {
|
97 |
|
|
var $toolbar = $('#toolbar');
|
98 |
|
|
var height = $toolbar.outerHeight();
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
var cssBoxShadowValue = $toolbar.css('box-shadow');
|
102 |
|
|
var boxShadow = (typeof cssBoxShadowValue !== 'undefined' && cssBoxShadowValue !== 'none');
|
103 |
|
|
|
104 |
|
|
|
105 |
|
|
if (!boxShadow && /DXImageTransform\.Microsoft\.Shadow/.test($toolbar.css('filter'))) {
|
106 |
|
|
height -= $toolbar[0].filters.item("DXImageTransform.Microsoft.Shadow").strength;
|
107 |
|
|
}
|
108 |
|
|
return height;
|
109 |
|
|
};
|
110 |
|
|
|
111 |
|
|
})(jQuery); |