Skip to content

Commit

Permalink
Added the type attribute.
Browse files Browse the repository at this point in the history
  • Loading branch information
mehrpadin committed May 7, 2017
1 parent af9cb4e commit 20c5be1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "mehrpadin/superfish",
"homepage": "https://github.com/mehrpadin/Superfish-for-Drupal",
"description": "Superfish library for the Drupal Superfish module.",
"type": "drupal-library",
"repository": {
"type": "git",
"url": "git://github.com/mehrpadin/Superfish-for-Drupal"
Expand Down
7 changes: 4 additions & 3 deletions sfsmallscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
return refined;
}

// Creating <option> elements out of t
// Creating <option> elements out of the menu.
function toSelect(menu, level){
var
items = '',
Expand All @@ -90,12 +90,13 @@
if (options.addSelected && item.hasClass('active')){
classes += ' active';
}
classes = (classes) ? ' class="' + classes + '"' : '';
// <option> has to be disabled if the item is not a link.
disable = item.is('span') || item.attr('href')=='#' ? ' disabled="disabled"' : '',
// Crystal clear.
subIndicator = 1 < level ? Array(level).join('-') + ' ' : '';
// Preparing the <option> element.
items += '<option value="' + path + '" class="' + classes + '"' + disable + '>' + subIndicator + $.trim(item.text()) +'</option>',
items += '<option value="' + path + '"' + classes + disable + '>' + subIndicator + $.trim(item.text()) +'</option>',
childUL = list.find('> ul');
// Using the function for the sub-menu of this item.
for (var u = 0; u < childUL.length; u++){
Expand Down Expand Up @@ -246,7 +247,7 @@
// Creating the <option> elements.
var newMenu = toSelect(refinedMenu, 1),
// Creating the <select> element and assigning an ID and class name.
selectList = $('<select class="' + classes + '" id="' + menuID + '-select"/>')
selectList = $('<select' + classes + ' id="' + menuID + '-select"/>')
// Attaching the title and the items to the <select> element.
.html('<option>' + options.title + '</option>' + newMenu)
// Attaching an event then.
Expand Down

0 comments on commit 20c5be1

Please sign in to comment.