Commit 482fb8b8d16cbe256075ede09cb0cd28d5eb582b

Authored by AurelioAHeckert
1 parent 4b28d7ee

ActionItem358: now is posible to havesome theme specific javascript

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1754 3f533792-8f58-4932-b0fe-aaf55b0a4547
public/designs/themes/ecosol/default.yml
... ... @@ -1,2 +0,0 @@
1   -title: "Default"
2   -description: "A simple theme"
public/designs/themes/ecosol/javascript/auto-open-menu.js 0 → 100644
... ... @@ -0,0 +1,64 @@
  1 +
  2 +function setAutoOpenMenu( menu ) {
  3 +
  4 + var mul = menu.getElementsByTagName("ul")[0];
  5 + if ( !mul ) return false;
  6 +
  7 + mul.h = mul.clientHeight; // remember the current height to a faster animation
  8 + mul.minSize = mul.clientHeight;
  9 + var vli = mul.getElementsByTagName("li");
  10 + mul.paddingBottom = parseInt( menu.className.replace( /^.*AOM_paddingBottom_([^\s]+).*$/, "$1" ) );
  11 + mul.maxSize = ( vli.length * ( vli[1].offsetTop - vli[0].offsetTop ) );
  12 + mul.inc = 1;
  13 +
  14 + window["autoOpenMenu-"+menu.id] = menu;
  15 + menu.mul = mul;
  16 +
  17 + if ( mul.minSize == 1 ) {
  18 + // Work arround bug for IE - ie sux - ie sux - ie sux - ie sux -ie sux -ie sux -ie sux - ie sux!!!
  19 + mul.h = 3;
  20 + setTimeout('m = window[\'autoOpenMenu-'+menu.id+'\']; m.onmouseout()', 10);
  21 + }
  22 +
  23 + menu.isIE = ( navigator.appName.indexOf("Microsoft") > -1 );
  24 +
  25 + menu.onmouseover = function () {
  26 + clearTimeout( this.timeoutClose );
  27 + var mul = this.mul;
  28 + if ( mul.paddingBottom ) mul.parentNode.style.paddingBottom = mul.paddingBottom +"px";
  29 + if ( mul.h < mul.maxSize ) {
  30 + mul.h += mul.inc;
  31 + mul.inc += 2;
  32 + mul.style.height = mul.h +"px";
  33 + this.timeoutOpen = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseover()", 33 );
  34 + } else {
  35 + mul.h = mul.maxSize;
  36 + mul.style.height = mul.h +"px";
  37 + mul.inc = 1;
  38 + }
  39 + }
  40 +
  41 + menu.onmouseout = function ( doIt, firstDoIt ) {
  42 + clearTimeout( this.timeoutOpen );
  43 + var mul = this.mul;
  44 + if ( firstDoIt ) mul.inc = 1;
  45 + if ( doIt == true ) {
  46 + if ( mul.h > mul.minSize ) {
  47 + mul.h -= mul.inc++;
  48 + if ( mul.h < 0 ) mul.h = 0;
  49 + if ( this.isIE ) if ( mul.h < 1 ) mul.h = 1;
  50 + mul.style.height = mul.h +"px";
  51 + this.timeoutClose = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseout(true)", 33 );
  52 + } else {
  53 + mul.h = mul.minSize;
  54 + mul.style.height = mul.h +"px";
  55 + if ( mul.paddingBottom ) mul.parentNode.style.paddingBottom = "0px";
  56 + mul.inc = 2;
  57 + }
  58 + } else {
  59 + // Work arround IE bug
  60 + this.timeoutClose = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseout(true, true)", 200 );
  61 + }
  62 + }
  63 +
  64 +}
... ...
public/designs/themes/ecosol/theme.yml 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +title: "Default"
  2 +description: "A simple theme"
  3 +js: [ auto-open-menu ]
... ...
public/javascripts/auto-open-menu.js
... ... @@ -1,64 +0,0 @@
1   -
2   -function setAutoOpenMenu( menu ) {
3   -
4   - var mul = menu.getElementsByTagName("ul")[0];
5   - if ( !mul ) return false;
6   -
7   - mul.h = mul.clientHeight; // remember the current height to a faster animation
8   - mul.minSize = mul.clientHeight;
9   - var vli = mul.getElementsByTagName("li");
10   - mul.paddingBottom = parseInt( menu.className.replace( /^.*AOM_paddingBottom_([^\s]+).*$/, "$1" ) );
11   - mul.maxSize = ( vli.length * ( vli[1].offsetTop - vli[0].offsetTop ) );
12   - mul.inc = 1;
13   -
14   - window["autoOpenMenu-"+menu.id] = menu;
15   - menu.mul = mul;
16   -
17   - if ( mul.minSize == 1 ) {
18   - // Work arround bug for IE - ie sux - ie sux - ie sux - ie sux -ie sux -ie sux -ie sux - ie sux!!!
19   - mul.h = 3;
20   - setTimeout('m = window[\'autoOpenMenu-'+menu.id+'\']; m.onmouseout()', 10);
21   - }
22   -
23   - menu.isIE = ( navigator.appName.indexOf("Microsoft") > -1 );
24   -
25   - menu.onmouseover = function () {
26   - clearTimeout( this.timeoutClose );
27   - var mul = this.mul;
28   - if ( mul.paddingBottom ) mul.parentNode.style.paddingBottom = mul.paddingBottom +"px";
29   - if ( mul.h < mul.maxSize ) {
30   - mul.h += mul.inc;
31   - mul.inc += 2;
32   - mul.style.height = mul.h +"px";
33   - this.timeoutOpen = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseover()", 33 );
34   - } else {
35   - mul.h = mul.maxSize;
36   - mul.style.height = mul.h +"px";
37   - mul.inc = 1;
38   - }
39   - }
40   -
41   - menu.onmouseout = function ( doIt, firstDoIt ) {
42   - clearTimeout( this.timeoutOpen );
43   - var mul = this.mul;
44   - if ( firstDoIt ) mul.inc = 1;
45   - if ( doIt == true ) {
46   - if ( mul.h > mul.minSize ) {
47   - mul.h -= mul.inc++;
48   - if ( mul.h < 0 ) mul.h = 0;
49   - if ( this.isIE ) if ( mul.h < 1 ) mul.h = 1;
50   - mul.style.height = mul.h +"px";
51   - this.timeoutClose = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseout(true)", 33 );
52   - } else {
53   - mul.h = mul.minSize;
54   - mul.style.height = mul.h +"px";
55   - if ( mul.paddingBottom ) mul.parentNode.style.paddingBottom = "0px";
56   - mul.inc = 2;
57   - }
58   - } else {
59   - // Work arround IE bug
60   - this.timeoutClose = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseout(true, true)", 200 );
61   - }
62   - }
63   -
64   -}