Changeset 457097
- Timestamp:
- 10/29/2011 03:43:17 PM (14 years ago)
- Location:
- fancy-events/trunk
- Files:
-
- 3 edited
-
fancy_events.php (modified) (1 diff)
-
js/fancy_events.js (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fancy-events/trunk/fancy_events.php
r457072 r457097 104 104 delete_option('fancy_events_options_data'); // so we don't have to reset all the 'off' checkboxes too! (don't think this is needed but leave for now) 105 105 106 $arr = array( "fancy_events_options_image" => plugins_url() +"/fancy-events/images/halloween.png",107 "fancy_events_options_speed" => " 50",108 "fancy_events_options_max_images" => " 20",106 $arr = array( "fancy_events_options_image" => plugins_url() . "/fancy-events/images/halloween.png", 107 "fancy_events_options_speed" => "60", 108 "fancy_events_options_max_images" => "15", 109 109 "fancy_events_options_zindex" => "200", 110 110 "fancy_events_options_opacity" => "0.7" -
fancy-events/trunk/js/fancy_events.js
r457079 r457097 1 2 var ready = (function(){ 3 4 var readyList, 5 DOMContentLoaded, 6 class2type = {}; 7 class2type["[object Boolean]"] = "boolean"; 8 class2type["[object Number]"] = "number"; 9 class2type["[object String]"] = "string"; 10 class2type["[object Function]"] = "function"; 11 class2type["[object Array]"] = "array"; 12 class2type["[object Date]"] = "date"; 13 class2type["[object RegExp]"] = "regexp"; 14 class2type["[object Object]"] = "object"; 15 16 var ReadyObj = { 17 // Is the DOM ready to be used? Set to true once it occurs. 18 isReady: false, 19 // A counter to track how many items to wait for before 20 // the ready event fires. See #6781 21 readyWait: 1, 22 // Hold (or release) the ready event 23 holdReady: function( hold ) { 24 if ( hold ) { 25 ReadyObj.readyWait++; 26 } else { 27 ReadyObj.ready( true ); 28 } 29 }, 30 // Handle when the DOM is ready 31 ready: function( wait ) { 32 // Either a released hold or an DOMready/load event and not yet ready 33 if ( (wait === true && !--ReadyObj.readyWait) || (wait !== true && !ReadyObj.isReady) ) { 34 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 35 if ( !document.body ) { 36 return setTimeout( ReadyObj.ready, 1 ); 37 } 38 39 // Remember that the DOM is ready 40 ReadyObj.isReady = true; 41 // If a normal DOM Ready event fired, decrement, and wait if need be 42 if ( wait !== true && --ReadyObj.readyWait > 0 ) { 43 return; 44 } 45 // If there are functions bound, to execute 46 readyList.resolveWith( document, [ ReadyObj ] ); 47 48 // Trigger any bound ready events 49 //if ( ReadyObj.fn.trigger ) { 50 // ReadyObj( document ).trigger( "ready" ).unbind( "ready" ); 51 //} 52 } 53 }, 54 bindReady: function() { 55 if ( readyList ) { 56 return; 57 } 58 readyList = ReadyObj._Deferred(); 59 60 // Catch cases where $(document).ready() is called after the 61 // browser event has already occurred. 62 if ( document.readyState === "complete" ) { 63 // Handle it asynchronously to allow scripts the opportunity to delay ready 64 return setTimeout( ReadyObj.ready, 1 ); 65 } 66 67 // Mozilla, Opera and webkit nightlies currently support this event 68 if ( document.addEventListener ) { 69 // Use the handy event callback 70 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 71 // A fallback to window.onload, that will always work 72 window.addEventListener( "load", ReadyObj.ready, false ); 73 74 // If IE event model is used 75 } else if ( document.attachEvent ) { 76 // ensure firing before onload, 77 // maybe late but safe also for iframes 78 document.attachEvent( "onreadystatechange", DOMContentLoaded ); 79 80 // A fallback to window.onload, that will always work 81 window.attachEvent( "onload", ReadyObj.ready ); 82 83 // If IE and not a frame 84 // continually check to see if the document is ready 85 var toplevel = false; 86 87 try { 88 toplevel = window.frameElement == null; 89 } catch(e) {} 90 91 if ( document.documentElement.doScroll && toplevel ) { 92 doScrollCheck(); 93 } 94 } 95 }, 96 _Deferred: function() { 97 var // callbacks list 98 callbacks = [], 99 // stored [ context , args ] 100 fired, 101 // to avoid firing when already doing so 102 firing, 103 // flag to know if the deferred has been cancelled 104 cancelled, 105 // the deferred itself 106 deferred = { 107 108 // done( f1, f2, ...) 109 done: function() { 110 if ( !cancelled ) { 111 var args = arguments, 112 i, 113 length, 114 elem, 115 type, 116 _fired; 117 if ( fired ) { 118 _fired = fired; 119 fired = 0; 120 } 121 for ( i = 0, length = args.length; i < length; i++ ) { 122 elem = args[ i ]; 123 type = ReadyObj.type( elem ); 124 if ( type === "array" ) { 125 deferred.done.apply( deferred, elem ); 126 } else if ( type === "function" ) { 127 callbacks.push( elem ); 128 } 129 } 130 if ( _fired ) { 131 deferred.resolveWith( _fired[ 0 ], _fired[ 1 ] ); 132 } 133 } 134 return this; 135 }, 136 137 // resolve with given context and args 138 resolveWith: function( context, args ) { 139 if ( !cancelled && !fired && !firing ) { 140 // make sure args are available (#8421) 141 args = args || []; 142 firing = 1; 143 try { 144 while( callbacks[ 0 ] ) { 145 callbacks.shift().apply( context, args );//shifts a callback, and applies it to document 146 } 147 } 148 finally { 149 fired = [ context, args ]; 150 firing = 0; 151 } 152 } 153 return this; 154 }, 155 156 // resolve with this as context and given arguments 157 resolve: function() { 158 deferred.resolveWith( this, arguments ); 159 return this; 160 }, 161 162 // Has this deferred been resolved? 163 isResolved: function() { 164 return !!( firing || fired ); 165 }, 166 167 // Cancel 168 cancel: function() { 169 cancelled = 1; 170 callbacks = []; 171 return this; 172 } 173 }; 174 175 return deferred; 176 }, 177 type: function( obj ) { 178 return obj == null ? 179 String( obj ) : 180 class2type[ Object.prototype.toString.call(obj) ] || "object"; 181 } 182 } 183 // The DOM ready check for Internet Explorer 184 function doScrollCheck() { 185 if ( ReadyObj.isReady ) { 186 return; 187 } 188 189 try { 190 // If IE is used, use the trick by Diego Perini 191 // http://javascript.nwbox.com/IEContentLoaded/ 192 document.documentElement.doScroll("left"); 193 } catch(e) { 194 setTimeout( doScrollCheck, 1 ); 195 return; 196 } 197 198 // and execute any waiting functions 199 ReadyObj.ready(); 200 } 201 // Cleanup functions for the document ready method 202 if ( document.addEventListener ) { 203 DOMContentLoaded = function() { 204 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 205 ReadyObj.ready(); 206 }; 207 208 } else if ( document.attachEvent ) { 209 DOMContentLoaded = function() { 210 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 211 if ( document.readyState === "complete" ) { 212 document.detachEvent( "onreadystatechange", DOMContentLoaded ); 213 ReadyObj.ready(); 214 } 215 }; 216 } 217 function ready( fn ) { 218 // Attach the listeners 219 ReadyObj.bindReady(); 220 221 var type = ReadyObj.type( fn ); 222 223 // Add the callback 224 readyList.done( fn );//readyList is result of _Deferred() 225 } 226 return ready; 227 })(); 228 229 230 //alert(MyScriptParams.foo); 231 //alert(FancyEventsWpPluginParams.image); 232 1 233 /* 2 234 Only for test … … 7 239 var _lag = 3500; 8 240 var _opacity = 50 241 9 242 */ 10 243 … … 44 277 return setInterval(main_loop, _speed ); 45 278 } 46 279 280 47 281 function createImage() 48 282 { … … 153 387 } 154 388 */ 155 156 389 /********************************************************************************************* 157 390 STUPID FUCKING IE FUCK!!!!!!!!! FUCK!!!!! I will not include Jquery with 1000000000 code lines! :( … … 212 445 213 446 214 init(); 215 /**************************************************************************** 216 SPECIAL THANKS TO: 217 ***************************************************************************** 218 http://www.davidflanagan.com/2010/12/let-it-snow.html 219 http://silveiraneto.net/2011/06/02/simple-html5-animation-clouds-over-background/ 220 http://www.iconfinder.com/icondetails/34847/128/halloween_jack_o_lantern_pumpkin_icon 221 http://www.iconfinder.com/icondetails/40223/128/christmas_tree_icon 222 http://www.iconfinder.com/icondetails/44609/256/alcohol_beer_glass_icon?r=1 223 **************************************************************************** 224 225 **************************************************************************** 447 ready(function() 448 { 449 init(); 450 /**************************************************************************** 451 SPECIAL THANKS TO: 452 ***************************************************************************** 453 http://www.davidflanagan.com/2010/12/let-it-snow.html 454 http://silveiraneto.net/2011/06/02/simple-html5-animation-clouds-over-background/ 455 http://www.iconfinder.com/icondetails/34847/128/halloween_jack_o_lantern_pumpkin_icon 456 http://www.iconfinder.com/icondetails/40223/128/christmas_tree_icon 457 http://www.iconfinder.com/icondetails/44609/256/alcohol_beer_glass_icon?r=1 458 **************************************************************************** 459 460 **************************************************************************** 226 461 */ 462 }); -
fancy-events/trunk/readme.txt
r457081 r457097 9 9 10 10 == Description == 11 12 Warning some problems with WP Minify plugin(if it don't works try to disable)! :-( 11 13 12 14 Fancy Event uses a javascript script (written by me) that create images that fall from the top down. From the options you can select which event to celebrate. … … 48 50 == Changelog == 49 51 = 1.0.3 = 50 fix bugs jquery conflict 52 1. fix default option error (concatenation string with + in php not so good! :) ) 53 2. fix readme.txt title 51 54 = 1.0.2 = 52 55 fix link bug fancy_events in fancy-events
Note: See TracChangeset
for help on using the changeset viewer.