Index: swftools_flowplayer3.admin.inc =================================================================== --- swftools_flowplayer3.admin.inc +++ swftools_flowplayer3.admin.inc @@ -89,6 +89,15 @@ '#autocomplete_path' => 'admin/settings/swftools/flowplayer3/autocomplete', ); + $form['swftools_flowplayer3_files']['swftools_flowplayer3_ipad_javascript'] = array( + '#type' => 'textfield', + '#default_value' => variable_get('swftools_flowplayer3_ipad_javascript', SWFTOOLS_FLOWPLAYER3_IPAD_JAVASCRIPT), + '#title' => t('iPad script'), + '#description' => t('The path to the FlowPlayer3 iPad script which is used to enable iPad support.'), + '#size' => 50, + '#autocomplete_path' => 'admin/settings/swftools/flowplayer3/autocomplete', + ); + $form['swftools_flowplayer3_files']['swftools_flowplayer3_product_key'] = array( '#type' => 'textfield', '#default_value' => variable_get('swftools_flowplayer3_product_key', ''), @@ -140,6 +149,17 @@ ); + $form['swftools_flowplayer3_embedding']['swftools_flowplayer3_ipad'] = array( + '#type' => 'radios', + '#options' => array( + 0 => t('Disabled'), + 1 => t('Enabled'), + ), + '#default_value' => variable_get('swftools_flowplayer3_ipad', 0), + '#title' => t('Enable iPad support'), + '#description' => t('When enabled Flowplayers will have iPad support.'), + ); + // Add custom form handler to flush cache upon submit $form['#submit'][] = 'swftools_admin_settings_submit'; Index: swftools_flowplayer3.module =================================================================== --- swftools_flowplayer3.module +++ swftools_flowplayer3.module @@ -21,6 +21,11 @@ define('SWFTOOLS_FLOWPLAYER3_JAVASCRIPT', 'example/flowplayer-3.2.6.min.js'); /** + * The default name of the FlowPlayer3 JavaScript ipad file. + */ +define('SWFTOOLS_FLOWPLAYER3_IPAD_JAVASCRIPT', 'flowplayer.ipad-3.2.1.min.js'); + +/** * The default name of the Flowplayer 3 JavaScript tools.scrollable file. */ define('SWFTOOLS_FLOWPLAYER3_SCROLLABLE_JAVASCRIPT', 'scrollable.min.js'); @@ -524,6 +529,11 @@ // Convert config array to JSON $config = drupal_to_js($data['othervars']['flowplayer3']['config']); + if (variable_get('swftools_flowplayer3_ipad', 0) && $ipad_file != '') { + //Replace the ordinary playlist with our iPad variable. + $config = str_replace('"playlist_variable"', "playlist", $config); + } + // Remove quotes from around true and false $config = str_replace(array('"false"', '"true"'), array("false", "true"), $config); @@ -567,22 +577,29 @@ '!id' => $data['othervars']['id'], '!alt' => variable_get('swftools_flowplayer3_load', TRUE) ? '' : $html_alt, )); - + // Start adding scripts to the page // Rather than add each script separately with drupal_add_js build an array and then collapse it and add once $script = array(); + // Add variable for special plugins JavaScript to be attached to the end of the FlowPlayer function call + $plugins = ''; + if (variable_get('swftools_flowplayer3_ipad', 0)) { + $plugins = '.ipad()'; + } + // Provision ready for later to add some JavaScript immediately after Flowplayer embedding $post_js = ''; // Script to add player instance - $script[] = t('flowplayer("!id", !url, !config); + $script[] = t('flowplayer("!id", !url, !config)!plugins; !post_js ', array( - '!id' => $data['othervars']['id'], + '!id' => $data['othervars']['id'], '!url' => $parameters, '!config' => $config, - '!post_js' => $post_js, + '!plugins' => $plugins, + '!post_js' => $post_js, )); // Script to set height and width of container @@ -670,7 +687,11 @@ if (variable_get('swftools_flowplayer3_scrollable_script', 0)) { drupal_add_js($library . '/' . variable_get('swftools_flowplayer3_scrollable_javascript', SWFTOOLS_FLOWPLAYER3_SCROLLABLE_JAVASCRIPT)); } - + + // Add flowplayer3 ipad script if feature is enabled + if (variable_get('swftools_flowplayer3_ipad', 0)) { + drupal_add_js($library . '/' . variable_get('swftools_flowplayer3_ipad_javascript', SWFTOOLS_FLOWPLAYER3_IPAD_JAVASCRIPT)); + } } }