grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026/** * @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ /** * Field media */ ;(function($){ 'use strict'; if (!Function.prototype.bind) { Function.prototype.bind = function(oThis) { if (typeof this !== 'function') { // closest thing possible to the ECMAScript 5 // internal IsCallable function throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function() {}, fBound = function() { return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } $.fieldMedia = function(container, options){ // Merge options with defaults this.options = $.extend({}, $.fieldMedia.defaults, options); // Set up elements this.$container = $(container); this.$modal = this.$container.find(this.options.modal); this.$modalBody = this.$modal.children('.modal-body'); this.$input = this.$container.find(this.options.input); this.$containerPreview = this.$container.find(this.options.previewContainer); this.$buttonSelect = this.$container.find(this.options.buttonSelect); this.$buttonClear = this.$container.find(this.options.buttonClear); // Bind events this.$buttonSelect.on('click', this.modalOpen.bind(this)); this.$buttonClear.on('click', this.clearValue.bind(this)); this.$modal.on('hide', this.removeIframe.bind(this)); // Update preview for existing value this.updatePreview(); }; // display modal for select the file $.fieldMedia.prototype.modalOpen = function() { var $iframe = $('