Drupal.locale = { 'pluralFormula': function ($n) { return Number(($n!=1)); }, 'strings': {"":{"An AJAX HTTP error occurred.":"\u53d1\u751f\u4e00\u4e2aAJAX HTTP\u9519\u8bef\u3002","HTTP Result Code: !status":"HTTP\u8fd4\u56de\u4ee3\u7801\uff1a!status","An AJAX HTTP request terminated abnormally.":"\u4e00\u4e2aAJAX HTTP\u8bf7\u6c42\u5f02\u5e38\u7ec8\u6b62\u3002","Debugging information follows.":"\u8c03\u8bd5\u4fe1\u606f\u5982\u4e0b\u3002","Path: !uri":"\u8def\u5f84\uff1a!uri","StatusText: !statusText":"\u72b6\u6001\u6587\u672c: !statusText","ResponseText: !responseText":"\u54cd\u5e94\u6587\u672c\uff1a !responseText","ReadyState: !readyState":"\u51c6\u5907\u72b6\u6001\uff1a !readyState","CustomMessage: !customMessage":"\u5b9a\u5236\u4fe1\u606f\uff1a !customMessage","Loading":"\u6b63\u5728\u52a0\u8f7d","(active tab)":"\uff08\u6d3b\u52a8\u6807\u7b7e\uff09","Translate Text":"\u7ffb\u8bd1\u6587\u672c","Please wait...":"\u8bf7\u7a0d\u7b49...","An HTTP error @status occured.":"\u51fa\u73b0\u4e00\u4e2aHTTP@status\u9519\u8bef","@title dialog":"@title \u5bf9\u8bdd\u6846","Configure":"\u914d\u7f6e","Show shortcuts":"\u663e\u793a\u5feb\u6377\u65b9\u5f0f","Hide shortcuts":"\u9690\u85cf\u5feb\u6377\u952e","Hide":"\u9690\u85cf","Show":"\u663e\u793a","Translatable":"\u53ef\u88ab\u7ffb\u8bd1","Not translatable":"\u4e0d\u80fd\u88ab\u7ffb\u8bd1","Restricted to certain languages":"\u9650\u5236\u4e3a\u67d0\u4e9b\u8bed\u8a00","Not restricted":"\u672a\u53d7\u9650\u5236","Restricted to certain pages":"\u9650\u5236\u5230\u7279\u5b9a\u7684\u533a\u5757","Not customizable":"\u4e0d\u53ef\u81ea\u5b9a\u4e49\u7684","The changes to these blocks will not be saved until the \u003Cem\u003ESave blocks\u003C\/em\u003E button is clicked.":"\u8fd9\u4e9b\u533a\u5757\u7684\u53d8\u66f4\u4e0d\u4f1a\u88ab\u50a8\u5b58\u8d77\u6765\uff0c\u9664\u975e\u60a8\u6309\u4e0b\u003Cem\u003E\u50a8\u5b58\u533a\u5757\u003C\/em\u003E\u7684\u6309\u94ae\u3002","The block cannot be placed in this region.":"\u6b64\u533a\u5757\u4e0d\u80fd\u653e\u7f6e\u5728\u6b64\u533a\u57df\u4e2d","Re-order rows by numerical weight instead of dragging.":"\u4e0d\u7528\u62d6\u653e\u64cd\u4f5c\uff0c\u800c\u7528\u6570\u5b57\u6743\u91cd\u65b9\u5f0f\u91cd\u65b0\u5bf9\u884c\u6392\u5e8f\u3002","Show row weights":"\u663e\u793a\u884c\u7684\u6743\u91cd","Hide row weights":"\u9690\u85cf\u884c\u7684\u6743\u91cd","Drag to re-order":"\u62d6\u653e\u91cd\u65b0\u6392\u5e8f","Changes made in this table will not be saved until the form is submitted.":"\u5728\u6b64\u8868\u683c\u4e2d\u7684\u4fee\u6539\u53ea\u6709\u5728\u6574\u4e2a\u8868\u5355\u63d0\u4ea4\u540e\u624d\u4f1a\u88ab\u4fdd\u5b58\u3002","Status":"\u72b6\u6001","Select None":"\u9009\u62e9\u65e0","Select All":"\u9009\u62e9\u6240\u6709","Disabled":"\u7981\u7528","Enabled":"\u542f\u7528","Content can only be inserted into CKEditor in the WYSIWYG mode.":"\u53ea\u6709\u5728WYSIWYG\u6a21\u5f0f\u4e0b\u624d\u80fd\u5728CKEditor\u4e2d\u63d2\u5165\u5185\u5bb9\u3002","Edit":"\u7f16\u8f91","Size":"\u5927\u5c0f","Add":"\u6dfb\u52a0","Other":"\u5176\u5b83","@count year from now":"@count \u5e74\u4ece\u73b0\u5728\u8d77","@count years from now":"@count \u5e74\u4ece\u73b0\u5728\u8d77","Next":"\u4e0b\u4e00\u4e2a","Sunday":"\u661f\u671f\u65e5","Monday":"\u661f\u671f\u4e00","Tuesday":"\u661f\u671f\u4e8c","Wednesday":"\u661f\u671f\u4e09","Thursday":"\u661f\u671f\u56db","Friday":"\u661f\u671f\u4e94","Saturday":"\u661f\u671f\u516d","Filename":"\u6587\u4ef6\u540d","Upload":"\u4e0a\u4f20","Done":"\u5b8c\u6210","N\/A":"N\/A","OK":"OK","Prev":"\u524d","Mon":"\u5468\u4e00","Tue":"\u5468\u4e8c","Wed":"\u5468\u4e09","Thu":"\u5468\u56db","Fri":"\u5468\u4e94","Sat":"\u5468\u516d","Sun":"\u5468\u65e5","January":"\u4e00\u6708","February":"\u4e8c\u6708","March":"\u4e09\u6708","April":"\u56db\u6708","May":"5\u6708","June":"\u516d\u6708","July":"\u4e03\u6708","August":"\u516b\u6708","September":"\u4e5d\u6708","October":"\u5341\u6708","November":"\u5341\u4e00\u6708","December":"\u5341\u4e8c\u6708","Select all rows in this table":"\u9009\u62e9\u6b64\u8868\u4e2d\u7684\u6240\u6709\u884c","Deselect all rows in this table":"\u53d6\u6d88\u5168\u9009\u6b64\u8868\u4e2d\u7684\u6240\u6709\u884c","Today":"\u4eca\u5929","Feb":"2\u6708","Mar":"3\u6708","Apr":"4\u6708","Jun":"6\u6708","Jul":"7\u6708","Aug":"8\u6708","Sep":"9\u6708","Oct":"10\u6708","Nov":"11\u6708","Dec":"12\u6708","Su":"\u5468\u65e5","Mo":"\u5468\u4e00","Tu":"\u5468\u4e8c","We":"\u5468\u4e09","Th":"\u5468\u56db","Fr":"\u5468\u4e94","Sa":"\u5468\u516d","Not published":"\u672a\u53d1\u8868","mm\/dd\/yy":"mm\/dd\/yy","Only files with the following extensions are allowed: %files-allowed.":"\u53ea\u5141\u8bb8\u4ee5\u4e0b\u6269\u5c55\u540d\u6587\u4ef6\uff1a%files-allowed\u3002","By @name on @date":"\u7531 @name \u5728 @date \u53d1\u5e03","By @name":"\u7531 @name \u53d1\u5e03","Not in menu":"\u4e0d\u5728\u83dc\u5355\u4e2d","Alias: @alias":"\u522b\u540d\uff1a@alias","No alias":"\u65e0\u522b\u540d","New revision":"\u65b0\u7684\u4fee\u8ba2\u7248\u672c","This permission is inherited from the authenticated user role.":"\u6b64\u6743\u9650\u7ee7\u627f\u81ea\u6ce8\u518c\u7528\u6237\u89d2\u8272\u3002","No revision":"\u6ca1\u6709\u4fee\u8ba2\u7248\u672c","Requires a title":"\u9700\u8981\u4e00\u4e2a\u6807\u9898","Hide summary":"\u9690\u85cf\u6458\u8981","Edit summary":"\u7f16\u8f91\u6458\u8981","Don\u0027t display post information":"\u4e0d\u8981\u663e\u793a\u53d1\u5e03\u4fe1\u606f\u3002","The selected file %filename cannot be uploaded. Only files with the following extensions are allowed: %extensions.":"\u9009\u62e9\u7684\u6587\u4ef6%filename\u65e0\u6cd5\u4e0a\u4f20\u3002\u53ea\u6709\u4ee5\u4e0b\u7c7b\u578b\u7684\u6587\u4ef6\u88ab\u5141\u8bb8\uff1a%extensions\u3002","Autocomplete popup":"\u81ea\u52a8\u5b8c\u6210\u7684\u5f39\u51fa\u7a97\u53e3","Searching for matches...":"\u6b63\u5728\u67e5\u627e\u5339\u914d\u9879...","The response failed verification so will not be processed.":"\u672a\u901a\u8fc7\u9a8c\u8bc1\u7684\u54cd\u5e94\u4e0d\u4f1a\u88ab\u5904\u7406\u3002","The callback URL is not local and not trusted: !url":"\u975e\u672c\u5730\u7684\u56de\u8c03\u5730\u5740\u4e0d\u4f1a\u88ab\u4fe1\u4efb\uff1a !url","Submit":"\u63d0\u4ea4","Start upload":"\u5f00\u59cb\u4e0a\u4f20","Associated with @name":"\u4e0e @name \u5173\u8054","Destination: @scheme":"\u76ee\u6807\uff1a @scheme","Close":"\u5173\u95ed","Log messages":"\u65e5\u5fd7\u6d88\u606f","Please select a file.":"\u8bf7\u9009\u62e91\u4e2a\u6587\u4ef6\u3002","You are not allowed to operate on more than %num files.":"\u60a8\u4e0d\u5f97\u64cd\u4f5c\u8d85\u8fc7%num\u4e2a\u6587\u4ef6\u3002","Please specify dimensions within the allowed range that is from 1x1 to @dimensions.":"\u8bf7\u57281x1 \u5230 @dimensions\u7684\u8bb8\u53ef\u8303\u56f4\u5185\u8bbe\u5b9a\u5c3a\u5bf8\u5927\u5c0f\u3002","%filename is not an image.":"%filename\u4e0d\u662f1\u4e2a\u56fe\u7247\u3002","Do you want to refresh the current directory?":"\u4f60\u60f3\u5237\u65b0\u5f53\u524d\u76ee\u5f55\uff1f","Delete selected files?":"\u5220\u9664\u6240\u9009\u6587\u4ef6\uff1f","Please select a thumbnail.":"\u8bf7\u9009\u62e9\u4e00\u4e2a\u7f29\u7565\u56fe\u3002","You must select at least %num files.":"\u4f60\u81f3\u5c11\u5f97\u9009\u62e9%num\u4e2a\u6587\u4ef6\u3002","You can not perform this operation.":"\u60a8\u4e0d\u80fd\u6267\u884c\u6b64\u64cd\u4f5c\u3002","Insert file":"\u63d2\u5165\u6587\u4ef6","Media browser":"\u5a92\u4f53\u6d4f\u89c8\u5668","Cannot continue, nothing selected":"\u5565\u4e5f\u6ca1\u9009\u4e2d","You have not selected anything!":"\u60a8\u672a\u9009\u62e9\u4efb\u4f55\u4e1c\u897f\uff01","Insert":"\u63d2\u5165","@label: @value":"@label: @value","Using defaults":"\u4f7f\u7528\u9ed8\u8ba4","An error occurred":"\u53d1\u751f\u4e86\u4e00\u4e2a\u9519\u8bef","No nodes in this queue.":"\u6b64\u961f\u5217\u4e2d\u65e0\u8282\u70b9\u3002","Automatic alias":"\u81ea\u52a8\u522b\u540d","Add files":"\u6dfb\u52a0\u6587\u4ef6","Select files":"\u9009\u62e9\u6587\u4ef6","Add files to the upload queue and click the start button.":"\u6dfb\u52a0\u6587\u4ef6\u5230\u4e0a\u4f20\u961f\u5217\uff0c\u7136\u540e\u70b9\u51fb\u5f00\u59cb\u6309\u94ae","Stop current upload":"\u505c\u6b62\u5f53\u524d\u4e0a\u4f20","Start uploading queue":"\u5f00\u59cb\u4e0a\u4f20","Drag files here.":"\u62d6\u653e\u6587\u4ef6\u5230\u8fd9\u91cc","Error: File too large: ":"\u9519\u8bef\uff1a\u6587\u4ef6\u592a\u5927\uff1a ","Uploaded %d\/%d files":"\u4e0a\u4f20 %d\/%d \u6587\u4ef6","File extension error.":"\u6587\u4ef6\u6269\u5c55\u540d\u9519\u8bef\u3002","File size error.":"\u6587\u4ef6\u5927\u5c0f\u9519\u8bef\uff0c","Init error.":"\u521d\u59cb\u5316\u9519\u8bef\u3002","HTTP Error.":"HTTP\u9519\u8bef\u3002","Security error.":"\u5b89\u5168\u9519\u8bef\u3002","Generic error.":"\u5e38\u89c4\u9519\u8bef\u3002","IO error.":"IO\u9519\u8bef\u3002","Stop upload":"\u505c\u6b62\u4e0a\u4f20","%d files queued":"%d \u6587\u4ef6\u5df2\u6392\u5165\u961f\u5217","Please wait while your files are being uploaded.":"\u60a8\u7684\u6587\u4ef6\u6b63\u5728\u4e0a\u4f20\uff0c\u8bf7\u8010\u5fc3\u7b49\u5f85\u3002","Available tokens":"\u53ef\u7528\u7684token","Insert this token into your form":"\u628a\u8fd9\u4e2aToken\uff08\u4ee4\u724c\uff09\u63d2\u5165\u5230\u8868\u5355","First click a text field to insert your tokens into.":"\u5148\u70b9\u51fb\u60a8\u9700\u8981\u63d2\u5165\u66ff\u6362\u7b26\u7684\u6587\u5b57\u5b57\u6bb5\u3002","Loading token browser...":"\u6b63\u5728\u8f7d\u5165token\u6d4f\u89c8\u5668...","Inclusion: @value":"\u5305\u542b\uff1a @value","Priority: @value":"\u4f18\u5148\u7ea7: @value"}} };; /** * @file better_exposed_filters.js * * Provides some client-side functionality for the Better Exposed Filters module */ (function ($) { Drupal.behaviors.betterExposedFilters = { attach: function(context) { // Add highlight class to checked checkboxes for better theming $('.bef-tree input[type=checkbox], .bef-checkboxes input[type=checkbox]') // Highlight newly selected checkboxes .change(function() { _bef_highlight(this, context); }) .filter(':checked').closest('.form-item', context).addClass('highlight') ; } }; Drupal.behaviors.betterExposedFiltersSelectAllNone = { attach: function(context) { /* * Add Select all/none links to specified checkboxes */ var selected = $('.form-checkboxes.bef-select-all-none:not(.bef-processed)'); if (selected.length) { var selAll = Drupal.t('Select All'); var selNone = Drupal.t('Select None'); // Set up a prototype link and event handlers var link = $(''+ selAll +'') link.click(function(event) { // Don't actually follow the link... event.preventDefault(); event.stopPropagation(); if (selAll == $(this).text()) { // Select all the checkboxes $(this) .html(selNone) .siblings('.bef-checkboxes, .bef-tree') .find('.form-item input:checkbox').each(function() { $(this).attr('checked', true); _bef_highlight(this, context); }) .end() // attr() doesn't trigger a change event, so we do it ourselves. But just on // one checkbox otherwise we have many spinning cursors .find('input[type=checkbox]:first').change() ; } else { // Unselect all the checkboxes $(this) .html(selAll) .siblings('.bef-checkboxes, .bef-tree') .find('.form-item input:checkbox').each(function() { $(this).attr('checked', false); _bef_highlight(this, context); }) .end() // attr() doesn't trigger a change event, so we do it ourselves. But just on // one checkbox otherwise we have many spinning cursors .find('input[type=checkbox]:first').change() ; } }); // Add link to the page for each set of checkboxes. selected .addClass('bef-processed') .each(function(index) { // Clone the link prototype and insert into the DOM var newLink = link.clone(true); newLink.insertBefore($('.bef-checkboxes, .bef-tree', this)); // If all checkboxes are already checked by default then switch to Select None if ($('input:checkbox:checked', this).length == $('input:checkbox', this).length) { newLink.click(); } }) ; } // Check for and initialize datepickers var befSettings = Drupal.settings.better_exposed_filters; if (befSettings && befSettings.datepicker && befSettings.datepicker_options && $.fn.datepicker) { var opt = []; $.each(befSettings.datepicker_options, function(key, val) { if (key && val) { opt[key] = JSON.parse(val); } }); $('.bef-datepicker').datepicker(opt); } } // attach: function() { }; // Drupal.behaviors.better_exposed_filters = { Drupal.behaviors.betterExposedFiltersAllNoneNested = { attach:function (context, settings) { $('.form-checkboxes.bef-select-all-none-nested li').has('ul').once('bef-all-none-nested', function () { $(this) // To respect term depth, check/uncheck child term checkboxes. .find('input.form-checkboxes:first') .click(function() { var checkedParent = $(this).attr('checked'); if (!checkedParent) { // Uncheck all children if parent is unchecked. $(this).parents('li:first').find('ul input.form-checkboxes').removeAttr('checked'); } else { // Check all children if parent is checked. $(this).parents('li:first').find('ul input.form-checkboxes').attr('checked', $(this).attr('checked')); } }) .end() // When a child term is checked or unchecked, set the parent term's // status. .find('ul input.form-checkboxes') .click(function() { var checked = $(this).attr('checked'); // Determine the number of unchecked sibling checkboxes. var ct = $(this).parents('ul:first').find('input.form-checkboxes:not(:checked)').size(); // If the child term is unchecked, uncheck the parent. if (!checked) { // Uncheck parent if any of the childres is unchecked. $(this).parents('li:first').parents('li:first').find('input.form-checkboxes:first').removeAttr('checked'); } // If all sibling terms are checked, check the parent. if (!ct) { // Check the parent if all the children are checked. $(this).parents('li:first').parents('li:first').find('input.form-checkboxes:first').attr('checked', checked); } }); }); } }; Drupal.behaviors.better_exposed_filters_slider = { attach: function(context, settings) { var befSettings = settings.better_exposed_filters; if (befSettings && befSettings.slider && befSettings.slider_options) { $.each(befSettings.slider_options, function(i, sliderOptions) { var containing_parent = "#" + sliderOptions.viewId + " #edit-" + sliderOptions.id + "-wrapper .views-widget"; var $filter = $(containing_parent); // If the filter is placed in a secondary fieldset, we may not have // the usual wrapper element. if (!$filter.length) { containing_parent = "#" + sliderOptions.viewId + " .bef-slider-wrapper"; $filter = $(containing_parent); } // Only make one slider per filter. $filter.once('slider-filter', function() { var $input = $(this).find('input[type=text]'); // This is a "between" or "not between" filter with two values. if ($input.length == 2) { var $min = $input.parent().find('input#edit-' + sliderOptions.id + '-min'), $max = $input.parent().find('input#edit-' + sliderOptions.id + '-max'), default_min, default_max; if (!$min.length || !$max.length) { return; } // Get the default values. // We use slider min & max if there are no defaults. default_min = parseFloat(($min.val() == '') ? sliderOptions.min : $min.val(), 10); default_max = parseFloat(($max.val() == '') ? sliderOptions.max : $max.val(), 10); // Set the element value in case we are using the slider min & max. $min.val(default_min); $max.val(default_max); $min.parents(containing_parent).after( $('
').slider({ range: true, min: parseFloat(sliderOptions.min, 10), max: parseFloat(sliderOptions.max, 10), step: parseFloat(sliderOptions.step, 10), animate: sliderOptions.animate ? sliderOptions.animate : false, orientation: sliderOptions.orientation, values: [default_min, default_max], // Update the textfields as the sliders are moved slide: function (event, ui) { $min.val(ui.values[0]); $max.val(ui.values[1]); }, // This fires when the value is set programmatically or the // stop event fires. // This takes care of the case that a user enters a value // into the text field that is not a valid step of the slider. // In that case the slider will go to the nearest step and // this change event will update the text area. change: function (event, ui) { $min.val(ui.values[0]); $max.val(ui.values[1]); }, // Attach stop listeners. stop: function(event, ui) { // Click the auto submit button. $(this).parents('form').find('.ctools-auto-submit-click').click(); } }) ); // Update the slider when the fields are updated. $min.blur(function() { befUpdateSlider($(this), 0, sliderOptions); }); $max.blur(function() { befUpdateSlider($(this), 1, sliderOptions); }); } // This is single value filter. else if ($input.length == 1) { if ($input.attr('id') != 'edit-' + sliderOptions.id) { return; } // Get the default value. We use slider min if there is no default. var default_value = parseFloat(($input.val() == '') ? sliderOptions.min : $input.val(), 10); // Set the element value in case we are using the slider min. $input.val(default_value); $input.parents(containing_parent).after( $('
').slider({ min: parseFloat(sliderOptions.min, 10), max: parseFloat(sliderOptions.max, 10), step: parseFloat(sliderOptions.step, 10), animate: sliderOptions.animate ? sliderOptions.animate : false, orientation: sliderOptions.orientation, value: default_value, // Update the textfields as the sliders are moved. slide: function (event, ui) { $input.val(ui.value); }, // This fires when the value is set programmatically or the // stop event fires. // This takes care of the case that a user enters a value // into the text field that is not a valid step of the slider. // In that case the slider will go to the nearest step and // this change event will update the text area. change: function (event, ui) { $input.val(ui.value); }, // Attach stop listeners. stop: function(event, ui) { // Click the auto submit button. $(this).parents('form').find('.ctools-auto-submit-click').click(); } }) ); // Update the slider when the field is updated. $input.blur(function() { befUpdateSlider($(this), null, sliderOptions); }); } else { return; } }) }); } } }; // This is only needed to provide ajax functionality Drupal.behaviors.better_exposed_filters_select_as_links = { attach: function(context, settings) { $('.bef-select-as-links', context).once(function() { var $element = $(this); // Check if ajax submission is enabled. If it's not enabled then we // don't need to attach our custom submission handling, because the // links are already properly built. // First check if any ajax views are contained in the current page. if (typeof settings.views == 'undefined' || typeof settings.views.ajaxViews == 'undefined') { return; } // Now check that the view for which the current filter block is used, // is part of the configured ajax views. var $uses_ajax = false; $.each(settings.views.ajaxViews, function(i, item) { var $view_name = item.view_name.replace(/_/g, '-'); var $view_display_id = item.view_display_id.replace(/_/g, '-'); var $id = 'views-exposed-form-' + $view_name + '-' + $view_display_id; var $form_id = $element.parents('form').attr('id'); if ($form_id == $id) { $uses_ajax = true; return; } }); // If no ajax is used for form submission, we quit here. if (!$uses_ajax) { return; } // Attach selection toggle and form submit on click to each link. $(this).find('a').click(function(event) { var $wrapper = $(this).parents('.bef-select-as-links'); var $options = $wrapper.find('select option'); // We have to prevent the page load triggered by the links. event.preventDefault(); event.stopPropagation(); // Un select if previously seleted toogle is selected. var link_text = $(this).text(); removed = ''; $($options).each(function(i) { if ($(this).attr('selected')) { if (link_text == $(this).text()) { removed = $(this).text(); $(this).removeAttr('selected'); } } }); // Set the corresponding option inside the select element as selected. $selected = $options.filter(function() { return $(this).text() == link_text && removed != link_text; }); $selected.attr('selected', 'selected'); $wrapper.find('.bef-new-value').val($selected.val()); $wrapper.find('.bef-new-value[value=""]').attr("disabled", "disabled"); $(this).addClass('active'); // Submit the form. $wrapper.parents('form').find('.views-submit-button *[type=submit]').click(); }); $('.bef-select-as-link').ready(function() { $('.bef-select-as-link').find('a').removeClass('active'); $('.bef-new-value').each(function(i, val) { id = $(this).parent().find('select').attr('id') + '-' + $(this).val(); $('#'+id).find('a').addClass('active'); }); }); }); } }; Drupal.behaviors.betterExposedFiltersRequiredFilter = { attach: function(context, settings) { // Required checkboxes should re-check all inputs if a user un-checks // them all. $('.bef-select-as-checkboxes', context).once('bef-required-filter').ajaxComplete(function (e, xhr, s) { var $element = $(this); if (typeof settings.views == 'undefined' || typeof settings.views.ajaxViews == 'undefined') { return; } // Now check that the view for which the current filter block is used, // is part of the configured ajax views. var $view_name; var $view_display_id; var $uses_ajax = false; $.each(settings.views.ajaxViews, function(i, item) { $view_name = item.view_name; $view_display_id = item.view_display_id; var $id = 'views-exposed-form-' + $view_name.replace(/_/g, '-') + '-' + $view_display_id.replace(/_/g, '-'); var $form_id = $element.parents('form').attr('id'); if ($form_id == $id) { $uses_ajax = true; return false; } }); //Check if we have any filters at all because of Views Selective Filter if($('input', this).length > 0) { var $filter_name = $('input', this).attr('name').slice(0, -2); if (Drupal.settings.better_exposed_filters.views[$view_name].displays[$view_display_id].filters[$filter_name].required && $('input:checked', this).length == 0) { $('input', this).prop('checked', true); } } }); } } /* * Helper functions */ /** * Adds/Removes the highlight class from the form-item div as appropriate */ function _bef_highlight(elem, context) { $elem = $(elem, context); $elem.attr('checked') ? $elem.closest('.form-item', context).addClass('highlight') : $elem.closest('.form-item', context).removeClass('highlight'); } /** * Update a slider when a related input element is changed. * * We don't need to check whether the new value is valid based on slider min, * max, and step because the slider will do that automatically and then we * update the textfield on the slider's change event. * * We still have to make sure that the min & max values of a range slider * don't pass each other though, however once this jQuery UI bug is fixed we * won't have to. - http://bugs.jqueryui.com/ticket/3762 * * @param $el * A jQuery object of the updated element. * @param valIndex * The index of the value for a range slider or null for a non-range slider. * @param sliderOptions * The options for the current slider. */ function befUpdateSlider($el, valIndex, sliderOptions) { var val = parseFloat($el.val(), 10), currentMin = $el.parents('div.views-widget').next('.bef-slider').slider('values', 0), currentMax = $el.parents('div.views-widget').next('.bef-slider').slider('values', 1); // If we have a range slider. if (valIndex != null) { // Make sure the min is not more than the current max value. if (valIndex == 0 && val > currentMax) { val = currentMax; } // Make sure the max is not more than the current max value. if (valIndex == 1 && val < currentMin) { val = currentMin; } // If the number is invalid, go back to the last value. if (isNaN(val)) { val = $el.parents('div.views-widget').next('.bef-slider').slider('values', valIndex); } } else { // If the number is invalid, go back to the last value. if (isNaN(val)) { val = $el.parents('div.views-widget').next('.bef-slider').slider('value'); } } // Make sure we are a number again. val = parseFloat(val, 10); // Set the slider to the new value. // The slider's change event will then update the textfield again so that // they both have the same value. if (valIndex != null) { $el.parents('div.views-widget').next('.bef-slider').slider('values', valIndex, val); } else { $el.parents('div.views-widget').next('.bef-slider').slider('value', val); } } }) (jQuery); ; (function($){ /** * To make a form auto submit, all you have to do is 3 things: * * ctools_add_js('auto-submit'); * * On gadgets you want to auto-submit when changed, add the ctools-auto-submit * class. With FAPI, add: * @code * '#attributes' => array('class' => array('ctools-auto-submit')), * @endcode * * If you want to have auto-submit for every form element, * add the ctools-auto-submit-full-form to the form. With FAPI, add: * @code * '#attributes' => array('class' => array('ctools-auto-submit-full-form')), * @endcode * * If you want to exclude a field from the ctool-auto-submit-full-form auto submission, * add the class ctools-auto-submit-exclude to the form element. With FAPI, add: * @code * '#attributes' => array('class' => array('ctools-auto-submit-exclude')), * @endcode * * Finally, you have to identify which button you want clicked for autosubmit. * The behavior of this button will be honored if it's ajaxy or not: * @code * '#attributes' => array('class' => array('ctools-use-ajax', 'ctools-auto-submit-click')), * @endcode * * Currently only 'select', 'radio', 'checkbox' and 'textfield' types are supported. We probably * could use additional support for HTML5 input types. */ Drupal.behaviors.CToolsAutoSubmit = { attach: function(context) { // 'this' references the form element function triggerSubmit (e) { if ($.contains(document.body, this)) { var $this = $(this); if (!$this.hasClass('ctools-ajaxing')) { $this.find('.ctools-auto-submit-click').click(); } } } // the change event bubbles so we only need to bind it to the outer form $('form.ctools-auto-submit-full-form', context) .add('.ctools-auto-submit', context) .filter('form, select, input:not(:text, :submit)') .once('ctools-auto-submit') .change(function (e) { // don't trigger on text change for full-form if ($(e.target).is(':not(:text, :submit, .ctools-auto-submit-exclude)')) { triggerSubmit.call(e.target.form); } }); // e.keyCode: key var discardKeyCode = [ 16, // shift 17, // ctrl 18, // alt 20, // caps lock 33, // page up 34, // page down 35, // end 36, // home 37, // left arrow 38, // up arrow 39, // right arrow 40, // down arrow 9, // tab 13, // enter 27 // esc ]; // Don't wait for change event on textfields $('.ctools-auto-submit-full-form input:text, input:text.ctools-auto-submit', context) .filter(':not(.ctools-auto-submit-exclude)') .once('ctools-auto-submit', function () { // each textinput element has his own timeout var timeoutID = 0; $(this) .bind('keydown keyup', function (e) { if ($.inArray(e.keyCode, discardKeyCode) === -1) { timeoutID && clearTimeout(timeoutID); } }) .keyup(function(e) { if ($.inArray(e.keyCode, discardKeyCode) === -1) { timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500); } }) .bind('change', function (e) { if ($.inArray(e.keyCode, discardKeyCode) === -1) { timeoutID = setTimeout($.proxy(triggerSubmit, this.form), 500); } }); }); } }; })(jQuery); ;