1void function ( exports, $, _, Backbone ) { 2 3 exports.ES_Item_Style = B.Model({ 4 5 //visible: true, 6 7 background: ES_Background, 8 9 position: B.Model({ x: 0.5, y: 0.5 }), 10 offset: B.Model({ x: 0, y: 0, z: 0 }), 11 rotate: B.Model({ x: 0, y: 0, z: 0 }), 12 13 width: 0, 14 height: 0, 15 16 opacity: 1, 17 18 line_height: 1, 19 letter_spacing: 0, 20 21 align_h: 'center', 22 align_v: 'middle', 23 24 flex: B.Model({ 25 wrap: 'nowrap', 26 shrink: false, 27 grow: false, 28 direction: 'column', 29 alignItems: 'center', 30 alignContent: 'space-around', 31 justifyContent: 'space-around', 32 alignStart: B.Compute({ 33 deps: [ 'direction' ], 34 get: function () { 35 //row-reverse 36 return this.get('direction').indexOf('column') >= 0 ? 'Left' : 'Top'; 37 }, 38 set: function ( value ) { 39 //this.set('direction', Math.round(value * 100) * 10); 40 } 41 }), 42 alignCenter: B.Compute({ 43 deps: [ 'direction' ], 44 get: function () { 45 return this.get('direction').indexOf('column') >= 0 ? 'Center' : 'Middle'; 46 }, 47 set: function ( value ) { 48 //this.set('direction', Math.round(value * 100) * 10); 49 } 50 }), 51 alignEnd: B.Compute({ 52 deps: [ 'direction' ], 53 get: function () { 54 return this.get('direction').indexOf('column') >= 0 ? 'Right' : 'Bottom'; 55 }, 56 set: function ( value ) { 57 //this.set('direction', Math.round(value * 100) * 10); 58 } 59 }) 60 }), 61 padding: B.Model({ 62 top: 0, 63 left: 0, 64 right: 0, 65 bottom: 0 66 }), 67 border: B.Model({ 68 width: 0, 69 style: 'none', 70 color: '', 71 radius: 0, 72 borderStyleNotNone: B.Compute([ 'style' ], function ( style ) { 73 if ( style ) { 74 return style == 'none' ? true : false; 75 } 76 }) 77 }), 78 font: B.Model({ 79 family: 'Helvetica', 80 size: 24, 81 weight: 400, 82 style: 'normal', 83 color: '#000' 84 }), 85 box_shadows: B.Collection( 86 B.Model({ 87 inset: false, x: 0, y: 0, blur: 0, color: '', 88 isInset: B.Compute({ 89 deps: ['inset'], 90 get: function(arg) { 91 return arg ? 'inset' : 'outset'; 92 }, 93 set: function(value) { 94 value && this.set('inset', (value == 'inset' ? true : false)) 95 } 96 }) 97 }) 98 ), 99 text_shadows: B.Collection( 100 B.Model({ x: 0, y: 0, blur: 0, color: '' }) 101 ), 102 smartAlign: B.Compute({ 103 deps: [ 'align_h', 'flex' ], 104 get: function ( align_h ) { 105 return align_h; 106 }, 107 set: function(value) { 108 109 switch (value) { 110 case 'left': 111 this.set('flex.direction', 'column'); 112 this.set('flex.alignItems', 'flex-start'); 113 this.set('align_h', 'left'); 114 break; 115 case 'center': 116 this.set('flex.direction', 'column'); 117 this.set('flex.alignItems', 'center'); 118 this.set('align_h', 'center'); 119 break; 120 case 'right': 121 this.set('flex.direction', 'column'); 122 this.set('flex.alignItems', 'flex-end'); 123 this.set('align_h', 'right'); 124 break; 125 } 126 } 127 }) 128 }, { 129 initialize: function () { 130 if ( !_.has(this.attributes, 'visible') ) { 131 this.set('visible', true, { silent: true }); 132 } 133 } 134 }); 135 136 exports.ES_Item_Animation_Transform = B.Model({ 137 opacity: 0, 138 origin: B.Model({ x: 0.5, y: 0.5, z: 0 }), 139 translate: B.Model({ x: 0, y: 0, z: 0 }), 140 rotate: B.Model({ x: 0, y: 0, z: 0 }), 141 scale: B.Model({ x: 1, y: 1, z: 1 }), 142 skew: B.Model({ x: 0, y: 0, z: 0 }), 143 }) 144 145 exports.ES_Item_Animation = B.Model({ 146 147 enable: true, 148 auto: true, 149 150 effect: 'none', 151 easing: 'linear', 152 153 delay: 0, 154 duration: 500, 155 156 split: 0, 157 splitDelay: 50, 158 159 transform: ES_Item_Animation_Transform, 160 161 delaySeconds: B.Compute({ 162 deps: ['delay'], 163 get: function() { 164 return (Math.round(this.get('delay') / 100) / 10).toFixed(1); 165 }, 166 set: function ( value ) { 167 this.set('delay', Math.round(value * 100) * 10); 168 } 169 }), 170 durationSeconds: B.Compute({ 171 deps: [ 'duration' ], 172 get: function () { 173 return (Math.round(this.get('duration') / 100) / 10).toFixed(1); 174 }, 175 set: function ( value ) { 176 this.set('duration', Math.round(value * 100) * 10); 177 } 178 }) 179 180 }, { 181 initialize: function () { 182 this.on('change:transform', function ( model, value, options ) { 183 if ( !options.chained ) 184 this.set('effect', 'custom'); 185 }) 186 }, 187 getTweenObj: function () { 188 return _.extend(this.get('transform').toJSON(), this.pick('delay', 'duration', 'easing')) 189 } 190 }); 191 192 exports.ES_Item = B.Model({ 193 194 id: null, 195 index: 0, 196 name: '', 197 group: '', 198 199 selected: false,
200 locked: false, 201 hidden: false, 202 203 content: '<div></div>', 204 dynamicName: B.Compute({ 205 deps: [ 'name', 'content' ], 206 get: function () { 207 //var name = this.get('name'); 208 //if (name) 209 // return name; 210 // 211 //var content = this.get 212 213 return this.get('name') || $(this.get('content')).map(function () { 214 return $(this).text() 215 }).toArray().join(' ') 216 }, 217 set: function ( value ) { 218 this.set('name', value) 219 } 220 }), 221 222 aspectRatio: false, 223 parallax_depth: 0, 224 225 attr: ES_Attributes, 226 227 style: B.Compute({ 228 deps: [ 'style_desktop', 'style_laptop', 'style_tablet', 'style_mobile' ], 229 get: function () { 230 var mode = this.root.get('state.view_mode'); 231 return this.get('style_' + ( mode || 'desktop')); 232 }, 233 set: function ( value, options ) { 234 var mode = this.root.get('state.view_mode'); 235 var model = this.attributes['style_' +( mode||'desktop')]; 236 return model && model.set(value, options); 237 } 238 }), 239 240 style_desktop: ES_Item_Style, 241 style_laptop: B.Model({}), 242 style_tablet: B.Model({}), 243 style_mobile: B.Model({}), 244 245 animation: B.Model({ 246 'in': ES_Item_Animation, 247 'out': ES_Item_Animation 248 }), 249 250 }, { 251 initialize: function ( attrs ) { 252 253 this.get('type') == 'item' && this.set('type', 'box'); 254 255 this.get('style_laptop').alias(this.get('style_desktop')); 256 this.get('style_tablet').alias(this.get('style_desktop')); 257 this.get('style_mobile').alias(this.get('style_desktop')); 258 259 this.on('change:locked', function ( model, locked ) { 260 !locked || this.set('selected', false); 261 }) 262 this.on('change:animation.out.delay', function ( model, outDelay ) { 263 var inDelay = this.get('animation.in.delay'); 264 var inDuration = this.get('animation.in.duration'); 265 if ( inDelay + inDuration > outDelay ) 266 this.set('animation.out.delay', inDelay + inDuration) 267 }) 268 this.on('change:animation.in.effect', function ( model, name ) { 269 this.setEffect('in', name); 270 }) 271 this.on('change:animation.out.effect', function ( model, name ) { 272 this.setEffect('out', name); 273 }) 274 this.on('change:style.position', this.updateOffset) 275 }, 276 setEffect: function ( type, name ) { 277 var easing; 278 var animation = ES_ANIMATIONS_INDEX[ name ]; 279 if ( !animation ) 280 return; 281 switch ( type ) { 282 case 'in': 283 easing = 'easeOut' + (animation.easing || 'Cubic'); 284 break; 285 case 'out': 286 easing = 'easeIn' + (animation.easing || 'Cubic'); 287 break; 288 } 289 this.set('animation.' + type, { 290 easing: easing, 291 transform: animation.transform 292 }, { 293 preset: true 294 }); 295 }, 296 updateOffset: function () { 297 var pos_x = this.get('style.position.x'); 298 switch ( parseFloat((pos_x)) ) { 299 case 0: 300 this.set('style.offset.x', 0); 301 break; 302 case 0.5: 303 this.set('style.offset.x', parseInt(this.get('style.width')) / -2); 304 break; 305 case 1: 306 this.set('style.offset.x', -this.get('style.width')); 307 break; 308 } 309 var pos_y = this.get('style.position.y'); 310 switch ( parseFloat((pos_y)) ) { 311 case 0: 312 this.set('style.offset.y', 0); 313 break; 314 case 0.5: 315 this.set('style.offset.y', this.get('style.height') / -2); 316 break; 317 case 1: 318 this.set('style.offset.y', -this.get('style.height')); 319 break; 320 } 321 } 322 323 }, { 324 DEFAULT_ANIM_IN: { 325 delay: 0, 326 duration: 500, 327 transform: { 328 opacity: 0 329 } 330 }, 331 DEFAULT_ANIM_OUT: { 332 delay: 5000, 333 duration: 500, 334 transform: { 335 opacity: 0 336 } 337 }, 338 DEFAULT_BOX: {}, 339 DEFAULT_TEXT: {}, 340 DEFAULT_IMAGE: {}, 341 DEFAULT_VIDEO: {} 342 }); 343 344 exports.ES_Items = B.Collection(ES_Item); 345 346 exports.ES_ANIMATIONS = { 347 348 'default': { 349 'none': {}, 350 }, 351 'bounce': { 352 'bounce': { 353 easing: 'Elastic', 354 scale: { x: 0.5, y: 0.5 } 355 }, 356 'bounce-top': { 357 easing: 'Elastic', 358 translate: { y: -200 } 359 }, 360 'bounce-bottom': { 361 easing: 'Elastic', 362 translate: { y: 200 } 363 }, 364 'bounce-left': { 365 easing: 'Elastic', 366 translate: { x: -200 } 367 }, 368 'bounce-right': { 369 easing: 'Elastic', 370 translate: { x: 200 } 371 }, 372 }, 373 'slide': { 374 'slide-left': { 375 easing: 'Quad', 376 translate: { x: -100 } 377 }, 378 'slide-left-big': { 379 translate: { x: -2000 } 380 }, 381 'slide-left-small': { 382 translate: { x: -50 } 383 }, 384 'slide-right': { 385 translate: { x: 100 } 386 }, 387 'slide-right-big': { 388 translate: { x: 2000 } 389 }, 390 'slide-right-small': { 391 translate: { x: 50 } 392 }, 393 'slide-top': { 394 translate: { y: -100 } 395 }, 396 'slide-top-big': { 397 translate: { y: -2000 } 398 }, 399 'slide-top-small': { 400 translate: { y: -50 } 401 }, 402 'slide-bottom': { 403 translate: { y: 100 } 404 }, 405 'slide-bottom-big': { 406 translate: { y: 2000 } 407 }, 408 'slide-bottom-small': { 409 translate: { y: 50 } 410 }, 411 }, 412 'roll': { 413 'roll-left': { 414 translate: { x: -400 }, 415 rotate: { z: -360 }, 416 }, 417 'roll-right': { 418 translate: { x: 400 }, 419 rotate: { z: 360 }, 420 } 421 }, 422 'skew': { 423 'skew-left': { 424 easing: 'Back', 425 translate: { x: -200 }, 426 skew: { x: 30 } 427 }, 428 'skew-right': { 429 easing: 'Back', 430 translate: { x: 200 }, 431 skew: { x: -30 } 432 } 433 }, 434 'flip': { 435 'flip-left': { 436 rotate: { y: -180 } 437 }, 438 'flip-right': { 439 rotate: { y: 180 } 440 }, 441 'flip-top': { 442 rotate: { x: 180 } 443 }, 444 'flip-bottom': { 445 rotate: { x: -180 } 446 }, 447 }, 448 'rotate': { 449 'rotate-left-360': { 450 rotate: { z: 360 } 451 }, 452 'rotate-left-180': { 453 rotate: { z: 180 } 454 }, 455 'rotate-left-90': { 456 rotate: { z: 90 } 457 }, 458 459 'rotate-right-360': { 460 rotate: { z: -360 } 461 }, 462 'rotate-right-180': { 463 rotate: { z: -180 } 464 }, 465 'rotate-right-90': { 466 rotate: { z: -90 } 467 }, 468 }, 469 'scale': { 470 'scale': { 471 scale: { x: 0, y: 0 } 472 }, 473 'scale-X': { 474 scale: { x: 0, y: 1 } 475 }, 476 'scale-Y': { 477 scale: { x: 1, y: 0 } 478 }, 479 }, 480 'Other': { 481 'custom': {} 482 } 483 }; 484 485 exports.ES_ANIMATIONS_INDEX = {}; 486 _(ES_ANIMATIONS).each(function ( animations, group ) { 487 _(animations).each(function ( animation, name ) { 488 ES_ANIMATIONS_INDEX[ name ] = { 489 easing: animation.easing, 490 transform: (new ES_Item_Animation_Transform(_.omit(animation, 'easing'))).toJSON() 491 }; 492 }) 493 }) 494 495}(this, jQuery, _, JSNES_Backbone);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.