From 294697faacf6fc9c1fca1cf3131f75c3d275d44e Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Thu, 4 Sep 2014 16:01:18 -0400 Subject: [PATCH] Update theme for headway --- .../headway/library/admin/admin-write.php | 2 +- .../themes/headway/library/api/api-block.php | 52 +- .../themes/headway/library/api/api-panel.php | 16 + .../themes/headway/library/blocks/blocks.php | 15 +- .../blocks/custom-code/custom-code.php | 3 +- .../headway/library/blocks/image/image.php | 7 +- .../library/blocks/navigation/navigation.php | 111 +- .../headway/library/common/application.php | 11 +- .../headway/library/common/compiler.php | 26 +- .../themes/headway/library/common/layout.php | 14 +- .../headway/library/data/data-elements.php | 12 +- .../headway/library/data/data-portability.php | 14 +- .../headway/library/display/grid-renderer.php | 6 +- .../themes/headway/library/display/head.php | 3 +- .../library/display/layout-renderer.php | 13 +- .../library/maintenance/upgrade-37.php | 10 +- .../library/media/dynamic/responsive-grid.php | 16 +- .../visual-editor/css/editor-inputs.less | 5 + .../library/visual-editor/css/editor.less | 5 + .../library/visual-editor/iframe-grid.php | 2 +- .../library/visual-editor/scripts-min/app.js | 2 +- .../scripts-min/deps/ace/ace.min.js | 2 +- .../scripts-min/deps/ace/ext-searchbox.js | 1 + .../scripts-min/deps/ace/mode-css.js | 2 +- .../scripts-min/deps/ace/mode-html.js | 1 + .../scripts-min/deps/ace/mode-php.js | 1 + .../scripts-min/deps/ace/theme-textmate.js | 2 +- .../scripts-min/deps/ace/worker-css.js | 2 +- .../library/visual-editor/scripts/app.js | 2 - .../visual-editor/scripts/build/build.js | 29 - .../library/visual-editor/scripts/build/r.js | 27811 ---------------- .../visual-editor/scripts/deps/ace/ace.min.js | 12 +- .../scripts/deps/ace/ext-searchbox.js | 5 + .../scripts/deps/ace/mode-css.js | 816 +- .../scripts/deps/ace/mode-html.js | 1 + .../scripts/deps/ace/mode-php.js | 1 + .../scripts/deps/ace/theme-textmate.js | 162 +- .../scripts/deps/ace/worker-css.js | 8324 +---- .../visual-editor/scripts/deps/jquery.qtip.js | 2716 +- .../visual-editor/scripts/deps/jquery.ui.js | 36 +- .../visual-editor/scripts/deps/mousetrap.js | 40 +- .../visual-editor/scripts/helper.ace.js | 103 + .../visual-editor/scripts/helper.blocks.js | 101 +- .../visual-editor/scripts/helper.wrappers.js | 37 +- .../scripts/modules/design/mode-design.js | 42 +- .../scripts/modules/grid/grid-wizard.js | 143 +- .../scripts/modules/grid/grid.js | 61 +- .../scripts/modules/grid/mode-grid.js | 2 +- .../scripts/modules/grid/wrapper-inputs.js | 18 +- .../scripts/modules/grid/wrappers.js | 131 +- .../visual-editor/scripts/modules/menu.js | 73 +- .../scripts/modules/panel.inputs.js | 18 +- .../visual-editor/scripts/modules/panel.js | 2 + .../visual-editor/scripts/util.saving.js | 1 + .../visual-editor/scripts/util.tooltips.js | 4 +- .../visual-editor/scripts/util.usability.js | 2 +- .../visual-editor/visual-editor-ajax.php | 7 +- .../library/visual-editor/visual-editor.php | 44 + .../library/wrappers/wrapper-options.php | 11 + wp-content/themes/headway/style.css | 2 +- 60 files changed, 3612 insertions(+), 37501 deletions(-) create mode 100644 wp-content/themes/headway/library/visual-editor/scripts-min/deps/ace/ext-searchbox.js create mode 100644 wp-content/themes/headway/library/visual-editor/scripts-min/deps/ace/mode-html.js create mode 100644 wp-content/themes/headway/library/visual-editor/scripts-min/deps/ace/mode-php.js delete mode 100644 wp-content/themes/headway/library/visual-editor/scripts/build/build.js delete mode 100644 wp-content/themes/headway/library/visual-editor/scripts/build/r.js create mode 100644 wp-content/themes/headway/library/visual-editor/scripts/deps/ace/ext-searchbox.js create mode 100644 wp-content/themes/headway/library/visual-editor/scripts/deps/ace/mode-html.js create mode 100644 wp-content/themes/headway/library/visual-editor/scripts/deps/ace/mode-php.js create mode 100644 wp-content/themes/headway/library/visual-editor/scripts/helper.ace.js diff --git a/wp-content/themes/headway/library/admin/admin-write.php b/wp-content/themes/headway/library/admin/admin-write.php index 54a77f3..42b201f 100644 --- a/wp-content/themes/headway/library/admin/admin-write.php +++ b/wp-content/themes/headway/library/admin/admin-write.php @@ -23,7 +23,7 @@ class HeadwayAdminWrite { return false; /* Figure out the layout ID */ - $layout_id = 'single-' . $post->post_type . '-' . $postid; + $layout_id = 'single' . HeadwayLayout::$sep . $post->post_type . HeadwayLayout::$sep . $postid; /* Delete everything from the layout including blocks, wrapper, design editor instances, and the wp_options rows */ HeadwayLayout::delete_layout($layout_id, false); diff --git a/wp-content/themes/headway/library/api/api-block.php b/wp-content/themes/headway/library/api/api-block.php index 9fdb703..11e0c61 100644 --- a/wp-content/themes/headway/library/api/api-block.php +++ b/wp-content/themes/headway/library/api/api-block.php @@ -371,28 +371,11 @@ class HeadwayBlockOptionsAPI extends HeadwayVisualEditorPanelAPI { 'callback' => 'var $block = $i("#block-" + block.id); $block.data("alias", value); updateBlockContentCover($block);', 'tooltip' => 'Enter an easily recognizable name for the block alias and it will be used throughout your site admin. For instance, if you add an alias to a widget area block, that alias will be used in the Widgets panel.', ); - - if ( HeadwayResponsiveGrid::is_enabled() ) { - - $this->inputs['config']['responsive-block-hiding'] = array( - 'type' => 'multi-select', - 'name' => 'responsive-block-hiding', - 'label' => 'Responsive Grid Block Hiding', - 'default' => '', - 'tooltip' => 'If you have the responsive grid enabled and the user views your website on an iPhone (or equivalent device), the grid may be cluttered do to so many blocks being in a small area. If you wish to limit the blocks that are shown on mobile devices, you can use this setting to hide certain blocks for the devices you choose. If no options are selected, then responsive block hiding will not be active for this block.', - 'options' => array( - 'smartphones' => 'iPhone/Smartphones', - 'tablets-landscape' => 'iPad/Tablets (Landscape)', - 'tablets-portrait' => 'iPad/Tablets (Portrait)', - 'computers' => 'Laptops & Desktops (Not Recommended)' - ) - ); - - } - + $this->inputs['config']['css-classes'] = array( 'type' => 'text', 'name' => 'css-classes', + 'callback' => 'updateBlockCustomClasses(input, block.id, value);', 'label' => 'Custom CSS Class(es)', 'default' => '', 'tooltip' => 'Need more finite control? Enter the custom CSS class selectors here and they will be added to the block\'s class attribute. DO NOT put regular CSS in here. Use the Live CSS editor for that.', @@ -614,19 +597,24 @@ class HeadwayBlockOptionsAPI extends HeadwayVisualEditorPanelAPI { 'callback' => '' ); - $this->inputs['responsive']['responsive-block-hiding'] = array( - 'type' => 'multi-select', - 'name' => 'responsive-block-hiding', - 'label' => 'Legacy Responsive Grid Block Hiding', - 'default' => '', - 'tooltip' => 'If you have the responsive grid enabled and the user views your website on an iPhone (or equivalent device), the grid may be cluttered do to so many blocks being in a small area. If you wish to limit the blocks that are shown on mobile devices, you can use this setting to hide certain blocks for the devices you choose. If no options are selected, then responsive block hiding will not be active for this block.', - 'options' => array( - 'smartphones' => 'iPhone/Smartphones', - 'tablets-landscape' => 'iPad/Tablets (Landscape)', - 'tablets-portrait' => 'iPad/Tablets (Portrait)', - 'computers' => 'Laptops & Desktops (Not Recommended)' - ) - ); + + if ( HeadwayBlocksData::get_block_setting($this->block, 'responsive-block-hiding') ) { + + $this->inputs['responsive']['responsive-block-hiding'] = array( + 'type' => 'multi-select', + 'name' => 'responsive-block-hiding', + 'label' => 'Legacy Responsive Grid Block Hiding', + 'default' => '', + 'tooltip' => 'If you have the responsive grid enabled and the user views your website on an iPhone (or equivalent device), the grid may be cluttered do to so many blocks being in a small area. If you wish to limit the blocks that are shown on mobile devices, you can use this setting to hide certain blocks for the devices you choose. If no options are selected, then responsive block hiding will not be active for this block.', + 'options' => array( + 'smartphones' => 'iPhone/Smartphones', + 'tablets-landscape' => 'iPad/Tablets (Landscape)', + 'tablets-portrait' => 'iPad/Tablets (Portrait)', + 'computers' => 'Laptops & Desktops (Not Recommended)' + ) + ); + + } } diff --git a/wp-content/themes/headway/library/api/api-panel.php b/wp-content/themes/headway/library/api/api-panel.php index 11407e2..7286a6f 100644 --- a/wp-content/themes/headway/library/api/api-panel.php +++ b/wp-content/themes/headway/library/api/api-panel.php @@ -448,6 +448,22 @@ abstract class HeadwayVisualEditorPanelAPI { } + public function input_code($input) { + + echo ' +
+ +
+ +
+ + +
+ '; + + } + + public function input_wysiwyg($input) { echo ' diff --git a/wp-content/themes/headway/library/blocks/blocks.php b/wp-content/themes/headway/library/blocks/blocks.php index c75f5c7..8ec4ddd 100644 --- a/wp-content/themes/headway/library/blocks/blocks.php +++ b/wp-content/themes/headway/library/blocks/blocks.php @@ -118,8 +118,8 @@ class HeadwayBlocks { $block_path = '/blocks/' . $block . '/' . $block . '.php'; /* Allow blocks to be overriden by child themes */ - if ( HEADWAY_CHILD_THEME_ACTIVE && file_exists( untrailingslashit(get_stylesheet_directory()) . $block_path ) ) { - require_once untrailingslashit( get_stylesheet_directory() ) . $block_path; + if ( HEADWAY_CHILD_THEME_ACTIVE && file_exists( untrailingslashit(HEADWAY_CHILD_THEME_DIR) . $block_path ) ) { + require_once untrailingslashit( HEADWAY_CHILD_THEME_DIR ) . $block_path; } else { require_once HEADWAY_LIBRARY_DIR . $block_path; } @@ -571,7 +571,7 @@ class HeadwayBlocks { //Set the original block for future use $original_block = $block; - $original_block_id = $where != 'grid' ? HeadwayBlocksData::get_legacy_id( $block ) : $block['id']; + $original_block_id = $block['id']; //Set the block style to null so we don't get an ugly notice down the road if it's not used. $block_style_attr = null; @@ -630,7 +630,7 @@ class HeadwayBlocks { if ( $where != 'grid' ) { $block_classes[] = 'block-mirroring-' . $mirrored_block['id']; - $block_classes[] = 'block-original-' . $original_block_id; + $block_classes[] = 'block-original-' . HeadwayBlocksData::get_legacy_id( $block ); } @@ -654,7 +654,8 @@ class HeadwayBlocks { 'data-grid-top="' . $original_block['position']['top'] . '"', 'data-width="' . $original_block['dimensions']['width'] . '"', 'data-height="' . $original_block['dimensions']['height'] . '"', - 'data-alias="' . headway_get('alias', headway_get('settings', $block, array())) . '"' + 'data-alias="' . esc_attr(stripslashes(headway_get('alias', headway_get('settings', $block, array())))) . '"', + 'data-custom-classes="' . trim($custom_css_classes) . '"' )); } else { @@ -743,11 +744,11 @@ class HeadwayBlocks { if ( is_numeric($key) ) $output .= esc_html($value); else - $output .= sprintf( '%s="%s" ', esc_html($key), esc_attr($value) ); + $output .= sprintf( ' %s="%s"', esc_html($key), esc_attr($value) ); } - return trim( $output ); + return $output; } diff --git a/wp-content/themes/headway/library/blocks/custom-code/custom-code.php b/wp-content/themes/headway/library/blocks/custom-code/custom-code.php index 5d218d5..702c97d 100644 --- a/wp-content/themes/headway/library/blocks/custom-code/custom-code.php +++ b/wp-content/themes/headway/library/blocks/custom-code/custom-code.php @@ -37,7 +37,8 @@ class HeadwayCustomCodeBlockOptions extends HeadwayBlockOptionsAPI { public $inputs = array( 'content' => array( 'content' => array( - 'type' => 'textarea', + 'type' => 'code', + 'mode' => 'html', 'name' => 'content', 'label' => 'Content', 'default' => null diff --git a/wp-content/themes/headway/library/blocks/image/image.php b/wp-content/themes/headway/library/blocks/image/image.php index 6206fe9..5890562 100644 --- a/wp-content/themes/headway/library/blocks/image/image.php +++ b/wp-content/themes/headway/library/blocks/image/image.php @@ -63,9 +63,12 @@ class HeadwayImageBlock extends HeadwayBlockAPI { 'bottom_center' => 'bottom: 0; left: 0; right: 0;', 'bottom_right' => 'bottom: 0;right: 0;' ); - + + $position_fragments = explode('_', $position); + $position_horizontal = $position_fragments[1]; + $css = ' - #block-' . $block['id'] . ' .block-content { position: relative; } + #block-' . $block['id'] . ' .block-content { position: relative; text-align: ' . $position_horizontal . '; } #block-' . $block['id'] . ' img { margin: auto; position: absolute; diff --git a/wp-content/themes/headway/library/blocks/navigation/navigation.php b/wp-content/themes/headway/library/blocks/navigation/navigation.php index 6b652d1..0c3cdc4 100644 --- a/wp-content/themes/headway/library/blocks/navigation/navigation.php +++ b/wp-content/themes/headway/library/blocks/navigation/navigation.php @@ -28,6 +28,19 @@ class HeadwayNavigationBlock extends HeadwayBlockAPI { static private $menu_sub_check_cache = array(); + static private $wp_nav_menu_cache = array(); + + + public static function init() { + + if ( is_admin() ) { + return; + } + + wp_register_script('jquery-hoverintent', headway_url() . '/library/media/js/jquery.hoverintent.js', array('jquery')); + + } + public static function init_action($block_id, $block = false) { @@ -38,8 +51,6 @@ class HeadwayNavigationBlock extends HeadwayBlockAPI { register_nav_menu('navigation_block_' . $block_id, $name); - wp_register_script('jquery-hoverintent', headway_url() . '/library/media/js/jquery.hoverintent.js', array('jquery')); - } @@ -48,7 +59,7 @@ class HeadwayNavigationBlock extends HeadwayBlockAPI { $dependencies = array(); /* Handle sub menus with super fish */ - if ( self::does_menu_have_subs('navigation_block_' . $block_id) ) { + if ( self::does_menu_have_subs($block) ) { $dependencies[] = 'jquery'; @@ -72,12 +83,7 @@ class HeadwayNavigationBlock extends HeadwayBlockAPI { function content($block) { self::$block = $block; - - /* Add filter to add home link */ - add_filter('wp_nav_menu_items', array(__CLASS__, 'home_link_filter')); - add_filter('wp_list_pages', array(__CLASS__, 'home_link_filter')); - add_filter('wp_page_menu', array(__CLASS__, 'fix_legacy_nav')); - + /* Variables */ $vertical = parent::get_setting($block, 'vert-nav-box', false); $alignment = parent::get_setting($block, 'alignment', 'left'); @@ -108,19 +114,7 @@ class HeadwayNavigationBlock extends HeadwayBlockAPI { echo '
'; - $nav_menu_args = array( - 'theme_location' => $nav_location, - 'container' => false, - ); - - if ( HeadwayRoute::is_grid() || headway_get('ve-live-content-query', $block) ) { - - $nav_menu_args['link_before'] = ''; - $nav_menu_args['link_after'] = ''; - - } - - wp_nav_menu(apply_filters('headway_navigation_block_query_args', $nav_menu_args, $block)); + echo self::get_wp_nav_menu($block); if ( $search && !$vertical ) { @@ -132,12 +126,7 @@ class HeadwayNavigationBlock extends HeadwayBlockAPI { } - echo '
'; - - /* Remove filter for home link so other non-navigation blocks are modified */ - remove_filter('wp_nav_menu_items', array(__CLASS__, 'home_link_filter')); - remove_filter('wp_list_pages', array(__CLASS__, 'home_link_filter')); - remove_filter('wp_page_menu', array(__CLASS__, 'fix_legacy_nav')); + echo ''; } @@ -173,7 +162,7 @@ class HeadwayNavigationBlock extends HeadwayBlockAPI { $js = null; /* Superfish */ - if ( self::does_menu_have_subs('navigation_block_' . $block_id) ) { + if ( self::does_menu_have_subs($block) ) { switch ( parent::get_setting($block, 'effect', 'fade') ) { case 'none': @@ -240,33 +229,69 @@ class HeadwayNavigationBlock extends HeadwayBlockAPI { return $js; } + + + public static function get_wp_nav_menu($block) { + + $nav_location = 'navigation_block_' . HeadwayBlocksData::get_legacy_id($block); + + if ( headway_get($nav_location, self::$wp_nav_menu_cache) !== null ) { + return headway_get($nav_location, self::$wp_nav_menu_cache); + } + + /* Add filter to add home link */ + add_filter('wp_nav_menu_items', array(__CLASS__, 'home_link_filter')); + add_filter('wp_list_pages', array(__CLASS__, 'home_link_filter')); + add_filter('wp_page_menu', array(__CLASS__, 'fix_legacy_nav')); + + $nav_menu_args = array( + 'theme_location' => $nav_location, + 'container' => false, + 'echo' => false + ); + + if ( HeadwayRoute::is_grid() || headway_get('ve-live-content-query', $block) ) { + + $nav_menu_args['link_before'] = ''; + $nav_menu_args['link_after'] = ''; + + } + + self::$wp_nav_menu_cache[$nav_location] = wp_nav_menu(apply_filters('headway_navigation_block_query_args', $nav_menu_args, $block)); + + /* Remove filter for home link so other non-navigation blocks are modified */ + remove_filter('wp_nav_menu_items', array(__CLASS__, 'home_link_filter')); + remove_filter('wp_list_pages', array(__CLASS__, 'home_link_filter')); + remove_filter('wp_page_menu', array(__CLASS__, 'fix_legacy_nav')); + + return self::$wp_nav_menu_cache[$nav_location]; + + } + - - public static function does_menu_have_subs($location) { + public static function does_menu_have_subs($block) { + + $nav_location = 'navigation_block_' . HeadwayBlocksData::get_legacy_id($block); /* - * Running wp_nav_menu() is a little taxing when not needed. - * Sometimes self::does_menu_have_subs() is called multiple times on the same location and this is wasting resources. - * This is what the cache is here to resolve. + * Running wp_nav_menu() is a little taxing when not needed. + * Sometimes self::does_menu_have_subs() is called multiple times on the same location and this is wasting resources. + * This is what the cache is here to resolve. */ - - if ( headway_get($location, self::$menu_sub_check_cache) !== null ) { - return headway_get($location, self::$menu_sub_check_cache); + if ( headway_get($nav_location, self::$menu_sub_check_cache) !== null ) { + return headway_get($nav_location, self::$menu_sub_check_cache); } - $menu = wp_nav_menu(array( - 'theme_location' => $location, - 'echo' => false - )); + $menu = self::get_wp_nav_menu($block); $result = false; if ( preg_match('/class=[\'"]sub-menu[\'"]/', $menu) || preg_match('/class=[\'"]children[\'"]/', $menu) ) $result = true; - self::$menu_sub_check_cache[$location] = $result; + self::$menu_sub_check_cache[$nav_location] = $result; - return self::$menu_sub_check_cache[$location]; + return self::$menu_sub_check_cache[$nav_location]; } diff --git a/wp-content/themes/headway/library/common/application.php b/wp-content/themes/headway/library/common/application.php index d327258..f0b5d7e 100644 --- a/wp-content/themes/headway/library/common/application.php +++ b/wp-content/themes/headway/library/common/application.php @@ -26,7 +26,7 @@ class Headway { /* Define simple constants */ define('THEME_FRAMEWORK', 'headway'); - define('HEADWAY_VERSION', '3.7.8'); + define('HEADWAY_VERSION', '3.7.9'); /* Define directories */ define('HEADWAY_DIR', headway_change_to_unix_path(TEMPLATEPATH)); @@ -47,10 +47,13 @@ class Headway { $wpdb->hw_layout_meta = $wpdb->prefix . 'hw_layout_meta'; /* Handle child themes */ - if ( get_template_directory_uri() !== get_stylesheet_directory_uri() ) - define('HEADWAY_CHILD_THEME_ACTIVE', true); - else + if ( get_template_directory_uri() !== get_stylesheet_directory_uri() ) { + define('HEADWAY_CHILD_THEME_ACTIVE', true); + define('HEADWAY_CHILD_THEME_DIR', get_stylesheet_directory()); + } else { define('HEADWAY_CHILD_THEME_ACTIVE', false); + define('HEADWAY_CHILD_THEME_DIR', null); + } /* Handle uploads directory and cache */ $uploads = wp_upload_dir(); diff --git a/wp-content/themes/headway/library/common/compiler.php b/wp-content/themes/headway/library/common/compiler.php index 7cc44ef..ca42aeb 100644 --- a/wp-content/themes/headway/library/common/compiler.php +++ b/wp-content/themes/headway/library/common/compiler.php @@ -88,14 +88,34 @@ class HeadwayCompiler { } - /* Enqueue script */ - if ( $args['enqueue'] ) + /* Output or Enqueue script */ + if ( $args['output-inline'] && $args['format'] != 'js' ) { + + return add_action('wp_print_styles', create_function('', 'return HeadwayCompiler::output_inline(\'' . $args['name'] . '\');')); + + } else if ( $args['enqueue'] ) { + return self::enqueue_file($args['name'], $args['footer-js']); + } + + return true; + + } + + + public static function output_inline($file) { + + $cache = get_transient('hw_compiler_template_' . HeadwayOption::$current_skin); + + if ( !isset($cache[$file]) ) + return false; + + echo "\n\n" . '' . "\n\n"; + return true; } - /** * @param string diff --git a/wp-content/themes/headway/library/common/layout.php b/wp-content/themes/headway/library/common/layout.php index 5f3826a..b780a6f 100644 --- a/wp-content/themes/headway/library/common/layout.php +++ b/wp-content/themes/headway/library/common/layout.php @@ -104,7 +104,7 @@ class HeadwayLayout { $current_hierarchy = self::get_current_hierarchy(); - return end($current_hierarchy); + return apply_filters('headway_current_layout', end($current_hierarchy)); } @@ -178,7 +178,7 @@ class HeadwayLayout { } //If there STILL isn't a customized layout, just return the top level of the current layout. - return end($hierarchy); + return apply_filters('headway_current_layout_in_use', end($hierarchy)); } @@ -201,6 +201,10 @@ class HeadwayLayout { * @return array **/ public static function get_current_hierarchy() { + + if ( !empty($GLOBALS['headway_current_hierarchy']) ) { + return apply_filters('headway_current_layout_hierarchy', $GLOBALS['headway_current_hierarchy']); + } $current_layout = array(); $queried_object = get_queried_object(); @@ -300,7 +304,11 @@ class HeadwayLayout { } //I think we're finally done. - return $current_layout; + if ( count($current_layout) ) { + $GLOBALS['headway_current_hierarchy'] = $current_layout; + } + + return apply_filters('headway_current_layout_hierarchy', $current_layout); } diff --git a/wp-content/themes/headway/library/data/data-elements.php b/wp-content/themes/headway/library/data/data-elements.php index 093e72d..096df39 100644 --- a/wp-content/themes/headway/library/data/data-elements.php +++ b/wp-content/themes/headway/library/data/data-elements.php @@ -2,6 +2,9 @@ class HeadwayElementsData { + private static $raw_data = null; + + public static function init() { add_action('headway_visual_editor_save', array(__CLASS__, 'merge_core_default_design_data')); @@ -12,9 +15,16 @@ class HeadwayElementsData { /* Used to merge in the global defaults for backwards compatibility */ public static function get_raw_data($defaults = array()) { - return headway_array_merge_recursive_simple(self::get_legacy_default_data(), HeadwaySkinOption::get('properties', 'design', $defaults)); + if ( is_array(self::$raw_data) ) { + return self::$raw_data; + } + + self::$raw_data = headway_array_merge_recursive_simple(self::get_legacy_default_data(), HeadwaySkinOption::get('properties', 'design', $defaults)); + + return self::$raw_data; } + /* Mass Get */ diff --git a/wp-content/themes/headway/library/data/data-portability.php b/wp-content/themes/headway/library/data/data-portability.php index 4f005a5..77b8924 100644 --- a/wp-content/themes/headway/library/data/data-portability.php +++ b/wp-content/themes/headway/library/data/data-portability.php @@ -292,20 +292,10 @@ class HeadwayDataPortability { $layout = array( 'name' => $layout_name, - 'blocks' => HeadwayBlocksData::get_blocks_by_layout($layout_id) + 'blocks' => HeadwayBlocksData::get_blocks_by_layout($layout_id, false, true), + 'wrappers' => HeadwayWrappersData::get_wrappers_by_layout($layout_id, true) ); - /* Convert all mirrored blocks into original blocks by pulling their mirror target's settings */ - /* Loop through each block in the template and check if it's mirrored. If it is, replace it with the block that it's mirroring */ - foreach ( $layout['blocks'] as $layout_block_index => $layout_block ) { - - if ( !$mirrored_block = HeadwayBlocksData::get_block_mirror($layout_block) ) - continue; - - $layout['blocks'][$layout_block_index] = $mirrored_block; - - } - /* Spit the file out */ return self::to_json('Headway Layout - ' . $layout_name, 'layout', $layout); diff --git a/wp-content/themes/headway/library/display/grid-renderer.php b/wp-content/themes/headway/library/display/grid-renderer.php index f9534dc..a9ace06 100644 --- a/wp-content/themes/headway/library/display/grid-renderer.php +++ b/wp-content/themes/headway/library/display/grid-renderer.php @@ -17,7 +17,7 @@ class HeadwayGridRenderer { } private function step_1_sort_blocks_by_position() { - uasort( $this->blocks, array( __CLASS__, 'uasort_blocks_by_top_to_left' ) ); + @uasort( $this->blocks, array( __CLASS__, 'uasort_blocks_by_top_to_left' ) ); } private function uasort_blocks_by_top_to_left( $a, $b ) { @@ -118,7 +118,7 @@ class HeadwayGridRenderer { } } } - uasort( $this->columns[ $column_id ], array( __CLASS__, 'uasort_blocks_by_top_to_left' ) ); + @uasort( $this->columns[ $column_id ], array( __CLASS__, 'uasort_blocks_by_top_to_left' ) ); if ( isset( $this->columns[ $column_id ] ) ) $this->columns[ $column_id ] = array_values( $this->columns[ $column_id ] ); } @@ -323,7 +323,7 @@ class HeadwayGridRenderer { $this->layout[ $row ][ $column ] = $this->columns[ $column ]; } foreach ( $this->layout as $row => $row_columns ) - uasort( $this->layout[ $row ], array( __CLASS__, 'uasort_columns_by_left' ) ); + @uasort( $this->layout[ $row ], array( __CLASS__, 'uasort_columns_by_left' ) ); ksort( $this->layout, SORT_NUMERIC ); } diff --git a/wp-content/themes/headway/library/display/head.php b/wp-content/themes/headway/library/display/head.php index 4b2b498..fb39af0 100644 --- a/wp-content/themes/headway/library/display/head.php +++ b/wp-content/themes/headway/library/display/head.php @@ -197,6 +197,7 @@ class HeadwayHead { HeadwayCompiler::register_file(array( 'name' => 'responsive-grid', 'format' => 'css', + 'iframe-cache' => true, 'fragments' => array( array('HeadwayResponsiveGridDynamicMedia', 'content') ), @@ -206,7 +207,7 @@ class HeadwayHead { )); /* JS */ - if ( HeadwayResponsiveGrid::is_active() && apply_filters('headway_responsive_fitvids', HeadwayOption::get('responsive-video-resizing', false, true)) ) { + if ( HeadwayResponsiveGrid::is_active() && apply_filters('headway_responsive_fitvids', HeadwaySkinOption::get('responsive-video-resizing', false, true)) ) { wp_enqueue_script('fitvids', headway_url() . '/library/media/js/jquery.fitvids.js', array('jquery')); diff --git a/wp-content/themes/headway/library/display/layout-renderer.php b/wp-content/themes/headway/library/display/layout-renderer.php index c381710..e623afc 100644 --- a/wp-content/themes/headway/library/display/layout-renderer.php +++ b/wp-content/themes/headway/library/display/layout-renderer.php @@ -88,13 +88,20 @@ class HeadwayLayoutRenderer { $wrapper_classes[] = 'wrapper-first'; /* Custom wrapper classes */ - $custom_css_classes = explode(' ', str_replace(' ', ' ', str_replace(',', ' ', esc_attr(strip_tags(headway_get('css-classes', $wrapper_settings, '')))))); - $wrapper_classes = array_merge($wrapper_classes, $custom_css_classes); + $custom_css_classes = str_replace(' ', ' ', str_replace(',', ' ', esc_attr(strip_tags(headway_get('css-classes', $wrapper_settings, ''))))); + $wrapper_classes = array_merge($wrapper_classes, explode(' ', $custom_css_classes)); + + /* Visual Editor Attributes */ + $wrapper_visual_editor_attributes = ''; + + if ( HeadwayRoute::is_visual_editor_iframe() ) { + $wrapper_visual_editor_attributes = ' data-id="' . $wrapper['original-id'] . '" data-custom-classes="' . trim($custom_css_classes) . '"'; + } /* Display the wrapper */ do_action('headway_before_wrapper'); - echo '
' . "\n\n"; + echo '
' . "\n\n"; do_action('headway_wrapper_open'); diff --git a/wp-content/themes/headway/library/maintenance/upgrade-37.php b/wp-content/themes/headway/library/maintenance/upgrade-37.php index fbc5e8d..ef5dfb7 100644 --- a/wp-content/themes/headway/library/maintenance/upgrade-37.php +++ b/wp-content/themes/headway/library/maintenance/upgrade-37.php @@ -197,9 +197,7 @@ function headway_upgrade_37_fix_templates() { } - if ( count($templates_repaired) ) { - $templates = $templates_repaired; - } + $templates = $templates_repaired; } @@ -207,6 +205,8 @@ function headway_upgrade_37_fix_templates() { /* Truncate the template ID to 12 characters due to varchar limit in wp_options */ $new_template_id = substr(strtolower(str_replace(' ', '-', $template['id'])), 0, 12); + $shortened_template_id = $new_template_id; + $original_template_id = $template['id']; /* If the new template ID is the same as the current ID then don't do anything with this template */ @@ -219,12 +219,12 @@ function headway_upgrade_37_fix_templates() { while ( headway_get($new_template_id, $templates) || get_option('headway_|skin=' . $new_template_id . '|_option_group_general') ) { $template_unique_id_counter++; - $new_template_id = $new_template_id . '-' . $template_unique_id_counter; + $new_template_id = $shortened_template_id . '-' . $template_unique_id_counter; } /* Update WP option names */ - $wpdb->query( "UPDATE $wpdb->options SET option_name = replace(option_name, 'headway_|skin=$original_template_id', 'headway_|skin=$new_template_id') WHERE option_name LIKE 'headway_|skin=$original_template_id%'" ); + $wpdb->query( "UPDATE $wpdb->options SET option_name = replace(option_name, 'headway_|skin=$original_template_id|', 'headway_|skin=$new_template_id|') WHERE option_name LIKE 'headway_|skin=$original_template_id|%'" ); /* If the current skin is the one with the name change then change that */ if ( HeadwayOption::get('current-skin', 'general', HEADWAY_DEFAULT_SKIN) == $original_template_id ) { diff --git a/wp-content/themes/headway/library/media/dynamic/responsive-grid.php b/wp-content/themes/headway/library/media/dynamic/responsive-grid.php index e28ad7a..cc08aa4 100644 --- a/wp-content/themes/headway/library/media/dynamic/responsive-grid.php +++ b/wp-content/themes/headway/library/media/dynamic/responsive-grid.php @@ -38,6 +38,12 @@ class HeadwayResponsiveGridDynamicMedia { /* --- Generic Mobile --- */ @media only screen and (max-width: 1024px) { + /* Take the minimum height off of blocks. */ + .responsive-grid-active .block { + min-height: inherit !important; + height: auto !important; + } + .responsive-grid-active .block img, .responsive-grid-active .block .wp-caption { max-width: 100%; @@ -48,6 +54,10 @@ class HeadwayResponsiveGridDynamicMedia { display: block; } + .responsive-grid-active .block-type-image img { + position: static !important; + } + } '; @@ -111,12 +121,6 @@ class HeadwayResponsiveGridDynamicMedia { margin-right: 0 !important; } - /* Take the minimum height off of fluid blocks. */ - .responsive-grid-active .block { - min-height: inherit !important; - height: auto !important; - } - /* Responsive Block Hiding */ .responsive-block-hiding-device-smartphones { display: none !important; diff --git a/wp-content/themes/headway/library/visual-editor/css/editor-inputs.less b/wp-content/themes/headway/library/visual-editor/css/editor-inputs.less index 9a99df6..d41a08a 100644 --- a/wp-content/themes/headway/library/visual-editor/css/editor-inputs.less +++ b/wp-content/themes/headway/library/visual-editor/css/editor-inputs.less @@ -233,6 +233,11 @@ div.sub-tabs-content div.input-textarea { line-height: 16px; } +/* Code Editor */ +div.sub-tabs-content div.input-code textarea { + display: none; +} + /* WYSIWYG */ div.sub-tabs-content div.input-wysiwyg { position: relative; diff --git a/wp-content/themes/headway/library/visual-editor/css/editor.less b/wp-content/themes/headway/library/visual-editor/css/editor.less index 31bd03f..10c6083 100644 --- a/wp-content/themes/headway/library/visual-editor/css/editor.less +++ b/wp-content/themes/headway/library/visual-editor/css/editor.less @@ -1867,6 +1867,11 @@ div.notification-success { content: '\72'; } + /* Duplicate Block */ + #context-menu-block li.context-menu-block-duplicate span:before { + font-family: 'dashicons'; + content: "\f105"; + } /* Unmirror Block */ #context-menu-block li.context-menu-block-unmirror span:before { diff --git a/wp-content/themes/headway/library/visual-editor/iframe-grid.php b/wp-content/themes/headway/library/visual-editor/iframe-grid.php index 575a22b..5d8d079 100644 --- a/wp-content/themes/headway/library/visual-editor/iframe-grid.php +++ b/wp-content/themes/headway/library/visual-editor/iframe-grid.php @@ -93,7 +93,7 @@ class HeadwayVisualEditorIframeGrid { } /* Output the wrapper */ - echo '
'; + echo '
'; echo '
'; diff --git a/wp-content/themes/headway/library/visual-editor/scripts-min/app.js b/wp-content/themes/headway/library/visual-editor/scripts-min/app.js index b2f7dbb..78decd7 100644 --- a/wp-content/themes/headway/library/visual-editor/scripts-min/app.js +++ b/wp-content/themes/headway/library/visual-editor/scripts-min/app.js @@ -1 +1 @@ -function ITStylesheet(e,t){return"undefined"!=typeof e.document&&(this.document=e.document,delete e.document),this.property_dom_names={},this.property_standard_names={},this.converted_rgb_values={},this.args="undefined"!=typeof e?e:{},this.action="undefined"!=typeof t?t:"load",this.init=function(){"find"===this.action?this._find_stylesheet():this._load_stylesheet()},this._load_stylesheet=function(){e=this.args;var t;"undefined"!=typeof e.href?(t=this.document.createElement("link"),t.href=e.href,this.type="link"):(t=this.document.createElement("style"),this.type="style"),t.type="text/css","undefined"!=typeof e.title&&(t.title=e.title),"undefined"!=typeof e.rel&&(t.rel=e.rel),"undefined"!=typeof e.media&&(t.media=e.media),"undefined"!=typeof e.href&&"undefined"==typeof e.rel&&(t.rel="stylesheet");var n="";"undefined"!=typeof e.content&&(n=e.content,delete e.content);var r=Math.floor(Math.random()*1e3)+1;this.$stylesheet_node=jQuery(t).insertBefore($i("style#live-css-holder")).addClass("ITStylesheet").attr("id","itstylesheet-"+r),this.stylesheet_node=this.$stylesheet_node[0];var i=this;jQuery.each(this.document.styleSheets,function(e,t){if(typeof t.ownerNode.id=="undefined"||!t.ownerNode.id||t.ownerNode.id!="itstylesheet-"+r)return;return i.stylesheet=t,!1}),this._find_rules(),""!==n&&this.set_rules(n)},this._find_stylesheet=function(){e=this.args;for(var t=0;t0){var r=t.shift();r=r.charAt(0).toUpperCase()+r.substr(1),n+=r}return this.property_dom_names[e]=n,n},this._get_property_standard_name=function(e){if("undefined"!=typeof this.property_standard_names[e])return this.property_standard_names[e];var t=e;return"padding-right-value"===e?t="padding-right":"padding-left-value"===e?t="padding-left":"margin-right-value"===e?t="margin-right":"margin-left-value"===e&&(t="margin-left"),this.property_standard_names[e]=t,t},this._delete_rule_at_index=function(e){this.stylesheet.deleteRule?this.stylesheet.deleteRule(e):this.stylesheet.removeRule(e)},this._get_stylesheet_rules=function(e){return e.cssRules?e.cssRules:e.rules},this._get_stylesheet_rules_object=function(e){var t=this._get_stylesheet_rules(e),n={},r=[];for(var i=0;i0)this._delete_rule_at_index(0)},this.delete_rule=function(e){var t=this.get_rule_index(e);return!1===t?!1:(this._delete_rule_at_index(t),!0)},this.delete_rule_property=function(e,t){var n={};n[t]=null,this.update_rule(e,n)},this._convert_rgb_to_hex=function(e){if("undefined"!=typeof this.converted_rgb_values[e])return this.converted_rgb_values[e];var t=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/.exec(e),n=parseInt(t[1]),r=parseInt(t[2]),i=parseInt(t[3]),s=i|r<<8|n<<16;hex=s.toString(16).toUpperCase();while(hex.length<6)hex="0"+hex;return this.converted_rgb_values[e]="#"+hex,"#"+hex},this.get_stylesheet_text=function(){var e=this._get_stylesheet_rules_object(this.stylesheet),t="",n=/^rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)/;for(selector in e){var r="";for(property in e[selector]){var i=e[selector][property];if("undefined"==typeof i)continue;n.test(i)&&(i=this._convert_rgb_to_hex(i)),r+=" "+property+": "+i+";\n"}if(""===r)continue;""!==t&&(t+="\n"),t+=selector+" {\n"+r+"}"}return t},this.get_computed_style=function(e){return window.getComputedStyle?window.getComputedStyle(e,""):e.currentStyle},this.set_rules=function(e){this.delete_all_rules(),"string"==typeof e&&(e=this._get_rules_obj_from_string(e));for(selector in e)this.update_rule(selector,e[selector])},this.init(),!0}define("util.misc",["jquery"],function(e){updateQueryStringParameter=function(e,t,n){var r=new RegExp("([?|&])"+t+"=.*?(&|$)","i"),i=e.indexOf("?")!==-1?"&":"?";return e.match(r)?e.replace(r,"$1"+t+"="+n+"$2"):e+i+t+"="+n},jQuery.fn.reverse=[].reverse,Number.prototype.toNearest=function(e){return Math.round(this/e)*e},Math._round=Math.round,Math.round=function(e,t){t=Math.abs(parseInt(t))||0;var n=Math.pow(10,t);return Math._round(e*n)/n},String.prototype.repeatStr=function(e){return e<=0?"":Array.prototype.join.call({length:e+1},this)},String.prototype.capitalize=function(){return this.replace(/(^|\s)([a-z])/g,function(e,t,n){return t+n.toUpperCase()})},hwBoolean=function(e){if(typeof e=="boolean")return e;if(typeof e=="undefined")return!1;if(typeof e=="number")return e===1?!0:e===0?!1:null;if(e===null)return!1;if(typeof e=="string"){var t=e.split(/\b/g);return t[0]==="1"||t[0]==="true"?!0:t[0]==="0"||t[0]==="false"?!1:null}return null},Number.prototype.toBool=function(){return this===1?!0:this===0?!1:null},String.prototype.toBool=function(){var e=this.split(/\b/g);return e[0]==="1"||e[0]==="true"?!0:e[0]==="0"||e[0]==="false"?!1:null},String.prototype.escapeHTML=function(){return this.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}}),define("util.loader",["jquery","util.misc"],function(e){createCog=function(t,n,r,i,s){if(e(t).length===0||e(t).find(".cog-container:visible").length)return!1;var r=typeof r=="undefined"?!1:r,o='
';return r?t.append(o):t.html(o),typeof s!="undefined"&&t.find(".cog-container").css({opacity:s}),!0},changeTitle=function(t){return e("title").text(t)},startTitleActivityIndicator=function(){return typeof titleActivityIndicatorInstance=="number"?!1:(titleActivityIndicatorInstance=window.setInterval(titleActivityIndicator,500),titleActivityIndicatorSavedTitle=e("title").text(),!0)},stopTitleActivityIndicator=function(){return typeof titleActivityIndicatorInstance!="number"?!1:(window.clearInterval(titleActivityIndicatorInstance),changeTitle(titleActivityIndicatorSavedTitle),delete titleActivityIndicatorCounter,delete titleActivityIndicatorSavedTitle,delete titleActivityIndicatorInstance,!0)},titleActivityIndicator=function(){typeof titleActivityIndicatorCounter=="undefined"&&(titleActivityIndicatorCounter=0,titleActivityIndicatorCounterPos=!0),titleActivityIndicatorCounterPos===!0?++titleActivityIndicatorCounter:--titleActivityIndicatorCounter,titleActivityIndicatorCounter===3?titleActivityIndicatorCounterPos=!1:titleActivityIndicatorCounter===0&&(titleActivityIndicatorCounterPos=!0);var e=titleActivityIndicatorSavedTitle+".".repeatStr(titleActivityIndicatorCounter);changeTitle(e)}}),function(){var DEBUG=!0;(function(undefined){var window=this||(0,eval)("this"),document=window.document,navigator=window.navigator,jQuery=window.jQuery,JSON=window.JSON;(function(e){if(typeof require=="function"&&typeof exports=="object"&&typeof module=="object"){var t=module.exports||exports;e(t)}else typeof define=="function"&&define.amd?define("ko",["exports"],e):e(window.ko={})})(function(e){function r(e,t){var r=e===null||typeof e in n;return r?e===t:!1}function i(e,t){var n;return function(){n||(n=setTimeout(function(){n=undefined,e()},t))}}function s(e,t){var n;return function(){clearTimeout(n),n=setTimeout(e,t)}}function o(e){var n=this;return e&&t.utils.objectForEach(e,function(e,r){var i=t.extenders[e];typeof i=="function"&&(n=i(n,r)||n)}),n}function d(e){t.bindingHandlers[e]={init:function(n,r,i,s,o){var u=function(){var t={};return t[e]=r(),t};return t.bindingHandlers.event.init.call(this,n,u,i,s,o)}}}function g(e,n,r,i){t.bindingHandlers[e]={init:function(e,s,o,u,a){var f,l;return t.computed(function(){var o=t.utils.unwrapObservable(s()),u=!r!=!o,c=!l,h=c||n||u!==f;h&&(c&&t.computedContext.getDependenciesCount()&&(l=t.utils.cloneNodes(t.virtualElements.childNodes(e),!0)),u?(c||t.virtualElements.setDomNodeChildren(e,t.utils.cloneNodes(l)),t.applyBindingsToDescendants(i?i(a,o):a,e)):t.virtualElements.emptyNode(e),f=u)},null,{disposeWhenNodeIsRemoved:e}),{controlsDescendantBindings:!0}}},t.expressionRewriting.bindingRewriteValidators[e]=!1,t.virtualElements.allowedBindings[e]=!0}var t=typeof e!="undefined"?e:{};t.exportSymbol=function(e,n){var r=e.split("."),i=t;for(var s=0;s",n[0]);return e>4?e:undefined}(),l=f===6,c=f===7;return{fieldsIncludedWithJsonPost:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],arrayForEach:function(e,t){for(var n=0,r=e.length;n0?e.splice(r,1):r===0&&e.shift()},arrayGetDistinctValues:function(e){e=e||[];var n=[];for(var r=0,i=e.length;r0){var i=r[0],s=i.parentNode;for(var o=0,u=n.length;o1){var n=e[0],r=e[e.length-1];e.length=0;while(n!==r){e.push(n),n=n.nextSibling;if(!n)return}e.push(r)}}return e},setOptionNodeSelectionState:function(e,t){f<7?e.setAttribute("selected",t):e.selected=t},stringTrim:function(e){return e===null||e===undefined?"":e.trim?e.trim():e.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},stringTokenize:function(e,n){var r=[],i=(e||"").split(n);for(var s=0,o=i.length;se.length?!1:e.substring(0,t.length)===t},domNodeIsContainedBy:function(e,t){if(e===t)return!0;if(e.nodeType===11)return!1;if(t.contains)return t.contains(e.nodeType===3?e.parentNode:e);if(t.compareDocumentPosition)return(t.compareDocumentPosition(e)&16)==16;while(e&&e!=t)e=e.parentNode;return!!e},domNodeIsAttachedToDocument:function(e){return t.utils.domNodeIsContainedBy(e,e.ownerDocument.documentElement)},anyDomNodeIsAttachedToDocument:function(e){return!!t.utils.arrayFirst(e,t.utils.domNodeIsAttachedToDocument)},tagNameLower:function(e){return e&&e.tagName&&e.tagName.toLowerCase()},registerEventHandler:function(e,n,r){var i=f&&a[n];if(!i&&jQuery)jQuery(e).bind(n,r);else if(!i&&typeof e.addEventListener=="function")e.addEventListener(n,r,!1);else{if(typeof e.attachEvent=="undefined")throw new Error("Browser doesn't support addEventListener or attachEvent");var s=function(t){r.call(e,t)},o="on"+n;e.attachEvent(o,s),t.utils.domNodeDisposal.addDisposeCallback(e,function(){e.detachEvent(o,s)})}},triggerEvent:function(e,t){if(!e||!e.nodeType)throw new Error("element must be a DOM node when calling triggerEvent");var n=h(e,t);if(jQuery&&!n)jQuery(e).trigger(t);else if(typeof document.createEvent=="function"){if(typeof e.dispatchEvent!="function")throw new Error("The supplied element doesn't support dispatchEvent");var r=o[t]||"HTMLEvents",i=document.createEvent(r);i.initEvent(t,!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,e),e.dispatchEvent(i)}else if(n&&e.click)e.click();else{if(typeof e.fireEvent=="undefined")throw new Error("Browser doesn't support triggering events");e.fireEvent("on"+t)}},unwrapObservable:function(e){return t.isObservable(e)?e():e},peekObservable:function(e){return t.isObservable(e)?e.peek():e},toggleDomNodeCssClass:function(e,n,r){if(n){var i=/\S+/g,s=e.className.match(i)||[];t.utils.arrayForEach(n.match(i),function(e){t.utils.addOrRemoveItem(s,e,r)}),e.className=s.join(" ")}},setTextContent:function(e,n){var r=t.utils.unwrapObservable(n);if(r===null||r===undefined)r="";var i=t.virtualElements.firstChild(e);!i||i.nodeType!=3||t.virtualElements.nextSibling(i)?t.virtualElements.setDomNodeChildren(e,[e.ownerDocument.createTextNode(r)]):i.data=r,t.utils.forceRefresh(e)},setElementName:function(e,t){e.name=t;if(f<=7)try{e.mergeAttributes(document.createElement(""),!1)}catch(n){}},forceRefresh:function(e){if(f>=9){var t=e.nodeType==1?e:e.parentNode;t.style&&(t.style.zoom=t.style.zoom)}},ensureSelectElementIsRenderedCorrectly:function(e){if(f){var t=e.style.width;e.style.width=0,e.style.width=t}},range:function(e,n){e=t.utils.unwrapObservable(e),n=t.utils.unwrapObservable(n);var r=[];for(var i=e;i<=n;i++)r.push(i);return r},makeArray:function(e){var t=[];for(var n=0,r=e.length;n=0;o--)i(r[o])&&s.push(r[o]);return s},parseJson:function(e){if(typeof e=="string"){e=t.utils.stringTrim(e);if(e)return JSON&&JSON.parse?JSON.parse(e):(new Function("return "+e))()}return null},stringifyJson:function(e,n,r){if(!JSON||!JSON.stringify)throw new Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");return JSON.stringify(t.utils.unwrapObservable(e),n,r)},postJson:function(n,r,i){i=i||{};var s=i.params||{},o=i.includeFields||this.fieldsIncludedWithJsonPost,u=n;if(typeof n=="object"&&t.utils.tagNameLower(n)==="form"){var a=n;u=a.action;for(var f=o.length-1;f>=0;f--){var l=t.utils.getFormFields(a,o[f]);for(var c=l.length-1;c>=0;c--)s[l[c].name]=l[c].value}}r=t.utils.unwrapObservable(r);var h=document.createElement("form");h.style.display="none",h.action=u,h.method="post";for(var p in r){var d=document.createElement("input");d.name=p,d.value=t.utils.stringifyJson(t.utils.unwrapObservable(r[p])),h.appendChild(d)}e(s,function(e,t){var n=document.createElement("input");n.name=e,n.value=t,h.appendChild(n)}),document.body.appendChild(h),i.submitter?i.submitter(h):h.submit(),setTimeout(function(){h.parentNode.removeChild(h)},0)}}}(),t.exportSymbol("utils",t.utils),t.exportSymbol("utils.arrayForEach",t.utils.arrayForEach),t.exportSymbol("utils.arrayFirst",t.utils.arrayFirst),t.exportSymbol("utils.arrayFilter",t.utils.arrayFilter),t.exportSymbol("utils.arrayGetDistinctValues",t.utils.arrayGetDistinctValues),t.exportSymbol("utils.arrayIndexOf",t.utils.arrayIndexOf),t.exportSymbol("utils.arrayMap",t.utils.arrayMap),t.exportSymbol("utils.arrayPushAll",t.utils.arrayPushAll),t.exportSymbol("utils.arrayRemoveItem",t.utils.arrayRemoveItem),t.exportSymbol("utils.extend",t.utils.extend),t.exportSymbol("utils.fieldsIncludedWithJsonPost",t.utils.fieldsIncludedWithJsonPost),t.exportSymbol("utils.getFormFields",t.utils.getFormFields),t.exportSymbol("utils.peekObservable",t.utils.peekObservable),t.exportSymbol("utils.postJson",t.utils.postJson),t.exportSymbol("utils.parseJson",t.utils.parseJson),t.exportSymbol("utils.registerEventHandler",t.utils.registerEventHandler),t.exportSymbol("utils.stringifyJson",t.utils.stringifyJson),t.exportSymbol("utils.range",t.utils.range),t.exportSymbol("utils.toggleDomNodeCssClass",t.utils.toggleDomNodeCssClass),t.exportSymbol("utils.triggerEvent",t.utils.triggerEvent),t.exportSymbol("utils.unwrapObservable",t.utils.unwrapObservable),t.exportSymbol("utils.objectForEach",t.utils.objectForEach),t.exportSymbol("utils.addOrRemoveItem",t.utils.addOrRemoveItem),t.exportSymbol("unwrap",t.utils.unwrapObservable),Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,n=Array.prototype.slice.call(arguments),e=n.shift();return function(){return t.apply(e,n.concat(Array.prototype.slice.call(arguments)))}}),t.utils.domData=new function(){function r(r,i){var s=r[t],o=s&&s!=="null"&&n[s];if(!o){if(!i)return undefined;s=r[t]="ko"+e++,n[s]={}}return n[s]}var e=0,t="__ko__"+(new Date).getTime(),n={};return{get:function(e,t){var n=r(e,!1);return n===undefined?undefined:n[t]},set:function(e,t,n){if(n===undefined&&r(e,!1)===undefined)return;var i=r(e,!0);i[t]=n},clear:function(e){var r=e[t];return r?(delete n[r],e[t]=null,!0):!1},nextKey:function(){return e++ +t}}},t.exportSymbol("utils.domData",t.utils.domData),t.exportSymbol("utils.domData.clear",t.utils.domData.clear),t.utils.domNodeDisposal=new function(){function i(n,r){var i=t.utils.domData.get(n,e);return i===undefined&&r&&(i=[],t.utils.domData.set(n,e,i)),i}function s(n){t.utils.domData.set(n,e,undefined)}function o(e){var n=i(e,!1);if(n){n=n.slice(0);for(var s=0;s",""]||!n.indexOf("",""]||(!n.indexOf("",""]||[0,"",""],s="ignored
"+i[1]+e+i[2]+"
";typeof window["innerShiv"]=="function"?r.appendChild(window.innerShiv(s)):r.innerHTML=s;while(i[0]--)r=r.lastChild;return t.utils.makeArray(r.lastChild.childNodes)}function r(e){if(jQuery.parseHTML)return jQuery.parseHTML(e)||[];var t=jQuery.clean([e]);if(t&&t[0]){var n=t[0];while(n.parentNode&&n.parentNode.nodeType!==11)n=n.parentNode;n.parentNode&&n.parentNode.removeChild(n)}return t}var e=/^(\s*)/;t.utils.parseHtmlFragment=function(e){return jQuery?r(e):n(e)},t.utils.setHtml=function(e,n){t.utils.emptyDomNode(e),n=t.utils.unwrapObservable(n);if(n!==null&&n!==undefined){typeof n!="string"&&(n=n.toString());if(jQuery)jQuery(e).html(n);else{var r=t.utils.parseHtmlFragment(n);for(var i=0;i"},unmemoize:function(t,n){var r=e[t];if(r===undefined)throw new Error("Couldn't find any memo with ID "+t+". Perhaps it's already been unmemoized.");try{return r.apply(null,n||[]),!0}finally{delete e[t]}},unmemoizeDomNodeAndDescendants:function(e,n){var r=[];i(e,r);for(var s=0,o=r.length;s0?(r.isDifferent(n,arguments[0])&&(r.valueWillMutate(),n=arguments[0],DEBUG&&(r._latestValue=n),r.valueHasMutated()),this):(t.dependencyDetection.registerDependency(r),n)}var n=e;return t.subscribable.call(r),t.utils.setPrototypeOfOrExtend(r,t.observable.fn),DEBUG&&(r._latestValue=n),r.peek=function(){return n},r.valueHasMutated=function(){r.notifySubscribers(n)},r.valueWillMutate=function(){r.notifySubscribers(n,"beforeChange")},t.exportProperty(r,"peek",r.peek),t.exportProperty(r,"valueHasMutated",r.valueHasMutated),t.exportProperty(r,"valueWillMutate",r.valueWillMutate),r},t.observable.fn={equalityComparer:r};var f=t.observable.protoProperty="__ko_proto__";t.observable.fn[f]=t.observable,t.utils.canSetPrototype&&t.utils.setPrototypeOf(t.observable.fn,t.subscribable.fn),t.hasPrototype=function(e,n){return e===null||e===undefined||e[f]===undefined?!1:e[f]===n?!0:t.hasPrototype(e[f],n)},t.isObservable=function(e){return t.hasPrototype(e,t.observable)},t.isWriteableObservable=function(e){return typeof e=="function"&&e[f]===t.observable?!0:typeof e=="function"&&e[f]===t.dependentObservable&&e.hasWriteFunction?!0:!1},t.exportSymbol("observable",t.observable),t.exportSymbol("isObservable",t.isObservable),t.exportSymbol("isWriteableObservable",t.isWriteableObservable),t.observableArray=function(e){e=e||[];if(typeof e=="object"&&"length"in e){var n=t.observable(e);return t.utils.setPrototypeOfOrExtend(n,t.observableArray.fn),n.extend({trackArrayChanges:!0})}throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined.")},t.observableArray.fn={remove:function(e){var n=this.peek(),r=[],i=typeof e=="function"&&!t.isObservable(e)?e:function(t){return t===e};for(var s=0;s=0}):[]},destroy:function(e){var n=this.peek(),r=typeof e=="function"&&!t.isObservable(e)?e:function(t){return t===e};this.valueWillMutate();for(var i=n.length-1;i>=0;i--){var s=n[i];r(s)&&(n[i]._destroy=!0)}this.valueHasMutated()},destroyAll:function(e){return e===undefined?this.destroy(function(){return!0}):e?this.destroy(function(n){return t.utils.arrayIndexOf(e,n)>=0}):[]},indexOf:function(e){var n=this();return t.utils.arrayIndexOf(n,e)},replace:function(e,t){var n=this.indexOf(e);n>=0&&(this.valueWillMutate(),this.peek()[n]=t,this.valueHasMutated())}},t.utils.arrayForEach(["pop","push","reverse","shift","sort","splice","unshift"],function(e){t.observableArray.fn[e]=function(){var t=this.peek();this.valueWillMutate(),this.cacheDiffForKnownOperation(t,e,arguments);var n=t[e].apply(t,arguments);return this.valueHasMutated(),n}}),t.utils.arrayForEach(["slice"],function(e){t.observableArray.fn[e]=function(){var t=this();return t[e].apply(t,arguments)}}),t.utils.canSetPrototype&&t.utils.setPrototypeOf(t.observableArray.fn,t.observable.fn),t.exportSymbol("observableArray",t.observableArray);var l="arrayChange";t.extenders.trackArrayChanges=function(e){function o(){if(n)return;n=!0;var t=e.notifySubscribers;e.notifySubscribers=function(e,n){return(!n||n===u)&&++i,t.apply(this,arguments)};var s=[].concat(e.peek()||[]);r=null,e.subscribe(function(t){t=[].concat(t||[]);if(e.hasSubscriptionsForEvent(l)){var n=a(s,t);n.length&&e.notifySubscribers(n,l)}s=t,r=null,i=0})}function a(e,n){if(!r||i>1)r=t.utils.compareArrays(e,n,{sparse:!0});return r}if(e.cacheDiffForKnownOperation)return;var n=!1,r=null,i=0,s=e.subscribe;e.subscribe=e.subscribe=function(e,t,n){return n===l&&o(),s.apply(this,arguments)},e.cacheDiffForKnownOperation=function(e,s,o){function c(e,t,n){return u[u.length]={status:e,value:t,index:n}}if(!n||i)return;var u=[],a=e.length,f=o.length,l=0;switch(s){case"push":l=a;case"unshift":for(var h=0;h=0?(clearTimeout(T),T=setTimeout(p,e)):d._evalRateLimited?d._evalRateLimited():p()}function p(){if(o)return;if(a)return;if(w&&w()){if(!u){E();return}}else u=!1;o=!0;try{var e=S,r=x;t.dependencyDetection.begin({callback:function(t,n){a||(r&&e[n]?(S[n]=e[n],++x,delete e[n],--r):l(t,n))},computed:d,isInitial:!x}),S={},x=0;try{var c=n?f.call(n):f()}finally{t.dependencyDetection.end(),r&&t.utils.objectForEach(e,function(e,t){t.dispose()}),s=!1}d.isDifferent(i,c)&&(d.notifySubscribers(i,"beforeChange"),i=c,DEBUG&&(d._latestValue=i),(!d._evalRateLimited||d.throttleEvaluation)&&d.notifySubscribers(i))}finally{o=!1}x||E()}function d(){if(arguments.length>0){if(typeof g!="function")throw new Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");return g.apply(n,arguments),this}return s&&p(),t.dependencyDetection.registerDependency(d),i}function v(){return s&&!x&&p(),i}function m(){return s||x>0}var i,s=!0,o=!1,u=!1,a=!1,f=e;f&&typeof f=="object"?(r=f,f=r.read):(r=r||{},f||(f=r.read));if(typeof f!="function")throw new Error("Pass a function that returns the value of the ko.computed");var g=r.write,y=r.disposeWhenNodeIsRemoved||r.disposeWhenNodeIsRemoved||null,b=r.disposeWhen||r.disposeWhen,w=b,E=c,S={},x=0,T=null;n||(n=r.owner),t.subscribable.call(d),t.utils.setPrototypeOfOrExtend(d,t.dependentObservable.fn),d.peek=v,d.getDependenciesCount=function(){return x},d.hasWriteFunction=typeof r.write=="function",d.dispose=function(){E()},d.isActive=m;var N=d.limit;return d.limit=function(e){N.call(d,e),d._evalRateLimited=function(){d._rateLimitedBeforeChange(i),s=!0,d._rateLimitedChange(d)}},t.exportProperty(d,"peek",d.peek),t.exportProperty(d,"dispose",d.dispose),t.exportProperty(d,"isActive",d.isActive),t.exportProperty(d,"getDependenciesCount",d.getDependenciesCount),y&&(u=!0,y.nodeType&&(w=function(){return!t.utils.domNodeIsAttachedToDocument(y)||b&&b()})),r.deferEvaluation!==!0&&p(),y&&m()&&y.nodeType&&(E=function(){t.utils.domNodeDisposal.removeDisposeCallback(y,E),c()},t.utils.domNodeDisposal.addDisposeCallback(y,E)),d},t.isComputed=function(e){return t.hasPrototype(e,t.dependentObservable)};var c=t.observable.protoProperty;t.dependentObservable[c]=t.observable,t.dependentObservable.fn={equalityComparer:r},t.dependentObservable.fn[c]=t.dependentObservable,t.utils.canSetPrototype&&t.utils.setPrototypeOf(t.dependentObservable.fn,t.subscribable.fn),t.exportSymbol("dependentObservable",t.dependentObservable),t.exportSymbol("computed",t.dependentObservable),t.exportSymbol("isComputed",t.isComputed),function(){function n(e,t,s){s=s||new i,e=t(e);var o=typeof e=="object"&&e!==null&&e!==undefined&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof Number)&&!(e instanceof Boolean);if(!o)return e;var u=e instanceof Array?[]:{};return s.save(e,u),r(e,function(r){var i=t(e[r]);switch(typeof i){case"boolean":case"number":case"string":case"function":u[r]=i;break;case"object":case"undefined":var o=s.get(i);u[r]=o!==undefined?o:n(i,t,s)}}),u}function r(e,t){if(e instanceof Array){for(var n=0;n=0?this.values[r]=n:(this.keys.push(e),this.values.push(n))},get:function(e){var n=t.utils.arrayIndexOf(this.keys,e);return n>=0?this.values[n]:undefined}}}(),t.exportSymbol("toJS",t.toJS),t.exportSymbol("toJSON",t.toJSON),function(){var e="__ko__hasDomDataOptionValue__";t.selectExtensions={readValue:function(n){switch(t.utils.tagNameLower(n)){case"option":if(n[e]===!0)return t.utils.domData.get(n,t.bindingHandlers.options.optionValueDomDataKey);return t.utils.ieVersion<=7?n.getAttributeNode("value")&&n.getAttributeNode("value").specified?n.value:n.text:n.value;case"select":return n.selectedIndex>=0?t.selectExtensions.readValue(n.options[n.selectedIndex]):undefined;default:return n.value}},writeValue:function(n,r,i){switch(t.utils.tagNameLower(n)){case"option":switch(typeof r){case"string":t.utils.domData.set(n,t.bindingHandlers.options.optionValueDomDataKey,undefined),e in n&&delete n[e],n.value=r;break;default:t.utils.domData.set(n,t.bindingHandlers.options.optionValueDomDataKey,r),n[e]=!0,n.value=typeof r=="number"?r:""}break;case"select":if(r===""||r===null)r=undefined;var s=-1;for(var o=0,u=n.options.length,a;o=0||r===undefined&&n.size>1)n.selectedIndex=s;break;default:if(r===null||r===undefined)r="";n.value=r}}}}(),t.exportSymbol("selectExtensions",t.selectExtensions),t.exportSymbol("selectExtensions.readValue",t.selectExtensions.readValue),t.exportSymbol("selectExtensions.writeValue",t.selectExtensions.writeValue),t.expressionRewriting=function(){function r(r){if(t.utils.arrayIndexOf(e,r)>=0)return!1;var i=r.match(n);return i===null?!1:i[1]?"Object("+i[1]+")"+i[2]:r}function p(e){var n=t.utils.stringTrim(e);n.charCodeAt(0)===123&&(n=n.slice(1,-1));var r=[],i=n.match(l),s,o,u=0;if(i){i.push(",");for(var a=0,f;f=i[a];++a){var p=f.charCodeAt(0);if(p===44){if(u<=0){s&&r.push(o?{key:s,value:o.join("")}:{unknown:s}),s=o=u=0;continue}}else if(p===58){if(!o)continue}else if(p===47&&a&&f.length>1){var d=i[a-1].match(c);d&&!h[d[0]]&&(n=n.substr(n.indexOf(f)+1),i=n.match(l),i.push(","),a=-1,f="/")}else if(p===40||p===123||p===91)++u;else if(p===41||p===125||p===93)--u;else if(!s&&!o){s=p===34||p===39?f.slice(1,-1):f;continue}o?o.push(f):o=[f]}}return r}function v(e,n){function i(e,n){function f(t){return t&&t.preprocess?n=t.preprocess(n,e,i):!0}var a;if(!f(t.getBindingHandler(e)))return;d[e]&&(a=r(n))&&o.push("'"+e+"':function(_z){"+a+"=_z}"),u&&(n="function(){return "+n+" }"),s.push("'"+e+"':"+n)}n=n||{};var s=[],o=[],u=n.valueAccessors,a=typeof e=="string"?p(e):e;return t.utils.arrayForEach(a,function(e){i(e.key||e.unknown,e.value)}),o.length&&i("_ko_property_writers","{"+o.join(",")+" }"),s.join(",")}var e=["true","false","null","undefined"],n=/^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i,i='"(?:[^"\\\\]|\\\\.)*"',s="'(?:[^'\\\\]|\\\\.)*'",o="/(?:[^/\\\\]|\\\\.)*/w*",u=",\"'{}()/:[\\]",a="[^\\s:,/][^"+u+"]*[^\\s"+u+"]",f="[^\\s]",l=RegExp(i+"|"+s+"|"+o+"|"+a+"|"+f,"g"),c=/[\])"'A-Za-z0-9_$]+$/,h={"in":1,"return":1,"typeof":1},d={};return{bindingRewriteValidators:[],twoWayBindings:d,parseObjectLiteral:p,preProcessBindings:v,keyValueArrayContainsKey:function(e,t){for(var n=0;n0?n[n.length-1].nextSibling:e.nextSibling:null}function f(e){var t=e.firstChild,n=null;if(t)do if(n)n.push(t);else if(s(t)){var r=a(t,!0);r?t=r:n=[t]}else o(t)&&(n=[t]);while(t=t.nextSibling);return n}var e=document&&document.createComment("test").text==="",n=e?/^$/:/^\s*ko(?:\s+([\s\S]+))?\s*$/,r=e?/^$/:/^\s*\/ko\s*$/,i={ul:!0,ol:!0};t.virtualElements={allowedBindings:{},childNodes:function(e){return s(e)?u(e):e.childNodes},emptyNode:function(e){if(!s(e))t.utils.emptyDomNode(e);else{var n=t.virtualElements.childNodes(e);for(var r=0,i=n.length;r=0:u?e.checked=r:e.checked=i()===r}var u=e.type=="checkbox",a=e.type=="radio";if(!u&&!a)return;var f=u&&t.utils.unwrapObservable(n())instanceof Array,l=f?i():undefined,c=a||f;a&&!e.name&&t.bindingHandlers.uniqueName.init(e,function(){return!0}),t.computed(s,null,{disposeWhenNodeIsRemoved:e}),t.utils.registerEventHandler(e,"click",s),t.computed(o,null,{disposeWhenNodeIsRemoved:e})}},t.expressionRewriting.twoWayBindings.checked=!0,t.bindingHandlers.checkedValue={update:function(e,n){e.value=t.utils.unwrapObservable(n())}}}();var p="__ko__cssValue";t.bindingHandlers.css={update:function(e,n){var r=t.utils.unwrapObservable(n());typeof r=="object"?t.utils.objectForEach(r,function(n,r){r=t.utils.unwrapObservable(r),t.utils.toggleDomNodeCssClass(e,n,r)}):(r=String(r||""),t.utils.toggleDomNodeCssClass(e,e[p],!1),e[p]=r,t.utils.toggleDomNodeCssClass(e,r,!0))}},t.bindingHandlers.enable={update:function(e,n){var r=t.utils.unwrapObservable(n());r&&e.disabled?e.removeAttribute("disabled"):!r&&!e.disabled&&(e.disabled=!0)}},t.bindingHandlers.disable={update:function(e,n){t.bindingHandlers.enable.update(e,function(){return!t.utils.unwrapObservable(n())})}},t.bindingHandlers.event={init:function(e,n,r,i,s){var o=n()||{};t.utils.objectForEach(o,function(o){typeof o=="string"&&t.utils.registerEventHandler(e,o,function(e){var u,a=n()[o];if(!a)return;try{var f=t.utils.makeArray(arguments);i=s.$data,f.unshift(i),u=a.apply(i,f)}finally{u!==!0&&(e.preventDefault?e.preventDefault():e.returnValue=!1)}var l=r.get(o+"Bubble")!==!1;l||(e.cancelBubble=!0,e.stopPropagation&&e.stopPropagation())})})}},t.bindingHandlers.foreach={makeTemplateValueAccessor:function(e){return function(){var n=e(),r=t.utils.peekObservable(n);return!r||typeof r.length=="number"?{foreach:n,templateEngine:t.nativeTemplateEngine.instance}:(t.utils.unwrapObservable(n),{foreach:r.data,as:r.as,includeDestroyed:r.includeDestroyed,afterAdd:r.afterAdd,beforeRemove:r.beforeRemove,afterRender:r.afterRender,beforeMove:r.beforeMove,afterMove:r.afterMove,templateEngine:t.nativeTemplateEngine.instance})}},init:function(e,n,r,i,s){return t.bindingHandlers.template.init(e,t.bindingHandlers.foreach.makeTemplateValueAccessor(n))},update:function(e,n,r,i,s){return t.bindingHandlers.template.update(e,t.bindingHandlers.foreach.makeTemplateValueAccessor(n),r,i,s)}},t.expressionRewriting.bindingRewriteValidators.foreach=!1,t.virtualElements.allowedBindings.foreach=!0;var v="__ko_hasfocusUpdating",m="__ko_hasfocusLastValue";t.bindingHandlers.hasfocus={init:function(e,n,r){var i=function(i){e[v]=!0;var s=e.ownerDocument;if("activeElement"in s){var o;try{o=s.activeElement}catch(u){o=s.body}i=o===e}var a=n();t.expressionRewriting.writeValueToProperty(a,r,"hasfocus",i,!0),e[m]=i,e[v]=!1},s=i.bind(null,!0),o=i.bind(null,!1);t.utils.registerEventHandler(e,"focus",s),t.utils.registerEventHandler(e,"focusin",s),t.utils.registerEventHandler(e,"blur",o),t.utils.registerEventHandler(e,"focusout",o)},update:function(e,n){var r=!!t.utils.unwrapObservable(n());!e[v]&&e[m]!==r&&(r?e.focus():e.blur(),t.dependencyDetection.ignore(t.utils.triggerEvent,null,[e,r?"focusin":"focusout"]))}},t.expressionRewriting.twoWayBindings.hasfocus=!0,t.bindingHandlers.hasFocus=t.bindingHandlers.hasfocus,t.expressionRewriting.twoWayBindings.hasFocus=!0,t.bindingHandlers.html={init:function(){return{controlsDescendantBindings:!0}},update:function(e,n){t.utils.setHtml(e,n())}},g("if"),g("ifnot",!1,!0),g("with",!0,!1,function(e,t){return e.createChildContext(t)});var y={};t.bindingHandlers.options={init:function(e){if(t.utils.tagNameLower(e)!=="select")throw new Error("options binding applies only to SELECT elements");while(e.length>0)e.remove(0);return{controlsDescendantBindings:!0}},update:function(e,n,r){function i(){return t.utils.arrayFilter(e.options,function(e){return e.selected})}function p(e,t,n){var r=typeof t;return r=="function"?t(e):r=="string"?e[t]:n}function v(n,i,s){s.length&&(h=s[0].selected?[t.selectExtensions.readValue(s[0])]:[],d=!0);var o=e.ownerDocument.createElement("option");if(n===y)t.utils.setTextContent(o,r.get("optionsCaption")),t.selectExtensions.writeValue(o,undefined);else{var u=p(n,r.get("optionsValue"),n);t.selectExtensions.writeValue(o,t.utils.unwrapObservable(u));var a=p(n,r.get("optionsText"),u);t.utils.setTextContent(o,a)}return[o]}function m(n,r){if(h.length){var i=t.utils.arrayIndexOf(h,t.selectExtensions.readValue(r[0]))>=0;t.utils.setOptionNodeSelectionState(r[0],i),d&&!i&&t.dependencyDetection.ignore(t.utils.triggerEvent,null,[e,"change"])}}var s=e.length==0,o=!s&&e.multiple?e.scrollTop:null,u=t.utils.unwrapObservable(n()),a=r.get("optionsIncludeDestroyed"),f={},l,c,h;e.multiple?h=t.utils.arrayMap(i(),t.selectExtensions.readValue):h=e.selectedIndex>=0?[t.selectExtensions.readValue(e.options[e.selectedIndex])]:[],u&&(typeof u.length=="undefined"&&(u=[u]),c=t.utils.arrayFilter(u,function(e){return a||e===undefined||e===null||!t.utils.unwrapObservable(e._destroy)}),r.has("optionsCaption")&&(l=t.utils.unwrapObservable(r.get("optionsCaption")),l!==null&&l!==undefined&&c.unshift(y)));var d=!1;f.beforeRemove=function(t){e.removeChild(t)};var g=m;r.has("optionsAfterRender")&&(g=function(e,n){m(e,n),t.dependencyDetection.ignore(r.get("optionsAfterRender"),null,[n[0],e!==y?e:undefined])}),t.utils.setDomNodeChildrenFromArrayMapping(e,c,v,f,g),t.dependencyDetection.ignore(function(){if(r.get("valueAllowUnset")&&r.has("value"))t.selectExtensions.writeValue(e,t.utils.unwrapObservable(r.get("value")),!0);else{var n;e.multiple?n=h.length&&i().length=0?t.selectExtensions.readValue(e.options[e.selectedIndex])!==h[0]:h.length||e.selectedIndex>=0,n&&t.utils.triggerEvent(e,"change")}}),t.utils.ensureSelectElementIsRenderedCorrectly(e),o&&Math.abs(o-e.scrollTop)>20&&(e.scrollTop=o)}},t.bindingHandlers.options.optionValueDomDataKey=t.utils.domData.nextKey(),t.bindingHandlers.selectedOptions={after:["options","foreach"],init:function(e,n,r){t.utils.registerEventHandler(e,"change",function(){var i=n(),s=[];t.utils.arrayForEach(e.getElementsByTagName("option"),function(e){e.selected&&s.push(t.selectExtensions.readValue(e))}),t.expressionRewriting.writeValueToProperty(i,r,"selectedOptions",s)})},update:function(e,n){if(t.utils.tagNameLower(e)!="select")throw new Error("values binding applies only to SELECT elements");var r=t.utils.unwrapObservable(n());r&&typeof r.length=="number"&&t.utils.arrayForEach(e.getElementsByTagName("option"),function(e){var n=t.utils.arrayIndexOf(r,t.selectExtensions.readValue(e))>=0;t.utils.setOptionNodeSelectionState(e,n)})}},t.expressionRewriting.twoWayBindings.selectedOptions=!0,t.bindingHandlers.style={update:function(e,n){var r=t.utils.unwrapObservable(n()||{});t.utils.objectForEach(r,function(n,r){r=t.utils.unwrapObservable(r),e.style[n]=r||""})}},t.bindingHandlers.submit={init:function(e,n,r,i,s){if(typeof n()!="function")throw new Error("The value for a submit binding must be a function");t.utils.registerEventHandler(e,"submit",function(t){var r,i=n();try{r=i.call(s.$data,e)}finally{r!==!0&&(t.preventDefault?t.preventDefault():t.returnValue=!1)}})}},t.bindingHandlers.text={init:function(){return{controlsDescendantBindings:!0}},update:function(e,n){t.utils.setTextContent(e,n())}},t.virtualElements.allowedBindings.text=!0,t.bindingHandlers.uniqueName={init:function(e,n){if(n()){var r="ko_unique_"+ ++t.bindingHandlers.uniqueName.currentIndex;t.utils.setElementName(e,r)}}},t.bindingHandlers.uniqueName.currentIndex=0,t.bindingHandlers.value={after:["options","foreach"],init:function(e,n,r){var i=["change"],s=r.get("valueUpdate"),o=!1;s&&(typeof s=="string"&&(s=[s]),t.utils.arrayPushAll(i,s),i=t.utils.arrayGetDistinctValues(i));var u=function(){o=!1;var i=n(),s=t.selectExtensions.readValue(e);t.expressionRewriting.writeValueToProperty(i,r,"value",s)},a=t.utils.ieVersion&&e.tagName.toLowerCase()=="input"&&e.type=="text"&&e.autocomplete!="off"&&(!e.form||e.form.autocomplete!="off");a&&t.utils.arrayIndexOf(i,"propertychange")==-1&&(t.utils.registerEventHandler(e,"propertychange",function(){o=!0}),t.utils.registerEventHandler(e,"focus",function(){o=!1}),t.utils.registerEventHandler(e,"blur",function(){o&&u()})),t.utils.arrayForEach(i,function(n){var r=u;t.utils.stringStartsWith(n,"after")&&(r=function(){setTimeout(u,0)},n=n.substring("after".length)),t.utils.registerEventHandler(e,n,r)})},update:function(e,n,r){var i=t.utils.unwrapObservable(n()),s=t.selectExtensions.readValue(e),o=i!==s;if(o)if(t.utils.tagNameLower(e)==="select"){var u=r.get("valueAllowUnset"),a=function(){t.selectExtensions.writeValue(e,i,u)};a(),!u&&i!==t.selectExtensions.readValue(e)?t.dependencyDetection.ignore(t.utils.triggerEvent,null,[e,"change"]):setTimeout(a,0)}else t.selectExtensions.writeValue(e,i)}},t.expressionRewriting.twoWayBindings.value=!0,t.bindingHandlers.visible={update:function(e,n){var r=t.utils.unwrapObservable(n()),i=e.style.display!="none";r&&!i?e.style.display="":!r&&i&&(e.style.display="none")}},d("click"),t.templateEngine=function(){},t.templateEngine.prototype.renderTemplateSource=function(e,t,n){throw new Error("Override renderTemplateSource")},t.templateEngine.prototype.createJavaScriptEvaluatorBlock=function(e){throw new Error("Override createJavaScriptEvaluatorBlock")},t.templateEngine.prototype.makeTemplateSource=function(e,n){if(typeof e=="string"){n=n||document;var r=n.getElementById(e);if(!r)throw new Error("Cannot find template with ID "+e);return new t.templateSources.domElement(r)}if(e.nodeType==1||e.nodeType==8)return new t.templateSources.anonymousTemplate(e);throw new Error("Unknown template type: "+e)},t.templateEngine.prototype.renderTemplate=function(e,t,n,r){var i=this.makeTemplateSource(e,r);return this.renderTemplateSource(i,t,n)},t.templateEngine.prototype.isTemplateRewritten=function(e,t){return this.allowTemplateRewriting===!1?!0:this.makeTemplateSource(e,t).data("isRewritten")},t.templateEngine.prototype.rewriteTemplate=function(e,t,n){var r=this.makeTemplateSource(e,n),i=t(r.text());r.text(i),r.data("isRewritten",!0)},t.exportSymbol("templateEngine",t.templateEngine),t.templateRewriting=function(){function r(e){var n=t.expressionRewriting.bindingRewriteValidators;for(var r=0;r/g;return{ensureTemplateIsRewritten:function(e,n,r){n.isTemplateRewritten(e,r)||n.rewriteTemplate(e,function(e){return t.templateRewriting.memoizeBindingAttributeSyntax(e,n)},r)},memoizeBindingAttributeSyntax:function(t,r){return t.replace(e,function(){return i(arguments[4],arguments[1],arguments[2],r)}).replace(n,function(){return i(arguments[1],"","#comment",r)})},applyMemoizedBindingsToNextSibling:function(e,n){return t.memoization.memoize(function(r,i){var s=r.nextSibling;s&&s.nodeName.toLowerCase()===n&&t.applyBindingAccessorsToNode(s,e,i)})}}}(),t.exportSymbol("__tr_ambtns",t.templateRewriting.applyMemoizedBindingsToNextSibling),function(){t.templateSources={},t.templateSources.domElement=function(e){this.domElement=e},t.templateSources.domElement.prototype.text=function(){var e=t.utils.tagNameLower(this.domElement),n=e==="script"?"text":e==="textarea"?"value":"innerHTML";if(arguments.length==0)return this.domElement[n];var r=arguments[0];n==="innerHTML"?t.utils.setHtml(this.domElement,r):this.domElement[n]=r};var e=t.utils.domData.nextKey()+"_";t.templateSources.domElement.prototype.data=function(n){if(arguments.length===1)return t.utils.domData.get(this.domElement,e+n);t.utils.domData.set(this.domElement,e+n,arguments[1])};var n=t.utils.domData.nextKey();t.templateSources.anonymousTemplate=function(e){this.domElement=e},t.templateSources.anonymousTemplate.prototype=new t.templateSources.domElement,t.templateSources.anonymousTemplate.prototype.constructor=t.templateSources.anonymousTemplate,t.templateSources.anonymousTemplate.prototype.text=function(){if(arguments.length==0){var e=t.utils.domData.get(this.domElement,n)||{};return e.textData===undefined&&e.containerData&&(e.textData=e.containerData.innerHTML),e.textData}var r=arguments[0];t.utils.domData.set(this.domElement,n,{textData:r})},t.templateSources.domElement.prototype.nodes=function(){if(arguments.length==0){var e=t.utils.domData.get(this.domElement,n)||{};return e.containerData}var r=arguments[0];t.utils.domData.set(this.domElement,n,{containerData:r})},t.exportSymbol("templateSources",t.templateSources),t.exportSymbol("templateSources.domElement",t.templateSources.domElement),t.exportSymbol("templateSources.anonymousTemplate",t.templateSources.anonymousTemplate)}(),function(){function n(e,n,r){var i,s=e,o=t.virtualElements.nextSibling(n);while(s&&(i=s)!==o)s=t.virtualElements.nextSibling(i),r(i,s)}function r(e,r){if(e.length){var i=e[0],s=e[e.length-1],o=i.parentNode,u=t.bindingProvider.instance,a=u.preprocessNode;if(a){n(i,s,function(e,t){var n=e.previousSibling,r=a.call(u,e);r&&(e===i&&(i=r[0]||t),e===s&&(s=r[r.length-1]||n))}),e.length=0;if(!i)return;i===s?e.push(i):(e.push(i,s),t.utils.fixUpContinuousNodeArray(e,o))}n(i,s,function(e){(e.nodeType===1||e.nodeType===8)&&t.applyBindings(r,e)}),n(i,s,function(e){(e.nodeType===1||e.nodeType===8)&&t.memoization.unmemoizeDomNodeAndDescendants(e,[r])}),t.utils.fixUpContinuousNodeArray(e,o)}}function i(e){return e.nodeType?e:e.length>0?e[0]:null}function s(n,s,o,u,a){a=a||{};var f=n&&i(n),l=f&&f.ownerDocument,c=a.templateEngine||e;t.templateRewriting.ensureTemplateIsRewritten(o,c,l);var h=c.renderTemplate(o,u,a,l);if(typeof h.length!="number"||h.length>0&&typeof h[0].nodeType!="number")throw new Error("Template engine must return an array of DOM nodes");var p=!1;switch(s){case"replaceChildren":t.virtualElements.setDomNodeChildren(n,h),p=!0;break;case"replaceNode":t.utils.replaceDomNodes(n,h),p=!0;break;case"ignoreTargetNode":break;default:throw new Error("Unknown renderMode: "+s)}return p&&(r(h,u),a.afterRender&&t.dependencyDetection.ignore(a.afterRender,null,[h,u.$data])),h}function u(e,n){var r=t.utils.domData.get(e,o);r&&typeof r.dispose=="function"&&r.dispose(),t.utils.domData.set(e,o,n&&n.isActive()?n:undefined)}var e;t.setTemplateEngine=function(n){if(!(n==undefined||n instanceof t.templateEngine))throw new Error("templateEngine must inherit from ko.templateEngine");e=n},t.renderTemplate=function(n,r,o,u,a){o=o||{};if((o["templateEngine"]||e)==undefined)throw new Error("Set a template engine before calling renderTemplate");a=a||"replaceChildren";if(u){var f=i(u),l=function(){return!f||!t.utils.domNodeIsAttachedToDocument(f)},c=f&&a=="replaceNode"?f.parentNode:f;return t.dependentObservable(function(){var e=r&&r instanceof t.bindingContext?r:new t.bindingContext(t.utils.unwrapObservable(r)),l=t.isObservable(n)?n():typeof n=="function"?n(e.$data,e):n,c=s(u,a,l,e,o);a=="replaceNode"&&(u=c,f=i(u))},null,{disposeWhen:l,disposeWhenNodeIsRemoved:c})}return t.memoization.memoize(function(e){t.renderTemplate(n,r,o,e,"replaceNode")})},t.renderTemplateForEach=function(e,n,i,o,u){var a,f=function(t,n){a=u.createChildContext(t,i.as,function(e){e.$index=n});var r=typeof e=="function"?e(t,a):e;return s(null,"ignoreTargetNode",r,a,i)},l=function(e,t,n){r(t,a),i.afterRender&&i.afterRender(t,e)};return t.dependentObservable(function(){var e=t.utils.unwrapObservable(n)||[];typeof e.length=="undefined"&&(e=[e]);var r=t.utils.arrayFilter(e,function(e){return i.includeDestroyed||e===undefined||e===null||!t.utils.unwrapObservable(e._destroy)});t.dependencyDetection.ignore(t.utils.setDomNodeChildrenFromArrayMapping,null,[o,r,f,i,l])},null,{disposeWhenNodeIsRemoved:o})};var o=t.utils.domData.nextKey();t.bindingHandlers.template={init:function(e,n){var r=t.utils.unwrapObservable(n());if(typeof r=="string"||r.name)t.virtualElements.emptyNode(e);else{var i=t.virtualElements.childNodes(e),s=t.utils.moveCleanedNodesToContainerElement(i);(new t.templateSources.anonymousTemplate(e)).nodes(s)}return{controlsDescendantBindings:!0}},update:function(e,n,r,i,s){var o=n(),a,f=t.utils.unwrapObservable(o),l=!0,c=null,h;typeof f=="string"?(h=o,f={}):(h=f.name,"if"in f&&(l=t.utils.unwrapObservable(f["if"])),l&&"ifnot"in f&&(l=!t.utils.unwrapObservable(f.ifnot)),a=t.utils.unwrapObservable(f.data));if("foreach"in f){var p=l&&f.foreach||[];c=t.renderTemplateForEach(h||e,p,f,e,s)}else if(!l)t.virtualElements.emptyNode(e);else{var d="data"in f?s.createChildContext(a,f.as):s;c=t.renderTemplate(h||e,d,f,e)}u(e,c)}},t.expressionRewriting.bindingRewriteValidators.template=function(e){var n=t.expressionRewriting.parseObjectLiteral(e);return n.length==1&&n[0].unknown?null:t.expressionRewriting.keyValueArrayContainsKey(n,"name")?null:"This template engine does not support anonymous templates nested within its templates"},t.virtualElements.allowedBindings.template=!0}(),t.exportSymbol("setTemplateEngine",t.setTemplateEngine),t.exportSymbol("renderTemplate",t.renderTemplate),t.utils.findMovesInArrayComparison=function(e,t,n){if(e.length&&t.length){var r,i,s,o,u;for(r=i=0;(!n||r0&&(t.utils.replaceDomNodes(o,u),i&&t.dependencyDetection.ignore(i,null,[r,u,s])),o.length=0,t.utils.arrayPushAll(o,u)},null,{disposeWhenNodeIsRemoved:e,disposeWhen:function(){return!t.utils.anyDomNodeIsAttachedToDocument(o)}});return{mappedNodes:o,dependentObservable:u.isActive()?u:undefined}}var n=t.utils.domData.nextKey();t.utils.setDomNodeChildrenFromArrayMapping=function(r,i,s,o,u){function E(e,n){w=f[n],d!==n&&(y[e]=w),w.indexObservable(d++),t.utils.fixUpContinuousNodeArray(w.mappedNodes,r),h.push(w),m.push(w)}function S(e,n){if(e)for(var r=0,i=n.length;r=0)return 2}catch(e){}return 1}();this.renderTemplateSource=function(e,r,i){i=i||{},t();var s=e.data("precompiled");if(!s){var o=e.text()||"";o="{{ko_with $item.koBindingContext}}"+o+"{{/ko_with}}",s=jQuery.template(null,o),e.data("precompiled",s)}var u=[r.$data],a=jQuery.extend({koBindingContext:r},i.templateOptions),f=n(s,u,a);return f.appendTo(document.createElement("div")),jQuery.fragments={},f},this.createJavaScriptEvaluatorBlock=function(e){return"{{ko_code ((function() { return "+e+" })()) }}"},this.addTemplate=function(e,t){document.write("'; } + + + public static function iframe_tooltip_container() { + + echo '
'; + + } } \ No newline at end of file diff --git a/wp-content/themes/headway/library/wrappers/wrapper-options.php b/wp-content/themes/headway/library/wrappers/wrapper-options.php index c6676df..eb5ce84 100644 --- a/wp-content/themes/headway/library/wrappers/wrapper-options.php +++ b/wp-content/themes/headway/library/wrappers/wrapper-options.php @@ -185,6 +185,7 @@ class HeadwayWrapperOptions extends HeadwayVisualEditorPanelAPI { 'css-classes' => array( 'type' => 'text', 'name' => 'css-classes', + 'callback' => 'updateWrapperCustomClasses(args.wrapper.id, value);', 'label' => 'Custom CSS Class(es)', 'default' => '', 'tooltip' => 'Need more finite control? Enter the custom CSS class selectors here and they will be added to the wrappers\'s class attribute. DO NOT put regular CSS in here. Use the Live CSS editor for that.' @@ -330,6 +331,16 @@ class HeadwayWrapperOptions extends HeadwayVisualEditorPanelAPI { function modify_arguments($args = false) { + + /* Do not show Wrapper Setup tab in the Design Mode */ + if ( headway_post('mode') == 'design') { + + unset($this->tabs['setup']); + unset($this->inputs['setup']); + + return; + + } /* Grid Settings Defaults */ $this->inputs['setup']['column-width']['default'] = HeadwayWrappers::$default_column_width; diff --git a/wp-content/themes/headway/style.css b/wp-content/themes/headway/style.css index cb802fc..656d738 100644 --- a/wp-content/themes/headway/style.css +++ b/wp-content/themes/headway/style.css @@ -1,7 +1,7 @@ /* THEME NAME:Headway Base THEME URI:http://www.headwaythemes.com -VERSION:3.7.8 +VERSION:3.7.9 AUTHOR:Headway Themes AUTHOR URI:http://www.headwaythemes.com DESCRIPTION:Headway is a feature-packed theme with drag and drop layout editing, point and click design capabilities, powerful search engine optimization and much more. For help, you can access our support or go to the Headway documentation. -- 2.17.1