puffer 0.0.11 → 0.0.12
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/VERSION +1 -1
- data/app/helpers/puffer_helper.rb +8 -0
- data/app/views/layouts/puffer.html.erb +5 -11
- data/lib/generators/puffer/install/install_generator.rb +2 -2
- data/lib/generators/puffer/install/templates/puffer.rb +12 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/{application.js → puffer.js} +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/{rails-src.js → rails.js} +0 -0
- data/lib/puffer.rb +14 -0
- data/lib/puffer/controller/mutate.rb +8 -2
- data/lib/puffer/extensions/mapper.rb +2 -2
- data/lib/puffer/inputs.rb +1 -1
- data/lib/puffer/path_set.rb +14 -7
- data/lib/puffer/resource.rb +1 -1
- data/puffer.gemspec +8 -44
- data/spec/dummy/config/initializers/puffer.rb +12 -0
- data/spec/dummy/public/puffer/javascripts/{application.js → puffer.js} +0 -0
- data/spec/dummy/public/puffer/javascripts/{rails-src.js → rails.js} +0 -0
- metadata +10 -46
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-autocompleter-src.js +0 -621
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-autocompleter.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-calendar-src.js +0 -1461
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-calendar.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-in-edit-src.js +0 -369
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-in-edit.js +0 -13
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-in-edit.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-lightbox-src.js +0 -905
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-lightbox.js +0 -24
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-lightbox.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-sortable-src.js +0 -428
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-sortable.js +0 -17
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-sortable.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-src.js +0 -5892
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-tabs-src.js +0 -1145
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-tabs.js +0 -29
- data/lib/generators/puffer/install/templates/puffer/javascripts/right-tabs.js.gz +0 -0
- data/lib/generators/puffer/install/templates/puffer/javascripts/right.js.gz +0 -0
- data/spec/dummy/config/puffer.rb +0 -0
- data/spec/dummy/public/puffer/javascripts/right-autocompleter-src.js +0 -621
- data/spec/dummy/public/puffer/javascripts/right-autocompleter.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right-calendar-src.js +0 -1461
- data/spec/dummy/public/puffer/javascripts/right-calendar.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right-in-edit-src.js +0 -369
- data/spec/dummy/public/puffer/javascripts/right-in-edit.js +0 -13
- data/spec/dummy/public/puffer/javascripts/right-in-edit.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right-lightbox-src.js +0 -905
- data/spec/dummy/public/puffer/javascripts/right-lightbox.js +0 -24
- data/spec/dummy/public/puffer/javascripts/right-lightbox.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right-sortable-src.js +0 -428
- data/spec/dummy/public/puffer/javascripts/right-sortable.js +0 -17
- data/spec/dummy/public/puffer/javascripts/right-sortable.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right-src.js +0 -5892
- data/spec/dummy/public/puffer/javascripts/right-tabs-src.js +0 -1145
- data/spec/dummy/public/puffer/javascripts/right-tabs.js +0 -29
- data/spec/dummy/public/puffer/javascripts/right-tabs.js.gz +0 -0
- data/spec/dummy/public/puffer/javascripts/right.js.gz +0 -0
| Binary file | 
| @@ -1,369 +0,0 @@ | |
| 1 | 
            -
            /**
         | 
| 2 | 
            -
             * Inline editor feature for RightJS
         | 
| 3 | 
            -
             *  http://rightjs.org/ui/in-edit
         | 
| 4 | 
            -
             *
         | 
| 5 | 
            -
             * Copyright (C) 2009-2010 Nikolay Nemshilov
         | 
| 6 | 
            -
             */
         | 
| 7 | 
            -
            var InEdit = RightJS.InEdit = (function(document, RightJS) {
         | 
| 8 | 
            -
            /**
         | 
| 9 | 
            -
             * This module defines the basic widgets constructor
         | 
| 10 | 
            -
             * it creates an abstract proxy with the common functionality
         | 
| 11 | 
            -
             * which then we reuse and override in the actual widgets
         | 
| 12 | 
            -
             *
         | 
| 13 | 
            -
             * Copyright (C) 2010-2011 Nikolay Nemshilov
         | 
| 14 | 
            -
             */
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            /**
         | 
| 17 | 
            -
             * In-Edit plugin initalization
         | 
| 18 | 
            -
             *
         | 
| 19 | 
            -
             * Copyright (C) 2010 Nikolay Nemshilov
         | 
| 20 | 
            -
             */
         | 
| 21 | 
            -
            var R = RightJS,
         | 
| 22 | 
            -
                $ = RightJS.$,
         | 
| 23 | 
            -
                $w = RightJS.$w,
         | 
| 24 | 
            -
                Xhr     = RightJS.Xhr,
         | 
| 25 | 
            -
                Object  = RightJS.Object,
         | 
| 26 | 
            -
                Element = RightJS.Element,
         | 
| 27 | 
            -
                Input   = RightJS.Input;
         | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
            /**
         | 
| 38 | 
            -
             * The widget units constructor
         | 
| 39 | 
            -
             *
         | 
| 40 | 
            -
             * @param String tag-name or Object methods
         | 
| 41 | 
            -
             * @param Object methods
         | 
| 42 | 
            -
             * @return Widget wrapper
         | 
| 43 | 
            -
             */
         | 
| 44 | 
            -
            function Widget(tag_name, methods) {
         | 
| 45 | 
            -
              if (!methods) {
         | 
| 46 | 
            -
                methods = tag_name;
         | 
| 47 | 
            -
                tag_name = 'DIV';
         | 
| 48 | 
            -
              }
         | 
| 49 | 
            -
             | 
| 50 | 
            -
              /**
         | 
| 51 | 
            -
               * An Abstract Widget Unit
         | 
| 52 | 
            -
               *
         | 
| 53 | 
            -
               * Copyright (C) 2010 Nikolay Nemshilov
         | 
| 54 | 
            -
               */
         | 
| 55 | 
            -
              var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
         | 
| 56 | 
            -
                /**
         | 
| 57 | 
            -
                 * The common constructor
         | 
| 58 | 
            -
                 *
         | 
| 59 | 
            -
                 * @param Object options
         | 
| 60 | 
            -
                 * @param String optional tag name
         | 
| 61 | 
            -
                 * @return void
         | 
| 62 | 
            -
                 */
         | 
| 63 | 
            -
                initialize: function(key, options) {
         | 
| 64 | 
            -
                  this.key = key;
         | 
| 65 | 
            -
                  var args = [{'class': 'rui-' + key}];
         | 
| 66 | 
            -
             | 
| 67 | 
            -
                  // those two have different constructors
         | 
| 68 | 
            -
                  if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
         | 
| 69 | 
            -
                    args.unshift(tag_name);
         | 
| 70 | 
            -
                  }
         | 
| 71 | 
            -
                  this.$super.apply(this, args);
         | 
| 72 | 
            -
             | 
| 73 | 
            -
                  if (RightJS.isString(options)) {
         | 
| 74 | 
            -
                    options = RightJS.$(options);
         | 
| 75 | 
            -
                  }
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                  // if the options is another element then
         | 
| 78 | 
            -
                  // try to dynamically rewrap it with our widget
         | 
| 79 | 
            -
                  if (options instanceof RightJS.Element) {
         | 
| 80 | 
            -
                    this._ = options._;
         | 
| 81 | 
            -
                    if ('$listeners' in options) {
         | 
| 82 | 
            -
                      options.$listeners = options.$listeners;
         | 
| 83 | 
            -
                    }
         | 
| 84 | 
            -
                    options = {};
         | 
| 85 | 
            -
                  }
         | 
| 86 | 
            -
                  this.setOptions(options, this);
         | 
| 87 | 
            -
             | 
| 88 | 
            -
                  return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
         | 
| 89 | 
            -
                },
         | 
| 90 | 
            -
             | 
| 91 | 
            -
              // protected
         | 
| 92 | 
            -
             | 
| 93 | 
            -
                /**
         | 
| 94 | 
            -
                 * Catches the options
         | 
| 95 | 
            -
                 *
         | 
| 96 | 
            -
                 * @param Object user-options
         | 
| 97 | 
            -
                 * @param Element element with contextual options
         | 
| 98 | 
            -
                 * @return void
         | 
| 99 | 
            -
                 */
         | 
| 100 | 
            -
                setOptions: function(options, element) {
         | 
| 101 | 
            -
                  element = element || this;
         | 
| 102 | 
            -
                  RightJS.Options.setOptions.call(this,
         | 
| 103 | 
            -
                    RightJS.Object.merge(options, eval("("+(
         | 
| 104 | 
            -
                      element.get('data-'+ this.key) || '{}'
         | 
| 105 | 
            -
                    )+")"))
         | 
| 106 | 
            -
                  );
         | 
| 107 | 
            -
                  return this;
         | 
| 108 | 
            -
                }
         | 
| 109 | 
            -
              });
         | 
| 110 | 
            -
             | 
| 111 | 
            -
              /**
         | 
| 112 | 
            -
               * Creating the actual widget class
         | 
| 113 | 
            -
               *
         | 
| 114 | 
            -
               */
         | 
| 115 | 
            -
              var Klass = new RightJS.Class(AbstractWidget, methods);
         | 
| 116 | 
            -
             | 
| 117 | 
            -
              // creating the widget related shortcuts
         | 
| 118 | 
            -
              RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
         | 
| 119 | 
            -
             | 
| 120 | 
            -
              return Klass;
         | 
| 121 | 
            -
            }
         | 
| 122 | 
            -
             | 
| 123 | 
            -
             | 
| 124 | 
            -
            /**
         | 
| 125 | 
            -
             * A shared module to create textual spinners
         | 
| 126 | 
            -
             *
         | 
| 127 | 
            -
             * Copyright (C) 2010-2011 Nikolay Nemshilov
         | 
| 128 | 
            -
             */
         | 
| 129 | 
            -
            var Spinner = new RightJS.Class(RightJS.Element, {
         | 
| 130 | 
            -
              /**
         | 
| 131 | 
            -
               * Constructor
         | 
| 132 | 
            -
               *
         | 
| 133 | 
            -
               * @param Number optional spinner size (4 by default)
         | 
| 134 | 
            -
               * @return void
         | 
| 135 | 
            -
               */
         | 
| 136 | 
            -
              initialize: function(size) {
         | 
| 137 | 
            -
                this.$super('div', {'class': 'rui-spinner'});
         | 
| 138 | 
            -
                this.dots = [];
         | 
| 139 | 
            -
             | 
| 140 | 
            -
                for (var i=0; i < (size || 4); i++) {
         | 
| 141 | 
            -
                  this.dots.push(new RightJS.Element('div'));
         | 
| 142 | 
            -
                }
         | 
| 143 | 
            -
             | 
| 144 | 
            -
                this.dots[0].addClass('glowing');
         | 
| 145 | 
            -
                this.insert(this.dots);
         | 
| 146 | 
            -
                RightJS(this.shift).bind(this).periodical(300);
         | 
| 147 | 
            -
              },
         | 
| 148 | 
            -
             | 
| 149 | 
            -
              /**
         | 
| 150 | 
            -
               * Shifts the spinner elements
         | 
| 151 | 
            -
               *
         | 
| 152 | 
            -
               * @return void
         | 
| 153 | 
            -
               */
         | 
| 154 | 
            -
              shift: function() {
         | 
| 155 | 
            -
                if (this.visible()) {
         | 
| 156 | 
            -
                  var dot = this.dots.pop();
         | 
| 157 | 
            -
                  this.dots.unshift(dot);
         | 
| 158 | 
            -
                  this.insert(dot, 'top');
         | 
| 159 | 
            -
                }
         | 
| 160 | 
            -
              }
         | 
| 161 | 
            -
            });
         | 
| 162 | 
            -
             | 
| 163 | 
            -
             | 
| 164 | 
            -
            /**
         | 
| 165 | 
            -
             * An inline editor feature
         | 
| 166 | 
            -
             *
         | 
| 167 | 
            -
             * Copyright (C) 2009-2011 Nikolay Nemshilov
         | 
| 168 | 
            -
             */
         | 
| 169 | 
            -
            var InEdit = new Widget('FORM', {
         | 
| 170 | 
            -
              extend: {
         | 
| 171 | 
            -
                version: '2.2.0',
         | 
| 172 | 
            -
             | 
| 173 | 
            -
                EVENTS: $w('show hide send update'),
         | 
| 174 | 
            -
             | 
| 175 | 
            -
                Options: {
         | 
| 176 | 
            -
                  url:    null,    // the url address where to send the stuff
         | 
| 177 | 
            -
                  name:   'text',  // the field name
         | 
| 178 | 
            -
                  method: 'put',   // the method
         | 
| 179 | 
            -
             | 
| 180 | 
            -
                  type:   'text',  // the input type, 'text', 'file', 'password' or 'textarea'
         | 
| 181 | 
            -
             | 
| 182 | 
            -
                  toggle:  null,   // a reference to an element that should get hidden when the editor is active
         | 
| 183 | 
            -
             | 
| 184 | 
            -
                  update:  true,   // a marker if the element should be updated with the response-text
         | 
| 185 | 
            -
             | 
| 186 | 
            -
                  Xhr: {}          // additional Xhr options
         | 
| 187 | 
            -
                },
         | 
| 188 | 
            -
             | 
| 189 | 
            -
                i18n: {
         | 
| 190 | 
            -
                  Save:   'Save',
         | 
| 191 | 
            -
                  Cancel: 'Cancel'
         | 
| 192 | 
            -
                },
         | 
| 193 | 
            -
             | 
| 194 | 
            -
                current: null      // currently opened editor
         | 
| 195 | 
            -
              },
         | 
| 196 | 
            -
             | 
| 197 | 
            -
              /**
         | 
| 198 | 
            -
               * Constructor
         | 
| 199 | 
            -
               *
         | 
| 200 | 
            -
               * @param mixed an element reference
         | 
| 201 | 
            -
               * @param Object options
         | 
| 202 | 
            -
               * @return void
         | 
| 203 | 
            -
               */
         | 
| 204 | 
            -
              initialize: function(element, options) {
         | 
| 205 | 
            -
                this.element = $(element);
         | 
| 206 | 
            -
             | 
| 207 | 
            -
                this
         | 
| 208 | 
            -
                  .$super('in-edit', options)
         | 
| 209 | 
            -
                  .set('action', this.options.url)
         | 
| 210 | 
            -
                  .insert([
         | 
| 211 | 
            -
                    this.field   = new Input({type: this.options.type, name: this.options.name, 'class': 'field'}),
         | 
| 212 | 
            -
                    this.spinner = new Spinner(4),
         | 
| 213 | 
            -
                    this.submit  = new Input({type: 'submit', 'class': 'submit', value: InEdit.i18n.Save}),
         | 
| 214 | 
            -
                    this.cancel  = new Element('a', {'class': 'cancel', href: '#', html: InEdit.i18n.Cancel})
         | 
| 215 | 
            -
                  ])
         | 
| 216 | 
            -
                  .onClick(this.clicked)
         | 
| 217 | 
            -
                  .onSubmit(this.send);
         | 
| 218 | 
            -
              },
         | 
| 219 | 
            -
             | 
| 220 | 
            -
              /**
         | 
| 221 | 
            -
               * Shows the inline-editor form
         | 
| 222 | 
            -
               *
         | 
| 223 | 
            -
               * @return InEdit this
         | 
| 224 | 
            -
               */
         | 
| 225 | 
            -
              show: function() {
         | 
| 226 | 
            -
                if (InEdit.current !== this) {
         | 
| 227 | 
            -
                  if (InEdit.current) { InEdit.current.hide(); }
         | 
| 228 | 
            -
             | 
| 229 | 
            -
                  this.oldContent = this.element.html();
         | 
| 230 | 
            -
             | 
| 231 | 
            -
                  if (!R(['file', 'password']).include(this.options.type)) {
         | 
| 232 | 
            -
                    this.field.setValue(this.oldContent);
         | 
| 233 | 
            -
                  }
         | 
| 234 | 
            -
             | 
| 235 | 
            -
                  this.element.update(this);
         | 
| 236 | 
            -
             | 
| 237 | 
            -
                  this.spinner.hide();
         | 
| 238 | 
            -
                  this.submit.show();
         | 
| 239 | 
            -
             | 
| 240 | 
            -
                  if (this.options.toggle) {
         | 
| 241 | 
            -
                    $(this.options.toggle).hide();
         | 
| 242 | 
            -
                  }
         | 
| 243 | 
            -
                }
         | 
| 244 | 
            -
             | 
| 245 | 
            -
                if (this.options.type !== 'file') {
         | 
| 246 | 
            -
                  this.field.focus();
         | 
| 247 | 
            -
                }
         | 
| 248 | 
            -
             | 
| 249 | 
            -
                InEdit.current = this;
         | 
| 250 | 
            -
                return this.fire('show');
         | 
| 251 | 
            -
              },
         | 
| 252 | 
            -
             | 
| 253 | 
            -
              /**
         | 
| 254 | 
            -
               * Hides the form and brings the content back
         | 
| 255 | 
            -
               *
         | 
| 256 | 
            -
               * @param String optional new content
         | 
| 257 | 
            -
               * @return InEdit this
         | 
| 258 | 
            -
               */
         | 
| 259 | 
            -
              hide: function() {
         | 
| 260 | 
            -
                this.element._.innerHTML = this.oldContent;
         | 
| 261 | 
            -
             | 
| 262 | 
            -
                if (this.xhr) {
         | 
| 263 | 
            -
                  this.xhr.cancel();
         | 
| 264 | 
            -
                }
         | 
| 265 | 
            -
             | 
| 266 | 
            -
                return this.finish();
         | 
| 267 | 
            -
              },
         | 
| 268 | 
            -
             | 
| 269 | 
            -
              /**
         | 
| 270 | 
            -
               * Triggers the form remote submit
         | 
| 271 | 
            -
               *
         | 
| 272 | 
            -
               * @return InEdit this
         | 
| 273 | 
            -
               */
         | 
| 274 | 
            -
              send: function(event) {
         | 
| 275 | 
            -
                if (event) { event.stop(); }
         | 
| 276 | 
            -
             | 
| 277 | 
            -
                this.spinner.show().resize(this.submit.size());
         | 
| 278 | 
            -
                this.submit.hide();
         | 
| 279 | 
            -
             | 
| 280 | 
            -
                this.xhr = new Xhr(this.options.url, Object.merge(this.options.Xhr, {
         | 
| 281 | 
            -
                  method:     this.options.method,
         | 
| 282 | 
            -
                  spinner:    this.spinner,
         | 
| 283 | 
            -
                  onComplete: R(this.receive).bind(this)
         | 
| 284 | 
            -
                })).send(this);
         | 
| 285 | 
            -
             | 
| 286 | 
            -
                return this.fire('send');
         | 
| 287 | 
            -
              },
         | 
| 288 | 
            -
             | 
| 289 | 
            -
            // protected
         | 
| 290 | 
            -
             | 
| 291 | 
            -
              // finishes up with the form
         | 
| 292 | 
            -
              finish: function() {
         | 
| 293 | 
            -
                if (this.options.toggle) {
         | 
| 294 | 
            -
                  $(this.options.toggle).show();
         | 
| 295 | 
            -
                }
         | 
| 296 | 
            -
             | 
| 297 | 
            -
                InEdit.current = null;
         | 
| 298 | 
            -
                return this.fire('hide');
         | 
| 299 | 
            -
              },
         | 
| 300 | 
            -
             | 
| 301 | 
            -
              // the xhr callback
         | 
| 302 | 
            -
              receive: function() {
         | 
| 303 | 
            -
                if (this.options.update) {
         | 
| 304 | 
            -
                  this.element.update(this.xhr.text);
         | 
| 305 | 
            -
                  this.fire('update');
         | 
| 306 | 
            -
                }
         | 
| 307 | 
            -
             | 
| 308 | 
            -
                this.xhr = null;
         | 
| 309 | 
            -
             | 
| 310 | 
            -
                this.finish();
         | 
| 311 | 
            -
              },
         | 
| 312 | 
            -
             | 
| 313 | 
            -
              // catches clicks on the element
         | 
| 314 | 
            -
              clicked: function(event) {
         | 
| 315 | 
            -
                if (event.target === this.cancel) {
         | 
| 316 | 
            -
                  event.stop();
         | 
| 317 | 
            -
                  this.hide();
         | 
| 318 | 
            -
                }
         | 
| 319 | 
            -
              }
         | 
| 320 | 
            -
             | 
| 321 | 
            -
            });
         | 
| 322 | 
            -
             | 
| 323 | 
            -
             | 
| 324 | 
            -
            /**
         | 
| 325 | 
            -
             * The document hooks for in-edit form
         | 
| 326 | 
            -
             *
         | 
| 327 | 
            -
             * Copyright (C) 2010 Nikolay Nemshilov
         | 
| 328 | 
            -
             */
         | 
| 329 | 
            -
            $(document).onKeydown(function(event) {
         | 
| 330 | 
            -
              // processing the `ESC` button
         | 
| 331 | 
            -
              if (event.keyCode === 27 && InEdit.current) {
         | 
| 332 | 
            -
                InEdit.current.hide();
         | 
| 333 | 
            -
              }
         | 
| 334 | 
            -
            });
         | 
| 335 | 
            -
             | 
| 336 | 
            -
             | 
| 337 | 
            -
            /**
         | 
| 338 | 
            -
             * The element level inline editor extension
         | 
| 339 | 
            -
             *
         | 
| 340 | 
            -
             * Copyright (C) 2009-2010 Nikolay Nemshilov
         | 
| 341 | 
            -
             */
         | 
| 342 | 
            -
            Element.include({
         | 
| 343 | 
            -
              /**
         | 
| 344 | 
            -
               * Triggers an inline-editor feature on the element
         | 
| 345 | 
            -
               *
         | 
| 346 | 
            -
               * @param Object options for the InEdit class
         | 
| 347 | 
            -
               * @return InEdit object
         | 
| 348 | 
            -
               */
         | 
| 349 | 
            -
              inEdit: function(options) {
         | 
| 350 | 
            -
                return new InEdit(this, options).show();
         | 
| 351 | 
            -
              }
         | 
| 352 | 
            -
            });
         | 
| 353 | 
            -
            (function() {
         | 
| 354 | 
            -
                    var style = document.createElement('style'),
         | 
| 355 | 
            -
                        rules = document.createTextNode("div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}form.rui-in-edit,form.rui-in-edit .cancel{margin:0;padding:0;float:none;position:static}form.rui-in-edit{display:inline-block; *display:inline; *zoom:1;border:none;background:none}form.rui-in-edit div.rui-spinner{margin-right:.2em}form.rui-in-edit div.rui-spinner div{margin-top:.2em}form.rui-in-edit textarea.field{width:100%;margin-bottom:.5em}form.rui-in-edit .field,form.rui-in-edit .submit{margin-right:.2em}form.rui-in-edit,form.rui-in-edit .field,form.rui-in-edit .submit,form.rui-in-edit div.rui-spinner,form.rui-in-edit .cancel{vertical-align:middle}");
         | 
| 356 | 
            -
             | 
| 357 | 
            -
                    style.type = 'text/css';
         | 
| 358 | 
            -
             | 
| 359 | 
            -
                    if(style.styleSheet) {
         | 
| 360 | 
            -
                      style.styleSheet.cssText = rules.nodeValue;
         | 
| 361 | 
            -
                    } else {
         | 
| 362 | 
            -
                      style.appendChild(rules);
         | 
| 363 | 
            -
                    }
         | 
| 364 | 
            -
             | 
| 365 | 
            -
                    document.getElementsByTagName('head')[0].appendChild(style);
         | 
| 366 | 
            -
                  })();
         | 
| 367 | 
            -
             | 
| 368 | 
            -
            return InEdit;
         | 
| 369 | 
            -
            })(document, RightJS);
         | 
| @@ -1,13 +0,0 @@ | |
| 1 | 
            -
            /**
         | 
| 2 | 
            -
             * Inline editor feature for RightJS
         | 
| 3 | 
            -
             *  http://rightjs.org/ui/in-edit
         | 
| 4 | 
            -
             *
         | 
| 5 | 
            -
             * Copyright (C) 2009-2010 Nikolay Nemshilov
         | 
| 6 | 
            -
             */
         | 
| 7 | 
            -
            var InEdit=RightJS.InEdit=function(g,b){var h=b.$,m=b.$w,n=b.Xhr,o=b.Object,j=b.Element,k=b.Input,p=new b.Class(b.Element,{initialize:function(a){this.$super("div",{"class":"rui-spinner"});this.dots=[];for(var d=0;d<(a||4);d++)this.dots.push(new b.Element("div"));this.dots[0].addClass("glowing");this.insert(this.dots);b(this.shift).bind(this).periodical(300)},shift:function(){if(this.visible()){var a=this.dots.pop();this.dots.unshift(a);this.insert(a,"top")}}}),e=new (function(a,d){if(!d){d=a;a="DIV"}var f=
         | 
| 8 | 
            -
            new b.Class(b.Element.Wrappers[a]||b.Element,{initialize:function(i,c){this.key=i;var l=[{"class":"rui-"+i}];this instanceof b.Input||this instanceof b.Form||l.unshift(a);this.$super.apply(this,l);if(b.isString(c))c=b.$(c);if(c instanceof b.Element){this._=c._;if("$listeners"in c)c.$listeners=c.$listeners;c={}}this.setOptions(c,this);return b.Wrapper.Cache[b.$uid(this._)]=this},setOptions:function(i,c){c=c||this;b.Options.setOptions.call(this,b.Object.merge(i,eval("("+(c.get("data-"+this.key)||"{}")+
         | 
| 9 | 
            -
            ")")));return this}});f=new b.Class(f,d);b.Observer.createShortcuts(f.prototype,f.EVENTS||[]);return f})("FORM",{extend:{version:"2.2.0",EVENTS:m("show hide send update"),Options:{url:null,name:"text",method:"put",type:"text",toggle:null,update:true,Xhr:{}},i18n:{Save:"Save",Cancel:"Cancel"},current:null},initialize:function(a,d){this.element=h(a);this.$super("in-edit",d).set("action",this.options.url).insert([this.field=new k({type:this.options.type,name:this.options.name,"class":"field"}),this.spinner=
         | 
| 10 | 
            -
            new p(4),this.submit=new k({type:"submit","class":"submit",value:e.i18n.Save}),this.cancel=new j("a",{"class":"cancel",href:"#",html:e.i18n.Cancel})]).onClick(this.clicked).onSubmit(this.send)},show:function(){if(e.current!==this){e.current&&e.current.hide();this.oldContent=this.element.html();b(["file","password"]).include(this.options.type)||this.field.setValue(this.oldContent);this.element.update(this);this.spinner.hide();this.submit.show();this.options.toggle&&h(this.options.toggle).hide()}this.options.type!==
         | 
| 11 | 
            -
            "file"&&this.field.focus();e.current=this;return this.fire("show")},hide:function(){this.element._.innerHTML=this.oldContent;this.xhr&&this.xhr.cancel();return this.finish()},send:function(a){a&&a.stop();this.spinner.show().resize(this.submit.size());this.submit.hide();this.xhr=(new n(this.options.url,o.merge(this.options.Xhr,{method:this.options.method,spinner:this.spinner,onComplete:b(this.receive).bind(this)}))).send(this);return this.fire("send")},finish:function(){this.options.toggle&&h(this.options.toggle).show();
         | 
| 12 | 
            -
            e.current=null;return this.fire("hide")},receive:function(){if(this.options.update){this.element.update(this.xhr.text);this.fire("update")}this.xhr=null;this.finish()},clicked:function(a){if(a.target===this.cancel){a.stop();this.hide()}}});h(g).onKeydown(function(a){a.keyCode===27&&e.current&&e.current.hide()});j.include({inEdit:function(a){return(new e(this,a)).show()}});(function(){var a=g.createElement("style"),d=g.createTextNode("div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}form.rui-in-edit,form.rui-in-edit .cancel{margin:0;padding:0;float:none;position:static}form.rui-in-edit{display:inline-block; *display:inline; *zoom:1;border:none;background:none}form.rui-in-edit div.rui-spinner{margin-right:.2em}form.rui-in-edit div.rui-spinner div{margin-top:.2em}form.rui-in-edit textarea.field{width:100%;margin-bottom:.5em}form.rui-in-edit .field,form.rui-in-edit .submit{margin-right:.2em}form.rui-in-edit,form.rui-in-edit .field,form.rui-in-edit .submit,form.rui-in-edit div.rui-spinner,form.rui-in-edit .cancel{vertical-align:middle}");
         | 
| 13 | 
            -
            a.type="text/css";if(a.styleSheet)a.styleSheet.cssText=d.nodeValue;else a.appendChild(d);g.getElementsByTagName("head")[0].appendChild(a)})();return e}(document,RightJS);
         | 
| Binary file | 
| @@ -1,905 +0,0 @@ | |
| 1 | 
            -
            /**
         | 
| 2 | 
            -
             * Lightbox feature for RightJS
         | 
| 3 | 
            -
             * http://rightjs.org/ui/lightbox
         | 
| 4 | 
            -
             *
         | 
| 5 | 
            -
             * Copyright (C) 2009-2010 Nikolay Nemshilov
         | 
| 6 | 
            -
             */
         | 
| 7 | 
            -
            var Lightbox = RightJS.Lightbox = (function(document, RightJS) {
         | 
| 8 | 
            -
            /**
         | 
| 9 | 
            -
             * This module defines the basic widgets constructor
         | 
| 10 | 
            -
             * it creates an abstract proxy with the common functionality
         | 
| 11 | 
            -
             * which then we reuse and override in the actual widgets
         | 
| 12 | 
            -
             *
         | 
| 13 | 
            -
             * Copyright (C) 2010-2011 Nikolay Nemshilov
         | 
| 14 | 
            -
             */
         | 
| 15 | 
            -
             | 
| 16 | 
            -
            /**
         | 
| 17 | 
            -
             * The filenames to include
         | 
| 18 | 
            -
             *
         | 
| 19 | 
            -
             * Copyright (C) 2010-2011 Nikolay Nemshilov
         | 
| 20 | 
            -
             */
         | 
| 21 | 
            -
            var R       = RightJS,
         | 
| 22 | 
            -
                $       = RightJS.$,
         | 
| 23 | 
            -
                $$      = RightJS.$$,
         | 
| 24 | 
            -
                $w      = RightJS.$w,
         | 
| 25 | 
            -
                $E      = RightJS.$E,
         | 
| 26 | 
            -
                $ext    = RightJS.$ext,
         | 
| 27 | 
            -
                Xhr     = RightJS.Xhr,
         | 
| 28 | 
            -
                Class   = RightJS.Class,
         | 
| 29 | 
            -
                Object  = RightJS.Object,
         | 
| 30 | 
            -
                Element = RightJS.Element,
         | 
| 31 | 
            -
                Browser = RightJS.Browser;
         | 
| 32 | 
            -
             | 
| 33 | 
            -
            // IE6 doesn't support position:fixed so it needs a crunch
         | 
| 34 | 
            -
            Browser.IE6 = Browser.OLD && navigator.userAgent.indexOf("MSIE 6") > 0;
         | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
            /**
         | 
| 44 | 
            -
             * The widget units constructor
         | 
| 45 | 
            -
             *
         | 
| 46 | 
            -
             * @param String tag-name or Object methods
         | 
| 47 | 
            -
             * @param Object methods
         | 
| 48 | 
            -
             * @return Widget wrapper
         | 
| 49 | 
            -
             */
         | 
| 50 | 
            -
            function Widget(tag_name, methods) {
         | 
| 51 | 
            -
              if (!methods) {
         | 
| 52 | 
            -
                methods = tag_name;
         | 
| 53 | 
            -
                tag_name = 'DIV';
         | 
| 54 | 
            -
              }
         | 
| 55 | 
            -
             | 
| 56 | 
            -
              /**
         | 
| 57 | 
            -
               * An Abstract Widget Unit
         | 
| 58 | 
            -
               *
         | 
| 59 | 
            -
               * Copyright (C) 2010 Nikolay Nemshilov
         | 
| 60 | 
            -
               */
         | 
| 61 | 
            -
              var AbstractWidget = new RightJS.Class(RightJS.Element.Wrappers[tag_name] || RightJS.Element, {
         | 
| 62 | 
            -
                /**
         | 
| 63 | 
            -
                 * The common constructor
         | 
| 64 | 
            -
                 *
         | 
| 65 | 
            -
                 * @param Object options
         | 
| 66 | 
            -
                 * @param String optional tag name
         | 
| 67 | 
            -
                 * @return void
         | 
| 68 | 
            -
                 */
         | 
| 69 | 
            -
                initialize: function(key, options) {
         | 
| 70 | 
            -
                  this.key = key;
         | 
| 71 | 
            -
                  var args = [{'class': 'rui-' + key}];
         | 
| 72 | 
            -
             | 
| 73 | 
            -
                  // those two have different constructors
         | 
| 74 | 
            -
                  if (!(this instanceof RightJS.Input || this instanceof RightJS.Form)) {
         | 
| 75 | 
            -
                    args.unshift(tag_name);
         | 
| 76 | 
            -
                  }
         | 
| 77 | 
            -
                  this.$super.apply(this, args);
         | 
| 78 | 
            -
             | 
| 79 | 
            -
                  if (RightJS.isString(options)) {
         | 
| 80 | 
            -
                    options = RightJS.$(options);
         | 
| 81 | 
            -
                  }
         | 
| 82 | 
            -
             | 
| 83 | 
            -
                  // if the options is another element then
         | 
| 84 | 
            -
                  // try to dynamically rewrap it with our widget
         | 
| 85 | 
            -
                  if (options instanceof RightJS.Element) {
         | 
| 86 | 
            -
                    this._ = options._;
         | 
| 87 | 
            -
                    if ('$listeners' in options) {
         | 
| 88 | 
            -
                      options.$listeners = options.$listeners;
         | 
| 89 | 
            -
                    }
         | 
| 90 | 
            -
                    options = {};
         | 
| 91 | 
            -
                  }
         | 
| 92 | 
            -
                  this.setOptions(options, this);
         | 
| 93 | 
            -
             | 
| 94 | 
            -
                  return (RightJS.Wrapper.Cache[RightJS.$uid(this._)] = this);
         | 
| 95 | 
            -
                },
         | 
| 96 | 
            -
             | 
| 97 | 
            -
              // protected
         | 
| 98 | 
            -
             | 
| 99 | 
            -
                /**
         | 
| 100 | 
            -
                 * Catches the options
         | 
| 101 | 
            -
                 *
         | 
| 102 | 
            -
                 * @param Object user-options
         | 
| 103 | 
            -
                 * @param Element element with contextual options
         | 
| 104 | 
            -
                 * @return void
         | 
| 105 | 
            -
                 */
         | 
| 106 | 
            -
                setOptions: function(options, element) {
         | 
| 107 | 
            -
                  element = element || this;
         | 
| 108 | 
            -
                  RightJS.Options.setOptions.call(this,
         | 
| 109 | 
            -
                    RightJS.Object.merge(options, eval("("+(
         | 
| 110 | 
            -
                      element.get('data-'+ this.key) || '{}'
         | 
| 111 | 
            -
                    )+")"))
         | 
| 112 | 
            -
                  );
         | 
| 113 | 
            -
                  return this;
         | 
| 114 | 
            -
                }
         | 
| 115 | 
            -
              });
         | 
| 116 | 
            -
             | 
| 117 | 
            -
              /**
         | 
| 118 | 
            -
               * Creating the actual widget class
         | 
| 119 | 
            -
               *
         | 
| 120 | 
            -
               */
         | 
| 121 | 
            -
              var Klass = new RightJS.Class(AbstractWidget, methods);
         | 
| 122 | 
            -
             | 
| 123 | 
            -
              // creating the widget related shortcuts
         | 
| 124 | 
            -
              RightJS.Observer.createShortcuts(Klass.prototype, Klass.EVENTS || []);
         | 
| 125 | 
            -
             | 
| 126 | 
            -
              return Klass;
         | 
| 127 | 
            -
            }
         | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 130 | 
            -
            /**
         | 
| 131 | 
            -
             * A shared module to create textual spinners
         | 
| 132 | 
            -
             *
         | 
| 133 | 
            -
             * Copyright (C) 2010-2011 Nikolay Nemshilov
         | 
| 134 | 
            -
             */
         | 
| 135 | 
            -
            var Spinner = new RightJS.Class(RightJS.Element, {
         | 
| 136 | 
            -
              /**
         | 
| 137 | 
            -
               * Constructor
         | 
| 138 | 
            -
               *
         | 
| 139 | 
            -
               * @param Number optional spinner size (4 by default)
         | 
| 140 | 
            -
               * @return void
         | 
| 141 | 
            -
               */
         | 
| 142 | 
            -
              initialize: function(size) {
         | 
| 143 | 
            -
                this.$super('div', {'class': 'rui-spinner'});
         | 
| 144 | 
            -
                this.dots = [];
         | 
| 145 | 
            -
             | 
| 146 | 
            -
                for (var i=0; i < (size || 4); i++) {
         | 
| 147 | 
            -
                  this.dots.push(new RightJS.Element('div'));
         | 
| 148 | 
            -
                }
         | 
| 149 | 
            -
             | 
| 150 | 
            -
                this.dots[0].addClass('glowing');
         | 
| 151 | 
            -
                this.insert(this.dots);
         | 
| 152 | 
            -
                RightJS(this.shift).bind(this).periodical(300);
         | 
| 153 | 
            -
              },
         | 
| 154 | 
            -
             | 
| 155 | 
            -
              /**
         | 
| 156 | 
            -
               * Shifts the spinner elements
         | 
| 157 | 
            -
               *
         | 
| 158 | 
            -
               * @return void
         | 
| 159 | 
            -
               */
         | 
| 160 | 
            -
              shift: function() {
         | 
| 161 | 
            -
                if (this.visible()) {
         | 
| 162 | 
            -
                  var dot = this.dots.pop();
         | 
| 163 | 
            -
                  this.dots.unshift(dot);
         | 
| 164 | 
            -
                  this.insert(dot, 'top');
         | 
| 165 | 
            -
                }
         | 
| 166 | 
            -
              }
         | 
| 167 | 
            -
            });
         | 
| 168 | 
            -
             | 
| 169 | 
            -
             | 
| 170 | 
            -
            /**
         | 
| 171 | 
            -
             * The lightbox widget
         | 
| 172 | 
            -
             *
         | 
| 173 | 
            -
             * Copyright (C) 2009-2011 Nikolay Nemshilov
         | 
| 174 | 
            -
             */
         | 
| 175 | 
            -
            var Lightbox = new Widget({
         | 
| 176 | 
            -
             | 
| 177 | 
            -
              extend: {
         | 
| 178 | 
            -
                version: '2.2.0',
         | 
| 179 | 
            -
             | 
| 180 | 
            -
                EVENTS: $w('show hide load'),
         | 
| 181 | 
            -
             | 
| 182 | 
            -
                Options: {
         | 
| 183 | 
            -
                  fxName:          'fade',
         | 
| 184 | 
            -
                  fxDuration:      300,
         | 
| 185 | 
            -
             | 
| 186 | 
            -
                  group:           null, // a group marker
         | 
| 187 | 
            -
             | 
| 188 | 
            -
                  hideOnEsc:       true,
         | 
| 189 | 
            -
                  hideOnOutClick:  true,
         | 
| 190 | 
            -
                  showCloseButton: true,
         | 
| 191 | 
            -
             | 
| 192 | 
            -
                  cssRule:         "a[data-lightbox]", // all lightbox links css-rule
         | 
| 193 | 
            -
             | 
| 194 | 
            -
                  // video links default size
         | 
| 195 | 
            -
                  mediaWidth:      425,
         | 
| 196 | 
            -
                  mediaHeight:     350
         | 
| 197 | 
            -
                },
         | 
| 198 | 
            -
             | 
| 199 | 
            -
                i18n: {
         | 
| 200 | 
            -
                  Close: 'Close',
         | 
| 201 | 
            -
                  Prev:  'Previous Image',
         | 
| 202 | 
            -
                  Next:  'Next Image'
         | 
| 203 | 
            -
                },
         | 
| 204 | 
            -
             | 
| 205 | 
            -
                // the supported image-urls regexp
         | 
| 206 | 
            -
                Images: /\.(jpg|jpeg|gif|png|bmp)/,
         | 
| 207 | 
            -
             | 
| 208 | 
            -
                // media content sources
         | 
| 209 | 
            -
                Medias: [
         | 
| 210 | 
            -
                  [/(http:\/\/.*?youtube\.[a-z]+)\/watch\?v=([^&]+)/,       '$1/v/$2',                      'swf'],
         | 
| 211 | 
            -
                  [/(http:\/\/video.google.com)\/videoplay\?docid=([^&]+)/, '$1/googleplayer.swf?docId=$2', 'swf'],
         | 
| 212 | 
            -
                  [/(http:\/\/vimeo\.[a-z]+)\/([0-9]+).*?/,                 '$1/moogaloop.swf?clip_id=$2',  'swf']
         | 
| 213 | 
            -
                ]
         | 
| 214 | 
            -
              },
         | 
| 215 | 
            -
             | 
| 216 | 
            -
              /**
         | 
| 217 | 
            -
               * basic constructor
         | 
| 218 | 
            -
               *
         | 
| 219 | 
            -
               * @param Object options override
         | 
| 220 | 
            -
               * @param Element optional options holder
         | 
| 221 | 
            -
               * @return void
         | 
| 222 | 
            -
               */
         | 
| 223 | 
            -
              initialize: function(options, context) {
         | 
| 224 | 
            -
                this
         | 
| 225 | 
            -
                  .$super('lightbox', {})
         | 
| 226 | 
            -
                  .setOptions(options, context)
         | 
| 227 | 
            -
                  .insert([
         | 
| 228 | 
            -
                    this.locker = new Locker(this.options),
         | 
| 229 | 
            -
                    this.dialog = new Dialog(this.options)
         | 
| 230 | 
            -
                  ])
         | 
| 231 | 
            -
                  .on({
         | 
| 232 | 
            -
                    close: this._close,
         | 
| 233 | 
            -
                    next:  this._next,
         | 
| 234 | 
            -
                    prev:  this._prev
         | 
| 235 | 
            -
                  });
         | 
| 236 | 
            -
              },
         | 
| 237 | 
            -
             | 
| 238 | 
            -
              /**
         | 
| 239 | 
            -
               * Extracting the rel="lightboux[groupname]" attributes
         | 
| 240 | 
            -
               *
         | 
| 241 | 
            -
               * @param Object options
         | 
| 242 | 
            -
               * @param Element link with options
         | 
| 243 | 
            -
               * @return Dialog this
         | 
| 244 | 
            -
               */
         | 
| 245 | 
            -
              setOptions: function(options, context) {
         | 
| 246 | 
            -
                this.$super(options, context);
         | 
| 247 | 
            -
             | 
| 248 | 
            -
                if (context) {
         | 
| 249 | 
            -
                  var rel = context.get('rel');
         | 
| 250 | 
            -
                  if (rel && (rel = rel.match(/lightbox\[(.+?)\]/))) {
         | 
| 251 | 
            -
                    this.options.group = rel[1];
         | 
| 252 | 
            -
                  }
         | 
| 253 | 
            -
                }
         | 
| 254 | 
            -
             | 
| 255 | 
            -
                return this;
         | 
| 256 | 
            -
              },
         | 
| 257 | 
            -
             | 
| 258 | 
            -
              /**
         | 
| 259 | 
            -
               * Sets the popup's title
         | 
| 260 | 
            -
               *
         | 
| 261 | 
            -
               * @param mixed string or element or somethin'
         | 
| 262 | 
            -
               * @return Lighbox self
         | 
| 263 | 
            -
               */
         | 
| 264 | 
            -
              setTitle: function(text) {
         | 
| 265 | 
            -
                this.dialog.setTitle(text);
         | 
| 266 | 
            -
             | 
| 267 | 
            -
                return this;
         | 
| 268 | 
            -
              },
         | 
| 269 | 
            -
             | 
| 270 | 
            -
              /**
         | 
| 271 | 
            -
               * Shows the lightbox
         | 
| 272 | 
            -
               *
         | 
| 273 | 
            -
               * @param String/Array... content
         | 
| 274 | 
            -
               * @return Lightbox this
         | 
| 275 | 
            -
               */
         | 
| 276 | 
            -
              show: function(content) {
         | 
| 277 | 
            -
                return this._showAnd(function() {
         | 
| 278 | 
            -
                  this.dialog.show(content, !content);
         | 
| 279 | 
            -
                });
         | 
| 280 | 
            -
              },
         | 
| 281 | 
            -
             | 
| 282 | 
            -
              /**
         | 
| 283 | 
            -
               * Hides the lightbox
         | 
| 284 | 
            -
               *
         | 
| 285 | 
            -
               * @return Lightbox this
         | 
| 286 | 
            -
               */
         | 
| 287 | 
            -
              hide: function() {
         | 
| 288 | 
            -
                Lightbox.current = null;
         | 
| 289 | 
            -
             | 
| 290 | 
            -
                return this.$super(this.options.fxName, {
         | 
| 291 | 
            -
                  duration: this.options.fxDuration/3,
         | 
| 292 | 
            -
                  onFinish: R(function() {
         | 
| 293 | 
            -
                    this.fire('hide');
         | 
| 294 | 
            -
                    this.remove();
         | 
| 295 | 
            -
                  }).bind(this)
         | 
| 296 | 
            -
                });
         | 
| 297 | 
            -
              },
         | 
| 298 | 
            -
             | 
| 299 | 
            -
              /**
         | 
| 300 | 
            -
               * Loads up the data from url or a link
         | 
| 301 | 
            -
               *
         | 
| 302 | 
            -
               * @param String address or a link element
         | 
| 303 | 
            -
               * @param Object Xhr options
         | 
| 304 | 
            -
               * @return Lightbox this
         | 
| 305 | 
            -
               */
         | 
| 306 | 
            -
              load: function(link, options) {
         | 
| 307 | 
            -
                return this._showAnd(function() {
         | 
| 308 | 
            -
                  this.dialog.load(link, options);
         | 
| 309 | 
            -
                });
         | 
| 310 | 
            -
              },
         | 
| 311 | 
            -
             | 
| 312 | 
            -
              /**
         | 
| 313 | 
            -
               * Resizes the content block to the given size
         | 
| 314 | 
            -
               *
         | 
| 315 | 
            -
               * @param Hash size
         | 
| 316 | 
            -
               * @return Lightbox this
         | 
| 317 | 
            -
               */
         | 
| 318 | 
            -
              resize: function(size) {
         | 
| 319 | 
            -
                this.dialog.resize(size);
         | 
| 320 | 
            -
                return this;
         | 
| 321 | 
            -
              },
         | 
| 322 | 
            -
             | 
| 323 | 
            -
            // protected
         | 
| 324 | 
            -
             | 
| 325 | 
            -
              // handles the 'close' event
         | 
| 326 | 
            -
              _close: function(event) {
         | 
| 327 | 
            -
                event.stop();
         | 
| 328 | 
            -
                this.hide();
         | 
| 329 | 
            -
              },
         | 
| 330 | 
            -
             | 
| 331 | 
            -
              // handles the 'prev' event
         | 
| 332 | 
            -
              _prev: function(event) {
         | 
| 333 | 
            -
                event.stop();
         | 
| 334 | 
            -
                Pager.prev();
         | 
| 335 | 
            -
              },
         | 
| 336 | 
            -
             | 
| 337 | 
            -
              // handles the 'next' event
         | 
| 338 | 
            -
              _next: function(event) {
         | 
| 339 | 
            -
                event.stop();
         | 
| 340 | 
            -
                Pager.next();
         | 
| 341 | 
            -
              },
         | 
| 342 | 
            -
             | 
| 343 | 
            -
              // shows the lightbox element and then calls back
         | 
| 344 | 
            -
              _showAnd: function(callback) {
         | 
| 345 | 
            -
                if (Lightbox.current !== this) {
         | 
| 346 | 
            -
                  Lightbox.current = this;
         | 
| 347 | 
            -
             | 
| 348 | 
            -
                  // hidding all the hanging around lightboxes
         | 
| 349 | 
            -
                  $$('div.rui-lightbox').each('remove');
         | 
| 350 | 
            -
             | 
| 351 | 
            -
                  this.insertTo(document.body);
         | 
| 352 | 
            -
                  this.dialog.show('', true);
         | 
| 353 | 
            -
             | 
| 354 | 
            -
                  if (Browser.OLD) { // IE's get screwed by the transparency tricks
         | 
| 355 | 
            -
                    this.reposition();
         | 
| 356 | 
            -
                    Element.prototype.show.call(this);
         | 
| 357 | 
            -
                    callback.call(this);
         | 
| 358 | 
            -
                  } else {
         | 
| 359 | 
            -
                    this.setStyle('display:none');
         | 
| 360 | 
            -
                    Element.prototype.show.call(this, this.options.fxName, {
         | 
| 361 | 
            -
                      duration: this.options.fxDuration/2,
         | 
| 362 | 
            -
                      onFinish: R(function() {
         | 
| 363 | 
            -
                        callback.call(this);
         | 
| 364 | 
            -
                        this.fire('show');
         | 
| 365 | 
            -
                      }).bind(this)
         | 
| 366 | 
            -
                    });
         | 
| 367 | 
            -
                  }
         | 
| 368 | 
            -
                } else {
         | 
| 369 | 
            -
                  callback.call(this);
         | 
| 370 | 
            -
                }
         | 
| 371 | 
            -
             | 
| 372 | 
            -
                return this;
         | 
| 373 | 
            -
              },
         | 
| 374 | 
            -
             | 
| 375 | 
            -
              // manually repositioning under IE6 browser
         | 
| 376 | 
            -
              reposition: function() {
         | 
| 377 | 
            -
                if (Browser.IE6) {
         | 
| 378 | 
            -
                  var win = $(window);
         | 
| 379 | 
            -
             | 
| 380 | 
            -
                  this.setStyle({
         | 
| 381 | 
            -
                    top:      win.scrolls().y + 'px',
         | 
| 382 | 
            -
                    width:    win.size().x    + 'px',
         | 
| 383 | 
            -
                    height:   win.size().y    + 'px',
         | 
| 384 | 
            -
                    position: "absolute"
         | 
| 385 | 
            -
                  });
         | 
| 386 | 
            -
                }
         | 
| 387 | 
            -
              }
         | 
| 388 | 
            -
            });
         | 
| 389 | 
            -
             | 
| 390 | 
            -
             | 
| 391 | 
            -
            /**
         | 
| 392 | 
            -
             * The class level interface
         | 
| 393 | 
            -
             *
         | 
| 394 | 
            -
             * @copyright (C) 2009 Nikolay Nemshilov
         | 
| 395 | 
            -
             */
         | 
| 396 | 
            -
            Lightbox.extend({
         | 
| 397 | 
            -
              hide: function() {
         | 
| 398 | 
            -
                if (Lightbox.current) {
         | 
| 399 | 
            -
                  Lightbox.current.hide();
         | 
| 400 | 
            -
                }
         | 
| 401 | 
            -
              },
         | 
| 402 | 
            -
             | 
| 403 | 
            -
              show: function() {
         | 
| 404 | 
            -
                return this.inst('show', arguments);
         | 
| 405 | 
            -
              },
         | 
| 406 | 
            -
             | 
| 407 | 
            -
              load: function() {
         | 
| 408 | 
            -
                return this.inst('load', arguments);
         | 
| 409 | 
            -
              },
         | 
| 410 | 
            -
             | 
| 411 | 
            -
            // private
         | 
| 412 | 
            -
             | 
| 413 | 
            -
              inst: function(name, args) {
         | 
| 414 | 
            -
                var inst = new Lightbox();
         | 
| 415 | 
            -
                return inst[name].apply(inst, args);
         | 
| 416 | 
            -
              }
         | 
| 417 | 
            -
            });
         | 
| 418 | 
            -
             | 
| 419 | 
            -
             | 
| 420 | 
            -
            /**
         | 
| 421 | 
            -
             * Lightbox background locker element
         | 
| 422 | 
            -
             *
         | 
| 423 | 
            -
             * Copyright (C) 2010-2011 Nikolay Nemshilov
         | 
| 424 | 
            -
             */
         | 
| 425 | 
            -
            var Locker = new Class(Element, {
         | 
| 426 | 
            -
              initialize: function(options) {
         | 
| 427 | 
            -
                this.$super('div', {'class': 'rui-lightbox-locker'});
         | 
| 428 | 
            -
             | 
| 429 | 
            -
                if (options.hideOnOutClick) {
         | 
| 430 | 
            -
                  this.onClick('fire', 'close');
         | 
| 431 | 
            -
                }
         | 
| 432 | 
            -
              }
         | 
| 433 | 
            -
            });
         | 
| 434 | 
            -
             | 
| 435 | 
            -
             | 
| 436 | 
            -
            /**
         | 
| 437 | 
            -
             * The dialog element wrapper
         | 
| 438 | 
            -
             *
         | 
| 439 | 
            -
             * Copyright (C) 2010-2011 Nikolay Nemshilov
         | 
| 440 | 
            -
             */
         | 
| 441 | 
            -
            var Dialog = new Class(Element, {
         | 
| 442 | 
            -
              /**
         | 
| 443 | 
            -
               * Constructor
         | 
| 444 | 
            -
               *
         | 
| 445 | 
            -
               * @param Object options
         | 
| 446 | 
            -
               * @return void
         | 
| 447 | 
            -
               */
         | 
| 448 | 
            -
              initialize: function(options) {
         | 
| 449 | 
            -
                var i18n = Lightbox.i18n;
         | 
| 450 | 
            -
             | 
| 451 | 
            -
                this.options = options;
         | 
| 452 | 
            -
                this.$super('div', {'class': 'rui-lightbox-dialog'});
         | 
| 453 | 
            -
             | 
| 454 | 
            -
                // building up the
         | 
| 455 | 
            -
                this.insert([
         | 
| 456 | 
            -
                  this.title = $E('div', {'class': 'rui-lightbox-title'}),
         | 
| 457 | 
            -
             | 
| 458 | 
            -
                  $E('div', {'class': 'rui-lightbox-body'}).insert(
         | 
| 459 | 
            -
                    $E('div', {'class': 'rui-lightbox-body-inner'}).insert([
         | 
| 460 | 
            -
                      this.locker    = $E('div', {'class': 'rui-lightbox-body-locker'}).insert(new Spinner(4)),
         | 
| 461 | 
            -
                      this.scroller  = $E('div', {'class': 'rui-lightbox-scroller'}).insert(
         | 
| 462 | 
            -
                        this.content = $E('div', {'class': 'rui-lightbox-content'})
         | 
| 463 | 
            -
                      )
         | 
| 464 | 
            -
                    ])
         | 
| 465 | 
            -
                  ),
         | 
| 466 | 
            -
             | 
| 467 | 
            -
                  $E('div', {'class': 'rui-lightbox-navigation'}).insert([
         | 
| 468 | 
            -
                    this.closeButton = $E('div', {'class': 'close', html: '×', title: i18n.Close}).onClick('fire', 'close'),
         | 
| 469 | 
            -
                    this.prevLink    = $E('div', {'class': 'prev',  html: '←',  title: i18n.Prev}).onClick('fire',  'prev'),
         | 
| 470 | 
            -
                    this.nextLink    = $E('div', {'class': 'next',  html: '→',  title: i18n.Next}).onClick('fire',  'next')
         | 
| 471 | 
            -
                  ])
         | 
| 472 | 
            -
                ]);
         | 
| 473 | 
            -
             | 
| 474 | 
            -
                // presetting the navigation state
         | 
| 475 | 
            -
                this.prevLink.hide();
         | 
| 476 | 
            -
                this.nextLink.hide();
         | 
| 477 | 
            -
             | 
| 478 | 
            -
                if (!options.showCloseButton) {
         | 
| 479 | 
            -
                  this.closeButton.hide();
         | 
| 480 | 
            -
                }
         | 
| 481 | 
            -
              },
         | 
| 482 | 
            -
             | 
| 483 | 
            -
              /**
         | 
| 484 | 
            -
               * Sets the dialogue caption
         | 
| 485 | 
            -
               *
         | 
| 486 | 
            -
               * @param String title
         | 
| 487 | 
            -
               * @return Dialog this
         | 
| 488 | 
            -
               */
         | 
| 489 | 
            -
              setTitle: function(title) {
         | 
| 490 | 
            -
                this.title.update(title||'');
         | 
| 491 | 
            -
              },
         | 
| 492 | 
            -
             | 
| 493 | 
            -
              /**
         | 
| 494 | 
            -
               * Nicely resize the dialog box
         | 
| 495 | 
            -
               *
         | 
| 496 | 
            -
               * @param Object the end size
         | 
| 497 | 
            -
               * @param Boolean use fx (false by default)
         | 
| 498 | 
            -
               * @return Dialog this
         | 
| 499 | 
            -
               */
         | 
| 500 | 
            -
              resize: function(end_size, with_fx) {
         | 
| 501 | 
            -
                var win_size = this.parent().size(),
         | 
| 502 | 
            -
                    cur_size = this.scroller.size(),
         | 
| 503 | 
            -
                    cur_top  = (win_size.y - this.size().y)/2,
         | 
| 504 | 
            -
                    dlg_diff = this.size().x - cur_size.x; // <- use for IE6 fixes
         | 
| 505 | 
            -
             | 
| 506 | 
            -
                if (end_size) {
         | 
| 507 | 
            -
                  // getting the actual end-size
         | 
| 508 | 
            -
                  end_size = this.scroller.setStyle(end_size).size();
         | 
| 509 | 
            -
             | 
| 510 | 
            -
                  this.scroller.setStyle({
         | 
| 511 | 
            -
                    width:  cur_size.x + 'px',
         | 
| 512 | 
            -
                    height: cur_size.y + 'px'
         | 
| 513 | 
            -
                  });
         | 
| 514 | 
            -
                } else {
         | 
| 515 | 
            -
                  // using the content block size
         | 
| 516 | 
            -
                  end_size = this.content.size();
         | 
| 517 | 
            -
                }
         | 
| 518 | 
            -
             | 
| 519 | 
            -
                // checking the constraints
         | 
| 520 | 
            -
                var threshold = 100; // px
         | 
| 521 | 
            -
                if ((end_size.x + threshold) > win_size.x) { end_size.x = win_size.x - threshold; }
         | 
| 522 | 
            -
                if ((end_size.y + threshold) > win_size.y) { end_size.y = win_size.y - threshold; }
         | 
| 523 | 
            -
             | 
| 524 | 
            -
                // the actual resize and reposition
         | 
| 525 | 
            -
                var end_top = (cur_top * 2 + cur_size.y - end_size.y) / 2;
         | 
| 526 | 
            -
                var dialog  = this._.style, content = this.scroller._.style;
         | 
| 527 | 
            -
             | 
| 528 | 
            -
                if (RightJS.Fx && with_fx && (end_size.x != cur_size.x || end_size.y != cur_size.y)) {
         | 
| 529 | 
            -
             | 
| 530 | 
            -
                  $ext(new RightJS.Fx(this, {duration: this.options.fxDuration}), {
         | 
| 531 | 
            -
                    render: function(delta) {
         | 
| 532 | 
            -
                      content.width  = (cur_size.x + (end_size.x - cur_size.x) * delta) + 'px';
         | 
| 533 | 
            -
                      content.height = (cur_size.y + (end_size.y - cur_size.y) * delta) + 'px';
         | 
| 534 | 
            -
                      dialog.top     = (cur_top    + (end_top    - cur_top)    * delta) + 'px';
         | 
| 535 | 
            -
             | 
| 536 | 
            -
                      if (Browser.IE6) {
         | 
| 537 | 
            -
                        dialog.width  = (dlg_diff + cur_size.y + (end_size.y - cur_size.y) * delta) + 'px';
         | 
| 538 | 
            -
                      }
         | 
| 539 | 
            -
                    }
         | 
| 540 | 
            -
                  }).onFinish(R(this.unlock).bind(this)).start();
         | 
| 541 | 
            -
             | 
| 542 | 
            -
                } else {
         | 
| 543 | 
            -
                  // no-fx direct assignment
         | 
| 544 | 
            -
                  content.width  = end_size.x + 'px';
         | 
| 545 | 
            -
                  content.height = end_size.y + 'px';
         | 
| 546 | 
            -
                  dialog.top     = end_top    + 'px';
         | 
| 547 | 
            -
             | 
| 548 | 
            -
                  if (Browser.IE6) {
         | 
| 549 | 
            -
                    dialog.width = (dlg_diff + end_size.x) + 'px';
         | 
| 550 | 
            -
                  }
         | 
| 551 | 
            -
             | 
| 552 | 
            -
                  if (!this.request) { this.unlock(); }
         | 
| 553 | 
            -
                }
         | 
| 554 | 
            -
             | 
| 555 | 
            -
                return this;
         | 
| 556 | 
            -
              },
         | 
| 557 | 
            -
             | 
| 558 | 
            -
              /**
         | 
| 559 | 
            -
               * Shows the content
         | 
| 560 | 
            -
               *
         | 
| 561 | 
            -
               * @param mixed content String/Element/Array and so one
         | 
| 562 | 
            -
               * @return Dialog this
         | 
| 563 | 
            -
               */
         | 
| 564 | 
            -
              show: function(content, no_fx) {
         | 
| 565 | 
            -
                this.content.update(content || '');
         | 
| 566 | 
            -
                this.resize(null, !no_fx);
         | 
| 567 | 
            -
              },
         | 
| 568 | 
            -
             | 
| 569 | 
            -
              /**
         | 
| 570 | 
            -
               * Loads up the data from the link
         | 
| 571 | 
            -
               *
         | 
| 572 | 
            -
               * @param mixed String url address or a link element
         | 
| 573 | 
            -
               * @param Object xhr-options
         | 
| 574 | 
            -
               * @return void
         | 
| 575 | 
            -
               */
         | 
| 576 | 
            -
              load: function(url, options) {
         | 
| 577 | 
            -
                if (url instanceof Element) {
         | 
| 578 | 
            -
                  this.setTitle(url.get('title'));
         | 
| 579 | 
            -
                  url = url.get('href');
         | 
| 580 | 
            -
                }
         | 
| 581 | 
            -
             | 
| 582 | 
            -
                Pager.show(this, url);
         | 
| 583 | 
            -
                this.lock().cancel();
         | 
| 584 | 
            -
             | 
| 585 | 
            -
                // defined in the loader.js file
         | 
| 586 | 
            -
                this.request = new Loader(url, options, R(function(content, no_fx) {
         | 
| 587 | 
            -
                  this.request = null;
         | 
| 588 | 
            -
                  this.show(content, no_fx);
         | 
| 589 | 
            -
                }).bind(this));
         | 
| 590 | 
            -
             | 
| 591 | 
            -
                return this.resize(); // the look might be changed for a media-type
         | 
| 592 | 
            -
              },
         | 
| 593 | 
            -
             | 
| 594 | 
            -
              /**
         | 
| 595 | 
            -
               * Cancels a currently loading request
         | 
| 596 | 
            -
               *
         | 
| 597 | 
            -
               * @return Dialog this
         | 
| 598 | 
            -
               */
         | 
| 599 | 
            -
              cancel: function() {
         | 
| 600 | 
            -
                if (this.request) {
         | 
| 601 | 
            -
                  this.request.cancel();
         | 
| 602 | 
            -
                }
         | 
| 603 | 
            -
             | 
| 604 | 
            -
                return this;
         | 
| 605 | 
            -
              },
         | 
| 606 | 
            -
             | 
| 607 | 
            -
              /**
         | 
| 608 | 
            -
               * Shows the loading lock
         | 
| 609 | 
            -
               *
         | 
| 610 | 
            -
               * @return Dialog this
         | 
| 611 | 
            -
               */
         | 
| 612 | 
            -
              lock: function() {
         | 
| 613 | 
            -
                this.locker.setStyle('opacity:1;display:block').insertTo(this.scroller, 'before');
         | 
| 614 | 
            -
                return this;
         | 
| 615 | 
            -
              },
         | 
| 616 | 
            -
             | 
| 617 | 
            -
              /**
         | 
| 618 | 
            -
               * Hides the loading lock
         | 
| 619 | 
            -
               *
         | 
| 620 | 
            -
               * @return Dialog this
         | 
| 621 | 
            -
               */
         | 
| 622 | 
            -
              unlock: function() {
         | 
| 623 | 
            -
                this.locker.remove(R(this.content.html()).blank() ? null : 'fade', {
         | 
| 624 | 
            -
                  duration: this.options.fxDuration * 2/3
         | 
| 625 | 
            -
                });
         | 
| 626 | 
            -
             | 
| 627 | 
            -
                return this;
         | 
| 628 | 
            -
              }
         | 
| 629 | 
            -
            });
         | 
| 630 | 
            -
             | 
| 631 | 
            -
             | 
| 632 | 
            -
            /**
         | 
| 633 | 
            -
             * Xhr/images/medias loading module
         | 
| 634 | 
            -
             *
         | 
| 635 | 
            -
             * Copyright (C) 2009-2010 Nikolay Nemshilov
         | 
| 636 | 
            -
             */
         | 
| 637 | 
            -
            var Loader = new Class({
         | 
| 638 | 
            -
              /**
         | 
| 639 | 
            -
               * Constructor
         | 
| 640 | 
            -
               *
         | 
| 641 | 
            -
               * @param String url address
         | 
| 642 | 
            -
               * @param Object Xhr options
         | 
| 643 | 
            -
               * @param Function on-finish callback
         | 
| 644 | 
            -
               */
         | 
| 645 | 
            -
              initialize: function(url, options, on_finish) {
         | 
| 646 | 
            -
                // adjusting the dialog look for different media-types
         | 
| 647 | 
            -
                if (this.isImage(url, on_finish)) {
         | 
| 648 | 
            -
                  Lightbox.current.addClass('rui-lightbox-image');
         | 
| 649 | 
            -
                } else if (this.isMedia(url, on_finish)) {
         | 
| 650 | 
            -
                  Lightbox.current.addClass('rui-lightbox-media');
         | 
| 651 | 
            -
                } else {
         | 
| 652 | 
            -
                  this.xhr = new Xhr(url,
         | 
| 653 | 
            -
                    Object.merge({method: 'get'}, options)
         | 
| 654 | 
            -
                  ).onComplete(function() {
         | 
| 655 | 
            -
                    on_finish(this.text);
         | 
| 656 | 
            -
                  }).send();
         | 
| 657 | 
            -
                }
         | 
| 658 | 
            -
              },
         | 
| 659 | 
            -
             | 
| 660 | 
            -
              /**
         | 
| 661 | 
            -
               * Cancels the request
         | 
| 662 | 
            -
               *
         | 
| 663 | 
            -
               * @return Loader this
         | 
| 664 | 
            -
               */
         | 
| 665 | 
            -
              cancel: function() {
         | 
| 666 | 
            -
                if (this.xhr) {
         | 
| 667 | 
            -
                  this.xhr.cancel();
         | 
| 668 | 
            -
                } else if (this.img) {
         | 
| 669 | 
            -
                  this.img.onload = function() {};
         | 
| 670 | 
            -
                }
         | 
| 671 | 
            -
              },
         | 
| 672 | 
            -
             | 
| 673 | 
            -
            // protected
         | 
| 674 | 
            -
             | 
| 675 | 
            -
              // tries to initialize it as an image loading
         | 
| 676 | 
            -
              isImage: function(url, on_finish) {
         | 
| 677 | 
            -
                if (url.match(Lightbox.Images)) {
         | 
| 678 | 
            -
                  var img = this.img = $E('img')._;
         | 
| 679 | 
            -
                  img.onload = function() {
         | 
| 680 | 
            -
                    on_finish(img);
         | 
| 681 | 
            -
                  };
         | 
| 682 | 
            -
                  img.src = url;
         | 
| 683 | 
            -
                  return true;
         | 
| 684 | 
            -
                }
         | 
| 685 | 
            -
              },
         | 
| 686 | 
            -
             | 
| 687 | 
            -
              // tries to initialize it as a flash-element
         | 
| 688 | 
            -
              isMedia: function(url, on_finish) {
         | 
| 689 | 
            -
                var media = R(Lightbox.Medias).map(function(desc) {
         | 
| 690 | 
            -
                  return url.match(desc[0]) ? this.buildEmbed(
         | 
| 691 | 
            -
                    url.replace(desc[0], desc[1]), desc[2]) : null;
         | 
| 692 | 
            -
                }, this).compact()[0];
         | 
| 693 | 
            -
             | 
| 694 | 
            -
                if (media) {
         | 
| 695 | 
            -
                  on_finish(media, true);
         | 
| 696 | 
            -
                  return true;
         | 
| 697 | 
            -
                }
         | 
| 698 | 
            -
              },
         | 
| 699 | 
            -
             | 
| 700 | 
            -
              // builds an embedded media block
         | 
| 701 | 
            -
              buildEmbed: function(url, type) {
         | 
| 702 | 
            -
                var media_types = {
         | 
| 703 | 
            -
                  swf: [
         | 
| 704 | 
            -
                    'D27CDB6E-AE6D-11cf-96B8-444553540000',
         | 
| 705 | 
            -
                    'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
         | 
| 706 | 
            -
                    'application/x-shockwave-flash'
         | 
| 707 | 
            -
                  ]
         | 
| 708 | 
            -
                },
         | 
| 709 | 
            -
                options = Lightbox.current ? Lightbox.current.options : Lightbox.Options,
         | 
| 710 | 
            -
                sizes = ' width="'+ options.mediaWidth + '" height="'+ options.mediaHeight + '"';
         | 
| 711 | 
            -
             | 
| 712 | 
            -
                return '<object classid="clsid:' + media_types[type][0] +
         | 
| 713 | 
            -
                  '" codebase="' + media_types[type][1] + '"'+ sizes + '>' +
         | 
| 714 | 
            -
                  '<param name="src" value="'+ url +'" />'+
         | 
| 715 | 
            -
                  '<embed src="'+ url +'" type="'+ media_types[type][2]+'"'+ sizes + ' />' +
         | 
| 716 | 
            -
                '</object>';
         | 
| 717 | 
            -
              }
         | 
| 718 | 
            -
             | 
| 719 | 
            -
            });
         | 
| 720 | 
            -
             | 
| 721 | 
            -
             | 
| 722 | 
            -
            /**
         | 
| 723 | 
            -
             * Processes the link-groups showing things in a single Lightbox
         | 
| 724 | 
            -
             *
         | 
| 725 | 
            -
             * Copyright (C) 2010 Nikolay Nemshilov
         | 
| 726 | 
            -
             */
         | 
| 727 | 
            -
            var Pager = {
         | 
| 728 | 
            -
              /**
         | 
| 729 | 
            -
               * Checks and shows the pager links on the dialog
         | 
| 730 | 
            -
               *
         | 
| 731 | 
            -
               * @param Dialog dialog
         | 
| 732 | 
            -
               * @param String url-address
         | 
| 733 | 
            -
               * @return void
         | 
| 734 | 
            -
               */
         | 
| 735 | 
            -
              show: function(dialog, url) {
         | 
| 736 | 
            -
                if (dialog.options.group) {
         | 
| 737 | 
            -
                  this.dialog = dialog;
         | 
| 738 | 
            -
                  this.links  = this.find(dialog.options.group);
         | 
| 739 | 
            -
                  this.link   = this.links.first(function(link) {
         | 
| 740 | 
            -
                    return link.get('href') === url;
         | 
| 741 | 
            -
                  });
         | 
| 742 | 
            -
             | 
| 743 | 
            -
                  var index = this.links.indexOf(this.link), size = this.links.length;
         | 
| 744 | 
            -
             | 
| 745 | 
            -
                  dialog.prevLink[size && index > 0 ? 'show' : 'hide']();
         | 
| 746 | 
            -
                  dialog.nextLink[size && index < size - 1 ? 'show' : 'hide']();
         | 
| 747 | 
            -
                } else {
         | 
| 748 | 
            -
                  this.dialog = null;
         | 
| 749 | 
            -
                }
         | 
| 750 | 
            -
              },
         | 
| 751 | 
            -
             | 
| 752 | 
            -
              /**
         | 
| 753 | 
            -
               * Shows the prev link
         | 
| 754 | 
            -
               *
         | 
| 755 | 
            -
               * @return void
         | 
| 756 | 
            -
               */
         | 
| 757 | 
            -
              prev: function() {
         | 
| 758 | 
            -
                if (this.dialog && !this.timer) {
         | 
| 759 | 
            -
                  var id   = this.links.indexOf(this.link),
         | 
| 760 | 
            -
                      link = this.links[id - 1];
         | 
| 761 | 
            -
             | 
| 762 | 
            -
                  if (link) {
         | 
| 763 | 
            -
                    this.dialog.load(link);
         | 
| 764 | 
            -
                    this.timeout();
         | 
| 765 | 
            -
                  }
         | 
| 766 | 
            -
                }
         | 
| 767 | 
            -
              },
         | 
| 768 | 
            -
             | 
| 769 | 
            -
              /**
         | 
| 770 | 
            -
               * Shows the next link
         | 
| 771 | 
            -
               *
         | 
| 772 | 
            -
               * @return void
         | 
| 773 | 
            -
               */
         | 
| 774 | 
            -
              next: function() {
         | 
| 775 | 
            -
                if (this.dialog && !this.timer) {
         | 
| 776 | 
            -
                  var id   = this.links.indexOf(this.link),
         | 
| 777 | 
            -
                      link = this.links[id + 1];
         | 
| 778 | 
            -
             | 
| 779 | 
            -
                  if (link) {
         | 
| 780 | 
            -
                    this.dialog.load(link);
         | 
| 781 | 
            -
                    this.timeout();
         | 
| 782 | 
            -
                  }
         | 
| 783 | 
            -
                }
         | 
| 784 | 
            -
              },
         | 
| 785 | 
            -
             | 
| 786 | 
            -
            // private
         | 
| 787 | 
            -
             | 
| 788 | 
            -
              // finding the links list
         | 
| 789 | 
            -
              find: function(group) {
         | 
| 790 | 
            -
                return $$('a').filter(function(link) {
         | 
| 791 | 
            -
                  var data = link.get('data-lightbox');
         | 
| 792 | 
            -
                  var rel  = link.get('rel');
         | 
| 793 | 
            -
             | 
| 794 | 
            -
                  return (data && eval("("+ data + ")").group === group) ||
         | 
| 795 | 
            -
                    (rel && rel.indexOf('lightbox['+ group + ']') > -1);
         | 
| 796 | 
            -
                });
         | 
| 797 | 
            -
              },
         | 
| 798 | 
            -
             | 
| 799 | 
            -
              // having a little nap to prevent ugly quick scrolling
         | 
| 800 | 
            -
              timeout: function() {
         | 
| 801 | 
            -
                this.timer = R(function() {
         | 
| 802 | 
            -
                  Pager.timer = null;
         | 
| 803 | 
            -
                }).delay(300);
         | 
| 804 | 
            -
              }
         | 
| 805 | 
            -
            };
         | 
| 806 | 
            -
             | 
| 807 | 
            -
             | 
| 808 | 
            -
            /**
         | 
| 809 | 
            -
             * document level hooks
         | 
| 810 | 
            -
             *
         | 
| 811 | 
            -
             * Copyright (C) 2009-2010 Nikolay Nemshilov
         | 
| 812 | 
            -
             */
         | 
| 813 | 
            -
             | 
| 814 | 
            -
            $(document).on({
         | 
| 815 | 
            -
              /**
         | 
| 816 | 
            -
               * Catches clicks on the target links
         | 
| 817 | 
            -
               *
         | 
| 818 | 
            -
               * @param Event click
         | 
| 819 | 
            -
               * @return void
         | 
| 820 | 
            -
               */
         | 
| 821 | 
            -
              click: function(event) {
         | 
| 822 | 
            -
                var target = event.find(Lightbox.Options.cssRule) || event.find('a[rel^=lightbox]');
         | 
| 823 | 
            -
             | 
| 824 | 
            -
                if (target) {
         | 
| 825 | 
            -
                  event.stop();
         | 
| 826 | 
            -
                  new Lightbox({}, target).load(target);
         | 
| 827 | 
            -
                }
         | 
| 828 | 
            -
              },
         | 
| 829 | 
            -
             | 
| 830 | 
            -
              /**
         | 
| 831 | 
            -
               * Catches the mousewheel event and tries to scroll
         | 
| 832 | 
            -
               * the list of objects on the lightbox
         | 
| 833 | 
            -
               *
         | 
| 834 | 
            -
               * @param Event mousewheel
         | 
| 835 | 
            -
               * @return void
         | 
| 836 | 
            -
               */
         | 
| 837 | 
            -
              mousewheel: function(event) {
         | 
| 838 | 
            -
                if (Lightbox.current) {
         | 
| 839 | 
            -
                  var target = event.target, box = target.parent('div.rui-lightbox-content');
         | 
| 840 | 
            -
             | 
| 841 | 
            -
                  if (!box || target.getStyle('overflow') === 'visible') {
         | 
| 842 | 
            -
                    event.stop();
         | 
| 843 | 
            -
                  }
         | 
| 844 | 
            -
             | 
| 845 | 
            -
                  Lightbox.current.fire((event._.detail || -event._.wheelDelta) < 0 ? 'prev' : 'next');
         | 
| 846 | 
            -
                }
         | 
| 847 | 
            -
              },
         | 
| 848 | 
            -
             | 
| 849 | 
            -
              /**
         | 
| 850 | 
            -
               * Handles the navigation form a keyboard
         | 
| 851 | 
            -
               *
         | 
| 852 | 
            -
               * @param Event keydown
         | 
| 853 | 
            -
               * @return void
         | 
| 854 | 
            -
               */
         | 
| 855 | 
            -
              keydown: function(event) {
         | 
| 856 | 
            -
                var lightbox = Lightbox.current, name = ({
         | 
| 857 | 
            -
                  27: 'close', // Esc
         | 
| 858 | 
            -
                  33: 'prev',  // PageUp
         | 
| 859 | 
            -
                  37: 'prev',  // Left
         | 
| 860 | 
            -
                  38: 'prev',  // Up
         | 
| 861 | 
            -
                  39: 'next',  // Right
         | 
| 862 | 
            -
                  40: 'next',  // Down
         | 
| 863 | 
            -
                  34: 'next'   // PageDown
         | 
| 864 | 
            -
                })[event.keyCode];
         | 
| 865 | 
            -
             | 
| 866 | 
            -
                if (lightbox && name) {
         | 
| 867 | 
            -
                  if (name !== 'close' || lightbox.options.hideOnEsc) {
         | 
| 868 | 
            -
                    event.stop();
         | 
| 869 | 
            -
                    lightbox.fire(name);
         | 
| 870 | 
            -
                  }
         | 
| 871 | 
            -
                }
         | 
| 872 | 
            -
              }
         | 
| 873 | 
            -
            });
         | 
| 874 | 
            -
             | 
| 875 | 
            -
            $(window).on({
         | 
| 876 | 
            -
              resize: function() {
         | 
| 877 | 
            -
                if (Lightbox.current) {
         | 
| 878 | 
            -
                  Lightbox.current.reposition();
         | 
| 879 | 
            -
                  Lightbox.current.dialog.resize();
         | 
| 880 | 
            -
                }
         | 
| 881 | 
            -
              },
         | 
| 882 | 
            -
             | 
| 883 | 
            -
              scroll: function(event) {
         | 
| 884 | 
            -
                if (Lightbox.current && Browser.IE6) {
         | 
| 885 | 
            -
                  Lightbox.current.reposition();
         | 
| 886 | 
            -
                }
         | 
| 887 | 
            -
              }
         | 
| 888 | 
            -
            });
         | 
| 889 | 
            -
            (function() {
         | 
| 890 | 
            -
                    var style = document.createElement('style'),
         | 
| 891 | 
            -
                        rules = document.createTextNode("div.rui-spinner,div.rui-spinner div{margin:0;padding:0;border:none;background:none;list-style:none;font-weight:normal;float:none;display:inline-block; *display:inline; *zoom:1;border-radius:.12em;-moz-border-radius:.12em;-webkit-border-radius:.12em}div.rui-spinner{text-align:center;white-space:nowrap;background:#EEE;border:1px solid #DDD;height:1.2em;padding:0 .2em}div.rui-spinner div{width:.4em;height:70%;background:#BBB;margin-left:1px}div.rui-spinner div:first-child{margin-left:0}div.rui-spinner div.glowing{background:#777}div.rui-lightbox{position:fixed;top:0;left:0;float:none;width:100%;height:100%;margin:0;padding:0;background:none;border:none;text-align:center;z-index:9999;z-index/*\\**/:auto\\9;}div.rui-lightbox-locker{position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#000;opacity:0.8;filter:alpha(opacity=80);cursor:default;z-index/*\\**/:9990\\9;}div.rui-lightbox-dialog{display:inline-block; *display:inline; *zoom:1;position:relative;text-align:left;z-index/*\\**/:9999\\9;}div.rui-lightbox-title{height:1.2em;margin-bottom:.1em;white-space:nowrap;color:#DDD;font-weight:bold;font-size:1.6em;font-family:Helvetica}div.rui-lightbox-body{background-color:#FFF;padding:1em;border-radius:.5em;-moz-border-radius:.5em;-webkit-border-radius:.5em}div.rui-lightbox-body-inner{position:relative}div.rui-lightbox-scroller{overflow:hidden}div.rui-lightbox-content{display:inline-block; *display:inline; *zoom:1;min-height:10em;min-width:10em;_height:10em;_width:10em}div.rui-lightbox-body-locker{background-color:white;position:absolute;left:0px;top:0px;width:100%;height:100%;opacity:0;filter:alpha(opacity=0)}div.rui-lightbox-body-locker div.rui-spinner{position:absolute;right:0;bottom:0;border:none;background:none;font-size:150%}div.rui-lightbox-navigation{color:#888;font-size:160%;font-family:Arial;height:1em;user-select:none;-moz-user-select:none;-webkit-user-select:none}div.rui-lightbox-navigation div{cursor:pointer;position:absolute}div.rui-lightbox-navigation div:hover{color:white}div.rui-lightbox-navigation div.next{left:2em}div.rui-lightbox-navigation div.close{right:0}div.rui-lightbox-image div.rui-lightbox-body,div.rui-lightbox-media div.rui-lightbox-body{padding:0;border:1px solid #777;border-radius:0px;-moz-border-radius:0px;-webkit-border-radius:0px}div.rui-lightbox-image div.rui-lightbox-content,div.rui-lightbox-media div.rui-lightbox-content{min-height:12em;min-width:12em;_height:12em;_width:12em}div.rui-lightbox-image div.rui-lightbox-content img{vertical-align:middle}div.rui-lightbox-image div.rui-lightbox-body,div.rui-lightbox-image div.rui-lightbox-body-locker,div.rui-lightbox-media div.rui-lightbox-body,div.rui-lightbox-media div.rui-lightbox-body-locker{background-color:#D8D8D8}div.rui-lightbox-image div.rui-lightbox-body-locker div.rui-spinner,div.rui-lightbox-media div.rui-lightbox-body-locker div.rui-spinner{bottom:.5em;right:.5em}");
         | 
| 892 | 
            -
             | 
| 893 | 
            -
                    style.type = 'text/css';
         | 
| 894 | 
            -
             | 
| 895 | 
            -
                    if(style.styleSheet) {
         | 
| 896 | 
            -
                      style.styleSheet.cssText = rules.nodeValue;
         | 
| 897 | 
            -
                    } else {
         | 
| 898 | 
            -
                      style.appendChild(rules);
         | 
| 899 | 
            -
                    }
         | 
| 900 | 
            -
             | 
| 901 | 
            -
                    document.getElementsByTagName('head')[0].appendChild(style);
         | 
| 902 | 
            -
                  })();
         | 
| 903 | 
            -
             | 
| 904 | 
            -
            return Lightbox;
         | 
| 905 | 
            -
            })(document, RightJS);
         |