$24 GRAYBYTE WORDPRESS FILE MANAGER $99

SERVER : premium134.web-hosting.com #1 SMP Thu Mar 13 14:29:12 UTC 2025
SERVER IP : 162.0.232.104 | ADMIN IP 216.73.217.120
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/home/raydofqv/ctcom.com.tw/js-20260612083400/

HOME
Current File : /home/raydofqv/ctcom.com.tw/js-20260612083400//customize-models.js
/**
 * @output wp-includes/js/customize-models.js
 */

/* global _wpCustomizeHeader */
(function( $, wp ) {
	var api = wp.customize;
	/** @namespace wp.customize.HeaderTool */
	api.HeaderTool = {};


	/**
	 * wp.customize.HeaderTool.ImageModel
	 *
	 * A header image. This is where saves via the Customizer API are
	 * abstracted away, plus our own Ajax calls to add images to and remove
	 * images from the user's recently uploaded images setting on the server.
	 * These calls are made regardless of whether the user actually saves new
	 * Customizer settings.
	 *
	 * @memberOf wp.customize.HeaderTool
	 * @alias wp.customize.HeaderTool.ImageModel
	 *
	 * @constructor
	 * @augments Backbone.Model
	 */
	api.HeaderTool.ImageModel = Backbone.Model.extend(/** @lends wp.customize.HeaderTool.ImageModel.prototype */{
		defaults: function() {
			return {
				header: {
					attachment_id: 0,
					url: '',
					timestamp: _.now(),
					thumbnail_url: ''
				},
				choice: '',
				selected: false,
				random: false
			};
		},

		initialize: function() {
			this.on('hide', this.hide, this);
		},

		hide: function() {
			this.set('choice', '');
			api('header_image').set('remove-header');
			api('header_image_data').set('remove-header');
		},

		destroy: function() {
			var data = this.get('header'),
				curr = api.HeaderTool.currentHeader.get('header').attachment_id;

			// If the image we're removing is also the current header,
			// unset the latter.
			if (curr && data.attachment_id === curr) {
				api.HeaderTool.currentHeader.trigger('hide');
			}

			wp.ajax.post( 'custom-header-remove', {
				nonce: _wpCustomizeHeader.nonces.remove,
				wp_customize: 'on',
				theme: api.settings.theme.stylesheet,
				attachment_id: data.attachment_id
			});

			this.trigger('destroy', this, this.collection);
		},

		save: function() {
			if (this.get('random')) {
				api('header_image').set(this.get('header').random);
				api('header_image_data').set(this.get('header').random);
			} else {
				if (this.get('header').defaultName) {
					api('header_image').set(this.get('header').url);
					api('header_image_data').set(this.get('header').defaultName);
				} else {
					api('header_image').set(this.get('header').url);
					api('header_image_data').set(this.get('header'));
				}
			}

			api.HeaderTool.combinedList.trigger('control:setImage', this);
		},

		importImage: function() {
			var data = this.get('header');
			if (data.attachment_id === undefined) {
				return;
			}

			wp.ajax.post( 'custom-header-add', {
				nonce: _wpCustomizeHeader.nonces.add,
				wp_customize: 'on',
				theme: api.settings.theme.stylesheet,
				attachment_id: data.attachment_id
			} );
		},

		shouldBeCropped: function() {
			if (this.get('themeFlexWidth') === true &&
						this.get('themeFlexHeight') === true) {
				return false;
			}

			if (this.get('themeFlexWidth') === true &&
				this.get('themeHeight') === this.get('imageHeight')) {
				return false;
			}

			if (this.get('themeFlexHeight') === true &&
				this.get('themeWidth') === this.get('imageWidth')) {
				return false;
			}

			if (this.get('themeWidth') === this.get('imageWidth') &&
				this.get('themeHeight') === this.get('imageHeight')) {
				return false;
			}

			if (this.get('imageWidth') <= this.get('themeWidth')) {
				return false;
			}

			return true;
		}
	});


	/**
	 * wp.customize.HeaderTool.ChoiceList
	 *
	 * @memberOf wp.customize.HeaderTool
	 * @alias wp.customize.HeaderTool.ChoiceList
	 *
	 * @constructor
	 * @augments Backbone.Collection
	 */
	api.HeaderTool.ChoiceList = Backbone.Collection.extend({
		model: api.HeaderTool.ImageModel,

		// Ordered from most recently used to least.
		comparator: function(model) {
			return -model.get('header').timestamp;
		},

		initialize: function() {
			var current = api.HeaderTool.currentHeader.get('choice').replace(/^https?:\/\//, ''),
				isRandom = this.isRandomChoice(api.get().header_image);

			// Overridable by an extending class.
			if (!this.type) {
				this.type = 'uploaded';
			}

			// Overridable by an extending class.
			if (typeof this.data === 'undefined') {
				this.data = _wpCustomizeHeader.uploads;
			}

			if (isRandom) {
				// So that when adding data we don't hide regular images.
				current = api.get().header_image;
			}

			this.on('control:setImage', this.setImage, this);
			this.on('control:removeImage', this.removeImage, this);
			this.on('add', this.maybeRemoveOldCrop, this);
			this.on('add', this.maybeAddRandomChoice, this);

			_.each(this.data, function(elt, index) {
				if (!elt.attachment_id) {
					elt.defaultName = index;
				}

				if (typeof elt.timestamp === 'undefined') {
					elt.timestamp = 0;
				}

				this.add({
					header: elt,
					choice: elt.url.split('/').pop(),
					selected: current === elt.url.replace(/^https?:\/\//, '')
				}, { silent: true });
			}, this);

			if (this.size() > 0) {
				this.addRandomChoice(current);
			}
		},

		maybeRemoveOldCrop: function( model ) {
			var newID = model.get( 'header' ).attachment_id || false,
			 	oldCrop;

			// Bail early if we don't have a new attachment ID.
			if ( ! newID ) {
				return;
			}

			oldCrop = this.find( function( item ) {
				return ( item.cid !== model.cid && item.get( 'header' ).attachment_id === newID );
			} );

			// If we found an old crop, remove it from the collection.
			if ( oldCrop ) {
				this.remove( oldCrop );
			}
		},

		maybeAddRandomChoice: function() {
			if (this.size() === 1) {
				this.addRandomChoice();
			}
		},

		addRandomChoice: function(initialChoice) {
			var isRandomSameType = RegExp(this.type).test(initialChoice),
				randomChoice = 'random-' + this.type + '-image';

			this.add({
				header: {
					timestamp: 0,
					random: randomChoice,
					width: 245,
					height: 41
				},
				choice: randomChoice,
				random: true,
				selected: isRandomSameType
			});
		},

		isRandomChoice: function(choice) {
			return (/^random-(uploaded|default)-image$/).test(choice);
		},

		shouldHideTitle: function() {
			return this.size() < 2;
		},

		setImage: function(model) {
			this.each(function(m) {
				m.set('selected', false);
			});

			if (model) {
				model.set('selected', true);
			}
		},

		removeImage: function() {
			this.each(function(m) {
				m.set('selected', false);
			});
		}
	});


	/**
	 * wp.customize.HeaderTool.DefaultsList
	 *
	 * @memberOf wp.customize.HeaderTool
	 * @alias wp.customize.HeaderTool.DefaultsList
	 *
	 * @constructor
	 * @augments wp.customize.HeaderTool.ChoiceList
	 * @augments Backbone.Collection
	 */
	api.HeaderTool.DefaultsList = api.HeaderTool.ChoiceList.extend({
		initialize: function() {
			this.type = 'default';
			this.data = _wpCustomizeHeader.defaults;
			api.HeaderTool.ChoiceList.prototype.initialize.apply(this);
		}
	});

})( jQuery, window.wp );


Current_dir [ WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
12 Jun 2026 5.03 PM
raydofqv / nobody
0777
codemirror
--
12 Jun 2026 8.34 AM
raydofqv / raydofqv
0755
crop
--
12 Jun 2026 8.34 AM
raydofqv / raydofqv
0755
dist
--
12 Jun 2026 8.34 AM
raydofqv / raydofqv
0755
.htaccess
0.124 KB
5 Jun 2026 6.28 AM
raydofqv / raydofqv
0644
admin-bar.js
10.3 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
admin-bar.min.js
3.405 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
api-request.js
3.246 KB
1 Dec 2020 2.14 PM
raydofqv / raydofqv
0644
api-request.min.js
0.999 KB
25 May 2022 6.09 AM
raydofqv / raydofqv
0644
autosave.js
21.949 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
autosave.min.js
5.671 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
backbone.js
78.551 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
backbone.min.js
23.744 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
clipboard.js
26.179 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
clipboard.min.js
8.798 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
colorpicker.js
28.401 KB
18 Nov 2012 1.41 AM
raydofqv / raydofqv
0644
colorpicker.min.js
16.111 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
comment-reply.js
12.22 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
comment-reply.min.js
2.955 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-base.js
25.217 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-base.min.js
7.668 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-loader.js
7.718 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-loader.min.js
3.468 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-models.js
6.661 KB
25 Jun 2020 10.13 PM
raydofqv / raydofqv
0644
customize-models.min.js
3.595 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-preview-nav-menus.js
14.672 KB
28 Jul 2020 9.05 AM
raydofqv / raydofqv
0644
customize-preview-nav-menus.min.js
4.915 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-preview-widgets.js
22.708 KB
20 Jun 2020 10.28 PM
raydofqv / raydofqv
0644
customize-preview-widgets.min.js
7.637 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-preview.js
27.927 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-preview.min.js
10.753 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-selective-refresh.js
32.554 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-selective-refresh.min.js
10.442 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-views.js
5.1 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644
customize-views.min.js
2.507 KB
2 Jun 2026 6.01 AM
raydofqv / raydofqv
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF Static GIF