Changeset 27411 for extensions/rv_menutree
- Timestamp:
- Feb 19, 2014, 6:13:47 AM (11 years ago)
- Location:
- extensions/rv_menutree/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/rv_menutree/trunk/js/rvtree.js
r7956 r27411 94 94 { 95 95 // This LI has UL's in it, so it's a +/- node 96 if ( !XElement.hasClass(item, RVTree.options.nodeOpenClass) )97 XElement.addClass(item, RVTree.options.nodeClosedClass);98 99 96 // If it's just text, make the text work as the link also 100 if (item.firstChild.node Name=="#text")97 if (item.firstChild.nodeType==3) 101 98 { 102 99 t = t+item.firstChild.nodeValue; … … 127 124 if (isRoot && RVTree.options.IEVersion && RVTree.options.IEVersion < 8) 128 125 item.style.marginLeft="-16px"; // thats IE6,IE7 ; IE8 seems more compliant 129 if (s) 130 { 131 s.appendChild(document.createTextNode(t)); 132 item.insertBefore(s,item.firstChild); 133 } 126 s.appendChild(document.createTextNode(t)); 127 item.insertBefore(s,item.firstChild); 134 128 } 135 129 ul.style.marginLeft = 0; -
extensions/rv_menutree/trunk/js/rvtree.min.js
r7956 r27411 1 var XElement={hasClass:function(a,d){if(!a)return false;var f=a.className;return f.length>0&&(f==d||RegExp("(^|\\s)"+d+"(\\s|$)").test(f))},addClass:function(a,d){if(a){XElement.hasClass(a,d)||(a.className+=(a.className?" ":"")+d);return a}},toggleClasses:function(a,d,f){if(a){for(var b=a.className.split(/\s+/),g=-1,c=-1,e=0;e<b.length;e++){if(b[e]==d)g=e;if(b[e]==f)c=e}if(g>=0){b.splice(g,1);c>=g&&c--}else b.push(d);c>=0?b.splice(c,1):b.push(f);a.className=b.join(" ");return a}}},RVTree={options:{nodeClosedClass:"liClosed", 2 nodeOpenClass:"liOpen",nodeBulletClass:"liBullet",nodeLinkClass:"bullet"},convertTree:function(a){if(document.createElement){if(window.attachEvent&&!window.opera)if(/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)!=null)RVTree.options.IEVersion=parseFloat(RegExp.$1);RVTree._processList(a,true)}},_processList:function(a,d){if(!(!a.childNodes||a.childNodes.length==0)){for(var f=0;f<a.childNodes.length;f++){var b=a.childNodes[f];if(b.nodeName=="LI"){for(var g=false,c=0;c<b.childNodes.length;c++){var e= 3 b.childNodes[c];if(e.nodeName=="UL"){g=true;RVTree._processList(e,false)}}c=document.createElement("SPAN");e="\u00a0";c.className=RVTree.options.nodeLinkClass;if(g){XElement.hasClass(b,RVTree.options.nodeOpenClass)||XElement.addClass(b,RVTree.options.nodeClosedClass);if(b.firstChild.nodeName=="#text"){e+=b.firstChild.nodeValue;b.removeChild(b.firstChild)}c.onclick=function(){XElement.toggleClasses(this.parentNode,RVTree.options.nodeOpenClass,RVTree.options.nodeClosedClass);return false}}else if(XElement.hasClass(b, 4 RVTree.options.nodeClosedClass))c.onclick=function(){var h=this.parentNode.getElementsByTagName("A");if(h.length)document.location=h[0].href};else XElement.addClass(b,RVTree.options.nodeBulletClass);b.style.listStyleType="none";if(d&&RVTree.options.IEVersion&&RVTree.options.IEVersion<8)b.style.marginLeft="-16px";if(c){c.appendChild(document.createTextNode(e));b.insertBefore(c,b.firstChild)}}}a.style.marginLeft=0;a.style.paddingLeft=d?0:"8px"}}}; 5 (function(){if(typeof _rvTreeAutoQueue!="undefined"&&_rvTreeAutoQueue.length)for(var a=0;a<_rvTreeAutoQueue.length;a++)RVTree.convertTree(_rvTreeAutoQueue[a]);_rvTreeAutoQueue={push:function(d){RVTree.convertTree(d)}}})(); 1 var XElement={hasClass:function(a,e){if(!a)return!1;var f=a.className;return 0<f.length&&(f==e||RegExp("(^|\\s)"+e+"(\\s|$)").test(f))},addClass:function(a,e){if(a)return XElement.hasClass(a,e)||(a.className+=(a.className?" ":"")+e),a},toggleClasses:function(a,e,f){if(a){for(var b=a.className.split(/\s+/),g=-1,c=-1,d=0;d<b.length;d++)b[d]==e&&(g=d),b[d]==f&&(c=d);0<=g?(b.splice(g,1),c>=g&&c--):b.push(e);0<=c?b.splice(c,1):b.push(f);a.className=b.join(" ");return a}}},RVTree={options:{nodeClosedClass:"liClosed", 2 nodeOpenClass:"liOpen",nodeBulletClass:"liBullet",nodeLinkClass:"bullet"},convertTree:function(a){document.createElement&&(window.attachEvent&&!window.opera&&null!=/MSIE ([0-9]{1,}[.0-9]{0,})/.exec(navigator.userAgent)&&(RVTree.options.IEVersion=parseFloat(RegExp.$1)),RVTree._processList(a,!0))},_processList:function(a,e){if(a.childNodes&&0!=a.childNodes.length){for(var f=0;f<a.childNodes.length;f++){var b=a.childNodes[f];if("LI"==b.nodeName){for(var g=!1,c=0;c<b.childNodes.length;c++){var d=b.childNodes[c]; 3 "UL"==d.nodeName&&(g=!0,RVTree._processList(d,!1))}c=document.createElement("SPAN");d="\u00a0";c.className=RVTree.options.nodeLinkClass;g?(3==b.firstChild.nodeType&&(d+=b.firstChild.nodeValue,b.removeChild(b.firstChild)),c.onclick=function(){XElement.toggleClasses(this.parentNode,RVTree.options.nodeOpenClass,RVTree.options.nodeClosedClass);return!1}):XElement.hasClass(b,RVTree.options.nodeClosedClass)?c.onclick=function(){var a=this.parentNode.getElementsByTagName("A");a.length&&(document.location= 4 a[0].href)}:XElement.addClass(b,RVTree.options.nodeBulletClass);b.style.listStyleType="none";e&&RVTree.options.IEVersion&&8>RVTree.options.IEVersion&&(b.style.marginLeft="-16px");c.appendChild(document.createTextNode(d));b.insertBefore(c,b.firstChild)}}a.style.marginLeft=0;a.style.paddingLeft=e?0:"8px"}}};(function(){if("undefined"!=typeof _rvTreeAutoQueue&&_rvTreeAutoQueue.length)for(var a=0;a<_rvTreeAutoQueue.length;a++)RVTree.convertTree(_rvTreeAutoQueue[a]);_rvTreeAutoQueue={push:function(a){RVTree.convertTree(a)}}})(); -
extensions/rv_menutree/trunk/main.inc.php
r24720 r27411 47 47 global $template, $page; 48 48 49 $upper_ids = isset($page['category']['uppercats']) ? array_flip( explode(',', $page['category']['uppercats'])) : null; 50 $refLevel = 0; 51 foreach($block->data['MENU_CATEGORIES'] as &$cat) 52 { 53 $level = $cat['LEVEL']; 54 if ($level>$refLevel) 55 $pre = '<ul'.($refLevel==0?' class=rvTree id=theCategoryMenu':'').'>'; 56 else 57 $pre = '</li>'.str_repeat('</ul></li>', $refLevel-$level); 58 59 $class= $cat['SELECTED'] ? 'selected ' : ''; 60 if ($cat['count_categories'] > 0) 61 $class .= isset($upper_ids[$cat['id']]) ? 'liOpen':'liClosed'; 62 if (!empty($class)) 63 $class=' class="'.$class.'"'; 64 $cat['PRE'] = $pre; 65 $cat['CLASS'] = $class; 66 $refLevel = $level; 67 } 68 unset($cat); 49 69 $rvmt_base_name = basename(dirname(__FILE__)); 50 70 $template->set_template_dir(PHPWG_ROOT_PATH.'plugins/'.$rvmt_base_name.'/template/'); 51 71 $template->assign(array( 52 72 'RVMT_BASE_NAME' => $rvmt_base_name, 53 'RVMT_ UPPER_IDS' => isset($page['category']['uppercats']) ? array_flip( explode(',', $page['category']['uppercats'])) : null,73 'RVMT_POST' => str_repeat('</li></ul>', $refLevel), 54 74 ) 55 75 ); -
extensions/rv_menutree/trunk/template/rv_menutree_categories.tpl
r27368 r27411 4 4 <dd> 5 5 {strip} 6 {assign var='ref_level' value=0}7 6 {foreach from=$block->data.MENU_CATEGORIES item=cat} 8 {if $cat.LEVEL > $ref_level} 9 <ul{if $ref_level == 0} class=rvTree id=theCategoryMenu{/if}> 10 {else} 11 </li> 12 {'</ul></li>'|@str_repeat:($ref_level-$cat.LEVEL)} 13 {/if} 14 {if $cat.SELECTED} 15 {assign var=liclass value='selected '} 16 {else} 17 {assign var=liclass value=''} 18 {/if} 19 {if $cat.count_categories > 0} 20 {if isset($RVMT_UPPER_IDS[$cat.id])} 21 {assign var=liclass value="`$liclass`liOpen"} 22 {else} 23 {assign var=liclass value="`$liclass`liClosed"} 24 {/if} 25 {/if} 26 <li{if !empty($liclass)} class="{$liclass}"{/if}> <a href="{$cat.URL}"{if $cat.IS_UPPERCAT} rel="up"{/if}>{$cat.NAME}</a> 7 {$cat.PRE} 8 <li{$cat.CLASS}> <a href="{$cat.URL}"{if $cat.IS_UPPERCAT} rel="up"{/if}>{$cat.NAME}</a> 27 9 {if $cat.count_images > 0} 28 10 <span{if $cat.nb_images <= 0} class=menuInfoCatByChild{/if} title="{$cat.TITLE}"> [{$cat.count_images}] </span> … … 31 13 <img title="{$cat.icon_ts.TITLE}" src="{$ROOT_URL}{$themeconf.icon_dir}/recent{if $cat.icon_ts.IS_CHILD_DATE}_by_child{/if}.png" alt="(!)"> 32 14 {/if} 33 {assign var='ref_level' value=$cat.LEVEL}34 15 {/foreach} 35 { '</li></ul>'|@str_repeat:$ref_level}16 {$RVMT_POST} 36 17 {/strip} 37 18 {combine_script id='rvmt' load='async' path="plugins/`$RVMT_BASE_NAME`/js/rvtree.min.js"}
Note: See TracChangeset
for help on using the changeset viewer.