frontline 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +0 -0
- data/LICENSE +19 -0
- data/README.md +92 -0
- data/Rakefile +21 -0
- data/assets/ansi_up.js +143 -0
- data/assets/api.js +533 -0
- data/assets/bootstrap/css/bootstrap-responsive.min.css +9 -0
- data/assets/bootstrap/css/bootstrap.min.css +9 -0
- data/assets/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/assets/bootstrap/img/glyphicons-halflings.png +0 -0
- data/assets/bootstrap/js/bootstrap.min.js +6 -0
- data/assets/jquery.cookie.js +95 -0
- data/assets/jquery.js +6 -0
- data/assets/noty/jquery.noty.js +520 -0
- data/assets/noty/layouts/top.js +34 -0
- data/assets/noty/layouts/topRight.js +43 -0
- data/assets/noty/promise.js +432 -0
- data/assets/noty/themes/default.js +156 -0
- data/assets/select2-bootstrap.css +86 -0
- data/assets/select2/select2-spinner.gif +0 -0
- data/assets/select2/select2.css +615 -0
- data/assets/select2/select2.min.js +22 -0
- data/assets/select2/select2.png +0 -0
- data/assets/select2/select2x2.png +0 -0
- data/assets/typeahead.js-bootstrap.css +49 -0
- data/assets/typeahead.min.js +7 -0
- data/assets/ui.css +28 -0
- data/assets/xhr.js +19 -0
- data/bin/frontline +19 -0
- data/frontline.gemspec +31 -0
- data/images/0.png +0 -0
- data/lib/frontline.rb +23 -0
- data/lib/frontline/actions.rb +15 -0
- data/lib/frontline/app.rb +86 -0
- data/lib/frontline/controllers/controllers.rb +71 -0
- data/lib/frontline/controllers/index.rb +167 -0
- data/lib/frontline/controllers/models.rb +104 -0
- data/lib/frontline/controllers/sources.rb +11 -0
- data/lib/frontline/frontline.rb +11 -0
- data/lib/frontline/helpers.rb +179 -0
- data/lib/frontline/inflect.rb +183 -0
- data/lib/frontline/templates/controllers/controller.slim +27 -0
- data/lib/frontline/templates/controllers/index.slim +56 -0
- data/lib/frontline/templates/controllers/route.slim +17 -0
- data/lib/frontline/templates/controllers/route_editor.slim +45 -0
- data/lib/frontline/templates/controllers/route_layout.slim +88 -0
- data/lib/frontline/templates/editor.slim +17 -0
- data/lib/frontline/templates/error.slim +36 -0
- data/lib/frontline/templates/index/applications.slim +123 -0
- data/lib/frontline/templates/layout.slim +182 -0
- data/lib/frontline/templates/models/index.slim +31 -0
- data/lib/frontline/templates/models/migration.slim +46 -0
- data/lib/frontline/templates/models/migration_layout.slim +159 -0
- data/lib/frontline/templates/models/model.slim +34 -0
- metadata +245 -0
| @@ -0,0 +1,34 @@ | |
| 1 | 
            +
            ;(function($) {
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            	$.noty.layouts.top = {
         | 
| 4 | 
            +
            		name: 'top',
         | 
| 5 | 
            +
            		options: {},
         | 
| 6 | 
            +
            		container: {
         | 
| 7 | 
            +
            			object: '<ul id="noty_top_layout_container" />',
         | 
| 8 | 
            +
            			selector: 'ul#noty_top_layout_container',
         | 
| 9 | 
            +
            			style: function() {
         | 
| 10 | 
            +
            				$(this).css({
         | 
| 11 | 
            +
            					top: 0,
         | 
| 12 | 
            +
            					left: '5%',
         | 
| 13 | 
            +
            					position: 'fixed',
         | 
| 14 | 
            +
            					width: '90%',
         | 
| 15 | 
            +
            					height: 'auto',
         | 
| 16 | 
            +
            					margin: 0,
         | 
| 17 | 
            +
            					padding: 0,
         | 
| 18 | 
            +
            					listStyleType: 'none',
         | 
| 19 | 
            +
            					zIndex: 9999999
         | 
| 20 | 
            +
            				});
         | 
| 21 | 
            +
            			}
         | 
| 22 | 
            +
            		},
         | 
| 23 | 
            +
            		parent: {
         | 
| 24 | 
            +
            			object: '<li />',
         | 
| 25 | 
            +
            			selector: 'li',
         | 
| 26 | 
            +
            			css: {}
         | 
| 27 | 
            +
            		},
         | 
| 28 | 
            +
            		css: {
         | 
| 29 | 
            +
            			display: 'none'
         | 
| 30 | 
            +
            		},
         | 
| 31 | 
            +
            		addClass: ''
         | 
| 32 | 
            +
            	};
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            })(jQuery);
         | 
| @@ -0,0 +1,43 @@ | |
| 1 | 
            +
            ;(function($) {
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            	$.noty.layouts.topRight = {
         | 
| 4 | 
            +
            		name: 'topRight',
         | 
| 5 | 
            +
            		options: { // overrides options
         | 
| 6 | 
            +
            			
         | 
| 7 | 
            +
            		},
         | 
| 8 | 
            +
            		container: {
         | 
| 9 | 
            +
            			object: '<ul id="noty_topRight_layout_container" />',
         | 
| 10 | 
            +
            			selector: 'ul#noty_topRight_layout_container',
         | 
| 11 | 
            +
            			style: function() {
         | 
| 12 | 
            +
            				$(this).css({
         | 
| 13 | 
            +
            					top: 20,
         | 
| 14 | 
            +
            					right: 20,
         | 
| 15 | 
            +
            					position: 'fixed',
         | 
| 16 | 
            +
            					width: '310px',
         | 
| 17 | 
            +
            					height: 'auto',
         | 
| 18 | 
            +
            					margin: 0,
         | 
| 19 | 
            +
            					padding: 0,
         | 
| 20 | 
            +
            					listStyleType: 'none',
         | 
| 21 | 
            +
            					zIndex: 10000000
         | 
| 22 | 
            +
            				});
         | 
| 23 | 
            +
             | 
| 24 | 
            +
            				if (window.innerWidth < 600) {
         | 
| 25 | 
            +
            					$(this).css({
         | 
| 26 | 
            +
            						right: 5
         | 
| 27 | 
            +
            					});
         | 
| 28 | 
            +
            				}
         | 
| 29 | 
            +
            			}
         | 
| 30 | 
            +
            		},
         | 
| 31 | 
            +
            		parent: {
         | 
| 32 | 
            +
            			object: '<li />',
         | 
| 33 | 
            +
            			selector: 'li',
         | 
| 34 | 
            +
            			css: {}
         | 
| 35 | 
            +
            		},
         | 
| 36 | 
            +
            		css: {
         | 
| 37 | 
            +
            			display: 'none',
         | 
| 38 | 
            +
            			width: '310px'
         | 
| 39 | 
            +
            		},
         | 
| 40 | 
            +
            		addClass: ''
         | 
| 41 | 
            +
            	};
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            })(jQuery);
         | 
| @@ -0,0 +1,432 @@ | |
| 1 | 
            +
            /*!
         | 
| 2 | 
            +
             * Noty Helpers Javascript From JQuery Javascript Library
         | 
| 3 | 
            +
             *
         | 
| 4 | 
            +
             * Ported by Maksim Pecherskiy.  Original Licensing:
         | 
| 5 | 
            +
             *
         | 
| 6 | 
            +
             * http://jquery.com/
         | 
| 7 | 
            +
             *
         | 
| 8 | 
            +
             * Copyright 2011, John Resig
         | 
| 9 | 
            +
             * Dual licensed under the MIT or GPL Version 2 licenses.
         | 
| 10 | 
            +
             * http://jquery.org/license
         | 
| 11 | 
            +
             *
         | 
| 12 | 
            +
             * Includes Sizzle.js
         | 
| 13 | 
            +
             * http://sizzlejs.com/
         | 
| 14 | 
            +
             * Copyright 2011, The Dojo Foundation
         | 
| 15 | 
            +
             * Released under the MIT, BSD, and GPL Licenses.
         | 
| 16 | 
            +
             *
         | 
| 17 | 
            +
             * Date: Mon Nov 21 21:11:03 2011 -0500
         | 
| 18 | 
            +
             */
         | 
| 19 | 
            +
             | 
| 20 | 
            +
             | 
| 21 | 
            +
            (function(){
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              // String to Object flags format cache
         | 
| 24 | 
            +
            var flagsCache = {};
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            // Convert String-formatted flags into Object-formatted ones and store in cache
         | 
| 27 | 
            +
            function createFlags( flags ) {
         | 
| 28 | 
            +
              var object = flagsCache[ flags ] = {},
         | 
| 29 | 
            +
                i, length;
         | 
| 30 | 
            +
              flags = flags.split( /\s+/ );
         | 
| 31 | 
            +
              for ( i = 0, length = flags.length; i < length; i++ ) {
         | 
| 32 | 
            +
                object[ flags[i] ] = true;
         | 
| 33 | 
            +
              }
         | 
| 34 | 
            +
              return object;
         | 
| 35 | 
            +
            }
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            jQuery.extend({
         | 
| 38 | 
            +
             | 
| 39 | 
            +
              _mark: function( elem, type ) {
         | 
| 40 | 
            +
                if ( elem ) {
         | 
| 41 | 
            +
                  type = (type || "fx") + "mark";
         | 
| 42 | 
            +
                  jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true );
         | 
| 43 | 
            +
                }
         | 
| 44 | 
            +
              },
         | 
| 45 | 
            +
             | 
| 46 | 
            +
              _unmark: function( force, elem, type ) {
         | 
| 47 | 
            +
                if ( force !== true ) {
         | 
| 48 | 
            +
                  type = elem;
         | 
| 49 | 
            +
                  elem = force;
         | 
| 50 | 
            +
                  force = false;
         | 
| 51 | 
            +
                }
         | 
| 52 | 
            +
                if ( elem ) {
         | 
| 53 | 
            +
                  type = type || "fx";
         | 
| 54 | 
            +
                  var key = type + "mark",
         | 
| 55 | 
            +
                    count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 );
         | 
| 56 | 
            +
                  if ( count ) {
         | 
| 57 | 
            +
                    jQuery.data( elem, key, count, true );
         | 
| 58 | 
            +
                  } else {
         | 
| 59 | 
            +
                    jQuery.removeData( elem, key, true );
         | 
| 60 | 
            +
                    handleQueueMarkDefer( elem, type, "mark" );
         | 
| 61 | 
            +
                  }
         | 
| 62 | 
            +
                }
         | 
| 63 | 
            +
              },
         | 
| 64 | 
            +
             | 
| 65 | 
            +
              queue: function( elem, type, data ) {
         | 
| 66 | 
            +
                if ( elem ) {
         | 
| 67 | 
            +
                  type = (type || "fx") + "queue";
         | 
| 68 | 
            +
                  var q = jQuery.data( elem, type, undefined, true );
         | 
| 69 | 
            +
                  // Speed up dequeue by getting out quickly if this is just a lookup
         | 
| 70 | 
            +
                  if ( data ) {
         | 
| 71 | 
            +
                    if ( !q || jQuery.isArray(data) ) {
         | 
| 72 | 
            +
                      q = jQuery.data( elem, type, jQuery.makeArray(data), true );
         | 
| 73 | 
            +
                    } else {
         | 
| 74 | 
            +
                      q.push( data );
         | 
| 75 | 
            +
                    }
         | 
| 76 | 
            +
                  }
         | 
| 77 | 
            +
                  return q || [];
         | 
| 78 | 
            +
                }
         | 
| 79 | 
            +
              },
         | 
| 80 | 
            +
             | 
| 81 | 
            +
              dequeue: function( elem, type ) {
         | 
| 82 | 
            +
                type = type || "fx";
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                var queue = jQuery.queue( elem, type ),
         | 
| 85 | 
            +
                  fn = queue.shift(),
         | 
| 86 | 
            +
                  defer;
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                // If the fx queue is dequeued, always remove the progress sentinel
         | 
| 89 | 
            +
                if ( fn === "inprogress" ) {
         | 
| 90 | 
            +
                  fn = queue.shift();
         | 
| 91 | 
            +
                }
         | 
| 92 | 
            +
             | 
| 93 | 
            +
                if ( fn ) {
         | 
| 94 | 
            +
                  // Add a progress sentinel to prevent the fx queue from being
         | 
| 95 | 
            +
                  // automatically dequeued
         | 
| 96 | 
            +
                  if ( type === "fx" ) {
         | 
| 97 | 
            +
                    queue.unshift("inprogress");
         | 
| 98 | 
            +
                  }
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                  fn.call(elem, function() {
         | 
| 101 | 
            +
                    jQuery.dequeue(elem, type);
         | 
| 102 | 
            +
                  });
         | 
| 103 | 
            +
                }
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                if ( !queue.length ) {
         | 
| 106 | 
            +
                  jQuery.removeData( elem, type + "queue", true );
         | 
| 107 | 
            +
                  handleQueueMarkDefer( elem, type, "queue" );
         | 
| 108 | 
            +
                }
         | 
| 109 | 
            +
              }
         | 
| 110 | 
            +
            });
         | 
| 111 | 
            +
             | 
| 112 | 
            +
            jQuery.fn.extend({
         | 
| 113 | 
            +
              queue: function( type, data ) {
         | 
| 114 | 
            +
                if ( typeof type !== "string" ) {
         | 
| 115 | 
            +
                  data = type;
         | 
| 116 | 
            +
                  type = "fx";
         | 
| 117 | 
            +
                }
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                if ( data === undefined ) {
         | 
| 120 | 
            +
                  return jQuery.queue( this[0], type );
         | 
| 121 | 
            +
                }
         | 
| 122 | 
            +
                return this.each(function() {
         | 
| 123 | 
            +
                  var queue = jQuery.queue( this, type, data );
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                  if ( type === "fx" && queue[0] !== "inprogress" ) {
         | 
| 126 | 
            +
                    jQuery.dequeue( this, type );
         | 
| 127 | 
            +
                  }
         | 
| 128 | 
            +
                });
         | 
| 129 | 
            +
              },
         | 
| 130 | 
            +
              dequeue: function( type ) {
         | 
| 131 | 
            +
                return this.each(function() {
         | 
| 132 | 
            +
                  jQuery.dequeue( this, type );
         | 
| 133 | 
            +
                });
         | 
| 134 | 
            +
              },
         | 
| 135 | 
            +
              // Based off of the plugin by Clint Helfers, with permission.
         | 
| 136 | 
            +
              // http://blindsignals.com/index.php/2009/07/jquery-delay/
         | 
| 137 | 
            +
              delay: function( time, type ) {
         | 
| 138 | 
            +
                time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
         | 
| 139 | 
            +
                type = type || "fx";
         | 
| 140 | 
            +
             | 
| 141 | 
            +
                return this.queue( type, function() {
         | 
| 142 | 
            +
                  var elem = this;
         | 
| 143 | 
            +
                  setTimeout(function() {
         | 
| 144 | 
            +
                    jQuery.dequeue( elem, type );
         | 
| 145 | 
            +
                  }, time );
         | 
| 146 | 
            +
                });
         | 
| 147 | 
            +
              },
         | 
| 148 | 
            +
              clearQueue: function( type ) {
         | 
| 149 | 
            +
                return this.queue( type || "fx", [] );
         | 
| 150 | 
            +
              },
         | 
| 151 | 
            +
              // Get a promise resolved when queues of a certain type
         | 
| 152 | 
            +
              // are emptied (fx is the type by default)
         | 
| 153 | 
            +
              promise: function( type, object ) {
         | 
| 154 | 
            +
                if ( typeof type !== "string" ) {
         | 
| 155 | 
            +
                  object = type;
         | 
| 156 | 
            +
                  type = undefined;
         | 
| 157 | 
            +
                }
         | 
| 158 | 
            +
                type = type || "fx";
         | 
| 159 | 
            +
                var defer = jQuery.Deferred(),
         | 
| 160 | 
            +
                  elements = this,
         | 
| 161 | 
            +
                  i = elements.length,
         | 
| 162 | 
            +
                  count = 1,
         | 
| 163 | 
            +
                  deferDataKey = type + "defer",
         | 
| 164 | 
            +
                  queueDataKey = type + "queue",
         | 
| 165 | 
            +
                  markDataKey = type + "mark",
         | 
| 166 | 
            +
                  tmp;
         | 
| 167 | 
            +
                function resolve() {
         | 
| 168 | 
            +
                  if ( !( --count ) ) {
         | 
| 169 | 
            +
                    defer.resolveWith( elements, [ elements ] );
         | 
| 170 | 
            +
                  }
         | 
| 171 | 
            +
                }
         | 
| 172 | 
            +
                while( i-- ) {
         | 
| 173 | 
            +
                  if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
         | 
| 174 | 
            +
                      ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
         | 
| 175 | 
            +
                        jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
         | 
| 176 | 
            +
                      jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) {
         | 
| 177 | 
            +
                    count++;
         | 
| 178 | 
            +
                    tmp.done( resolve );
         | 
| 179 | 
            +
                  }
         | 
| 180 | 
            +
                }
         | 
| 181 | 
            +
                resolve();
         | 
| 182 | 
            +
                return defer.promise();
         | 
| 183 | 
            +
              }
         | 
| 184 | 
            +
            });
         | 
| 185 | 
            +
             | 
| 186 | 
            +
            function handleQueueMarkDefer( elem, type, src ) {
         | 
| 187 | 
            +
              var deferDataKey = type + "defer",
         | 
| 188 | 
            +
                queueDataKey = type + "queue",
         | 
| 189 | 
            +
                markDataKey = type + "mark",
         | 
| 190 | 
            +
                defer = jQuery._data( elem, deferDataKey );
         | 
| 191 | 
            +
              if ( defer &&
         | 
| 192 | 
            +
                ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
         | 
| 193 | 
            +
                ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
         | 
| 194 | 
            +
                // Give room for hard-coded callbacks to fire first
         | 
| 195 | 
            +
                // and eventually mark/queue something else on the element
         | 
| 196 | 
            +
                setTimeout( function() {
         | 
| 197 | 
            +
                  if ( !jQuery._data( elem, queueDataKey ) &&
         | 
| 198 | 
            +
                    !jQuery._data( elem, markDataKey ) ) {
         | 
| 199 | 
            +
                    jQuery.removeData( elem, deferDataKey, true );
         | 
| 200 | 
            +
                    defer.fire();
         | 
| 201 | 
            +
                  }
         | 
| 202 | 
            +
                }, 0 );
         | 
| 203 | 
            +
              }
         | 
| 204 | 
            +
            }
         | 
| 205 | 
            +
             | 
| 206 | 
            +
             | 
| 207 | 
            +
             | 
| 208 | 
            +
            jQuery.Callbacks = function( flags ) {
         | 
| 209 | 
            +
             | 
| 210 | 
            +
              // Convert flags from String-formatted to Object-formatted
         | 
| 211 | 
            +
              // (we check in cache first)
         | 
| 212 | 
            +
              flags = flags ? ( /*flagsCache[ flags ] || */createFlags( flags ) ) : {};
         | 
| 213 | 
            +
             | 
| 214 | 
            +
              var // Actual callback list
         | 
| 215 | 
            +
                list = [],
         | 
| 216 | 
            +
                // Stack of fire calls for repeatable lists
         | 
| 217 | 
            +
                stack = [],
         | 
| 218 | 
            +
                // Last fire value (for non-forgettable lists)
         | 
| 219 | 
            +
                memory,
         | 
| 220 | 
            +
                // Flag to know if list is currently firing
         | 
| 221 | 
            +
                firing,
         | 
| 222 | 
            +
                // First callback to fire (used internally by add and fireWith)
         | 
| 223 | 
            +
                firingStart,
         | 
| 224 | 
            +
                // End of the loop when firing
         | 
| 225 | 
            +
                firingLength,
         | 
| 226 | 
            +
                // Index of currently firing callback (modified by remove if needed)
         | 
| 227 | 
            +
                firingIndex,
         | 
| 228 | 
            +
                // Add one or several callbacks to the list
         | 
| 229 | 
            +
                add = function( args ) {
         | 
| 230 | 
            +
                  var i,
         | 
| 231 | 
            +
                    length,
         | 
| 232 | 
            +
                    elem,
         | 
| 233 | 
            +
                    type,
         | 
| 234 | 
            +
                    actual;
         | 
| 235 | 
            +
                  for ( i = 0, length = args.length; i < length; i++ ) {
         | 
| 236 | 
            +
                    elem = args[ i ];
         | 
| 237 | 
            +
                    type = jQuery.type( elem );
         | 
| 238 | 
            +
                    if ( type === "array" ) {
         | 
| 239 | 
            +
                      // Inspect recursively
         | 
| 240 | 
            +
                      add( elem );
         | 
| 241 | 
            +
                    } else if ( type === "function" ) {
         | 
| 242 | 
            +
                      // Add if not in unique mode and callback is not in
         | 
| 243 | 
            +
                      if ( !flags.unique || !self.has( elem ) ) {
         | 
| 244 | 
            +
                        list.push( elem );
         | 
| 245 | 
            +
                      }
         | 
| 246 | 
            +
                    }
         | 
| 247 | 
            +
                  }
         | 
| 248 | 
            +
                },
         | 
| 249 | 
            +
                // Fire callbacks
         | 
| 250 | 
            +
                fire = function( context, args ) {
         | 
| 251 | 
            +
                  args = args || [];
         | 
| 252 | 
            +
                  memory = !flags.memory || [ context, args ];
         | 
| 253 | 
            +
                  firing = true;
         | 
| 254 | 
            +
                  firingIndex = firingStart || 0;
         | 
| 255 | 
            +
                  firingStart = 0;
         | 
| 256 | 
            +
                  firingLength = list.length;
         | 
| 257 | 
            +
                  for ( ; list && firingIndex < firingLength; firingIndex++ ) {
         | 
| 258 | 
            +
                    if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
         | 
| 259 | 
            +
                      memory = true; // Mark as halted
         | 
| 260 | 
            +
                      break;
         | 
| 261 | 
            +
                    }
         | 
| 262 | 
            +
                  }
         | 
| 263 | 
            +
                  firing = false;
         | 
| 264 | 
            +
                  if ( list ) {
         | 
| 265 | 
            +
                    if ( !flags.once ) {
         | 
| 266 | 
            +
                      if ( stack && stack.length ) {
         | 
| 267 | 
            +
                        memory = stack.shift();
         | 
| 268 | 
            +
                        self.fireWith( memory[ 0 ], memory[ 1 ] );
         | 
| 269 | 
            +
                      }
         | 
| 270 | 
            +
                    } else if ( memory === true ) {
         | 
| 271 | 
            +
                      self.disable();
         | 
| 272 | 
            +
                    } else {
         | 
| 273 | 
            +
                      list = [];
         | 
| 274 | 
            +
                    }
         | 
| 275 | 
            +
                  }
         | 
| 276 | 
            +
                },
         | 
| 277 | 
            +
                // Actual Callbacks object
         | 
| 278 | 
            +
                self = {
         | 
| 279 | 
            +
                  // Add a callback or a collection of callbacks to the list
         | 
| 280 | 
            +
                  add: function() {
         | 
| 281 | 
            +
                    if ( list ) {
         | 
| 282 | 
            +
                      var length = list.length;
         | 
| 283 | 
            +
                      add( arguments );
         | 
| 284 | 
            +
                      // Do we need to add the callbacks to the
         | 
| 285 | 
            +
                      // current firing batch?
         | 
| 286 | 
            +
                      if ( firing ) {
         | 
| 287 | 
            +
                        firingLength = list.length;
         | 
| 288 | 
            +
                      // With memory, if we're not firing then
         | 
| 289 | 
            +
                      // we should call right away, unless previous
         | 
| 290 | 
            +
                      // firing was halted (stopOnFalse)
         | 
| 291 | 
            +
                      } else if ( memory && memory !== true ) {
         | 
| 292 | 
            +
                        firingStart = length;
         | 
| 293 | 
            +
                        fire( memory[ 0 ], memory[ 1 ] );
         | 
| 294 | 
            +
                      }
         | 
| 295 | 
            +
                    }
         | 
| 296 | 
            +
                    return this;
         | 
| 297 | 
            +
                  },
         | 
| 298 | 
            +
                  // Remove a callback from the list
         | 
| 299 | 
            +
                  remove: function() {
         | 
| 300 | 
            +
                    if ( list ) {
         | 
| 301 | 
            +
                      var args = arguments,
         | 
| 302 | 
            +
                        argIndex = 0,
         | 
| 303 | 
            +
                        argLength = args.length;
         | 
| 304 | 
            +
                      for ( ; argIndex < argLength ; argIndex++ ) {
         | 
| 305 | 
            +
                        for ( var i = 0; i < list.length; i++ ) {
         | 
| 306 | 
            +
                          if ( args[ argIndex ] === list[ i ] ) {
         | 
| 307 | 
            +
                            // Handle firingIndex and firingLength
         | 
| 308 | 
            +
                            if ( firing ) {
         | 
| 309 | 
            +
                              if ( i <= firingLength ) {
         | 
| 310 | 
            +
                                firingLength--;
         | 
| 311 | 
            +
                                if ( i <= firingIndex ) {
         | 
| 312 | 
            +
                                  firingIndex--;
         | 
| 313 | 
            +
                                }
         | 
| 314 | 
            +
                              }
         | 
| 315 | 
            +
                            }
         | 
| 316 | 
            +
                            // Remove the element
         | 
| 317 | 
            +
                            list.splice( i--, 1 );
         | 
| 318 | 
            +
                            // If we have some unicity property then
         | 
| 319 | 
            +
                            // we only need to do this once
         | 
| 320 | 
            +
                            if ( flags.unique ) {
         | 
| 321 | 
            +
                              break;
         | 
| 322 | 
            +
                            }
         | 
| 323 | 
            +
                          }
         | 
| 324 | 
            +
                        }
         | 
| 325 | 
            +
                      }
         | 
| 326 | 
            +
                    }
         | 
| 327 | 
            +
                    return this;
         | 
| 328 | 
            +
                  },
         | 
| 329 | 
            +
                  // Control if a given callback is in the list
         | 
| 330 | 
            +
                  has: function( fn ) {
         | 
| 331 | 
            +
                    if ( list ) {
         | 
| 332 | 
            +
                      var i = 0,
         | 
| 333 | 
            +
                        length = list.length;
         | 
| 334 | 
            +
                      for ( ; i < length; i++ ) {
         | 
| 335 | 
            +
                        if ( fn === list[ i ] ) {
         | 
| 336 | 
            +
                          return true;
         | 
| 337 | 
            +
                        }
         | 
| 338 | 
            +
                      }
         | 
| 339 | 
            +
                    }
         | 
| 340 | 
            +
                    return false;
         | 
| 341 | 
            +
                  },
         | 
| 342 | 
            +
                  // Remove all callbacks from the list
         | 
| 343 | 
            +
                  empty: function() {
         | 
| 344 | 
            +
                    list = [];
         | 
| 345 | 
            +
                    return this;
         | 
| 346 | 
            +
                  },
         | 
| 347 | 
            +
                  // Have the list do nothing anymore
         | 
| 348 | 
            +
                  disable: function() {
         | 
| 349 | 
            +
                    list = stack = memory = undefined;
         | 
| 350 | 
            +
                    return this;
         | 
| 351 | 
            +
                  },
         | 
| 352 | 
            +
                  // Is it disabled?
         | 
| 353 | 
            +
                  disabled: function() {
         | 
| 354 | 
            +
                    return !list;
         | 
| 355 | 
            +
                  },
         | 
| 356 | 
            +
                  // Lock the list in its current state
         | 
| 357 | 
            +
                  lock: function() {
         | 
| 358 | 
            +
                    stack = undefined;
         | 
| 359 | 
            +
                    if ( !memory || memory === true ) {
         | 
| 360 | 
            +
                      self.disable();
         | 
| 361 | 
            +
                    }
         | 
| 362 | 
            +
                    return this;
         | 
| 363 | 
            +
                  },
         | 
| 364 | 
            +
                  // Is it locked?
         | 
| 365 | 
            +
                  locked: function() {
         | 
| 366 | 
            +
                    return !stack;
         | 
| 367 | 
            +
                  },
         | 
| 368 | 
            +
                  // Call all callbacks with the given context and arguments
         | 
| 369 | 
            +
                  fireWith: function( context, args ) {
         | 
| 370 | 
            +
                    if ( stack ) {
         | 
| 371 | 
            +
                      if ( firing ) {
         | 
| 372 | 
            +
                        if ( !flags.once ) {
         | 
| 373 | 
            +
                          stack.push( [ context, args ] );
         | 
| 374 | 
            +
                        }
         | 
| 375 | 
            +
                      } else if ( !( flags.once && memory ) ) {
         | 
| 376 | 
            +
                        fire( context, args );
         | 
| 377 | 
            +
                      }
         | 
| 378 | 
            +
                    }
         | 
| 379 | 
            +
                    return this;
         | 
| 380 | 
            +
                  },
         | 
| 381 | 
            +
                  // Call all the callbacks with the given arguments
         | 
| 382 | 
            +
                  fire: function() {
         | 
| 383 | 
            +
                    self.fireWith( this, arguments );
         | 
| 384 | 
            +
                    return this;
         | 
| 385 | 
            +
                  },
         | 
| 386 | 
            +
                  // To know if the callbacks have already been called at least once
         | 
| 387 | 
            +
                  fired: function() {
         | 
| 388 | 
            +
                    return !!memory;
         | 
| 389 | 
            +
                  }
         | 
| 390 | 
            +
                };
         | 
| 391 | 
            +
             | 
| 392 | 
            +
              return self;
         | 
| 393 | 
            +
            };
         | 
| 394 | 
            +
             | 
| 395 | 
            +
             | 
| 396 | 
            +
             | 
| 397 | 
            +
            jQuery.fn.extend({
         | 
| 398 | 
            +
              // Get a promise resolved when queues of a certain type
         | 
| 399 | 
            +
              // are emptied (fx is the type by default)
         | 
| 400 | 
            +
              promise: function( type, object ) {
         | 
| 401 | 
            +
                if ( typeof type !== "string" ) {
         | 
| 402 | 
            +
                  object = type;
         | 
| 403 | 
            +
                  type = undefined;
         | 
| 404 | 
            +
                }
         | 
| 405 | 
            +
                type = type || "fx";
         | 
| 406 | 
            +
                var defer = jQuery.Deferred(),
         | 
| 407 | 
            +
                  elements = this,
         | 
| 408 | 
            +
                  i = elements.length,
         | 
| 409 | 
            +
                  count = 1,
         | 
| 410 | 
            +
                  deferDataKey = type + "defer",
         | 
| 411 | 
            +
                  queueDataKey = type + "queue",
         | 
| 412 | 
            +
                  markDataKey = type + "mark",
         | 
| 413 | 
            +
                  tmp;
         | 
| 414 | 
            +
                function resolve() {
         | 
| 415 | 
            +
                  if ( !( --count ) ) {
         | 
| 416 | 
            +
                    defer.resolveWith( elements, [ elements ] );
         | 
| 417 | 
            +
                  }
         | 
| 418 | 
            +
                }
         | 
| 419 | 
            +
                while( i-- ) {
         | 
| 420 | 
            +
                  if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
         | 
| 421 | 
            +
                      ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
         | 
| 422 | 
            +
                        jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
         | 
| 423 | 
            +
                      jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
         | 
| 424 | 
            +
                    count++;
         | 
| 425 | 
            +
                    tmp.add( resolve );
         | 
| 426 | 
            +
                  }
         | 
| 427 | 
            +
                }
         | 
| 428 | 
            +
                resolve();
         | 
| 429 | 
            +
                return defer.promise();
         | 
| 430 | 
            +
              }
         | 
| 431 | 
            +
            });
         | 
| 432 | 
            +
            })();
         |