Move admin widget scripts
This commit is contained in:
@@ -33,21 +33,6 @@ jQuery(document).ready(function($){
|
|||||||
|
|
||||||
// Activate auto key placeholder
|
// Activate auto key placeholder
|
||||||
$("#poststuff #title").keyup();
|
$("#poststuff #title").keyup();
|
||||||
|
|
||||||
// Orderby affects order select in widget options
|
|
||||||
$("body.widgets-php").on("change", ".sp-select-orderby", function() {
|
|
||||||
$(this).closest(".widget-content").find(".sp-select-order").prop("disabled", $(this).val() == "default");
|
|
||||||
});
|
|
||||||
|
|
||||||
// Calendar affects view all link checkbox in widget options
|
|
||||||
$("body.widgets-php").on("change", ".sp-event-calendar-select", function() {
|
|
||||||
$el = $(this).closest(".widget-content").find(".sp-event-calendar-show-all-toggle");
|
|
||||||
if($(this).val() == 0)
|
|
||||||
$el.hide();
|
|
||||||
else
|
|
||||||
$el.show();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Table switcher
|
// Table switcher
|
||||||
$(".sp-table-panel").siblings(".sp-table-bar").find("a").click(function() {
|
$(".sp-table-panel").siblings(".sp-table-bar").find("a").click(function() {
|
||||||
$(this).closest("li").find("a").addClass("current").closest("li").siblings().find("a").removeClass("current").closest(".sp-table-bar").siblings($(this).attr("href")).show().siblings(".sp-table-panel").hide();
|
$(this).closest("li").find("a").addClass("current").closest("li").siblings().find("a").removeClass("current").closest(".sp-table-bar").siblings($(this).attr("href")).show().siblings(".sp-table-panel").hide();
|
||||||
|
|||||||
17
assets/js/admin/widgets.js
Normal file
17
assets/js/admin/widgets.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
jQuery(document).ready(function($){
|
||||||
|
|
||||||
|
// Orderby affects order select in widget options
|
||||||
|
$("body").on("change", ".sp-select-orderby", function() {
|
||||||
|
$(this).closest(".widget-content").find(".sp-select-order").prop("disabled", $(this).val() == "default");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Calendar affects view all link checkbox in widget options
|
||||||
|
$("body").on("change", ".sp-event-calendar-select", function() {
|
||||||
|
$el = $(this).closest(".widget-content").find(".sp-event-calendar-show-all-toggle");
|
||||||
|
if($(this).val() == 0)
|
||||||
|
$el.hide();
|
||||||
|
else
|
||||||
|
$el.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
@@ -86,6 +86,8 @@ class SP_Admin_Assets {
|
|||||||
|
|
||||||
wp_register_script( 'sportspress-admin', SP()->plugin_url() . '/assets/js/admin/sportspress-admin.js', array( 'jquery', 'chosen', 'jquery-tiptip', 'jquery-caret', 'jquery-countdown' ), SP_VERSION, true );
|
wp_register_script( 'sportspress-admin', SP()->plugin_url() . '/assets/js/admin/sportspress-admin.js', array( 'jquery', 'chosen', 'jquery-tiptip', 'jquery-caret', 'jquery-countdown' ), SP_VERSION, true );
|
||||||
|
|
||||||
|
wp_register_script( 'sportspress-admin-widgets', SP()->plugin_url() . '/assets/js/admin/widgets.js', array( 'jquery' ), SP_VERSION, true );
|
||||||
|
|
||||||
// SportsPress admin pages
|
// SportsPress admin pages
|
||||||
if ( in_array( $screen->id, sp_get_screen_ids() ) ) {
|
if ( in_array( $screen->id, sp_get_screen_ids() ) ) {
|
||||||
|
|
||||||
@@ -113,6 +115,10 @@ class SP_Admin_Assets {
|
|||||||
//wp_enqueue_style( 'sportspress-admin-dashboard' );
|
//wp_enqueue_style( 'sportspress-admin-dashboard' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( in_array( $screen->id, array( 'widgets' ) ) ) {
|
||||||
|
wp_enqueue_script( 'sportspress-admin-widgets' );
|
||||||
|
}
|
||||||
|
|
||||||
// Edit venue pages
|
// Edit venue pages
|
||||||
if ( in_array( $screen->id, array( 'edit-sp_venue' ) ) ) {
|
if ( in_array( $screen->id, array( 'edit-sp_venue' ) ) ) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user