Alien-Web-ExtJS-V3

 view release on metacpan or  search on metacpan

share/docs/source/Ext-more.html  view on Meta::CPAN

        scrollWidth = null;

    return {
<span id='Ext-property-emptyFn'>        /**
</span>        * A reusable empty function
        * @property
        * @type Function
        */
        emptyFn : function(){},

<span id='Ext-property-BLANK_IMAGE_URL'>        /**
</span>         * URL to a 1x1 transparent gif image used by Ext to create inline icons with CSS background images.
         * In older versions of IE, this defaults to &quot;http://extjs.com/s.gif&quot; and you should change this to a URL on your server.
         * For other browsers it uses an inline data URL.
         * @type String
         */
        BLANK_IMAGE_URL : Ext.isIE6 || Ext.isIE7 || Ext.isAir ?
                            'http:/' + '/www.extjs.com/s.gif' :
                            'data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==',

        extendX : function(supr, fn){
            return Ext.extend(supr, fn(supr.prototype));
        },

<span id='Ext-method-getDoc'>        /**
</span>         * Returns the current HTML document object as an {@link Ext.Element}.
         * @return Ext.Element The document
         */
        getDoc : function(){
            return Ext.get(document);
        },

<span id='Ext-method-num'>        /**
</span>         * Utility method for validating that a value is numeric, returning the specified default value if it is not.
         * @param {Mixed} value Should be a number, but any type will be handled appropriately
         * @param {Number} defaultValue The value to return if the original value is non-numeric
         * @return {Number} Value, if numeric, else defaultValue
         */
        num : function(v, defaultValue){
            v = Number(Ext.isEmpty(v) || Ext.isArray(v) || typeof v == 'boolean' || (typeof v == 'string' &amp;&amp; v.trim().length == 0) ? NaN : v);
            return isNaN(v) ? defaultValue : v;
        },

<span id='Ext-method-value'>        /**
</span>         * &lt;p&gt;Utility method for returning a default value if the passed value is empty.&lt;/p&gt;
         * &lt;p&gt;The value is deemed to be empty if it is&lt;div class=&quot;mdetail-params&quot;&gt;&lt;ul&gt;
         * &lt;li&gt;null&lt;/li&gt;
         * &lt;li&gt;undefined&lt;/li&gt;
         * &lt;li&gt;an empty array&lt;/li&gt;
         * &lt;li&gt;a zero length string (Unless the &lt;tt&gt;allowBlank&lt;/tt&gt; parameter is &lt;tt&gt;true&lt;/tt&gt;)&lt;/li&gt;
         * &lt;/ul&gt;&lt;/div&gt;
         * @param {Mixed} value The value to test
         * @param {Mixed} defaultValue The value to return if the original value is empty
         * @param {Boolean} allowBlank (optional) true to allow zero length strings to qualify as non-empty (defaults to false)
         * @return {Mixed} value, if non-empty, else defaultValue
         */
        value : function(v, defaultValue, allowBlank){
            return Ext.isEmpty(v, allowBlank) ? defaultValue : v;
        },

<span id='Ext-method-escapeRe'>        /**
</span>         * Escapes the passed string for use in a regular expression
         * @param {String} str
         * @return {String}
         */
        escapeRe : function(s) {
            return s.replace(/([-.*+?^${}()|[\]\/\\])/g, &quot;\\$1&quot;);
        },

        sequence : function(o, name, fn, scope){
            o[name] = o[name].createSequence(fn, scope);
        },

<span id='Ext-method-addBehaviors'>        /**
</span>         * Applies event listeners to elements by selectors when the document is ready.
         * The event name is specified with an &lt;tt&gt;&amp;#64;&lt;/tt&gt; suffix.
         * &lt;pre&gt;&lt;code&gt;
Ext.addBehaviors({
    // add a listener for click on all anchors in element with id foo
    '#foo a&amp;#64;click' : function(e, t){
        // do something
    },

    // add the same listener to multiple selectors (separated by comma BEFORE the &amp;#64;)
    '#foo a, #bar span.some-class&amp;#64;mouseover' : function(){
        // do something
    }
});
         * &lt;/code&gt;&lt;/pre&gt;
         * @param {Object} obj The list of behaviors to apply
         */
        addBehaviors : function(o){
            if(!Ext.isReady){
                Ext.onReady(function(){
                    Ext.addBehaviors(o);
                });
            } else {
                var cache = {}, // simple cache for applying multiple behaviors to same selector does query multiple times
                    parts,
                    b,
                    s;
                for (b in o) {
                    if ((parts = b.split('@'))[1]) { // for Object prototype breakers
                        s = parts[0];
                        if(!cache[s]){
                            cache[s] = Ext.select(s);
                        }
                        cache[s].on(parts[1], o[b]);
                    }
                }
                cache = null;
            }
        },

<span id='Ext-method-getScrollBarWidth'>        /**
</span>         * Utility method for getting the width of the browser scrollbar. This can differ depending on
         * operating system settings, such as the theme or font size.
         * @param {Boolean} force (optional) true to force a recalculation of the value.
         * @return {Number} The width of the scrollbar.
         */
        getScrollBarWidth: function(force){
            if(!Ext.isReady){
                return 0;
            }

            if(force === true || scrollWidth === null){

share/docs/source/Ext-more.html  view on Meta::CPAN


        // internal
        callback : function(cb, scope, args, delay){
            if(typeof cb == 'function'){
                if(delay){
                    cb.defer(delay, scope, args || []);
                }else{
                    cb.apply(scope, args || []);
                }
            }
        }
    };
}());

<span id='Function'>/**
</span> * @class Function
 * These functions are available on every Function object (any JavaScript function).
 */
Ext.apply(Function.prototype, {
<span id='Function-method-createSequence'>    /**
</span>     * Create a combined function call sequence of the original function + the passed function.
     * The resulting function returns the results of the original function.
     * The passed fcn is called with the parameters of the original function. Example usage:
     * &lt;pre&gt;&lt;code&gt;
var sayHi = function(name){
    alert('Hi, ' + name);
}

sayHi('Fred'); // alerts &quot;Hi, Fred&quot;

var sayGoodbye = sayHi.createSequence(function(name){
    alert('Bye, ' + name);
});

sayGoodbye('Fred'); // both alerts show
&lt;/code&gt;&lt;/pre&gt;
     * @param {Function} fcn The function to sequence
     * @param {Object} scope (optional) The scope (&lt;code&gt;&lt;b&gt;this&lt;/b&gt;&lt;/code&gt; reference) in which the passed function is executed.
     * &lt;b&gt;If omitted, defaults to the scope in which the original function is called or the browser window.&lt;/b&gt;
     * @return {Function} The new function
     */
    createSequence : function(fcn, scope){
        var method = this;
        return (typeof fcn != 'function') ?
                this :
                function(){
                    var retval = method.apply(this || window, arguments);
                    fcn.apply(scope || this || window, arguments);
                    return retval;
                };
    }
});


<span id='String'>/**
</span> * @class String
 * These functions are available as static methods on the JavaScript String object.
 */
Ext.applyIf(String, {

<span id='String-static-method-escape'>    /**
</span>     * Escapes the passed string for ' and \
     * @param {String} string The string to escape
     * @return {String} The escaped string
     * @static
     */
    escape : function(string) {
        return string.replace(/('|\\)/g, &quot;\\$1&quot;);
    },

<span id='String-static-method-leftPad'>    /**
</span>     * Pads the left side of a string with a specified character.  This is especially useful
     * for normalizing number and date strings.  Example usage:
     * &lt;pre&gt;&lt;code&gt;
var s = String.leftPad('123', 5, '0');
// s now contains the string: '00123'
     * &lt;/code&gt;&lt;/pre&gt;
     * @param {String} string The original string
     * @param {Number} size The total length of the output string
     * @param {String} char (optional) The character with which to pad the original string (defaults to empty string &quot; &quot;)
     * @return {String} The padded string
     * @static
     */
    leftPad : function (val, size, ch) {
        var result = String(val);
        if(!ch) {
            ch = &quot; &quot;;
        }
        while (result.length &lt; size) {
            result = ch + result;
        }
        return result;
    }
});

<span id='String-method-toggle'>/**
</span> * Utility function that allows you to easily switch a string between two alternating values.  The passed value
 * is compared to the current string, and if they are equal, the other value that was passed in is returned.  If
 * they are already different, the first value passed in is returned.  Note that this method returns the new value
 * but does not change the current string.
 * &lt;pre&gt;&lt;code&gt;
// alternate sort directions
sort = sort.toggle('ASC', 'DESC');

// instead of conditional logic:
sort = (sort == 'ASC' ? 'DESC' : 'ASC');
&lt;/code&gt;&lt;/pre&gt;
 * @param {String} value The value to compare to the current string
 * @param {String} other The new value to use if the string already equals the first value passed in
 * @return {String} The new value
 */
String.prototype.toggle = function(value, other){
    return this == value ? other : value;
};

<span id='String-method-trim'>/**
</span> * Trims whitespace from either end of a string, leaving spaces within the string intact.  Example:
 * &lt;pre&gt;&lt;code&gt;
var s = '  foo bar  ';
alert('-' + s + '-');         //alerts &quot;- foo bar -&quot;
alert('-' + s.trim() + '-');  //alerts &quot;-foo bar-&quot;
&lt;/code&gt;&lt;/pre&gt;
 * @return {String} The trimmed string
 */
String.prototype.trim = function(){
    var re = /^\s+|\s+$/g;
    return function(){ return this.replace(re, &quot;&quot;); };



( run in 1.342 second using v1.01-cache-2.11-cpan-119454b85a5 )