diff --git a/at_core/inc/forms/settings.menutoggle.inc b/at_core/inc/forms/settings.menutoggle.inc index 7266780629cd3ca71b4096f8f50fcd17ebb4a8c0..d80e9500a091e7dd42e2ec075ce3375cdc42599a 100755 --- a/at_core/inc/forms/settings.menutoggle.inc +++ b/at_core/inc/forms/settings.menutoggle.inc @@ -9,7 +9,7 @@ function at_core_menu_toggle_form(&$form) { '#type' => 'fieldset', '#title' => t('Mobile Menu Toggle'), '#weight' => 30, - '#description' => t('
The Menu Toggle will hide the main menu (either a block in the Menu bar region, or the Main menu) and a single clickable link will appear. Clicking this link toggles the menu open and closed - suitable for mobile devices.
Superfish: if you start using the Superfish module you should re-save the theme settings so this will work correctly (extra CSS is added only if the module is enabled). Also enable the sf-Touchscreen plugin, which is a setting in the block configuration for your Superfish menu block.
Smalltouch/smartphone breakpoints are supported by default, you can select additional devices/breakpoints.'), + '#description' => t('
The Menu Toggle will hide selected menus and a single clickable link will appear. Clicking this link toggles the menu open and closed - suitable for mobile devices. Smalltouch/smartphone breakpoints are supported by default.
Superfish: if you start using the Superfish module you should re-save the theme settings. Also enable the sf-Touchscreen plugin for your Superfish menu block.
Polyfills: for this to work in older browsers and Adroid 2 you need to enable the matchMedia polyfill (see the Polyfills tab).
'), ); // Select additional breakpoints diff --git a/at_core/inc/forms/settings.polyfills.inc b/at_core/inc/forms/settings.polyfills.inc index 404ddd618e6b9da93a86b4f3f40c617d2a18889a..6c7002effb32e9e8cb51b8b4559bf0eb5771dfb4 100755 --- a/at_core/inc/forms/settings.polyfills.inc +++ b/at_core/inc/forms/settings.polyfills.inc @@ -26,12 +26,20 @@ function at_core_polyfills_form(&$form, $theme_name) { '#default_value' => at_get_setting('load_html5js'), ); + // matchMedia polyfill: https://github.com/paulirish/matchMedia.js + $form['at-settings']['polyfills']['fills']['load_matchmediajs'] = array( + '#type' => 'checkbox', + '#title' => t('matchMedia.js Polyfill'), + '#description' => t('Backport matchMedia support to unsupporting browsers - see github.com/paulirish/matchMedia. If using the Menu Toggle extension you need this if supporting Android 2.3 or earlier is important. Do not enable this if you are using respond.js (see Media query support for IE6-8, below) or Modernizr. A number of other libraries load this polyfill also - it\'s worth checking, although its also a very small polyfill.', array('!matchmedia_link' => '//github.com/paulirish/matchMedia.js')), + '#default_value' => at_get_setting('load_matchmediajs'), + ); + // OnMediaQuery.js $script_filepath = '/' . $theme_name . '/scripts/media_queries.js'; $form['at-settings']['polyfills']['fills']['load_onmediaqueryjs'] = array( '#type' => 'checkbox', - '#title' => t('Responsive JavaScript beta'), - '#description' => t('Load the JS Media Queries plugin to enable responsive JavaScript. See@script_filepath
for instructions on how to use. This is an alternative to using matchMedia and hard coding breakpoints in JavaScript. This is bleeding edge and must be considered beta, but its wickedly cool, and useful.', array('!onmediaquery_link' => '//github.com/JoshBarr/js-media-queries', '@script_filepath' => $script_filepath)),
+ '#title' => t('Responsive JavaScript (deprecated)'),
+ '#description' => t('This is deprecated because AT Core now loads it\'s media queries into Drupals JS settings - see menu-toggle.js
in the core theme for an example of how this can be used with matchMedia. This legacy feature loads the JS Media Queries plugin to enable responsive JavaScript. See @script_filepath
for instructions on how to use. This is an alternative to using matchMedia.', array('!onmediaquery_link' => '//github.com/JoshBarr/js-media-queries', '@script_filepath' => $script_filepath)),
'#default_value' => at_get_setting('load_onmediaqueryjs'),
);
@@ -46,7 +54,7 @@ function at_core_polyfills_form(&$form, $theme_name) {
// Respond.js
$form['at-settings']['polyfills']['fills']['load_respondjs'] = array(
'#type' => 'checkbox',
- '#title' => t('Media query support for IE6-8'),
+ '#title' => t('Media query support for IE6-8 (respond.js)'),
'#description' => t('By checking this setting IE6, 7 and 8 will rely on respond.js to set the layout.', array('!respondjs_link' => '//github.com/scottjehl/Respond')),
'#default_value' => at_get_setting('load_respondjs'),
'#states' => array(
@@ -58,7 +66,7 @@ function at_core_polyfills_form(&$form, $theme_name) {
$form['at-settings']['polyfills']['fills']['load_scalefixjs'] = array(
'#type' => 'checkbox',
'#title' => t('Scalefix for iOS'),
- '#description' => t('Fixes the iOS Orientationchange zoom bug.'),
+ '#description' => t('Fixes the iOS Orientationchange zoom bug. See github.com/scottjehl/iOS-Orientationchange-Fix.', array('!scalefix_link' => 'https://github.com/scottjehl/iOS-Orientationchange-Fix')),
'#default_value' => at_get_setting('load_scalefixjs'),
'#states' => array(
'invisible' => array('input[name="disable_responsive_styles"]' => array('checked' => TRUE)),
diff --git a/at_core/inc/load.inc b/at_core/inc/load.inc
index 59d46e3348b6a417b5f9dab01e246b0eb6bb37a5..60800298686cbe246cb74fa54f98224a214a520d 100755
--- a/at_core/inc/load.inc
+++ b/at_core/inc/load.inc
@@ -340,6 +340,10 @@ function at_load_polyfills($theme_name) {
if (at_get_setting('load_onmediaqueryjs') === 1) {
$polyfills_array['all'][] = 'scripts/onmediaquery.js';
}
+ if (at_get_setting('load_matchmediajs') === 1) {
+ $polyfills_array['all'][] = 'scripts/matchMedia.addListener.js';
+ $polyfills_array['all'][] = 'scripts/matchMedia.js';
+ }
// Load Polyfills
if (!empty($polyfills_array)) {
@@ -700,6 +704,7 @@ function at_load_menu_toggle($path, $theme_name) {
'type' => 'file',
'scope' => 'header',
'group' => JS_THEME,
+ 'weight'=> 999,
'preprocess' => TRUE,
'cache' => TRUE,
)
diff --git a/at_core/inc/preprocess.inc b/at_core/inc/preprocess.inc
index cce40abb1aa2a9ee75fb48bd030915402c662ab4..c2da3d3f357eb2ac28fb1078c2671a06e10a1d67 100755
--- a/at_core/inc/preprocess.inc
+++ b/at_core/inc/preprocess.inc
@@ -793,13 +793,20 @@ function adaptivetheme_preprocess_comment(&$vars) {
}
$vars['links_attributes_array']['class'][] = 'clearfix';
- // Build the submitted by and time elements
+ // Build the submitted by, permalink, title and time elements
$uri = entity_uri('comment', $vars['comment']);
$uri['options'] += array('attributes' => array('rel' => 'bookmark'));
$vars['title'] = l($vars['comment']->subject, $uri['path'], $uri['options']);
- $vars['permalink'] = l(t('Permalink'), $uri['path'], $uri['options']); // Permalinks are embedded in the time element, aka Wordpress
+
+ // Don't rebuild the permalink variable if Advanced Forum is enabled
+ if (!module_exists('advanced_forum')) {
+ $vars['permalink'] = l(t('Permalink'), $uri['path'], $uri['options']);
+ }
+
$vars['created'] = '' . l($vars['created'], $uri['path'], $uri['options']) . '';
+
$vars['datetime'] = format_date($vars['comment']->created, 'custom', 'Y-m-d\TH:i:s\Z'); // Generate the timestamp, PHP "c" format is wrong
+
$vars['submitted'] = t('Submitted by !username on !datetime',
array(
'!username' => $vars['author'],
diff --git a/at_core/scripts/matchMedia.addListener.js b/at_core/scripts/matchMedia.addListener.js
new file mode 100755
index 0000000000000000000000000000000000000000..2c61b3969c9331fdc7e932649d498faa78065003
--- /dev/null
+++ b/at_core/scripts/matchMedia.addListener.js
@@ -0,0 +1,47 @@
+/*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */
+(function(){
+ // monkeypatch unsupported addListener/removeListener with polling
+ if( !window.matchMedia( "" ).addListener ){
+ var oldMM = window.matchMedia;
+
+ window.matchMedia = function( q ){
+ var ret = oldMM( q ),
+ listeners = [],
+ last = false,
+ timer,
+ check = function(){
+ var list = oldMM( q ),
+ unmatchToMatch = list.matches && !last,
+ matchToUnmatch = !list.matches && last;
+
+ //fire callbacks only if transitioning to or from matched state
+ if( unmatchToMatch || matchToUnmatch ){
+ for( var i =0, il = listeners.length; i< il; i++ ){
+ listeners[ i ].call( ret, list );
+ }
+ }
+ last = list.matches;
+ };
+
+ ret.addListener = function( cb ){
+ listeners.push( cb );
+ if( !timer ){
+ timer = setInterval( check, 1000 );
+ }
+ };
+
+ ret.removeListener = function( cb ){
+ for( var i =0, il = listeners.length; i< il; i++ ){
+ if( listeners[ i ] === cb ){
+ listeners.splice( i, 1 );
+ }
+ }
+ if( !listeners.length && timer ){
+ clearInterval( timer );
+ }
+ };
+
+ return ret;
+ };
+ }
+}());
diff --git a/at_core/scripts/matchMedia.js b/at_core/scripts/matchMedia.js
new file mode 100755
index 0000000000000000000000000000000000000000..c680c4baf4246dbee84c38fba759caf29d1ef001
--- /dev/null
+++ b/at_core/scripts/matchMedia.js
@@ -0,0 +1,36 @@
+/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
+
+window.matchMedia = window.matchMedia || (function( doc, undefined ) {
+
+ "use strict";
+
+ var bool,
+ docElem = doc.documentElement,
+ refNode = docElem.firstElementChild || docElem.firstChild,
+ // fakeBody required for