chatango chatbox - xsanime.com

make chatango iframe like messenger chat box - 2/11/2022, 11:41:44 AM

目前為 2022-02-11 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        chatango chatbox - xsanime.com
// @description make chatango iframe like messenger chat box - 2/11/2022, 11:41:44 AM
// @version     1.0.0
// @license     MIT
// @namespace   com.github.codeiter.userscript
// @author      Mohamed Amin Boubaker - https://github.com/CodeIter
// @match       http*://xsanime.com/*
// @match       http*://*.xsanime.com/*
// @noframes
// @run-at      document-end
// @grant       none
// ==/UserScript==

const chatango_iframe_div = document.querySelector('.ChatButton')

const chatango_wrapper = document.createElement('div')
chatango_wrapper.id='chatango-wrapper'
//chatango_wrapper.style['display'] = 'none'
chatango_wrapper.style['right']='1000px'
chatango_iframe_div.parentNode.insertBefore(chatango_wrapper, chatango_iframe_div)
chatango_wrapper.appendChild(chatango_iframe_div)

const chatango_box = document.createElement('div')
chatango_box.id='chatango-box'
chatango_box.style['position'] = 'fixed'
chatango_box.style['bottom'] = '0'
chatango_box.style['left'] = '15px'
chatango_box.style['z-index'] = '9'
chatango_box.style['box-sizing'] = 'border-box'
chatango_wrapper.parentNode.insertBefore(chatango_box, chatango_wrapper)
chatango_box.appendChild(chatango_wrapper)

const chatango_button = document.createElement('button')
chatango_button.id='chatango-button'
chatango_button.style['background-color'] = '#555'
chatango_button.style['color'] = 'white'
chatango_button.style['padding'] = '16px 20px'
chatango_button.style['border'] = 'none'
chatango_button.style['cursor'] = 'pointer'
chatango_button.style['opacity'] = '0.8'
chatango_button.style['width'] = '280px'
chatango_button.innerText = 'Open ChatanGo Box'

chatango_button.addEventListener("click", function() {
  if(chatango_wrapper.style['right']!=='1000px'){
    chatango_wrapper.style['right']='1000px'
    chatango_button.style['background-color'] = '#555'
    chatango_box.style['border'] = 'none'
    chatango_button.innerText = 'Open ChatanGo Box'
  }else{
    chatango_wrapper.style['right']='0'
    chatango_button.style['background-color'] = 'red'
    chatango_box.style['border'] = '3px solid #f1f1f1'
    chatango_button.innerText = 'Close ChatanGo Box'
  }
})
chatango_box.appendChild(chatango_button)