diff --git a/dfp.admin.inc b/dfp.admin.inc index 27cf0c1..dae195c 100644 --- a/dfp.admin.inc +++ b/dfp.admin.inc @@ -215,30 +215,6 @@ function dfp_admin_settings($form, $form_state) { '#dialog' => TRUE, ); - // Javascript. - $form['javascript'] = array( - '#type' => 'fieldset', - '#title' => t('Inject Javascript'), - '#collapsible' => TRUE, - '#collapsed' => FALSE, - '#weight' => 20, - '#group' => 'settings', - ); - $form['javascript']['dfp_injected_js'] = array( - '#type' => 'textarea', - '#title' => t('Inject javascript') . ' 1', - '#description' => t('Inject this javascript into the @tag on every page request immediately after the googletag object becomes available.', array('@tag' => '')), - '#default_value' => variable_get('dfp_injected_js', ''), - '#rows' => 5, - ); - $form['javascript']['dfp_injected_js2'] = array( - '#type' => 'textarea', - '#title' => t('Inject javascript') . ' 2', - '#description' => t('Inject this javascript into the @tag on every page request immediately before the enableServices call.', array('@tag' => '')), - '#default_value' => variable_get('dfp_injected_js2', ''), - '#rows' => 5, - ); - // Google Tag Manager. $form['gtm'] = array( '#type' => 'fieldset', diff --git a/js/dfp_googletag.cmd.js b/js/dfp_googletag.cmd.js index 6a55d8b..6d83039 100644 --- a/js/dfp_googletag.cmd.js +++ b/js/dfp_googletag.cmd.js @@ -24,16 +24,6 @@ var name = this.localDefinition.machineName; - // If we are using breakpoints define our size mappings. - if (this.localDefinition.breakpoints.length > 0) { - - // Size mapping just wants an array of arrays. - this.mapping = []; - for (var b = 0; b < this.localDefinition.breakpoints.length; b++) { - this.mapping.push([this.localDefinition.breakpoints[b].browser, this.localDefinition.breakpoints[b].ad]); - } - } - // The dfp_entry. if (this.localDefinition.outOfPage) { dfp_entry[name] = googletag.defineOutOfPageSlot(this.localDefinition.adUnit, this.localDefinition.placeHolderId); @@ -42,8 +32,21 @@ dfp_entry[name] = googletag.defineSlot(this.localDefinition.adUnit, this.localDefinition.tagSize, this.localDefinition.placeHolderId); } - // Add size mapping to the slot. - dfp_entry[name].defineSizeMapping(this.mapping); + // Size mapping just wants an array of arrays. + this.mapping = []; + + // If we are using breakpoints define our size mappings. + if (this.localDefinition.breakpoints.length > 0) { + + for (var b = 0; b < this.localDefinition.breakpoints.length; b++) { + this.mapping.push([this.localDefinition.breakpoints[b].browser, this.localDefinition.breakpoints[b].ad]); + } + + if (this.mapping.length > 0) { + // Add size mapping to the slot. + dfp_entry[name].defineSizeMapping(this.mapping); + } + } // Add the click URL if we have one. if (this.localDefinition.clickURL.length !== 0) {