|
@@ -52,6 +52,7 @@
|
|
|
_isMembershipForm = _$body.is('.page-node-11186'), //$('body').is('.page-node-11187') || ,
|
|
|
_isBreveMateriauNodePage = _$body.is('.node-type-breve') || _$body.is('.node-type-materiau'),
|
|
|
// _isBreveMateriauNodePage = _themeSettings.page_callback == 'node_page_view' && (_themeSettings.node_type == 'materiau' || _themeSettings.node_type == 'breve'),
|
|
|
+ _hasDoubleSearchForm = $('#block-materio-search-api-materio-search-api-search').length,
|
|
|
_resizeTimer,
|
|
|
_max_480 = function(){ return (viewport().width < 479); },
|
|
|
_480_768 = function(){ return ( !_max_480() && _max_768() ); },
|
|
@@ -96,6 +97,9 @@
|
|
|
initKeyboardShortcuts();
|
|
|
initViewmodes();
|
|
|
|
|
|
+ if(_hasDoubleSearchForm)
|
|
|
+ initDoubleSearchFormTabs();
|
|
|
+
|
|
|
if(_isBreveMateriauNodePage)
|
|
|
$.event.trigger({ type : 'resultschanged', container : '#content>.inner-content'});
|
|
|
|
|
@@ -1563,6 +1567,42 @@
|
|
|
return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
|
|
|
};
|
|
|
|
|
|
+ /**
|
|
|
+ * Search Form
|
|
|
+ */
|
|
|
+ function initDoubleSearchFormTabs() {
|
|
|
+ var $searchblock = $('#block-materio-search-api-materio-search-api-search');
|
|
|
+ var $tabs = $('<div>')
|
|
|
+ .addClass('searchform-tabs')
|
|
|
+ .prependTo($searchblock.children('.inner'));
|
|
|
+ $('h4.form-title', $searchblock).each(function(index, el) {
|
|
|
+ $(el)
|
|
|
+ .attr('index', index)
|
|
|
+ .bind('click', function(e){
|
|
|
+ var $this = $(this);
|
|
|
+ var index = $this.attr('index');
|
|
|
+ // show the right tab
|
|
|
+ $('h4.form-title', $tabs).removeClass('active');
|
|
|
+ $this.addClass('active');
|
|
|
+ // show the right form
|
|
|
+ $('.msa-form-wrapper', $searchblock)
|
|
|
+ .removeClass('active')
|
|
|
+ .eq(index).addClass('active');
|
|
|
+ // record cookie
|
|
|
+ createCookie('default-search-form', index);
|
|
|
+ })
|
|
|
+ .appendTo($tabs);
|
|
|
+ });
|
|
|
+
|
|
|
+ // read from cookie what was the last search form visible
|
|
|
+ var defaultIndex = readCookie('default-search-form') || 0;
|
|
|
+ // show default tab
|
|
|
+ $('h4.form-title', $tabs).eq(defaultIndex).addClass('active');
|
|
|
+ $('.msa-form-wrapper', $searchblock).eq(defaultIndex).addClass('active');
|
|
|
+
|
|
|
+ $searchblock.addClass('tabed');
|
|
|
+ };
|
|
|
+
|
|
|
/**
|
|
|
* Forms
|
|
|
*/
|
|
@@ -1669,39 +1709,39 @@
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * Attach collapse behavior to the feedback form block.
|
|
|
- */
|
|
|
- Drupal.behaviors.feedbackForm = {
|
|
|
- attach: function (context) {
|
|
|
- $('#block-feedback-form', context).once('feedback', function () {
|
|
|
- var $block = $(this);
|
|
|
- $block.find('span.feedback-link')
|
|
|
- .prepend('<span id="feedback-form-toggle">feedback</span> ')
|
|
|
- .css('cursor', 'pointer')
|
|
|
- .toggle(function () {
|
|
|
- Drupal.feedbackFormToggle($block, false);
|
|
|
- },
|
|
|
- function() {
|
|
|
- Drupal.feedbackFormToggle($block, true);
|
|
|
- }
|
|
|
- );
|
|
|
- $block.find('form').hide();
|
|
|
- $block.show();
|
|
|
- });
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
+ * Attach collapse behavior to the feedback form block.
|
|
|
+ */
|
|
|
+ // Drupal.behaviors.feedbackForm = {
|
|
|
+ // attach: function (context) {
|
|
|
+ // $('#block-feedback-form', context).once('feedback', function () {
|
|
|
+ // var $block = $(this);
|
|
|
+ // $block.find('span.feedback-link')
|
|
|
+ // .prepend('<span id="feedback-form-toggle">feedback</span> ')
|
|
|
+ // .css('cursor', 'pointer')
|
|
|
+ // .toggle(function () {
|
|
|
+ // Drupal.feedbackFormToggle($block, false);
|
|
|
+ // },
|
|
|
+ // function() {
|
|
|
+ // Drupal.feedbackFormToggle($block, true);
|
|
|
+ // }
|
|
|
+ // );
|
|
|
+ // $block.find('form').hide();
|
|
|
+ // $block.show();
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ //
|
|
|
/**
|
|
|
* Collapse or uncollapse the feedback form block.
|
|
|
*/
|
|
|
- Drupal.feedbackFormToggle = function ($block, enable) {
|
|
|
- $block.find('form').slideToggle('medium');
|
|
|
- if (enable) {
|
|
|
- $('#feedback-form-toggle', $block).html('feedback');
|
|
|
- }
|
|
|
- else {
|
|
|
- $('#feedback-form-toggle', $block).html('feedback (close)');
|
|
|
- }
|
|
|
- };
|
|
|
+ // Drupal.feedbackFormToggle = function ($block, enable) {
|
|
|
+ // $block.find('form').slideToggle('medium');
|
|
|
+ // if (enable) {
|
|
|
+ // $('#feedback-form-toggle', $block).html('feedback');
|
|
|
+ // }
|
|
|
+ // else {
|
|
|
+ // $('#feedback-form-toggle', $block).html('feedback (close)');
|
|
|
+ // }
|
|
|
+ // };
|
|
|
|
|
|
})(jQuery);
|