NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @namespace linuxmint.com.ru_improvements
// @name linuxmint.com.ru improvements
// @description Adding chat button to top panel
// @version 0.0.7
// @license GPL-2.0-only
// @author FreeStyler
// @copyright 2018, FreeStyler (https://openuserjs.org//users/FreeStyler)
// @supportURL mailto:zanygamer@gmail.com
// @include *linuxmint.com.ru/*
// @match *linuxmint.com.ru/*
// @updateURL https://openuserjs.org/meta/FreeStyler/linuxmint.com.ru_improvements.meta.js
// @downloadURL https://openuserjs.org/install/FreeStyler/linuxmint.com.ru_improvements.user.js
// @grant none
// @run-at document-end
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @require file:///home/alex/0Mega/MyProjects/UserScripts/lmru_improvements/linuxmint.com.ru_improvements.user.js
// ==/UserScript==
(function ($, undefined){
$(function(){
'use strict';
var
cl = console.log,
isset = function (e){ return typeof e == 'undefined' ? false : true;},
LANG = navigator.language,
chat_setted = false,
$chat,
endvar;
//if(LANG == 'en-US') LANG = 'en';
LANG = 'en';
if(LANG == 'ru-RU') LANG = 'ru';
function add_styles(){
var styles = `
<style>
.csmile {
max-width:32px;
}
</style>
`;
$('body').append(styles);
}
function setChat(){
let $chat = $('#chat-body');
if(!$chat.length) return;
$chat.hide().appendTo($('body')).css({position: 'fixed', left: 0, top: 0, zIndex: 99});
$('.headerbar-menu').append(`
<li title='Показать/Скрыть чат' id=chat_show class="av-big-icon-only av-always-visible"><a href="#" role="chat_show" class="chad"><i class="zmdi zmdi-comment-more"></i></a></li>
`);
//https://linuxmint.com.ru/app.php/chat
$('#chat_show').on('click', function(){
if($chat.css('display') === 'none')
$chat.fadeIn();
else
$chat.fadeOut();
});
$('.ic-input').append('<a did=hide_chat href="#" class="chat-button ic-small" title="Скрыть чат"><i class="zmdi zmdi-triangle-down"></i></a>');
$('.ic-input').append('<a did=to_chat href="#" class="chat-button ic-small" title="На страницу чата" style="position: relative; left: -22px; top: 26px; transform: rotate(-90deg);"><i class="zmdi zmdi-triangle-down"></i></a>');
$('a[did=hide_chat]').on('click', ()=>{
$chat.fadeOut();
});
$('a[did=to_chat]').on('click', ()=>{
location.href = 'https://linuxmint.com.ru/app.php/chat';
});
}
//<img src="./images/smilies/blink.gif" alt=":blink2:" title="Моргаю" tiney="true" width="20" height="20">
if(!/chat\?mode=archive/.test(location.href)) setChat();
add_styles();
//[img]https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/whatsapp/186/expressionless-face_1f611.png[/img]
//('#smiley-boxr').prepend('<img class=csmile src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/whatsapp/186/expressionless-face_1f611.png"/>'); //http://kolobok.us/smiles/remake/wink.gif
$('#smiley-box').append(`
<img class=csmile src="https://emojipedia-us.s3.dualstack.us-west-1.amazonaws.com/thumbs/120/whatsapp/186/expressionless-face_1f611.png"/>
<a href="#" onclick="insert_text(':scratch:', true); return false;"><img src="./images/smilies/scratch_one-s_head.gif" alt=":scratch:" title="Почеесываю" width="27" height="24"></a>
<a href="#" onclick="insert_text(':sry:', true); return false;"><img src="./images/smilies/pardon.gif" alt=":sry:" title="Пардон" width="27" height="24"></a>
<img class=csmile src="https://demiart.ru/forum/html/emoticons/wink.gif"/>
`); // <a href="#" onclick="initInsertions(); insert_text(':sry:', true, true); return false;"><img src="./images/smilies/pardon.gif" alt=":sry:" title="Пардон" width="36" height="26"></a>
//<a href="#" onclick="initInsertions(); insert_text(':scratch:', true, true); return false;"><img src="./images/smilies/scratch_one-s_head.gif" alt=":scratch:" title="Почеесываю" width="27" height="24"></a>
$('.csmile').on('click', function(){
insert_text('[img]'+ this.src + '[/img]', true); return false;
});
});
})(window.jQuery.noConflict(true));