Skip to content

Commit 98d9048

Browse files
author
Chris Blakley
committed
Mobile autocomplete fix, TinyMCE with Bootstrap Reboot CSS, other minor edits...
1 parent 95f6302 commit 98d9048

File tree

12 files changed

+2890
-51
lines changed

12 files changed

+2890
-51
lines changed

Nebula-Child/style.css

Lines changed: 858 additions & 3 deletions
Large diffs are not rendered by default.

assets/css/pre.css

Lines changed: 183 additions & 2 deletions
Large diffs are not rendered by default.

assets/css/tinymce.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/js/main.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ function nebulaBatteryData(battery){
233233
'battery_mode': nebula.user.client.device.battery.mode,
234234
'battery_percentage': nebula.user.client.device.battery.percentage,
235235
});
236-
jQuery(document).trigger('batteryChange');
236+
nebula.dom.document.trigger('batteryChange');
237237
}
238238

239239
//Detect Network Connection
@@ -288,7 +288,7 @@ function facebookConnect(){
288288
xfbml: true
289289
});
290290

291-
jQuery(document).trigger('fbinit');
291+
nebula.dom.document.trigger('fbinit');
292292
};
293293
} else {
294294
jQuery('.facebook-connect').remove();
@@ -748,8 +748,8 @@ function isInView(element){
748748
var elementTop = element.offset().top;
749749
var elementBottom = element.offset().top+element.innerHeight();
750750

751-
var windowTop = jQuery(document).scrollTop();
752-
var windowBottom = jQuery(document).scrollTop()+jQuery(window).height();
751+
var windowTop = nebula.dom.document.scrollTop();
752+
var windowBottom = nebula.dom.document.scrollTop()+nebula.dom.window.height();
753753

754754
if ( !nebula.dom.body.hasClass('page-visibility-hidden') && ((elementTop >= windowTop && elementTop < windowBottom) || (elementBottom >= windowTop && elementBottom < windowBottom) || (elementTop < windowTop && elementBottom > windowBottom)) ){
755755
return true;
@@ -867,7 +867,7 @@ function hubspot(mode, type, email, properties, callback){ //@todo "Nebula" 0: U
867867
nebula.user.vid = response.vid;
868868
nv('send', {'hubspot_vid': response.vid});
869869
}
870-
jQuery(document).trigger('nebula_hubspot_sent');
870+
nebula.dom.document.trigger('nebula_hubspot_sent');
871871

872872
if ( callback ){
873873
callback(response);
@@ -931,7 +931,7 @@ function initAutocompleteSearch(){
931931
jQuery('.nebula-search-iconable').removeClass('searching').removeClass('autocompleted');
932932
});
933933

934-
jQuery("input#s, input.search").on('keypress paste', function(e){
934+
jQuery("input#s, input.search").on('keyup paste', function(e){
935935
if ( !jQuery(this).hasClass('no-autocomplete') && jQuery.trim(jQuery(this).val()).length && searchTriggerOnlyChars(e) ){
936936
autocompleteSearch(jQuery(this));
937937
}
@@ -949,7 +949,7 @@ function autocompleteSearch(element, types){
949949
return false;
950950
}
951951

952-
jQuery(document).trigger('nebula_autocomplete_search_start', element);
952+
nebula.dom.document.trigger('nebula_autocomplete_search_start', element);
953953
nebulaTimer('autocompleteSearch', 'start');
954954
nebulaTimer('autocompleteResponse', 'start');
955955

@@ -981,18 +981,18 @@ function autocompleteSearch(element, types){
981981
types: JSON.stringify(types)
982982
},
983983
success: function(data){
984-
jQuery(document).trigger('nebula_autocomplete_search_success', data);
984+
nebula.dom.document.trigger('nebula_autocomplete_search_success', data);
985985
ga('set', gaCustomMetrics['autocompleteSearches'], 1);
986986
ga('set', gaCustomDimensions['timestamp'], localTimestamp());
987987
if ( data ){
988-
jQuery(document).trigger('nebula_autocomplete_search_results', data);
988+
nebula.dom.document.trigger('nebula_autocomplete_search_results', data);
989989
nebulaPrerender(data[0].link);
990990
jQuery.each(data, function(index, value){
991991
value.label = value.label.replace(/&#038;/g, "\&");
992992
});
993993
noSearchResults = '';
994994
} else {
995-
jQuery(document).trigger('nebula_autocomplete_search_no_results');
995+
nebula.dom.document.trigger('nebula_autocomplete_search_no_results');
996996
noSearchResults = ' (No Results)';
997997
}
998998
debounce(function(){
@@ -1004,7 +1004,7 @@ function autocompleteSearch(element, types){
10041004
element.parents('form').removeClass('searching').addClass('autocompleted');
10051005
},
10061006
error: function(XMLHttpRequest, textStatus, errorThrown){
1007-
jQuery(document).trigger('nebula_autocomplete_search_error', request.term);
1007+
nebula.dom.document.trigger('nebula_autocomplete_search_error', request.term);
10081008
ga('set', gaCustomDimensions['timestamp'], localTimestamp());
10091009
debounce(function(){
10101010
ga('send', 'event', 'Internal Search', 'Autcomplete Error', request.term);
@@ -1019,7 +1019,7 @@ function autocompleteSearch(element, types){
10191019
event.preventDefault(); //Prevent input value from changing.
10201020
},
10211021
select: function(event, ui){
1022-
jQuery(document).trigger('nebula_autocomplete_search_selected', ui);
1022+
nebula.dom.document.trigger('nebula_autocomplete_search_selected', ui);
10231023
ga('set', gaCustomMetrics['autocompleteSearchClicks'], 1);
10241024
ga('set', gaCustomDimensions['timestamp'], localTimestamp());
10251025
ga('send', 'event', 'Internal Search', 'Autocomplete Click', ui.item.label);
@@ -1916,7 +1916,7 @@ function conditionalJSLoading(){
19161916
jQuery.getScript('https://www.google.com/jsapi?key=' + nebula.site.options.nebula_google_browser_api_key, function(){
19171917
google.load('maps', '3', {
19181918
callback: function(){
1919-
jQuery(document).trigger('nebula_google_maps_api_loaded');
1919+
nebula.dom.document.trigger('nebula_google_maps_api_loaded');
19201920
}
19211921
});
19221922
}).fail(function(){
@@ -1942,7 +1942,7 @@ function conditionalJSLoading(){
19421942
jQuery.getScript(nebula.site.resources.js.datatables).done(function(){
19431943
nebulaLoadCSS(nebula.site.resources.css.datatables);
19441944
dataTablesActions(); //Once loaded, call the DataTables actions. This can be called or overwritten in child.js (or elsewhere)
1945-
jQuery(document).trigger('nebula_datatables_loaded'); //This event can be listened for in child.js (or elsewhere) for when DataTables has finished loading.
1945+
nebula.dom.document.trigger('nebula_datatables_loaded'); //This event can be listened for in child.js (or elsewhere) for when DataTables has finished loading.
19461946
}).fail(function(){
19471947
ga('set', gaCustomDimensions['timestamp'], localTimestamp());
19481948
ga('send', 'event', 'Error', 'JS Error', 'jquery.dataTables.min.js could not be loaded', {'nonInteraction': true});
@@ -2464,7 +2464,7 @@ function nebulaScrollTo(element, milliseconds, offset, onlyWhenBelow){
24642464
var willScroll = true;
24652465
if ( onlyWhenBelow ){
24662466
var elementTop = element.offset().top-offset;
2467-
var viewportTop = jQuery(document).scrollTop();
2467+
var viewportTop = nebula.dom.document.scrollTop();
24682468
if ( viewportTop-elementTop <= 0 ){
24692469
willScroll = false;
24702470
}
@@ -3203,7 +3203,7 @@ function onYouTubeIframeAPIReady(e){
32033203
}
32043204
});
32053205

3206-
jQuery(document).trigger('nebula_youtube_players_created');
3206+
nebula.dom.document.trigger('nebula_youtube_players_created');
32073207
pauseFlag = false;
32083208
}
32093209
function onPlayerError(e){
@@ -3339,7 +3339,7 @@ function nebulaVimeoTracking(){
33393339
players.vimeo[id].addEvent('finish', vimeoFinish);
33403340
players.vimeo[id].addEvent('playProgress', vimeoPlayProgress);
33413341

3342-
jQuery(document).trigger('nebula_vimeo_players_created', id);
3342+
nebula.dom.document.trigger('nebula_vimeo_players_created', id);
33433343
});
33443344
});
33453345

assets/scss/partials/_helpers.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ body:not(.wp-admin) {
104104
.filtered {display: none;}
105105
}
106106

107+
.sticky {position: sticky; top: 0;} //Sticky requires a top value. Default is set to 0 here.
108+
107109
.aligncenter, .align-center {display: block; margin: 0 auto;}
108110
.alignleft, .align-left {float: left;}
109111
.alignright, .align-right {float: right;}

assets/scss/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Description: Nebula is a springboard WordPress theme framework for developers. Like other WordPress startup themes, it has custom functionality built-in (like shortcodes, styles, and JS/PHP functions), but unlike other themes Nebula is not meant for the end-user.
55
Author: Pinckney Hugo Group
66
Author URI: http://www.pinckneyhugo.com
7-
Version: 4.11.13
7+
Version: 4.11.14
88
License: GNU General Public License v2.0 or later
99
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1010
Tags: one-column, two-columns, three-columns, four-columns, left-sidebar, right-sidebar, threaded-comments, theme-options, sticky-post, post-formats, microformats, full-width-template, front-page-post-form, flexible-header, featured-images, featured-image-header, editor-style, custom-menu, custom-colors, accessibility-ready

assets/scss/tinymce.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
//Bootstrap Reboot is applied to the TinyMCE editor first.
2+
13
@import 'variables';
24
@import 'mixins';
35
@import 'helpers'; //Requires mixins
46

5-
body#tinymce.wp-editor {background: $background_color; color: #292b2c;
7+
body#tinymce.wp-editor {background: $background_color; font-size: 16px; padding: 20px !important;
68
a {color: $primary_color; text-decoration: none;
79
&:hover {color: $secondary_color;}
810
}

inc/data/nebula_theme.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "4.11.13",
2+
"version": "4.11.14",
33
"details_url": "https://github.com/chrisblakley/Nebula/commits/master",
44
"download_url": "https://github.com/chrisblakley/Nebula/archive/master.zip"
55
}

libs/Admin.php

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public function hooks(){
2929
$this->UsersHooks(); // Register Users hooks
3030
}
3131

32+
//Enable editor style for the TinyMCE WYSIWYG editor.
33+
add_editor_style(nebula()->bootstrap('reboot'));
34+
add_editor_style('assets/css/tinymce.css');
35+
3236
//Force expire query transients when posts/pages are saved.
3337
add_action('save_post', array($this, 'clear_transients'));
3438

@@ -142,9 +146,6 @@ public function hooks(){
142146

143147
add_action('manage_media_custom_column', array($this, 'muc_value'), 10, 2);
144148

145-
//Enable editor style for the TinyMCE WYSIWYG editor.
146-
add_editor_style('assets/css/tinymce.css');
147-
148149
//Enable All Settings page for only Developers who are Admins
149150
if ( nebula()->is_dev(true) && current_user_can('manage_options') ){
150151
add_action('admin_menu', array($this, 'all_settings_link'));
@@ -262,13 +263,15 @@ public function admin_bar_menus($wp_admin_bar){
262263
));
263264

264265
//Theme template file
265-
$wp_admin_bar->add_node(array(
266-
'parent' => $node_id,
267-
'id' => 'nebula-template',
268-
'title' => '<i class="nebula-admin-fa fa fa-fw fa-object-group" style="font-family: \'FontAwesome\'; color: #a0a5aa; color: rgba(240, 245, 250, .6); margin-right: 5px;"></i> Template: ' . basename($GLOBALS['current_theme_template']) . ' <span class="nebula-admin-light" style="font-size: 10px; color: #a0a5aa; color: rgba(240, 245, 250, .6);">(' . dirname($GLOBALS['current_theme_template']) . ')</span>',
269-
'href' => get_edit_post_link(),
270-
'meta' => array('target' => '_blank')
271-
));
266+
if ( !empty($GLOBALS['current_theme_template']) ){
267+
$wp_admin_bar->add_node(array(
268+
'parent' => $node_id,
269+
'id' => 'nebula-template',
270+
'title' => '<i class="nebula-admin-fa fa fa-fw fa-object-group" style="font-family: \'FontAwesome\'; color: #a0a5aa; color: rgba(240, 245, 250, .6); margin-right: 5px;"></i> Template: ' . basename($GLOBALS['current_theme_template']) . ' <span class="nebula-admin-light" style="font-size: 10px; color: #a0a5aa; color: rgba(240, 245, 250, .6);">(' . dirname($GLOBALS['current_theme_template']) . ')</span>',
271+
'href' => get_edit_post_link(),
272+
'meta' => array('target' => '_blank')
273+
));
274+
}
272275

273276
if ( !empty($post_type_object) ){
274277
//Ancestor pages

libs/Options.php

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,29 +119,41 @@ public function twitter_url($username=false){
119119
return false;
120120
}
121121

122-
//Register the requested version of Bootstrap.
123-
public function bootstrap_version($lang=false){
122+
//Register or return the requested Bootstrap file.
123+
public function bootstrap($file=false){
124124
if ( nebula()->option('bootstrap_version') === 'bootstrap3' ){
125125
//Bootstrap 3 (IE8+ Support)
126-
if ( $lang === 'css' ){
126+
if ( $file === 'css' ){
127127
return wp_register_style('nebula-bootstrap', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css', null, '3.3.7', 'all');
128-
} elseif ( $lang === 'js' ){
128+
} elseif ( $file === 'js' ){
129129
return nebula_register_script('nebula-bootstrap', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js', 'defer', null, '3.3.7', true);
130+
} elseif ( $file === 'reboot' ){
131+
return false;
132+
} else {
133+
return 'v3';
130134
}
131135
} elseif ( nebula()->option('bootstrap_version') === 'bootstrap4a5' ){
132136
//Bootstrap 4 alpha 5 (IE9+ Support)
133-
if ( $lang === 'css' ){
137+
if ( $file === 'css' ){
134138
return wp_register_style('nebula-bootstrap', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap.min.css', null, '4.0.0a5', 'all');
135-
} elseif ( $lang === 'js' ){
139+
} elseif ( $file === 'js' ){
136140
return nebula()->register_script('nebula-bootstrap', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/js/bootstrap.min.js', 'defer', null, '4.0.0a5', true);
141+
} elseif ( $file === 'reboot' ){
142+
return 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap-reboot.min.css';
143+
} else {
144+
return 'v4a5';
137145
}
138146
}
139147

140148
//Latest (IE10+)
141-
if ( $lang === 'css' ){
149+
if ( $file === 'css' ){
142150
return wp_register_style('nebula-bootstrap', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css', null, '4.0.0a6', 'all');
143-
} elseif ( $lang === 'js' ){
151+
} elseif ( $file === 'js' ){
144152
return nebula()->register_script('nebula-bootstrap', 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js', 'defer', null, '4.0.0a6', true);
153+
} elseif ( $file === 'reboot' ){
154+
return 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap-reboot.min.css';
155+
} else {
156+
return 'latest';
145157
}
146158
}
147159

0 commit comments

Comments
 (0)