OMPS多人在线同播

OMPS多人在线同播。脚本默认对所有站点均生效。您可以在TamperMonkey=>管理面板=>OMPS多人在线同播=>设置=>用户排除中修改不想要生效的网站或直接修改源代码

As of 2023-01-20. See the latest version.

  1. // ==UserScript==
  2. // @name OMPS多人在线同播
  3. // @namespace https://xypp.cc/omps/
  4. // @version 7.2.2
  5. // @description OMPS多人在线同播。脚本默认对所有站点均生效。您可以在TamperMonkey=>管理面板=>OMPS多人在线同播=>设置=>用户排除中修改不想要生效的网站或直接修改源代码
  6. // @author 小鱼飘飘
  7. // @match *://*/*
  8. // @icon https://xypp.cc/omps/logo.png
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // @grant unsafeWindow
  12. // @grant GM_getTab
  13. // ==/UserScript==
  14.  
  15. (function () {
  16. 'use strict';
  17. const OMPS_VER = "7.2.1";
  18. const DEBUG = false;
  19. const URL = "wss://public.xypp.cc:8093";
  20. /**
  21. * OMPS 在线多人同播插件
  22. */
  23.  
  24. //为非油猴的直接运行方式优化
  25. function LOGGER(a){
  26. if(DEBUG){
  27. console.log("[OMPS]"+a)
  28. }
  29. }
  30. var GM_window, GM_get, GM_set;
  31. if (typeof unsafeWindow != 'object') GM_window = window;
  32. else GM_window = unsafeWindow;
  33. if (typeof GM_getValue != 'function') {
  34. GM_get = function (key, val) {
  35. return GM_window.localStorage.getItem(key) || val;
  36. };
  37. GM_set = function (key, val) {
  38. return GM_window.localStorage.setItem(key, val);
  39. };
  40. } else {
  41. GM_get = GM_getValue;
  42. GM_set = GM_setValue;
  43. }
  44. try {
  45. document.body.setAttribute("data-omps-injected", "true");
  46. } catch (e) { }
  47. function getTextSafe(text) {
  48. var tmpElement = document.createElement("div");
  49. if (tmpElement.textContent !== null) tmpElement.textContent = text;
  50. else tmpElement.innerText = text;
  51.  
  52. var retText = tmpElement.innerHTML;
  53. return retText;
  54. }
  55. var ws;
  56. var video;
  57. var currentDomain = GM_window.location.host;
  58. var isTopWindow = false;
  59. var topCode = "", topUrl = "", topTitle = "";
  60. var frameWindowObjs = [];
  61. var oneKeySetting = {}
  62. var trustKey = GM_get("trust", "none");
  63. var initFinish = false;
  64. var lastTime = -1;
  65. var pauseAt = -1;
  66. var pauseUser = "";
  67. var globalCount = 24;
  68. var timerCount = 0;
  69. var toastCnt = 0;
  70. var tmpLocalDelay;
  71. var localDelay;
  72. var currentRate = 1;
  73. var baseSpeed = 1;
  74. var tipSpeed = true;
  75. var initTime;
  76. var videoCode = "";
  77. var HASH = {};
  78. var videoTitle = "";
  79. var videoUrl = "";
  80. var errConnBreak = false;
  81. var errConnBreak_reconn = 10;
  82. var errConnBreak_tryCnt = 0;
  83. var isPausedShowList = false;
  84. const css = `.omps-friend .item:hover{text-decoration: underline;cursor: pointer;}.omps-friend .item:hover::after{content: "→";}.omps-friend{position:absolute;top:140px;left:0}.omps-friend .item{height:30px;border-radius:0 40px 40px 0;background-color:rgba(0,0,0,0.772);padding-left:10px;padding-right:5px;line-height:25px;font-size:15px;color:white;max-width:300px;margin-top:3px}.omps-friend .item.offline{opacity:.5;text-decoration:line-through}.omps-tip{position:absolute;top:100px;height:40px;border-radius:0 40px 40px 0;left:-300px;background-color:rgba(0,0,0,0.772);padding-left:10px;line-height:35px;color:white;max-width:100%;z-index:10000000;transition:all 1s;opacity:0}.omps-tip.open{left:0;opacity:1}.omps-tip div{display:inline;font-size:20px}.omps-tip .btn{color:black;background-color:#fff;border-radius:30px;padding:5px 7px;margin-right:6px;line-height:13px;box-shadow:grey 1px 1px 1px;text-align:center;display:inline-block;vertical-align:middle}.omps-tip .btn svg,.omps-chat-input svg,.omps-chat svg,.omps-friend svg{height:20px;width:20px}.omps-tip .btn svg path{fill:black}.omps-tip .btn:hover{background-color:#dcdcdc}.omps-tip .btn:active{box-shadow:inset gray 1px 1px 1px}.omps-tip .btn span{display:none}.omps-tip .btn:hover span{animation:showLabelAnim 1s linear 1s 1;animation-fill-mode:forwards;max-width:0;overflow-x:hidden;word-break:keep-all;margin:0;display:unset;padding:0;line-height:20px;overflow-y:clip;float:right}@keyframes showLabelAnim{0%{max-width:0}100%{max-width:200px}}.omps-config{font-size:18px;z-index:10000003;max-width:calc(100% - 100px);position:absolute;top:50px;width:600px;left:50px;background-color:rgba(0,0,0,0.772);border-radius:10px;color:white;padding:20px;max-height:calc(100% - 100px);overflow:auto}.omps-config input{display:block;outline:0;border:0;border-radius:5px;color:black;background-color:rgba(255,255,255,0.772)}.omps-config input:active{box-shadow:skyblue 0 0 5px 3px}.omps-config input:focus{box-shadow:skyblue 0 0 3px 1px}.omps-config input.i{height:30px;width:300px;max-width:100%}.omps-config input.c{height:20px;width:20px;-webkit-appearance:checkbox!important;appearance:checkbox!important}.omps-config label{display:block;text-decoration:underline}.omps-config small{display:block;color:lightgray}.omps-config .btn{color:black;background-color:#fff;border-radius:30px;padding:5px 10px;margin-right:10px;box-shadow:grey 1px 1px 1px;text-align:center;display:inline-block;vertical-align:middle}.omps-config .btn:hover{background-color:#dcdcdc}.omps-config .btn:active{box-shadow:inset gray 1px 1px 1px}.omps-chat{font-size:18px;position:absolute;top:5px;right:0;overflow-x:hidden;max-width:100%;width:400px}.omps-chat .item{border-radius:40px 0 0 40px;background-color:rgba(0,0,0,0.772);color:white;max-width:calc(100% - 30px);z-index:10000000;transition:all 1s;opacity:0;transform:translateX(100%);position:relative;margin-top:2px;max-height:0;line-break:loose;word-break:break-all;white-space:normal;overflow:hidden}.omps-chat .item.open{transform:translateX(0%);opacity:1;max-height:400px;padding:10px}.omps-chat .item .name{text-decoration:underline;font-weight:bold}.omps-chat .item .delay{font-size:x-small;font-style:italic;position:absolute;top:1px;right:1px}.omps-chat-input{white-space: nowrap;position:absolute;bottom:50px;right:100px;width:calc(100% - 200px);background-color:rgba(0,0,0,0.772);height:40px}.omps-chat-input{font-size:18px;position:absolute;bottom:150px;right:100px;width:calc(100% - 200px);background-color:rgba(0,0,0,0.772);border-radius:50px;padding:10px 30px;opacity:0;transition:all .5s}.omps-chat-input.tipPos{animation:omps-tipPos 1s ease-in-out 0s infinite}.omps-chat-input:hover,.omps-chat-input.inputActive{opacity:1}@keyframes omps-tipPos{0%{opacity:0}50%{opacity:.5}100%{opacity:0}}.omps-chat-input input{background-color:rgba(0,0,0,0);display:inline-block;outline:0;border:rgba(255,255,255,0.497) 1px solid;border-radius:5px;width:calc(100% - 100px);height:100%;color:white}.omps-chat-input input:active{box-shadow:skyblue 0 0 5px 3px}.omps-chat-input input:focus{box-shadow:skyblue 0 0 3px 1px}.omps-chat-input .btn,.omps-chat .btn{color:black;background-color:#fff;border-radius:30px;padding:5px 10px;margin-right:10px;box-shadow:grey 1px 1px 1px;text-align:center;display:inline-block;vertical-align:middle}.omps-chat-input .btn svg path,.omps-chat .btn svg path{fill:black}.omps-chat-input .btn:hover,.omps-chat .btn:hover{background-color:#dcdcdc}.omps-chat-input .btn:active,.omps-chat .btn:active{box-shadow:inset gray 1px 1px 1px}.omps-chat .btn{padding: 2px 5px;font-size: 16px;}.omps-tipLine{position: absolute;top: 100px;height: 40px;border-radius:5px;left: 0px;width: 3px;background-color: white;z-index: 10000001;transition:background-color 0.5s;}`;
  85. function OMPS_INFO() {
  86. if (isTopWindow) console.log(`
  87. ____ __ _______ _____
  88. / __ \\/ |/ / __ \\/ ___/
  89. / / / / /|_/ / /_/ /\\__ \\
  90. / /_/ / / / / ____/___/ /
  91. \\____/_/ /_/_/ /____/
  92. OMPS在线同播插件Ver${OMPS_VER}
  93. https://xypp.cc/omps/
  94. `);
  95. }
  96.  
  97. const lang = {
  98. join: "检测到视频,点击进入联机放映",
  99. reconfigure: "重新填写配置",
  100. quickJoin: "快速加入",
  101. quit: "关闭",
  102. setting: {
  103. userId: {
  104. label: "用户名",
  105. tip: "其他用户看到您的名字。请不要使用短用户名防止重名"
  106. },
  107. group: {
  108. label: "加入的房间ID",
  109. tip: "该房间ID用于同步进度。与您的朋友输入相同的房间ID且您和朋友正在观看相同的视频时,你们的进度将会被同步"
  110. },
  111. autoJoin: {
  112. label: "自动加入",
  113. tip: "勾选后,下次检测到视频将会自动进入上次填写的群组"
  114. },
  115. silent: {
  116. label: "静默模式",
  117. tip: "仅会提示您失去同步消息,不会提示您成功消息"
  118. },
  119. friend: {
  120. label: "始终显示好友",
  121. tip: "常驻显示左侧的好友列表。该列表在不同步/等待好友进度时会自动显示,静默模式下该列表不会显示。"
  122. },
  123. showMsgIpt: {
  124. label: "显示消息输入框",
  125. tip: "在视频下方中央显示一个输入框,这将您允许发送消息"
  126. },
  127. hideMsg: {
  128. label: "隐藏消息",
  129. tip: "隐藏消息,不显示别人发送的消息。注意,打开此功能后,显示消息输入框功能将失效。"
  130. },
  131. noRateSync: {
  132. label: "不使用变速同步",
  133. tip: "变速同步会在您与好友进度略微不同时将快的一方速率降低5%来缓慢而无感的达到同步。关闭此选项后将使用默认的暂停同步方法。"
  134. },
  135.  
  136. saveExit: "保存并关闭",
  137. saveJoin: "保存并连接"
  138. },
  139. conErr: ["无法连接到服务器,将在", "秒后重连"],
  140. conErrNoRty: "无法连接到服务器,点击重连",
  141. autoReconn: "自动重连中...",
  142. pauseMsg: "的视频太慢了,等他一下...",
  143. pauseHandMsg: "您的视频慢了,房间中其他人正在等您",
  144. playFail: "未能正确的开始播放视频!您需要手动点击播放按钮,否则您的好友可能需要等待您",
  145. delay: ["延迟达到了", "ms,可能会影响您或其他人的观影体验"],
  146. success: "连接成功,延迟",
  147. syncSuccess: "同步进度完成",
  148. playerJoin: "加入了放映厅",
  149. sync: "同步",
  150. call: "集合",
  151. sendmsg: "发送",
  152. unsync: ["失去同步!最快进度为", "(", "s)"],
  153. unsync_top: "失去同步!您是目前的最快进度",
  154. videoChange: "视频变更,准备重连",
  155. dumplName: "注册失败,与服务器中已连接的用户重名",
  156. secondConnect: "因为您的另一个客户端的连接,本页面已与服务器断开连接",
  157. tiper: "提示",
  158. jumpTip: ["用户[", "]从此视频转向观看‘", "’", "点击前往"],
  159. jumpConfirm: ["您即将前往", "跳转到目标网站可能会带来不明的风险,您确定要跳转吗?"],
  160. shareUrl: "成功创建了分享链接",
  161. share: "分享",
  162. waitTop: ["分享失败", "等待顶层页面响应,请稍后"],
  163. streamVideo: "这是一个直播视频,已关闭进度同步",
  164. usingSpeedControl: "正在使用调速同步,这将调整您的视频播放速度"
  165. }
  166.  
  167. //===========设置相关============
  168. var setting = {
  169. autoJoin: "",
  170. userId: "",
  171. group: "",
  172. silent: "",
  173. friend: "",
  174. showMsgIpt: "",
  175. hideMsg: "",
  176. noRateSync: "",
  177. };
  178. //导入设置(TamporMonkey/LocalStorage)
  179. for (const settingItem in setting) {
  180. if (Object.hasOwnProperty.call(setting, settingItem)) {
  181. const defaultVal = setting[settingItem];
  182. setting[settingItem] = GM_get(settingItem, defaultVal);
  183. }
  184. }
  185. var openedSettingPanel;
  186. //[函数]打开设置面板
  187. function openSettingPanel() {
  188. if (openedSettingPanel) {
  189. closeSettingPanel();
  190. }
  191. var el = document.createElement("div");
  192. el.className = "omps-config";
  193. el.id = "omps-config";
  194. el.onclick = noPop;
  195. el.innerHTML = msgMaker.settingPanel();
  196. document.body.appendChild(el);
  197. openedSettingPanel = el;
  198. }
  199. function saveSettings() {
  200. var el = document.getElementById("omps-config");
  201. if (!el) return;
  202. GM_set("userId", document.getElementById("omps-input-name").value);
  203. GM_set("group", document.getElementById("omps-input-group").value);
  204. GM_set("autoJoin", document.getElementById("omps-input-quick").checked ? "1" : "");
  205. GM_set("silent", document.getElementById("omps-input-silent").checked ? "1" : "");
  206. GM_set("friend", document.getElementById("omps-input-friend").checked ? "1" : "");
  207. GM_set("showMsgIpt", document.getElementById("omps-input-showMsgIpt").checked ? "1" : "");
  208. GM_set("hideMsg", document.getElementById("omps-input-hideMsg").checked ? "1" : "");
  209. GM_set("noRateSync", document.getElementById("omps-input-noRateSync").checked ? "1" : "");
  210. setting.userId = document.getElementById("omps-input-name").value;
  211. setting.group = document.getElementById("omps-input-group").value;
  212. setting.autoJoin = document.getElementById("omps-input-quick").checked ? "1" : "";
  213. setting.silent = document.getElementById("omps-input-silent").checked ? "1" : "";
  214. setting.friend = document.getElementById("omps-input-friend").checked ? "1" : "";
  215. setting.showMsgIpt = document.getElementById("omps-input-showMsgIpt").checked ? "1" : "";
  216. setting.hideMsg = document.getElementById("omps-input-hideMsg").checked ? "1" : "";
  217. setting.noRateSync = document.getElementById("omps-input-noRateSync").checked ? "1" : "";
  218. }
  219. function closeSettingPanel() {
  220. var el = openedSettingPanel;
  221. if (el && el.parentNode) {
  222. el.parentNode.removeChild(el);
  223. }
  224. }
  225. //===========设置相关============
  226.  
  227.  
  228. var msgMaker = {
  229. settingPanel: () => {//设置面板
  230. return `
  231. <label>${lang.setting.userId.label}</label>
  232. <small>${lang.setting.userId.tip}</small>
  233. <input class="omps-input i" id="omps-input-name" value="${setting.userId}">
  234. <br>
  235. <label>${lang.setting.group.label}</label>
  236. <small>${lang.setting.group.tip}</small>
  237. <input class="omps-input i" id="omps-input-group" value="${setting.group}">
  238. <br>
  239. <label>${lang.setting.autoJoin.label}</label>
  240. <small>${lang.setting.autoJoin.tip}</small>
  241. <input class="omps-input c" type="checkbox" id="omps-input-quick" ${setting.autoJoin ? "checked" : ""}>
  242. <br>
  243. <label>${lang.setting.silent.label}</label>
  244. <small>${lang.setting.silent.tip}</small>
  245. <input class="omps-input c" type="checkbox" id="omps-input-silent" ${setting.silent ? "checked" : ""}>
  246. <br>
  247. <label>${lang.setting.friend.label}</label>
  248. <small>${lang.setting.friend.tip}</small>
  249. <input class="omps-input c" type="checkbox" id="omps-input-friend" ${setting.friend ? "checked" : ""}>
  250. <br>
  251. <label>${lang.setting.showMsgIpt.label}</label>
  252. <small>${lang.setting.showMsgIpt.tip}</small>
  253. <input class="omps-input c" type="checkbox" id="omps-input-showMsgIpt" ${setting.showMsgIpt ? "checked" : ""}>
  254. <br>
  255. <label>${lang.setting.hideMsg.label}</label>
  256. <small>${lang.setting.hideMsg.tip}</small>
  257. <input class="omps-input c" type="checkbox" id="omps-input-hideMsg" ${setting.hideMsg ? "checked" : ""}>
  258. <br>
  259. <label>${lang.setting.noRateSync.label}</label>
  260. <small>${lang.setting.noRateSync.tip}</small>
  261. <input class="omps-input c" type="checkbox" id="omps-input-noRateSync" ${setting.noRateSync ? "checked" : ""}>
  262. <br><br>
  263. <a class="btn" onclick="ompsEventRouter('saveExit');return false;">${lang.setting.saveExit}</a>
  264. <a class="btn" onclick="ompsEventRouter('saveLink');return false;">${lang.setting.saveJoin}</a>
  265. `;
  266. },
  267. smallSetting: () => {
  268. return `
  269. <a class="btn" onclick="ompsEventRouter('config');return false;">
  270. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black"class="bi bi-gear-fill" viewBox="0 0 16 16"><path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z" /></svg>
  271. <span class="desc">${lang.reconfigure}</span>
  272. </a>
  273. <a class="btn" onclick="ompsEventRouter('hide');return false;">
  274. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-x" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg>
  275. <span class="desc">${lang.quit}</span>
  276. </a>
  277. `;
  278. },
  279. joinAsk: (hasConfigured) => {
  280. return `${lang.join}
  281. <a class="btn" onclick="ompsEventRouter('config');return false;">
  282. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black"class="bi bi-gear-fill" viewBox="0 0 16 16"><path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z" /></svg>
  283. <span class="desc">${lang.reconfigure}</span>
  284. </a>
  285. <a class="btn"onclick="ompsEventRouter('create');return false;">
  286. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-arrow-right-circle-fill" viewBox="0 0 16 16"><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zM4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H4.5z"/></svg>
  287. <span class="desc">${lang.quickJoin}</span>
  288. </a>
  289. <a class="btn" onclick="ompsEventRouter('hide');return false;">
  290. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-x" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg>
  291. <span class="desc">${lang.quit}</span>
  292. </a>
  293. `;
  294. },
  295. success: (code, delv, group) => {
  296. return `${getTextSafe(group)} ${lang.success}${getTextSafe(delv)}
  297. <a class="btn" onclick="ompsEventRouter('config');return false;">
  298. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black"class="bi bi-gear-fill" viewBox="0 0 16 16"><path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z" /></svg>
  299. <span class="desc">${lang.reconfigure}</span>
  300. </a>
  301. <a class="btn" onclick="ompsEventRouter('share');return false;">
  302. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-share-fill" viewBox="0 0 16 16"><path d="M11 2.5a2.5 2.5 0 1 1 .603 1.628l-6.718 3.12a2.499 2.499 0 0 1 0 1.504l6.718 3.12a2.5 2.5 0 1 1-.488.876l-6.718-3.12a2.5 2.5 0 1 1 0-3.256l6.718-3.12A2.5 2.5 0 0 1 11 2.5z"/></svg>
  303. <span class="desc">${lang.share}</span>
  304. </a>
  305. <a class="btn" onclick="ompsEventRouter('hide');return false;">
  306. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-x" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg>
  307. <span class="desc">${lang.quit}</span>
  308. </a>
  309. `;
  310. },
  311. conErr: () => {
  312. return `${lang.conErr}`;
  313. },
  314. pauseMsg: (pu) => {
  315. return `${pu}${lang.pauseMsg}`;
  316. },
  317. pauseFor: () => {
  318. return `${lang.pauseHandMsg}`;
  319. },
  320. playFail: () => {
  321. return `${lang.playFail}`;
  322. },
  323. delayTip: (delv) => {
  324. return `${lang.delay[0]}${getTextSafe(delv)}${lang.delay[1]}`;
  325. },
  326. syncSuccess: () => {
  327. return lang.syncSuccess;
  328. },
  329. playerJoin: (pname) => {
  330. return `${getTextSafe(pname)}${lang.playerJoin}`;
  331. },
  332. unsync: (target, deltaTime) => {
  333. return `${lang.unsync[0]}${getTextSafe(target)}${lang.unsync[1]}${getTextSafe(deltaTime)}${lang.unsync[2]}
  334. <a class=\"btn\" onclick=\"ompsEventRouter('sync');return false;\">
  335. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-clockwise" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z"/><path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z"/></svg>
  336. <span class="desc">${lang.sync}</span>
  337. </a>
  338. <a class=\"btn\" onclick=\"ompsEventRouter('call');return false;\">
  339. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-flag-fill" viewBox="0 0 16 16"><path d="M14.778.085A.5.5 0 0 1 15 .5V8a.5.5 0 0 1-.314.464L14.5 8l.186.464-.003.001-.006.003-.023.009a12.435 12.435 0 0 1-.397.15c-.264.095-.631.223-1.047.35-.816.252-1.879.523-2.71.523-.847 0-1.548-.28-2.158-.525l-.028-.01C7.68 8.71 7.14 8.5 6.5 8.5c-.7 0-1.638.23-2.437.477A19.626 19.626 0 0 0 3 9.342V15.5a.5.5 0 0 1-1 0V.5a.5.5 0 0 1 1 0v.282c.226-.079.496-.17.79-.26C4.606.272 5.67 0 6.5 0c.84 0 1.524.277 2.121.519l.043.018C9.286.788 9.828 1 10.5 1c.7 0 1.638-.23 2.437-.477a19.587 19.587 0 0 0 1.349-.476l.019-.007.004-.002h.001"/></svg>
  340. <span class="desc">${lang.call}</span>
  341. </a>`
  342. },
  343. unsync_top: () => {
  344. return `${lang.unsync_top}
  345. <a class=\"btn\" onclick=\"ompsEventRouter('call');return false;\">
  346. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-flag-fill" viewBox="0 0 16 16"><path d="M14.778.085A.5.5 0 0 1 15 .5V8a.5.5 0 0 1-.314.464L14.5 8l.186.464-.003.001-.006.003-.023.009a12.435 12.435 0 0 1-.397.15c-.264.095-.631.223-1.047.35-.816.252-1.879.523-2.71.523-.847 0-1.548-.28-2.158-.525l-.028-.01C7.68 8.71 7.14 8.5 6.5 8.5c-.7 0-1.638.23-2.437.477A19.626 19.626 0 0 0 3 9.342V15.5a.5.5 0 0 1-1 0V.5a.5.5 0 0 1 1 0v.282c.226-.079.496-.17.79-.26C4.606.272 5.67 0 6.5 0c.84 0 1.524.277 2.121.519l.043.018C9.286.788 9.828 1 10.5 1c.7 0 1.638-.23 2.437-.477a19.587 19.587 0 0 0 1.349-.476l.019-.007.004-.002h.001"/></svg>
  347. <span class="desc">${lang.call}</span>
  348. </a>`
  349. },
  350. chat_input: () => {
  351. return `
  352. <input class="omps-input i" id="omps-input-chatmsg" onblur="this.parentNode.classList.remove('inputActive')"
  353. onfocus="this.parentNode.classList.add('inputActive')" onkeydown="if(event.keyCode == 13){ompsEventRouter('sendMsg');omps_noPop(event);}"
  354. onclick="noPop(event)" autocomplete="off">
  355. <a class="btn" onclick="ompsEventRouter('sendMsg');omps_noPop(event)">
  356. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black"
  357. class="bi bi-arrow-right-circle-fill" viewBox="0 0 16 16">
  358. <path
  359. d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zM4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H4.5z" />
  360. </svg>
  361. <span class="desc">${lang.sendmsg}</span>
  362. </a>
  363. `;
  364. },
  365. chat_block: (name, msg, time) => {
  366. return `
  367. <span class="name">${getTextSafe(name)}</span>
  368. &nbsp;:&nbsp;
  369. <span>${getTextSafe(msg)}</span>
  370. <span class="delay">${time}</span>
  371. `;
  372. },
  373. error: (msg, arg) => {
  374. if (msg == "E_USERNAME_DUMPL") {
  375. return `
  376. ${lang.dumplName}
  377. <a class="btn" onclick="ompsEventRouter('config');return false;">
  378. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black"class="bi bi-gear-fill" viewBox="0 0 16 16"><path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z" /></svg>
  379. <span class="desc">${lang.reconfigure}</span>
  380. </a>
  381. <a class="btn" onclick="ompsEventRouter('hide');return false;">
  382. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-x" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg>
  383. <span class="desc">${lang.quit}</span>
  384. </a>`;
  385. } else if (msg == "E_SECOND_CONN") {
  386. return `${lang.secondConnect}
  387. <a class="btn" onclick="ompsEventRouter('config');return false;">
  388. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black"class="bi bi-gear-fill" viewBox="0 0 16 16"><path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z" /></svg>
  389. <span class="desc">${lang.reconfigure}</span>
  390. </a>
  391. <a class="btn"onclick="ompsEventRouter('create');return false;">
  392. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-arrow-right-circle-fill" viewBox="0 0 16 16"><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zM4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H4.5z"/></svg>
  393. <span class="desc">${lang.quickJoin}</span>
  394. </a>
  395. <a class="btn" onclick="ompsEventRouter('hide');return false;">
  396. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-x" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg>
  397. <span class="desc">${lang.quit}</span>
  398. </a>
  399. `;
  400. } else if (msg == "E_ERR_NET") {
  401. let _tipTxt = `${lang.conErr[0]}${arg}${lang.conErr[1]}`;
  402. if (!arg) _tipTxt = lang.conErrNoRty;
  403. return `${_tipTxt}
  404. <a class="btn" onclick="ompsEventRouter('config');return false;">
  405. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black"class="bi bi-gear-fill" viewBox="0 0 16 16"><path d="M9.405 1.05c-.413-1.4-2.397-1.4-2.81 0l-.1.34a1.464 1.464 0 0 1-2.105.872l-.31-.17c-1.283-.698-2.686.705-1.987 1.987l.169.311c.446.82.023 1.841-.872 2.105l-.34.1c-1.4.413-1.4 2.397 0 2.81l.34.1a1.464 1.464 0 0 1 .872 2.105l-.17.31c-.698 1.283.705 2.686 1.987 1.987l.311-.169a1.464 1.464 0 0 1 2.105.872l.1.34c.413 1.4 2.397 1.4 2.81 0l.1-.34a1.464 1.464 0 0 1 2.105-.872l.31.17c1.283.698 2.686-.705 1.987-1.987l-.169-.311a1.464 1.464 0 0 1 .872-2.105l.34-.1c1.4-.413 1.4-2.397 0-2.81l-.34-.1a1.464 1.464 0 0 1-.872-2.105l.17-.31c.698-1.283-.705-2.686-1.987-1.987l-.311.169a1.464 1.464 0 0 1-2.105-.872l-.1-.34zM8 10.93a2.929 2.929 0 1 1 0-5.86 2.929 2.929 0 0 1 0 5.858z" /></svg>
  406. <span class="desc">${lang.reconfigure}</span>
  407. </a>
  408. <a class="btn"onclick="ompsEventRouter('create');return false;">
  409. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-arrow-right-circle-fill" viewBox="0 0 16 16"><path d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zM4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H4.5z"/></svg>
  410. <span class="desc">${lang.quickJoin}</span>
  411. </a>
  412. <a class="btn" onclick="ompsEventRouter('hide');return false;">
  413. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black" class="bi bi-x" viewBox="0 0 16 16"><path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg>
  414. <span class="desc">${lang.quit}</span>
  415. </a>
  416. `;
  417. }
  418. },
  419. userJump: (name, title, url) => {
  420. if (title.length > 80) {
  421. title = title.substr(0, 80) + "...";
  422. }
  423. var urlDat = "";
  424. try { urlDat = window.btoa(url) } catch (e) { }
  425. var urlBtn = `<div style="text-align:right;">
  426. <a class="btn" data-url='${urlDat}' onclick="ompsEventRouter('jump',event);omps_noPop(event);">
  427. <span>${lang.jumpTip[3]}</span>
  428. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="black"
  429. class="bi bi-arrow-right-circle-fill" viewBox="0 0 16 16">
  430. <path
  431. d="M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zM4.5 7.5a.5.5 0 0 0 0 1h5.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H4.5z" />
  432. </svg>
  433. </a></div>`;
  434. if (!urlDat) urlBtn = "【发生错误,无法跳转】";
  435. return `
  436. <span class="name">${getTextSafe(name)}</span>
  437. &nbsp;:&nbsp;
  438. <span>
  439. ${lang.jumpTip[0]}${getTextSafe(name)}${lang.jumpTip[1]}${getTextSafe(title)}${lang.jumpTip[2]}${urlBtn}
  440. </span>
  441. `
  442. },
  443. share_url: (url) => {
  444. return `
  445. <span class="name">${lang.shareUrl}</span><br>
  446. <div><textarea style="background:rgba(0,0,0,0);color:white;width:90%;height:60px;">${url}</textarea></div>
  447. `
  448. }
  449. }
  450.  
  451.  
  452. // 向服务器发送数据
  453. var sendDat = (data) => {
  454. ws.send(JSON.stringify(data));
  455. }
  456.  
  457. //=============页内通讯=====================
  458. function registeInPageMessage() {
  459. GM_window.addEventListener("message", inPageOnMessage);
  460. if (GM_window !== GM_window.top) {
  461. isTopWindow = false;
  462. GM_window.top.postMessage({
  463. fromApp: "OMPS",
  464. action: "reg"
  465. }, "*");
  466. } else {
  467. isTopWindow = true;
  468. topUrl = GM_window.location.href;
  469. topTitle = GM_window.document.title;
  470. OMPS_INFO();
  471. }
  472. }
  473. function inPageOnMessage(event) {
  474. var data = event.data;
  475. if ((data.fromApp || "") != "OMPS") return;
  476. if (data.action == "reg") {
  477. event.source.postMessage({
  478. fromApp: "OMPS",
  479. action: "setCode",
  480. url: topUrl,
  481. title: topTitle,
  482. code: getVideoCode(),
  483. }, "*");
  484. if (oneKeySetting.exist)
  485. event.source.postMessage({
  486. fromApp: "OMPS",
  487. action: "onekey",
  488. data: oneKeySetting,
  489. }, "*");
  490. frameWindowObjs.push(event.source)
  491. } else if (data.action == "setHash") {
  492. GM_window.location.hash = event.data.val;
  493. } else if (data.action == "setCode") {
  494. topCode = data.code;
  495. topUrl = data.url;
  496. topTitle = data.title;
  497. LOGGER("[OMPS]TOP_CODE Received:" + topCode);
  498. detecVideoCode();
  499. } else if (data.action == "onekey") {
  500. oneKeySetting = data.data;
  501. applyOneKeySetting();
  502. } else if (data.action == "jumpUrl") {
  503. if (confirm(lang.jumpConfirm[0] +
  504. data.url +
  505. '\n' +
  506. lang.jumpConfirm[1])) {
  507. GM_window.location.href = data.url;
  508. }
  509. }
  510.  
  511. }
  512.  
  513. //=============视频识别代码计算==============
  514.  
  515. function videoCodeOutdateEventRegist_title() {
  516. try {
  517. var titleEl = document.getElementsByTagName("title")[0];
  518. var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
  519. var MutationObserverConfig = {
  520. childList: true,
  521. subtree: true,
  522. characterData: true
  523. };
  524. var observer = new MutationObserver(function (mutations) {
  525. LOGGER("视频检测到标题变化");
  526. topUrl = GM_window.location.href;
  527. topTitle = GM_window.document.title;
  528. for (let i = 0; i < frameWindowObjs.length; i++) {
  529. frameWindowObjs[i].postMessage({
  530. fromApp: "OMPS",
  531. action: "setCode",
  532. url: topUrl,
  533. title: topTitle,
  534. code: getVideoCode(),
  535. }, "*");
  536. }
  537. detecVideoCode();
  538. });
  539. observer.observe(titleEl, MutationObserverConfig);
  540. } catch (ignore) { }
  541. }
  542. //检测VideoCode是否过期
  543. function detecVideoCode() {
  544. if (!initFinish) return;
  545. let ovideoCode = videoCode;
  546. calcVideoCode(video, function () {
  547. if (videoCode != ovideoCode) {
  548. showToast(lang.videoChange, 1, 1);
  549. initFinish = false;
  550. try { ws.onclose = ws.onerror = () => { }; } catch (e) { }
  551. try { ws.close(); } catch (e) { }
  552. showTip();
  553. } else setTimeout(detecVideoCode, 5000);
  554. });
  555. }
  556. //计算当前视频页面对应的VideoCode
  557. function getVideoCode() {
  558. var orgCode = GM_window.document.title;
  559. var tmpVideoCode = HASH.md5(orgCode);
  560. tmpVideoCode = tmpVideoCode.toUpperCase();
  561. return tmpVideoCode;
  562. }
  563. //更新VideoCode
  564. function calcVideoCode(_video, callBack, count = 0) {
  565. globalCount = 0;
  566. if (count > 10) {
  567. LOGGER("[OMPS]TOP_CODE Recv. timeout");
  568. video = null;
  569. globalCount = 24;
  570. videoCode = "";
  571. testVideo();
  572. return;
  573. }
  574. let t_videoCode = getVideoCode();
  575. if (!isTopWindow) {
  576. if (!topCode) {
  577. LOGGER("[OMPS]STILL WAITING TOP");
  578. return setTimeout(calcVideoCode, 1000, _video, callBack, (count || 0) + 1);
  579. } else {
  580. videoUrl = topUrl;
  581. videoTitle = topTitle;
  582. t_videoCode = HASH.md5(t_videoCode + topCode);
  583. }
  584. } else {
  585. videoUrl = GM_window.location.href;
  586. videoTitle = GM_window.document.title;
  587. }
  588. videoCode = t_videoCode.toUpperCase();
  589. callBack();
  590. }
  591. //视频调速
  592. function setVideoSpeed(speed) {
  593. currentRate = speed;
  594. if (video.playbackRate != speed)
  595. video.playbackRate = speed;
  596. }
  597.  
  598. //==========TOAST提示条====================
  599. var toastElement;
  600. var toastTipLine;
  601. function showToast(text, time, imp) {
  602. if (time === undefined) time = -1;
  603. else time *= 5;
  604.  
  605. if (time != -1 && setting.silent && !imp) return hideToast();
  606.  
  607. if (!toastElement) {
  608. toastElement = document.createElement("div");
  609. toastElement.className = "omps-tip"
  610. toastElement.onclick = noPop;
  611. video.parentNode.appendChild(toastElement);
  612. }
  613.  
  614. toastCnt = time;
  615. toastElement.innerHTML = "<div>" + text + "</div>";
  616. toastElement.style.display = "block";
  617. setTimeout(() => {
  618. toastElement.classList.add("open");
  619. }, 100);
  620. }
  621. function hideToast(fh) {
  622. if (fh) {
  623. if (toastElement) toastElement.style.display = "none";
  624. toastCnt = 0;
  625. } else {
  626. if (toastElement) toastElement.classList.remove("open");
  627. }
  628. }
  629. function appendTipLine() {
  630. if (toastTipLine && toastTipLine.parentNode) {
  631. try { toastTipLine.parentNode.removeChild(toastTipLine) } catch (ignore) { };
  632. }
  633. toastTipLine = document.createElement("div");
  634. toastTipLine.className = "omps-tipLine";
  635. toastTipLine.onmouseenter = toastTipLine.ontouchstart = function () {
  636. showToast(msgMaker.smallSetting(), 3, true);
  637. }
  638. toastTipLine.onclick = noPop;
  639. video.parentNode.appendChild(toastTipLine);
  640. }
  641.  
  642. //==========加入流程===========
  643. function ableToDirectJoin() {
  644. var lastJoinTime = parseInt(GM_get("lastTime", 0));
  645. var lastJoinDomain = GM_get("lastDomain", "");
  646. if (Date.now() - lastJoinTime < 60 * 1000 && lastJoinDomain == currentDomain) {
  647. LOGGER("[OMPS]:判断自动跳转视频,自动加入已生效");
  648. return true;
  649. }
  650. return false;
  651. }
  652. function updateDirectJoin() {
  653. GM_set("lastTime", Date.now());
  654. GM_set("lastDomain", currentDomain);
  655. }
  656. function showTip() {
  657. //STYLE_A 加入目标window,使得视频播放器中样式可用
  658. LOGGER("[OMPS]:已找到视频");
  659. var el = document.createElement("style");
  660. el.innerHTML = css;
  661. el.className = "OMPS_CSS";
  662. video.parentNode.appendChild(el);
  663. //B 在大window中加入样式
  664. el = document.createElement("style");
  665. el.innerHTML = css;
  666. el.className = "OMPS_CSS";
  667. document.body.appendChild(el);
  668.  
  669. if (video.duration === Infinity) {
  670. showToast(lang.streamVideo, 3);
  671. return;
  672. }
  673.  
  674. if (ableToDirectJoin() || setting.oneKeyJoin) {
  675. setting.oneKeyJoin = true;
  676. ompsEventRouter("create");
  677. } else if (setting.autoJoin && setting.userId && setting.group) {
  678. ompsEventRouter("create");
  679. } else
  680. showToast(msgMaker.joinAsk(), 20, 1);
  681. }
  682. var getVideosNextIframeList;
  683. //获取视频
  684. function testVideo() {
  685. if (globalCount <= 0) {
  686. return;
  687. }
  688. globalCount--;
  689. try {
  690. document.body.setAttribute("data-omps-injected", "true");
  691. video = null
  692. var videos = document.getElementsByTagName("video");
  693. for (let i = 0; i < videos.length; i++) {
  694. var v = videos[i];
  695. if (!video && document.body.offsetWidth < v.offsetWidth * 3) {
  696. video = v;
  697. break;
  698. }
  699. }
  700. if (getVideosNextIframeList) {
  701. for (let i = 0; i < getVideosNextIframeList.length; i++) {
  702. try {
  703. var frameBody = getVideosNextIframeList[i].contentDocument.body;
  704. if (frameBody.getAttribute("data-omps-injected") == "true") continue;
  705. if (frameBody.getAttribute("data-omps-injected") != "waitParent") {
  706. frameBody.setAttribute("data-omps-injected", "waitParent");
  707. globalCount++;
  708. continue;
  709. }
  710. getVideosNextIframeList[i].contentWindow.ompsEventRouter = ompsEventRouter;
  711. var videos = getVideosNextIframeList[i].contentDocument.getElementsByTagName("video");
  712. for (let i = 0; i < videos.length; i++) {
  713. var v = videos[i];
  714. if (!video && frameBody.offsetWidth < v.offsetWidth * 3) {
  715. video = v;
  716. break;
  717. }
  718. }
  719. } catch (e) { };
  720. }
  721. }
  722. getVideosNextIframeList = document.getElementsByTagName("iframe");
  723. } catch (e) {
  724. video = null;
  725. }
  726. if (video) {
  727. calcVideoCode(video, showTip);
  728. } else if (globalCount > 0)
  729. setTimeout(testVideo, 5000);
  730. }
  731. //连接网络
  732. function initNetwork() {
  733. videoTitle = topTitle;
  734. videoUrl = topUrl;
  735.  
  736. if (trustKey == "none") {
  737. trustKey = HASH.md5(Date.now() + "--" + parseInt(Math.random() * 1000000));
  738. GM_set("trust", trustKey);
  739. }
  740. if (ws) {
  741. try { ws.onclose = ws.onerror = () => { }; } catch (e) { }
  742. try { ws.close(); } catch (e) { }
  743. }
  744. ws = new WebSocket(URL);
  745. ws.onmessage = wsMsg;
  746. ws.onopen = () => setTimeout(() => {
  747. sendDat({
  748. type: "reg",
  749. user: setting.userId,
  750. group: videoCode + "-" + setting.group,
  751. trust: trustKey,
  752. title: videoTitle,
  753. url: videoUrl
  754. });
  755. }, 1000);
  756. ws.onclose = ws.onerror = () => {
  757. errConnBreak = true;
  758. if (errConnBreak_tryCnt > 5) showToast(msgMaker.error("E_ERR_NET", false), -1, 10);
  759. else showToast(msgMaker.error("E_ERR_NET", parseInt(errConnBreak_reconn / 5)), -1, 10);
  760. }
  761. }
  762. //==========加入流程===========
  763.  
  764.  
  765. //=========前端暴露函数=============
  766. var ompsEventRouter = GM_window.ompsEventRouter = function (name, event) {
  767. if (name == "config") {
  768. openSettingPanel();
  769. } else if (name == "create") {
  770. hideToast();
  771. if (setting.group && setting.userId) initNetwork();
  772. else openSettingPanel();
  773. } else if (name == "call") {
  774. sendDat({
  775. type: "call",
  776. time: video.currentTime * 1000 + localDelay
  777. });
  778. } else if (name == "sync") {
  779. sendDat({
  780. type: "sync"
  781. });
  782. } else if (name == "hide") {
  783. hideToast();
  784. } else if (name == "saveExit") {
  785. saveSettings();
  786. closeSettingPanel();
  787. } else if (name == "saveLink") {
  788. saveSettings();
  789. if (setting.group && setting.userId) {
  790. hideToast();
  791. initNetwork();
  792. closeSettingPanel();
  793. }
  794. } else if (name == "sendMsg") {
  795. sendMsg();
  796. } else if (name == "share") {
  797. createShare();
  798. } else if (name == "jump") {
  799. if (isTopWindow) {
  800. if (confirm(lang.jumpConfirm[0] + GM_window.atob(event.currentTarget.getAttribute('data-url')) + '\n' + lang.jumpConfirm[1])) {
  801. GM_window.location = GM_window.atob(event.currentTarget.getAttribute('data-url'));
  802. }
  803. } else {
  804. GM_window.top.postMessage({ fromApp: "OMPS", action: "jumpUrl", url: window.atob(event.currentTarget.getAttribute('data-url')) }, '*');
  805. }
  806. }
  807. }
  808. var noPop = GM_window.omps_noPop = function (event) {
  809. event.stopPropagation();
  810. }
  811.  
  812. //=========好友列表================
  813. var friends = {}, friendCountTick = 0, friCtr;
  814. function jumpToFriend(event) {
  815. noPop(event);
  816. var friid = event.currentTarget.getAttribute("data-friend-name");
  817. if (friends[friid].tick != friendCountTick) return;
  818. video.currentTime = (friends[friid].time - friends[setting.userId].time + lastTime) / 1000;
  819. }
  820. function addFriendItem(name) {
  821. var el = document.createElement("div");
  822. friCtr.appendChild(el);
  823. el.setAttribute("data-friend-name", name);
  824. el.onclick = jumpToFriend;
  825. friends[name] = {
  826. tick: friendCountTick,
  827. element: el,
  828. time: 0
  829. }
  830. }
  831. function removeFriendItem(name) {
  832. friCtr.removeChild(friends[name].element);
  833. delete friends[name];
  834. }
  835. function updateFriendList(list) {
  836. if (!friCtr) {
  837. friCtr = document.createElement("div");
  838. friCtr.className = "omps-friend"
  839. video.parentNode.appendChild(friCtr);
  840. }
  841. friendCountTick++;
  842. for (let i = 0; i < list.length; i++) {
  843. if (!friends[list[i].name]) addFriendItem(list[i].name);
  844. friends[list[i].name].time = list[i].time;
  845. if (list[i].name == setting.userId)
  846. friends[list[i].name].element.innerText = list[i].name + "(你) ";
  847. else {
  848. var strSig = "";
  849. if (list[i].time > lastTime) {
  850. strSig = "+";
  851. }
  852. friends[list[i].name].element.innerText = list[i].name + "(" + strSig + ((list[i].time - lastTime) / 1000).toFixed(1) + "s) ";
  853. }
  854. friends[list[i].name].tick = friendCountTick;
  855. }
  856. for (const friid in friends) {
  857. if (Object.hasOwnProperty.call(friends, friid)) {
  858. if (friends[friid].tick != friendCountTick) {
  859. friends[friid].element.className = "item offline";
  860. if (friendCountTick - friends[friid].tick > 2) {
  861. removeFriendItem(friid);
  862. }
  863. } else {
  864. friends[friid].element.className = "item";
  865. }
  866. }
  867. }
  868. }
  869.  
  870. //========消息====================
  871. var msgCtr, msgInput;
  872. function addMsgInput() {
  873. var msgInputE = document.createElement("div");
  874. msgInputE.className = "omps-chat-input tipPos";
  875. msgInputE.innerHTML = msgMaker.chat_input();
  876. msgInputE.onclick = noPop;
  877. video.parentNode.appendChild(msgInputE);
  878. msgInput = msgInputE.getElementsByTagName("input")[0];
  879. setTimeout(() => msgInputE.classList.remove("tipPos"), 3000);
  880. }
  881. function createMsg(from, msg, time) {
  882. if (from == setting.userId) time = "你";
  883. else if (time > 0) time = "+" + time + "s";
  884. else time += "s";
  885. createMsgRaw(msgMaker.chat_block(from, msg, time))
  886. }
  887. function createMsgRaw(msg, delTime) {
  888. if (!msgCtr) {
  889. msgCtr = document.createElement("div");
  890. msgCtr.className = "omps-chat";
  891. video.parentNode.appendChild(msgCtr);
  892. }
  893. var el = document.createElement("div")
  894. el.className = "item";
  895. el.innerHTML = msg
  896. msgCtr.appendChild(el);
  897. var hideTime = Math.max(Math.min(8000, msg.length * 400), 3000);
  898. if (delTime) hideTime = delTime;
  899. setTimeout(() => el.className = "item open", 200);
  900. setTimeout(() => el.className = "item", hideTime + 200);
  901. setTimeout(() => msgCtr.removeChild(el), hideTime + 600);
  902. }
  903. function sendMsg() {
  904. var text = msgInput.value;
  905. msgInput.value = "";
  906. if (!text) return;
  907. sendDat({
  908. type: "msg",
  909. time: parseInt(video.currentTime * 1000),
  910. msg: text
  911. })
  912. }
  913. //=======分享URL====================
  914. function createShare() {
  915. if (!topUrl && !isTopWindow) {
  916. createMsg(lang.waitTop[0], lang.waitTop[1], 4000);
  917. return;
  918. }
  919. var url = topUrl + "#&OMPS_room=" + setting.group + "&OMPS_join";
  920. createMsgRaw(msgMaker.share_url(url), 10000);
  921. }
  922. function parseShareHash() {
  923. try {
  924. //一键加入放映厅等功能
  925. var oneKeyCommand = GM_window.location.hash;
  926. if (oneKeyCommand.charAt(0) == "#") oneKeyCommand = oneKeyCommand.slice(1);
  927.  
  928. if (oneKeyCommand) {
  929. LOGGER("[OMPS]:正在处理一键链接参数");
  930. oneKeySetting.exist = true;
  931. var newHashLst = [];
  932. var commandList = oneKeyCommand.split("&");
  933. for (let i = 0; i < commandList.length; i++) {
  934. var cmd = commandList[i].split("=");
  935. if (cmd.length == 2 && cmd[0] == "OMPS_room") {
  936. oneKeySetting.group = cmd[1];
  937. } else if (cmd.length == 1 && cmd[0] == "OMPS_join") {
  938. oneKeySetting.oneKeyJoin = true;
  939. } else {
  940. newHashLst.push(cmd.join("="));
  941. }
  942. }
  943. GM_window.location.hash = newHashLst.join("&");
  944. }
  945. } catch (e) {
  946. LOGGER(`[OMPS][ERROR]:${e}`);
  947. }
  948. applyOneKeySetting();
  949. for (let i = 0; i < frameWindowObjs.length; i++) {
  950. frameWindowObjs[i].postMessage({
  951. fromApp: "OMPS",
  952. action: "onekey",
  953. data: oneKeySetting,
  954. }, "*");
  955. }
  956. }
  957. function applyOneKeySetting() {
  958. if (oneKeySetting.exist) {
  959. if (oneKeySetting.group) setting.group = oneKeySetting.group;
  960. if (oneKeySetting.oneKeyJoin) setting.oneKeyJoin = true;
  961. if (video) {
  962. if (setting.group && setting.userId) { initNetwork(); }
  963. else if (oneKeyJoin) {
  964. openSettingPanel();
  965. }
  966. }
  967. }
  968.  
  969. }
  970. //200ms时钟,用于触发等待点和上报时间
  971. var reportPtns = 0;
  972. setInterval(() => {
  973. reportPtns++;
  974. if (reportPtns == 100) reportPtns = 0;
  975. if (toastCnt > 0) {
  976. if (--toastCnt == 0) {
  977. hideToast();
  978. setTimeout(() => {
  979. if (toastCnt == 0) hideToast(1);
  980. }, 1000);
  981. }
  982. }
  983. if (errConnBreak && errConnBreak_reconn > 0) {
  984. if (errConnBreak_tryCnt > 5) {
  985. errConnBreak_reconn = -1;
  986. }
  987. errConnBreak_reconn--;
  988. if (errConnBreak_reconn == 0) {
  989. errConnBreak_tryCnt++;
  990. errConnBreak = false;
  991. errConnBreak_reconn = errConnBreak_tryCnt * 50 + 10;
  992. ompsEventRouter('create');
  993. showToast(lang.autoReconn, 3);
  994. }
  995. }
  996. if (initFinish) {
  997. timerCount++;
  998. timerCount %= 40;
  999. if (timerCount % 20 == 0) {
  1000. if ((setting.friend || (isPausedShowList && !setting.silent))) {
  1001. sendDat({ type: "list" });
  1002. } else if (friCtr) {
  1003. friCtr.parentNode.removeChild(friCtr);
  1004. friCtr = undefined;
  1005. friends = {};
  1006. friendCountTick = 0;
  1007. }
  1008. }
  1009. if (timerCount == 0) {
  1010. tmpLocalDelay = Date.now();
  1011. sendDat({ type: "delay" });
  1012. }
  1013.  
  1014. var currentTime = parseInt(video.currentTime * 1000);
  1015. if (
  1016. (timerCount % 2 == 0 && currentTime != lastTime)
  1017. ) {
  1018. sendDat({
  1019. type: "ping",
  1020. time: currentTime + localDelay
  1021. });
  1022. lastTime = currentTime;
  1023. }
  1024. if (currentRate != video.playbackRate) {
  1025. setVideoSpeed(video.playbackRate);
  1026. sendDat({
  1027. type: "speed",
  1028. speed: currentRate
  1029. });
  1030. }
  1031. if (pauseAt != -1 && video.currentTime >= pauseAt) {
  1032. video.pause();
  1033. showToast(msgMaker.pauseMsg(pauseUser));
  1034. isPausedShowList = true;
  1035. pauseAt = -1;
  1036. }
  1037. }
  1038. }, 200);
  1039.  
  1040.  
  1041. //WEBSOCKET事件响应
  1042. var wsMsg = (e) => {
  1043. var data = JSON.parse(e.data), time, realTime;
  1044. LOGGER(data);
  1045. if (data.time) {
  1046. time = (data.time + localDelay) / 1000;
  1047. realTime = (data.time) / 1000;
  1048. }
  1049. switch (data.type) {
  1050. case "init":
  1051. errConnBreak = false;
  1052. errConnBreak_tryCnt = 0;
  1053. errConnBreak_reconn = 10;
  1054. if (data.time != 0) {
  1055. initTime = data.time;
  1056. } else initTime = 0;
  1057. localDelay = 0;
  1058. pauseAt = -1;
  1059. tmpLocalDelay = Date.now();
  1060. sendDat({ type: "delay" });
  1061. isPausedShowList = false;
  1062. appendTipLine();
  1063. toastTipLine.style.backgroundColor = "#a5d6a7";
  1064. try {
  1065. video.play();
  1066. hideToast();
  1067. } catch (e) {
  1068. showToast(msgMaker.playFail());
  1069. }
  1070. break;
  1071. case "delay":
  1072. updateDirectJoin();
  1073. localDelay = parseInt((Date.now() - tmpLocalDelay) / 2);
  1074. if (initTime != 0) {
  1075. video.currentTime = (initTime + 3 * localDelay) / 1000;
  1076. initTime = 0;
  1077. }
  1078. if (localDelay > 600) {
  1079. toastTipLine.style.backgroundColor = "#fff59d";
  1080. showToast(msgMaker.delayTip(localDelay), 2);
  1081. }
  1082. if (!initFinish) {
  1083. setTimeout(() => {
  1084. initFinish = true;
  1085. detecVideoCode();
  1086. var delayTime = 5;
  1087. if (setting.autoJoin || setting.oneKeyJoin) delayTime = 12;
  1088. showToast(msgMaker.success(videoCode, localDelay, setting.group), delayTime, 1);
  1089. }, 1000);
  1090. if (setting.showMsgIpt) {
  1091. addMsgInput();
  1092. }
  1093. }
  1094. break;
  1095. case "pause":
  1096. //服务器发送Pause指令
  1097. // 指令包含:
  1098. // 切换时间戳
  1099. toastTipLine.style.backgroundColor = "#ffab91";
  1100. if (video.currentTime >= time) {
  1101. isPausedShowList = true;
  1102. video.pause();
  1103. showToast(msgMaker.pauseMsg(data.foru));
  1104. } else {
  1105. pauseAt = time;
  1106. pauseUser = data.foru;
  1107. if (pauseUser == setting.userId) {
  1108. showToast(msgMaker.pauseFor());
  1109. }
  1110. }
  1111.  
  1112. break;
  1113. case "play":
  1114. //服务器发送Play指令
  1115. pauseAt = -1;
  1116. isPausedShowList = false;
  1117. if (video.currentTime > time) video.currentTime = time;
  1118. setVideoSpeed(baseSpeed);
  1119. toastTipLine.style.backgroundColor = "#a5d6a7";
  1120. try {
  1121. video.play();
  1122. showToast(msgMaker.syncSuccess(), 1);
  1123. } catch (e) {
  1124. showToast(msgMaker.playFail());
  1125. }
  1126. break;
  1127. case "join":
  1128. showToast(msgMaker.playerJoin(data.user), 1);
  1129. break;
  1130. case "unsync":
  1131. toastTipLine.style.backgroundColor = "#ffab91";
  1132. isPausedShowList = true;
  1133. let deltaTime = (time - video.currentTime).toFixed(1);
  1134. if (deltaTime >= 0) deltaTime = "+" + deltaTime;
  1135. if (data.target != setting.userId)
  1136. showToast(msgMaker.unsync(data.target, deltaTime));
  1137. else
  1138. showToast(msgMaker.unsync_top());
  1139. pauseAt = -1;
  1140. break;
  1141. case "sync":
  1142. toastTipLine.style.backgroundColor = "#a5d6a7";
  1143. video.currentTime = (realTime);
  1144. if (data.wait) {
  1145. video.pause();
  1146. }
  1147. pauseAt = -1;
  1148. showToast(msgMaker.syncSuccess(), 1);
  1149. isPausedShowList = false;
  1150. break;
  1151. case "error":
  1152. ws.onerror = ws.onclose = () => { };
  1153. ws.close();
  1154. showToast(msgMaker.error(data.msg), 6, 10);
  1155. isPausedShowList = false;
  1156. break;
  1157. case "list":
  1158. if (setting.friend || (isPausedShowList && !setting.silent)) {
  1159. updateFriendList(data.list);
  1160. }
  1161. break;
  1162. case "msg":
  1163. if (!setting.hideMsg) {
  1164. createMsg(data.name, data.msg, parseFloat(realTime - video.currentTime).toFixed(1));
  1165. }
  1166. break;
  1167. case "userJmp":
  1168. if (data.title && !setting.hideMsg) {
  1169. createMsgRaw(msgMaker.userJump(data.name, data.title, data.url), 10000);
  1170. }
  1171. break;
  1172. case "slow":
  1173. toastTipLine.style.backgroundColor = "#fff59d";
  1174. if (setting.noRateSync) break;
  1175. if (video.currentTime >= time) {
  1176. if (tipSpeed && !setting.silent) {
  1177. showToast(lang.usingSpeedControl, 4);
  1178. tipSpeed = false;
  1179. }
  1180. setVideoSpeed(baseSpeed * 0.95);
  1181. } else {
  1182. setVideoSpeed(baseSpeed);
  1183. }
  1184. break;
  1185. case "noslow":
  1186. toastTipLine.style.backgroundColor = "#a5d6a7";
  1187. setVideoSpeed(baseSpeed);
  1188. break;
  1189. case "speed":
  1190. baseSpeed = data.speed;
  1191. setVideoSpeed(baseSpeed);
  1192. break;
  1193. default:
  1194. break;
  1195. }
  1196. }
  1197. //MD5 JS
  1198. !function (n) { "use strict"; function d(n, t) { var r = (65535 & n) + (65535 & t); return (n >> 16) + (t >> 16) + (r >> 16) << 16 | 65535 & r } function f(n, t, r, e, o, u) { return d((u = d(d(t, n), d(e, u))) << o | u >>> 32 - o, r) } function l(n, t, r, e, o, u, c) { return f(t & r | ~t & e, n, t, o, u, c) } function g(n, t, r, e, o, u, c) { return f(t & e | r & ~e, n, t, o, u, c) } function v(n, t, r, e, o, u, c) { return f(t ^ r ^ e, n, t, o, u, c) } function m(n, t, r, e, o, u, c) { return f(r ^ (t | ~e), n, t, o, u, c) } function c(n, t) { var r, e, o, u; n[t >> 5] |= 128 << t % 32, n[14 + (t + 64 >>> 9 << 4)] = t; for (var c = 1732584193, f = -271733879, i = -1732584194, a = 271733878, h = 0; h < n.length; h += 16)c = l(r = c, e = f, o = i, u = a, n[h], 7, -680876936), a = l(a, c, f, i, n[h + 1], 12, -389564586), i = l(i, a, c, f, n[h + 2], 17, 606105819), f = l(f, i, a, c, n[h + 3], 22, -1044525330), c = l(c, f, i, a, n[h + 4], 7, -176418897), a = l(a, c, f, i, n[h + 5], 12, 1200080426), i = l(i, a, c, f, n[h + 6], 17, -1473231341), f = l(f, i, a, c, n[h + 7], 22, -45705983), c = l(c, f, i, a, n[h + 8], 7, 1770035416), a = l(a, c, f, i, n[h + 9], 12, -1958414417), i = l(i, a, c, f, n[h + 10], 17, -42063), f = l(f, i, a, c, n[h + 11], 22, -1990404162), c = l(c, f, i, a, n[h + 12], 7, 1804603682), a = l(a, c, f, i, n[h + 13], 12, -40341101), i = l(i, a, c, f, n[h + 14], 17, -1502002290), c = g(c, f = l(f, i, a, c, n[h + 15], 22, 1236535329), i, a, n[h + 1], 5, -165796510), a = g(a, c, f, i, n[h + 6], 9, -1069501632), i = g(i, a, c, f, n[h + 11], 14, 643717713), f = g(f, i, a, c, n[h], 20, -373897302), c = g(c, f, i, a, n[h + 5], 5, -701558691), a = g(a, c, f, i, n[h + 10], 9, 38016083), i = g(i, a, c, f, n[h + 15], 14, -660478335), f = g(f, i, a, c, n[h + 4], 20, -405537848), c = g(c, f, i, a, n[h + 9], 5, 568446438), a = g(a, c, f, i, n[h + 14], 9, -1019803690), i = g(i, a, c, f, n[h + 3], 14, -187363961), f = g(f, i, a, c, n[h + 8], 20, 1163531501), c = g(c, f, i, a, n[h + 13], 5, -1444681467), a = g(a, c, f, i, n[h + 2], 9, -51403784), i = g(i, a, c, f, n[h + 7], 14, 1735328473), c = v(c, f = g(f, i, a, c, n[h + 12], 20, -1926607734), i, a, n[h + 5], 4, -378558), a = v(a, c, f, i, n[h + 8], 11, -2022574463), i = v(i, a, c, f, n[h + 11], 16, 1839030562), f = v(f, i, a, c, n[h + 14], 23, -35309556), c = v(c, f, i, a, n[h + 1], 4, -1530992060), a = v(a, c, f, i, n[h + 4], 11, 1272893353), i = v(i, a, c, f, n[h + 7], 16, -155497632), f = v(f, i, a, c, n[h + 10], 23, -1094730640), c = v(c, f, i, a, n[h + 13], 4, 681279174), a = v(a, c, f, i, n[h], 11, -358537222), i = v(i, a, c, f, n[h + 3], 16, -722521979), f = v(f, i, a, c, n[h + 6], 23, 76029189), c = v(c, f, i, a, n[h + 9], 4, -640364487), a = v(a, c, f, i, n[h + 12], 11, -421815835), i = v(i, a, c, f, n[h + 15], 16, 530742520), c = m(c, f = v(f, i, a, c, n[h + 2], 23, -995338651), i, a, n[h], 6, -198630844), a = m(a, c, f, i, n[h + 7], 10, 1126891415), i = m(i, a, c, f, n[h + 14], 15, -1416354905), f = m(f, i, a, c, n[h + 5], 21, -57434055), c = m(c, f, i, a, n[h + 12], 6, 1700485571), a = m(a, c, f, i, n[h + 3], 10, -1894986606), i = m(i, a, c, f, n[h + 10], 15, -1051523), f = m(f, i, a, c, n[h + 1], 21, -2054922799), c = m(c, f, i, a, n[h + 8], 6, 1873313359), a = m(a, c, f, i, n[h + 15], 10, -30611744), i = m(i, a, c, f, n[h + 6], 15, -1560198380), f = m(f, i, a, c, n[h + 13], 21, 1309151649), c = m(c, f, i, a, n[h + 4], 6, -145523070), a = m(a, c, f, i, n[h + 11], 10, -1120210379), i = m(i, a, c, f, n[h + 2], 15, 718787259), f = m(f, i, a, c, n[h + 9], 21, -343485551), c = d(c, r), f = d(f, e), i = d(i, o), a = d(a, u); return [c, f, i, a] } function i(n) { for (var t = "", r = 32 * n.length, e = 0; e < r; e += 8)t += String.fromCharCode(n[e >> 5] >>> e % 32 & 255); return t } function a(n) { var t = []; for (t[(n.length >> 2) - 1] = void 0, e = 0; e < t.length; e += 1)t[e] = 0; for (var r = 8 * n.length, e = 0; e < r; e += 8)t[e >> 5] |= (255 & n.charCodeAt(e / 8)) << e % 32; return t } function e(n) { for (var t, r = "0123456789abcdef", e = "", o = 0; o < n.length; o += 1)t = n.charCodeAt(o), e += r.charAt(t >>> 4 & 15) + r.charAt(15 & t); return e } function r(n) { return unescape(encodeURIComponent(n)) } function o(n) { return i(c(a(n = r(n)), 8 * n.length)) } function u(n, t) { return function (n, t) { var r, e = a(n), o = [], u = []; for (o[15] = u[15] = void 0, 16 < e.length && (e = c(e, 8 * n.length)), r = 0; r < 16; r += 1)o[r] = 909522486 ^ e[r], u[r] = 1549556828 ^ e[r]; return t = c(o.concat(a(t)), 512 + 8 * t.length), i(c(u.concat(t), 640)) }(r(n), r(t)) } function t(n, t, r) { return t ? r ? u(t, n) : e(u(t, n)) : r ? o(n) : e(o(n)) } "function" == typeof define && define.amd ? define(function () { return t }) : "object" == typeof module && module.exports ? module.exports = t : n.md5 = t }(HASH);
  1199. GM_window.onload = () => {
  1200. try {
  1201. document.body.setAttribute("data-omps-injected", "true");
  1202. } catch (e) { }
  1203. }
  1204.  
  1205.  
  1206. registeInPageMessage();
  1207. parseShareHash();
  1208. videoCodeOutdateEventRegist_title();
  1209. testVideo();
  1210. })();