diff --git a/R/package.R b/R/package.R index 9a113d7c..53530d8d 100644 --- a/R/package.R +++ b/R/package.R @@ -5,4 +5,4 @@ #' @import stats utils NULL -DataTablesVersion = '1.13.6' +DataTablesVersion = "2.1.4" diff --git a/tools/download_src_files.R b/tools/download_src_files.R new file mode 100644 index 00000000..46e9eb5e --- /dev/null +++ b/tools/download_src_files.R @@ -0,0 +1,109 @@ +# Update the html_text variable with the latest DataTables CDN links +# To update: +# 1. Visit https://datatables.net/download/index +# 2. Select all default options except "Extensions" +# 3. At the bottom of the page, click the "CDN" panel +# 4. Choose "Minified" but not "Concatenated" +# 5. Copy the entire CDN panel content +# 6. Replace the html_text variable below with the copied content +# +# Note: This ensures we always have the most up-to-date DataTables resources +# while maintaining a consistent structure for our download process. + +version = "2.1.4" # this must be the same as the version in the html_text +html_text = r"{ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +}" +download_datatables_files = function(html_text) { + # Define the base directory as a variable + base_dir = "download/DataTables" + # Create the base directory and ensure it's empty + if (dir.exists(base_dir)) { + unlink(base_dir, recursive = TRUE) + } + dir.create(base_dir, recursive = TRUE, showWarnings = FALSE) + + # Extract URLs from the HTML text + urls = unlist(regmatches(html_text, gregexpr("https://[^\"]+", html_text))) + + # replace all the xxx.js to xxx.min.js, except xxx.min.js + # Replace xxx.js with xxx.min.js, except for already minified files + urls = gsub("(?