| @@ -1,15 +1,17 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | - * Page Name: JS Code | |
| 3 | + * Page Name: JS | |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | use WPCoder\Dashboard\Field; |
| 7 | 7 | use WPCoder\Dashboard\FolderManager; |
| 8 | +use WPCoder\Dashboard\Option; | |
| 8 | 9 | |
| 9 | 10 | defined( 'ABSPATH' ) || exit; |
| 10 | 11 | |
| 11 | 12 | $default = Field::getDefault(); |
| 13 | +$opt = include( 'options/js-code.php' ); | |
| 12 | 14 | |
| 13 | 15 | $js_link = ''; |
| 14 | 16 | if ( ! empty( $default['js_code'] ) ) { |
| 15 | 17 | $js_link = FolderManager::path_upload_url() . 'script-' . $default['id'] . '.js'; |
| @@ -15,61 +17,42 @@ | ||
| 15 | 17 | $js_link = FolderManager::path_upload_url() . 'script-' . $default['id'] . '.js'; |
| 16 | 18 | } |
| 17 | 19 | |
| 18 | 20 | ?> |
| 19 | - <h4> | |
| 20 | - <span class="wowp-icon wowp-icon-js"></span> | |
| 21 | - <?php esc_html_e( 'JavaScript Code', 'wpcoder' ); ?> | |
| 22 | - </h4> | |
| 23 | 21 | |
| 24 | - <fieldset> | |
| 25 | - <legend><?php esc_html_e( 'Settings', 'wpcoder' ); ?></legend> | |
| 22 | + <div class="wowp-settings__page"> | |
| 23 | + <div class="wowp-settings__page-sidebar"> | |
| 26 | 24 | |
| 27 | - <div class="wowp-field has-chackbox"> | |
| 28 | - <span class="label"><?php esc_html_e( 'JQuery Dependency', 'wpcoder' ); ?></span> | |
| 29 | - <?php Field::checkbox( '[jquery_dependency]' ); ?> | |
| 30 | - <label for="jquery_dependency">Disable</label> | |
| 31 | - </div> | |
| 25 | + <?php Option::init( [ | |
| 26 | + $opt['jquery'], | |
| 27 | + $opt['inline'], | |
| 28 | + $opt['minified'], | |
| 29 | + $opt['attributes'], | |
| 30 | + ] ); ?> | |
| 32 | 31 | |
| 33 | - <div class="wowp-field has-chackbox"> | |
| 34 | - <span class="label"><?php esc_html_e( 'Inline', 'wpcoder' ); ?></span> | |
| 35 | - <?php Field::checkbox( '[inline_js]' ); ?> | |
| 36 | - <label for="inline_js">Enable</label> | |
| 37 | - </div> | |
| 32 | + <button class="button-editor button" id="jsnav"><?php esc_html_e( 'Add NAV Comment', 'wp-coder' ); ?></button> | |
| 33 | + <ol id="jsNavigationMenu" class="wowp-php-nav-menu"></ol> | |
| 38 | 34 | |
| 39 | - <div class="wowp-field"> | |
| 40 | - <label for="js_attributes" class="label"><?php esc_html_e( 'Minified', 'wpcoder' ); ?></label> | |
| 41 | - <?php Field::select( '[minified_js]', 'obfuscate', [ | |
| 42 | - 'none' => 'none', | |
| 43 | - 'minify' => 'Minify', | |
| 44 | - 'obfuscate' => 'Obfuscate' | |
| 45 | - ] ); ?> | |
| 46 | 35 | </div> |
| 36 | + <div class="wowp-settings__page-content"> | |
| 37 | + <?php Field::textarea( 'js_code' ); ?> | |
| 47 | 38 | |
| 48 | - <div class="wowp-field"> | |
| 49 | - <label for="js_attributes" class="label"><?php esc_html_e( 'Attribute', 'wpcoder' ); ?></label> | |
| 50 | - <?php Field::select( '[js_attributes]', null, [ | |
| 51 | - 0 => 'none', | |
| 52 | - 'defer' => 'defer', | |
| 53 | - 'async' => 'async' | |
| 54 | - ] ); ?> | |
| 55 | - </div> | |
| 39 | + <div class="wowp-notification notification-info"> | |
| 40 | + Just enter the JavaScript content. You don’t need to include <code><script></code> — it's already on the page. | |
| 41 | + </div> | |
| 56 | 42 | |
| 57 | - </fieldset> | |
| 43 | + <?php if ( ! empty( $js_link ) ): ?> | |
| 44 | + <div class="wowp-field has-addon"> | |
| 45 | + <span class="label"><?php esc_html_e( 'JS File URL', 'wp-coder' ); ?></span> | |
| 46 | + <label for="tag" class="label is-addon"><span | |
| 47 | + class="dashicons dashicons-admin-links"></span></label> | |
| 48 | + <input type="url" id="url-js-file" readonly="readonly" value="<?php echo esc_url( $js_link ); ?>"> | |
| 49 | + </div> | |
| 50 | + <?php endif; ?> | |
| 58 | 51 | |
| 59 | 52 | |
| 60 | -<?php Field::textarea( 'js_code' ); ?> | |
| 61 | - | |
| 62 | -<?php if ( ! empty( $js_link ) ): ?> | |
| 63 | - <div class="wowp-fields-group has-mt"> | |
| 64 | - <div class="wowp-field is-full has-addon border-default"> | |
| 65 | - <label for="url-css-file" class="is-addon"> | |
| 66 | - <span class="dashicons dashicons-admin-links"></span> | |
| 67 | - </label> | |
| 68 | - <input type="url" id="url-css-file" readonly="readonly" value="<?php echo esc_url( $js_link ); ?>"> | |
| 69 | - <span class="label"><?php esc_html_e( 'URL to the JS file', 'wpcoder' ); ?></span> | |
| 70 | 53 | </div> |
| 71 | 54 | </div> |
| 72 | -<?php endif; ?> | |
| 73 | 55 | |
| 56 | +<?php | |
| 74 | 57 | |
| 75 | -<?php | |
| 58 | + | |