Spaces:
Sleeping
Sleeping
Update app.R
Browse files
app.R
CHANGED
|
@@ -124,12 +124,19 @@ build_pitcher_table <- function(lb, min_pitches, portal_only) {
|
|
| 124 |
'+baseball+twitter" target="_blank">🐦 Search</a>'),
|
| 125 |
`Board` = paste0('<button class="board-btn" data-pitcher="',
|
| 126 |
gsub('"', '"', Pitcher),
|
| 127 |
-
'" data-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
'" data-
|
| 132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 133 |
Name = ifelse(HasSinker,
|
| 134 |
paste0('<span style="background:#cce5ff; padding:2px 6px;',
|
| 135 |
'border-radius:3px; font-weight:700;">', Name, '</span>'),
|
|
@@ -311,12 +318,9 @@ ui <- fluidPage(
|
|
| 311 |
// board modal
|
| 312 |
$(document).on('click', '.board-btn', function() {
|
| 313 |
var d = $(this).data();
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
$('#board_first').val(parts[0] || '');
|
| 318 |
-
$('#board_last').val(parts.slice(1).join(' ') || '');
|
| 319 |
-
$('#board_school').val(d.team || '');
|
| 320 |
$('#board_throws').val(d.throws || '');
|
| 321 |
$('#board_height').val(d.height || '');
|
| 322 |
$('#board_weight').val(d.weight || '');
|
|
@@ -965,12 +969,11 @@ make_color_ramp <- function(values, low, high, flip = FALSE,
|
|
| 965 |
Last = d$last,
|
| 966 |
School = d$school,
|
| 967 |
Position = d$position,
|
|
|
|
| 968 |
Height = d$height,
|
| 969 |
Weight = d$weight,
|
| 970 |
-
Throws = d$throws,
|
| 971 |
Notes = d$notes,
|
| 972 |
`Added By` = d$added_by,
|
| 973 |
-
`Date Added` = format(Sys.time(), "%Y-%m-%d %H:%M"),
|
| 974 |
check.names = FALSE
|
| 975 |
)
|
| 976 |
|
|
|
|
| 124 |
'+baseball+twitter" target="_blank">🐦 Search</a>'),
|
| 125 |
`Board` = paste0('<button class="board-btn" data-pitcher="',
|
| 126 |
gsub('"', '"', Pitcher),
|
| 127 |
+
'" data-first="', gsub('"', '"', sapply(Pitcher, function(n) {
|
| 128 |
+
parts <- strsplit(n, ", ")[[1]]
|
| 129 |
+
if (length(parts)==2) trimws(parts[2]) else n
|
| 130 |
+
})),
|
| 131 |
+
'" data-last="', gsub('"', '"', sapply(Pitcher, function(n) {
|
| 132 |
+
parts <- strsplit(n, ", ")[[1]]
|
| 133 |
+
if (length(parts)==2) trimws(parts[1]) else n
|
| 134 |
+
})),
|
| 135 |
+
'" data-team="', gsub('"', '"', ifelse(is.na(Team), "", Team)),
|
| 136 |
+
'" data-throws="', gsub('"', '"', ifelse(is.na(Throws), "", Throws)),
|
| 137 |
+
'" data-height="', gsub('"', '"', ifelse(is.na(Height), "", Height)),
|
| 138 |
+
'" data-weight="', gsub('"', '"', ifelse(is.na(Weight), "", Weight)),
|
| 139 |
+
'">⭐ Add</button>')
|
| 140 |
Name = ifelse(HasSinker,
|
| 141 |
paste0('<span style="background:#cce5ff; padding:2px 6px;',
|
| 142 |
'border-radius:3px; font-weight:700;">', Name, '</span>'),
|
|
|
|
| 318 |
// board modal
|
| 319 |
$(document).on('click', '.board-btn', function() {
|
| 320 |
var d = $(this).data();
|
| 321 |
+
$('#board_first').val(d.first || '');
|
| 322 |
+
$('#board_last').val(d.last || '');
|
| 323 |
+
$('#board_school').val(d.team || '');
|
|
|
|
|
|
|
|
|
|
| 324 |
$('#board_throws').val(d.throws || '');
|
| 325 |
$('#board_height').val(d.height || '');
|
| 326 |
$('#board_weight').val(d.weight || '');
|
|
|
|
| 969 |
Last = d$last,
|
| 970 |
School = d$school,
|
| 971 |
Position = d$position,
|
| 972 |
+
Hand = d$throws,
|
| 973 |
Height = d$height,
|
| 974 |
Weight = d$weight,
|
|
|
|
| 975 |
Notes = d$notes,
|
| 976 |
`Added By` = d$added_by,
|
|
|
|
| 977 |
check.names = FALSE
|
| 978 |
)
|
| 979 |
|