Projet

Général

Profil

Révision c304a780

Ajouté par Assos Assos il y a environ 6 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/adminimal_admin_menu/CREDITS.txt
1
# Design and development
2
* [ANDiTKO](https://anditko.com/)
3

  
4
# Icons
5
* [Icons8](https://icons8.com/)
6
* [VisualPharm](https://visualpharm.com/)
drupal7/sites/all/modules/adminimal_admin_menu/README.txt
1
Quick info:
1
# Quick info
2 2
“Adminimal Administration Menu” changes the style of the
3 3
“Administration menu” module. It adds a nice and simple minimalist look and
4 4
provides some tweaks to improve you Drupal administration experience. 
5
The menu hierarchy is not simpler and easier to understand
6
(removing the unnecessary transparency and only highlighting the correct menus).
7
 It also adds shortcut links that can be edited from the core shortcut module. 
8
 The shortcut links fit nicely and have a small icon that separates them from
9
 the normal admin menu links.
10 5

  
11
Requirements:
12
Requires the administration menu module (http://drupal.org/project/admin_menu) 
6
The menu hierarchy is now easier to understand, by removing the unnecessary
7
transparency and only highlighting the correct menus.
13 8

  
14
Installation:
15
1) Download and install like any other drupal module
16
2) Enable the “Administration menu Adminimal Theme” from the module manager. 
9
It also adds shortcut links that can be edited from the core shortcut module.
10
The shortcut links fit nicely and have a small icon that separates them from
11
the normal admin menu links.
12

  
13
# Requirements
14
* [Administration menu module](http://drupal.org/project/admin_menu)
15

  
16
# Installation
17
1. Download and install like any other drupal module
18
2. Enable the “Administration menu Adminimal Theme” from the module manager.
17 19
If you are using the “Administration menu Toolbar style” it will be disabled
18 20
automatically to prevent some styling issues. This change will be saved in your
19 21
database, so if you decide to disable the “Administration menu Adminimal Theme”
20 22
your old “Administration menu Toolbar style” will be enabled automatically
21 23
so you have nothing to worry about.
22
3) Refresh your administration page and you must be good to go!
24
3. Refresh your administration page and you must be good to go!
drupal7/sites/all/modules/adminimal_admin_menu/adminimal_admin_menu.css
6 6
  font-weight: 300;
7 7
  src: local('Open Sans Light'), local('OpenSans-Light'), url(https://themes.googleusercontent.com/static/fonts/opensans/v6/DXI1ORHCpsQm3Vp6mXoaTRsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
8 8
}
9

  
10 9
@font-face {
11 10
  font-family: 'Open Sans';
12 11
  font-style: normal;
13 12
  font-weight: 400;
14 13
  src: local('Open Sans'), local('OpenSans'), url(https://themes.googleusercontent.com/static/fonts/opensans/v6/uYKcPVoh6c5R0NpdEY5A-Q.woff) format('woff');
15 14
}
16

  
17 15
@font-face {
18 16
  font-family: 'Open Sans';
19 17
  font-style: normal;
20 18
  font-weight: 600;
21 19
  src: local('Open Sans Semibold'), local('OpenSans-Semibold'), url(https://themes.googleusercontent.com/static/fonts/opensans/v6/MTP_ySUJH_bn48VBG8sNShsxEYwM7FgeyaSgU71cLG0.woff) format('woff');
22 20
}
23

  
24

  
25 21
/* Blink Animation */
26 22

  
27 23
@keyframes blink {
......
38 34
    color: #fff;
39 35
  }
40 36
}
41

  
42 37
@-moz-keyframes blink {
43 38
  0% {
44 39
    background-color: #f69231;
......
53 48
    color: #fff;
54 49
  }
55 50
}
56

  
57 51
@-webkit-keyframes blink {
58 52
  0% {
59 53
    background-color: #f69231;
......
68 62
    color: #fff;
69 63
  }
70 64
}
71

  
72 65
@-o-keyframes blink {
73 66
  0% {
74 67
    background-color: #f69231;
......
83 76
    color: #fff;
84 77
  }
85 78
}
86

  
87 79
body.admin-menu.adminimal-menu #admin-menu *::-moz-focus-inner {
88 80
  border: 0;
89 81
}
90

  
91 82
body.admin-menu.adminimal-menu {
92
  margin-top: 0px !important;
83
  margin-top: 0 !important;
93 84
}
94

  
95 85
body.admin-menu.adminimal-menu:before {
96 86
  content: "";
97 87
  display: block;
......
100 90
  top: 0;
101 91
  left: 0;
102 92
}
103

  
104 93
body.adminimal-menu div#admin-menu {
105 94
  background: #333;
106 95
  background: none repeat scroll 0 0 #202020;
107
  border-bottom: 1px solid #111111;
96
  border-bottom: 1px solid #111;
108 97
  font-family: Open Sans, "Segoe UI", "Helvetica", sans-serif;
109 98
}
110

  
111 99
body.adminimal-menu div#admin-menu li.admin-menu-toolbar-home-menu {
112 100
  background: transparent;
113 101
}
114

  
115 102
body.adminimal-menu div#admin-menu ul.dropdown span.admin-menu-home-icon {
116 103
  background: url("images/home.svg") no-repeat scroll 0 0 transparent;
117 104
  display: block;
......
119 106
  padding: 0;
120 107
  width: 15px;
121 108
}
122

  
123 109
body.adminimal-menu div#admin-menu a,
124 110
body.adminimal-menu div#admin-menu span {
125 111
  border: none !important;
......
127 113
  font-size: 12px;
128 114
  line-height: 18px;
129 115
}
130

  
131 116
body.adminimal-menu div#admin-menu a:hover {
132 117
  background-color: #0074bd;
133 118
  color: #fff;
134 119
}
135

  
136 120
body.adminimal-menu #admin-menu .dropdown li li {
137 121
  background-color: #1f1f1f;
138 122
}
139

  
140 123
body.adminimal-menu #admin-menu .dropdown li li.expandable ul {
141 124
  margin-top: -28px;
142 125
}
143

  
144 126
body.adminimal-menu #admin-menu .dropdown li li > li.admin-menu-toolbar-category {
145 127
  background: #fff !important;
146 128
}
147

  
148 129
body.adminimal-menu #admin-menu .dropdown li li li:hover,
149 130
body.adminimal-menu #admin-menu .dropdown li:hover {
150 131
  background: #0074bd !important;
151 132
}
152

  
153 133
body.adminimal-menu #admin-menu .dropdown a {
154 134
  border-right: none;
155 135
}
156

  
157 136
body.adminimal-menu #admin-menu .dropdown li.admin-menu-toolbar-category a {
158 137
  line-height: 20px;
159 138
}
160

  
161 139
body.adminimal-menu #admin-menu .dropdown li.admin-menu-toolbar-category a:focus {
162
  background: #0074BD;
140
  background: #0074bd;
163 141
}
164

  
165 142
body.adminimal-menu #admin-menu #admin-menu-wrapper .dropdown li li {
166 143
  opacity: 1;
167 144
}
168

  
169 145
body.adminimal-menu #admin-menu .dropdown li li:hover,
170 146
body.adminimal-menu #admin-menu .dropdown li li.iehover {
171 147
  background-color: #333;
172 148
}
173

  
174 149
body.adminimal-menu #admin-menu #admin-menu-wrapper .dropdown li li a {
175 150
  border: none;
176 151
}
177

  
178 152
body.adminimal-menu #admin-menu #admin-menu-wrapper .dropdown li li.expandable {
179 153
  background: url("images/square.png") no-repeat scroll 145px 11px #1f1f1f;
180 154
}
181

  
182 155
body.adminimal-menu #admin-menu #admin-menu-wrapper .dropdown li li.expandable a {
183 156
  background: transparent;
184 157
  padding-right: 25px;
185 158
}
186

  
187 159
body.adminimal-menu #admin-menu #admin-menu-wrapper .dropdown li li.expandable:hover {
188 160
  background: url("images/square.png") no-repeat scroll 145px -83px #0074bd !important;
189 161
}
190

  
191

  
192 162
/* Shortcuts bar */
193 163

  
194 164
body.adminimal-menu div.toolbar-shortcuts {
195 165
  float: left;
196 166
}
197

  
198 167
body.adminimal-menu div.shortcut-toolbar div#toolbar div.toolbar-shortcuts ul.menu {
199 168
  margin: 0;
200 169
  padding: 0;
201 170
}
202

  
203 171
body.adminimal-menu div.shortcut-toolbar div#toolbar div.toolbar-shortcuts ul.menu li {
204 172
  float: left;
205 173
  list-style: none outside none;
206 174
  padding: 0;
207 175
  margin: 0;
208 176
}
209

  
210 177
body.adminimal-menu div.shortcut-toolbar div#toolbar a#edit-shortcuts {
211 178
  float: right;
212 179
  line-height: 18px;
213 180
  padding: 5px 10px;
214 181
  text-decoration: none;
215 182
}
216

  
217 183
body.adminimal-menu div.shortcut-toolbar div#toolbar a#edit-shortcuts:hover {
218 184
  text-decoration: none;
219 185
}
220

  
221 186
body.adminimal-menu div.shortcut-toolbar div#toolbar a#edit-shortcuts:focus {
222
  background: #0074BD;
187
  background: #0074bd;
223 188
}
224

  
225 189
body.adminimal-menu #admin-menu .dropdown li ul {
226 190
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
227 191
}
228

  
229 192
body.adminimal-menu #admin-menu .dropdown li ul {
230
  border-top: 3px solid #0074BD;
193
  border-top: 3px solid #0074bd;
231 194
}
232

  
233 195
body.adminimal-menu #admin-menu .admin-menu-toolbar-category.expandable .dropdown li ul,
234 196
body.adminimal-menu #admin-menu .dropdown.admin-menu-search-results li ul {
235 197
  border-top: none;
236 198
}
237

  
238 199
body.adminimal-menu #admin-menu .dropdown li.admin-menu-action a {
239 200
  border: none !important;
240 201
}
241

  
242 202
body.adminimal-menu #admin-menu .dropdown li.admin-menu-action:first-child a {
243 203
  background: #444;
244 204
  padding: 5px 10px;
245 205
}
246

  
247 206
body.adminimal-menu #admin-menu .dropdown li.admin-menu-action:first-child a:hover,
248 207
body.adminimal-menu #admin-menu .dropdown li.admin-menu-action:first-child a:focus {
249 208
  background: #b73939;
250 209
}
251

  
252 210
body.adminimal-menu #admin-menu .dropdown li.admin-menu-action.admin-menu-users {
253 211
  border-left: 1px solid #000;
254 212
}
255

  
256 213
body.adminimal-menu #admin-menu .dropdown li.admin-menu-action.admin-menu-users a:hover {
257
  background: #0074BD;
214
  background: #0074bd;
258 215
}
259

  
260 216
body.adminimal-menu #admin-menu .dropdown li.admin-menu-action.admin-menu-account a {
261 217
  background: #4d8f46 !important;
262 218
  border: medium none;
263 219
  padding: 5px 10px;
264 220
}
265

  
266 221
body.adminimal-menu #admin-menu .dropdown li.admin-menu-action.admin-menu-account a:hover {
267 222
  background: #277d1e !important;
268 223
}
269

  
270 224
body.adminimal-menu #admin-menu #admin-menu-wrapper div#toolbar div.toolbar-shortcuts ul li a {
271 225
  background: url("images/shortcut.png") no-repeat scroll 7px 7px transparent;
272 226
  border-radius: 0 0 0 0;
......
275 229
  padding: 5px 10px;
276 230
  text-indent: 16px;
277 231
}
278

  
279 232
body.adminimal-menu #admin-menu #admin-menu-wrapper div#toolbar div.toolbar-shortcuts ul li a:hover {
280 233
  background-color: #0074bd;
281 234
  background-position: 7px -78px;
282 235
}
283

  
284 236
body.adminimal-menu #admin-menu .admin-menu-search input {
285 237
  background: none no-repeat scroll right center #444;
286 238
  border: medium none;
287 239
  border-radius: 0 0 0 0;
288
  color: #999999;
240
  color: #999;
289 241
  font-size: 12px;
290 242
  margin: 0 !important;
291 243
  outline: medium none;
......
293 245
  width: 110px;
294 246
  height: 20px;
295 247
}
296

  
297 248
body.adminimal-menu #admin-menu .admin-menu-search input:focus,
298 249
#admin-menu .admin-menu-search input:hover,
299 250
#admin-menu .admin-menu-search input:active {
300 251
  background: none no-repeat scroll right center #888;
301 252
  color: #eee;
302 253
}
303

  
304 254
body.adminimal-menu li.admin-menu-search:hover {
305 255
  background: transparent !important;
306 256
}
307

  
308 257
body.adminimal-menu div#admin-menu li.highlight {
309 258
  background-color: #ef6114;
310 259
  animation: blink 1s ease both infinite;
......
313 262
  -o-animation: blink 1s ease both infinite;
314 263
  color: #fff !important;
315 264
}
316

  
317 265
body.adminimal-menu #admin-menu li.highlight > a,
318 266
body.adminimal-menu #admin-menu li.highlight > li {
319 267
  border-color: #ef6114;
......
323 271
  -webkit-animation: blink 1s ease both infinite;
324 272
  -o-animation: blink 1s ease both infinite;
325 273
}
326

  
327

  
328 274
/* Newline render mode */
329 275

  
330 276
body.adminimal-menu.admin-menu.menu-render-newline div#admin-menu div#admin-menu-wrapper div.shortcut-toolbar {
331 277
  clear: both;
332 278
  border-top: 1px solid #000;
333 279
}
334

  
335
body.adminimal-menu.admin-menu.menu-render-newline {
336
  margin-top: 56px !important;
280
body.admin-menu.adminimal-menu.menu-render-newline:before {
281
  height: 56px;
337 282
}
338

  
339 283
body.adminimal-menu.admin-menu.menu-render-newline #overlay-container,
340 284
body.adminimal-menu.admin-menu.newline .overlay-modal-background,
341 285
body.adminimal-menu.admin-menu.newline .overlay-element,
342 286
body.adminimal-menu.admin-menu.newline #overlay {
343 287
  padding-top: 30px !important;
344 288
}
345

  
346

  
347 289
/* Collapsed render mode */
348 290

  
349 291
body.adminimal-menu.admin-menu.menu-render-collapsed div.shortcut-toolbar div#toolbar div.toolbar-shortcuts ul.menu {
350 292
  position: absolute;
351 293
}
352

  
353 294
body.adminimal-menu.admin-menu.menu-render-collapsed div.shortcut-toolbar div#toolbar div.toolbar-shortcuts ul.menu li {
354 295
  float: none;
355 296
  display: none;
356 297
  border: none;
357 298
}
358

  
359 299
body.adminimal-menu.admin-menu.menu-render-collapsed div.shortcut-toolbar div#toolbar div.toolbar-shortcuts ul.menu li.label {
360 300
  display: block;
361 301
  cursor: default;
362 302
}
363

  
364 303
body.adminimal-menu.admin-menu.menu-render-collapsed div.shortcut-toolbar div#toolbar div.toolbar-shortcuts ul.menu li.label a:hover {
365 304
  background: url("images/shortcut.png") no-repeat scroll 7px 7px #202020 !important;
366
  color: #EEEEEE !important;
305
  color: #eee !important;
367 306
}
368

  
369 307
body.adminimal-menu.admin-menu.menu-render-collapsed div.shortcut-toolbar div#toolbar div.toolbar-shortcuts ul.menu:hover li {
370 308
  display: block;
371 309
  background: #202020;
372 310
}
373

  
374

  
375 311
/* Dropdown render mode */
376 312

  
377 313
body.adminimal-menu.admin-menu.menu-render-dropdown .toolbar-shortcuts select#shortcut-menu {
378 314
  -webkit-appearance: none;
379
  background: url("images/shortcut.png") no-repeat scroll 7px 7px #222222;
315
  background: url("images/shortcut.png") no-repeat scroll 7px 7px #222;
380 316
  border: medium none;
381
  color: #EEEEEE;
317
  color: #eee;
382 318
  font-family: "Open Sans", "Segoe UI", "Helvetica", sans-serif;
383 319
  font-size: 12px;
384 320
  padding: 5px 4px 4px 24px;
385 321
}
386

  
387 322
body.adminimal-menu.admin-menu.menu-render-dropdown .toolbar-shortcuts select#shortcut-menu option:hover {
388 323
  cursor: pointer;
389 324
}
390

  
391 325
body.adminimal-menu.admin-menu.menu-render-dropdown .toolbar-shortcuts select#shortcut-menu option:first-child {
392 326
  display: none;
393 327
}
394

  
395 328
body.adminimal-menu #admin-menu .dropdown .admin-menu-tab {
396 329
  background: #444;
397 330
  padding-bottom: 2px;
398 331
}
399

  
400

  
401 332
/* Environment indicator 2.x */
402 333

  
403 334
body.adminimal-menu #admin-menu #environment-indicator {
404 335
  text-shadow: none;
405 336
}
406

  
407 337
body.adminimal-menu #admin-menu #environment-indicator .environment-indicator-name {
408 338
  background-image: none;
409 339
  border-left: 1px solid #323232;
......
412 342
  line-height: 18px;
413 343
  padding: 5px 10px;
414 344
}
415

  
416 345
body.adminimal-menu #admin-menu #admin-menu-wrapper div#toolbar div.toolbar-shortcuts ul,
417 346
body.adminimal-menu #admin-menu #admin-menu-wrapper div#toolbar div.toolbar-shortcuts ul li {
418 347
  margin: 0;
419 348
  padding: 0;
420 349
}
421

  
422 350
body.adminimal-menu #admin-menu .admin-menu-search input {
423 351
  background: none no-repeat scroll right center #444;
424 352
  border: medium none;
425 353
  -webkit-border-radius: 0 0 0 0;
426 354
  -moz-border-radius: 0 0 0 0;
427 355
  border-radius: 0 0 0 0;
428
  color: #999999;
356
  color: #999;
429 357
  font-size: 12px;
430 358
  margin: 0 !important;
431 359
  outline: medium none;
......
438 366
  height: 28px;
439 367
  box-sizing: border-box;
440 368
}
369
#admin-menu-search .form-item.form-type-textfield label.control-label {
370
  display: none;
371
}
drupal7/sites/all/modules/adminimal_admin_menu/adminimal_admin_menu.info
3 3
package = Administration
4 4
core = 7.x
5 5
dependencies[] = admin_menu
6
configure = admin/config/administration/adminimal_menu
6 7

  
7
; Information added by Drupal.org packaging script on 2015-12-03
8
version = "7.x-1.7"
8
; Information added by Drupal.org packaging script on 2018-02-28
9
version = "7.x-1.8"
9 10
core = "7.x"
10 11
project = "adminimal_admin_menu"
11
datestamp = "1449182323"
12
datestamp = "1519846986"
12 13

  
drupal7/sites/all/modules/adminimal_admin_menu/adminimal_admin_menu.install
84 84
 */
85 85
function adminimal_admin_menu_update_7100() {
86 86

  
87
  // Include the update file.
88
  include 'updates/update_7100.php';
87
  // Define Adminimal Menu path.
88
  $module_path = drupal_get_path('module', 'adminimal_admin_menu');
89 89

  
90
  if (file_exists($module_path . '/adminimal_admin_menu.js')) {
91
    // Delete the "adminimal_admin_menu.js" file.
92
    file_unmanaged_delete($module_path . '/adminimal_admin_menu.js');
93
  }
94

  
95
  if (file_exists($module_path . '/slicknav')) {
96
    // Empty the "slicknav" folder.
97
    file_unmanaged_delete_recursive($module_path . '/slicknav');
98

  
99
    // Delete the "slicknav" folder.
100
    drupal_rmdir($module_path . '/slicknav');
101
  }
90 102
}
drupal7/sites/all/modules/adminimal_admin_menu/adminimal_admin_menu.module
20 20
  );
21 21

  
22 22
  return $items;
23

  
24 23
}
25 24

  
26 25
/**
......
31 30
    return;
32 31
  }
33 32
  $path = drupal_get_path('module', 'adminimal_admin_menu');
34
	$load_slicknav = variable_get('adminimal_admin_menu_slicknav', TRUE );
35
	$load_jQuery = variable_get('adminimal_admin_menu_jquery', TRUE );
33
  $load_slicknav = variable_get('adminimal_admin_menu_slicknav', TRUE);
34
  $load_jquery = variable_get('adminimal_admin_menu_jquery', TRUE);
36 35

  
37 36
  // Attach the CSS and JavaScript assets.
38 37
  drupal_add_css($path . '/adminimal_admin_menu.css');
39 38

  
40
	// Support for the Environment Indicator module.
41
  if (module_exists('environment_indicator')) {
42
  $environment_info = environment_indicator_get_active();
43
	  drupal_add_css('
44
      div.slicknav_menu a.slicknav_btn:after {
45
      	content: "' . $environment_info['name']. '";
46
      	margin-left: 1em;
47
      	color: ' . $environment_info['text_color'] . ';
48
      	font-size: 12px;
49
      	background-color: ' . $environment_info['color'] . ';
50
				padding: 2px 5px;
51
			}
52
			#admin-menu-wrapper {background: #222 !important;}
53
			',
54
      array(
55
        'group' => CSS_DEFAULT,
56
        'type' => 'inline',
57
        'preprocess' => FALSE,
58
        'weight' => '100',
59
      ));
60
	}
61

  
62
	// Check if both slicknav and custom jQuery must be loaded.
63
	if ($load_slicknav and $load_jQuery) {
64
	  drupal_add_js($path . '/js/jquery.min.js', array( 'type' => 'file', 'scope' => 'header', 'weight' => 888 ));
65
		drupal_add_js($path . '/js/slicknav/jquery-no-conflict.slicknav.js', array( 'type' => 'file', 'scope' => 'header', 'weight' => 888 ));
66
		drupal_add_css($path . '/js/slicknav/slicknav.css');
67
	}
68
	elseif ($load_slicknav and !$load_jQuery) {
69
		drupal_add_js($path . '/js/slicknav/jquery.slicknav.js', array( 'type' => 'file', 'scope' => 'header', 'weight' => 888 ));
70
		drupal_add_css($path . '/js/slicknav/slicknav.css');
71
	}
72

  
73
	drupal_add_js($path . '/js/adminimal_admin_menu.js', array( 'type' => 'file', 'scope' => 'header', 'weight' => 888 ));
39
  _adminimal_admin_menu_support_environment_indicator();
40

  
41
  // Check if both slicknav and custom jQuery must be loaded.
42
  if ($load_slicknav and $load_jquery) {
43
    drupal_add_js($path . '/js/jquery.min.js', array(
44
      'type' => 'file',
45
      'scope' => 'header',
46
      'weight' => 888,
47
    ));
48
    drupal_add_js($path . '/js/slicknav/jquery-no-conflict.slicknav.js', array(
49
      'type' => 'file',
50
      'scope' => 'header',
51
      'weight' => 888,
52
    ));
53
    drupal_add_css($path . '/js/slicknav/slicknav.css');
54
  }
55
  elseif ($load_slicknav and !$load_jquery) {
56
    drupal_add_js($path . '/js/slicknav/jquery.slicknav.js', array(
57
      'type' => 'file',
58
      'scope' => 'header',
59
      'weight' => 888,
60
    ));
61
    drupal_add_css($path . '/js/slicknav/slicknav.css');
62
  }
63

  
64
  drupal_add_js($path . '/js/adminimal_admin_menu.js', array(
65
    'type' => 'file',
66
    'scope' => 'header',
67
    'weight' => 888,
68
  ));
74 69

  
75 70
  if (!isset($page['page_bottom']['admin_menu'])) {
76 71
    return;
......
99 94
    'data' => array('admin_menu' => array('toolbar' => $settings)),
100 95
    'type' => 'setting',
101 96
  );
97
}
98

  
99
/**
100
 * Add CSS for module environment_indicator.
101
 */
102
function _adminimal_admin_menu_support_environment_indicator() {
103
  if (!module_exists('environment_indicator')) {
104
    return;
105
  }
106

  
107
  $environment_info = environment_indicator_get_active();
102 108

  
109
  if (!environment_indicator_check_access($environment_info)) {
110
    return;
111
  }
112

  
113
  drupal_add_css('
114
      div.slicknav_menu a.slicknav_btn:after {
115
        content: "' . $environment_info['name'] . '";
116
        margin-left: 1em;
117
        color: ' . $environment_info['text_color'] . ';
118
        font-size: 12px;
119
        background-color: ' . $environment_info['color'] . ';
120
        padding: 2px 5px;
121
      }
122
      #admin-menu-wrapper {background: #222 !important;}
123
      ',
124
    array(
125
      'group' => CSS_DEFAULT,
126
      'type' => 'inline',
127
      'preprocess' => FALSE,
128
      'weight' => '100',
129
    ));
103 130
}
104 131

  
105 132
/**
......
140 167
  unset($content['icon']['icon']['#theme']);
141 168
  $content['icon']['icon']['#title'] = '<span class="admin-menu-home-icon">&nbsp;</span>';
142 169
  $content['icon']['icon']['#attributes']['class'][] = 'admin-menu-toolbar-home-menu';
170
  // @todo Fix this CS-issue.
143 171
  $page['#attributes']['class'][] = 'adminimal-menu';
144 172

  
145 173
  // Hide the menu.
......
152 180
    }
153 181
  }
154 182

  
155
	// Create the responsive menu.
156
	if (variable_get('adminimal_admin_menu_slicknav', 'TRUE')) {
157
	  // Prepare the responsive menu and Join the Icon menu with the administration menu.
158
	  $responsivemenu = array_merge($content['icon'], $content['menu']);
159
	
160
	  // Give it ID to target it later with js and css.
161
	  $responsivemenu['#wrapper_attributes']['id'] = 'admin-menu-menu-responsive';
162
	
163
	  // Move the icon menu to the top.
164
	  $responsivemenu['icon']['#weight'] = '-100';
165
	
166
	  // Change the link title to Administration.
167
	  $responsivemenu['admin/index']['#title'] = t('Administration');
168
	
169
	  // Bind the responsive menu the the content varable so it can be rendered.
170
	  $content['responsive-menu'] = $responsivemenu;
171
	
172
	  // Create the responsive shortucts.
173
	  $content['responsive']['shortcuts'] = array(
174
	    '#prefix' => '<div id="admin-menu-shortcuts-responsive">',
175
	    '#suffix' => '</div>',
176
	    '#pre_render' => array('shortcut_toolbar_pre_render'),
177
	  );
178
	}
183
  // Create the responsive menu.
184
  if (variable_get('adminimal_admin_menu_slicknav', TRUE)) {
185
    // Join the Icon menu with the administration menu.
186
    $responsivemenu = array_merge($content['icon'], $content['menu']);
187

  
188
    // Give it ID to target it later with js and css.
189
    $responsivemenu['#wrapper_attributes']['id'] = 'admin-menu-menu-responsive';
190

  
191
    // Move the icon menu to the top.
192
    $responsivemenu['icon']['#weight'] = '-100';
193

  
194
    // Change the link title for 'admin/index' to Administration if it exists.
195
    if (!empty($responsivemenu['admin/index'])) {
196
      $responsivemenu['admin/index']['#title'] = t('Administration');
197
    }
198

  
199
    // Add the account menu, and push account and logout links toward bottom.
200
    $responsivemenu = array_merge($content['account'], $responsivemenu);
201
    $responsivemenu['account']['#weight'] = 99;
202
    $responsivemenu['logout']['#weight'] = 100;
203

  
204
    // Bind the responsive menu the the content varable so it can be rendered.
205
    $content['responsive-menu'] = $responsivemenu;
206

  
207
    // Create the responsive shortucts.
208
    $content['responsive']['shortcuts'] = array(
209
      '#prefix' => '<div id="admin-menu-shortcuts-responsive">',
210
      '#suffix' => '</div>',
211
      '#pre_render' => array('shortcut_toolbar_pre_render'),
212
    );
213
  }
179 214
}
180 215

  
181 216
/**
......
199 234
  // Add the shortcut render mode class.
200 235
  $vars['classes_array'][] = 'menu-render-' . variable_get('adminimal_admin_menu_render', 'collapsed');
201 236

  
202
  // Fix the viewport, correcting the mobile device zoom.
203
  /** @todo - Mybre remove this and let the theme manage the view pont.
204
   *  But i was suprised that only few "responsive" drupal themes were fixing
205
   *  the viewport.
237
  /*
238
   * Fix the viewport, correcting the mobile device zoom.
239
   *
240
   * @todo Maybe remove this and let the theme manage the view point.
241
   *   But i was suprised that only few "responsive" drupal themes were fixing
242
   *   the viewport.
206 243
   */
207 244
  $viewport = array(
208
   '#tag' => 'meta',
209
   '#attributes' => array(
210
     'name' => 'viewport',
211
     'content' => 'width=device-width, initial-scale=1, maximum-scale=1',
212
   ),
245
    '#tag' => 'meta',
246
    '#attributes' => array(
247
      'name' => 'viewport',
248
      'content' => 'width=device-width, initial-scale=1, maximum-scale=1',
249
    ),
213 250
  );
214 251
  drupal_add_html_head($viewport, 'viewport');
215 252

  
......
217 254

  
218 255
/**
219 256
 * Check if the user has access to use the admin menu.
220
 * @return  boolean Result of access checks.
257
 *
258
 * @return bool
259
 *   Result of access checks.
221 260
 */
222 261
function _adminimal_admin_menu_access() {
223 262
  if (!user_access('access administration menu') || admin_menu_suppress(FALSE)) {
drupal7/sites/all/modules/adminimal_admin_menu/adminimal_menu_settings.inc
13 13
  // Create the shortcut category.
14 14
  $form['shortcuts'] = array(
15 15
    '#type' => 'fieldset',
16
    '#title' => t('Shortcuts options'),
16
    '#title' => t('Shortcut options'),
17 17
  );
18 18

  
19 19
  // Create the select list.
......
29 29
      'dropdown' => t('Dropdown'),
30 30
      'exclusive' => t('Exclusive'),
31 31
    ),
32
    '#description' => t('Select how the shortcuts will be rendered. There are currently 6 options: <ol> <li>Hidden -> The shortcuts will not be rendered inside the admin menu</li> <li>Inline -> The shortcuts will be rendered on the same line with the root menu links</li> <li>Collapsed -> The sorctus links will be collapsed like a normal menu. <strong>(Default option)</strong></li> <li>Newline -> The shortcuts will be rendered on a new line. Below the root menu links.</li> <li>Dropdown -> The shortcuts will be rendered inside a dropdown using the select html tag.</li> <li>Exclusive -> Only the shortcuts will be rendered, and the normal menu will be hidden.</li></ol>'),
32
    '#description' => t('Select how shortcuts will be rendered: <ul> <li>Hidden: Shortcuts will not be rendered inside the admin menu.</li> <li>Inline: Shortcuts will be rendered on the same line with the root menu links.</li> <li>Collapsed: Shortcuts will be collapsed like a normal menu. <strong>(Default option)</strong></li> <li>Newline: Shortcuts will be rendered on a new line. Below the root menu links.</li> <li>Dropdown: Shortcuts will be rendered inside a dropdown using the select html tag.</li> <li>Exclusive: Only the shortcuts will be rendered; the normal menu will be hidden.</li></ul>'),
33 33
    '#required' => TRUE,
34 34
  );
35 35

  
36
  // Create the shortcut category.
36
  // Create the advanced settings category.
37 37
  $form['advanced_settings'] = array(
38 38
    '#type' => 'fieldset',
39 39
    '#title' => t('Advanced Settings'),
40 40
    '#description' => '<div class="messages warning">WARNING: Do not change any of the advanced setting unless you know what you are doing!</div>',
41 41
  );
42 42

  
43
	$form['advanced_settings']['adminimal_admin_menu_slicknav'] = array(
44
	  '#type' => 'checkbox',
45
	  '#default_value' => variable_get('adminimal_admin_menu_slicknav', 'TRUE'),
46
	  '#title' => t('Enable Responsive Menu.'),
47
	  '#description' => t('<strong>Default value => Checked</strong>. 
43
  $form['advanced_settings']['adminimal_admin_menu_slicknav'] = array(
44
    '#type' => 'checkbox',
45
    '#default_value' => variable_get('adminimal_admin_menu_slicknav', TRUE),
46
    '#title' => t('Enable Responsive Menu.'),
47
    '#description' => t('<strong>Default value => Checked</strong>. 
48 48
	  Enable this option if you want to have responsive menu and mobile device support. 
49
	  While disabling this option could save you few kilobytes (around 3KB), i will completely disable the responsive menu functionality.'),
50
	);
49
	  While disabling this option could save you few kilobytes (around 3KB), it will completely disable the responsive menu functionality.'),
50
  );
51 51

  
52
	$form['advanced_settings']['adminimal_admin_menu_jquery'] = array(
53
	  '#type' => 'checkbox',
54
	  '#default_value' => variable_get('adminimal_admin_menu_jquery', 'TRUE'),
55
	  '#title' => t('Load the requred jQuery 1.7 library automagically.'),
56
	  '#description' => t('<strong>Default value => Checked</strong>. This will load the newer jQuery version 1.7 using 
57
	  the no-conflict method so it wont interfere with any existing jQuery or other java-script libraries. 
58
	  The only reason to uncheck this if you are already using a newer version of jQuery site-wide and its globally accessible by the "$" variable. 
59
	  Unchekig this option could save you 33KB, but it may also break your javasctipt if not used correctly.'),
52
  $form['advanced_settings']['adminimal_admin_menu_jquery'] = array(
53
    '#type' => 'checkbox',
54
    '#default_value' => variable_get('adminimal_admin_menu_jquery', TRUE),
55
    '#title' => t('Load the required jQuery 1.7 library automagically.'),
56
    '#description' => t('<strong>Default value => Checked</strong>. This will load the newer jQuery version 1.7 using 
57
	  the no-conflict method so it won\'t interfere with any existing jQuery or other JavaScript libraries. 
58
	  The only reason to un-check this if you are already using a newer version of jQuery site-wide and its globally accessible by the "$" variable. 
59
	  Un-cheking this option could save you 33KB, but it may also break your JavaScript if not used correctly.'),
60 60
    '#states' => array(
61 61
      // Hide the settings when the cancel notify checkbox is disabled.
62 62
      'visible' => array(
63
       ':input[name="adminimal_admin_menu_slicknav"]' => array('checked' => TRUE),
63
        ':input[name="adminimal_admin_menu_slicknav"]' => array('checked' => TRUE),
64 64
      ),
65 65
      'unchecked' => array(
66
       variable_get('adminimal_admin_menu_jquery', 'TRUE') => FALSE,
66
        variable_get('adminimal_admin_menu_jquery', TRUE) => FALSE,
67 67
      ),
68
     ),
69
	);
68
    ),
69
  );
70 70

  
71 71
  // Create the submit button.
72 72
  $form['submit'] = array(
drupal7/sites/all/modules/adminimal_admin_menu/credits.txt
1
Designed and developed by: ANDiTKO -> http://anditko.com
2
Some of the Icons are from the Icons8 set -> http://icons8.com/ and -> http://VisualPharm.com
drupal7/sites/all/modules/adminimal_admin_menu/js/adminimal_admin_menu.js
1
(function($) {
1
(function ($) {
2 2

  
3
Drupal.admin = Drupal.admin || {};
4
Drupal.admin.behaviors = Drupal.admin.behaviors || {};
3
  Drupal.admin = Drupal.admin || {};
4
  Drupal.admin.behaviors = Drupal.admin.behaviors || {};
5 5

  
6
/**
7
 * @ingroup admin_behaviors
8
 * @{
9
 */
6
  /**
7
   * @ingroup admin_behaviors
8
   * @{
9
   */
10 10

  
11
/**
12
 * Apply active trail highlighting based on current path.
13
 *
14
 * @todo Not limited to toolbar; move into core?
15
 */
16
Drupal.admin.behaviors.toolbarActiveTrail = function (context, settings, $adminMenu) {
17
  if (settings.admin_menu.toolbar && settings.admin_menu.toolbar.activeTrail) {
18
    $adminMenu.find('> div > ul > li > a[href="' + settings.admin_menu.toolbar.activeTrail + '"]').addClass('active-trail');
19
  }
20
};
11
  /**
12
   * Apply active trail highlighting based on current path.
13
   *
14
   * @todo Not limited to toolbar; move into core?
15
   */
16
  Drupal.admin.behaviors.toolbarActiveTrail = function (context, settings, $adminMenu) {
17
    if (settings.admin_menu.toolbar && settings.admin_menu.toolbar.activeTrail) {
18
      $adminMenu.find('> div > ul > li > a[href="' + settings.admin_menu.toolbar.activeTrail + '"]').addClass('active-trail');
19
    }
20
  };
21 21

  
22
Drupal.admin.behaviors.shorcutcollapsed = function (context, settings, $adminMenu) {
22
  Drupal.admin.behaviors.shorcutcollapsed = function (context, settings, $adminMenu) {
23 23

  
24
  // Create the dropdown base 
25
  $("<li class=\"label\"><a>"+Drupal.t('Shortcuts')+"</a></li>").prependTo("body.menu-render-collapsed #toolbar div.toolbar-shortcuts ul"); 
24
    // Create the dropdown base
25
    $('<li class="label"><a>' + Drupal.t('Shortcuts') + '</a></li>').prependTo("body.menu-render-collapsed #toolbar div.toolbar-shortcuts ul");
26 26

  
27
};
27
  };
28 28

  
29
Drupal.admin.behaviors.shorcutselect = function (context, settings, $adminMenu) {
29
  Drupal.admin.behaviors.shorcutselect = function (context, settings, $adminMenu) {
30 30

  
31
  // Create the dropdown base
32
  $("<select id='shortcut-menu'/>").appendTo("body.menu-render-dropdown #toolbar div.toolbar-shortcuts");
31
    // Create the dropdown base
32
    $('<select id="shortcut-menu"/>').appendTo("body.menu-render-dropdown #toolbar div.toolbar-shortcuts");
33 33

  
34
  // Create default option "Select"
35
  $("<option />", {
36
    "selected"  :  "selected",
37
    "value"     :  "",
38
    "text"      :  Drupal.t('Shortcuts')
39
  }).appendTo("body.menu-render-dropdown #toolbar div.toolbar-shortcuts select");
40

  
41
  // Populate dropdown with menu items
42
  $("body.menu-render-dropdown #toolbar div.toolbar-shortcuts a").each(function() {
43
    var el = $(this);
34
    // Create default option "Select"
44 35
    $("<option />", {
45
      "value"   :  el.attr("href"),
46
      "text"    :  el.text()
36
      "selected": "selected",
37
      "value": "",
38
      "text": Drupal.t('Shortcuts')
47 39
    }).appendTo("body.menu-render-dropdown #toolbar div.toolbar-shortcuts select");
40

  
41
    // Populate dropdown with menu items
42
    $("body.menu-render-dropdown #toolbar div.toolbar-shortcuts a").each(function () {
43
      var el = $(this);
44
      $("<option />", {
45
        "value": el.attr("href"),
46
        "text": el.text()
47
      }).appendTo("body.menu-render-dropdown #toolbar div.toolbar-shortcuts select");
48
    });
49

  
50
    $("body.menu-render-dropdown #toolbar div.toolbar-shortcuts select").change(function () {
51
      window.location = $(this).find("option:selected").val();
48 52
    });
49 53

  
50
  $("body.menu-render-dropdown #toolbar div.toolbar-shortcuts select").change(function() {
51
    window.location = $(this).find("option:selected").val();
52
  });
54
    $('body.menu-render-dropdown #toolbar div.toolbar-shortcuts ul').remove();
53 55

  
54
  $('body.menu-render-dropdown #toolbar div.toolbar-shortcuts ul').remove();
56
  };
55 57

  
56
};
58
  // Ovveride front link if changed by another module for the mobile menu.
59
  Drupal.admin.behaviors.mobile_front_link = function (context, settings, $adminMenu) {
60
    $("ul.slicknav_nav li.admin-menu-toolbar-home-menu a>a").attr("href", $("#admin-menu-icon > li > a").attr('href'));
61
  };
57 62

  
58 63
})(jQuery);
drupal7/sites/all/modules/adminimal_admin_menu/js/slicknav/jquery-no-conflict.slicknav.js
4 4
	licensed under MIT
5 5
*/
6 6
;(function ($, document, window) {
7
	var
8
	// default settings object.
9
	defaults = {
10
		label: 'MENU',
11
		duplicate: true,
12
		duration: 200,
13
		easingOpen: 'swing',
14
		easingClose: 'swing',
15
		closedSymbol: '&#9658;',
16
		openedSymbol: '&#9660;',
17
		prependTo: 'body',
18
		parentTag: 'a',
19
		closeOnClick: false,
20
		allowParentLinks: false,
21
		init: function(){},
22
		open: function(){},
23
		close: function(){}
24
	},
25
	mobileMenu = 'slicknav',
26
	prefix = 'slicknav';
27
	
28
	function Plugin( element, options ) {
29
		this.element = element;
30

  
31
        // jQuery has an extend method which merges the contents of two or
32
        // more objects, storing the result in the first object. The first object
33
        // is generally empty as we don't want to alter the default options for
34
        // future instances of the plugin
35
        this.settings = $.extend( {}, defaults, options) ;
36
        
37
        this._defaults = defaults;
38
        this._name = mobileMenu;
39
        
40
        this.init();
41
	}
42
	
43
	Plugin.prototype.init = function () {
44
        var $this = this;
45
		var menu = $(this.element);
46
		var settings = this.settings;
47
		
48
		// clone menu if needed
49
		if (settings.duplicate) {
50
			$this.mobileNav = menu.clone();
51
			//remove ids from clone to prevent css issues
52
			$this.mobileNav.removeAttr('id');
53
			$this.mobileNav.find('*').each(function(i,e){
54
				$(e).removeAttr('id');
55
			});
56
		}
57
		else
58
			$this.mobileNav = menu;
59
		
60
		// styling class for the button
61
		var iconClass = prefix+'_icon';
62
		
63
		if (settings.label == '') {
64
			iconClass += ' '+prefix+'_no-text';
65
		}
66
		
67
		if (settings.parentTag == 'a') {
68
			settings.parentTag = 'a href="#"';
69
		}
70
		
71
		// create menu bar
72
		$this.mobileNav.attr('class', prefix+'_nav');
73
		var menuBar = $('<div class="'+prefix+'_menu"></div>');
74
		$this.btn = $('<'+settings.parentTag+' aria-haspopup="true" tabindex="0" class="'+prefix+'_btn '+prefix+'_collapsed"><span class="'+prefix+'_menutxt">'+settings.label+'</span><span class="'+iconClass+'"><span class="'+prefix+'_icon-bar"></span><span class="'+prefix+'_icon-bar"></span><span class="'+prefix+'_icon-bar"></span></span></a>');
75
		$(menuBar).append($this.btn);		
76
		$(settings.prependTo).prepend(menuBar);
77
		menuBar.append($this.mobileNav);
78
		
79
		// iterate over structure adding additional structure
80
		var items = $this.mobileNav.find('li');
81
		$(items).each(function () {
82
			var item = $(this);
83
			data = {};
84
			data.children = item.children('ul').attr('role','menu');
85
			item.data("menu", data);
86
			
87
			// if a list item has a nested menu
88
			if (data.children.length > 0) {
89
			
90
				// select all text before the child menu
91
				var a = item.contents();
92
				var nodes = [];
93
				$(a).each(function(){
94
					if(!$(this).is("ul")) {
95
						nodes.push(this);
96
					}
97
					else {
98
						return false;
99
					}
100
				});
101
				
102
				// wrap item text with tag and add classes
103
				var wrap = $(nodes).wrapAll('<'+settings.parentTag+' role="menuitem" aria-haspopup="true" tabindex="-1" class="'+prefix+'_item"/>').parent();
104
				
105
				item.addClass(prefix+'_collapsed');
106
				item.addClass(prefix+'_parent');
107
				
108
				// create parent arrow
109
				$(nodes).last().after('<span class="'+prefix+'_arrow">'+settings.closedSymbol+'</span>');
110
				
111
			
112
			} else if ( item.children().length == 0) {
113
				 item.addClass(prefix+'_txtnode');
114
			}
115
			
116
			// accessibility for links
117
			item.children('a').attr('role', 'menuitem').click(function(){
118
				//Emulate menu close if set
119
				if (settings.closeOnClick)
120
					$($this.btn).click();
121
			});
122
		});
123
		
124
		// structure is in place, now hide appropriate items
125
		$(items).each(function () {
126
			var data = $(this).data("menu");
127
			$this._visibilityToggle(data.children, false, null, true);
128
		});
129
		
130
		// finally toggle entire menu
131
		$this._visibilityToggle($this.mobileNav, false, 'init', true);
132
		
133
		// accessibility for menu button
134
		$this.mobileNav.attr('role','menu');
135
		
136
		// outline prevention when using mouse
137
		$(document).mousedown(function(){
138
			$this._outlines(false);
139
		});
140
		
141
		$(document).keyup(function(){
142
			$this._outlines(true);
143
		});
144
		
145
		// menu button click
146
		$($this.btn).click(function (e) {
147
			e.preventDefault();
148
			$this._menuToggle();			
149
		});
150
		
151
		// click on menu parent
152
		$this.mobileNav.on('click', '.'+prefix+'_item', function(e){
153
			e.preventDefault();
154
			$this._itemClick($(this));
155
		});
156
		
157
		// check for enter key on menu button and menu parents
158
		$($this.btn).keydown(function (e) {
159
			var ev = e || event;
160
			if(ev.keyCode == 13) {
161
				e.preventDefault();
162
				$this._menuToggle();
163
			}
164
		});
165
		
166
		$this.mobileNav.on('keydown', '.'+prefix+'_item', function(e) {
167
			var ev = e || event;
168
			if(ev.keyCode == 13) {
169
				e.preventDefault();
170
				$this._itemClick($(e.target));
171
			}
172
		});
173
		
174
		// allow links clickable within parent tags if set
175
		if (settings.allowParentLinks) {
176
			$('.'+prefix+'_item a').click(function(e){
177
					e.stopImmediatePropagation();
178
			});
179
		}
180
    };
181
	
182
	//toggle menu
183
	Plugin.prototype._menuToggle = function(el){
184
		var $this = this;
185
		var btn = $this.btn;
186
		var mobileNav = $this.mobileNav;
187
		
188
		if (btn.hasClass(prefix+'_collapsed')) {
189
			btn.removeClass(prefix+'_collapsed');
190
			btn.addClass(prefix+'_open');
191
		} else {
192
			btn.removeClass(prefix+'_open');
193
			btn.addClass(prefix+'_collapsed');
194
		}
195
		btn.addClass(prefix+'_animating');
196
		$this._visibilityToggle(mobileNav, true, btn);
197
	}
198
	
199
	// toggle clicked items
200
	Plugin.prototype._itemClick = function(el) {
201
		var $this = this;
202
		var settings = $this.settings;
203
		var data = el.data("menu");
204
		if (!data) {
205
			data = {};
206
			data.arrow = el.children('.'+prefix+'_arrow');
207
			data.ul = el.next('ul');
208
			data.parent = el.parent();
209
			el.data("menu", data);
210
		}
211
		if (data.parent.hasClass(prefix+'_collapsed')) {
212
			data.arrow.html(settings.openedSymbol);
213
			data.parent.removeClass(prefix+'_collapsed');
214
			data.parent.addClass(prefix+'_open');
215
			data.parent.addClass(prefix+'_animating');
216
			$this._visibilityToggle(data.ul, true, el);
217
		} else {
218
			data.arrow.html(settings.closedSymbol);
219
			data.parent.addClass(prefix+'_collapsed');
220
			data.parent.removeClass(prefix+'_open');
221
			data.parent.addClass(prefix+'_animating');
222
			$this._visibilityToggle(data.ul, true, el);
223
		}
224
	}
225

  
226
	// toggle actual visibility and accessibility tags
227
	Plugin.prototype._visibilityToggle = function(el, animate, trigger, init) {
228
		var $this = this;
229
		var settings = $this.settings;
230
		var items = $this._getActionItems(el);
231
		var duration = 0;
232
		if (animate)
233
			duration = settings.duration;
234
		
235
		if (el.hasClass(prefix+'_hidden')) {
236
			el.removeClass(prefix+'_hidden');
237
			el.slideDown(duration, settings.easingOpen, function(){
238
				
239
				$(trigger).removeClass(prefix+'_animating');
240
				$(trigger).parent().removeClass(prefix+'_animating');
241
				
242
				//Fire open callback
243
				if (!init) {
244
					settings.open(trigger);
245
				}
246
			});
247
			el.attr('aria-hidden','false');
248
			items.attr('tabindex', '0');
249
			$this._setVisAttr(el, false);
250
		} else {
251
			el.addClass(prefix+'_hidden');
252
			el.slideUp(duration, this.settings.easingClose, function() {
253
				el.attr('aria-hidden','true');
254
				items.attr('tabindex', '-1');
255
				$this._setVisAttr(el, true);
256
				el.hide(); //jQuery 1.7 bug fix
257
				
258
				$(trigger).removeClass(prefix+'_animating');
259
				$(trigger).parent().removeClass(prefix+'_animating');
260
				
261
				//Fire init or close callback
262
				if (!init)
263
					settings.close(trigger);
264
				else if (trigger == 'init')
265
					settings.init();
266
			});
267
		}
268
	}
269

  
270
	// set attributes of element and children based on visibility
271
	Plugin.prototype._setVisAttr = function(el, hidden) {
272
		var $this = this;
273
		
274
		// select all parents that aren't hidden
275
		var nonHidden = el.children('li').children('ul').not('.'+prefix+'_hidden');
276
		
277
		// iterate over all items setting appropriate tags
278
		if (!hidden) {
279
			nonHidden.each(function(){
280
				var ul = $(this);
281
				ul.attr('aria-hidden','false');
282
				var items = $this._getActionItems(ul);
283
				items.attr('tabindex', '0');
284
				$this._setVisAttr(ul, hidden);
285
			});
286
		} else {
287
			nonHidden.each(function(){
288
				var ul = $(this);
289
				ul.attr('aria-hidden','true');
290
				var items = $this._getActionItems(ul);
291
				items.attr('tabindex', '-1');
292
				$this._setVisAttr(ul, hidden);
293
			});
294
		}
295
	}
296

  
297
	// get all 1st level items that are clickable
298
	Plugin.prototype._getActionItems = function(el) {
299
		var data = el.data("menu");
300
		if (!data) {
301
			data = {};
302
			var items = el.children('li');
303
			var anchors = items.children('a');
304
			data.links = anchors.add(items.children('.'+prefix+'_item'));
305
			el.data("menu", data);
306
		}
307
		return data.links;
308
	}
309

  
310
	Plugin.prototype._outlines = function(state) {
311
		if (!state) {
312
			$('.'+prefix+'_item, .'+prefix+'_btn').css('outline','none');
313
		} else {
314
			$('.'+prefix+'_item, .'+prefix+'_btn').css('outline','');
315
		}
316
	}
317
	
318
	Plugin.prototype.toggle = function(){
319
		$this._menuToggle();
320
	}
321
	
322
	Plugin.prototype.open = function(){
323
		$this = this;
324
		if ($this.btn.hasClass(prefix+'_collapsed')) {
325
			$this._menuToggle();
326
		}
327
	}
328
	
329
	Plugin.prototype.close = function(){
330
		$this = this;
331
		if ($this.btn.hasClass(prefix+'_open')) {
332
			$this._menuToggle();
333
		}
334
	}
335
	
336
	$.fn[mobileMenu] = function ( options ) {
337
		var args = arguments;
338

  
339
		// Is the first parameter an object (options), or was omitted, instantiate a new instance
340
		if (options === undefined || typeof options === 'object') {
341
			return this.each(function () {
342

  
343
				// Only allow the plugin to be instantiated once due to methods
344
				if (!$.data(this, 'plugin_' + mobileMenu)) {
345

  
346
					// if it has no instance, create a new one, pass options to our plugin constructor,
347
					// and store the plugin instance in the elements jQuery data object.
348
					$.data(this, 'plugin_' + mobileMenu, new Plugin( this, options ));
349
				}
350
			});
351

  
352
		// If is a string and doesn't start with an underscore or 'init' function, treat this as a call to a public method.
353
		} else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
354

  
355
			// Cache the method call to make it possible to return a value
356
			var returns;
357

  
358
			this.each(function () {
359
				var instance = $.data(this, 'plugin_' + mobileMenu);
360

  
361
				// Tests that there's already a plugin-instance and checks that the requested public method exists
362
				if (instance instanceof Plugin && typeof instance[options] === 'function') {
363

  
364
					// Call the method of our plugin instance, and pass it the supplied arguments.
365
					returns = instance[options].apply( instance, Array.prototype.slice.call( args, 1 ) );
366
				}
367
			});
368

  
369
			// If the earlier cached method gives a value back return the value, otherwise return this to preserve chainability.
370
			return returns !== undefined ? returns : this;
371
		}
372
	};
7
  var
8
    // default settings object.
9
    defaults = {
10
      label: 'MENU',
11
      duplicate: true,
12
      duration: 200,
13
      easingOpen: 'swing',
14
      easingClose: 'swing',
15
      closedSymbol: '&#9658;',
16
      openedSymbol: '&#9660;',
17
      prependTo: 'body',
18
      parentTag: 'a',
19
      closeOnClick: false,
20
      allowParentLinks: false,
21
      init: function () {
22
      },
23
      open: function () {
24
      },
25
      close: function () {
26
      }
27
    },
28
    mobileMenu = 'slicknav',
29
    prefix = 'slicknav';
30

  
31
  function Plugin(element, options) {
32
    this.element = element;
33

  
34
    // jQuery has an extend method which merges the contents of two or
35
    // more objects, storing the result in the first object. The first object
36
    // is generally empty as we don't want to alter the default options for
37
    // future instances of the plugin
38
    this.settings = $.extend({}, defaults, options);
39

  
40
    this._defaults = defaults;
41
    this._name = mobileMenu;
42

  
43
    this.init();
44
  }
45

  
46
  Plugin.prototype.init = function () {
47
    var $this = this;
48
    var menu = $(this.element);
49
    var settings = this.settings;
50

  
51
    // clone menu if needed
52
    if (settings.duplicate) {
53
      $this.mobileNav = menu.clone();
54
      //remove ids from clone to prevent css issues
55
      $this.mobileNav.removeAttr('id');
56
      $this.mobileNav.find('*').each(function (i, e) {
57
        $(e).removeAttr('id');
58
      });
59
    }
60
    else {
61
      $this.mobileNav = menu;
62
    }
63

  
64
    // styling class for the button
65
    var iconClass = prefix + '_icon';
66

  
67
    if (settings.label == '') {
68
      iconClass += ' ' + prefix + '_no-text';
69
    }
70

  
71
    if (settings.parentTag == 'a') {
72
      settings.parentTag = 'a href="#"';
73
    }
74

  
75
    // create menu bar
76
    $this.mobileNav.attr('class', prefix + '_nav');
77
    var menuBar = $('<div class="' + prefix + '_menu"></div>');
78
    $this.btn = $('<' + settings.parentTag + ' aria-haspopup="true" tabindex="0" class="' + prefix + '_btn ' + prefix + '_collapsed"><span class="' + prefix + '_menutxt">' + settings.label + '</span><span class="' + iconClass + '"><span class="' + prefix + '_icon-bar"></span><span class="' + prefix + '_icon-bar"></span><span class="' + prefix + '_icon-bar"></span></span></a>');
79
    $(menuBar).append($this.btn);
80
    $(settings.prependTo).prepend(menuBar);
81
    menuBar.append($this.mobileNav);
82

  
83
    // iterate over structure adding additional structure
84
    var items = $this.mobileNav.find('li');
85
    $(items).each(function () {
86
      var item = $(this);
87
      var data = {};
88
      data.children = item.children('ul').attr('role', 'menu');
89
      item.data("menu", data);
90

  
91
      // if a list item has a nested menu
92
      if (data.children.length > 0) {
93

  
94
        // select all text before the child menu
95
        var a = item.contents();
96
        var nodes = [];
97
        $(a).each(function () {
98
          if (!$(this).is("ul")) {
99
            nodes.push(this);
100
          }
101
          else {
102
            return false;
103
          }
104
        });
105

  
106
        // wrap item text with tag and add classes
107
        var wrap = $(nodes).wrapAll('<' + settings.parentTag + ' role="menuitem" aria-haspopup="true" tabindex="-1" class="' + prefix + '_item"/>').parent();
108

  
109
        item.addClass(prefix + '_collapsed');
110
        item.addClass(prefix + '_parent');
111

  
112
        // create parent arrow
113
        $(nodes).last().after('<span class="' + prefix + '_arrow">' + settings.closedSymbol + '</span>');
114

  
115

  
116
      }
117
      else {
118
        if (item.children().length == 0) {
119
          item.addClass(prefix + '_txtnode');
120
        }
121
      }
122

  
123
      // accessibility for links
124
      item.children('a').attr('role', 'menuitem').click(function () {
125
        //Emulate menu close if set
126
        if (settings.closeOnClick) {
127
          $($this.btn).click();
128
        }
129
      });
130
    });
131

  
132
    // structure is in place, now hide appropriate items
133
    $(items).each(function () {
134
      var data = $(this).data("menu");
135
      $this._visibilityToggle(data.children, false, null, true);
136
    });
137

  
138
    // finally toggle entire menu
139
    $this._visibilityToggle($this.mobileNav, false, 'init', true);
140

  
141
    // accessibility for menu button
142
    $this.mobileNav.attr('role', 'menu');
143

  
144
    // outline prevention when using mouse
145
    $(document).mousedown(function () {
146
      $this._outlines(false);
147
    });
148

  
149
    $(document).keyup(function () {
150
      $this._outlines(true);
151
    });
152

  
153
    // menu button click
154
    $($this.btn).click(function (e) {
155
      e.preventDefault();
156
      $this._menuToggle();
157
    });
158

  
159
    // click on menu parent
160
    $this.mobileNav.on('click', '.' + prefix + '_item', function (e) {
161
      e.preventDefault();
162
      $this._itemClick($(this));
163
    });
164

  
165
    // check for enter key on menu button and menu parents
166
    $($this.btn).keydown(function (e) {
167
      var ev = e || event;
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff