chatango chatbox - xsanime.com

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

当前为 2022-02-11 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 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)