Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions album-station.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ function album_station_js() {
if ( ! did_action( 'wp_enqueue_media' ) ) {
wp_enqueue_media();
}
wp_enqueue_script( 'myuploadscript', WBC_DIR_URL . '/assets/js/customscript.js', array( 'jquery' ) );

wp_enqueue_script( 'admin-albumstation', WBC_DIR_URL . '/assets/js/admin-albumstation.js', array( 'jquery' ) );
}
add_action( 'admin_enqueue_scripts', 'album_station_js' );

add_action( 'after_setup_theme', 'wpdocs_theme_setup' );
function wpdocs_theme_setup() {
add_image_size( 'album-size', 280, 185, true );
}
56 changes: 15 additions & 41 deletions assets/js/customscript.js → assets/js/admin-albumstation.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jQuery(function($){
multiple: true
});



custom_uploader.on('select', function() { // it also has "open" and "close" events

var attachments= custom_uploader.state().get('selection').toJSON();

var newarr = attachments.map( (img) => {
return img.id;
} );
var img_ids = newarr.toString();
var img_ids = newarr.toString();
$('#immage_id').val(img_ids);

var html = '';
Expand All @@ -39,7 +39,7 @@ jQuery(function($){
custom_uploader.on('open', function() {

var selection = custom_uploader.state().get('selection');

var ids = jQuery('input#immage_id').val().split(',');

ids.forEach(function(id) {
Expand All @@ -51,43 +51,17 @@ jQuery(function($){
}).open();
});
});

jQuery(document).ready(function(){

jQuery("input[name='video_choice']").change( function(){
var videoChoice = jQuery("input[name='video_choice']:checked").val();
if(videoChoice=='single'){
jQuery('.video_playlist').hide();
jQuery('.video_ids').show();
}else{
jQuery('.video_ids').hide();
jQuery('.video_playlist').show();

}
});

jQuery( "input[name='video_choice']:checked" ).trigger( "change" );

var jQuerygrid = jQuery('.album-grid').isotope({
itemSelector: '.album-station',
layoutMode: 'fitRows',
percentPosition: true,

});
jQuery('.filter-button-group').on( 'click', 'span', function() {
var filterValue = jQuery(this).attr('data-filter');
jQuerygrid.isotope({ filter: filterValue });
});

jQuery('.button-group').each( function( i, buttonGroup ) {
var jQuerybuttonGroup = jQuery( buttonGroup );
jQuerybuttonGroup.on( 'click', 'span', function() {
jQuerybuttonGroup.find('.is-checked').removeClass('is-checked');
jQuery( this ).addClass('is-checked');
});
});
});
jQuery("input[name='video_choice']").change( function(){
var videoChoice = jQuery("input[name='video_choice']:checked").val();
if(videoChoice=='single'){
jQuery('.video_playlist').hide();
jQuery('.video_ids').show();
}else{
jQuery('.video_ids').hide();
jQuery('.video_playlist').show();

jQuery( window ).load(function() {
jQuery(".button-group span:first-child").trigger('click');
});
}
});
});
29 changes: 29 additions & 0 deletions assets/js/albumstation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
jQuery(document).ready(function($){
if (jQuery(".album-grid").length > 0) {
jQuery( "input[name='video_choice']:checked" ).trigger( "change" );
var jQuerygrid = jQuery('.album-grid').isotope({
itemSelector: '.album-station',
layoutMode: 'fitRows',
percentPosition: true,

});
jQuery('.filter-button-group').on( 'click', 'span', function() {
var filterValue = jQuery(this).attr('data-filter');
jQuerygrid.isotope({ filter: filterValue });
});

jQuery('.button-group').each( function( i, buttonGroup ) {
var jQuerybuttonGroup = jQuery( buttonGroup );
jQuerybuttonGroup.on( 'click', 'span', function() {
jQuerybuttonGroup.find('.is-checked').removeClass('is-checked');
jQuery( this ).addClass('is-checked');
});
});
}
});

jQuery( window ).load(function() {
if (jQuery(".album-grid").length > 0) {
jQuery(".button-group span:first-child").trigger('click');
}
});
2 changes: 1 addition & 1 deletion includes/elementor-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function widget_styles() {
public function widget_scripts() {

wp_enqueue_script( 'lightgallery-combined', WBC_DIR_URL . 'assets/js/lightgallery-combined.js', array( 'jquery' ) );
wp_enqueue_script( 'customscript', WBC_DIR_URL . 'assets/js/customscript.js', array( 'jquery' ) );
wp_enqueue_script( 'albumstation', WBC_DIR_URL . 'assets/js/albumstation.js', array( 'jquery' ) );
}

public function register_widgets() {
Expand Down
Loading