| @@ -1,17 +1,15 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | - * Page Name: JS | |
| 3 | + * Page Name: JS Code | |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | use WPCoder\Dashboard\Field; |
| 7 | 7 | use WPCoder\Dashboard\FolderManager; |
| 8 | -use WPCoder\Dashboard\Option; | |
| 9 | 8 | |
| 10 | 9 | defined( 'ABSPATH' ) || exit; |
| 11 | 10 | |
| 12 | 11 | $default = Field::getDefault(); |
| 13 | -$opt = include( 'options/js-code.php' ); | |
| 14 | 12 | |
| 15 | 13 | $js_link = ''; |
| 16 | 14 | if ( ! empty( $default['js_code'] ) ) { |
| 17 | 15 | $js_link = FolderManager::path_upload_url() . 'script-' . $default['id'] . '.js'; |
| @@ -18,9 +16,9 @@ | ||
| 18 | 16 | } |
| 19 | 17 | |
| 20 | 18 | ?> |
| 21 | 19 | <h4> |
| 22 | - <span class="codericon codericon-filetype-js"></span> | |
| 20 | + <span class="wowp-icon wowp-icon-js"></span> | |
| 23 | 21 | <?php esc_html_e( 'JavaScript Code', 'wpcoder' ); ?> |
| 24 | 22 | </h4> |
| 25 | 23 | |
| 26 | 24 | <fieldset> |
| @@ -25,29 +23,42 @@ | ||
| 25 | 23 | |
| 26 | 24 | <fieldset> |
| 27 | 25 | <legend><?php esc_html_e( 'Settings', 'wpcoder' ); ?></legend> |
| 28 | 26 | |
| 29 | - <?php Option::init( [ | |
| 30 | - $opt['jquery'], | |
| 31 | - $opt['inline'], | |
| 32 | - $opt['minified'], | |
| 33 | - $opt['attributes'], | |
| 34 | - ] ); ?> | |
| 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> | |
| 35 | 32 | |
| 36 | - </fieldset> | |
| 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> | |
| 37 | 38 | |
| 38 | - <fieldset> | |
| 39 | - <div class="wowp-field is-full"> | |
| 40 | - <ol id="jsNavigationMenu" class="wowp-php-nav-menu"></ol> | |
| 41 | - <button class="button-editor button" id="jsnav">Add NAV Comment</button> | |
| 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 | + ] ); ?> | |
| 42 | 46 | </div> |
| 47 | + | |
| 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> | |
| 56 | + | |
| 43 | 57 | </fieldset> |
| 44 | 58 | |
| 45 | -<?php Option::init( [ $opt['js_code'] ] ); ?> | |
| 46 | 59 | |
| 47 | - <div class="wowp-notification -warning"> | |
| 48 | - Please input only the JavaScript content, omitting the <code>script</code> tag | |
| 49 | - </div> | |
| 60 | +<?php Field::textarea( 'js_code' ); ?> | |
| 50 | 61 | |
| 51 | 62 | <?php if ( ! empty( $js_link ) ): ?> |
| 52 | 63 | <div class="wowp-fields-group has-mt"> |
| 53 | 64 | <div class="wowp-field is-full has-addon border-default"> |
| @@ -57,6 +68,8 @@ | ||
| 57 | 68 | <input type="url" id="url-css-file" readonly="readonly" value="<?php echo esc_url( $js_link ); ?>"> |
| 58 | 69 | <span class="label"><?php esc_html_e( 'URL to the JS file', 'wpcoder' ); ?></span> |
| 59 | 70 | </div> |
| 60 | 71 | </div> |
| 61 | -<?php endif; | |
| 72 | +<?php endif; ?> | |
| 62 | 73 | |
| 74 | + | |
| 75 | +<?php | |