1(function ($) { 2 3Drupal.jQueryUiFilter = Drupal.jQueryUiFilter || {} 4 5/** 6 * Custom hash change event handling 7 */ 8var _currentHash = location.hash; 9Drupal.jQueryUiFilter.hashChange = function(func) { 10 // Handle URL anchor change event in js 11 // http://stackoverflow.com/questions/2161906/handle-url-anchor-change-event-in-js 12 if ('onhashchange' in window) { 13 $(window).bind('hashchange', func); 14 } 15 else { 16 window.setInterval(function () { 17 if (location.hash != _currentHash) { 18 _currentHash = location.hash; 19 func(); 20 } 21 }, 100); 22 } 23} 24 25 26/** 27 * Apply jQuery UI filter widget options as the global default options. 28 */ 29Drupal.jQueryUiFilter.globalOptions = function(widgetType) { 30 Drupal.jQueryUiFilter.cleanupOptions(jQuery.extend( 31 $.ui[widgetType].prototype.options, 32 Drupal.settings.jQueryUiFilter[widgetType + 'Options'], 33 Drupal.jQueryUiFilter[widgetType + 'Options'] 34 )); 35} 36 37/** 38 * Get jQuery UI filter widget options. 39 */ 40Drupal.jQueryUiFilter.getOptions = function(widgetType, options) { 41 return Drupal.jQueryUiFilter.cleanupOptions(jQuery.extend( 42 {}, // Using an empty object insures that new object is created and returned. 43 Drupal.settings.jQueryUiFilter[widgetType + 'Options'], 44 Drupal.jQueryUiFilter[widgetType + 'Options'], 45 options || {} 46 )); 47} 48 49/** 50 * Cleanup jQuery UI filter options by converting 'true' and 'false' strings to native JavaScript Boolean value. 51 */ 52Drupal.jQueryUiFilter.cleanupOptions = function(options) { 53 // jQuery UI options that are Booleans must be converted from integers booleans 54 for (var name in options) { 55 if (typeof(options[name]) == 'string' && options[name] == '') { 56 delete options[name]; 57 } 58 else if (options[name] == 'false') { 59 options[name] = false; 60 } 61 else if (options[name] === 'true') { 62 options[name] = true; 63 } 64 else if (name === 'position' && options[name].indexOf(',') != -1) { 65 options[name] = options[name].split(/\s*,\s*/); 66 } 67 else if (typeof(options[name]) == 'object') { 68 options[name] = Drupal.jQueryUiFilter.cleanupOptions(options[name]); 69 } 70 } 71 return options; 72} 73 74})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.