@@ -153,9 +153,9 @@ Joomla.extend = (destination, source) => {
153153 newDestination = { } ;
154154 }
155155
156- Object . keys ( source ) . forEach ( ( key ) => {
157- newDestination [ key ] = source [ key ] ;
158- } ) ;
156+ Object . keys ( source ) . forEach ( ( key ) => {
157+ newDestination [ key ] = source [ key ] ;
158+ } ) ;
159159
160160 return destination ;
161161} ;
@@ -188,22 +188,22 @@ Joomla.getOptions = (key, def) => {
188188 return Joomla . optionsStorage [ key ] !== undefined ? Joomla . optionsStorage [ key ] : def ;
189189} ;
190190
191- /**
192- * Load new options from given options object or from Element
193- *
194- * @param {Object|undefined } options The options object to load.
195- * Eg {"com_foobar" : {"option1": 1, "option2": 2}}
196- *
197- * @since 3.7.0
198- */
199- Joomla . loadOptions = ( options ) => {
200- // Load form the script container
201- if ( ! options ) {
202- let counter = 0 ;
191+ /**
192+ * Load new options from given options object or from Element
193+ *
194+ * @param {Object|undefined } options The options object to load.
195+ * Eg {"com_foobar" : {"option1": 1, "option2": 2}}
196+ *
197+ * @since 3.7.0
198+ */
199+ Joomla . loadOptions = ( options ) => {
200+ // Load form the script container
201+ if ( ! options ) {
202+ let counter = 0 ;
203203
204- document . querySelectorAll ( '.joomla-script-options.new' ) . forEach ( ( element ) => {
205- const str = element . text || element . textContent ;
206- const option = JSON . parse ( str ) ;
204+ document . querySelectorAll ( '.joomla-script-options.new' ) . forEach ( ( element ) => {
205+ const str = element . text || element . textContent ;
206+ const option = JSON . parse ( str ) ;
207207
208208 if ( option ) {
209209 Joomla . loadOptions ( option ) ;
@@ -218,27 +218,27 @@ Joomla.getOptions = (key, def) => {
218218 }
219219 }
220220
221- // Initial loading
222- if ( ! Joomla . optionsStorage ) {
223- Joomla . optionsStorage = options || { } ;
224- } else if ( options ) {
225- // Merge with existing
226- Object . keys ( options ) . forEach ( ( key ) => {
227- /**
228- * If both existing and new options are objects, merge them with Joomla.extend().
229- * But test for new option being null, as null is an object, but we want to allow
230- * clearing of options with ...
231- *
232- * Joomla.loadOptions({'joomla.jtext': null});
233- */
234- if ( options [ key ] !== null && typeof Joomla . optionsStorage [ key ] === 'object' && typeof options [ key ] === 'object' ) {
235- Joomla . optionsStorage [ key ] = Joomla . extend ( Joomla . optionsStorage [ key ] , options [ key ] ) ;
236- } else {
237- Joomla . optionsStorage [ key ] = options [ key ] ;
238- }
239- } ) ;
240- }
241- } ;
221+ // Initial loading
222+ if ( ! Joomla . optionsStorage ) {
223+ Joomla . optionsStorage = options || { } ;
224+ } else if ( options ) {
225+ // Merge with existing
226+ Object . keys ( options ) . forEach ( ( key ) => {
227+ /**
228+ * If both existing and new options are objects, merge them with Joomla.extend().
229+ * But test for new option being null, as null is an object, but we want to allow
230+ * clearing of options with ...
231+ *
232+ * Joomla.loadOptions({'joomla.jtext': null});
233+ */
234+ if ( options [ key ] !== null && typeof Joomla . optionsStorage [ key ] === 'object' && typeof options [ key ] === 'object' ) {
235+ Joomla . optionsStorage [ key ] = Joomla . extend ( Joomla . optionsStorage [ key ] , options [ key ] ) ;
236+ } else {
237+ Joomla . optionsStorage [ key ] = options [ key ] ;
238+ }
239+ } ) ;
240+ }
241+ } ;
242242
243243/**
244244 * Custom behavior for JavaScript I18N in Joomla! 1.6
@@ -277,16 +277,16 @@ Joomla.Text = {
277277 return Joomla . Text . strings [ newKey ] !== undefined ? Joomla . Text . strings [ newKey ] : newDef ;
278278 } ,
279279
280- /**
281- * Load new strings in to Joomla.Text
282- *
283- * @param {Object } object Object with new strings
284- * @returns {Joomla.Text }
285- */
286- load : ( object ) => {
287- Object . keys ( object ) . forEach ( ( key ) => {
288- Joomla . Text . strings [ key . toUpperCase ( ) ] = object [ key ] ;
289- } ) ;
280+ /**
281+ * Load new strings in to Joomla.Text
282+ *
283+ * @param {Object } object Object with new strings
284+ * @returns {Joomla.Text }
285+ */
286+ load : ( object ) => {
287+ Object . keys ( object ) . forEach ( ( key ) => {
288+ Joomla . Text . strings [ key . toUpperCase ( ) ] = object [ key ] ;
289+ } ) ;
290290
291291 return Joomla . Text ;
292292 } ,
@@ -635,12 +635,12 @@ Joomla.request = (options) => {
635635 }
636636 }
637637
638- // Custom headers
639- if ( newOptions . headers ) {
640- Object . keys ( newOptions . headers ) . forEach ( ( key ) => {
641- // Allow request without Content-Type
642- // eslint-disable-next-line no-empty
643- if ( key === 'Content-Type' && newOptions . headers [ 'Content-Type' ] === 'false' ) {
638+ // Custom headers
639+ if ( newOptions . headers ) {
640+ Object . keys ( newOptions . headers ) . forEach ( ( key ) => {
641+ // Allow request without Content-Type
642+ // eslint-disable-next-line no-empty
643+ if ( key === 'Content-Type' && newOptions . headers [ 'Content-Type' ] === 'false' ) {
644644
645645 } else {
646646 xhr . setRequestHeader ( key , newOptions . headers [ key ] ) ;
0 commit comments