Clean up spaces, tabs, indentation, and bracket formatting

This commit is contained in:
Brian Miyaji
2021-11-10 15:41:40 +09:00
parent e58beb1201
commit 3dff686a00
285 changed files with 29638 additions and 24147 deletions

View File

@@ -1,26 +1,38 @@
jQuery(document).ready(function($){
jQuery( document ).ready(
function($){
// Color picker
$('.colorpick').iris( {
change: function(event, ui){
$(this).css( { backgroundColor: ui.color.toString() } );
},
hide: true,
border: true
} ).each( function() {
$(this).css( { backgroundColor: $(this).val() } );
})
.click(function(){
$('.iris-picker').hide();
$(this).closest('.sp-color-box, td').find('.iris-picker').show();
});
// Color picker
$( '.colorpick' ).iris(
{
change: function(event, ui){
$( this ).css( { backgroundColor: ui.color.toString() } );
},
hide: true,
border: true
}
).each(
function() {
$( this ).css( { backgroundColor: $( this ).val() } );
}
)
.click(
function(){
$( '.iris-picker' ).hide();
$( this ).closest( '.sp-color-box, td' ).find( '.iris-picker' ).show();
}
);
$('body').click(function() {
$('.iris-picker').hide();
});
$( 'body' ).click(
function() {
$( '.iris-picker' ).hide();
}
);
$('.sp-color-box, .colorpick').click(function(event){
event.stopPropagation();
});
$( '.sp-color-box, .colorpick' ).click(
function(event){
event.stopPropagation();
}
);
});
}
);

View File

@@ -1,11 +1,18 @@
jQuery(document).ready(function($){
jQuery( document ).ready(
function($){
// Dashboard countdown
$("#sportspress_dashboard_status .sp_status_list li.countdown").each(function() {
var $this = $(this), finalDate = $(this).data('countdown');
$this.countdown(finalDate, function(event) {
$this.find('strong').html(event.strftime("%D "+localized_strings.days+" %H:%M:%S"));
});
});
// Dashboard countdown
$( "#sportspress_dashboard_status .sp_status_list li.countdown" ).each(
function() {
var $this = $( this ), finalDate = $( this ).data( 'countdown' );
$this.countdown(
finalDate,
function(event) {
$this.find( 'strong' ).html( event.strftime( "%D " + localized_strings.days + " %H:%M:%S" ) );
}
);
}
);
});
}
);

View File

@@ -3,51 +3,63 @@
$shortcodes = '';
$options = array(
'event' => array(
'details', 'results', 'performance', 'venue', 'officials', 'teams', 'full',
),
'team' => array(),
'player' => array(
'details', 'statistics'
),
'event' => array(
'details',
'results',
'performance',
'venue',
'officials',
'teams',
'full',
),
'team' => array(),
'player' => array(
'details',
'statistics',
),
);
$options = apply_filters( 'sportspress_shortcodes', $options );
foreach ( $options as $name => $group ) {
if ( empty( $group ) ) continue;
$shortcodes .= $name . '[' . implode( '|', $group ) . ']';
if ( empty( $group ) ) {
continue;
}
$shortcodes .= $name . '[' . implode( '|', $group ) . ']';
}
$raw = apply_filters( 'sportspress_tinymce_strings', array(
'shortcodes' => $shortcodes,
'insert' => __( 'SportsPress Shortcodes', 'sportspress' ),
'auto' => __( 'Auto', 'sportspress' ),
'manual' => __( 'Manual', 'sportspress' ),
'select' => __( 'Select...', 'sportspress' ),
'event' => __( 'Event', 'sportspress' ),
'details' => __( 'Details', 'sportspress' ),
'results' => __( 'Results', 'sportspress' ),
'countdown' => __( 'Countdown', 'sportspress' ),
'performance' => __( 'Box Score', 'sportspress' ),
'venue' => __( 'Venue', 'sportspress' ),
'officials' => __( 'Officials', 'sportspress' ),
'teams' => __( 'Teams', 'sportspress' ),
'full' => __( 'Full Info', 'sportspress' ),
'calendar' => __( 'Calendar', 'sportspress' ),
'statistics' => __( 'Statistics', 'sportspress' ),
'team' => __( 'Team', 'sportspress' ),
'standings' => __( 'League Table', 'sportspress' ),
'player' => __( 'Player', 'sportspress' ),
'list' => __( 'List', 'sportspress' ),
'blocks' => __( 'Blocks', 'sportspress' ),
'gallery' => __( 'Gallery', 'sportspress' ),
));
$raw = apply_filters(
'sportspress_tinymce_strings',
array(
'shortcodes' => $shortcodes,
'insert' => __( 'SportsPress Shortcodes', 'sportspress' ),
'auto' => __( 'Auto', 'sportspress' ),
'manual' => __( 'Manual', 'sportspress' ),
'select' => __( 'Select...', 'sportspress' ),
'event' => __( 'Event', 'sportspress' ),
'details' => __( 'Details', 'sportspress' ),
'results' => __( 'Results', 'sportspress' ),
'countdown' => __( 'Countdown', 'sportspress' ),
'performance' => __( 'Box Score', 'sportspress' ),
'venue' => __( 'Venue', 'sportspress' ),
'officials' => __( 'Officials', 'sportspress' ),
'teams' => __( 'Teams', 'sportspress' ),
'full' => __( 'Full Info', 'sportspress' ),
'calendar' => __( 'Calendar', 'sportspress' ),
'statistics' => __( 'Statistics', 'sportspress' ),
'team' => __( 'Team', 'sportspress' ),
'standings' => __( 'League Table', 'sportspress' ),
'player' => __( 'Player', 'sportspress' ),
'list' => __( 'List', 'sportspress' ),
'blocks' => __( 'Blocks', 'sportspress' ),
'gallery' => __( 'Gallery', 'sportspress' ),
)
);
$formatted = array();
foreach ( $raw as $key => $value ) {
$formatted[] = $key . ': "' . esc_js( $value ) . '"';
$formatted[] = $key . ': "' . esc_js( $value ) . '"';
}
$strings = 'tinyMCE.addI18n({' . _WP_Editors::$mce_locale . ':{

View File

@@ -1,42 +1,58 @@
/* global tinymce */
( function () {
tinymce.PluginManager.add( 'sp_shortcodes_button', function( editor, url ) {
var ed = tinymce.activeEditor;
tinymce.PluginManager.add(
'sp_shortcodes_button',
function( editor, url ) {
var ed = tinymce.activeEditor;
var groups = ed.getLang( 'sportspress.shortcodes' ).split("]");
var menu = new Array();
var groups = ed.getLang( 'sportspress.shortcodes' ).split( "]" );
var menu = new Array();
groups.forEach(function(g) {
if ( "" == g ) return;
var p = g.split("[");
var label = p.shift();
var variations = p.shift();
var shortcodes = typeof variations!== 'undefined' ? variations.split("|") : [];
var submenu = new Array();
shortcodes.forEach(function(s) {
submenu.push({
text: ed.getLang( 'sportspress.' + s ),
onclick: function() {
// triggers the thickbox
var width = jQuery(window).width(), H = jQuery(window).height(), W = ( 720 < width ) ? 720 : width;
W = W - 80;
H = H - 84;
tb_show( ed.getLang( 'sportspress.' + label ) + ' - ' + ed.getLang( 'sportspress.' + s ), 'admin-ajax.php?action=sportspress_' + label + '_' + s + '_shortcode&width=' + W + '&height=' + H );
groups.forEach(
function(g) {
if ( "" == g ) {
return;
}
});
});
menu.push({
text: ed.getLang( 'sportspress.' + label ),
menu: submenu
});
});
var p = g.split( "[" );
var label = p.shift();
var variations = p.shift();
var shortcodes = typeof variations !== 'undefined' ? variations.split( "|" ) : [];
var submenu = new Array();
shortcodes.forEach(
function(s) {
submenu.push(
{
text: ed.getLang( 'sportspress.' + s ),
onclick: function() {
// triggers the thickbox
var width = jQuery( window ).width(), H = jQuery( window ).height(), W = ( 720 < width ) ? 720 : width;
W = W - 80;
H = H - 84;
tb_show( ed.getLang( 'sportspress.' + label ) + ' - ' + ed.getLang( 'sportspress.' + s ), 'admin-ajax.php?action=sportspress_' + label + '_' + s + '_shortcode&width=' + W + '&height=' + H );
}
}
);
}
);
menu.push(
{
text: ed.getLang( 'sportspress.' + label ),
menu: submenu
}
);
}
);
editor.addButton( 'sp_shortcodes_button', {
title: ed.getLang('sportspress.insert'),
text: false,
icon: false,
type: 'menubutton',
menu: menu
});
});
editor.addButton(
'sp_shortcodes_button',
{
title: ed.getLang( 'sportspress.insert' ),
text: false,
icon: false,
type: 'menubutton',
menu: menu
}
);
}
);
})();

View File

@@ -1,37 +1,55 @@
jQuery(document).ready(function($){
$("#title").keyup(function() {
val = $(this).val();
if ( val == '' ) val = 'f(x)';
$(".sp-equation-variable").text( val + ' =' );
});
jQuery( document ).ready(
function($){
$( "#title" ).keyup(
function() {
val = $( this ).val();
if ( val == '' ) {
val = 'f(x)';
}
$( ".sp-equation-variable" ).text( val + ' =' );
}
);
$(".sp-equation-parts .button").draggable({
appendTo: "body",
helper: "clone",
cursor: "move",
distance: 10,
containment: "#sp_equationdiv",
}).click(function() {
$("<label class='button'></label>").text( $(this).text() ).append("<span class='remove'>&times;</span><input name='sp_equation[]' type='hidden' value='" + $(this).data("variable") + "'>").appendTo( $(".sp-equation-formula") );
});
$( ".sp-equation-parts .button" ).draggable(
{
appendTo: "body",
helper: "clone",
cursor: "move",
distance: 10,
containment: "#sp_equationdiv",
}
).click(
function() {
$( "<label class='button'></label>" ).text( $( this ).text() ).append( "<span class='remove'>&times;</span><input name='sp_equation[]' type='hidden' value='" + $( this ).data( "variable" ) + "'>" ).appendTo( $( ".sp-equation-formula" ) );
}
);
$(".sp-equation").droppable({
activeClass: "ui-state-active",
hoverClass: "ui-state-hover",
accept: ".button:not(.ui-sortable-helper)",
drop: function( event, ui ) {
$("<label class='button'></label>").text( ui.draggable.text() ).append("<span class='remove'>&times;</span><input name='sp_equation[]' type='hidden' value='" + ui.draggable.data("variable") + "'>").appendTo( $(".sp-equation-formula") );
}
}).sortable({
items: ".button",
tolerance: "pointer",
containment: "#sp_equationdiv",
sort: function() {
$( this ).removeClass( "ui-state-active" );
}
});
$( ".sp-equation" ).droppable(
{
activeClass: "ui-state-active",
hoverClass: "ui-state-hover",
accept: ".button:not(.ui-sortable-helper)",
drop: function( event, ui ) {
$( "<label class='button'></label>" ).text( ui.draggable.text() ).append( "<span class='remove'>&times;</span><input name='sp_equation[]' type='hidden' value='" + ui.draggable.data( "variable" ) + "'>" ).appendTo( $( ".sp-equation-formula" ) );
}
}
).sortable(
{
items: ".button",
tolerance: "pointer",
containment: "#sp_equationdiv",
sort: function() {
$( this ).removeClass( "ui-state-active" );
}
}
);
$(".sp-equation-formula").on("click", ".button .remove", function() {
$(this).closest(".button").remove();
});
});
$( ".sp-equation-formula" ).on(
"click",
".button .remove",
function() {
$( this ).closest( ".button" ).remove();
}
);
}
);

View File

@@ -1,37 +1,52 @@
jQuery(document).ready(function($){
jQuery( document ).ready(
function($){
// Icon picker
$('.sp-icons input').on('change', function() {
if ('' == $(this).val()) {
$('.sp-custom-colors').hide();
$('.sp-custom-thumbnail').show();
} else {
$('.sp-custom-thumbnail').hide();
$('.sp-custom-colors').show();
}
});
// Icon picker
$( '.sp-icons input' ).on(
'change',
function() {
if ('' == $( this ).val()) {
$( '.sp-custom-colors' ).hide();
$( '.sp-custom-thumbnail' ).show();
} else {
$( '.sp-custom-thumbnail' ).hide();
$( '.sp-custom-colors' ).show();
}
}
);
// Color picker
$('.colorpick').iris( {
change: function(event, ui){
$(this).css( { backgroundColor: ui.color.toString() } );
},
hide: true,
border: true
} ).each( function() {
$(this).css( { backgroundColor: $(this).val() } );
})
.click(function(){
$('.iris-picker').hide();
$(this).closest('.sp-color-box-for-icon, td').find('.iris-picker').show();
});
// Color picker
$( '.colorpick' ).iris(
{
change: function(event, ui){
$( this ).css( { backgroundColor: ui.color.toString() } );
},
hide: true,
border: true
}
).each(
function() {
$( this ).css( { backgroundColor: $( this ).val() } );
}
)
.click(
function(){
$( '.iris-picker' ).hide();
$( this ).closest( '.sp-color-box-for-icon, td' ).find( '.iris-picker' ).show();
}
);
$('body').click(function() {
$('.iris-picker').hide();
});
$( 'body' ).click(
function() {
$( '.iris-picker' ).hide();
}
);
$('.sp-color-box-for-icon, .colorpick').click(function(event){
event.stopPropagation();
});
$( '.sp-color-box-for-icon, .colorpick' ).click(
function(event){
event.stopPropagation();
}
);
});
}
);

View File

@@ -24,56 +24,72 @@
var $post_row = $( '#post-' + $post_id );
// get the data
var $number = $( '.column-sp_number', $post_row ).text();
var $current_teams = String( $( '.column-sp_team', $post_row ).find( '.sp-player-teams' ).data( 'current-teams' ) ).split(',');
var $past_teams = String( $( '.column-sp_team', $post_row ).find( '.sp-player-teams' ).data( 'past-teams' ) ).split(',');
var $number = $( '.column-sp_number', $post_row ).text();
var $current_teams = String( $( '.column-sp_team', $post_row ).find( '.sp-player-teams' ).data( 'current-teams' ) ).split( ',' );
var $past_teams = String( $( '.column-sp_team', $post_row ).find( '.sp-player-teams' ).data( 'past-teams' ) ).split( ',' );
// populate the data
$( ':input[name="sp_number"]', $edit_row ).val( $number );
$( ':input[name="sp_current_team[]"]', $edit_row ).each(function() {
$(this).prop("checked", ($.inArray($(this).val(), $current_teams ) != -1));
});
$( ':input[name="sp_past_team[]"]', $edit_row ).each(function() {
$(this).prop("checked", ($.inArray($(this).val(), $past_teams ) != -1));
});
$( ':input[name="sp_current_team[]"]', $edit_row ).each(
function() {
$( this ).prop( "checked", ($.inArray( $( this ).val(), $current_teams ) != -1) );
}
);
$( ':input[name="sp_past_team[]"]', $edit_row ).each(
function() {
$( this ).prop( "checked", ($.inArray( $( this ).val(), $past_teams ) != -1) );
}
);
}
};
$( document ).on( 'click', '#bulk_edit', function() {
// define the bulk edit row
var $bulk_row = $( '#bulk-edit' );
$( document ).on(
'click',
'#bulk_edit',
function() {
// define the bulk edit row
var $bulk_row = $( '#bulk-edit' );
// get the selected post ids that are being edited
var $post_ids = new Array();
$bulk_row.find( '#bulk-titles' ).children().each( function() {
$post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );
});
// get the selected post ids that are being edited
var $post_ids = new Array();
$bulk_row.find( '#bulk-titles' ).children().each(
function() {
$post_ids.push( $( this ).attr( 'id' ).replace( /^(ttle)/i, '' ) );
}
);
// get the data
var $current_teams = [];
$bulk_row.find( 'input[name="sp_current_team[]"]:checked' ).each(function() {
$current_teams.push( $(this).val() );
});
// get the data
var $current_teams = [];
$bulk_row.find( 'input[name="sp_current_team[]"]:checked' ).each(
function() {
$current_teams.push( $( this ).val() );
}
);
var $past_teams = [];
$bulk_row.find( 'input[name="sp_past_team[]"]:checked' ).each(function() {
$past_teams.push( $(this).val() );
});
var $past_teams = [];
$bulk_row.find( 'input[name="sp_past_team[]"]:checked' ).each(
function() {
$past_teams.push( $( this ).val() );
}
);
// save the data
$.ajax({
url: ajaxurl, // this is a variable that WordPress has already defined for us
type: 'POST',
async: false,
cache: false,
data: {
action: 'save_bulk_edit_sp_player',
post_ids: $post_ids,
current_teams: $current_teams,
past_teams: $past_teams,
nonce: $("#sp_player_edit_nonce").val()
}
});
});
// save the data
$.ajax(
{
url: ajaxurl, // this is a variable that WordPress has already defined for us
type: 'POST',
async: false,
cache: false,
data: {
action: 'save_bulk_edit_sp_player',
post_ids: $post_ids,
current_teams: $current_teams,
past_teams: $past_teams,
nonce: $( "#sp_player_edit_nonce" ).val()
}
}
);
}
);
})(jQuery);
})( jQuery );

View File

@@ -1,64 +1,92 @@
jQuery(document).ready(function($){
jQuery( document ).ready(
function($){
// Display custom sport name field as needed
$("body.toplevel_page_sportspress #sportspress_sport").change(function() {
$target = $("#sportspress_custom_sport_name");
if ( $(this).val() == "custom" )
$target.show();
else
$target.hide();
});
// Display custom sport name field as needed
$( "body.toplevel_page_sportspress #sportspress_sport" ).change(
function() {
$target = $( "#sportspress_custom_sport_name" );
if ( $( this ).val() == "custom" ) {
$target.show();
} else {
$target.hide();
}
}
);
// Color picker
$('.colorpick').iris( {
change: function(event, ui){
$(this).css( { backgroundColor: ui.color.toString() } );
},
hide: true,
border: true
} ).each( function() {
$(this).css( { backgroundColor: $(this).val() } );
})
.click(function(){
$('.iris-picker').hide();
$(this).closest('.sp-color-box, td').find('.iris-picker').show();
});
// Color picker
$( '.colorpick' ).iris(
{
change: function(event, ui){
$( this ).css( { backgroundColor: ui.color.toString() } );
},
hide: true,
border: true
}
).each(
function() {
$( this ).css( { backgroundColor: $( this ).val() } );
}
)
.click(
function(){
$( '.iris-picker' ).hide();
$( this ).closest( '.sp-color-box, td' ).find( '.iris-picker' ).show();
}
);
$('body').click(function() {
$('.iris-picker').hide();
});
$( 'body' ).click(
function() {
$( '.iris-picker' ).hide();
}
);
$('.sp-color-box, .colorpick').click(function(event){
event.stopPropagation();
});
$( '.sp-color-box, .colorpick' ).click(
function(event){
event.stopPropagation();
}
);
// Chosen select
$(".chosen-select").chosen({
allow_single_deselect: true,
single_backstroke_delete: false,
placeholder_text_multiple: localized_strings.none
});
// Chosen select
$( ".chosen-select" ).chosen(
{
allow_single_deselect: true,
single_backstroke_delete: false,
placeholder_text_multiple: localized_strings.none
}
);
// Preset field modifier
$(".sp-custom-input-wrapper .preset").click(function() {
val = $(this).val();
if(val == "\\c\\u\\s\\t\\o\\m") return true;
example = $(this).attr("data-example");
$(this).closest(".sp-custom-input-wrapper").find(".value").val(val).siblings(".example").html(example);
});
// Preset field modifier
$( ".sp-custom-input-wrapper .preset" ).click(
function() {
val = $( this ).val();
if (val == "\\c\\u\\s\\t\\o\\m") {
return true;
}
example = $( this ).attr( "data-example" );
$( this ).closest( ".sp-custom-input-wrapper" ).find( ".value" ).val( val ).siblings( ".example" ).html( example );
}
);
// Select custom preset when field is brought to focus
$(".sp-custom-input-wrapper .value").focus(function() {
$(this).siblings("label").find(".preset").prop("checked", true);
});
// Select custom preset when field is brought to focus
$( ".sp-custom-input-wrapper .value" ).focus(
function() {
$( this ).siblings( "label" ).find( ".preset" ).prop( "checked", true );
}
);
// Adjust example field when custom preset is entered
$(".sp-custom-input-wrapper .value").on("keyup", function() {
val = $(this).val();
if ( val === undefined ) return true;
format = $(this).attr("data-example-format");
example = format.replace(/__val__/g, val);
$(this).siblings(".example").html(example);
});
// Adjust example field when custom preset is entered
$( ".sp-custom-input-wrapper .value" ).on(
"keyup",
function() {
val = $( this ).val();
if ( val === undefined ) {
return true;
}
format = $( this ).attr( "data-example-format" );
example = format.replace( /__val__/g, val );
$( this ).siblings( ".example" ).html( example );
}
);
});
}
);

View File

@@ -1,54 +1,76 @@
//Get variables form input values
latitude = document.getElementById('term_meta[sp_latitude]').value;
longitude = document.getElementById('term_meta[sp_longitude]').value;
//Initialize the map and add the Search control box
var map = L.map('sp-location-picker').setView([latitude, longitude], 15),
// Get variables form input values
latitude = document.getElementById( 'term_meta[sp_latitude]' ).value;
longitude = document.getElementById( 'term_meta[sp_longitude]' ).value;
// Initialize the map and add the Search control box
var map = L.map( 'sp-location-picker' ).setView( [latitude, longitude], 15 ),
geocoder = L.Control.Geocoder.nominatim(),
control = L.Control.geocoder({
geocoder: geocoder,
collapsed: false,
defaultMarkGeocode: false
}).addTo(map),
//Add a marker to use from the begining
marker = L.marker([latitude, longitude],{draggable: true, autoPan: true}).addTo(map);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
//Pass the values to the fields after dragging
marker.on('dragend', function (e) {
document.getElementById('term_meta[sp_latitude]').value = marker.getLatLng().lat;
document.getElementById('term_meta[sp_longitude]').value = marker.getLatLng().lng;
geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) {
var r = results[0];
if (r) {
document.getElementById('term_meta[sp_address]').value = r.name;
control = L.Control.geocoder(
{
geocoder: geocoder,
collapsed: false,
defaultMarkGeocode: false
}
})
});
).addTo( map ),
// Add a marker to use from the begining
marker = L.marker( [latitude, longitude],{draggable: true, autoPan: true} ).addTo( map );
//After searching
control.on('markgeocode', function(e) {
var center = e.geocode.center;
var address = e.geocode.name;
map.setView([center.lat, center.lng], 15); //Center map to the new place
map.removeLayer(marker); //Remove previous marker
marker = L.marker([center.lat, center.lng],{draggable: true, autoPan: true}).addTo(map); //Add new marker to use
//Pass the values to the fields after searching
document.getElementById('term_meta[sp_latitude]').value = center.lat;
document.getElementById('term_meta[sp_longitude]').value = center.lng;
document.getElementById('term_meta[sp_address]').value = address;
//Pass the values to the fields after dragging
marker.on('dragend', function (e) {
document.getElementById('term_meta[sp_latitude]').value = marker.getLatLng().lat;
document.getElementById('term_meta[sp_longitude]').value = marker.getLatLng().lng;
geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) {
var r = results[0];
if (r) {
document.getElementById('term_meta[sp_address]').value = r.name;
L.tileLayer(
'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
{
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}
).addTo( map );
// Pass the values to the fields after dragging
marker.on(
'dragend',
function (e) {
document.getElementById( 'term_meta[sp_latitude]' ).value = marker.getLatLng().lat;
document.getElementById( 'term_meta[sp_longitude]' ).value = marker.getLatLng().lng;
geocoder.reverse(
marker.getLatLng(),
map.options.crs.scale( map.getZoom() ),
function(results) {
var r = results[0];
if (r) {
document.getElementById( 'term_meta[sp_address]' ).value = r.name;
}
}
})
});
}).addTo(map);
)
}
);
// After searching
control.on(
'markgeocode',
function(e) {
var center = e.geocode.center;
var address = e.geocode.name;
map.setView( [center.lat, center.lng], 15 ); // Center map to the new place
map.removeLayer( marker ); // Remove previous marker
marker = L.marker( [center.lat, center.lng],{draggable: true, autoPan: true} ).addTo( map ); // Add new marker to use
// Pass the values to the fields after searching
document.getElementById( 'term_meta[sp_latitude]' ).value = center.lat;
document.getElementById( 'term_meta[sp_longitude]' ).value = center.lng;
document.getElementById( 'term_meta[sp_address]' ).value = address;
// Pass the values to the fields after dragging
marker.on(
'dragend',
function (e) {
document.getElementById( 'term_meta[sp_latitude]' ).value = marker.getLatLng().lat;
document.getElementById( 'term_meta[sp_longitude]' ).value = marker.getLatLng().lng;
geocoder.reverse(
marker.getLatLng(),
map.options.crs.scale( map.getZoom() ),
function(results) {
var r = results[0];
if (r) {
document.getElementById( 'term_meta[sp_address]' ).value = r.name;
}
}
)
}
);
}
).addTo( map );

View File

@@ -1,54 +1,76 @@
//Get variables form input values
latitude = document.getElementById('sp_latitude').value;
longitude = document.getElementById('sp_longitude').value;
//Initialize the map and add the Search control box
var map = L.map('sp-location-picker').setView([latitude, longitude], 15),
// Get variables form input values
latitude = document.getElementById( 'sp_latitude' ).value;
longitude = document.getElementById( 'sp_longitude' ).value;
// Initialize the map and add the Search control box
var map = L.map( 'sp-location-picker' ).setView( [latitude, longitude], 15 ),
geocoder = L.Control.Geocoder.nominatim(),
control = L.Control.geocoder({
geocoder: geocoder,
collapsed: false,
defaultMarkGeocode: false
}).addTo(map),
//Add a marker to use from the begining
marker = L.marker([latitude, longitude],{draggable: true, autoPan: true}).addTo(map);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
//Pass the values to the fields after dragging
marker.on('dragend', function (e) {
document.getElementById('sp_latitude').value = marker.getLatLng().lat;
document.getElementById('sp_longitude').value = marker.getLatLng().lng;
geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) {
var r = results[0];
if (r) {
document.getElementById('sp_address').value = r.name;
control = L.Control.geocoder(
{
geocoder: geocoder,
collapsed: false,
defaultMarkGeocode: false
}
})
});
).addTo( map ),
// Add a marker to use from the begining
marker = L.marker( [latitude, longitude],{draggable: true, autoPan: true} ).addTo( map );
//After searching
control.on('markgeocode', function(e) {
var center = e.geocode.center;
var address = e.geocode.name;
map.setView([center.lat, center.lng], 15); //Center map to the new place
map.removeLayer(marker); //Remove previous marker
marker = L.marker([center.lat, center.lng],{draggable: true, autoPan: true}).addTo(map); //Add new marker to use
//Pass the values to the fields after searching
document.getElementById('sp_latitude').value = center.lat;
document.getElementById('sp_longitude').value = center.lng;
document.getElementById('sp_address').value = address;
//Pass the values to the fields after dragging
marker.on('dragend', function (e) {
document.getElementById('sp_latitude').value = marker.getLatLng().lat;
document.getElementById('sp_longitude').value = marker.getLatLng().lng;
geocoder.reverse(marker.getLatLng(), map.options.crs.scale(map.getZoom()), function(results) {
var r = results[0];
if (r) {
document.getElementById('sp_address').value = r.name;
L.tileLayer(
'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
{
attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}
).addTo( map );
// Pass the values to the fields after dragging
marker.on(
'dragend',
function (e) {
document.getElementById( 'sp_latitude' ).value = marker.getLatLng().lat;
document.getElementById( 'sp_longitude' ).value = marker.getLatLng().lng;
geocoder.reverse(
marker.getLatLng(),
map.options.crs.scale( map.getZoom() ),
function(results) {
var r = results[0];
if (r) {
document.getElementById( 'sp_address' ).value = r.name;
}
}
})
});
}).addTo(map);
)
}
);
// After searching
control.on(
'markgeocode',
function(e) {
var center = e.geocode.center;
var address = e.geocode.name;
map.setView( [center.lat, center.lng], 15 ); // Center map to the new place
map.removeLayer( marker ); // Remove previous marker
marker = L.marker( [center.lat, center.lng],{draggable: true, autoPan: true} ).addTo( map ); // Add new marker to use
// Pass the values to the fields after searching
document.getElementById( 'sp_latitude' ).value = center.lat;
document.getElementById( 'sp_longitude' ).value = center.lng;
document.getElementById( 'sp_address' ).value = address;
// Pass the values to the fields after dragging
marker.on(
'dragend',
function (e) {
document.getElementById( 'sp_latitude' ).value = marker.getLatLng().lat;
document.getElementById( 'sp_longitude' ).value = marker.getLatLng().lng;
geocoder.reverse(
marker.getLatLng(),
map.options.crs.scale( map.getZoom() ),
function(results) {
var r = results[0];
if (r) {
document.getElementById( 'sp_address' ).value = r.name;
}
}
)
}
);
}
).addTo( map );

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +1,32 @@
jQuery(document).ready(function($){
jQuery( document ).ready(
function($){
// Tiptip
$(".sp-tip").tipTip({
delay: 200,
fadeIn: 100,
fadeOut: 100
});
$(".sp-desc-tip").tipTip({
delay: 200,
fadeIn: 100,
fadeOut: 100,
defaultPosition: 'right'
});
// Tiptip
$( ".sp-tip" ).tipTip(
{
delay: 200,
fadeIn: 100,
fadeOut: 100
}
);
$( ".sp-desc-tip" ).tipTip(
{
delay: 200,
fadeIn: 100,
fadeOut: 100,
defaultPosition: 'right'
}
);
// Chosen select
$(".chosen-select, #poststuff #post_author_override").chosen({
allow_single_deselect: true,
search_contains: true,
single_backstroke_delete: false,
disable_search_threshold: 10,
placeholder_text_multiple: localized_strings.none
});
});
// Chosen select
$( ".chosen-select, #poststuff #post_author_override" ).chosen(
{
allow_single_deselect: true,
search_contains: true,
single_backstroke_delete: false,
disable_search_threshold: 10,
placeholder_text_multiple: localized_strings.none
}
);
}
);

View File

@@ -1,41 +1,60 @@
jQuery(document).ready(function($){
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");
});
// 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();
});
// 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();
}
}
);
// Show or hide datepicker
$("body").on("change", ".sp-date-selector select", function() {
if ( $(this).val() == "range" ) {
$(this).closest(".sp-date-selector").find(".sp-date-range").show();
} else {
$(this).closest(".sp-date-selector").find(".sp-date-range").hide();
}
});
$(".sp-date-selector select").trigger("change");
// Show or hide datepicker
$( "body" ).on(
"change",
".sp-date-selector select",
function() {
if ( $( this ).val() == "range" ) {
$( this ).closest( ".sp-date-selector" ).find( ".sp-date-range" ).show();
} else {
$( this ).closest( ".sp-date-selector" ).find( ".sp-date-range" ).hide();
}
}
);
$( ".sp-date-selector select" ).trigger( "change" );
// Toggle date range selectors
$("body").on("change", ".sp-date-relative input", function() {
$relative = $(this).closest(".sp-date-relative").siblings(".sp-date-range-relative").toggle(0, $(this).attr("checked"));
$absolute = $(this).closest(".sp-date-relative").siblings(".sp-date-range-absolute").toggle(0, $(this).attr("checked"));
// Toggle date range selectors
$( "body" ).on(
"change",
".sp-date-relative input",
function() {
$relative = $( this ).closest( ".sp-date-relative" ).siblings( ".sp-date-range-relative" ).toggle( 0, $( this ).attr( "checked" ) );
$absolute = $( this ).closest( ".sp-date-relative" ).siblings( ".sp-date-range-absolute" ).toggle( 0, $( this ).attr( "checked" ) );
if ($(this).attr("checked")) {
$relative.show();
$absolute.hide();
} else {
$absolute.show();
$relative.hide();
}
});
$(".sp-date-selector input").trigger("change");
});
if ($( this ).attr( "checked" )) {
$relative.show();
$absolute.hide();
} else {
$absolute.show();
$relative.hide();
}
}
);
$( ".sp-date-selector input" ).trigger( "change" );
}
);

View File

@@ -1,81 +1,88 @@
import apiFetch from '@wordpress/api-fetch';
console.log(wp.api.collections.Posts());
console.log( wp.api.collections.Posts() );
wp.blocks.registerBlockType('sportspress/event-calendar', {
title: strings.event_calendar,
icon: 'calendar',
category: 'sportspress',
attributes: {
title: {
type: 'string'
},
id: {
type: 'number'
},
status: {
type: 'string'
},
date: {
type: 'string'
},
date_from: {
type: 'string'
},
date_to: {
type: 'string'
},
date_past: {
type: 'number'
},
date_future: {
type: 'number'
},
date_relative: {
type: 'number'
},
day: {
type: 'string'
},
show_all_events_link: {
type: 'number'
},
wp.blocks.registerBlockType(
'sportspress/event-calendar',
{
title: strings.event_calendar,
icon: 'calendar',
category: 'sportspress',
attributes: {
title: {
type: 'string'
},
id: {
type: 'number'
},
status: {
type: 'string'
},
date: {
type: 'string'
},
date_from: {
type: 'string'
},
date_to: {
type: 'string'
},
date_past: {
type: 'number'
},
date_future: {
type: 'number'
},
date_relative: {
type: 'number'
},
day: {
type: 'string'
},
show_all_events_link: {
type: 'number'
},
content: {type: 'string'},
color: {type: 'string'}
},
edit: function(props) {
function updateContent(event) {
props.setAttributes({content: event.target.value})
}
function updateColor(value) {
props.setAttributes({color: value.hex})
}
return React.createElement(
wp.components.Panel,
{header: strings.event_calendar},
React.createElement(
wp.components.PanelBody,
{title: strings.properties},
React.createElement(
wp.components.TextControl,
{label: strings.title, type: "text", value: props.attributes.title}
),
React.createElement(
wp.components.SelectControl,
{label: strings.select_calendar, options: [{label: strings.all, value: 0}].concat(posts.events.map(post => {
return {label: post.post_title, value: post.ID}
}))}
)
)
);
},
content: {type: 'string'},
color: {type: 'string'}
},
save: function(props) {
return wp.element.createElement(
"h3",
{ style: { border: "3px solid " + props.attributes.color } },
props.attributes.content
);
}
})
edit: function(props) {
function updateContent(event) {
props.setAttributes( {content: event.target.value} )
}
function updateColor(value) {
props.setAttributes( {color: value.hex} )
}
return React.createElement(
wp.components.Panel,
{header: strings.event_calendar},
React.createElement(
wp.components.PanelBody,
{title: strings.properties},
React.createElement(
wp.components.TextControl,
{label: strings.title, type: "text", value: props.attributes.title}
),
React.createElement(
wp.components.SelectControl,
{label: strings.select_calendar, options: [{label: strings.all, value: 0}].concat(
posts.events.map(
post => {
return {label: post.post_title, value: post.ID}
}
)
)}
)
)
);
},
save: function(props) {
return wp.element.createElement(
"h3",
{ style: { border: "3px solid " + props.attributes.color } },
props.attributes.content
);
}
}
)

View File

@@ -11,73 +11,77 @@
(function( $ ){
'use strict';
'use strict';
$.fn.fitVids = function( options ) {
var settings = {
customSelector: null,
ignore: null
};
$.fn.fitVids = function( options ) {
var settings = {
customSelector: null,
ignore: null
};
if(!document.getElementById('fit-vids-style')) {
// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
var head = document.head || document.getElementsByTagName('head')[0];
var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
var div = document.createElement("div");
div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
head.appendChild(div.childNodes[1]);
}
if ( ! document.getElementById( 'fit-vids-style' )) {
// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
var head = document.head || document.getElementsByTagName( 'head' )[0];
var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
var div = document.createElement( "div" );
div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
head.appendChild( div.childNodes[1] );
}
if ( options ) {
$.extend( settings, options );
}
if ( options ) {
$.extend( settings, options );
}
return this.each(function(){
var selectors = [
'iframe[src*="player.vimeo.com"]',
'iframe[src*="youtube.com"]',
'iframe[src*="youtube-nocookie.com"]',
'iframe[src*="kickstarter.com"][src*="video.html"]',
'object',
'embed'
];
return this.each(
function(){
var selectors = [
'iframe[src*="player.vimeo.com"]',
'iframe[src*="youtube.com"]',
'iframe[src*="youtube-nocookie.com"]',
'iframe[src*="kickstarter.com"][src*="video.html"]',
'object',
'embed'
];
if (settings.customSelector) {
selectors.push(settings.customSelector);
}
if (settings.customSelector) {
selectors.push( settings.customSelector );
}
var ignoreList = '.fitvidsignore';
var ignoreList = '.fitvidsignore';
if(settings.ignore) {
ignoreList = ignoreList + ', ' + settings.ignore;
}
if (settings.ignore) {
ignoreList = ignoreList + ', ' + settings.ignore;
}
var $allVideos = $(this).find(selectors.join(','));
$allVideos = $allVideos.not('object object'); // SwfObj conflict patch
$allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
var $allVideos = $( this ).find( selectors.join( ',' ) );
$allVideos = $allVideos.not( 'object object' ); // SwfObj conflict patch
$allVideos = $allVideos.not( ignoreList ); // Disable FitVids on this video.
$allVideos.each(function(){
var $this = $(this);
if($this.parents(ignoreList).length > 0) {
return; // Disable FitVids on this video.
}
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
{
$this.attr('height', 9);
$this.attr('width', 16);
}
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
aspectRatio = height / width;
if(!$this.attr('id')){
var videoID = 'fitvid' + Math.floor(Math.random()*999999);
$this.attr('id', videoID);
}
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
$this.removeAttr('height').removeAttr('width');
});
});
};
// Works with either jQuery or Zepto
$allVideos.each(
function(){
var $this = $( this );
if ($this.parents( ignoreList ).length > 0) {
return; // Disable FitVids on this video.
}
if (this.tagName.toLowerCase() === 'embed' && $this.parent( 'object' ).length || $this.parent( '.fluid-width-video-wrapper' ).length) {
return; }
if (( ! $this.css( 'height' ) && ! $this.css( 'width' )) && (isNaN( $this.attr( 'height' ) ) || isNaN( $this.attr( 'width' ) ))) {
$this.attr( 'height', 9 );
$this.attr( 'width', 16 );
}
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr( 'height' ) && ! isNaN( parseInt( $this.attr( 'height' ), 10 ) )) ) ? parseInt( $this.attr( 'height' ), 10 ) : $this.height(),
width = ! isNaN( parseInt( $this.attr( 'width' ), 10 ) ) ? parseInt( $this.attr( 'width' ), 10 ) : $this.width(),
aspectRatio = height / width;
if ( ! $this.attr( 'id' )) {
var videoID = 'fitvid' + Math.floor( Math.random() * 999999 );
$this.attr( 'id', videoID );
}
$this.wrap( '<div class="fluid-width-video-wrapper"></div>' ).parent( '.fluid-width-video-wrapper' ).css( 'padding-top', (aspectRatio * 100) + '%' );
$this.removeAttr( 'height' ).removeAttr( 'width' );
}
);
}
);
};
// Works with either jQuery or Zepto
})( window.jQuery || window.Zepto );

View File

@@ -1,119 +1,138 @@
function sp_viewport() {
var e = window, a = 'inner';
if (!('innerWidth' in window )) {
a = 'client';
e = document.documentElement || document.body;
}
return { width : e[ a+'Width' ] , height : e[ a+'Height' ] };
var e = window, a = 'inner';
if ( ! ('innerWidth' in window )) {
a = 'client';
e = document.documentElement || document.body;
}
return { width : e[ a + 'Width' ] , height : e[ a + 'Height' ] };
}
(function($) {
/* Header */
if ( ! $('.sp-header').length ) {
$('body').prepend( '<div class="sp-header sp-header-loaded"></div>' );
if ( ! $( '.sp-header' ).length ) {
$( 'body' ).prepend( '<div class="sp-header sp-header-loaded"></div>' );
}
/* Countdown */
$("[data-countdown]").each(function() {
var $this = $(this);
// Get countdown time
var countDownDate = new Date($(this).data('countdown')).getTime();
// Iterate every second
var x = setInterval(function() {
// Get todays date and time
var now = new Date();
// Convert curent date and time to UTC
var tzDifference = now.getTimezoneOffset();
var nowutc = new Date(now.getTime() + tzDifference * 60 * 1000);
// Find the distance between now and the count down date
var distance = countDownDate - nowutc;
if ( distance < 0 ) {
distance = 0;
}
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result
$this.html("<span>"+(days < 10 ? '0' + days : days)+" <small>" + localized_strings.days + "</small></span> "
+ "<span>"+('0' + hours).slice(-2)+" <small>" + localized_strings.hrs + "</small></span> "
+ "<span>"+('0' + minutes).slice(-2)+" <small>" + localized_strings.mins + "</small></span> "
+ "<span>"+('0' + seconds).slice(-2)+" <small>" + localized_strings.secs + "</small></span>" );
}, 1000);
});
$( "[data-countdown]" ).each(
function() {
var $this = $( this );
// Get countdown time
var countDownDate = new Date( $( this ).data( 'countdown' ) ).getTime();
// Iterate every second
var x = setInterval(
function() {
// Get todays date and time
var now = new Date();
// Convert curent date and time to UTC
var tzDifference = now.getTimezoneOffset();
var nowutc = new Date( now.getTime() + tzDifference * 60 * 1000 );
// Find the distance between now and the count down date
var distance = countDownDate - nowutc;
if ( distance < 0 ) {
distance = 0;
}
// Time calculations for days, hours, minutes and seconds
var days = Math.floor( distance / (1000 * 60 * 60 * 24) );
var hours = Math.floor( (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) );
var minutes = Math.floor( (distance % (1000 * 60 * 60)) / (1000 * 60) );
var seconds = Math.floor( (distance % (1000 * 60)) / 1000 );
// Output the result
$this.html(
"<span>" + (days < 10 ? '0' + days : days) + " <small>" + localized_strings.days + "</small></span> "
+ "<span>" + ('0' + hours).slice( -2 ) + " <small>" + localized_strings.hrs + "</small></span> "
+ "<span>" + ('0' + minutes).slice( -2 ) + " <small>" + localized_strings.mins + "</small></span> "
+ "<span>" + ('0' + seconds).slice( -2 ) + " <small>" + localized_strings.secs + "</small></span>"
);
},
1000
);
}
);
/* Scrollable Tables */
$(".sp-scrollable-table").wrap("<div class=\"sp-scrollable-table-wrapper\"></div>");
$( ".sp-scrollable-table" ).wrap( "<div class=\"sp-scrollable-table-wrapper\"></div>" );
/* Selector Redirect */
$(".sp-selector-redirect").change(function() {
window.location = $(this).val();
});
$( ".sp-selector-redirect" ).change(
function() {
window.location = $( this ).val();
}
);
/* Template Tabs */
$(".sp-tab-menu-item a").click(function() {
$template = $(this).data("sp-tab");
$(this).closest(".sp-tab-menu-item").addClass("sp-tab-menu-item-active").siblings(".sp-tab-menu-item").removeClass("sp-tab-menu-item-active");
$(this).closest(".sp-tab-group").find(".sp-tab-content-"+$template).show().siblings(".sp-tab-content").hide();
return false;
});
$( ".sp-tab-menu-item a" ).click(
function() {
$template = $( this ).data( "sp-tab" );
$( this ).closest( ".sp-tab-menu-item" ).addClass( "sp-tab-menu-item-active" ).siblings( ".sp-tab-menu-item" ).removeClass( "sp-tab-menu-item-active" );
$( this ).closest( ".sp-tab-group" ).find( ".sp-tab-content-" + $template ).show().siblings( ".sp-tab-content" ).hide();
return false;
}
);
/* API method to get paging information */
$.fn.dataTableExt.oApi.fnPagingInfo = function ( oSettings )
{
return {
"iStart": oSettings._iDisplayStart,
"iEnd": oSettings.fnDisplayEnd(),
"iLength": oSettings._iDisplayLength,
"iTotal": oSettings.fnRecordsTotal(),
"iFilteredTotal": oSettings.fnRecordsDisplay(),
"iPage": oSettings._iDisplayLength === -1 ?
0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
"iTotalPages": oSettings._iDisplayLength === -1 ?
0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
};
return {
"iStart": oSettings._iDisplayStart,
"iEnd": oSettings.fnDisplayEnd(),
"iLength": oSettings._iDisplayLength,
"iTotal": oSettings.fnRecordsTotal(),
"iFilteredTotal": oSettings.fnRecordsDisplay(),
"iPage": oSettings._iDisplayLength === -1 ?
0 : Math.ceil( oSettings._iDisplayStart / oSettings._iDisplayLength ),
"iTotalPages": oSettings._iDisplayLength === -1 ?
0 : Math.ceil( oSettings.fnRecordsDisplay() / oSettings._iDisplayLength )
};
}
/* Data Tables */
$(".sp-data-table").each(function() {
sortable = $(this).hasClass("sp-sortable-table");
paginated = $(this).hasClass("sp-paginated-table");
display_length = parseInt($(this).attr("data-sp-rows"));
if ( display_length == undefined || isNaN( display_length ) ) display_length = 10;
if ( $(this).find("tbody tr").length <= display_length ) paginated = false;
if ( sortable || paginated ) {
$(this).dataTable({
"order": [],
"autoWidth": false,
"searching": false,
"info": false,
"paging": paginated,
"lengthChange": false,
"pagingType": "simple_numbers",
"pageLength": display_length,
"ordering": sortable,
"language": {
"aria": {
"sortAscending": "",
"sortDescending": ""
},
"paginate": {
"previous": localized_strings.previous,
"next": localized_strings.next,
}
},
"columnDefs": [
{ "type": "num-fmt", "targets": [ ".data-number", ".data-rank" ] },
]
});
$( ".sp-data-table" ).each(
function() {
sortable = $( this ).hasClass( "sp-sortable-table" );
paginated = $( this ).hasClass( "sp-paginated-table" );
display_length = parseInt( $( this ).attr( "data-sp-rows" ) );
if ( display_length == undefined || isNaN( display_length ) ) {
display_length = 10;
}
if ( $( this ).find( "tbody tr" ).length <= display_length ) {
paginated = false;
}
if ( sortable || paginated ) {
$( this ).dataTable(
{
"order": [],
"autoWidth": false,
"searching": false,
"info": false,
"paging": paginated,
"lengthChange": false,
"pagingType": "simple_numbers",
"pageLength": display_length,
"ordering": sortable,
"language": {
"aria": {
"sortAscending": "",
"sortDescending": ""
},
"paginate": {
"previous": localized_strings.previous,
"next": localized_strings.next,
}
},
"columnDefs": [
{ "type": "num-fmt", "targets": [ ".data-number", ".data-rank" ] },
]
}
);
}
}
});
);
})(jQuery);
})( jQuery );