📄 repaint_r1.3.aaa.js
字号:
} if(typeof p.toString !== 'function') { p.toString = function() { return 'Daemon ' + this.getId(); }; } /** * onCreate {CustomEvent} * Event that fires whenever a daemon is spawned. * @privileged **/ this.onCreate = new $C('create',this); /** * onDaemonEvent {CustomEvent} * Event that fires whenever any daemon's custom event of any sort fires. * As far as the listener is concerned, it will be just as if it was listening to the actual event that fired. * @privileged **/ this.onDaemonEvent = new $C('daemonEvent'); // actual event time at firing time will likely be different. /** * daemonClass * The class that's used for daemons. * @public **/ this.daemonClass = daemonClass; /** * unload {function} * A function to help with memory management in IE; called on window.unload. * If daemonClass implements an unload method, then all managed daemons will be unloaded. * Then the references to the daemons are nulled. * @private **/ var unload = function(e){ var s=this.stack; for(var i=s.length-1; i>-1; i--) { if(s[i]) { s[i].manager = null; if(typeof(s[i].unload) == 'function') { s[i].unload(); } this.daemons[s[i].getId()] = null; s[i] = null; } } }; $U.Event.addListener(window,'unload',unload,this,true);};DTK.util.Manager.prototype={ /** * daemonEvents {Object} * If any daemon implements any CustomEvents, then a correllary CustomEvent is created as a pass-through. * As a result, assigning a listener to manager.daemonEvents.onFoo is the same as assigning a listener to all of the managed daemons' onFoo event. * @public **/ daemonEvents:{}, /** * spawnDaemon {Function} * method to create a daemon object. Fires the onCreate event. * manager.spawnDaemon('a','b') is equivalent to new manager.daemonClass('a','b'), except that the onCreate event will be fired. * @params {Optional} Any parameters passed to this function will be sent to the daemon constructor. * @public **/ spawnDaemon:function() { var obj = spawn(this.daemonClass,arguments) this.onCreate.fire(obj); return obj; }, /** * idString {String} * String that identifies what kind of manager this object is. Designed to be overwritten by the classes that extend the Manager class. * @public **/ idString:'Generic Daemon Manager', // designed to be overwritten in classes that extend the Manager class. /** * toString {function} * Method to identify this object. Uses the idString property. * @public **/ toString:function(){ var s=[this.idString,'{\n']; for(var c in this.daemons) { if(this.daemons[c] instanceof this.daemonClass) { s.push('\t',c,' : (',this.daemons[c].toString(),')\n'); } } s.push('}'); return s.join(''); }, /** * init {Function} * Create a single daemon and manage it. * @params {Optional} Any parameters sent to this function will be passed to the daemon constructor. * @return A reference to the created daemon object. **/ init:function() { var d=this.spawnDaemon.apply(this,arguments); if(d && d.manager != this) { var onDaemonEvent = this.onDaemonEvent; d.manager = this; this.daemons[d.getId()] = d; this.stack.push(d); for(var e in d){ // walk through all the daemon's properties looking for customevents to watch for. // this implements a "bubbling" sort of functionality. if(d[e] instanceof $C) { if(!this.daemonEvents[e]) { this.daemonEvents[e]=new $C(d[e].type); } var evMgr = this.daemonEvents[e]; var fn=function(type,data){ // fire the manager's version of the child event, and the onDaemonEvent, as if they were the ones that happened in the first place -- same scope, same type, same everything. evMgr.scope=this; evMgr.fire.apply(evMgr,data); onDaemonEvent.scope=this; onDaemonEvent.type=type; onDaemonEvent.fire.apply(onDaemonEvent,data); }; d[e].subscribe(fn); } } } return d; }, /** * initAll {Function} * Run init() a bunch of times. * Note: often overridden or extended in classes that extend the Manager class. * @param finder {Function} Function that returns an array of objects that can be sent as the first argument to the daemon constructor. For example, it could be a function that returns an array of DOM nodes. * @params {Optional} Additional parameters are passes as additional arguments to the daemon constructor function. * @return An array of references to the created daemon objects. **/ initAll:function(finder) { if(typeof(finder) != 'function') return []; var things = finder(); var ret = []; var len = things.length; var args = [null]; var arglen=arguments.length; for(var i=1;i<arglen;i++) { args.push(arguments[i]); } for(var i = 0; i < len; i++) { args[0] = things[i]; var d=this.init.apply(this, args); if(d) { ret.push(d); } } return ret; }, /** * getDaemonById {Function} * Get a reference to a certain daemon by its ID. * @param id {string || HTMLElement} The ID of the daemon, or an HTML element with an id that is the id of the daemon. * @return A reference to the daemon, or null if not found. **/ getDaemonById:function(id) { if(id.id) return this.getDaemonById(id.id); return this.daemons[id] || null; }};})();/** * DTK Carousel Component. * @description http://twiki.corp.yahoo.com/view/Media/DTKCarousel * @requires DTK Manager Utility **/// keep out of global scope.(function() {// shorthandvar $U=YAHOO.util;var $D=$U.Dom;var $E=$U.Event;var $S=$U.Scroll;var DTK=YAHOO.namespace('Media.Dtk');var Carousel; // varred here, but defined inside its own scope. This is the line in.(function(){// private static methods used by DTK.Carousel/** * addPageIndicators Method * @description Adds the links to individual pages * @private * @param C {Carousel Object} Reference to the carousel that is getting set up. **/var addPageIndicators=function() { // check to see if there's already one there. If so, we're going to enslave its babies. var n=$D.getElementsByClassName('scrollnav','div',this.getElement()); n=n[0] || document.createElement('div'); n.className='scrollnav'; removeNavLinks.call(this);//aaa
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -