Skip to content

Commit a792f26

Browse files
committed
Removed polyfill since they where not used
1 parent bdad720 commit a792f26

File tree

3 files changed

+0
-209
lines changed

3 files changed

+0
-209
lines changed

template.php

-166
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,6 @@ function ddbasic_preprocess_html(&$vars) {
5656
function ddbasic_process_html(&$vars) {
5757
$theme_name = 'ddbasic';
5858

59-
// Build an array of poly-filling scripts.
60-
$vars['polyfills_array'] = ddbasic_load_polyfills($theme_name, $vars);
61-
62-
// This code is copied from Adaptive Theme, at_core/inc/process.inc.
63-
// It wraps the required polyfills scripts into a conditional comment.
64-
if (!empty($vars['polyfills_array'])) {
65-
$vars['polyfills'] = drupal_static('ddbasic_process_html_polyfills');
66-
if (empty($vars['polyfills'])) {
67-
$polyfills = array();
68-
foreach ($vars['polyfills_array'] as $key => $value) {
69-
foreach ($value as $k => $v) {
70-
$polyfills[$k][] = implode("\n", $v);
71-
}
72-
}
73-
$polyfills_scripts = array();
74-
foreach ($polyfills as $kv => $kvp) {
75-
$polyfills_scripts[$kv] = implode("\n", $kvp);
76-
}
77-
$vars['polyfills'] = ddbasic_theme_conditional_scripts($polyfills_scripts);
78-
}
79-
}
80-
else {
81-
$vars['polyfills'] = '';
82-
}
83-
8459
// Classes for body element. Allows advanced theming based on context
8560
// (home page, node of certain type, etc.)
8661
if (!$vars['is_front']) {
@@ -746,147 +721,6 @@ function ddbasic_theme_script($filepath) {
746721
}
747722

748723

749-
/**
750-
* Return themed scripts in Conditional Comments.
751-
*
752-
* Since Drupal 7 does not (yet) support the 'browser' option in drupal_add_js()
753-
* Adaptivetheme provides a way to load scripts inside conditional comments.
754-
* This function will return a string for printing into a template, its
755-
* akin to a real theme_function but its not.
756-
*
757-
* @param array $ie_scripts
758-
* An array of themed scripts.
759-
*
760-
* @return string
761-
* Themed scripts.
762-
*/
763-
function ddbasic_theme_conditional_scripts($ie_scripts) {
764-
$themed_scripts = drupal_static(__FUNCTION__, array());
765-
if (empty($themed_scripts)) {
766-
$cc_scripts = array();
767-
768-
foreach ($ie_scripts as $conditional_comment => $conditional_scripts) {
769-
$cc_scripts[] = '<!--[if ' . $conditional_comment . ']>' . "\n" . $conditional_scripts . "\n" . '<![endif]-->' . "\n";
770-
}
771-
$themed_scripts = implode("\n", $cc_scripts);
772-
}
773-
774-
return $themed_scripts;
775-
}
776-
777-
778-
/**
779-
* Polyfill is used to enable HTML5 on browsers who doesn't natively support it.
780-
*
781-
* Polyfill adds the missing functionality by 'filling' in scripts that add the
782-
* HTML5 functionality the browser doesn't offer.
783-
*
784-
* Return an array of filenames (scripts) to include.
785-
*
786-
* @param string $theme_name
787-
* Name of the theme.
788-
*/
789-
function ddbasic_load_polyfills($theme_name) {
790-
// Get the info file data.
791-
$info = ddbasic_get_info($theme_name);
792-
793-
// Build an array of polyfilling scripts.
794-
$polyfills_array = drupal_static('ddbasic_preprocess_html_polyfills_array');
795-
if (empty($polyfills_array)) {
796-
// Info file loaded conditional scripts.
797-
$theme_path = drupal_get_path('theme', $theme_name);
798-
if (array_key_exists('ie_scripts', $info)) {
799-
foreach ($info['ie_scripts'] as $condition => $ie_scripts_path) {
800-
foreach ($ie_scripts_path as $key => $value) {
801-
$filepath = $theme_path . '/' . $value;
802-
$polyfills_array['info'][$condition][] = ddbasic_theme_script($filepath);
803-
}
804-
}
805-
}
806-
807-
// Ddbasic Core Polyfills.
808-
$theme_path = drupal_get_path('theme', 'ddbasic');
809-
$polly = '';
810-
$polly_settings_array = array(
811-
'load_html5js',
812-
'load_selectivizr',
813-
// Loaded directly by polly_wants_a_cracker(), its never returned.
814-
'load_scalefixjs',
815-
);
816-
foreach ($polly_settings_array as $polly_setting) {
817-
$polly[$polly_setting] = theme_get_setting($polly_setting, $theme_name);
818-
}
819-
$backed_crackers = ddbasic_polly_wants_a_cracker($polly);
820-
foreach ($backed_crackers as $cupboard => $flavors) {
821-
foreach ($flavors as $key => $value) {
822-
$filepath = $theme_path . '/' . $value;
823-
$polyfills_array['ddbasic'][$cupboard][] = ddbasic_theme_script($filepath);
824-
}
825-
}
826-
}
827-
828-
return $polyfills_array;
829-
}
830-
831-
832-
/**
833-
* Polyfills.
834-
*
835-
* This function does two seperate operations. First it attaches a condition
836-
* to each Polyfill which can be either an IE conditional comment or 'all'.
837-
* Polyfills with 'all' are loaded immediatly via drupal_add_js(), those with
838-
* an IE CC are returned for further processing. This function is hard coded
839-
* to support only those scripts supplied by the core theme, if you need to load
840-
* a script for IE use the info file feature.
841-
*
842-
* @param array $polly
843-
* Array of ?.
844-
*/
845-
function ddbasic_polly_wants_a_cracker($polly) {
846-
$theme_path = drupal_get_path('theme', 'ddbasic');
847-
848-
$baked_crackers = drupal_static(__FUNCTION__, array());
849-
if (empty($baked_crackers)) {
850-
if (in_array(1, $polly)) {
851-
852-
$crackers = array();
853-
854-
// HTML5 Shiv.
855-
if ($polly['load_html5js'] === 1) {
856-
$crackers['all'][] = 'scripts/html5shiv.js';
857-
}
858-
// Selectivizr.
859-
if ($polly['load_selectivizr'] === 1) {
860-
$crackers['all'][] = 'scripts/selectivizr-min.js';
861-
}
862-
// Scalefix.js.
863-
if ($polly['load_scalefixjs'] === 1) {
864-
$crackers['all'][] = 'scripts/scalefix.js';
865-
}
866-
867-
// Load Polyfills.
868-
if (!empty($crackers)) {
869-
// "all" - no conditional comment needed, use drupal_add_js().
870-
if (isset($crackers['all'])) {
871-
foreach ($crackers['all'] as $script) {
872-
drupal_add_js($theme_path . '/' . $script, array(
873-
'type' => 'file',
874-
'scope' => 'header',
875-
'group' => JS_THEME,
876-
'preprocess' => TRUE,
877-
'cache' => TRUE,
878-
)
879-
);
880-
}
881-
}
882-
}
883-
}
884-
}
885-
886-
return $baked_crackers;
887-
}
888-
889-
890724
/**
891725
* Return the info file array for a particular theme, usually the active theme.
892726
*

templates/html.tpl.php

-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
5151
<?php print $styles; ?>
5252
<?php print $scripts; ?>
53-
<?php print $polyfills; ?>
5453
</head>
5554
<body <?php print $attributes;?> class="<?php print $classes; ?>">
5655
<?php print $page_top; ?>

theme-settings.php

-42
Original file line numberDiff line numberDiff line change
@@ -65,48 +65,6 @@ function ddbasic_form_system_theme_settings_alter(&$form, $form_state) {
6565
'#default_value' => theme_get_setting('main_menu_sticky'),
6666
);
6767

68-
// Polyfill settings.
69-
$form['ddbasic-settings']['polyfills'] = array(
70-
'#type' => 'fieldset',
71-
'#title' => t('Polyfills'),
72-
'#description' => t('<h3>Polyfills</h3>Here you can enable commonly used Polyfills supplied with the core theme.'),
73-
'#collapsible' => TRUE,
74-
'#collapsed' => TRUE,
75-
'#weight' => -10,
76-
);
77-
78-
$form['ddbasic-settings']['polyfills']['fills'] = array(
79-
'#type' => 'fieldset',
80-
'#title' => t('Polyfills'),
81-
);
82-
83-
// HTML5 shiv.
84-
$form['ddbasic-settings']['polyfills']['fills']['load_html5js'] = array(
85-
'#type' => 'checkbox',
86-
'#title' => t('HTML5 support in IE'),
87-
'#description' => t('By checking this setting the site will load the @link. Turning this off will be bad news for IE6-8.', array('@link' => l(t('html5shiv'), '//github.com/aFarkas/html5shiv'))),
88-
'#default_value' => theme_get_setting('load_html5js'),
89-
);
90-
91-
// Selectivizr.
92-
$form['ddbasic-settings']['polyfills']['fills']['load_selectivizr'] = array(
93-
'#type' => 'checkbox',
94-
'#title' => t('Selectivizr'),
95-
'#description' => t('@link is a JavaScript utility that emulates CSS3 pseudo-classes and attribute selectors in Internet Explorer 6-8.', array('@link' => l(t('Selectivizr'), 'http://selectivizr.com'))),
96-
'#default_value' => theme_get_setting('load_selectivizr'),
97-
);
98-
99-
// Scalefix.
100-
$form['ddbasic-settings']['polyfills']['fills']['load_scalefixjs'] = array(
101-
'#type' => 'checkbox',
102-
'#title' => t('Scalefix for iOS'),
103-
'#description' => t('Fixes the iOS Orientationchange zoom bug.'),
104-
'#default_value' => theme_get_setting('load_scalefixjs'),
105-
'#states' => array(
106-
'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
107-
),
108-
);
109-
11068
/*
11169
* Plugins
11270
*/

0 commit comments

Comments
 (0)