1void function( exports, $, _, Backbone ) { 2 3 exports.ES_Model = B.Model; 4 exports.ES_Collection = B.Collection; 5 6 exports.ES_Origin = B.Model({ 7 x: 0, 8 y: 0 9 }); 10 11 exports.ES_Image = B.Model({ 12 13 alt: '', 14 src: '', 15 ratio: 1, 16 width: 0, 17 height: 0, 18 19 },{ 20 initialize: function() { 21 var self = this; 22 this.on('change:src', function( ) { 23 var image = new Image; 24 var src = this.get('src'); 25 self.trigger('loadstart'); 26 image.onload = function() { 27 self.set({ 28 width: this.width, 29 height: this.height, 30 ratio: this.width / this.height 31 }); 32 self.trigger('load'); 33 } 34 image.error = function() { 35 console.warn('Failed to load image: ', this.src); 36 self.set({ 37 width: 0, 38 height: 0, 39 ratio: 1 40 }); 41 self.trigger('loaderror'); 42 } 43 image.src = src; 44 }); 45 }, 46 }); 47 exports.ES_Video = B.Model({ 48 49 autoplay: true, 50 51 controls: false, 52 loop: false, 53 mute: false, 54 55 volume: 100, 56 speed: 1, 57 58 youtube: null, 59 vimeo: null, 60 61 mp4: null, 62 webm: null, 63 ogg: null, 64 65 ratio: 2.3, 66 youtubeRatio: 0, 67 vimeoRatio: 0, 68 69 youtubeID: B.Compute(['youtube'], function(arg){ 70 if (arg) { 71 var ID = arg.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/) 72 if(ID && ID[2]) { 73 return ID[2]; 74 } 75 } 76 return null; 77 }), 78 vimeoID: B.Compute(['vimeo'], function(arg){ 79 if ( arg) { 80 var ID = arg.match(/([0-9]+)/); 81 if( ID) { 82 return ID[1]; 83 } 84 } 85 return null; 86 }), 87 selector: 'provider', 88 videoURL: B.Compute({ 89 deps: ['youtube','vimeo'], 90 get: function( youtube, vimeo ) { 91 return youtube || vimeo || ''; 92 }, 93 set: function ( videoURL ) { 94 if( videoURL ) { 95 videoURL = videoURL.toString(); 96 if ( videoURL.match(/youtube/) || videoURL.match(/youtu\.be/) ) { 97 var ID = videoURL.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/) 98 if(ID && ID[2]) { 99 this.set({ 100 youtube: 'https://www.youtube.com/watch?v=' + ID[2], 101 vimeo: '', 102 }) 103 } 104 } 105 else if ( videoURL.match(/vimeo/) ) { 106 this.set({ 107 youtube: '', 108 vimeo: videoURL, 109 }) 110 } 111 else { 112 if (this.parent) { 113 this.set({ 114 youtube: '', 115 vimeo: '', 116 }); 117 this.parent.set('image.src', ' '); 118 this.parent.set('color', '#000000'); 119 } 120 } 121 } 122 else { 123 this.set({ 124 youtube: '', 125 vimeo: '', 126 }); 127 if (this.parent) { 128 this.parent.set('image.src', ' '); 129 this.parent.set('color', '#000000'); 130 } 131 } 132 133 } 134 }), 135 isProvider: B.Compute(['selector'], function(arg){ 136 return arg == 'provider' ? true : false; 137 }), 138 isLocal: B.Compute(['selector'], function(arg){ 139 return arg == 'local' ? true : false; 140 }) 141 //ratio: 0, 142 },{ 143 initialize: function() { 144 this.onChangeVideo = _.debounce(this.onChangeVideo) 145 this.on('change:youtube', this.onChangeVideo); 146 this.on('change:vimeo', this.onChangeVideo); 147 this.on('change:selector', this.onChangeVideo); 148 }, 149 onChangeVideo: function(){ 150 var model = this; 151 if(this.get('selector') == 'provider') { 152 var youtubeID = this.get('youtubeID'); 153 if ( youtubeID ) { 154 this.parent.set('image.src', 'https://img.youtube.com/vi/' + youtubeID + '/0.jpg'); 155 this.getVideoRatio( this.get( 'youtube' )); 156 return; 157 } 158 159 var vimeoID = this.get('vimeoID'); 160 161 if ( vimeoID ) { 162 $.getJSON('https://www.vimeo.com/api/v2/video/' + vimeoID + '.json?callback=?', {format: "json"}, function(data) { 163 model.parent.set('image.src', data[0].thumbnail_large); 164 model.getVideoRatio( model.get( 'vimeo' )); 165 }); 166 return; 167 } 168 169 } 170 else if(this.get('selector') == 'local'){ 171 this.parent.set('image.src', ' '); 172 this.parent.set('color', '#000000'); 173 } 174 175 }, 176 //onChangeVideoURL: function(){ 177 // var videoURL = this.get('videoURL'); 178 // if ( videoURL.match(/youtube/) ) { 179 // var ID = videoURL.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/) 180 // if(ID && ID[2]) { 181 // this.set({ 182 // youtube: '', 183 // vimeo: '', 184 // }, {silent: true}); 185 // this.set({ 186 // youtube: 'https://www.youtube.com/watch?v=' + ID[2], 187 // }) 188 // } 189 // } 190 // else if ( videoURL.match(/vimeo/) ) { 191 // this.set({ 192 // youtube: '', 193 // vimeo: '', 194 // }, {silent: true}); 195 // this.set({ 196 // vimeo: videoURL, 197 // }) 198 // } 199 // else { 200 // this.parent.set('image.src', ' '); 201 // this.parent.set('color', '#000000'); 202 // } 203 //}, 204 getVideoRatio: function(videoURL){ 205 206 var model = this; 207 $.ajax({ 208 url: ES_Config.URL.GET_RATIO_VIDEO, 209 type: 'POST', 210 dataType: 'json', 211 data: { video_url: videoURL }, 212 success: function ( response ) { 213 model.setRatio(videoURL, response); 214 }, 215 error: function ( req ) { 216 217 } 218 }); 219 }, 220 setRatio: function(url, data) { 221 222 if (data && data.status && data.width && data.height) { 223 if ( url.match(/youtube/) ) { 224 this.set('youtubeRatio', data.width / data.height); 225 } 226 if ( url.match(/vimeo/) ) { 227 this.set('vimeoRatio', data.width / data.height); 228 } 229 } 230 } 231 }); 232 exports.ES_Gradient = B.Model({ 233 type: 'linear', 234 angle: 0, 235 from: '#000000', 236 to: '#000000' 237 });
238 exports.ES_Background = B.Model({ 239 240 color: '', 241 image: ES_Image, 242 video: ES_Video, 243 gradient: ES_Gradient, 244 repeat: false, 245 position: 'center', 246 size: 'cover', 247 248 parallax_depth: 0.5, 249 250 kenburn: B.Model({ 251 version: 2, 252 enable: false, 253 duration: 3, 254 disable: B.Compute(['enable'], function(arg){ 255 return !arg; 256 }), 257 position: '150% 150%', 258 size: '150%', 259 easing: 'linear', 260 from: B.Model({ scale: 1, x: 0, y: 0 }), 261 to: B.Model({ scale: 1.2, x: 100, y: 100 }) 262 }, { 263 initialize: function(attrs) { 264 attrs = attrs || {}; 265 switch (attrs.version) { 266 case undefined: 267 if (attrs && attrs.position && attrs.size) { 268 var parse = _.parseBackgroundPos; 269 var pos = parse(attrs.position); 270 var scale = parse(attrs.size); 271 this.set({ 272 to: { scale: scale / 100, x: pos[0], y: pos[2] } 273 }, { silent: true }); 274 } 275 break; 276 } 277 } 278 }), 279 parallax: B.Model({ 280 enable: false, 281 type: "mouse-move", 282 depth: 50 283 }), 284 localVideo: B.Compute(function() { 285 return this.get('video.mp4') || this.get('video.ogg') || this.get('video.webm') ? true : false; 286 }) 287 }); 288 exports.ES_Attributes = B.Model({ 289 'id': '', 290 'class': '', 291 'href': '', 292 'target': '' 293 }); 294 exports.ES_FontsCollection = B.Collection([ 295 B.Model({ 296 name: 'Font Group', 297 fonts: B.Collection([ 298 B.Model({ name: 'Font Name' }) 299 ]) 300 }) 301 ],{ 302 constructor: function ES_FontsCollection() { 303 B.Collection.call(this, this.constructor.presets) 304 } 305 },{ 306 presets: [ 307 { 308 name: "Sans Serif", 309 fonts: [ { "name": "Open Sans" }, { "name": "Roboto" }, { "name": "Lato" }, { "name": "Oswald" }, { "name": "Roboto Condensed" }, { "name": "Source Sans Pro" }, { "name": "PT Sans" }, { "name": "Droid Sans" }, { "name": "Raleway" }, { "name": "Montserrat" }, { "name": "Ubuntu" }, { "name": "PT Sans Narrow" }, { "name": "Arimo" }, { "name": "Titillium Web" }, { "name": "Dosis" }, { "name": "Oxygen" }, { "name": "Hind" }, { "name": "Muli" }, { "name": "Fira Sans" }, { "name": "Play" }, { "name": "Signika" }, { "name": "Merriweather Sans" }, { "name": "Josefin Sans" }, { "name": "Archivo Narrow" }, { "name": "Archivo Black" }, { "name": "Exo 2" }, { "name": "Asap" }, { "name": "Karla" }, { "name": "Orbitron" }, { "name": "Quicksand" }, { "name": "Exo" }, { "name": "Ropa Sans" }, { "name": "Cabin Condensed" }, { "name": "Hammersmith One" }, { "name": "Jura" }, { "name": "Russo One" }, { "name": "Rambla" }, { "name": "Chivo" }, { "name": "Viga" }, { "name": "Rajdhani" }, { "name": "Teko" }, { "name": "Cambay" }, { "name": "Sarpanch" }, { "name": "Poppins" }, { "name": "NTR" }, { "name": "Yantramanav" }, { "name": "Jaldi" }, { "name": "Pragati Narrow" } ] 310 }, 311 { 312 name: "Serif", 313 fonts: [ { "name": "Lora" }, { "name": "Droid Serif" }, { "name": "Roboto Slab" }, { "name": "Merriweather" }, { "name": "Kadwa" }, { "name": "Sumana" }, { "name": "Martel" }, { "name": "Suranna" }, { "name": "Sree Krushnadevaraya" }, { "name": "Rozha One" }, { "name": "Vesper Libre" }, { "name": "Almendra" }, { "name": "Karma" }, { "name": "Stoke" }, { "name": "Inika" }, { "name": "Slabo 13px" }, { "name": "Rufina" }, { "name": "Tienne" }, { "name": "Podkova" }, { "name": "Judson" }, { "name": "Oranienbaum" }, { "name": "Prata" }, { "name": "Adamina" }, { "name": "Arapey" }, { "name": "Copse" }, { "name": "Alice" }, { "name": "Coustard" }, { "name": "Neuton" }, { "name": "Ultra" }, { "name": "Glegoo" }, { "name": "Cantata One" }, { "name": "Vidaloka" }, { "name": "Enriqueta" }, { "name": "Playfair Display SC" }, { "name": "Kreon" }, { "name": "Old Standard TT" }, { "name": "Josefin Slab" }, { "name": "Sanchez" }, { "name": "Noticia Text" }, { "name": "Crete Round" }, { "name": "Rokkitt" }, { "name": "Bree Serif" }, { "name": "Arvo" }, { "name": "Playfair Display" }, { "name": "Bitter" } ] 314 }, 315 { 316 name: "Display", 317 fonts: [ { "name": "Lobster" }, { "name": "Abril Fatface" }, { "name": "Patua One" }, { "name": "Lobster Two" }, { "name": "Bangers" }, { "name": "Fredoka One" }, { "name": "Alfa Slab One" }, { "name": "Passion One" }, { "name": "Righteous" }, { "name": "Playball" }, { "name": "Fugaz One" }, { "name": "Squada One" }, { "name": "Bevan" }, { "name": "Oleo Script" }, { "name": "Contrail One" }, { "name": "Monoton" }, { "name": "Sansita One" }, { "name": "Ceviche One" }, { "name": "Unica One" }, { "name": "Seaweed Script" }, { "name": "Kelly Slab" }, { "name": "Yeseva One" }, { "name": "Oleo Script Swash Caps" }, { "name": "Graduate" }, { "name": "Trade Winds" }, { "name": "Medula One" }, { "name": "Sancreek" }, { "name": "Rye" }, { "name": "Geostar Fill" }, { "name": "Geostar" }, { "name": "Ewert" }, { "name": "Metal Mania" }, { "name": "Faster One" }, { "name": "Ranga" } ] 318 }, 319 { 320 name: "Hand-writing", 321 fonts: [ { "name": "Romanesco" }, { "name": "Mrs Saint Delafield" }, { "name": "Aguafina Script" }, { "name": "Herr Von Muellerhoff" }, { "name": "Yesteryear" }, { "name": "Yellowtail" }, { "name": "Grand Hotel" }, { "name": "Allura" }, { "name": "Nothing You Could Do" }, { "name": "Great Vibes" }, { "name": "Kaushan Script" } ] 322 }, 323 { 324 name: "Monospace", 325 fonts: [ { "name": "Roboto Mono" }, { "name": "Cutive Mono" }, { "name": "PT Mono" }, { "name": "Ubuntu Mono" }, { "name": "Source Code Pro" }, { "name": "Inconsolata" } ] 326 } 327 ] 328 }) 329 exports.ES_Fonts = B.Collection.extend( { 330 model: B.Model.extend({ 331 defaults: { 332 name: '', 333 loaded: false, 334 system: false 335 }, 336 load: function() { 337 if (!this.get('loaded') && !this.get('system')){ 338 this.set('loaded', true); 339 if (JSNEasySliderLoadGoogleFonts) 340 { 341 $( 'body' ).append( "<link href='//fonts.googleapis.com/css?family=" + this.get( 'name' ).replace( /\s+/g, '+' ) + "' rel='stylesheet' data-noprefix type='text/css'>" ); 342 } 343 } 344 } 345 }), 346 constructor: function() { 347 var fonts = []; 348 _.each(ES_FontsCollection.presets, function(group) { 349 _.each(group.fonts, function( font ) { 350 fonts.push({ name: font.name, group: group.name }); 351 }); 352 }); 353 B.Collection.call(this,fonts); 354 }, 355 load: function( name ) { 356 _( this.where({ name: name }) ).invoke('load'); 357 } 358 }); 359 exports.ES_Nav = B.Collection.extend({ 360 361 },{ 362 templates: { 363 'slide': { 364 prev: '<span class="jsn-es-icon-wrap"><svg class="jsn-es-icon" width="32" height="32" viewBox="0 0 64 64"><use xlink:href="#arrow-left-1"></svg></span> ' + 365 '<div><h3 class="jsn-es-name"></h3><img /></div>', 366 next: '<span class="jsn-es-icon-wrap"><svg class="jsn-es-icon" width="32" height="32" viewBox="0 0 64 64"><use xlink:href="#arrow-right-1"></svg></span> ' + 367 '<div><h3 class="jsn-es-name"></h3><img /></div>', 368 }, 369 'fillpath': { 370 prev: '<span class="jsn-es-icon-wrap"></span><h3><strong class="jsn-es-name">Prev</strong><span></span></h3>', 371 next: '<span class="jsn-es-icon-wrap"></span><h3><strong class="jsn-es-name">Next</strong><span></span></h3>', 372 }, 373 'circlepop': { 374 prev: '<span class="jsn-es-icon-wrap"></span>', 375 next: '<span class="jsn-es-icon-wrap"></span>', 376 }, 377 'roundslide': { 378 prev: '<span class="jsn-es-icon-wrap"><svg class="jsn-es-icon" width="32" height="32" viewBox="0 0 64 64"><use xlink:href="#arrow-left-4"></svg></span> ' + 379 '<h3 class="jsn-es-name">Hannah Leigh</h3>', 380 next: '<span class="jsn-es-icon-wrap"><svg class="jsn-es-icon" width="32" height="32" viewBox="0 0 64 64"><use xlink:href="#arrow-right-4"></svg></span> ' + 381 '<h3 class="jsn-es-name">Greg Kennedy</h3>', 382 }, 383 'slit': { 384 prev: '<span class="jsn-es-icon-wrap"><svg class="jsn-es-icon" width="22" height="22" viewBox="0 0 64 64"><use xlink:href="#arrow-left-1"></svg></span> ' + 385 '<div><h3 class="jsn-es-name">City Lights</h3><img /></div>', 386 next: '<span class="jsn-es-icon-wrap"><svg class="jsn-es-icon" width="22" height="22" viewBox="0 0 64 64"><use xlink:href="#arrow-right-1"></svg></span> ' + 387 '<div><h3 class="jsn-es-name">City Lights</h3><img /></div>', 388 }, 389 'thumbflip': { 390 prev: '<span class="jsn-es-icon-wrap"><svg class="jsn-es-icon" width="32" height="32" viewBox="0 0 64 64"><use xlink:href="#arrow-left-5"></svg></span> <img />', 391 next: '<span class="jsn-es-icon-wrap"><svg class="jsn-es-icon" width="32" height="32" viewBox="0 0 64 64"><use xlink:href="#arrow-right-5"></svg></span> <img />', 392 }, 393 'name': { 394 prev: '', 395 next: '', 396 }, 397 'name': { 398 prev: '', 399 next: '', 400 }, 401 'name': { 402 prev: '', 403 next: '', 404 }, 405 'name': { 406 prev: '', 407 next: '', 408 }, 409 } 410 }) 411 412}( 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.