feat: update charity project assets, add livestream media, and clean up temporary migration scripts

This commit is contained in:
2026-07-15 16:37:05 +07:00
parent f4e24a0e00
commit fd4ad87a32
168 changed files with 3596 additions and 717 deletions
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class CheckCat {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
PreparedStatement stmt = conn.prepareStatement("SELECT category_id FROM sis_post WHERE id = 6450");
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
System.out.println("Category ID: " + rs.getLong(1));
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+26
View File
@@ -0,0 +1,26 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class CheckCategories {
public static void main(String[] args) {
try {
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT id, name, slug FROM sis_category");
while (rs.next()) {
System.out.println(rs.getLong("id") + " - " + rs.getString("name") + " (" + rs.getString("slug") + ")");
}
System.out.println("--- POSTS ---");
rs = stmt.executeQuery("SELECT id, title, slug, category_id, status FROM sis_post WHERE ROWNUM <= 10");
while (rs.next()) {
System.out.println("Post: " + rs.getLong("id") + " - " + rs.getString("title") + " (Cat: " + rs.getLong("category_id") + ", Status: " + rs.getString("status") + ")");
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class CheckCategories2 {
public static void main(String[] args) {
try {
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
Statement stmt = conn.createStatement();
System.out.println("--- CATEGORIES ---");
ResultSet rs = stmt.executeQuery("SELECT id, name, slug FROM sis_category");
while (rs.next()) {
System.out.println(rs.getLong("id") + " - " + rs.getString("name") + " (" + rs.getString("slug") + ")");
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class CheckComponents {
public static void main(String[] args) {
try {
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
Statement stmt = conn.createStatement();
System.out.println("--- COMPONENT TEMPLATES ---");
ResultSet rs = stmt.executeQuery("SELECT slug, name FROM sis_component_template");
while (rs.next()) {
System.out.println(rs.getString("slug") + " - " + rs.getString("name"));
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class CheckJson {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
PreparedStatement stmt = conn.prepareStatement(
"SELECT id, slug, data_json FROM sis_page"
);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
System.out.println("ID: " + rs.getLong("id") + " Slug: " + rs.getString("slug"));
String json = rs.getString("data_json");
if (json != null && json.contains("livestream_posts")) {
System.out.println("Found livestream_posts in page: " + rs.getString("slug"));
}
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class CheckNewsEventsTemplate {
public static void main(String[] args) {
try {
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT html_template FROM sis_component_template WHERE slug = 'news-events'");
if (rs.next()) {
System.out.println(rs.getString("html_template"));
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+20
View File
@@ -0,0 +1,20 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class CheckNewsGrid {
public static void main(String[] args) {
try {
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT html_template FROM sis_component_template WHERE slug = 'news-grid'");
if (rs.next()) {
System.out.println("TEMPLATE:");
System.out.println(rs.getString("html_template"));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class CheckPosts {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
PreparedStatement stmt = conn.prepareStatement(
"SELECT id, slug, title FROM sis_post ORDER BY id DESC FETCH FIRST 10 ROWS ONLY"
);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
System.out.println("ID: " + rs.getLong("id") + " Slug: " + rs.getString("slug") + " Title: " + rs.getString("title"));
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
+32
View File
@@ -0,0 +1,32 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
public class CheckRender {
public static void main(String[] args) {
try {
URL url = new URL("http://localhost:8080/");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.connect();
if (conn.getResponseCode() == 200) {
InputStream is = conn.getInputStream();
Scanner scanner = new Scanner(is, "UTF-8").useDelimiter("\\A");
String html = scanner.hasNext() ? scanner.next() : "";
int idx = html.indexOf("news-card__image");
if (idx != -1) {
System.out.println(html.substring(idx, Math.min(idx + 300, html.length())));
} else {
System.out.println("Could not find news-card__image in HTML");
}
} else {
System.out.println("HTTP " + conn.getResponseCode());
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+21
View File
@@ -0,0 +1,21 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class CheckSnippets {
public static void main(String[] args) {
try {
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT slug, content FROM html_snippet");
while (rs.next()) {
if (rs.getString("content") != null && rs.getString("content").contains("news-grid")) {
System.out.println("Snippet with news-grid: " + rs.getString("slug"));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class CheckTables {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
PreparedStatement stmt = conn.prepareStatement(
"SELECT table_name FROM user_tables"
);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
System.out.println("Table: " + rs.getString("table_name"));
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+22
View File
@@ -0,0 +1,22 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class CheckTag {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
PreparedStatement stmt = conn.prepareStatement("SELECT tag_id FROM sis_post_tag WHERE post_id = 6450");
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
System.out.println("Tag ID: " + rs.getLong(1));
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+28
View File
@@ -0,0 +1,28 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
public class CheckTags {
public static void main(String[] args) {
try {
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
Statement stmt = conn.createStatement();
System.out.println("--- TAGS ---");
ResultSet rs = stmt.executeQuery("SELECT id, name, slug FROM sis_tag");
while (rs.next()) {
System.out.println(rs.getLong("id") + " - " + rs.getString("name") + " (" + rs.getString("slug") + ")");
}
System.out.println("--- POST TAGS ---");
rs = stmt.executeQuery("SELECT post_id, tag_id FROM sis_post_tag");
while (rs.next()) {
System.out.println("Post: " + rs.getLong("post_id") + " - Tag: " + rs.getLong("tag_id"));
}
conn.close();
} catch (Exception e) {
System.out.println("Error: " + e.getMessage());
}
}
}
Binary file not shown.
+105
View File
@@ -0,0 +1,105 @@
import java.io.File;
import java.nio.file.Files;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PopulateLivestream {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
// Get category ID
PreparedStatement catStmt = conn.prepareStatement("SELECT id FROM sis_category WHERE slug = 'livestream'");
ResultSet rsCat = catStmt.executeQuery();
long catId = -1;
if (rsCat.next()) {
catId = rsCat.getLong("id");
}
if (catId == -1) {
System.out.println("Category 'livestream' not found!");
return;
}
// Delete old posts
PreparedStatement delStmt = conn.prepareStatement("DELETE FROM sis_post WHERE category_id = ?");
delStmt.setLong(1, catId);
delStmt.executeUpdate();
String baseDir = "/home/x79/sisvietnamvn_01/Media/Livestream";
String uploadDir = "/home/x79/sisvietnamvn_01/sisvietnamvn_main/src/main/resources/static/upload/livestream";
new File(uploadDir).mkdirs();
long currentId = 6500;
for (int i = 1; i <= 4; i++) {
String folder = baseDir + "/Tuan" + i;
File f = new File(folder);
if (!f.exists()) continue;
String title = "Tuần " + i;
String excerpt = "";
StringBuilder content = new StringBuilder();
String metaDesc = "";
String imageUrl = "";
File contentFile = new File(folder, "content.txt");
if (contentFile.exists()) {
List<String> lines = Files.readAllLines(contentFile.toPath());
if (lines.size() > 0) title = lines.get(0);
if (lines.size() > 1) excerpt = lines.get(1);
for (int j = 2; j < lines.size(); j++) {
content.append(lines.get(j)).append("<br>");
}
}
File embedFile = new File(folder, "embed.txt");
if (!embedFile.exists()) embedFile = new File(folder, "url.txt");
if (embedFile.exists()) {
String embedStr = Files.readString(embedFile.toPath());
Matcher m = Pattern.compile("src=\"([^\"]+)\"").matcher(embedStr);
if (m.find()) {
metaDesc = m.group(1);
}
}
for (File img : f.listFiles()) {
if (img.getName().endsWith(".jpg") || img.getName().endsWith(".png")) {
File dest = new File(uploadDir, "tuan" + i + "_" + img.getName());
Files.copy(img.toPath(), dest.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
imageUrl = "/upload/livestream/" + dest.getName();
break;
}
}
String slug = "livestream-tuan-" + i;
PreparedStatement insertStmt = conn.prepareStatement(
"INSERT INTO sis_post (id, slug, title, excerpt, content, meta_description, featured_image, category_id, created_date, is_published, views) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, SYSDATE, 1, 0)"
);
insertStmt.setLong(1, currentId++);
insertStmt.setString(2, slug);
insertStmt.setString(3, title);
insertStmt.setString(4, excerpt);
insertStmt.setString(5, content.toString());
insertStmt.setString(6, metaDesc);
insertStmt.setString(7, imageUrl);
insertStmt.setLong(8, catId);
insertStmt.executeUpdate();
System.out.println("Inserted Tuan " + i);
}
conn.close();
System.out.println("Done.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+126
View File
@@ -0,0 +1,126 @@
import java.io.File;
import java.nio.file.Files;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.List;
import java.util.stream.Collectors;
public class PopulateLivestreamFinal {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
long tagId = 6351;
// Delete old tags first, then old posts
PreparedStatement delTagStmt = conn.prepareStatement(
"DELETE FROM sis_post_tag WHERE tag_id = ?");
delTagStmt.setLong(1, tagId);
delTagStmt.executeUpdate();
PreparedStatement delStmt = conn.prepareStatement(
"DELETE FROM sis_post WHERE id BETWEEN 6600 AND 6610");
delStmt.executeUpdate();
String baseDir = "/home/x79/sisvietnamvn_01/Media/Livestream";
String uploadDir = "/home/x79/sisvietnamvn_01/sisvietnamvn_main/src/main/resources/static/upload/livestream";
new File(uploadDir).mkdirs();
long currentId = 6600;
for (int i = 1; i <= 4; i++) {
String folder = baseDir + "/Tuan" + i;
File f = new File(folder);
if (!f.exists()) continue;
// Title is just the week number for tab display
String title = String.valueOf(i);
// Excerpt is the short topic headline (line 2 of content.txt, after the program name)
String excerpt = "";
StringBuilder content = new StringBuilder();
String metaDescRaw = "";
String imageUrl = "";
File contentFile = new File(folder, "content.txt");
if (contentFile.exists()) {
List<String> lines = Files.readAllLines(contentFile.toPath())
.stream().filter(l -> !l.trim().isEmpty()).collect(Collectors.toList());
// Line 0 = full program name (used as excerpt/subtitle)
// Extract the topic after "Chủ đề:" if present
if (lines.size() > 0) {
String fullTitle = lines.get(0);
int chuDeIdx = fullTitle.indexOf("Chủ đề:");
if (chuDeIdx >= 0) {
excerpt = fullTitle.substring(chuDeIdx + "Chủ đề:".length()).trim();
} else {
chuDeIdx = fullTitle.indexOf("Chủ đề: ");
if (chuDeIdx >= 0) {
excerpt = fullTitle.substring(chuDeIdx + "Chủ đề: ".length()).trim();
} else {
excerpt = fullTitle;
}
}
}
// Line 1 onward = description content
if (lines.size() > 1) {
// Take first 2-3 meaningful lines as description
int maxLines = Math.min(lines.size(), 4);
for (int j = 1; j < maxLines; j++) {
content.append(lines.get(j));
if (j < maxLines - 1) content.append("<br>");
}
}
}
File embedFile = new File(folder, "embed.txt");
if (embedFile.exists()) {
metaDescRaw = Files.readString(embedFile.toPath()).trim();
}
// Find image
for (File img : f.listFiles()) {
String name = img.getName().toLowerCase();
if (name.endsWith(".jpg") || name.endsWith(".png") || name.endsWith(".jpeg")) {
File dest = new File(uploadDir, "tuan" + i + "_" + img.getName());
Files.copy(img.toPath(), dest.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
imageUrl = "/upload/livestream/" + dest.getName();
break;
}
}
String slug = "livestream-tuan-" + i;
PreparedStatement insertStmt = conn.prepareStatement(
"INSERT INTO sis_post (id, slug, title, excerpt, content, meta_description, featured_image, category_id, created_date, status, layout, created_by) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, NULL, SYSDATE, 'PUBLISHED', 'STANDARD', 'admin')"
);
insertStmt.setLong(1, currentId);
insertStmt.setString(2, slug);
insertStmt.setString(3, title);
insertStmt.setString(4, excerpt);
insertStmt.setString(5, content.toString());
insertStmt.setString(6, metaDescRaw);
insertStmt.setString(7, imageUrl);
insertStmt.executeUpdate();
PreparedStatement tagStmt = conn.prepareStatement(
"INSERT INTO sis_post_tag (post_id, tag_id) VALUES (?, ?)");
tagStmt.setLong(1, currentId);
tagStmt.setLong(2, tagId);
tagStmt.executeUpdate();
currentId++;
System.out.println("Inserted Tuan " + i + " | excerpt=" + excerpt + " | image=" + imageUrl);
}
conn.close();
System.out.println("Done populating livestream data.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+100
View File
@@ -0,0 +1,100 @@
import java.io.File;
import java.nio.file.Files;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;
import java.util.stream.Collectors;
public class PopulateLivestreamRaw {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
// Get tag ID
long tagId = 6351; // Hardcoded from CheckTag
// Delete old tags
PreparedStatement delTagStmt = conn.prepareStatement("DELETE FROM sis_post_tag WHERE post_id IN (SELECT id FROM sis_post WHERE category_id IS NULL) OR tag_id = ?");
delTagStmt.setLong(1, tagId);
delTagStmt.executeUpdate();
// Delete old posts
PreparedStatement delStmt = conn.prepareStatement("DELETE FROM sis_post WHERE id = 6450 OR id >= 6600");
delStmt.executeUpdate();
String baseDir = "/home/x79/sisvietnamvn_01/Media/Livestream";
String uploadDir = "/home/x79/sisvietnamvn_01/sisvietnamvn_main/src/main/resources/static/upload/livestream";
new File(uploadDir).mkdirs();
long currentId = 6600;
for (int i = 1; i <= 4; i++) {
String folder = baseDir + "/Tuan" + i;
File f = new File(folder);
if (!f.exists()) continue;
String title = "Tuần " + i;
String excerpt = "Tuần " + i;
StringBuilder content = new StringBuilder();
String metaDescRaw = "";
String imageUrl = "";
File contentFile = new File(folder, "content.txt");
if (contentFile.exists()) {
List<String> lines = Files.readAllLines(contentFile.toPath()).stream().filter(l -> !l.trim().isEmpty()).collect(Collectors.toList());
if (lines.size() > 0) title = lines.get(0);
if (lines.size() > 1) excerpt = lines.get(1);
for (int j = 2; j < lines.size(); j++) {
content.append(lines.get(j)).append("<br>");
}
}
File embedFile = new File(folder, "embed.txt");
if (!embedFile.exists()) embedFile = new File(folder, "url.txt");
if (embedFile.exists()) {
metaDescRaw = Files.readString(embedFile.toPath()); // Keep entire raw iframe
}
for (File img : f.listFiles()) {
if (img.getName().endsWith(".jpg") || img.getName().endsWith(".png")) {
File dest = new File(uploadDir, "tuan" + i + "_" + img.getName());
Files.copy(img.toPath(), dest.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING);
imageUrl = "/upload/livestream/" + dest.getName();
break;
}
}
String slug = "livestream-tuan-" + i;
PreparedStatement insertStmt = conn.prepareStatement(
"INSERT INTO sis_post (id, slug, title, excerpt, content, meta_description, featured_image, category_id, created_date, status, layout, created_by) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, NULL, SYSDATE, 'PUBLISHED', 'STANDARD', 'admin')"
);
insertStmt.setLong(1, currentId);
insertStmt.setString(2, slug);
insertStmt.setString(3, title);
insertStmt.setString(4, excerpt);
insertStmt.setString(5, content.toString());
insertStmt.setString(6, metaDescRaw);
insertStmt.setString(7, imageUrl);
insertStmt.executeUpdate();
PreparedStatement tagStmt = conn.prepareStatement("INSERT INTO sis_post_tag (post_id, tag_id) VALUES (?, ?)");
tagStmt.setLong(1, currentId);
tagStmt.setLong(2, tagId);
tagStmt.executeUpdate();
currentId++;
System.out.println("Inserted Tuan " + i);
}
conn.close();
System.out.println("Done.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+88
View File
@@ -0,0 +1,88 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class PopulateNewsEventsEducation {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
// Delete old duplicate posts
PreparedStatement delTagStmt = conn.prepareStatement("DELETE FROM sis_post_tag WHERE post_id >= 7000");
delTagStmt.executeUpdate();
PreparedStatement delStmt = conn.prepareStatement("DELETE FROM sis_post WHERE id >= 7000");
delStmt.executeUpdate();
// Get post 4151 to duplicate
PreparedStatement getPost = conn.prepareStatement("SELECT title, excerpt, content, meta_description, featured_image, category_id, layout, created_by FROM sis_post WHERE id = 4151");
ResultSet rs = getPost.executeQuery();
if (!rs.next()) {
System.out.println("Post 4151 not found!");
return;
}
String originalTitle = rs.getString("title");
String excerpt = rs.getString("excerpt");
String content = rs.getString("content");
String metaDesc = rs.getString("meta_description");
String featuredImage = rs.getString("featured_image");
long categoryId = rs.getLong("category_id");
boolean catIsNull = rs.wasNull();
String layout = rs.getString("layout");
String createdBy = rs.getString("created_by");
long currentId = 7000;
long[] tagIds = {4251, 4252, 6151}; // news, event, education
String[] prefixes = {"[Tin Tức] ", "[Sự Kiện] ", "[Đào Tạo] "};
String[] slugPrefixes = {"tin-tuc-", "su-kien-", "dao-tao-"};
PreparedStatement insertStmt = conn.prepareStatement(
"INSERT INTO sis_post (id, slug, title, excerpt, content, meta_description, featured_image, category_id, created_date, status, layout, created_by) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, SYSDATE - ?, 'PUBLISHED', ?, ?)"
);
PreparedStatement tagStmt = conn.prepareStatement("INSERT INTO sis_post_tag (post_id, tag_id) VALUES (?, ?)");
for (int t = 0; t < 3; t++) {
for (int i = 1; i <= 4; i++) {
String title = prefixes[t] + originalTitle + " " + i;
String slug = slugPrefixes[t] + currentId;
insertStmt.setLong(1, currentId);
insertStmt.setString(2, slug);
insertStmt.setString(3, title);
insertStmt.setString(4, excerpt);
insertStmt.setString(5, content);
insertStmt.setString(6, metaDesc);
insertStmt.setString(7, featuredImage);
if (catIsNull) {
insertStmt.setNull(8, java.sql.Types.BIGINT);
} else {
insertStmt.setLong(8, categoryId);
}
insertStmt.setInt(9, i); // Subtract i days to vary dates
insertStmt.setString(10, layout);
insertStmt.setString(11, createdBy);
insertStmt.executeUpdate();
tagStmt.setLong(1, currentId);
tagStmt.setLong(2, tagIds[t]);
tagStmt.executeUpdate();
currentId++;
}
}
conn.close();
System.out.println("Done duplicating posts.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+162
View File
@@ -0,0 +1,162 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
// 1. Update the Post's meta_description (YouTube URL)
PreparedStatement updatePost = conn.prepareStatement(
"UPDATE sis_post SET meta_description = ? WHERE slug = 'sis-vi-suc-khoe-cong-dong-ky-134'"
);
updatePost.setString(1, "https://www.youtube.com/embed/j63kT9Bjrb4?si=N5JwIcuRn-iRxkYu");
updatePost.executeUpdate();
// 2. Update the template's iframe attributes
String htmlTemplate =
"<style>\n" +
" .tabbed-media-content-media-item { width: 100%; aspect-ratio: 16/9; position: relative; display: flex; align-items: center; justify-content: center; }\n" +
" .tabbed-media-content-media-item .f--video-embed { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
" .tabbed-media-content-media-item .f--video-embed iframe { width: 100%; height: 100%; }\n" +
" .tabbed-media-content-media-item .f--image { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
" .tabbed-media-content-media-item .button-play { z-index: 10; }\n" +
"</style>\n" +
"<div class=\"cc--component-container cc--tabbed-media-content\" style=\"background-color: var(--color-gray-100);\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <div class=\"tabbed-media-content-text-col\">\n" +
" <div data-component-id=\"umass_base:section-title\" class=\"f--section-title\">\n" +
" <h2 style=\"color: var(--color-brand);\">LiveStream</h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:tabbed-container\" data-once=\"tabbed-container\">\n" +
" <div class=\"tab-labels-container\" role=\"tablist\">\n" +
" <div class=\"tab-labels-inner\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"#tabbed-content-{{index}}\" class=\"tab-label link-context-dark\" role=\"tab\" aria-selected=\"false\" aria-controls=\"tabbed-content-{{index}}\">{{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tab-content-container\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tab-content-panel\" id=\"tabbed-content-{{index}}\" role=\"tabpanel\" aria-live=\"polite\">\n" +
" <div class=\"f--field f--cta-title\">\n" +
" <h2 style=\"color: var(--color-black);\"> {{excerpt}} </h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:description\" class=\"f--description\">\n" +
" <div style=\"color:var(--color-black);\">{{content}}</div>\n" +
" </div>\n" +
" <div class=\"cta-container\">\n" +
" <div class=\"f--field f--button\">\n" +
" <a href=\"/post/{{slug}}\" class=\"button-primary button-context-light \" aria-label=\"Tìm Hiểu Thêm\" data-component-id=\"umass_base:button\">\n" +
" <span class=\"button-text\"> Tìm Hiểu Thêm </span>\n" +
" </a>\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tabbed-media-content-media-col\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tabbed-media-content-media-item with-video\" data-tab-id=\"tabbed-content-{{index}}\">\n" +
" <div class=\"f--field f--image\">\n" +
" <img src=\"{{featuredImageUrl}}\" data-src=\"{{featuredImageUrl}}\" class=\"lazyload\" alt=\"{{title}}\" style=\"width:100%;height:100%;object-fit:cover;\">\n" +
" </div>\n" +
" <div class=\"f--field f--button\">\n" +
" <a href=\"#\" class=\"button-play button-context-light \" aria-label=\"Play video\" data-component-id=\"umass_base:button\">\n" +
" <span class=\"button-icon button-icon-play\">\n" +
" <svg width=\"18\" height=\"27\" viewBox=\"0 0 18 27\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n" +
" <path d=\"M18 13.5L0 0V27L18 13.5Z\"></path>\n" +
" </svg>\n" +
" </span>\n" +
" <span class=\"button-text visually-hidden\"> Play </span>\n" +
" </a>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:video-embed\" class=\"f--field f--video-embed\">\n" +
" <iframe title=\"YouTube video player\" src=\"{{metaDescription}}\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"<script>\n" +
" document.addEventListener(\"DOMContentLoaded\", function() {\n" +
" var tabs = document.querySelectorAll('.tabbed-media-content-media-item[data-tab-id=\"tabbed-content-0\"]');\n" +
" if(tabs.length > 0) tabs[0].classList.add('is-active');\n" +
" \n" +
" var panels = document.querySelectorAll('#tabbed-content-0.tab-content-panel');\n" +
" if(panels.length > 0) panels[0].classList.add('is-active');\n" +
"\n" +
" var labels = document.querySelectorAll('a.tab-label[aria-controls=\"tabbed-content-0\"]');\n" +
" if(labels.length > 0) labels[0].setAttribute('aria-selected', 'true');\n" +
"\n" +
" var allLabels = document.querySelectorAll('.tab-labels-inner .tab-label');\n" +
" allLabels.forEach(function(label) {\n" +
" label.addEventListener('click', function(e) {\n" +
" e.preventDefault();\n" +
" allLabels.forEach(function(l) { l.setAttribute('aria-selected', 'false'); });\n" +
" this.setAttribute('aria-selected', 'true');\n" +
" \n" +
" var targetId = this.getAttribute('aria-controls');\n" +
" document.querySelectorAll('.tab-content-panel').forEach(function(p) { p.classList.remove('is-active'); });\n" +
" document.querySelectorAll('.tabbed-media-content-media-item').forEach(function(m) { \n" +
" m.classList.remove('is-active'); \n" +
" var vEmbed = m.querySelector('.f--video-embed');\n" +
" if(vEmbed) vEmbed.style.display = 'none';\n" +
" var img = m.querySelector('.f--image');\n" +
" if(img) img.style.display = 'block';\n" +
" var btn = m.querySelector('.button-play');\n" +
" if(btn) btn.style.display = 'flex';\n" +
" var iframe = m.querySelector('iframe');\n" +
" if(iframe) { \n" +
" var src = iframe.src;\n" +
" iframe.src = src.replace('&autoplay=1', '').replace('?autoplay=1', '');\n" +
" }\n" +
" });\n" +
" \n" +
" var targetPanel = document.getElementById(targetId);\n" +
" if(targetPanel) targetPanel.classList.add('is-active');\n" +
" var targetMedia = document.querySelector('.tabbed-media-content-media-item[data-tab-id=\"' + targetId + '\"]');\n" +
" if(targetMedia) targetMedia.classList.add('is-active');\n" +
" });\n" +
" });\n" +
"\n" +
" var playButtons = document.querySelectorAll('.tabbed-media-content-media-item .button-play');\n" +
" playButtons.forEach(function(btn) {\n" +
" btn.addEventListener('click', function(e) {\n" +
" e.preventDefault();\n" +
" var mediaItem = this.closest('.tabbed-media-content-media-item');\n" +
" var img = mediaItem.querySelector('.f--image');\n" +
" var videoEmbed = mediaItem.querySelector('.f--video-embed');\n" +
" \n" +
" if(img) img.style.display = 'none';\n" +
" this.style.display = 'none';\n" +
" if(videoEmbed) videoEmbed.style.display = 'block';\n" +
" \n" +
" var iframe = mediaItem.querySelector('iframe');\n" +
" if(iframe && iframe.src.indexOf('autoplay=1') === -1) {\n" +
" iframe.src = iframe.src + (iframe.src.indexOf('?') > -1 ? '&' : '?') + 'autoplay=1';\n" +
" }\n" +
" });\n" +
" });\n" +
" });\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
updateTemplate.executeUpdate();
System.out.println("Update complete!");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+159
View File
@@ -0,0 +1,159 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate10 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
String htmlTemplate =
"<style>\n" +
"/* ── Livestream Section ── */\n" +
".ls-section { background: #f5f5f5; padding: 40px 0; }\n" +
".ls-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2, 16px); border-left: 5px solid #c0272d; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.07); border-radius: 6px; overflow: hidden; }\n" +
"\n" +
"/* Left column */\n" +
".ls-left { padding: 36px 32px 32px 32px; display: flex; flex-direction: column; }\n" +
".ls-heading { font-size: 22px; font-weight: 800; color: #111; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 20px; font-family: 'Inter', 'Segoe UI', sans-serif; }\n" +
"\n" +
"/* Tabs */\n" +
".ls-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 24px; }\n" +
".ls-tab { padding: 8px 18px; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; text-decoration: none; white-space: nowrap; }\n" +
".ls-tab:hover { color: #c0272d; }\n" +
".ls-tab.active { color: #c0272d; border-bottom-color: #c0272d; }\n" +
"\n" +
"/* Tab panels */\n" +
".ls-panel { display: none; flex-direction: column; flex: 1; }\n" +
".ls-panel.active { display: flex; }\n" +
".ls-panel-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 14px; line-height: 1.4; }\n" +
".ls-panel-desc { font-size: 14px; color: #555; line-height: 1.7; margin-bottom: 24px; flex: 1; }\n" +
".ls-btn { display: inline-block; padding: 10px 24px; background: #c0272d; color: #fff; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; text-decoration: none; transition: background 0.2s; align-self: flex-start; }\n" +
".ls-btn:hover { background: #a01f24; }\n" +
"\n" +
"/* Right column — poster image */\n" +
".ls-right { min-height: 360px; position: relative; overflow: hidden; }\n" +
".ls-poster { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
".ls-poster.active { display: block; }\n" +
".ls-poster .ls-thumbnail { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 2; cursor: pointer; }\n" +
".ls-poster .ls-thumbnail img { width: 100%; height: 100%; object-fit: cover; }\n" +
".ls-play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 70px; height: 70px; background: rgba(192, 39, 45, 0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3; transition: transform 0.2s, background 0.2s; }\n" +
".ls-play-btn:hover { transform: translate(-50%, -50%) scale(1.1); background: #c0272d; }\n" +
".ls-play-btn::after { content: ''; display: block; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; margin-left: 5px; }\n" +
".ls-video-embed { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 1; }\n" +
".ls-video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
"\n" +
"/* ── Responsive ── */\n" +
"@media (max-width: 900px) {\n" +
" .ls-wrapper { grid-template-columns: 1fr; border-left: none; border-top: 5px solid #c0272d; }\n" +
" .ls-left { padding: 28px 20px 24px; }\n" +
" .ls-right { min-height: 260px; position: relative; }\n" +
" .ls-poster { position: relative; }\n" +
" .ls-poster .ls-thumbnail img { height: auto; max-height: 400px; }\n" +
"}\n" +
"@media (max-width: 600px) {\n" +
" .ls-heading { font-size: 18px; }\n" +
" .ls-tab { padding: 6px 12px; font-size: 13px; }\n" +
" .ls-panel-title { font-size: 16px; }\n" +
" .ls-panel-desc { font-size: 13px; }\n" +
" .ls-right { min-height: 200px; }\n" +
" .ls-play-btn { width: 50px; height: 50px; }\n" +
" .ls-play-btn::after { border-width: 9px 0 9px 15px; }\n" +
"}\n" +
"</style>\n" +
"\n" +
"<div class=\"cc--component-container cc--tabbed-media-content ls-section\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <div class=\"ls-wrapper\">\n" +
" <!-- Left Column -->\n" +
" <div class=\"ls-left\">\n" +
" <h2 class=\"ls-heading\">Livestream Tháng 07</h2>\n" +
" <div class=\"ls-tabs\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"javascript:void(0)\" class=\"ls-tab\" data-tab=\"ls-panel-{{index}}\" onclick=\"switchLsTab(this)\">Tuần {{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-panel\" id=\"ls-panel-{{index}}\">\n" +
" <h3 class=\"ls-panel-title\">{{excerpt}}</h3>\n" +
" <div class=\"ls-panel-desc\">{{content}}</div>\n" +
" <a href=\"/post/{{slug}}\" class=\"ls-btn\">Tìm Hiểu Thêm</a>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" <!-- Right Column — Poster -->\n" +
" <div class=\"ls-right\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-poster\" data-poster=\"ls-panel-{{index}}\">\n" +
" <div class=\"ls-thumbnail\" onclick=\"playLsVideo('ls-panel-{{index}}')\">\n" +
" <img src=\"{{featuredImageUrl}}\" alt=\"{{title}}\" loading=\"lazy\">\n" +
" <div class=\"ls-play-btn\"></div>\n" +
" </div>\n" +
" <div class=\"ls-video-embed\" id=\"ls-video-{{index}}\">\n" +
" {{{metaDescriptionRaw}}}\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"\n" +
"<script>\n" +
"function switchLsTab(el) {\n" +
" var tabId = el.getAttribute('data-tab');\n" +
" document.querySelectorAll('.ls-tab').forEach(function(t){t.classList.remove('active');});\n" +
" el.classList.add('active');\n" +
" document.querySelectorAll('.ls-panel').forEach(function(p){p.classList.remove('active');});\n" +
" var panel = document.getElementById(tabId);\n" +
" if(panel) panel.classList.add('active');\n" +
" document.querySelectorAll('.ls-poster').forEach(function(p){\n" +
" p.classList.remove('active');\n" +
" // Pause video when switching tab\n" +
" var iframe = p.querySelector('iframe');\n" +
" if(iframe) { \n" +
" var src = iframe.src;\n" +
" iframe.src = src;\n" +
" }\n" +
" });\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) poster.classList.add('active');\n" +
"}\n" +
"function playLsVideo(tabId) {\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) {\n" +
" var thumb = poster.querySelector('.ls-thumbnail');\n" +
" var embed = poster.querySelector('.ls-video-embed');\n" +
" var iframe = embed.querySelector('iframe');\n" +
" if (thumb) thumb.style.display = 'none';\n" +
" if (embed) {\n" +
" embed.style.display = 'block';\n" +
" embed.style.zIndex = '4';\n" +
" // Add autoplay parameter to iframe src if not present\n" +
" if (iframe && iframe.src.indexOf('autoplay=1') === -1) {\n" +
" if (iframe.src.indexOf('?') > -1) iframe.src += '&autoplay=1';\n" +
" else iframe.src += '?autoplay=1';\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n" +
"document.addEventListener('DOMContentLoaded', function() {\n" +
" var first = document.querySelector('.ls-tab');\n" +
" if(first) switchLsTab(first);\n" +
"});\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
int rows = updateTemplate.executeUpdate();
System.out.println("Updated " + rows + " row(s).");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+157
View File
@@ -0,0 +1,157 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate11 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
String htmlTemplate =
"<style>\n" +
"/* ── Livestream Section ── */\n" +
".ls-section { background: #f5f5f5; padding: 40px 0; }\n" +
".c--tabbed-media-content { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2, 16px); border-left: 5px solid #c0272d; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.07); border-radius: 6px; overflow: hidden; }\n" +
"\n" +
"/* Left column */\n" +
".ls-left { padding: 36px 32px 32px 32px; display: flex; flex-direction: column; }\n" +
".ls-heading { font-size: 22px; font-weight: 800; color: #111; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 20px; font-family: 'Inter', 'Segoe UI', sans-serif; }\n" +
"\n" +
"/* Tabs */\n" +
".ls-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 24px; }\n" +
".ls-tab { padding: 8px 18px; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; text-decoration: none; white-space: nowrap; }\n" +
".ls-tab:hover { color: #c0272d; }\n" +
".ls-tab.active { color: #c0272d; border-bottom-color: #c0272d; }\n" +
"\n" +
"/* Tab panels */\n" +
".ls-panel { display: none; flex-direction: column; flex: 1; }\n" +
".ls-panel.active { display: flex; }\n" +
".ls-panel-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 14px; line-height: 1.4; }\n" +
".ls-panel-desc { font-size: 14px; color: #555; line-height: 1.7; margin-bottom: 24px; flex: 1; }\n" +
".ls-btn { display: inline-block; padding: 10px 24px; background: #c0272d; color: #fff; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; text-decoration: none; transition: background 0.2s; align-self: flex-start; }\n" +
".ls-btn:hover { background: #a01f24; }\n" +
"\n" +
"/* Right column — poster image */\n" +
".ls-right { min-height: 360px; position: relative; overflow: hidden; }\n" +
".ls-poster { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
".ls-poster.active { display: block; }\n" +
".ls-poster .ls-thumbnail { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 2; cursor: pointer; }\n" +
".ls-poster .ls-thumbnail img { width: 100%; height: 100%; object-fit: cover; }\n" +
".ls-play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 70px; height: 70px; background: rgba(192, 39, 45, 0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3; transition: transform 0.2s, background 0.2s; }\n" +
".ls-play-btn:hover { transform: translate(-50%, -50%) scale(1.1); background: #c0272d; }\n" +
".ls-play-btn::after { content: ''; display: block; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; margin-left: 5px; }\n" +
".ls-video-embed { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 1; }\n" +
".ls-video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
"\n" +
"/* ── Responsive ── */\n" +
"@media (max-width: 900px) {\n" +
" .c--tabbed-media-content { grid-template-columns: 1fr; border-left: none; border-top: 5px solid #c0272d; }\n" +
" .ls-left { padding: 28px 20px 24px; }\n" +
" .ls-right { min-height: 260px; position: relative; }\n" +
" .ls-poster { position: relative; }\n" +
" .ls-poster .ls-thumbnail img { height: auto; max-height: 400px; }\n" +
"}\n" +
"@media (max-width: 600px) {\n" +
" .ls-heading { font-size: 18px; }\n" +
" .ls-tab { padding: 6px 12px; font-size: 13px; }\n" +
" .ls-panel-title { font-size: 16px; }\n" +
" .ls-panel-desc { font-size: 13px; }\n" +
" .ls-right { min-height: 200px; }\n" +
" .ls-play-btn { width: 50px; height: 50px; }\n" +
" .ls-play-btn::after { border-width: 9px 0 9px 15px; }\n" +
"}\n" +
"</style>\n" +
"\n" +
"<div class=\"cc--component-container cc--tabbed-media-content ls-section\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <!-- Left Column -->\n" +
" <div class=\"ls-left\">\n" +
" <h2 class=\"ls-heading\">Livestream Tháng 07</h2>\n" +
" <div class=\"ls-tabs\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"javascript:void(0)\" class=\"ls-tab\" data-tab=\"ls-panel-{{index}}\" onclick=\"switchLsTab(this)\">Tuần {{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-panel\" id=\"ls-panel-{{index}}\">\n" +
" <h3 class=\"ls-panel-title\">{{excerpt}}</h3>\n" +
" <div class=\"ls-panel-desc\">{{content}}</div>\n" +
" <a href=\"/post/{{slug}}\" class=\"ls-btn\">Tìm Hiểu Thêm</a>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" <!-- Right Column — Poster -->\n" +
" <div class=\"ls-right\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-poster\" data-poster=\"ls-panel-{{index}}\">\n" +
" <div class=\"ls-thumbnail\" onclick=\"playLsVideo('ls-panel-{{index}}')\">\n" +
" <img src=\"{{featuredImageUrl}}\" alt=\"{{title}}\" loading=\"lazy\">\n" +
" <div class=\"ls-play-btn\"></div>\n" +
" </div>\n" +
" <div class=\"ls-video-embed\" id=\"ls-video-{{index}}\">\n" +
" {{{metaDescriptionRaw}}}\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"\n" +
"<script>\n" +
"function switchLsTab(el) {\n" +
" var tabId = el.getAttribute('data-tab');\n" +
" document.querySelectorAll('.ls-tab').forEach(function(t){t.classList.remove('active');});\n" +
" el.classList.add('active');\n" +
" document.querySelectorAll('.ls-panel').forEach(function(p){p.classList.remove('active');});\n" +
" var panel = document.getElementById(tabId);\n" +
" if(panel) panel.classList.add('active');\n" +
" document.querySelectorAll('.ls-poster').forEach(function(p){\n" +
" p.classList.remove('active');\n" +
" // Pause video when switching tab\n" +
" var iframe = p.querySelector('iframe');\n" +
" if(iframe) { \n" +
" var src = iframe.src;\n" +
" iframe.src = src;\n" +
" }\n" +
" });\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) poster.classList.add('active');\n" +
"}\n" +
"function playLsVideo(tabId) {\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) {\n" +
" var thumb = poster.querySelector('.ls-thumbnail');\n" +
" var embed = poster.querySelector('.ls-video-embed');\n" +
" var iframe = embed.querySelector('iframe');\n" +
" if (thumb) thumb.style.display = 'none';\n" +
" if (embed) {\n" +
" embed.style.display = 'block';\n" +
" embed.style.zIndex = '4';\n" +
" // Add autoplay parameter to iframe src if not present\n" +
" if (iframe && iframe.src.indexOf('autoplay=1') === -1) {\n" +
" if (iframe.src.indexOf('?') > -1) iframe.src += '&autoplay=1';\n" +
" else iframe.src += '?autoplay=1';\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n" +
"document.addEventListener('DOMContentLoaded', function() {\n" +
" var first = document.querySelector('.ls-tab');\n" +
" if(first) switchLsTab(first);\n" +
"});\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
int rows = updateTemplate.executeUpdate();
System.out.println("Updated " + rows + " row(s).");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+156
View File
@@ -0,0 +1,156 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate12 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
String htmlTemplate =
"<style>\n" +
"/* ── Livestream Section ── */\n" +
".ls-section { background: #f5f5f5; padding: 40px 0; }\n" +
".c--tabbed-media-content { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2, 16px); border-left: 5px solid #c0272d; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.07); border-radius: 6px; overflow: hidden; }\n" +
"\n" +
"/* Left column */\n" +
".ls-left { padding: 36px 32px 32px 32px; display: flex; flex-direction: column; }\n" +
".ls-heading { font-size: 22px; font-weight: 800; color: #111; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 20px; font-family: 'Inter', 'Segoe UI', sans-serif; }\n" +
"\n" +
"/* Tabs */\n" +
".ls-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 24px; }\n" +
".ls-tab { padding: 8px 18px; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; text-decoration: none; white-space: nowrap; }\n" +
".ls-tab:hover { color: #c0272d; }\n" +
".ls-tab.active { color: #c0272d; border-bottom-color: #c0272d; }\n" +
"\n" +
"/* Tab panels */\n" +
".ls-panel { display: none; flex-direction: column; flex: 1; }\n" +
".ls-panel.active { display: flex; }\n" +
".ls-panel-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 14px; line-height: 1.4; }\n" +
".ls-panel-desc { font-size: 14px; color: #555; line-height: 1.7; margin-bottom: 24px; flex: 1; }\n" +
".ls-btn { display: inline-block; padding: 10px 24px; background: #c0272d; color: #fff; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; text-decoration: none; transition: background 0.2s; align-self: flex-start; }\n" +
".ls-btn:hover { background: #a01f24; }\n" +
"\n" +
"/* Right column — poster image */\n" +
".ls-right { min-height: 100%; position: relative; overflow: hidden; }\n" +
".ls-poster { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
".ls-poster.active { display: block; }\n" +
".ls-poster .ls-thumbnail { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 2; cursor: pointer; }\n" +
".ls-poster .ls-thumbnail img { width: 100%; height: 100%; object-fit: cover; object-position: center; }\n" +
".ls-play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 70px; height: 70px; background: rgba(192, 39, 45, 0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3; transition: transform 0.2s, background 0.2s; }\n" +
".ls-play-btn:hover { transform: translate(-50%, -50%) scale(1.1); background: #c0272d; }\n" +
".ls-play-btn::after { content: ''; display: block; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; margin-left: 5px; }\n" +
".ls-video-embed { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 1; }\n" +
".ls-video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
"\n" +
"/* ── Responsive ── */\n" +
"@media (max-width: 900px) {\n" +
" .c--tabbed-media-content { grid-template-columns: 1fr; border-left: none; border-top: 5px solid #c0272d; }\n" +
" .ls-left { padding: 28px 20px 24px; }\n" +
" .ls-right { min-height: auto; aspect-ratio: 16/9; position: relative; }\n" +
" .ls-poster { position: absolute; width: 100%; height: 100%; }\n" +
" .ls-poster .ls-thumbnail img { height: 100%; width: 100%; object-fit: cover; object-position: center; }\n" +
"}\n" +
"@media (max-width: 600px) {\n" +
" .ls-heading { font-size: 18px; }\n" +
" .ls-tab { padding: 6px 12px; font-size: 13px; }\n" +
" .ls-panel-title { font-size: 16px; }\n" +
" .ls-panel-desc { font-size: 13px; }\n" +
" .ls-play-btn { width: 50px; height: 50px; }\n" +
" .ls-play-btn::after { border-width: 9px 0 9px 15px; }\n" +
"}\n" +
"</style>\n" +
"\n" +
"<div class=\"cc--component-container cc--tabbed-media-content ls-section\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <!-- Left Column -->\n" +
" <div class=\"ls-left\">\n" +
" <h2 class=\"ls-heading\">Livestream Tháng 07</h2>\n" +
" <div class=\"ls-tabs\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"javascript:void(0)\" class=\"ls-tab\" data-tab=\"ls-panel-{{index}}\" onclick=\"switchLsTab(this)\">Tuần {{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-panel\" id=\"ls-panel-{{index}}\">\n" +
" <h3 class=\"ls-panel-title\">{{excerpt}}</h3>\n" +
" <div class=\"ls-panel-desc\">{{content}}</div>\n" +
" <a href=\"/post/{{slug}}\" class=\"ls-btn\">Tìm Hiểu Thêm</a>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" <!-- Right Column — Poster -->\n" +
" <div class=\"ls-right\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-poster\" data-poster=\"ls-panel-{{index}}\">\n" +
" <div class=\"ls-thumbnail\" onclick=\"playLsVideo('ls-panel-{{index}}')\">\n" +
" <img src=\"{{featuredImageUrl}}\" alt=\"{{title}}\" loading=\"lazy\">\n" +
" <div class=\"ls-play-btn\"></div>\n" +
" </div>\n" +
" <div class=\"ls-video-embed\" id=\"ls-video-{{index}}\">\n" +
" {{{metaDescriptionRaw}}}\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"\n" +
"<script>\n" +
"function switchLsTab(el) {\n" +
" var tabId = el.getAttribute('data-tab');\n" +
" document.querySelectorAll('.ls-tab').forEach(function(t){t.classList.remove('active');});\n" +
" el.classList.add('active');\n" +
" document.querySelectorAll('.ls-panel').forEach(function(p){p.classList.remove('active');});\n" +
" var panel = document.getElementById(tabId);\n" +
" if(panel) panel.classList.add('active');\n" +
" document.querySelectorAll('.ls-poster').forEach(function(p){\n" +
" p.classList.remove('active');\n" +
" // Pause video when switching tab\n" +
" var iframe = p.querySelector('iframe');\n" +
" if(iframe) { \n" +
" var src = iframe.src;\n" +
" iframe.src = src;\n" +
" }\n" +
" });\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) poster.classList.add('active');\n" +
"}\n" +
"function playLsVideo(tabId) {\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) {\n" +
" var thumb = poster.querySelector('.ls-thumbnail');\n" +
" var embed = poster.querySelector('.ls-video-embed');\n" +
" var iframe = embed.querySelector('iframe');\n" +
" if (thumb) thumb.style.display = 'none';\n" +
" if (embed) {\n" +
" embed.style.display = 'block';\n" +
" embed.style.zIndex = '4';\n" +
" // Add autoplay parameter to iframe src if not present\n" +
" if (iframe && iframe.src.indexOf('autoplay=1') === -1) {\n" +
" if (iframe.src.indexOf('?') > -1) iframe.src += '&autoplay=1';\n" +
" else iframe.src += '?autoplay=1';\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n" +
"document.addEventListener('DOMContentLoaded', function() {\n" +
" var first = document.querySelector('.ls-tab');\n" +
" if(first) switchLsTab(first);\n" +
"});\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
int rows = updateTemplate.executeUpdate();
System.out.println("Updated " + rows + " row(s).");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+156
View File
@@ -0,0 +1,156 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate13 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
String htmlTemplate =
"<style>\n" +
"/* ── Livestream Section ── */\n" +
".ls-section { background: #f5f5f5; padding: 40px 0; }\n" +
".c--tabbed-media-content { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2, 16px); overflow: hidden; }\n" +
"\n" +
"/* Left column */\n" +
".ls-left { padding: 36px 32px 32px 0px; display: flex; flex-direction: column; }\n" +
".ls-heading { font-size: 22px; font-weight: 800; color: #111; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 20px; font-family: 'Inter', 'Segoe UI', sans-serif; }\n" +
"\n" +
"/* Tabs */\n" +
".ls-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 24px; }\n" +
".ls-tab { padding: 8px 18px; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; text-decoration: none; white-space: nowrap; }\n" +
".ls-tab:hover { color: #c0272d; }\n" +
".ls-tab.active { color: #c0272d; border-bottom-color: #c0272d; }\n" +
"\n" +
"/* Tab panels */\n" +
".ls-panel { display: none; flex-direction: column; flex: 1; }\n" +
".ls-panel.active { display: flex; }\n" +
".ls-panel-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 14px; line-height: 1.4; }\n" +
".ls-panel-desc { font-size: 14px; color: #555; line-height: 1.7; margin-bottom: 24px; flex: 1; }\n" +
".ls-btn { display: inline-block; padding: 10px 24px; background: #c0272d; color: #fff; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; text-decoration: none; transition: background 0.2s; align-self: flex-start; }\n" +
".ls-btn:hover { background: #a01f24; }\n" +
"\n" +
"/* Right column — poster image */\n" +
".ls-right { min-height: 100%; position: relative; overflow: hidden; }\n" +
".ls-poster { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
".ls-poster.active { display: block; }\n" +
".ls-poster .ls-thumbnail { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 2; cursor: pointer; }\n" +
".ls-poster .ls-thumbnail img { width: 100%; height: 100%; object-fit: cover; object-position: center; }\n" +
".ls-play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 70px; height: 70px; background: rgba(192, 39, 45, 0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3; transition: transform 0.2s, background 0.2s; }\n" +
".ls-play-btn:hover { transform: translate(-50%, -50%) scale(1.1); background: #c0272d; }\n" +
".ls-play-btn::after { content: ''; display: block; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; margin-left: 5px; }\n" +
".ls-video-embed { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 1; }\n" +
".ls-video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
"\n" +
"/* ── Responsive ── */\n" +
"@media (max-width: 900px) {\n" +
" .c--tabbed-media-content { grid-template-columns: 1fr; border-left: none; border-top: 5px solid #c0272d; }\n" +
" .ls-left { padding: 28px 20px 24px; }\n" +
" .ls-right { min-height: auto; aspect-ratio: 16/9; position: relative; }\n" +
" .ls-poster { position: absolute; width: 100%; height: 100%; }\n" +
" .ls-poster .ls-thumbnail img { height: 100%; width: 100%; object-fit: cover; object-position: center; }\n" +
"}\n" +
"@media (max-width: 600px) {\n" +
" .ls-heading { font-size: 18px; }\n" +
" .ls-tab { padding: 6px 12px; font-size: 13px; }\n" +
" .ls-panel-title { font-size: 16px; }\n" +
" .ls-panel-desc { font-size: 13px; }\n" +
" .ls-play-btn { width: 50px; height: 50px; }\n" +
" .ls-play-btn::after { border-width: 9px 0 9px 15px; }\n" +
"}\n" +
"</style>\n" +
"\n" +
"<div class=\"cc--component-container cc--tabbed-media-content ls-section\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <!-- Left Column -->\n" +
" <div class=\"ls-left\">\n" +
" <h2 class=\"ls-heading\">Livestream Tháng 07</h2>\n" +
" <div class=\"ls-tabs\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"javascript:void(0)\" class=\"ls-tab\" data-tab=\"ls-panel-{{index}}\" onclick=\"switchLsTab(this)\">Tuần {{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-panel\" id=\"ls-panel-{{index}}\">\n" +
" <h3 class=\"ls-panel-title\">{{excerpt}}</h3>\n" +
" <div class=\"ls-panel-desc\">{{content}}</div>\n" +
" <a href=\"/post/{{slug}}\" class=\"ls-btn\">Tìm Hiểu Thêm</a>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" <!-- Right Column — Poster -->\n" +
" <div class=\"ls-right\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-poster\" data-poster=\"ls-panel-{{index}}\">\n" +
" <div class=\"ls-thumbnail\" onclick=\"playLsVideo('ls-panel-{{index}}')\">\n" +
" <img src=\"{{featuredImageUrl}}\" alt=\"{{title}}\" loading=\"lazy\">\n" +
" <div class=\"ls-play-btn\"></div>\n" +
" </div>\n" +
" <div class=\"ls-video-embed\" id=\"ls-video-{{index}}\">\n" +
" {{{metaDescriptionRaw}}}\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"\n" +
"<script>\n" +
"function switchLsTab(el) {\n" +
" var tabId = el.getAttribute('data-tab');\n" +
" document.querySelectorAll('.ls-tab').forEach(function(t){t.classList.remove('active');});\n" +
" el.classList.add('active');\n" +
" document.querySelectorAll('.ls-panel').forEach(function(p){p.classList.remove('active');});\n" +
" var panel = document.getElementById(tabId);\n" +
" if(panel) panel.classList.add('active');\n" +
" document.querySelectorAll('.ls-poster').forEach(function(p){\n" +
" p.classList.remove('active');\n" +
" // Pause video when switching tab\n" +
" var iframe = p.querySelector('iframe');\n" +
" if(iframe) { \n" +
" var src = iframe.src;\n" +
" iframe.src = src;\n" +
" }\n" +
" });\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) poster.classList.add('active');\n" +
"}\n" +
"function playLsVideo(tabId) {\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) {\n" +
" var thumb = poster.querySelector('.ls-thumbnail');\n" +
" var embed = poster.querySelector('.ls-video-embed');\n" +
" var iframe = embed.querySelector('iframe');\n" +
" if (thumb) thumb.style.display = 'none';\n" +
" if (embed) {\n" +
" embed.style.display = 'block';\n" +
" embed.style.zIndex = '4';\n" +
" // Add autoplay parameter to iframe src if not present\n" +
" if (iframe && iframe.src.indexOf('autoplay=1') === -1) {\n" +
" if (iframe.src.indexOf('?') > -1) iframe.src += '&autoplay=1';\n" +
" else iframe.src += '?autoplay=1';\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n" +
"document.addEventListener('DOMContentLoaded', function() {\n" +
" var first = document.querySelector('.ls-tab');\n" +
" if(first) switchLsTab(first);\n" +
"});\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
int rows = updateTemplate.executeUpdate();
System.out.println("Updated " + rows + " row(s).");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+156
View File
@@ -0,0 +1,156 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate14 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
String htmlTemplate =
"<style>\n" +
"/* ── Livestream Section ── */\n" +
".ls-section { background: #f5f5f5; padding: 40px 0; }\n" +
".c--tabbed-media-content { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2, 16px); overflow: hidden; }\n" +
"\n" +
"/* Left column */\n" +
".ls-left { padding: 36px 32px 32px 0px; display: flex; flex-direction: column; min-height: 450px; }\n" +
".ls-heading { font-size: 22px; font-weight: 800; color: #111; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 20px; font-family: 'Inter', 'Segoe UI', sans-serif; }\n" +
"\n" +
"/* Tabs */\n" +
".ls-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 24px; }\n" +
".ls-tab { padding: 8px 18px; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; text-decoration: none; white-space: nowrap; }\n" +
".ls-tab:hover { color: #c0272d; }\n" +
".ls-tab.active { color: #c0272d; border-bottom-color: #c0272d; }\n" +
"\n" +
"/* Tab panels */\n" +
".ls-panel { display: none; flex-direction: column; flex: 1; }\n" +
".ls-panel.active { display: flex; }\n" +
".ls-panel-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }\n" +
".ls-panel-desc { font-size: 14px; color: #555; line-height: 1.7; margin-bottom: 24px; flex: 1; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }\n" +
".ls-btn { display: inline-block; padding: 10px 24px; background: #c0272d; color: #fff; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; text-decoration: none; transition: background 0.2s; align-self: flex-start; }\n" +
".ls-btn:hover { background: #a01f24; }\n" +
"\n" +
"/* Right column — poster image */\n" +
".ls-right { min-height: 100%; position: relative; overflow: hidden; }\n" +
".ls-poster { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
".ls-poster.active { display: block; }\n" +
".ls-poster .ls-thumbnail { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 2; cursor: pointer; }\n" +
".ls-poster .ls-thumbnail img { width: 100%; height: 100%; object-fit: cover; object-position: center; }\n" +
".ls-play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 70px; height: 70px; background: rgba(192, 39, 45, 0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3; transition: transform 0.2s, background 0.2s; }\n" +
".ls-play-btn:hover { transform: translate(-50%, -50%) scale(1.1); background: #c0272d; }\n" +
".ls-play-btn::after { content: ''; display: block; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; margin-left: 5px; }\n" +
".ls-video-embed { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 1; }\n" +
".ls-video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
"\n" +
"/* ── Responsive ── */\n" +
"@media (max-width: 900px) {\n" +
" .c--tabbed-media-content { grid-template-columns: 1fr; border-left: none; border-top: 5px solid #c0272d; }\n" +
" .ls-left { padding: 28px 20px 24px 0px; min-height: auto; }\n" +
" .ls-right { min-height: auto; aspect-ratio: 16/9; position: relative; }\n" +
" .ls-poster { position: absolute; width: 100%; height: 100%; }\n" +
" .ls-poster .ls-thumbnail img { height: 100%; width: 100%; object-fit: cover; object-position: center; }\n" +
"}\n" +
"@media (max-width: 600px) {\n" +
" .ls-heading { font-size: 18px; }\n" +
" .ls-tab { padding: 6px 12px; font-size: 13px; }\n" +
" .ls-panel-title { font-size: 16px; -webkit-line-clamp: 2; }\n" +
" .ls-panel-desc { font-size: 13px; -webkit-line-clamp: 4; }\n" +
" .ls-play-btn { width: 50px; height: 50px; }\n" +
" .ls-play-btn::after { border-width: 9px 0 9px 15px; }\n" +
"}\n" +
"</style>\n" +
"\n" +
"<div class=\"cc--component-container cc--tabbed-media-content ls-section\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <!-- Left Column -->\n" +
" <div class=\"ls-left\">\n" +
" <h2 class=\"ls-heading\">Livestream Tháng 07</h2>\n" +
" <div class=\"ls-tabs\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"javascript:void(0)\" class=\"ls-tab\" data-tab=\"ls-panel-{{index}}\" onclick=\"switchLsTab(this)\">Tuần {{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-panel\" id=\"ls-panel-{{index}}\">\n" +
" <h3 class=\"ls-panel-title\">{{excerpt}}</h3>\n" +
" <div class=\"ls-panel-desc\">{{content}}</div>\n" +
" <a href=\"/post/{{slug}}\" class=\"ls-btn\">Tìm Hiểu Thêm</a>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" <!-- Right Column — Poster -->\n" +
" <div class=\"ls-right\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-poster\" data-poster=\"ls-panel-{{index}}\">\n" +
" <div class=\"ls-thumbnail\" onclick=\"playLsVideo('ls-panel-{{index}}')\">\n" +
" <img src=\"{{featuredImageUrl}}\" alt=\"{{title}}\" loading=\"lazy\">\n" +
" <div class=\"ls-play-btn\"></div>\n" +
" </div>\n" +
" <div class=\"ls-video-embed\" id=\"ls-video-{{index}}\">\n" +
" {{{metaDescriptionRaw}}}\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"\n" +
"<script>\n" +
"function switchLsTab(el) {\n" +
" var tabId = el.getAttribute('data-tab');\n" +
" document.querySelectorAll('.ls-tab').forEach(function(t){t.classList.remove('active');});\n" +
" el.classList.add('active');\n" +
" document.querySelectorAll('.ls-panel').forEach(function(p){p.classList.remove('active');});\n" +
" var panel = document.getElementById(tabId);\n" +
" if(panel) panel.classList.add('active');\n" +
" document.querySelectorAll('.ls-poster').forEach(function(p){\n" +
" p.classList.remove('active');\n" +
" // Pause video when switching tab\n" +
" var iframe = p.querySelector('iframe');\n" +
" if(iframe) { \n" +
" var src = iframe.src;\n" +
" iframe.src = src;\n" +
" }\n" +
" });\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) poster.classList.add('active');\n" +
"}\n" +
"function playLsVideo(tabId) {\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) {\n" +
" var thumb = poster.querySelector('.ls-thumbnail');\n" +
" var embed = poster.querySelector('.ls-video-embed');\n" +
" var iframe = embed.querySelector('iframe');\n" +
" if (thumb) thumb.style.display = 'none';\n" +
" if (embed) {\n" +
" embed.style.display = 'block';\n" +
" embed.style.zIndex = '4';\n" +
" // Add autoplay parameter to iframe src if not present\n" +
" if (iframe && iframe.src.indexOf('autoplay=1') === -1) {\n" +
" if (iframe.src.indexOf('?') > -1) iframe.src += '&autoplay=1';\n" +
" else iframe.src += '?autoplay=1';\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n" +
"document.addEventListener('DOMContentLoaded', function() {\n" +
" var first = document.querySelector('.ls-tab');\n" +
" if(first) switchLsTab(first);\n" +
"});\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
int rows = updateTemplate.executeUpdate();
System.out.println("Updated " + rows + " row(s).");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+161
View File
@@ -0,0 +1,161 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate2 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
// We append &autoplay=1 to the URL in the database so it's ready to play
PreparedStatement updatePost = conn.prepareStatement(
"UPDATE sis_post SET meta_description = ? WHERE slug = 'sis-vi-suc-khoe-cong-dong-ky-134'"
);
updatePost.setString(1, "https://www.youtube.com/embed/j63kT9Bjrb4?si=N5JwIcuRn-iRxkYu&autoplay=1");
updatePost.executeUpdate();
// 2. Update the template to use data-src instead of src.
String htmlTemplate =
"<style>\n" +
" .tabbed-media-content-media-item { width: 100%; aspect-ratio: 16/9; position: relative; display: flex; align-items: center; justify-content: center; background: #000; overflow: hidden; }\n" +
" .tabbed-media-content-media-item .f--video-embed { display: none; width: 100%; height: 100%; }\n" +
" .tabbed-media-content-media-item .f--video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
" .tabbed-media-content-media-item .f--image { width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
" .tabbed-media-content-media-item .button-play { z-index: 10; }\n" +
"</style>\n" +
"<div class=\"cc--component-container cc--tabbed-media-content\" style=\"background-color: var(--color-gray-100);\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <div class=\"tabbed-media-content-text-col\">\n" +
" <div data-component-id=\"umass_base:section-title\" class=\"f--section-title\">\n" +
" <h2 style=\"color: var(--color-brand);\">LiveStream</h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:tabbed-container\" data-once=\"tabbed-container\">\n" +
" <div class=\"tab-labels-container\" role=\"tablist\">\n" +
" <div class=\"tab-labels-inner\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"#tabbed-content-{{index}}\" class=\"tab-label link-context-dark\" role=\"tab\" aria-selected=\"false\" aria-controls=\"tabbed-content-{{index}}\">{{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tab-content-container\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tab-content-panel\" id=\"tabbed-content-{{index}}\" role=\"tabpanel\" aria-live=\"polite\">\n" +
" <div class=\"f--field f--cta-title\">\n" +
" <h2 style=\"color: var(--color-black);\"> {{excerpt}} </h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:description\" class=\"f--description\">\n" +
" <div style=\"color:var(--color-black);\">{{content}}</div>\n" +
" </div>\n" +
" <div class=\"cta-container\">\n" +
" <div class=\"f--field f--button\">\n" +
" <a href=\"/post/{{slug}}\" class=\"button-primary button-context-light \" aria-label=\"Tìm Hiểu Thêm\" data-component-id=\"umass_base:button\">\n" +
" <span class=\"button-text\"> Tìm Hiểu Thêm </span>\n" +
" </a>\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tabbed-media-content-media-col\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tabbed-media-content-media-item with-video\" data-tab-id=\"tabbed-content-{{index}}\">\n" +
" <div class=\"f--field f--image\">\n" +
" <img src=\"{{featuredImageUrl}}\" data-src=\"{{featuredImageUrl}}\" class=\"lazyload\" alt=\"{{title}}\" style=\"width:100%;height:100%;object-fit:cover;\">\n" +
" </div>\n" +
" <div class=\"f--field f--button\">\n" +
" <a href=\"#\" class=\"button-play button-context-light \" aria-label=\"Play video\" data-component-id=\"umass_base:button\">\n" +
" <span class=\"button-icon button-icon-play\">\n" +
" <svg width=\"18\" height=\"27\" viewBox=\"0 0 18 27\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n" +
" <path d=\"M18 13.5L0 0V27L18 13.5Z\"></path>\n" +
" </svg>\n" +
" </span>\n" +
" <span class=\"button-text visually-hidden\"> Play </span>\n" +
" </a>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:video-embed\" class=\"f--field f--video-embed\">\n" +
" <iframe title=\"YouTube video player\" data-src=\"{{metaDescription}}\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"<script>\n" +
" document.addEventListener(\"DOMContentLoaded\", function() {\n" +
" var tabs = document.querySelectorAll('.tabbed-media-content-media-item[data-tab-id=\"tabbed-content-0\"]');\n" +
" if(tabs.length > 0) tabs[0].classList.add('is-active');\n" +
" \n" +
" var panels = document.querySelectorAll('#tabbed-content-0.tab-content-panel');\n" +
" if(panels.length > 0) panels[0].classList.add('is-active');\n" +
"\n" +
" var labels = document.querySelectorAll('a.tab-label[aria-controls=\"tabbed-content-0\"]');\n" +
" if(labels.length > 0) labels[0].setAttribute('aria-selected', 'true');\n" +
"\n" +
" var allLabels = document.querySelectorAll('.tab-labels-inner .tab-label');\n" +
" allLabels.forEach(function(label) {\n" +
" label.addEventListener('click', function(e) {\n" +
" e.preventDefault();\n" +
" allLabels.forEach(function(l) { l.setAttribute('aria-selected', 'false'); });\n" +
" this.setAttribute('aria-selected', 'true');\n" +
" \n" +
" var targetId = this.getAttribute('aria-controls');\n" +
" document.querySelectorAll('.tab-content-panel').forEach(function(p) { p.classList.remove('is-active'); });\n" +
" document.querySelectorAll('.tabbed-media-content-media-item').forEach(function(m) { \n" +
" m.classList.remove('is-active'); \n" +
" var vEmbed = m.querySelector('.f--video-embed');\n" +
" if(vEmbed) vEmbed.style.display = 'none';\n" +
" var img = m.querySelector('.f--image');\n" +
" if(img) img.style.display = 'block';\n" +
" var btn = m.querySelector('.button-play');\n" +
" if(btn) btn.style.display = 'flex';\n" +
" var iframe = m.querySelector('iframe');\n" +
" if(iframe) { \n" +
" iframe.src = '';\n" +
" }\n" +
" });\n" +
" \n" +
" var targetPanel = document.getElementById(targetId);\n" +
" if(targetPanel) targetPanel.classList.add('is-active');\n" +
" var targetMedia = document.querySelector('.tabbed-media-content-media-item[data-tab-id=\"' + targetId + '\"]');\n" +
" if(targetMedia) targetMedia.classList.add('is-active');\n" +
" });\n" +
" });\n" +
"\n" +
" var playButtons = document.querySelectorAll('.tabbed-media-content-media-item .button-play');\n" +
" playButtons.forEach(function(btn) {\n" +
" btn.addEventListener('click', function(e) {\n" +
" e.preventDefault();\n" +
" var mediaItem = this.closest('.tabbed-media-content-media-item');\n" +
" var img = mediaItem.querySelector('.f--image');\n" +
" var videoEmbed = mediaItem.querySelector('.f--video-embed');\n" +
" \n" +
" if(img) img.style.display = 'none';\n" +
" this.style.display = 'none';\n" +
" if(videoEmbed) videoEmbed.style.display = 'block';\n" +
" \n" +
" var iframe = mediaItem.querySelector('iframe');\n" +
" if(iframe && iframe.getAttribute('data-src')) {\n" +
" iframe.src = iframe.getAttribute('data-src');\n" +
" }\n" +
" });\n" +
" });\n" +
" });\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
updateTemplate.executeUpdate();
System.out.println("Update complete!");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+146
View File
@@ -0,0 +1,146 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate3 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
// We ensure it is just the standard embed without JS tampering
String htmlTemplate =
"<style>\n" +
" .tabbed-media-content-media-item { width: 100%; aspect-ratio: 16/9; position: relative; display: flex; align-items: center; justify-content: center; background: #000; overflow: hidden; }\n" +
" .tabbed-media-content-media-item .f--video-embed { display: none; width: 100%; height: 100%; }\n" +
" .tabbed-media-content-media-item .f--video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
" .tabbed-media-content-media-item .f--image { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 5; }\n" +
" .tabbed-media-content-media-item .button-play { z-index: 10; }\n" +
"</style>\n" +
"<div class=\"cc--component-container cc--tabbed-media-content\" style=\"background-color: var(--color-gray-100);\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <div class=\"tabbed-media-content-text-col\">\n" +
" <div data-component-id=\"umass_base:section-title\" class=\"f--section-title\">\n" +
" <h2 style=\"color: var(--color-brand);\">LiveStream</h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:tabbed-container\" data-once=\"tabbed-container\">\n" +
" <div class=\"tab-labels-container\" role=\"tablist\">\n" +
" <div class=\"tab-labels-inner\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"#tabbed-content-{{index}}\" class=\"tab-label link-context-dark\" role=\"tab\" aria-selected=\"false\" aria-controls=\"tabbed-content-{{index}}\">{{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tab-content-container\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tab-content-panel\" id=\"tabbed-content-{{index}}\" role=\"tabpanel\" aria-live=\"polite\">\n" +
" <div class=\"f--field f--cta-title\">\n" +
" <h2 style=\"color: var(--color-black);\"> {{excerpt}} </h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:description\" class=\"f--description\">\n" +
" <div style=\"color:var(--color-black);\">{{content}}</div>\n" +
" </div>\n" +
" <div class=\"cta-container\">\n" +
" <div class=\"f--field f--button\">\n" +
" <a href=\"/post/{{slug}}\" class=\"button-primary button-context-light \" aria-label=\"Tìm Hiểu Thêm\" data-component-id=\"umass_base:button\">\n" +
" <span class=\"button-text\"> Tìm Hiểu Thêm </span>\n" +
" </a>\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tabbed-media-content-media-col\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tabbed-media-content-media-item with-video\" data-tab-id=\"tabbed-content-{{index}}\">\n" +
" <div class=\"f--field f--image\">\n" +
" <img src=\"{{featuredImageUrl}}\" data-src=\"{{featuredImageUrl}}\" class=\"lazyload\" alt=\"{{title}}\" style=\"width:100%;height:100%;object-fit:cover;\">\n" +
" </div>\n" +
" <div class=\"f--field f--button\" style=\"position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10;\">\n" +
" <a href=\"#\" class=\"button-play button-context-light \" aria-label=\"Play video\" data-component-id=\"umass_base:button\">\n" +
" <span class=\"button-icon button-icon-play\">\n" +
" <svg width=\"18\" height=\"27\" viewBox=\"0 0 18 27\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n" +
" <path d=\"M18 13.5L0 0V27L18 13.5Z\"></path>\n" +
" </svg>\n" +
" </span>\n" +
" <span class=\"button-text visually-hidden\"> Play </span>\n" +
" </a>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:video-embed\" class=\"f--field f--video-embed\">\n" +
" <iframe title=\"YouTube video player\" src=\"{{metaDescription}}\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"<script>\n" +
" document.addEventListener(\"DOMContentLoaded\", function() {\n" +
" var tabs = document.querySelectorAll('.tabbed-media-content-media-item[data-tab-id=\"tabbed-content-0\"]');\n" +
" if(tabs.length > 0) tabs[0].classList.add('is-active');\n" +
" \n" +
" var panels = document.querySelectorAll('#tabbed-content-0.tab-content-panel');\n" +
" if(panels.length > 0) panels[0].classList.add('is-active');\n" +
"\n" +
" var labels = document.querySelectorAll('a.tab-label[aria-controls=\"tabbed-content-0\"]');\n" +
" if(labels.length > 0) labels[0].setAttribute('aria-selected', 'true');\n" +
"\n" +
" var allLabels = document.querySelectorAll('.tab-labels-inner .tab-label');\n" +
" allLabels.forEach(function(label) {\n" +
" label.addEventListener('click', function(e) {\n" +
" e.preventDefault();\n" +
" allLabels.forEach(function(l) { l.setAttribute('aria-selected', 'false'); });\n" +
" this.setAttribute('aria-selected', 'true');\n" +
" \n" +
" var targetId = this.getAttribute('aria-controls');\n" +
" document.querySelectorAll('.tab-content-panel').forEach(function(p) { p.classList.remove('is-active'); });\n" +
" document.querySelectorAll('.tabbed-media-content-media-item').forEach(function(m) { \n" +
" m.classList.remove('is-active'); \n" +
" var vEmbed = m.querySelector('.f--video-embed');\n" +
" if(vEmbed) vEmbed.style.display = 'none';\n" +
" var img = m.querySelector('.f--image');\n" +
" if(img) img.style.display = 'block';\n" +
" var btnContainer = m.querySelector('.f--field.f--button');\n" +
" if(btnContainer) btnContainer.style.display = 'block';\n" +
" });\n" +
" \n" +
" var targetPanel = document.getElementById(targetId);\n" +
" if(targetPanel) targetPanel.classList.add('is-active');\n" +
" var targetMedia = document.querySelector('.tabbed-media-content-media-item[data-tab-id=\"' + targetId + '\"]');\n" +
" if(targetMedia) targetMedia.classList.add('is-active');\n" +
" });\n" +
" });\n" +
"\n" +
" var playButtons = document.querySelectorAll('.tabbed-media-content-media-item .button-play');\n" +
" playButtons.forEach(function(btn) {\n" +
" btn.addEventListener('click', function(e) {\n" +
" e.preventDefault();\n" +
" var mediaItem = this.closest('.tabbed-media-content-media-item');\n" +
" var img = mediaItem.querySelector('.f--image');\n" +
" var videoEmbed = mediaItem.querySelector('.f--video-embed');\n" +
" var btnContainer = mediaItem.querySelector('.f--field.f--button');\n" +
" \n" +
" if(img) img.style.display = 'none';\n" +
" if(btnContainer) btnContainer.style.display = 'none';\n" +
" if(videoEmbed) videoEmbed.style.display = 'block';\n" +
" });\n" +
" });\n" +
" });\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
updateTemplate.executeUpdate();
System.out.println("Update complete!");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+155
View File
@@ -0,0 +1,155 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate4 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
// Re-apply the URL to be just the embed URL without autoplay so we can append it cleanly in data-src
PreparedStatement updatePost = conn.prepareStatement(
"UPDATE sis_post SET meta_description = ? WHERE slug = 'sis-vi-suc-khoe-cong-dong-ky-134'"
);
updatePost.setString(1, "https://www.youtube.com/embed/j63kT9Bjrb4?si=N5JwIcuRn-iRxkYu");
updatePost.executeUpdate();
// We ensure it is just the standard embed without JS tampering
String htmlTemplate =
"<style>\n" +
" .tabbed-media-content-media-item { width: 100%; aspect-ratio: 16/9; position: relative; display: block; background: #000; overflow: hidden; }\n" +
" .tabbed-media-content-media-item .f--video-embed { display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; }\n" +
" .tabbed-media-content-media-item .f--video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
" .tabbed-media-content-media-item .f--image { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 5; }\n" +
" .tabbed-media-content-media-item .f--button { z-index: 10; }\n" +
"</style>\n" +
"<div class=\"cc--component-container cc--tabbed-media-content\" style=\"background-color: var(--color-gray-100);\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <div class=\"tabbed-media-content-text-col\">\n" +
" <div data-component-id=\"umass_base:section-title\" class=\"f--section-title\">\n" +
" <h2 style=\"color: var(--color-brand);\">LiveStream</h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:tabbed-container\" data-once=\"tabbed-container\">\n" +
" <div class=\"tab-labels-container\" role=\"tablist\">\n" +
" <div class=\"tab-labels-inner\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"#tabbed-content-{{index}}\" class=\"tab-label link-context-dark\" role=\"tab\" aria-selected=\"false\" aria-controls=\"tabbed-content-{{index}}\">{{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tab-content-container\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tab-content-panel\" id=\"tabbed-content-{{index}}\" role=\"tabpanel\" aria-live=\"polite\">\n" +
" <div class=\"f--field f--cta-title\">\n" +
" <h2 style=\"color: var(--color-black);\"> {{excerpt}} </h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:description\" class=\"f--description\">\n" +
" <div style=\"color:var(--color-black);\">{{content}}</div>\n" +
" </div>\n" +
" <div class=\"cta-container\">\n" +
" <div class=\"f--field f--button\">\n" +
" <a href=\"/post/{{slug}}\" class=\"button-primary button-context-light \" aria-label=\"Tìm Hiểu Thêm\" data-component-id=\"umass_base:button\">\n" +
" <span class=\"button-text\"> Tìm Hiểu Thêm </span>\n" +
" </a>\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tabbed-media-content-media-col\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tabbed-media-content-media-item with-video\" data-tab-id=\"tabbed-content-{{index}}\">\n" +
" <div class=\"f--field f--image\">\n" +
" <img src=\"{{featuredImageUrl}}\" data-src=\"{{featuredImageUrl}}\" class=\"lazyload\" alt=\"{{title}}\" style=\"width:100%;height:100%;object-fit:cover;\">\n" +
" </div>\n" +
" <div class=\"f--field f--button\" style=\"position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10;\">\n" +
" <a href=\"#\" class=\"button-play button-context-light \" aria-label=\"Play video\" data-component-id=\"umass_base:button\">\n" +
" <span class=\"button-icon button-icon-play\">\n" +
" <svg width=\"18\" height=\"27\" viewBox=\"0 0 18 27\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n" +
" <path d=\"M18 13.5L0 0V27L18 13.5Z\"></path>\n" +
" </svg>\n" +
" </span>\n" +
" <span class=\"button-text visually-hidden\"> Play </span>\n" +
" </a>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:video-embed\" class=\"f--field f--video-embed\">\n" +
" <iframe title=\"YouTube video player\" data-src=\"{{metaDescription}}&amp;autoplay=1\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"<script>\n" +
" document.addEventListener(\"DOMContentLoaded\", function() {\n" +
" var tabs = document.querySelectorAll('.tabbed-media-content-media-item[data-tab-id=\"tabbed-content-0\"]');\n" +
" if(tabs.length > 0) tabs[0].classList.add('is-active');\n" +
" \n" +
" var panels = document.querySelectorAll('#tabbed-content-0.tab-content-panel');\n" +
" if(panels.length > 0) panels[0].classList.add('is-active');\n" +
"\n" +
" var labels = document.querySelectorAll('a.tab-label[aria-controls=\"tabbed-content-0\"]');\n" +
" if(labels.length > 0) labels[0].setAttribute('aria-selected', 'true');\n" +
"\n" +
" var allLabels = document.querySelectorAll('.tab-labels-inner .tab-label');\n" +
" allLabels.forEach(function(label) {\n" +
" label.addEventListener('click', function(e) {\n" +
" e.preventDefault();\n" +
" allLabels.forEach(function(l) { l.setAttribute('aria-selected', 'false'); });\n" +
" this.setAttribute('aria-selected', 'true');\n" +
" \n" +
" var targetId = this.getAttribute('aria-controls');\n" +
" document.querySelectorAll('.tab-content-panel').forEach(function(p) { p.classList.remove('is-active'); });\n" +
" document.querySelectorAll('.tabbed-media-content-media-item').forEach(function(m) { \n" +
" m.classList.remove('is-active'); \n" +
" var img = m.querySelector('.f--image');\n" +
" if(img) img.style.display = 'block';\n" +
" var btnContainer = m.querySelector('.f--field.f--button');\n" +
" if(btnContainer) btnContainer.style.display = 'block';\n" +
" var iframe = m.querySelector('iframe');\n" +
" if(iframe) iframe.removeAttribute('src'); // Stop video playing if they switch tabs\n" +
" });\n" +
" \n" +
" var targetPanel = document.getElementById(targetId);\n" +
" if(targetPanel) targetPanel.classList.add('is-active');\n" +
" var targetMedia = document.querySelector('.tabbed-media-content-media-item[data-tab-id=\"' + targetId + '\"]');\n" +
" if(targetMedia) targetMedia.classList.add('is-active');\n" +
" });\n" +
" });\n" +
"\n" +
" var playButtons = document.querySelectorAll('.tabbed-media-content-media-item .button-play');\n" +
" playButtons.forEach(function(btn) {\n" +
" btn.addEventListener('click', function(e) {\n" +
" e.preventDefault();\n" +
" var mediaItem = this.closest('.tabbed-media-content-media-item');\n" +
" var img = mediaItem.querySelector('.f--image');\n" +
" var btnContainer = mediaItem.querySelector('.f--field.f--button');\n" +
" var iframe = mediaItem.querySelector('iframe');\n" +
" \n" +
" if(img) img.style.display = 'none';\n" +
" if(btnContainer) btnContainer.style.display = 'none';\n" +
" if(iframe && iframe.getAttribute('data-src')) {\n" +
" iframe.setAttribute('src', iframe.getAttribute('data-src'));\n" +
" }\n" +
" });\n" +
" });\n" +
" });\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
updateTemplate.executeUpdate();
System.out.println("Update complete!");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+117
View File
@@ -0,0 +1,117 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate5 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
// Revert the URL in the database to exactly what the user requested, without autoplay
PreparedStatement updatePost = conn.prepareStatement(
"UPDATE sis_post SET meta_description = ? WHERE slug = 'sis-vi-suc-khoe-cong-dong-ky-134'"
);
updatePost.setString(1, "https://www.youtube.com/embed/j63kT9Bjrb4?si=N5JwIcuRn-iRxkYu");
updatePost.executeUpdate();
// We remove the custom image and play button entirely and let YouTube handle it!
String htmlTemplate =
"<style>\n" +
" .tabbed-media-content-media-item { width: 100%; aspect-ratio: 16/9; position: relative; display: block; overflow: hidden; }\n" +
" .tabbed-media-content-media-item .f--video-embed { width: 100%; height: 100%; }\n" +
" .tabbed-media-content-media-item .f--video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
"</style>\n" +
"<div class=\"cc--component-container cc--tabbed-media-content\" style=\"background-color: var(--color-gray-100);\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <div class=\"tabbed-media-content-text-col\">\n" +
" <div data-component-id=\"umass_base:section-title\" class=\"f--section-title\">\n" +
" <h2 style=\"color: var(--color-brand);\">LiveStream</h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:tabbed-container\" data-once=\"tabbed-container\">\n" +
" <div class=\"tab-labels-container\" role=\"tablist\">\n" +
" <div class=\"tab-labels-inner\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"#tabbed-content-{{index}}\" class=\"tab-label link-context-dark\" role=\"tab\" aria-selected=\"false\" aria-controls=\"tabbed-content-{{index}}\">{{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tab-content-container\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tab-content-panel\" id=\"tabbed-content-{{index}}\" role=\"tabpanel\" aria-live=\"polite\">\n" +
" <div class=\"f--field f--cta-title\">\n" +
" <h2 style=\"color: var(--color-black);\"> {{excerpt}} </h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:description\" class=\"f--description\">\n" +
" <div style=\"color:var(--color-black);\">{{content}}</div>\n" +
" </div>\n" +
" <div class=\"cta-container\">\n" +
" <div class=\"f--field f--button\">\n" +
" <a href=\"/post/{{slug}}\" class=\"button-primary button-context-light \" aria-label=\"Tìm Hiểu Thêm\" data-component-id=\"umass_base:button\">\n" +
" <span class=\"button-text\"> Tìm Hiểu Thêm </span>\n" +
" </a>\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tabbed-media-content-media-col\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tabbed-media-content-media-item with-video\" data-tab-id=\"tabbed-content-{{index}}\">\n" +
" <div data-component-id=\"umass_base:video-embed\" class=\"f--field f--video-embed\">\n" +
" <iframe title=\"YouTube video player\" src=\"{{metaDescription}}\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"<script>\n" +
" document.addEventListener(\"DOMContentLoaded\", function() {\n" +
" var tabs = document.querySelectorAll('.tabbed-media-content-media-item[data-tab-id=\"tabbed-content-0\"]');\n" +
" if(tabs.length > 0) tabs[0].classList.add('is-active');\n" +
" \n" +
" var panels = document.querySelectorAll('#tabbed-content-0.tab-content-panel');\n" +
" if(panels.length > 0) panels[0].classList.add('is-active');\n" +
"\n" +
" var labels = document.querySelectorAll('a.tab-label[aria-controls=\"tabbed-content-0\"]');\n" +
" if(labels.length > 0) labels[0].setAttribute('aria-selected', 'true');\n" +
"\n" +
" var allLabels = document.querySelectorAll('.tab-labels-inner .tab-label');\n" +
" allLabels.forEach(function(label) {\n" +
" label.addEventListener('click', function(e) {\n" +
" e.preventDefault();\n" +
" allLabels.forEach(function(l) { l.setAttribute('aria-selected', 'false'); });\n" +
" this.setAttribute('aria-selected', 'true');\n" +
" \n" +
" var targetId = this.getAttribute('aria-controls');\n" +
" document.querySelectorAll('.tab-content-panel').forEach(function(p) { p.classList.remove('is-active'); });\n" +
" document.querySelectorAll('.tabbed-media-content-media-item').forEach(function(m) { \n" +
" m.classList.remove('is-active'); \n" +
" });\n" +
" \n" +
" var targetPanel = document.getElementById(targetId);\n" +
" if(targetPanel) targetPanel.classList.add('is-active');\n" +
" var targetMedia = document.querySelector('.tabbed-media-content-media-item[data-tab-id=\"' + targetId + '\"]');\n" +
" if(targetMedia) targetMedia.classList.add('is-active');\n" +
" });\n" +
" });\n" +
" });\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
updateTemplate.executeUpdate();
System.out.println("Update complete!");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+109
View File
@@ -0,0 +1,109 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate6 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
String htmlTemplate =
"<style>\n" +
" .tabbed-media-content-media-item { width: 100%; aspect-ratio: 16/9; position: relative; display: block; overflow: hidden; }\n" +
" .tabbed-media-content-media-item .f--video-embed { width: 100%; height: 100%; }\n" +
" .tabbed-media-content-media-item .f--video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
"</style>\n" +
"<div class=\"cc--component-container cc--tabbed-media-content\" style=\"background-color: var(--color-gray-100);\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <div class=\"tabbed-media-content-text-col\">\n" +
" <div data-component-id=\"umass_base:section-title\" class=\"f--section-title\">\n" +
" <h2 style=\"color: var(--color-brand);\">LiveStream</h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:tabbed-container\" data-once=\"tabbed-container\">\n" +
" <div class=\"tab-labels-container\" role=\"tablist\">\n" +
" <div class=\"tab-labels-inner\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"#tabbed-content-{{index}}\" class=\"tab-label link-context-dark\" role=\"tab\" aria-selected=\"false\" aria-controls=\"tabbed-content-{{index}}\">{{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tab-content-container\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tab-content-panel\" id=\"tabbed-content-{{index}}\" role=\"tabpanel\" aria-live=\"polite\">\n" +
" <div class=\"f--field f--cta-title\">\n" +
" <h2 style=\"color: var(--color-black);\"> {{excerpt}} </h2>\n" +
" </div>\n" +
" <div data-component-id=\"umass_base:description\" class=\"f--description\">\n" +
" <div style=\"color:var(--color-black);\">{{content}}</div>\n" +
" </div>\n" +
" <div class=\"cta-container\">\n" +
" <div class=\"f--field f--button\">\n" +
" <a href=\"/post/{{slug}}\" class=\"button-primary button-context-light \" aria-label=\"Tìm Hiểu Thêm\" data-component-id=\"umass_base:button\">\n" +
" <span class=\"button-text\"> Tìm Hiểu Thêm </span>\n" +
" </a>\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"tabbed-media-content-media-col\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"tabbed-media-content-media-item with-video\" data-tab-id=\"tabbed-content-{{index}}\">\n" +
" <div data-component-id=\"umass_base:video-embed\" class=\"f--field f--video-embed\">\n" +
" {{{metaDescriptionRaw}}}\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"<script>\n" +
" document.addEventListener(\"DOMContentLoaded\", function() {\n" +
" var tabs = document.querySelectorAll('.tabbed-media-content-media-item[data-tab-id=\"tabbed-content-0\"]');\n" +
" if(tabs.length > 0) tabs[0].classList.add('is-active');\n" +
" \n" +
" var panels = document.querySelectorAll('#tabbed-content-0.tab-content-panel');\n" +
" if(panels.length > 0) panels[0].classList.add('is-active');\n" +
"\n" +
" var labels = document.querySelectorAll('a.tab-label[aria-controls=\"tabbed-content-0\"]');\n" +
" if(labels.length > 0) labels[0].setAttribute('aria-selected', 'true');\n" +
"\n" +
" var allLabels = document.querySelectorAll('.tab-labels-inner .tab-label');\n" +
" allLabels.forEach(function(label) {\n" +
" label.addEventListener('click', function(e) {\n" +
" e.preventDefault();\n" +
" allLabels.forEach(function(l) { l.setAttribute('aria-selected', 'false'); });\n" +
" this.setAttribute('aria-selected', 'true');\n" +
" \n" +
" var targetId = this.getAttribute('aria-controls');\n" +
" document.querySelectorAll('.tab-content-panel').forEach(function(p) { p.classList.remove('is-active'); });\n" +
" document.querySelectorAll('.tabbed-media-content-media-item').forEach(function(m) { \n" +
" m.classList.remove('is-active'); \n" +
" });\n" +
" \n" +
" var targetPanel = document.getElementById(targetId);\n" +
" if(targetPanel) targetPanel.classList.add('is-active');\n" +
" var targetMedia = document.querySelector('.tabbed-media-content-media-item[data-tab-id=\"' + targetId + '\"]');\n" +
" if(targetMedia) targetMedia.classList.add('is-active');\n" +
" });\n" +
" });\n" +
" });\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
updateTemplate.executeUpdate();
System.out.println("Update complete!");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+117
View File
@@ -0,0 +1,117 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate7 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
String htmlTemplate =
"<style>\n" +
"/* ── Livestream Section ── */\n" +
".ls-section { background: #f5f5f5; padding: 40px 0; }\n" +
".ls-wrapper { max-width: 1200px; margin: 0 auto; display: flex; gap: 0; border-left: 5px solid #c0272d; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.07); border-radius: 6px; overflow: hidden; }\n" +
"\n" +
"/* Left column */\n" +
".ls-left { flex: 0 0 40%; max-width: 40%; padding: 36px 32px 32px 32px; display: flex; flex-direction: column; }\n" +
".ls-heading { font-size: 22px; font-weight: 800; color: #111; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 20px; font-family: 'Inter', 'Segoe UI', sans-serif; }\n" +
"\n" +
"/* Tabs */\n" +
".ls-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 24px; }\n" +
".ls-tab { padding: 8px 18px; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; text-decoration: none; white-space: nowrap; }\n" +
".ls-tab:hover { color: #c0272d; }\n" +
".ls-tab.active { color: #c0272d; border-bottom-color: #c0272d; }\n" +
"\n" +
"/* Tab panels */\n" +
".ls-panel { display: none; flex-direction: column; flex: 1; }\n" +
".ls-panel.active { display: flex; }\n" +
".ls-panel-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 14px; line-height: 1.4; }\n" +
".ls-panel-desc { font-size: 14px; color: #555; line-height: 1.7; margin-bottom: 24px; flex: 1; }\n" +
".ls-btn { display: inline-block; padding: 10px 24px; background: #c0272d; color: #fff; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; text-decoration: none; transition: background 0.2s; align-self: flex-start; }\n" +
".ls-btn:hover { background: #a01f24; }\n" +
"\n" +
"/* Right column — poster image */\n" +
".ls-right { flex: 1; min-height: 360px; position: relative; overflow: hidden; }\n" +
".ls-poster { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
".ls-poster.active { display: block; }\n" +
".ls-poster img { width: 100%; height: 100%; object-fit: cover; }\n" +
"\n" +
"/* ── Responsive ── */\n" +
"@media (max-width: 900px) {\n" +
" .ls-wrapper { flex-direction: column; border-left: none; border-top: 5px solid #c0272d; }\n" +
" .ls-left { flex: none; max-width: 100%; padding: 28px 20px 24px; }\n" +
" .ls-right { min-height: 260px; position: relative; }\n" +
" .ls-poster { position: relative; }\n" +
" .ls-poster img { height: auto; max-height: 400px; }\n" +
"}\n" +
"@media (max-width: 600px) {\n" +
" .ls-heading { font-size: 18px; }\n" +
" .ls-tab { padding: 6px 12px; font-size: 13px; }\n" +
" .ls-panel-title { font-size: 16px; }\n" +
" .ls-panel-desc { font-size: 13px; }\n" +
" .ls-right { min-height: 200px; }\n" +
"}\n" +
"</style>\n" +
"\n" +
"<section class=\"ls-section\">\n" +
" <div class=\"ls-wrapper\">\n" +
" <!-- Left Column -->\n" +
" <div class=\"ls-left\">\n" +
" <h2 class=\"ls-heading\">Livestream Tháng 07</h2>\n" +
" <div class=\"ls-tabs\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"javascript:void(0)\" class=\"ls-tab\" data-tab=\"ls-panel-{{index}}\" onclick=\"switchLsTab(this)\">Tuần {{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-panel\" id=\"ls-panel-{{index}}\">\n" +
" <h3 class=\"ls-panel-title\">{{excerpt}}</h3>\n" +
" <div class=\"ls-panel-desc\">{{content}}</div>\n" +
" <a href=\"/post/{{slug}}\" class=\"ls-btn\">Tìm Hiểu Thêm</a>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" <!-- Right Column — Poster -->\n" +
" <div class=\"ls-right\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-poster\" data-poster=\"ls-panel-{{index}}\">\n" +
" <img src=\"{{featuredImageUrl}}\" alt=\"{{title}}\" loading=\"lazy\">\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</section>\n" +
"\n" +
"<script>\n" +
"function switchLsTab(el) {\n" +
" var tabId = el.getAttribute('data-tab');\n" +
" document.querySelectorAll('.ls-tab').forEach(function(t){t.classList.remove('active');});\n" +
" el.classList.add('active');\n" +
" document.querySelectorAll('.ls-panel').forEach(function(p){p.classList.remove('active');});\n" +
" var panel = document.getElementById(tabId);\n" +
" if(panel) panel.classList.add('active');\n" +
" document.querySelectorAll('.ls-poster').forEach(function(p){p.classList.remove('active');});\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) poster.classList.add('active');\n" +
"}\n" +
"document.addEventListener('DOMContentLoaded', function() {\n" +
" var first = document.querySelector('.ls-tab');\n" +
" if(first) switchLsTab(first);\n" +
"});\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
int rows = updateTemplate.executeUpdate();
System.out.println("Updated " + rows + " row(s).");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+157
View File
@@ -0,0 +1,157 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate8 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
String htmlTemplate =
"<style>\n" +
"/* ── Livestream Section ── */\n" +
".ls-section { background: #f5f5f5; padding: 40px 0; }\n" +
".ls-wrapper { max-width: 1200px; margin: 0 auto; display: flex; gap: 0; border-left: 5px solid #c0272d; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.07); border-radius: 6px; overflow: hidden; }\n" +
"\n" +
"/* Left column */\n" +
".ls-left { flex: 0 0 40%; max-width: 40%; padding: 36px 32px 32px 32px; display: flex; flex-direction: column; }\n" +
".ls-heading { font-size: 22px; font-weight: 800; color: #111; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 20px; font-family: 'Inter', 'Segoe UI', sans-serif; }\n" +
"\n" +
"/* Tabs */\n" +
".ls-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 24px; }\n" +
".ls-tab { padding: 8px 18px; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; text-decoration: none; white-space: nowrap; }\n" +
".ls-tab:hover { color: #c0272d; }\n" +
".ls-tab.active { color: #c0272d; border-bottom-color: #c0272d; }\n" +
"\n" +
"/* Tab panels */\n" +
".ls-panel { display: none; flex-direction: column; flex: 1; }\n" +
".ls-panel.active { display: flex; }\n" +
".ls-panel-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 14px; line-height: 1.4; }\n" +
".ls-panel-desc { font-size: 14px; color: #555; line-height: 1.7; margin-bottom: 24px; flex: 1; }\n" +
".ls-btn { display: inline-block; padding: 10px 24px; background: #c0272d; color: #fff; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; text-decoration: none; transition: background 0.2s; align-self: flex-start; }\n" +
".ls-btn:hover { background: #a01f24; }\n" +
"\n" +
"/* Right column — poster image */\n" +
".ls-right { flex: 1; min-height: 360px; position: relative; overflow: hidden; }\n" +
".ls-poster { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
".ls-poster.active { display: block; }\n" +
".ls-poster .ls-thumbnail { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 2; cursor: pointer; }\n" +
".ls-poster .ls-thumbnail img { width: 100%; height: 100%; object-fit: cover; }\n" +
".ls-play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 70px; height: 70px; background: rgba(192, 39, 45, 0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3; transition: transform 0.2s, background 0.2s; }\n" +
".ls-play-btn:hover { transform: translate(-50%, -50%) scale(1.1); background: #c0272d; }\n" +
".ls-play-btn::after { content: ''; display: block; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; margin-left: 5px; }\n" +
".ls-video-embed { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 1; }\n" +
".ls-video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
"\n" +
"/* ── Responsive ── */\n" +
"@media (max-width: 900px) {\n" +
" .ls-wrapper { flex-direction: column; border-left: none; border-top: 5px solid #c0272d; }\n" +
" .ls-left { flex: none; max-width: 100%; padding: 28px 20px 24px; }\n" +
" .ls-right { min-height: 260px; position: relative; }\n" +
" .ls-poster { position: relative; }\n" +
" .ls-poster .ls-thumbnail img { height: auto; max-height: 400px; }\n" +
"}\n" +
"@media (max-width: 600px) {\n" +
" .ls-heading { font-size: 18px; }\n" +
" .ls-tab { padding: 6px 12px; font-size: 13px; }\n" +
" .ls-panel-title { font-size: 16px; }\n" +
" .ls-panel-desc { font-size: 13px; }\n" +
" .ls-right { min-height: 200px; }\n" +
" .ls-play-btn { width: 50px; height: 50px; }\n" +
" .ls-play-btn::after { border-width: 9px 0 9px 15px; }\n" +
"}\n" +
"</style>\n" +
"\n" +
"<section class=\"ls-section\">\n" +
" <div class=\"ls-wrapper\">\n" +
" <!-- Left Column -->\n" +
" <div class=\"ls-left\">\n" +
" <h2 class=\"ls-heading\">Livestream Tháng 07</h2>\n" +
" <div class=\"ls-tabs\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"javascript:void(0)\" class=\"ls-tab\" data-tab=\"ls-panel-{{index}}\" onclick=\"switchLsTab(this)\">Tuần {{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-panel\" id=\"ls-panel-{{index}}\">\n" +
" <h3 class=\"ls-panel-title\">{{excerpt}}</h3>\n" +
" <div class=\"ls-panel-desc\">{{content}}</div>\n" +
" <a href=\"/post/{{slug}}\" class=\"ls-btn\">Tìm Hiểu Thêm</a>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" <!-- Right Column — Poster -->\n" +
" <div class=\"ls-right\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-poster\" data-poster=\"ls-panel-{{index}}\">\n" +
" <div class=\"ls-thumbnail\" onclick=\"playLsVideo('ls-panel-{{index}}')\">\n" +
" <img src=\"{{featuredImageUrl}}\" alt=\"{{title}}\" loading=\"lazy\">\n" +
" <div class=\"ls-play-btn\"></div>\n" +
" </div>\n" +
" <div class=\"ls-video-embed\" id=\"ls-video-{{index}}\">\n" +
" {{{metaDescriptionRaw}}}\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
"</section>\n" +
"\n" +
"<script>\n" +
"function switchLsTab(el) {\n" +
" var tabId = el.getAttribute('data-tab');\n" +
" document.querySelectorAll('.ls-tab').forEach(function(t){t.classList.remove('active');});\n" +
" el.classList.add('active');\n" +
" document.querySelectorAll('.ls-panel').forEach(function(p){p.classList.remove('active');});\n" +
" var panel = document.getElementById(tabId);\n" +
" if(panel) panel.classList.add('active');\n" +
" document.querySelectorAll('.ls-poster').forEach(function(p){\n" +
" p.classList.remove('active');\n" +
" // Pause video when switching tab\n" +
" var iframe = p.querySelector('iframe');\n" +
" if(iframe) { \n" +
" var src = iframe.src;\n" +
" iframe.src = src;\n" +
" }\n" +
" });\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) poster.classList.add('active');\n" +
"}\n" +
"function playLsVideo(tabId) {\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) {\n" +
" var thumb = poster.querySelector('.ls-thumbnail');\n" +
" var embed = poster.querySelector('.ls-video-embed');\n" +
" var iframe = embed.querySelector('iframe');\n" +
" if (thumb) thumb.style.display = 'none';\n" +
" if (embed) {\n" +
" embed.style.display = 'block';\n" +
" embed.style.zIndex = '4';\n" +
" // Add autoplay parameter to iframe src if not present\n" +
" if (iframe && iframe.src.indexOf('autoplay=1') === -1) {\n" +
" if (iframe.src.indexOf('?') > -1) iframe.src += '&autoplay=1';\n" +
" else iframe.src += '?autoplay=1';\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n" +
"document.addEventListener('DOMContentLoaded', function() {\n" +
" var first = document.querySelector('.ls-tab');\n" +
" if(first) switchLsTab(first);\n" +
"});\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
int rows = updateTemplate.executeUpdate();
System.out.println("Updated " + rows + " row(s).");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Binary file not shown.
+159
View File
@@ -0,0 +1,159 @@
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
public class UpdateLivestreamTemplate9 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521/sisvietnam", "sisvietnam", "sisvietnam");
String htmlTemplate =
"<style>\n" +
"/* ── Livestream Section ── */\n" +
".ls-section { background: #f5f5f5; padding: 40px 0; }\n" +
".ls-wrapper { display: flex; gap: 0; border-left: 5px solid #c0272d; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,0.07); border-radius: 6px; overflow: hidden; }\n" +
"\n" +
"/* Left column */\n" +
".ls-left { flex: 0 0 40%; max-width: 40%; padding: 36px 32px 32px 32px; display: flex; flex-direction: column; }\n" +
".ls-heading { font-size: 22px; font-weight: 800; color: #111; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 20px; font-family: 'Inter', 'Segoe UI', sans-serif; }\n" +
"\n" +
"/* Tabs */\n" +
".ls-tabs { display: flex; gap: 0; border-bottom: 2px solid #e0e0e0; margin-bottom: 24px; }\n" +
".ls-tab { padding: 8px 18px; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.2s; text-decoration: none; white-space: nowrap; }\n" +
".ls-tab:hover { color: #c0272d; }\n" +
".ls-tab.active { color: #c0272d; border-bottom-color: #c0272d; }\n" +
"\n" +
"/* Tab panels */\n" +
".ls-panel { display: none; flex-direction: column; flex: 1; }\n" +
".ls-panel.active { display: flex; }\n" +
".ls-panel-title { font-size: 18px; font-weight: 700; color: #222; margin-bottom: 14px; line-height: 1.4; }\n" +
".ls-panel-desc { font-size: 14px; color: #555; line-height: 1.7; margin-bottom: 24px; flex: 1; }\n" +
".ls-btn { display: inline-block; padding: 10px 24px; background: #c0272d; color: #fff; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; text-decoration: none; transition: background 0.2s; align-self: flex-start; }\n" +
".ls-btn:hover { background: #a01f24; }\n" +
"\n" +
"/* Right column — poster image */\n" +
".ls-right { flex: 1; min-height: 360px; position: relative; overflow: hidden; }\n" +
".ls-poster { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }\n" +
".ls-poster.active { display: block; }\n" +
".ls-poster .ls-thumbnail { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 2; cursor: pointer; }\n" +
".ls-poster .ls-thumbnail img { width: 100%; height: 100%; object-fit: cover; }\n" +
".ls-play-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 70px; height: 70px; background: rgba(192, 39, 45, 0.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 3; transition: transform 0.2s, background 0.2s; }\n" +
".ls-play-btn:hover { transform: translate(-50%, -50%) scale(1.1); background: #c0272d; }\n" +
".ls-play-btn::after { content: ''; display: block; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent #fff; margin-left: 5px; }\n" +
".ls-video-embed { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 1; }\n" +
".ls-video-embed iframe { width: 100%; height: 100%; border: none; }\n" +
"\n" +
"/* ── Responsive ── */\n" +
"@media (max-width: 900px) {\n" +
" .ls-wrapper { flex-direction: column; border-left: none; border-top: 5px solid #c0272d; }\n" +
" .ls-left { flex: none; max-width: 100%; padding: 28px 20px 24px; }\n" +
" .ls-right { min-height: 260px; position: relative; }\n" +
" .ls-poster { position: relative; }\n" +
" .ls-poster .ls-thumbnail img { height: auto; max-height: 400px; }\n" +
"}\n" +
"@media (max-width: 600px) {\n" +
" .ls-heading { font-size: 18px; }\n" +
" .ls-tab { padding: 6px 12px; font-size: 13px; }\n" +
" .ls-panel-title { font-size: 16px; }\n" +
" .ls-panel-desc { font-size: 13px; }\n" +
" .ls-right { min-height: 200px; }\n" +
" .ls-play-btn { width: 50px; height: 50px; }\n" +
" .ls-play-btn::after { border-width: 9px 0 9px 15px; }\n" +
"}\n" +
"</style>\n" +
"\n" +
"<div class=\"cc--component-container cc--tabbed-media-content ls-section\">\n" +
" <div class=\"c--component c--tabbed-media-content\">\n" +
" <div class=\"ls-wrapper\">\n" +
" <!-- Left Column -->\n" +
" <div class=\"ls-left\">\n" +
" <h2 class=\"ls-heading\">Livestream Tháng 07</h2>\n" +
" <div class=\"ls-tabs\">\n" +
" {{#each livestream_posts}}\n" +
" <a href=\"javascript:void(0)\" class=\"ls-tab\" data-tab=\"ls-panel-{{index}}\" onclick=\"switchLsTab(this)\">Tuần {{title}}</a>\n" +
" {{/each}}\n" +
" </div>\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-panel\" id=\"ls-panel-{{index}}\">\n" +
" <h3 class=\"ls-panel-title\">{{excerpt}}</h3>\n" +
" <div class=\"ls-panel-desc\">{{content}}</div>\n" +
" <a href=\"/post/{{slug}}\" class=\"ls-btn\">Tìm Hiểu Thêm</a>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" <!-- Right Column — Poster -->\n" +
" <div class=\"ls-right\">\n" +
" {{#each livestream_posts}}\n" +
" <div class=\"ls-poster\" data-poster=\"ls-panel-{{index}}\">\n" +
" <div class=\"ls-thumbnail\" onclick=\"playLsVideo('ls-panel-{{index}}')\">\n" +
" <img src=\"{{featuredImageUrl}}\" alt=\"{{title}}\" loading=\"lazy\">\n" +
" <div class=\"ls-play-btn\"></div>\n" +
" </div>\n" +
" <div class=\"ls-video-embed\" id=\"ls-video-{{index}}\">\n" +
" {{{metaDescriptionRaw}}}\n" +
" </div>\n" +
" </div>\n" +
" {{/each}}\n" +
" </div>\n" +
" </div>\n" +
" </div>\n" +
"</div>\n" +
"\n" +
"<script>\n" +
"function switchLsTab(el) {\n" +
" var tabId = el.getAttribute('data-tab');\n" +
" document.querySelectorAll('.ls-tab').forEach(function(t){t.classList.remove('active');});\n" +
" el.classList.add('active');\n" +
" document.querySelectorAll('.ls-panel').forEach(function(p){p.classList.remove('active');});\n" +
" var panel = document.getElementById(tabId);\n" +
" if(panel) panel.classList.add('active');\n" +
" document.querySelectorAll('.ls-poster').forEach(function(p){\n" +
" p.classList.remove('active');\n" +
" // Pause video when switching tab\n" +
" var iframe = p.querySelector('iframe');\n" +
" if(iframe) { \n" +
" var src = iframe.src;\n" +
" iframe.src = src;\n" +
" }\n" +
" });\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) poster.classList.add('active');\n" +
"}\n" +
"function playLsVideo(tabId) {\n" +
" var poster = document.querySelector('.ls-poster[data-poster=\"'+tabId+'\"]');\n" +
" if(poster) {\n" +
" var thumb = poster.querySelector('.ls-thumbnail');\n" +
" var embed = poster.querySelector('.ls-video-embed');\n" +
" var iframe = embed.querySelector('iframe');\n" +
" if (thumb) thumb.style.display = 'none';\n" +
" if (embed) {\n" +
" embed.style.display = 'block';\n" +
" embed.style.zIndex = '4';\n" +
" // Add autoplay parameter to iframe src if not present\n" +
" if (iframe && iframe.src.indexOf('autoplay=1') === -1) {\n" +
" if (iframe.src.indexOf('?') > -1) iframe.src += '&autoplay=1';\n" +
" else iframe.src += '?autoplay=1';\n" +
" }\n" +
" }\n" +
" }\n" +
"}\n" +
"document.addEventListener('DOMContentLoaded', function() {\n" +
" var first = document.querySelector('.ls-tab');\n" +
" if(first) switchLsTab(first);\n" +
"});\n" +
"</script>";
PreparedStatement updateTemplate = conn.prepareStatement(
"UPDATE sis_component_template SET html_template = ? WHERE slug = 'tabbed-livestream'"
);
updateTemplate.setString(1, htmlTemplate);
int rows = updateTemplate.executeUpdate();
System.out.println("Updated " + rows + " row(s).");
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
+3
View File
@@ -0,0 +1,3 @@
SET PAGESIZE 0;
SELECT name FROM v$datafile WHERE con_id = 2;
EXIT;
+8
View File
@@ -0,0 +1,8 @@
CREATE PLUGGABLE DATABASE sisvietnam ADMIN USER pdbadmin IDENTIFIED BY Oracle123 FILE_NAME_CONVERT = ('/opt/oracle/oradata/FREE/pdbseed/', '/opt/oracle/oradata/FREE/sisvietnam/');
ALTER PLUGGABLE DATABASE sisvietnam OPEN;
ALTER PLUGGABLE DATABASE sisvietnam SAVE STATE;
ALTER SESSION SET CONTAINER = sisvietnam;
CREATE USER sisvietnam IDENTIFIED BY "sisvietnam";
GRANT DBA TO sisvietnam;
GRANT ALL PRIVILEGES TO sisvietnam;
EXIT;
+38
View File
@@ -0,0 +1,38 @@
const fs = require('fs');
const cheerio = require('cheerio');
const file = 'sisvietnamvn/src/main/resources/templates/flex-finish.html';
const html = fs.readFileSync(file, 'utf8');
const $ = cheerio.load(html, { decodeEntities: false }, false);
$('img').each((i, el) => {
$(el).removeAttr('srcset');
$(el).removeAttr('data-srcset');
$(el).removeAttr('data-src');
let src = $(el).attr('src');
if (src) {
// Extract the filename from the src
let filename = src.split('/').pop().split('?')[0];
// Handle the base64 gif fallback
if (src.includes('data:image/gif')) {
// we have to find the filename from srcset or data-srcset
let altSrcset = $(el).attr('srcset') || $(el).attr('data-srcset');
if (altSrcset) {
let firstUrl = altSrcset.split(' ')[0];
filename = firstUrl.split('/').pop().split('?')[0];
} else {
// Hardcode for UMass Flex Header 1.png because it's lazyloaded
filename = 'UMass Flex Header 1.png';
}
}
filename = decodeURIComponent(filename);
$(el).attr('th:src', `@{/images/umass/${filename}}`);
$(el).removeAttr('src');
}
});
fs.writeFileSync(file, $.html());
console.log('Done fixing images!');
+1
View File
@@ -0,0 +1 @@
fetch('https://www.google.com/search?q=site:umass.edu&hl=en', {headers: {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'}}).then(r=>r.text()).then(t => { const m = t.match(/id="result-stats">([^<]+)</); console.log(m ? m[1] : 'Not found'); })
+5
View File
@@ -0,0 +1,5 @@
ALTER USER sisvietnam IDENTIFIED BY "sisvietnam" ACCOUNT UNLOCK;
GRANT DBA TO sisvietnam;
GRANT ALL PRIVILEGES TO sisvietnam;
SELECT username, account_status FROM dba_users WHERE username = 'SISVIETNAM';
EXIT;
+10
View File
@@ -0,0 +1,10 @@
<style>
.tabbed-media-content-media-item { width: 100%; aspect-ratio: 16/9; position: relative; display: flex; align-items: center; justify-content: center; background: red;}
.tabbed-media-content-media-item .f--video-embed { display: none; width: 100%; height: 100%; position: absolute; top: 0; left: 0; }
.tabbed-media-content-media-item .f--video-embed iframe { width: 100%; height: 100%; }
</style>
<div class="tabbed-media-content-media-item">
<div class="f--video-embed" style="display:block;">
<iframe title="YouTube video player" src="https://www.youtube.com/embed/j63kT9Bjrb4?si=N5JwIcuRn-iRxkYu" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div>
</div>