Revision 2903,
1.9 KB
checked in by rodsouza, 14 years ago
(diff) |
Ticket #1058 - Corrigindo problemas na inclusão de folhas de estilo.
|
Rev | Line | |
---|
[2903] | 1 | //****c* XTools/XEvents |
---|
| 2 | // NAME |
---|
| 3 | // XStyle |
---|
| 4 | // |
---|
| 5 | // DESCRIPTION |
---|
| 6 | // Manipula folhas de estilo |
---|
| 7 | // |
---|
| 8 | // AUTHOR |
---|
| 9 | // Rodrigo Souza dos Santos |
---|
| 10 | // |html <br /><a href="mailto:%72%6f%64%72%69%67%6f%2e%73%6f%75%7a%61%40%63%65%6c%65%70%61%72%2e%70%72%2e%67%6f%76%2e%62%72">rodrigo.souza@celepar.pr.gov.br</a> |
---|
| 11 | // |html <br /><a href="mailto:%72%6f%64%72%69%67%6f%73%6f%75%7a%61%64%6f%73%73%61%6e%74%6f%73%40%67%6d%61%69%6c%2e%63%6f%6d">rodrigosouzadossantos@gmail.com</a> |
---|
| 12 | // |
---|
| 13 | //****** |
---|
| 14 | // You can use this space for remarks that should not be included |
---|
| 15 | // in the documentation. |
---|
| 16 | // |
---|
| 17 | ( function( ) |
---|
| 18 | { |
---|
| 19 | var _head = null; |
---|
| 20 | var _new = [ ]; |
---|
| 21 | var _loaded = [ ]; |
---|
| 22 | |
---|
| 23 | function _add( ) |
---|
| 24 | { |
---|
| 25 | if ( ! ( arguments.length && arguments[ 0 ] && arguments[ 0 ].constructor == String ) ) |
---|
| 26 | return false; |
---|
| 27 | |
---|
| 28 | for ( var i = 0; i < _loaded; i++ ) |
---|
| 29 | if ( _loaded[ i ] == arguments[ 0 ] ) |
---|
| 30 | return false; |
---|
| 31 | |
---|
| 32 | if ( _head ) |
---|
| 33 | _style( arguments[ 0 ] ); |
---|
| 34 | else |
---|
| 35 | _new[ _new.length ] = arguments[ 0 ]; |
---|
| 36 | } |
---|
| 37 | |
---|
| 38 | function _style( ) |
---|
| 39 | { |
---|
| 40 | if ( ! ( arguments.length && arguments[ 0 ] && arguments[ 0 ].constructor == String ) ) |
---|
| 41 | return false; |
---|
| 42 | |
---|
| 43 | var _sheet = document.createElement( 'link' ); |
---|
| 44 | _sheet.setAttribute( 'href', arguments[ 0 ] ); |
---|
| 45 | _sheet.setAttribute( 'rel', 'StyleSheet' ); |
---|
| 46 | _sheet.setAttribute( 'type', 'text/css' ); |
---|
| 47 | |
---|
| 48 | _head.appendChild( _sheet ); |
---|
| 49 | |
---|
| 50 | return true; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | function Style( ) |
---|
| 54 | { |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | Style.prototype.add = _add; |
---|
| 58 | |
---|
| 59 | window.XStyle = new Style; |
---|
| 60 | |
---|
| 61 | XEvents.add( window, 'onload', function( ) |
---|
| 62 | { |
---|
| 63 | _head = document.getElementsByTagName( 'head' ).item( 0 ); |
---|
| 64 | |
---|
| 65 | for ( var i = 0; i < _new.length; i++ ) |
---|
| 66 | _style( _new[ i ] ); |
---|
| 67 | } ); |
---|
| 68 | } )( ); |
---|
Note: See
TracBrowser
for help on using the repository browser.