PageSourceSearch

https://prosperajaya.com/plugins/system/easyslider/assets/js/model/core.js

js prosperajaya.com collected 2026-10-07 00:07:32 UTC 13,306 bytes, 388 lines download raw bytes

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	exports.ES_Image = B.Model({
11
12		alt: '',
13		src: '',
14		ratio: 1,
15		width: 0,
16		height: 0,
17
18	},{
19		initialize: function() {
20			var self = this;
21			this.on('change:src', function(  ) {
22				var image = new Image;
23				var src = this.get('src');
24				self.trigger('loadstart');
25				image.onload = function() {
26					self.set({
27						width: this.width,
28						height: this.height,
29						ratio: this.width / this.height
30					});
31					self.trigger('load');
32				}
33				image.error = function() {
34					console.warn('Failed to load image: ', this.src);
35					self.set({
36						width: 0,
37						height: 0,
38						ratio: 1
39					});
40					self.trigger('loaderror');
41				}
42				image.src = src;
43			});
44		},
45	});
46	exports.ES_Video = B.Model({
47
48		autoplay: true,
49
50		controls: false,
51		loop: false,
52		mute: false,
53
54		volume: 100,
55		speed: 1,
56
57		youtube: null,
58		vimeo: null,
59
60		mp4: null,
61		webm: null,
62		ogg: null,
63
64		ratio: 2.3,
65		youtubeRatio: 0,
66		vimeoRatio: 0,
67
68		youtubeID: B.Compute(['youtube'], function(arg){
69			if (arg) {
70				var ID = arg.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/)
71				if(ID && ID[2]) {
72					return ID[2];
73				}
74			}
75			return null;
76		}),
77		vimeoID: B.Compute(['vimeo'], function(arg){
78			if ( arg) {
79				var ID = arg.match(/([0-9]+)/);
80				if( ID) {
81					return ID[1];
82				}
83			}
84			return null;
85		}),
86		selector: 'provider',
87		videoURL: B.Compute({
88			deps: ['youtube','vimeo'],
89			get: function( youtube, vimeo ) {
90				return youtube || vimeo || '';
91			},
92			set: function ( videoURL ) {
93				if( videoURL ) {
94					videoURL = videoURL.toString();
95					if ( videoURL.match(/youtube/) || videoURL.match(/youtu\.be/) ) {
96						var ID = videoURL.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/)
97						if(ID && ID[2]) {
98							this.set({
99								youtube: 'https://www.youtube.com/watch?v=' + ID[2],
100								vimeo: '',
101							})
102						}
103					}
104					else if ( videoURL.match(/vimeo/) ) {
105						this.set({
106							youtube: '',
107							vimeo: videoURL,
108						})
109					}
110					else {
111						if (this.parent) {
112							this.set({
113								youtube: '',
114								vimeo: '',
115							});
116							this.parent.set('image.src', ' ');
117							this.parent.set('color', '#000000');
118						}
119					}
120				}
121				else {
122					this.set({
123						youtube: '',
124						vimeo: '',
125					});
126					if (this.parent) {
127						this.parent.set('image.src', ' ');
128						this.parent.set('color', '#000000');
129					}
130				}
131
132			}
133		}),
134		isProvider: B.Compute(['selector'], function(arg){
135			return arg == 'provider' ? true : false;
136		}),
137		isLocal: B.Compute(['selector'], function(arg){
138			return arg == 'local' ? true : false;
139		})
140		//ratio: 0,
141	},{
142		initialize: function() {
143            this.onChangeVideo = _.debounce(this.onChangeVideo)
144			this.on('change:youtube', this.onChangeVideo);
145			this.on('change:vimeo', this.onChangeVideo);
146			this.on('change:selector', this.onChangeVideo);
147		},
148		onChangeVideo: function(){
149			var model = this;
150			if(this.get('selector') == 'provider') {
151				var youtubeID = this.get('youtubeID');
152				if ( youtubeID ) {
153					this.parent.set('image.src', 'http://img.youtube.com/vi/' + youtubeID + '/1.jpg');
154					this.getVideoRatio( this.get( 'youtube' ));
155					return;
156				}
157
158				var vimeoID = this.get('vimeoID');
159
160				if ( vimeoID ) {
161					$.getJSON('http://www.vimeo.com/api/v2/video/' + vimeoID + '.json?callback=?', {format: "json"}, function(data) {
162						model.parent.set('image.src', data[0].thumbnail_large);
163						model.getVideoRatio( model.get( 'vimeo' ));
164					});
165					return;
166				}
167
168			}
169			else if(this.get('selector') == 'local'){
170				this.parent.set('image.src', ' ');
171				this.parent.set('color', '#000000');
172			}
173
174		},
175		//onChangeVideoURL: function(){
176		//	var videoURL = this.get('videoURL');
177		//	if ( videoURL.match(/youtube/) ) {
178		//		var ID = videoURL.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/)
179		//		if(ID && ID[2]) {
180		//			this.set({
181		//				youtube: '',
182		//				vimeo: '',
183		//			}, {silent: true});
184		//			this.set({
185		//				youtube: 'https://www.youtube.com/watch?v=' + ID[2],
186		//			})
187		//		}
188		//	}
189		//	else if ( videoURL.match(/vimeo/) ) {
190		//		this.set({
191		//			youtube: '',
192		//			vimeo: '',
193		//		}, {silent: true});
194		//		this.set({
195		//			vimeo: videoURL,
196		//		})
197		//	}
198		//	else {
199		//		this.parent.set('image.src', ' ');
200		//		this.parent.set('color', '#000000');
201		//	}
202		//},
203		getVideoRatio: function(videoURL){
204
205			var model = this;
206			$.ajax({
207				url: ES_Config.URL.GET_RATIO_VIDEO,
208				type: 'POST',
209				dataType: 'json',
210				data: { video_url: videoURL },
211				success: function ( response ) {
212					model.setRatio(videoURL, response);
213				},
214				error: function ( req ) {
215
216				}
217			});
218		},
219		setRatio: function(url, data) {
220
221			if (data && data.status && data.width && data.height) {
222				if ( url.match(/youtube/) ) {
223					this.set('youtubeRatio', data.width / data.height);
224				}
225				if ( url.match(/vimeo/) ) {
226					this.set('vimeoRatio', data.width / data.height);
227				}
228			}
229		}
230	});
231	exports.ES_Gradient = B.Model({
232		type: 'linear',
233		angle: 0,
234		from: '#000000',
235		to: '#000000'
236	});
237	exports.ES_Background = B.Model({
238
239		color: '',
240		image: ES_Image,
241		video: ES_Video,
242		gradient: ES_Gradient,
243		repeat: false,
244		position: 'center',
245		size: 'cover',
246
247		parallax_depth: 0.5,
248
249		kenburn: B.Model({
250			enable: false,
251			disable: B.Compute(['enable'], function(arg){
252				return !arg;
253			}),
254			position: '150% 150%',
255			size: '150%',
256			easing: 'linear'
257		}),
258		parallax: B.Model({
259			enable: false,
260			type: "mouse-move",
261			depth: 50
262		}),
263		localVideo: B.Compute(function() {
264			return this.get('video.mp4') || this.get('video.ogg') || this.get('video.webm') ? true : false;
265		})
266	});
267	exports.ES_Attributes = B.Model({
268		'id': '',
269		'class': '',
270		'href': '',
271		'target': ''
272	});
273	exports.ES_FontsCollection = B.Collection([
274		B.Model({
275			name: 'Font Group',
276			fonts: B.Collection([
277				B.Model({ name: 'Font Name' })
278			])
279		})
280	],{
281		constructor: function ES_FontsCollection() {
282			B.Collection.call(this, this.constructor.presets)
283		}
284	},{
285		presets: [
286			{
287				name: "Sans Serif",
288				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" } ]
289			},
290			{
291				name: "Serif",
292				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" } ]
293			},
294			{
295				name: "Display",
296				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" } ]
297			},
298			{
299				name: "Hand-writing",
300				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" } ]
301			},
302			{
303				name: "Monospace",
304				fonts: [ { "name": "Roboto Mono" }, { "name": "Cutive Mono" }, { "name": "PT Mono" }, { "name": "Ubuntu Mono" }, { "name": "Source Code Pro" }, { "name": "Inconsolata" } ]
305			}
306		]
307	})
308	exports.ES_Fonts = B.Collection.extend( {
309		model: B.Model.extend({
310			defaults: {
311				name: '',
312				loaded: false,
313				system: false
314			},
315			load: function() {
316				if (!this.get('loaded') && !this.get('system')){
317					this.set('loaded', true);
318					$( 'body' ).append( "<link href='//fonts.googleapis.com/css?family=" + this.get( 'name' ).replace( /\s+/g, '+' ) + "' rel='stylesheet' data-noprefix type='text/css'>" )
319				}
320			}
321		}),
322		constructor: function() {
323			var fonts = [];
324			_.each(ES_FontsCollection.presets, function(group) {
325				_.each(group.fonts, function( font ) {
326					fonts.push({ name: font.name, group: group.name });
327				});
328			});
329			B.Collection.call(this,fonts);
330		},
331		load: function( name ) {
332			_( this.where({ name: name }) ).invoke('load');
333		}
334	});
335	exports.ES_Nav = B.Collection.extend({
336
337	},{
338		templates: {
339			'slide': {
340				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> ' +
341						'<div><h3 class="jsn-es-name"></h3><img /></div>',
342				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> ' +
343						'<div><h3 class="jsn-es-name"></h3><img /></div>',
344			},
345			'fillpath': {
346				prev: '<span class="jsn-es-icon-wrap"></span><h3><strong class="jsn-es-name">Prev</strong><span></span></h3>',
347				next: '<span class="jsn-es-icon-wrap"></span><h3><strong class="jsn-es-name">Next</strong><span></span></h3>',
348			},
349			'circlepop': {
350				prev: '<span class="jsn-es-icon-wrap"></span>',
351				next: '<span class="jsn-es-icon-wrap"></span>',
352			},
353			'roundslide': {
354				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> ' +
355						'<h3 class="jsn-es-name">Hannah Leigh</h3>',
356				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> ' +
357						'<h3 class="jsn-es-name">Greg Kennedy</h3>',
358			},
359			'slit': {
360				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> ' +
361						'<div><h3 class="jsn-es-name">City Lights</h3><img /></div>',
362				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> ' +
363						'<div><h3 class="jsn-es-name">City Lights</h3><img /></div>',
364			},
365			'thumbflip': {
366				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 />',
367				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 />',
368			},
369			'name': {
370				prev: '',
371				next: '',
372			},
373			'name': {
374				prev: '',
375				next: '',
376			},
377			'name': {
378				prev: '',
379				next: '',
380			},
381			'name': {
382				prev: '',
383				next: '',
384			},
385		}
386	})
387
388}( 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.