/* * sf-Smallscreen v1.0b - Provides small-screen compatibility for the jQuery Superfish plugin. * * Developer's note: * Built as a part of the Superfish project for Drupal (http://drupal.org/project/superfish) * Found any bug? have any cool ideas? contact me right away! http://drupal.org/user/619294/contact * * jQuery version: 1.3.x or higher. * * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html */ (function($){ $.fn.sfsmallscreen = function(options){ options = $.extend({ mode: 'inactive', breakpoint: 768, useragent: '', title: '', addSelected: true, menuClasses: true, hyperlinkClasses: true, excludeClass_menu: '', excludeClass_hyperlink: '', includeClass_menu: '', includeClass_hyperlink: '' }, options); // We need to clean up the menu from anything unnecessary. function refine(menu){ if ($('.sf-megamenu', menu).length > 0){ var refined = menu.clone(); refined.find('div.sf-megamenu-column > ol').each(function(){ $(this).replaceWith(''); }); refined.find('div.sf-megamenu-column').each(function(){ $(this).replaceWith($(this).html()); }).end().find('.sf-megamenu-wrapper > ol').each(function(){ $(this).replaceWith($(this).html()); }).end().find('li.sf-megamenu-wrapper').each(function(){ $(this).replaceWith($(this).html()); }); } else { var refined = menu.clone(); } refined.find('.sf-smallscreen-remove').each(function(){ $(this).replaceWith($(this).html()); }).end().find('.sf-sub-indicator, .sf-description').each(function(){ $(this).remove(); }); return refined; } // Currently the only available reaction is converting the menu into a