wp_custom_menu - Version 2.10.2

Version Notes

Устранение бага подсчета продуктов в категорияй при фключенном flat catalog

Download this release

Release Info

Developer WebAndPeople
Extension wp_custom_menu
Version 2.10.2
Comparing to
See all releases


Code changes from version 2.10.0 to 2.10.2

app/code/community/WP/CustomMenu/Block/Navigation.php CHANGED
@@ -259,9 +259,12 @@ class WP_CustomMenu_Block_Navigation extends Mage_Catalog_Block_Navigation
259
  /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
260
  $collection->addAttributeToSelect('name')
261
  ->addAttributeToSelect('is_active')
262
- ->setProductStoreId($storeId)
263
- ->setLoadProductCount(true)
264
  ->setStoreId($storeId);
 
 
 
 
 
265
  $productsCount = array();
266
  foreach($collection as $cat) {
267
  $productsCount[$cat->getId()] = array(
259
  /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
260
  $collection->addAttributeToSelect('name')
261
  ->addAttributeToSelect('is_active')
 
 
262
  ->setStoreId($storeId);
263
+ if(method_exists($collection, 'setProductStoreId'))
264
+ $collection->setProductStoreId($storeId);
265
+ if(method_exists($collection, 'setLoadProductCount'))
266
+ $collection->setLoadProductCount(true);
267
+
268
  $productsCount = array();
269
  foreach($collection as $cat) {
270
  $productsCount[$cat->getId()] = array(
app/code/community/WP/CustomMenu/Helper/Data.php CHANGED
@@ -117,17 +117,18 @@ HTML;
117
  HTML;
118
  }
119
  // --- Menu Content ---
120
- $menuContent = '';
121
- $menuContentArray = array();
122
  foreach ($_categories as $_category) {
123
  $_block->drawCustomMenuItem($_category);
124
  }
125
- $topMenuArray = $_block->getTopMenuArray();
 
126
  if (count($topMenuArray)) {
127
  $topMenuContent = implode("\n", $topMenuArray);
128
  }
129
- $popupMenuArray = $_block->getPopupMenuArray();
130
- $popupMenuContent = '';
131
  if (count($popupMenuArray)) {
132
  $popupMenuContent = implode("\n", $popupMenuArray);
133
  }
117
  HTML;
118
  }
119
  // --- Menu Content ---
120
+ $menuContent = '';
121
+ $menuContentArray = array();
122
  foreach ($_categories as $_category) {
123
  $_block->drawCustomMenuItem($_category);
124
  }
125
+ $topMenuArray = $_block->getTopMenuArray();
126
+ $topMenuContent = '';
127
  if (count($topMenuArray)) {
128
  $topMenuContent = implode("\n", $topMenuArray);
129
  }
130
+ $popupMenuArray = $_block->getPopupMenuArray();
131
+ $popupMenuContent = '';
132
  if (count($popupMenuArray)) {
133
  $popupMenuContent = implode("\n", $popupMenuArray);
134
  }
app/code/community/WP/CustomMenu/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <WP_CustomMenu>
5
- <version>2.10.0</version>
6
  </WP_CustomMenu>
7
  </modules>
8
  <frontend>
@@ -75,7 +75,7 @@
75
  <default>
76
  <custom_menu>
77
  <general>
78
- <version>2.10.0</version>
79
  <enabled>1</enabled>
80
  <ajax_load_content>0</ajax_load_content>
81
  <mobile_menu>1</mobile_menu>
2
  <config>
3
  <modules>
4
  <WP_CustomMenu>
5
+ <version>2.10.2</version>
6
  </WP_CustomMenu>
7
  </modules>
8
  <frontend>
75
  <default>
76
  <custom_menu>
77
  <general>
78
+ <version>2.10.2</version>
79
  <enabled>1</enabled>
80
  <ajax_load_content>0</ajax_load_content>
81
  <mobile_menu>1</mobile_menu>
app/design/frontend/{default → base}/default/layout/webandpeople/custommenu.xml RENAMED
File without changes
app/design/frontend/{default → base}/default/template/webandpeople/custommenu/menucontent.phtml RENAMED
File without changes
app/design/frontend/{default → base}/default/template/webandpeople/custommenu/top.phtml RENAMED
File without changes
app/design/frontend/rwd/default/layout/webandpeople/custommenu.xml DELETED
@@ -1,6 +0,0 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <default>
4
- <block type="custommenu/toggle"></block>
5
- </default>
6
- </layout>
 
 
 
 
 
 
app/design/frontend/rwd/default/template/webandpeople/custommenu/menucontent.phtml DELETED
@@ -1,19 +0,0 @@
1
- <script type="text/javascript">
2
- //<![CDATA[
3
- <?php $menuContent = Mage::helper('custommenu')->getMenuContent(); ?>
4
- if ($('custommenu') != undefined) {
5
- $('custommenu').update(<?php echo Mage::helper('core')->jsonEncode($menuContent['topMenu']); ?>);
6
- }
7
- wpPopupMenuContent = <?php echo Mage::helper('core')->jsonEncode($menuContent['popupMenu']); ?>;
8
- //]]>
9
- </script>
10
- <script type="text/javascript">
11
- //<![CDATA[
12
- <?php $mobileMenuContent = Mage::helper('custommenu')->getMobileMenuContent(); ?>
13
- wpMobileMenuContent = <?php echo Mage::helper('core')->jsonEncode($mobileMenuContent); ?>;
14
- wpCustomMenuMobileToggle();
15
- Event.observe(window, 'resize', function() {
16
- wpCustomMenuMobileToggle();
17
- });
18
- //]]>
19
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/design/frontend/rwd/default/template/webandpeople/custommenu/top.phtml DELETED
@@ -1,88 +0,0 @@
1
- <?php
2
- Mage::helper('custommenu')->saveCurrentCategoryIdToSession();
3
- $menuData = Mage::helper('custommenu')->getMenuData();
4
- extract($menuData);
5
- // ---
6
- $txtLoading = '';
7
- $txtMenu = $this->__('Menu');
8
- $xRtl = $_rtl ? ' rtl' : '';
9
- $wpInitContent = <<<HTML
10
- <div id="custommenu-loading" class="$xRtl">
11
- <div class="menu">
12
- <div class="parentMenu menu0">
13
- <a href="javascript:;">
14
- <span>$txtLoading</span>
15
- </a>
16
- </div>
17
- </div>
18
- <div class="clearBoth"></div>
19
- </div>
20
- <div id="custommenu" class="$xRtl" style="display:none;">
21
- <div class="menu">
22
- <div class="parentMenu menu0">
23
- <a href="javascript:;">
24
- <span>$txtLoading</span>
25
- </a>
26
- </div>
27
- </div>
28
- <div class="clearBoth"></div>
29
- </div>
30
- <div id="custommenu-mobile" class="$xRtl" style="display:none;">
31
- <div id="menu-button" onclick="wpMenuButtonToggle()">
32
- <a href="javascript:void(0);">
33
- <span>$txtMenu</span>
34
- </a>
35
- </div>
36
- <div id="menu-content" style="display:none;">
37
- <div id="menu-mobile-loading" class="menu-mobile level0">
38
- <div class="parentMenu">
39
- <a href="javascript:;">
40
- <span>$txtLoading</span>
41
- </a>
42
- </div>
43
- </div>
44
- <div class="clearBoth"></div>
45
- </div>
46
- </div>
47
- HTML;
48
- ?>
49
- <div class="nav-container" id="wp-nav-container"></div>
50
- <script type="text/javascript">
51
- //<![CDATA[
52
- var CUSTOMMENU_POPUP_WIDTH = <?php echo $_popupWidth; ?>;
53
- var CUSTOMMENU_POPUP_TOP_OFFSET = <?php echo $_popupTopOffset; ?>;
54
- var CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING = <?php echo $_popupDelayBeforeDisplaying; ?>;
55
- var CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING = <?php echo $_popupDelayBeforeHiding; ?>;
56
- var CUSTOMMENU_RTL_MODE = <?php echo $_rtl; ?>;
57
- var CUSTOMMENU_MOBILE_MENU_WIDTH_INIT = <?php echo $_mobileMenuWidthInit; ?>;
58
- var wpCustommenuTimerShow = {};
59
- var wpCustommenuTimerHide = {};
60
- var wpActiveMenu = null;
61
- var wpMobileMenuEnabled = <?php echo $_mobileMenuEnabled; ?>;
62
- var wpMenuAjaxUrl = '<?php echo $_menuAjaxUrl; ?>';
63
- var wpMoblieMenuAjaxUrl = '<?php echo $_moblieMenuAjaxUrl; ?>';
64
- var wpPopupMenuContent = '';
65
- var wpMobileMenuContent = '';
66
- if ($('wp-nav-container') != undefined) {
67
- $('wp-nav-container').update(<?php echo Mage::helper('core')->jsonEncode($wpInitContent); ?>);
68
- }
69
- <?php if (Mage::getStoreConfig('custom_menu/general/ajax_load_content')) : ?>
70
- wpCustomMenuMobileToggle();
71
- Event.observe(window, 'resize', function() {
72
- wpCustomMenuMobileToggle();
73
- });
74
- <?php endif; ?>
75
- //]]>
76
- </script>
77
-
78
- <script type="text/javascript">
79
- //<![CDATA[
80
- Event.observe(document, 'dom:loaded', function(){
81
- $$('.skip-nav').each(function(element) {
82
- element.observe('click', function(event) {
83
- wpMenuButtonToggle();
84
- });
85
- });
86
- });
87
- //]]>
88
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
package.xml CHANGED
@@ -1,14 +1,14 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <package>
3
  <name>wp_custom_menu</name>
4
- <version>2.10.0</version>
5
  <stability>stable</stability>
6
  <license uri="http://web-experiment.info/regular_free_license">Web-Experiment.Info Regular Free License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Magento Extension - Magento Custom Menu (Web-Experiment.Info)</summary>
10
  <description>Magento Extension - Magento Custom Menu (Web-Experiment.Info)</description>
11
- <notes>Добавлена интеграция в RWD тему. Убрано принудительное переключение в мобильное меню по user-agent. Теперь переключение в мобильное меню осуществляется по значению ширины экрана. Добавлен новый параметр Width to trigger to mobile view. Текстовые изменения на странице настроек.</notes>
12
  <authors>
13
  <author>
14
  <name>WebAndPeople</name>
@@ -21,8 +21,8 @@
21
  <email>y.gerassimenko@webandpeople.com</email>
22
  </author>
23
  </authors>
24
- <date>2014-11-06</date>
25
- <time>05:02:33</time>
26
  <contents>
27
  <target name="mageweb">
28
  <dir name="app">
@@ -32,19 +32,19 @@
32
  <dir name="CustomMenu">
33
  <dir name="Block">
34
  <file name="About.php" hash="2537ed2ed0af59077dde8193bb1f1cd9"/>
35
- <file name="Navigation.php" hash="571a10c06eece83c78fa56b44f84b924"/>
36
  <file name="Toggle.php" hash="a184685bd82a0d5238ce40215aba97f6"/>
37
  <file name="Topmenu.php" hash="baf91d07f38b733b3e09957ccab4db4d"/>
38
  </dir>
39
  <dir name="Helper">
40
- <file name="Data.php" hash="9f2aff4d6a50272600f78deee3fc8032"/>
41
  </dir>
42
  <dir name="controllers">
43
  <file name="AjaxmenucontentController.php" hash="8149156483648c590da7d4e977b6829e"/>
44
  <file name="AjaxmobilemenucontentController.php" hash="38ca4e28579d38d697b22e5940c7ecc6"/>
45
  </dir>
46
  <dir name="etc">
47
- <file name="config.xml" hash="095f373bba649a61e8a40335ff31bd86"/>
48
  <file name="system.xml" hash="db517d350606da58f1d25e4301450ac6"/>
49
  </dir>
50
  </dir>
@@ -53,24 +53,7 @@
53
  </dir>
54
  <dir name="design">
55
  <dir name="frontend">
56
- <dir name="default">
57
- <dir name="default">
58
- <dir name="layout">
59
- <dir name="webandpeople">
60
- <file name="custommenu.xml" hash="924c62b611df2b20ef35fccab8c87a86"/>
61
- </dir>
62
- </dir>
63
- <dir name="template">
64
- <dir name="webandpeople">
65
- <dir name="custommenu">
66
- <file name="menucontent.phtml" hash="3394e31c66923ebef82c53b89abad333"/>
67
- <file name="top.phtml" hash="27f74d60761183011778638facc3c5d0"/>
68
- </dir>
69
- </dir>
70
- </dir>
71
- </dir>
72
- </dir>
73
- <dir name="rwd">
74
  <dir name="default">
75
  <dir name="layout">
76
  <dir name="webandpeople">
@@ -97,7 +80,7 @@
97
  </dir>
98
  <dir name="skin">
99
  <dir name="frontend">
100
- <dir name="default">
101
  <dir name="default">
102
  <dir name="css">
103
  <dir name="webandpeople">
@@ -124,13 +107,6 @@
124
  </dir>
125
  </dir>
126
  </dir>
127
- <dir name="js">
128
- <dir name="webandpeople">
129
- <dir name="custommenu">
130
- <file name="custommenu.js" hash="4e0ebcb63638c6d9cedb9e1a314ed9f8"/>
131
- </dir>
132
- </dir>
133
- </dir>
134
  </dir>
135
  </dir>
136
  </dir>
1
  <?xml version="1.0" encoding="UTF-8"?>
2
  <package>
3
  <name>wp_custom_menu</name>
4
+ <version>2.10.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://web-experiment.info/regular_free_license">Web-Experiment.Info Regular Free License</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Magento Extension - Magento Custom Menu (Web-Experiment.Info)</summary>
10
  <description>Magento Extension - Magento Custom Menu (Web-Experiment.Info)</description>
11
+ <notes>Устранение бага подсчета продуктов в категорияй при фключенном flat catalog</notes>
12
  <authors>
13
  <author>
14
  <name>WebAndPeople</name>
21
  <email>y.gerassimenko@webandpeople.com</email>
22
  </author>
23
  </authors>
24
+ <date>2015-06-17</date>
25
+ <time>13:27:02</time>
26
  <contents>
27
  <target name="mageweb">
28
  <dir name="app">
32
  <dir name="CustomMenu">
33
  <dir name="Block">
34
  <file name="About.php" hash="2537ed2ed0af59077dde8193bb1f1cd9"/>
35
+ <file name="Navigation.php" hash="2772a424a66c690cd72e846104ce4773"/>
36
  <file name="Toggle.php" hash="a184685bd82a0d5238ce40215aba97f6"/>
37
  <file name="Topmenu.php" hash="baf91d07f38b733b3e09957ccab4db4d"/>
38
  </dir>
39
  <dir name="Helper">
40
+ <file name="Data.php" hash="1c942fb2fc11bfbdb2dd925f3fcc6932"/>
41
  </dir>
42
  <dir name="controllers">
43
  <file name="AjaxmenucontentController.php" hash="8149156483648c590da7d4e977b6829e"/>
44
  <file name="AjaxmobilemenucontentController.php" hash="38ca4e28579d38d697b22e5940c7ecc6"/>
45
  </dir>
46
  <dir name="etc">
47
+ <file name="config.xml" hash="9b855477b12af8fdcfa3e87fa696a541"/>
48
  <file name="system.xml" hash="db517d350606da58f1d25e4301450ac6"/>
49
  </dir>
50
  </dir>
53
  </dir>
54
  <dir name="design">
55
  <dir name="frontend">
56
+ <dir name="base">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  <dir name="default">
58
  <dir name="layout">
59
  <dir name="webandpeople">
80
  </dir>
81
  <dir name="skin">
82
  <dir name="frontend">
83
+ <dir name="base">
84
  <dir name="default">
85
  <dir name="css">
86
  <dir name="webandpeople">
107
  </dir>
108
  </dir>
109
  </dir>
 
 
 
 
 
 
 
110
  </dir>
111
  </dir>
112
  </dir>
skin/frontend/{default → base}/default/css/webandpeople/custommenu/custommenu.css RENAMED
File without changes
skin/frontend/{default → base}/default/js/webandpeople/custommenu/custommenu.js RENAMED
File without changes
skin/frontend/rwd/default/js/webandpeople/custommenu/custommenu.js DELETED
@@ -1,296 +0,0 @@
1
- var wpMenuLoaded = false;
2
- var wpMobileMenuLoaded = false;
3
-
4
- function wpInitPopupContent()
5
- {
6
- if (wpMenuLoaded) return;
7
- var xMenu = $('custommenu');
8
- if (typeof wpPopupMenuContent != 'undefined') xMenu.innerHTML = wpPopupMenuContent + xMenu.innerHTML;
9
- wpMenuLoaded = true;
10
- }
11
-
12
- function wpInitMobileMenuContent()
13
- {
14
- if (wpMobileMenuLoaded) return;
15
- var xMenu = $('menu-content');
16
- if (typeof wpMobileMenuContent != 'undefined') xMenu.innerHTML = wpMobileMenuContent;
17
- wpMobileMenuLoaded = true;
18
- }
19
-
20
- function wpShowMenuPopup(objMenu, event, popupId)
21
- {
22
- wpInitPopupContent();
23
- if (typeof wpCustommenuTimerHide[popupId] != 'undefined') clearTimeout(wpCustommenuTimerHide[popupId]);
24
- objMenu = $(objMenu.id); var popup = $(popupId); if (!popup) return;
25
- if (!!wpActiveMenu) {
26
- wpHideMenuPopup(objMenu, event, wpActiveMenu.popupId, wpActiveMenu.menuId);
27
- }
28
- wpActiveMenu = {menuId: objMenu.id, popupId: popupId};
29
- if (!objMenu.hasClassName('active')) {
30
- wpCustommenuTimerShow[popupId] = setTimeout(function() {
31
- objMenu.addClassName('active');
32
- var popupWidth = CUSTOMMENU_POPUP_WIDTH;
33
- if (!popupWidth) popupWidth = popup.getWidth();
34
- var pos = wpPopupPos(objMenu, popupWidth);
35
- popup.style.top = pos.top + 'px';
36
- popup.style.left = pos.left + 'px';
37
- wpSetPopupZIndex(popup);
38
- if (CUSTOMMENU_POPUP_WIDTH)
39
- popup.style.width = CUSTOMMENU_POPUP_WIDTH + 'px';
40
- // --- Static Block width ---
41
- var block2 = $(popupId).select('div.block2');
42
- if (typeof block2[0] != 'undefined') {
43
- var wStart = block2[0].id.indexOf('_w');
44
- if (wStart > -1) {
45
- var w = block2[0].id.substr(wStart+2);
46
- } else {
47
- var w = 0;
48
- $(popupId).select('div.block1 div.column').each(function(item) {
49
- w += $(item).getWidth();
50
- });
51
- }
52
- if (w) block2[0].style.width = w + 'px';
53
- }
54
- // --- change href ---
55
- var wpMenuAnchor = $(objMenu.select('a')[0]);
56
- wpChangeTopMenuHref(wpMenuAnchor, true);
57
- // --- show popup ---
58
- if (typeof jQuery == 'undefined') {
59
- popup.style.display = 'block';
60
- } else {
61
- jQuery('#' + popupId).stop(true, true).fadeIn();
62
- }
63
- }, CUSTOMMENU_POPUP_DELAY_BEFORE_DISPLAYING);
64
- }
65
- }
66
-
67
- function wpHideMenuPopup(element, event, popupId, menuId)
68
- {
69
- if (typeof wpCustommenuTimerShow[popupId] != 'undefined') clearTimeout(wpCustommenuTimerShow[popupId]);
70
- var element = $(element); var objMenu = $(menuId) ;var popup = $(popupId); if (!popup) return;
71
- var wpCurrentMouseTarget = getCurrentMouseTarget(event);
72
- if (!!wpCurrentMouseTarget) {
73
- if (!wpIsChildOf(element, wpCurrentMouseTarget) && element != wpCurrentMouseTarget) {
74
- if (!wpIsChildOf(popup, wpCurrentMouseTarget) && popup != wpCurrentMouseTarget) {
75
- if (objMenu.hasClassName('active')) {
76
- wpCustommenuTimerHide[popupId] = setTimeout(function() {
77
- objMenu.removeClassName('active');
78
- // --- change href ---
79
- var wpMenuAnchor = $(objMenu.select('a')[0]);
80
- wpChangeTopMenuHref(wpMenuAnchor, false);
81
- // --- hide popup ---
82
- if (typeof jQuery == 'undefined') {
83
- popup.style.display = 'none';
84
- } else {
85
- jQuery('#' + popupId).stop(true, true).fadeOut();
86
- }
87
- }, CUSTOMMENU_POPUP_DELAY_BEFORE_HIDING);
88
- }
89
- }
90
- }
91
- }
92
- }
93
-
94
- function wpPopupOver(element, event, popupId, menuId)
95
- {
96
- if (typeof wpCustommenuTimerHide[popupId] != 'undefined') clearTimeout(wpCustommenuTimerHide[popupId]);
97
- }
98
-
99
- function wpPopupPos(objMenu, w)
100
- {
101
- var pos = objMenu.cumulativeOffset();
102
- var wraper = $('custommenu');
103
- var posWraper = wraper.cumulativeOffset();
104
- var xTop = pos.top - posWraper.top
105
- if (CUSTOMMENU_POPUP_TOP_OFFSET) {
106
- xTop += CUSTOMMENU_POPUP_TOP_OFFSET;
107
- } else {
108
- xTop += objMenu.getHeight();
109
- }
110
- var res = {'top': xTop};
111
- if (CUSTOMMENU_RTL_MODE) {
112
- var xLeft = pos.left - posWraper.left - w + objMenu.getWidth();
113
- if (xLeft < 0) xLeft = 0;
114
- res.left = xLeft;
115
- } else {
116
- var wWraper = wraper.getWidth();
117
- var xLeft = pos.left - posWraper.left;
118
- if ((xLeft + w) > wWraper) xLeft = wWraper - w;
119
- if (xLeft < 0) xLeft = 0;
120
- res.left = xLeft;
121
- }
122
- return res;
123
- }
124
-
125
- function wpChangeTopMenuHref(wpMenuAnchor, state)
126
- {
127
- if (state) {
128
- wpMenuAnchor.href = wpMenuAnchor.rel;
129
- } else {
130
- wpMenuAnchor.href = 'javascript:void(0);';
131
- }
132
- }
133
-
134
- function wpIsChildOf(parent, child)
135
- {
136
- if (child != null) {
137
- while (child.parentNode) {
138
- if ((child = child.parentNode) == parent) {
139
- return true;
140
- }
141
- }
142
- }
143
- return false;
144
- }
145
-
146
- function wpSetPopupZIndex(popup)
147
- {
148
- $$('.wp-custom-menu-popup').each(function(item){
149
- item.style.zIndex = '9999';
150
- });
151
- popup.style.zIndex = '10000';
152
- }
153
-
154
- function getCurrentMouseTarget(xEvent)
155
- {
156
- var wpCurrentMouseTarget = null;
157
- if (xEvent.toElement) {
158
- wpCurrentMouseTarget = xEvent.toElement;
159
- } else if (xEvent.relatedTarget) {
160
- wpCurrentMouseTarget = xEvent.relatedTarget;
161
- }
162
- return wpCurrentMouseTarget;
163
- }
164
-
165
- function getCurrentMouseTargetMobile(xEvent)
166
- {
167
- if (!xEvent) var xEvent = window.event;
168
- var wpCurrentMouseTarget = null;
169
- if (xEvent.target) wpCurrentMouseTarget = xEvent.target;
170
- else if (xEvent.srcElement) wpCurrentMouseTarget = xEvent.srcElement;
171
- if (wpCurrentMouseTarget.nodeType == 3) // defeat Safari bug
172
- wpCurrentMouseTarget = wpCurrentMouseTarget.parentNode;
173
- return wpCurrentMouseTarget;
174
- }
175
-
176
- /* Mobile */
177
- function wpMenuButtonToggle()
178
- {
179
- $('menu-content').toggle();
180
- }
181
-
182
- function wpGetMobileSubMenuLevel(id)
183
- {
184
- var rel = $(id).readAttribute('rel');
185
- return parseInt(rel.replace('level', ''));
186
- }
187
-
188
- function wpSubMenuToggle(obj, activeMenuId, activeSubMenuId)
189
- {
190
- var currLevel = wpGetMobileSubMenuLevel(activeSubMenuId);
191
- // --- hide submenus ---
192
- $$('.wp-custom-menu-submenu').each(function(item) {
193
- if (item.id == activeSubMenuId) return;
194
- var xLevel = wpGetMobileSubMenuLevel(item.id);
195
- if (xLevel >= currLevel) {
196
- $(item).hide();
197
- }
198
- });
199
- // --- reset button state ---
200
- $('custommenu-mobile').select('span.button').each(function(xItem) {
201
- var subMenuId = $(xItem).readAttribute('rel');
202
- if (!$(subMenuId).visible()) {
203
- $(xItem).removeClassName('open');
204
- }
205
- });
206
- // ---
207
- if ($(activeSubMenuId).getStyle('display') == 'none') {
208
- $(activeSubMenuId).show();
209
- $(obj).addClassName('open');
210
- } else {
211
- $(activeSubMenuId).hide();
212
- $(obj).removeClassName('open');
213
- }
214
- }
215
-
216
- function wpResetMobileMenuState()
217
- {
218
- if ($('menu-content') != undefined) $('menu-content').hide();
219
- $$('.wp-custom-menu-submenu').each(function(item) {
220
- $(item).hide();
221
- });
222
- if ($('custommenu-mobile') != undefined) {
223
- $('custommenu-mobile').select('span.button').each(function(item) {
224
- $(item).removeClassName('open');
225
- });
226
- }
227
- }
228
-
229
- function wpCustomMenuMobileToggle()
230
- {
231
- var w = window,
232
- d = document,
233
- e = d.documentElement,
234
- g = d.getElementsByTagName('body')[0],
235
- x = w.innerWidth || e.clientWidth || g.clientWidth,
236
- y = w.innerHeight|| e.clientHeight|| g.clientHeight;
237
-
238
- if (wpMobileMenuEnabled && CUSTOMMENU_MOBILE_MENU_WIDTH_INIT > x) {
239
-
240
- wpInitMobileMenuContent();
241
- if ($('custommenu') != undefined) $('custommenu').hide();
242
- if ($('custommenu-mobile') != undefined) $('custommenu-mobile').show();
243
- // --- ajax load ---
244
- if (wpMoblieMenuAjaxUrl) {
245
- new Ajax.Request(
246
- wpMoblieMenuAjaxUrl, {
247
- asynchronous: true,
248
- method: 'post',
249
- onSuccess: function(transport) {
250
- if (transport && transport.responseText) {
251
- try {
252
- response = eval('(' + transport.responseText + ')');
253
- } catch (e) {
254
- response = {};
255
- }
256
- }
257
- wpMobileMenuContent = response;
258
- wpMobileMenuLoaded = false;
259
- wpInitMobileMenuContent();
260
- }
261
- }
262
- );
263
- wpMoblieMenuAjaxUrl = null;
264
- }
265
-
266
- } else {
267
-
268
- if ($('custommenu-mobile') != undefined) $('custommenu-mobile').hide();
269
- wpResetMobileMenuState();
270
- if ($('custommenu') != undefined) $('custommenu').show();
271
- // --- ajax load ---
272
- if (wpMenuAjaxUrl) {
273
- new Ajax.Request(
274
- wpMenuAjaxUrl, {
275
- asynchronous: true,
276
- method: 'post',
277
- onSuccess: function(transport) {
278
- if (transport && transport.responseText) {
279
- try {
280
- response = eval('(' + transport.responseText + ')');
281
- } catch (e) {
282
- response = {};
283
- }
284
- }
285
- if ($('custommenu') != undefined) $('custommenu').update(response.topMenu);
286
- wpPopupMenuContent = response.popupMenu;
287
- }
288
- }
289
- );
290
- wpMenuAjaxUrl = null;
291
- }
292
-
293
- }
294
-
295
- if ($('custommenu-loading') != undefined) $('custommenu-loading').remove();
296
- }