Беер.рф - чат

Чат

目前為 2020-09-17 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Беер.рф - чат
// @namespace    https://беер.рф/
// @version      0.1
// @description  Чат
// @match        http*://xn--90aia8b.xn--p1ai/forum/*
// @grant        none
// ==/UserScript==

var str = '<style>'
                + 'div#TopChat { position:fixed; margin:0; padding:0; top:10px; left: 5px;'
                             + ' max-width:450px; min-width:200px; width: 14%; height: 15%;'
                             + ' border: 1px'
                + ' }'
        + '</style>'
        + '<div id="TopChat"><div>',

run = function() {
    $( 'div#TopChat table.chatik tbody tr td.gTableTop' ).prepend( '<div id="MoveChat" style=" position:absolute; width:55%; height: 50px; cursor:pointer" title="Переместить">&nbsp;</div>' );

    $( 'div#MoveChat' ).click(function(){
        $('div#TopChat').draggable();
    }).mouseup( function(){
        $('div#TopChat').offset(function(i,val){
            localStorage.setItem('ChatTop',  val.top+'px');
            localStorage.setItem('ChatLeft', val.left+'px');
        });
    });

//----------------------------------------------------------
    if( localStorage.getItem('ChatTop') != null ) {
        $( 'div#TopChat' ).css({
            top:  localStorage.getItem('ChatTop'),
//            left: localStorage.getItem('ChatLeft'),
//            left: localStorage.getItem('ChatLeft'),
            left: localStorage.getItem('ChatLeft')
        });
    }

//    $( "#div#TopChat" ).resizable();
};

if(window.top == window)
{
    $('head').append( '<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>' );
    $('body').append( str );
    $("table.chatik").remove().clone().appendTo('#TopChat');
    $( '<script/>', { text: '(' + run.toString() + ')()' } ).appendTo('head');
}