Tập lệnh đăng nhập lại tự động sau khi tự đang suất sau 20 phút/.. không thao tác trên Opera Cloud:
Dùng tiện ích mở rộng: Tampermonkey
Tập lệnh:
// ==UserScript==
// @name Opera Cloud Auto Login Script
// @namespace http://tampermonkey.net/
// @version 2026-03-03
// @description Gộp toàn bộ login automation vào một script duy nhất
// @author You
// @match https://fs.ad.tuigroup.com/adfs/ls/*
// @match https://*.identity.oraclecloud.com/ui/v1/signin*
// @match https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id*
// @match https://login.microsoftonline.com/login.srf*
// @match https://m365.cloud.microsoft/chat*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const EMAIL = "youremail@yourdomain.vn";
const PASSWORD = "xxxxxxxx"; // thay mật khẩu
/**********************
* HELPER
**********************/
function waitForEl(selector, callback) {
const el = document.querySelector(selector);
if (el) return callback(el);
const obs = new MutationObserver(() => {
const found = document.querySelector(selector);
if (found) {
obs.disconnect();
callback(found);
}
});
obs.observe(document, { childList: true, subtree: true });
}
/*****************************************
* 1) ADFS Logout → Điều hướng quay lại trang login
*****************************************/
if (
location.hostname === "fs.ad.tuigroup.com" &&
location.pathname.startsWith("/adfs/ls")
) {
const urlParams = new URLSearchParams(location.search);
if (urlParams.get("wa") === "wsignout1.0") {
console.log("Đăng xuất ADFS → Redirect Microsoft");
window.location.replace("https://login.microsoftonline.com");
}
}
/*****************************************
* 2) Oracle Cloud → Click nút Entra ID
*****************************************/
if (location.href.includes("identity.oraclecloud.com/ui/v1/signin")) {
function clickIdP() {
const btn = document.querySelector("[id='idcs-signin-idp-signin-form-idp-button-TUIAD Entra ID']");
if (btn) {
console.log("Tìm thấy nút Entra ID → CLICK");
btn.click();
} else {
console.log("⏳ Chưa thấy nút Entra ID → thử lại...");
setTimeout(clickIdP, 800);
}
}
clickIdP();
}
/************************************************
* 3) Microsoft → Thêm login_hint đúng cách
************************************************/
if (location.href.includes("login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id")) {
const url = new URL(window.location.href);
// Nếu chưa có login_hint thì thêm vào
if (!url.searchParams.has("login_hint")) {
url.searchParams.set("login_hint", EMAIL);
window.location.replace(url.toString());
console.log("Tự đăng nhập bằng user/PW");
return;
}
}
/*****************************************
* 4) ADFS Password → Điền mật khẩu + Sign in
*****************************************/
if (location.hostname === "fs.ad.tuigroup.com") {
waitForEl('#passwordInput', (pw) => {
pw.value = PASSWORD;
pw.dispatchEvent(new Event('input', { bubbles: true }));
console.log("Đã nhập PW");
});
waitForEl('#submitButton', (btn) => {
btn.click();
});
}
/*****************************************
* 5) Microsoft Login (KMSI) → Bấm nút Yes
*****************************************/
if (location.href.includes("login.microsoftonline.com/login.srf")) {
waitForEl('#idSIButton9', (btn) => {
console.log("Tìm thấy nút 'Yes' (idSIButton9) → CLICK");
btn.click();
});
}
/*****************************************
* 6) Đã đăng nhập → Điều hướng quay lại Opera Cloud
*****************************************/
if (location.href.includes("m365.cloud.microsoft/chat")) {
console.log("Đã đăng nhập → Chuyển về Opera Cloud");
window.location.href = "https://mtce13.oraclehospitality.eu-frankfurt-1.ocs.oraclecloud.com/TUIORG/operacloud/odereload";
}
})();