Merge branch 'master' into feature-league-tables-bypass-ordering

This commit is contained in:
Brian Miyaji
2021-09-30 17:32:50 +09:00
committed by GitHub
119 changed files with 4379 additions and 2238 deletions

View File

@@ -11,7 +11,7 @@
var p = g.split("[");
var label = p.shift();
var variations = p.shift();
var shortcodes = variations.split("|");
var shortcodes = typeof variations!== 'undefined' ? variations.split("|") : [];
var submenu = new Array();
shortcodes.forEach(function(s) {
submenu.push({

View File

@@ -23,14 +23,14 @@ jQuery(document).ready(function($){
})
.click(function(){
$('.iris-picker').hide();
$(this).closest('.sp-icon-color-box, td').find('.iris-picker').show();
$(this).closest('.sp-color-box-for-icon, td').find('.iris-picker').show();
});
$('body').click(function() {
$('.iris-picker').hide();
});
$('.sp-icon-color-box, .colorpick').click(function(event){
$('.sp-color-box-for-icon, .colorpick').click(function(event){
event.stopPropagation();
});

View File

@@ -1,16 +0,0 @@
jQuery(document).ready(function($){
$(".sp-location-picker").locationpicker({
location: {
latitude: Number($(".sp-latitude").val()),
longitude: Number($(".sp-longitude").val())
},
radius: 0,
inputBinding: {
latitudeInput: $(".sp-latitude"),
longitudeInput: $(".sp-longitude"),
locationNameInput: $(".sp-address")
},
addressFormat: null,
enableAutocomplete: true
});
});

View File

@@ -0,0 +1,54 @@
//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;
}
})
});
//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

@@ -0,0 +1,54 @@
//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;
}
})
});
//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);

View File

@@ -14,13 +14,16 @@ jQuery(document).ready(function($){
});
// Chosen select
$(".chosen-select").chosen({
allow_single_deselect: true,
search_contains: true,
single_backstroke_delete: false,
disable_search_threshold: 10,
placeholder_text_multiple: localized_strings.none
});
$(document).on("postbox-toggled", function() {
$(".chosen-select").filter(":visible").chosen({
allow_single_deselect: true,
search_contains: true,
single_backstroke_delete: false,
disable_search_threshold: 10,
placeholder_text_multiple: localized_strings.none
});
}).trigger("postbox-toggled");
// Auto key placeholder
$("#poststuff #title").on("keyup", function() {
@@ -37,7 +40,7 @@ jQuery(document).ready(function($){
// Radio input toggle
$(".sp-radio-toggle").click(function() {
if($(this).data("sp-checked")) {
$(this).attr("checked", false );
$(this).prop("checked", false );
$(this).data("sp-checked", false );
} else {
$(this).data("sp-checked", true );
@@ -255,7 +258,7 @@ jQuery(document).ready(function($){
});
// Activate total stats calculator
if($(".sp-data-table .sp-total").size()) {
if($(".sp-data-table .sp-total").length) {
$(".sp-data-table .sp-post td input").on("keyup", function() {
$(this).closest(".sp-data-table").find(".sp-total td").eq($(this).parent().index()).find("input[data-sp-format=number][data-sp-total-type!=average]").trigger("updateTotal");
});
@@ -488,11 +491,11 @@ jQuery(document).ready(function($){
});
// Event format affects data
$(".post-type-sp_event #post-formats-select input.post-format").change(function() {
$(".post-type-sp_event #post-formats-select").change(function() {
layout = $(".post-type-sp_event #post-formats-select input:checked").val();
if ( layout == "friendly" ) {
$(".sp_event-sp_league-field").show().find("select").prop("disabled", false);
$(".sp_event-sp_season-field").show().find("select").prop("disabled", false);
$(".sp_event-sp_league-field").hide().find("select").prop("disabled", true);
$(".sp_event-sp_season-field").hide().find("select").prop("disabled", true);
} else {
$(".sp_event-sp_league-field").show().find("select").prop("disabled", false);
$(".sp_event-sp_season-field").show().find("select").prop("disabled", false);
@@ -500,10 +503,10 @@ jQuery(document).ready(function($){
});
// Trigger event format change
$(".post-type-sp_event #post-formats-select input.post-format").trigger("change");
$(".post-type-sp_event #post-formats-select").trigger("change");
// Calendar layout affects data
$(".post-type-sp_calendar #post-formats-select input.post-format").change(function() {
$(".post-type-sp_calendar #post-formats-select").change(function() {
layout = $(".post-type-sp_calendar #post-formats-select input:checked").val();
$(".sp-calendar-table tr").each(function() {
if ( layout == "list" ) {
@@ -517,10 +520,10 @@ jQuery(document).ready(function($){
});
// Trigger calendar layout change
$(".post-type-sp_calendar #post-formats-select input.post-format").trigger("change");
$(".post-type-sp_calendar #post-formats-select").trigger("change");
// Player list layout affects data
$(".post-type-sp_list #post-formats-select input.post-format").change(function() {
$(".post-type-sp_list #post-formats-select").change(function() {
layout = $(".post-type-sp_list #post-formats-select input:checked").val();
$(".sp-player-list-table tr").each(function() {
if ( layout == "list" ) {
@@ -532,7 +535,7 @@ jQuery(document).ready(function($){
});
// Trigger player list layout change
$(".post-type-sp_list #post-formats-select input.post-format").trigger("change");
$(".post-type-sp_list #post-formats-select").trigger("change");
// Configure primary result option (Ajax)
$(".sp-admin-config-table").on("click", ".sp-primary-result-option", function() {