Russian cursive for Translate Google

Allows you to use cursive in Google Translate while using Russian

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Russian cursive for Translate Google
// @version      1.0
// @supportURL   https://github.com/MrMaxie/CursiveForGoogleTranslate
// @source       https://github.com/MrMaxie/CursiveForGoogleTranslate
// @description  Allows you to use cursive in Google Translate while using Russian
// @author       Maxie
// @match        *://*.translate.google.com/*
// @match        *://*.translate.google.ac/*
// @match        *://*.translate.google.ad/*
// @match        *://*.translate.google.ae/*
// @match        *://*.translate.google.af/*
// @match        *://*.translate.google.ag/*
// @match        *://*.translate.google.ai/*
// @match        *://*.translate.google.al/*
// @match        *://*.translate.google.am/*
// @match        *://*.translate.google.ao/*
// @match        *://*.translate.google.ar/*
// @match        *://*.translate.google.as/*
// @match        *://*.translate.google.at/*
// @match        *://*.translate.google.au/*
// @match        *://*.translate.google.az/*
// @match        *://*.translate.google.ba/*
// @match        *://*.translate.google.bd/*
// @match        *://*.translate.google.be/*
// @match        *://*.translate.google.bf/*
// @match        *://*.translate.google.bg/*
// @match        *://*.translate.google.bh/*
// @match        *://*.translate.google.bi/*
// @match        *://*.translate.google.bj/*
// @match        *://*.translate.google.bn/*
// @match        *://*.translate.google.bo/*
// @match        *://*.translate.google.br/*
// @match        *://*.translate.google.bs/*
// @match        *://*.translate.google.bt/*
// @match        *://*.translate.google.bw/*
// @match        *://*.translate.google.by/*
// @match        *://*.translate.google.bz/*
// @match        *://*.translate.google.ca/*
// @match        *://*.translate.google.kh/*
// @match        *://*.translate.google.cc/*
// @match        *://*.translate.google.cd/*
// @match        *://*.translate.google.cf/*
// @match        *://*.translate.google.cat/*
// @match        *://*.translate.google.cg/*
// @match        *://*.translate.google.ch/*
// @match        *://*.translate.google.ci/*
// @match        *://*.translate.google.ck/*
// @match        *://*.translate.google.cl/*
// @match        *://*.translate.google.cm/*
// @match        *://*.translate.google.cn/*
// @match        *://*.translate.google.co/*
// @match        *://*.translate.google.cr/*
// @match        *://*.translate.google.cu/*
// @match        *://*.translate.google.cv/*
// @match        *://*.translate.google.cx/*
// @match        *://*.translate.google.cy/*
// @match        *://*.translate.google.cz/*
// @match        *://*.translate.google.de/*
// @match        *://*.translate.google.dj/*
// @match        *://*.translate.google.dk/*
// @match        *://*.translate.google.dm/*
// @match        *://*.translate.google.do/*
// @match        *://*.translate.google.dz/*
// @match        *://*.translate.google.ec/*
// @match        *://*.translate.google.ee/*
// @match        *://*.translate.google.eg/*
// @match        *://*.translate.google.es/*
// @match        *://*.translate.google.et/*
// @match        *://*.translate.google.eu/*
// @match        *://*.translate.google.fi/*
// @match        *://*.translate.google.fj/*
// @match        *://*.translate.google.fm/*
// @match        *://*.translate.google.fr/*
// @match        *://*.translate.google.ga/*
// @match        *://*.translate.google.ge/*
// @match        *://*.translate.google.gf/*
// @match        *://*.translate.google.gg/*
// @match        *://*.translate.google.gh/*
// @match        *://*.translate.google.gi/*
// @match        *://*.translate.google.gl/*
// @match        *://*.translate.google.gm/*
// @match        *://*.translate.google.gp/*
// @match        *://*.translate.google.gr/*
// @match        *://*.translate.google.gt/*
// @match        *://*.translate.google.gy/*
// @match        *://*.translate.google.hk/*
// @match        *://*.translate.google.hn/*
// @match        *://*.translate.google.hr/*
// @match        *://*.translate.google.ht/*
// @match        *://*.translate.google.hu/*
// @match        *://*.translate.google.id/*
// @match        *://*.translate.google.iq/*
// @match        *://*.translate.google.ie/*
// @match        *://*.translate.google.il/*
// @match        *://*.translate.google.im/*
// @match        *://*.translate.google.in/*
// @match        *://*.translate.google.io/*
// @match        *://*.translate.google.is/*
// @match        *://*.translate.google.it/*
// @match        *://*.translate.google.je/*
// @match        *://*.translate.google.jm/*
// @match        *://*.translate.google.jo/*
// @match        *://*.translate.google.jp/*
// @match        *://*.translate.google.ke/*
// @match        *://*.translate.google.ki/*
// @match        *://*.translate.google.kg/*
// @match        *://*.translate.google.kr/*
// @match        *://*.translate.google.kw/*
// @match        *://*.translate.google.kz/*
// @match        *://*.translate.google.la/*
// @match        *://*.translate.google.lb/*
// @match        *://*.translate.google.lc/*
// @match        *://*.translate.google.li/*
// @match        *://*.translate.google.lk/*
// @match        *://*.translate.google.ls/*
// @match        *://*.translate.google.lt/*
// @match        *://*.translate.google.lu/*
// @match        *://*.translate.google.lv/*
// @match        *://*.translate.google.ly/*
// @match        *://*.translate.google.ma/*
// @match        *://*.translate.google.md/*
// @match        *://*.translate.google.me/*
// @match        *://*.translate.google.mg/*
// @match        *://*.translate.google.mk/*
// @match        *://*.translate.google.ml/*
// @match        *://*.translate.google.mm/*
// @match        *://*.translate.google.mn/*
// @match        *://*.translate.google.ms/*
// @match        *://*.translate.google.mt/*
// @match        *://*.translate.google.mu/*
// @match        *://*.translate.google.mv/*
// @match        *://*.translate.google.mw/*
// @match        *://*.translate.google.mx/*
// @match        *://*.translate.google.my/*
// @match        *://*.translate.google.mz/*
// @match        *://*.translate.google.na/*
// @match        *://*.translate.google.ne/*
// @match        *://*.translate.google.nf/*
// @match        *://*.translate.google.ng/*
// @match        *://*.translate.google.ni/*
// @match        *://*.translate.google.nl/*
// @match        *://*.translate.google.no/*
// @match        *://*.translate.google.np/*
// @match        *://*.translate.google.nr/*
// @match        *://*.translate.google.nu/*
// @match        *://*.translate.google.nz/*
// @match        *://*.translate.google.om/*
// @match        *://*.translate.google.pk/*
// @match        *://*.translate.google.pa/*
// @match        *://*.translate.google.pe/*
// @match        *://*.translate.google.ph/*
// @match        *://*.translate.google.pl/*
// @match        *://*.translate.google.pg/*
// @match        *://*.translate.google.pn/*
// @match        *://*.translate.google.pr/*
// @match        *://*.translate.google.ps/*
// @match        *://*.translate.google.pt/*
// @match        *://*.translate.google.py/*
// @match        *://*.translate.google.qa/*
// @match        *://*.translate.google.ro/*
// @match        *://*.translate.google.rs/*
// @match        *://*.translate.google.ru/*
// @match        *://*.translate.google.rw/*
// @match        *://*.translate.google.sa/*
// @match        *://*.translate.google.sb/*
// @match        *://*.translate.google.sc/*
// @match        *://*.translate.google.se/*
// @match        *://*.translate.google.sg/*
// @match        *://*.translate.google.sh/*
// @match        *://*.translate.google.si/*
// @match        *://*.translate.google.sk/*
// @match        *://*.translate.google.sl/*
// @match        *://*.translate.google.sn/*
// @match        *://*.translate.google.sm/*
// @match        *://*.translate.google.so/*
// @match        *://*.translate.google.st/*
// @match        *://*.translate.google.sr/*
// @match        *://*.translate.google.sv/*
// @match        *://*.translate.google.td/*
// @match        *://*.translate.google.tg/*
// @match        *://*.translate.google.th/*
// @match        *://*.translate.google.tj/*
// @match        *://*.translate.google.tk/*
// @match        *://*.translate.google.tl/*
// @match        *://*.translate.google.tm/*
// @match        *://*.translate.google.to/*
// @match        *://*.translate.google.tn/*
// @match        *://*.translate.google.tr/*
// @match        *://*.translate.google.tt/*
// @match        *://*.translate.google.tw/*
// @match        *://*.translate.google.tz/*
// @match        *://*.translate.google.ua/*
// @match        *://*.translate.google.ug/*
// @match        *://*.translate.google.uk/*
// @match        *://*.translate.google.us/*
// @match        *://*.translate.google.uy/*
// @match        *://*.translate.google.uz/*
// @match        *://*.translate.google.vc/*
// @match        *://*.translate.google.ve/*
// @match        *://*.translate.google.vg/*
// @match        *://*.translate.google.vi/*
// @match        *://*.translate.google.vn/*
// @match        *://*.translate.google.vu/*
// @match        *://*.translate.google.ws/*
// @match        *://*.translate.google.za/*
// @match        *://*.translate.google.zm/*
// @match        *://*.translate.google.zw/*
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
// @namespace https://greasyfork.org/users/120551
// ==/UserScript==

// Font
var rctg_fontFamily = '"Marck Script", cursive';
var rctg_fontCssUrl = 'https://fonts.googleapis.com/css?family=Marck+Script';

// Styling
GM_addStyle(
'#cursive-toggler {' +
'	font-family: inherit;' +
'	font-size: 11px;' +
'	font-weight: bold;' +
'	margin-left: 5px;' +
'	padding: 0 8px;' +
'	min-width: 54px;' +
'	height: 31px;' +
'	margin-top: -1px;' +
'	border: 1px solid #dcdcdc;' +
'	-webkit-border-radius: 2px;' +
'	-moz-border-radius: 2px;' +
'	border-radius: 2px;' +
'	text-align: center;' +
'	background-color: #f5f5f5;' +
'	background-image: -webkit-linear-gradient(top,#f5f5f5,#f1f1f1);' +
'	background-image: -moz-linear-gradient(top,#f5f5f5,#f1f1f1);' +
'	background-image: -ms-linear-gradient(top,#f5f5f5,#f1f1f1);' +
'	background-image: -o-linear-gradient(top,#f5f5f5,#f1f1f1);' +
'	background-image: linear-gradient(top,#f5f5f5,#f1f1f1);' +
'	color: #444;' +
'	outline: none;' +
'}' +
'#cursive-toggler:hover {' +
'	background-color: #F8F8F8;' +
'	background-image: -webkit-linear-gradient(top,#f8f8f8,#f1f1f1);' +
'	background-image: -moz-linear-gradient(top,#f8f8f8,#f1f1f1);' +
'	background-image: -ms-linear-gradient(top,#f8f8f8,#f1f1f1);' +
'	background-image: -o-linear-gradient(top,#f8f8f8,#f1f1f1);' +
'	background-image: linear-gradient(top,#f8f8f8,#f1f1f1);' +
'	border: 1px solid #C6C6C6;' +
'	color: #333;' +
'	-webkit-box-shadow: 0px 1px 1px rgba(0,0,0,.1);' +
'	-moz-box-shadow: 0px 1px 1px rgba(0,0,0,.1);' +
'	box-shadow: 0px 1px 1px rgba(0,0,0,.1);' +
'}' +
'#cursive-toggler:active {' +
'	-webkit-box-shadow: inset 0px 1px 2px rgba(0,0,0,.1);' +
'	-moz-box-shadow: inset 0px 1px 2px rgba(0,0,0,.1);' +
'	box-shadow: inset 0px 1px 2px rgba(0,0,0,.1);' +
'}' +
'#cursive-toggler.enabled {' +
'	background-color: #D14836;' +
'	background-image: -webkit-linear-gradient(top,#dd4b39,#d14836);' +
'	background-image: -moz-linear-gradient(top,#dd4b39,#d14836);' +
'	background-image: -ms-linear-gradient(top,#dd4b39,#d14836);' +
'	background-image: -o-linear-gradient(top,#dd4b39,#d14836);' +
'	background-image: linear-gradient(top,#dd4b39,#d14836);' +
'	border: 1px solid transparent;' +
'	color: white;' +
'	text-shadow: 0 1px rgba(0, 0, 0, 0.1);' +
'}' +
'#cursive-toggler.enabled:hover {' +
'	background-color: #C53727;' +
'	background-image: -webkit-linear-gradient(top,#dd4b39,#c53727);' +
'	background-image: -moz-linear-gradient(top,#dd4b39,#c53727);' +
'	background-image: -ms-linear-gradient(top,#dd4b39,#c53727);' +
'	background-image: -o-linear-gradient(top,#dd4b39,#c53727);' +
'	background-image: linear-gradient(top,#dd4b39,#c53727);' +
'}' +
'#result_box[lang=ru].cursive {' +
'	font-family: '+rctg_fontFamily+' !important;' +
'}' +
'#result_box[lang=ru].cursive {' +
'	font-size: 35px !important;' +
'}' +
'#result_box[lang=ru].cursive.short_text {' +
'	font-size: 45px !important;' +
'}');

// Inject cursive font
$('<link>')
.attr('rel', 'stylesheet')
.attr('href', rctg_fontCssUrl)
.appendTo('head');

(function() {
	'use strict';

	// Add button to toggle cursive
	$('<button>')
	.attr('id', 'cursive-toggler')
	.attr('type', 'button')
	.appendTo('#gt-lang-right');

	/**
	 * Change state of button
	 * @param {boolean} arg
	 */
	function setAsEnabled(arg){
		var btn = $('#cursive-toggler');
		var txt = $('#result_box');
		if(arg){
			btn.addClass('enabled')
			.text('Disable cursive');
			txt.addClass('cursive');
			GM_setValue('rctg_cursiveToggler', true);
		}else{
			btn.removeClass('enabled')
			.text('Enable cursive');
			txt.removeClass('cursive');
			GM_setValue('rctg_cursiveToggler', false);
		}
	}

	// Prepare button
	setAsEnabled(GM_getValue('rctg_cursiveToggler', false));

	// Handle clicking of button
	$('#cursive-toggler').click(function(){
		setAsEnabled(!GM_getValue('rctg_cursiveToggler', false));
	});
})();