Russian cursive for Translate Google

Allows you to use cursive in Google Translate while using Russian

  1. // ==UserScript==
  2. // @name Russian cursive for Translate Google
  3. // @version 1.0
  4. // @supportURL https://github.com/MrMaxie/CursiveForGoogleTranslate
  5. // @source https://github.com/MrMaxie/CursiveForGoogleTranslate
  6. // @description Allows you to use cursive in Google Translate while using Russian
  7. // @author Maxie
  8. // @match *://*.translate.google.com/*
  9. // @match *://*.translate.google.ac/*
  10. // @match *://*.translate.google.ad/*
  11. // @match *://*.translate.google.ae/*
  12. // @match *://*.translate.google.af/*
  13. // @match *://*.translate.google.ag/*
  14. // @match *://*.translate.google.ai/*
  15. // @match *://*.translate.google.al/*
  16. // @match *://*.translate.google.am/*
  17. // @match *://*.translate.google.ao/*
  18. // @match *://*.translate.google.ar/*
  19. // @match *://*.translate.google.as/*
  20. // @match *://*.translate.google.at/*
  21. // @match *://*.translate.google.au/*
  22. // @match *://*.translate.google.az/*
  23. // @match *://*.translate.google.ba/*
  24. // @match *://*.translate.google.bd/*
  25. // @match *://*.translate.google.be/*
  26. // @match *://*.translate.google.bf/*
  27. // @match *://*.translate.google.bg/*
  28. // @match *://*.translate.google.bh/*
  29. // @match *://*.translate.google.bi/*
  30. // @match *://*.translate.google.bj/*
  31. // @match *://*.translate.google.bn/*
  32. // @match *://*.translate.google.bo/*
  33. // @match *://*.translate.google.br/*
  34. // @match *://*.translate.google.bs/*
  35. // @match *://*.translate.google.bt/*
  36. // @match *://*.translate.google.bw/*
  37. // @match *://*.translate.google.by/*
  38. // @match *://*.translate.google.bz/*
  39. // @match *://*.translate.google.ca/*
  40. // @match *://*.translate.google.kh/*
  41. // @match *://*.translate.google.cc/*
  42. // @match *://*.translate.google.cd/*
  43. // @match *://*.translate.google.cf/*
  44. // @match *://*.translate.google.cat/*
  45. // @match *://*.translate.google.cg/*
  46. // @match *://*.translate.google.ch/*
  47. // @match *://*.translate.google.ci/*
  48. // @match *://*.translate.google.ck/*
  49. // @match *://*.translate.google.cl/*
  50. // @match *://*.translate.google.cm/*
  51. // @match *://*.translate.google.cn/*
  52. // @match *://*.translate.google.co/*
  53. // @match *://*.translate.google.cr/*
  54. // @match *://*.translate.google.cu/*
  55. // @match *://*.translate.google.cv/*
  56. // @match *://*.translate.google.cx/*
  57. // @match *://*.translate.google.cy/*
  58. // @match *://*.translate.google.cz/*
  59. // @match *://*.translate.google.de/*
  60. // @match *://*.translate.google.dj/*
  61. // @match *://*.translate.google.dk/*
  62. // @match *://*.translate.google.dm/*
  63. // @match *://*.translate.google.do/*
  64. // @match *://*.translate.google.dz/*
  65. // @match *://*.translate.google.ec/*
  66. // @match *://*.translate.google.ee/*
  67. // @match *://*.translate.google.eg/*
  68. // @match *://*.translate.google.es/*
  69. // @match *://*.translate.google.et/*
  70. // @match *://*.translate.google.eu/*
  71. // @match *://*.translate.google.fi/*
  72. // @match *://*.translate.google.fj/*
  73. // @match *://*.translate.google.fm/*
  74. // @match *://*.translate.google.fr/*
  75. // @match *://*.translate.google.ga/*
  76. // @match *://*.translate.google.ge/*
  77. // @match *://*.translate.google.gf/*
  78. // @match *://*.translate.google.gg/*
  79. // @match *://*.translate.google.gh/*
  80. // @match *://*.translate.google.gi/*
  81. // @match *://*.translate.google.gl/*
  82. // @match *://*.translate.google.gm/*
  83. // @match *://*.translate.google.gp/*
  84. // @match *://*.translate.google.gr/*
  85. // @match *://*.translate.google.gt/*
  86. // @match *://*.translate.google.gy/*
  87. // @match *://*.translate.google.hk/*
  88. // @match *://*.translate.google.hn/*
  89. // @match *://*.translate.google.hr/*
  90. // @match *://*.translate.google.ht/*
  91. // @match *://*.translate.google.hu/*
  92. // @match *://*.translate.google.id/*
  93. // @match *://*.translate.google.iq/*
  94. // @match *://*.translate.google.ie/*
  95. // @match *://*.translate.google.il/*
  96. // @match *://*.translate.google.im/*
  97. // @match *://*.translate.google.in/*
  98. // @match *://*.translate.google.io/*
  99. // @match *://*.translate.google.is/*
  100. // @match *://*.translate.google.it/*
  101. // @match *://*.translate.google.je/*
  102. // @match *://*.translate.google.jm/*
  103. // @match *://*.translate.google.jo/*
  104. // @match *://*.translate.google.jp/*
  105. // @match *://*.translate.google.ke/*
  106. // @match *://*.translate.google.ki/*
  107. // @match *://*.translate.google.kg/*
  108. // @match *://*.translate.google.kr/*
  109. // @match *://*.translate.google.kw/*
  110. // @match *://*.translate.google.kz/*
  111. // @match *://*.translate.google.la/*
  112. // @match *://*.translate.google.lb/*
  113. // @match *://*.translate.google.lc/*
  114. // @match *://*.translate.google.li/*
  115. // @match *://*.translate.google.lk/*
  116. // @match *://*.translate.google.ls/*
  117. // @match *://*.translate.google.lt/*
  118. // @match *://*.translate.google.lu/*
  119. // @match *://*.translate.google.lv/*
  120. // @match *://*.translate.google.ly/*
  121. // @match *://*.translate.google.ma/*
  122. // @match *://*.translate.google.md/*
  123. // @match *://*.translate.google.me/*
  124. // @match *://*.translate.google.mg/*
  125. // @match *://*.translate.google.mk/*
  126. // @match *://*.translate.google.ml/*
  127. // @match *://*.translate.google.mm/*
  128. // @match *://*.translate.google.mn/*
  129. // @match *://*.translate.google.ms/*
  130. // @match *://*.translate.google.mt/*
  131. // @match *://*.translate.google.mu/*
  132. // @match *://*.translate.google.mv/*
  133. // @match *://*.translate.google.mw/*
  134. // @match *://*.translate.google.mx/*
  135. // @match *://*.translate.google.my/*
  136. // @match *://*.translate.google.mz/*
  137. // @match *://*.translate.google.na/*
  138. // @match *://*.translate.google.ne/*
  139. // @match *://*.translate.google.nf/*
  140. // @match *://*.translate.google.ng/*
  141. // @match *://*.translate.google.ni/*
  142. // @match *://*.translate.google.nl/*
  143. // @match *://*.translate.google.no/*
  144. // @match *://*.translate.google.np/*
  145. // @match *://*.translate.google.nr/*
  146. // @match *://*.translate.google.nu/*
  147. // @match *://*.translate.google.nz/*
  148. // @match *://*.translate.google.om/*
  149. // @match *://*.translate.google.pk/*
  150. // @match *://*.translate.google.pa/*
  151. // @match *://*.translate.google.pe/*
  152. // @match *://*.translate.google.ph/*
  153. // @match *://*.translate.google.pl/*
  154. // @match *://*.translate.google.pg/*
  155. // @match *://*.translate.google.pn/*
  156. // @match *://*.translate.google.pr/*
  157. // @match *://*.translate.google.ps/*
  158. // @match *://*.translate.google.pt/*
  159. // @match *://*.translate.google.py/*
  160. // @match *://*.translate.google.qa/*
  161. // @match *://*.translate.google.ro/*
  162. // @match *://*.translate.google.rs/*
  163. // @match *://*.translate.google.ru/*
  164. // @match *://*.translate.google.rw/*
  165. // @match *://*.translate.google.sa/*
  166. // @match *://*.translate.google.sb/*
  167. // @match *://*.translate.google.sc/*
  168. // @match *://*.translate.google.se/*
  169. // @match *://*.translate.google.sg/*
  170. // @match *://*.translate.google.sh/*
  171. // @match *://*.translate.google.si/*
  172. // @match *://*.translate.google.sk/*
  173. // @match *://*.translate.google.sl/*
  174. // @match *://*.translate.google.sn/*
  175. // @match *://*.translate.google.sm/*
  176. // @match *://*.translate.google.so/*
  177. // @match *://*.translate.google.st/*
  178. // @match *://*.translate.google.sr/*
  179. // @match *://*.translate.google.sv/*
  180. // @match *://*.translate.google.td/*
  181. // @match *://*.translate.google.tg/*
  182. // @match *://*.translate.google.th/*
  183. // @match *://*.translate.google.tj/*
  184. // @match *://*.translate.google.tk/*
  185. // @match *://*.translate.google.tl/*
  186. // @match *://*.translate.google.tm/*
  187. // @match *://*.translate.google.to/*
  188. // @match *://*.translate.google.tn/*
  189. // @match *://*.translate.google.tr/*
  190. // @match *://*.translate.google.tt/*
  191. // @match *://*.translate.google.tw/*
  192. // @match *://*.translate.google.tz/*
  193. // @match *://*.translate.google.ua/*
  194. // @match *://*.translate.google.ug/*
  195. // @match *://*.translate.google.uk/*
  196. // @match *://*.translate.google.us/*
  197. // @match *://*.translate.google.uy/*
  198. // @match *://*.translate.google.uz/*
  199. // @match *://*.translate.google.vc/*
  200. // @match *://*.translate.google.ve/*
  201. // @match *://*.translate.google.vg/*
  202. // @match *://*.translate.google.vi/*
  203. // @match *://*.translate.google.vn/*
  204. // @match *://*.translate.google.vu/*
  205. // @match *://*.translate.google.ws/*
  206. // @match *://*.translate.google.za/*
  207. // @match *://*.translate.google.zm/*
  208. // @match *://*.translate.google.zw/*
  209. // @grant GM_addStyle
  210. // @grant GM_setValue
  211. // @grant GM_getValue
  212. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
  213. // @namespace https://greasyfork.org/users/120551
  214. // ==/UserScript==
  215.  
  216. // Font
  217. var rctg_fontFamily = '"Marck Script", cursive';
  218. var rctg_fontCssUrl = 'https://fonts.googleapis.com/css?family=Marck+Script';
  219.  
  220. // Styling
  221. GM_addStyle(
  222. '#cursive-toggler {' +
  223. ' font-family: inherit;' +
  224. ' font-size: 11px;' +
  225. ' font-weight: bold;' +
  226. ' margin-left: 5px;' +
  227. ' padding: 0 8px;' +
  228. ' min-width: 54px;' +
  229. ' height: 31px;' +
  230. ' margin-top: -1px;' +
  231. ' border: 1px solid #dcdcdc;' +
  232. ' -webkit-border-radius: 2px;' +
  233. ' -moz-border-radius: 2px;' +
  234. ' border-radius: 2px;' +
  235. ' text-align: center;' +
  236. ' background-color: #f5f5f5;' +
  237. ' background-image: -webkit-linear-gradient(top,#f5f5f5,#f1f1f1);' +
  238. ' background-image: -moz-linear-gradient(top,#f5f5f5,#f1f1f1);' +
  239. ' background-image: -ms-linear-gradient(top,#f5f5f5,#f1f1f1);' +
  240. ' background-image: -o-linear-gradient(top,#f5f5f5,#f1f1f1);' +
  241. ' background-image: linear-gradient(top,#f5f5f5,#f1f1f1);' +
  242. ' color: #444;' +
  243. ' outline: none;' +
  244. '}' +
  245. '#cursive-toggler:hover {' +
  246. ' background-color: #F8F8F8;' +
  247. ' background-image: -webkit-linear-gradient(top,#f8f8f8,#f1f1f1);' +
  248. ' background-image: -moz-linear-gradient(top,#f8f8f8,#f1f1f1);' +
  249. ' background-image: -ms-linear-gradient(top,#f8f8f8,#f1f1f1);' +
  250. ' background-image: -o-linear-gradient(top,#f8f8f8,#f1f1f1);' +
  251. ' background-image: linear-gradient(top,#f8f8f8,#f1f1f1);' +
  252. ' border: 1px solid #C6C6C6;' +
  253. ' color: #333;' +
  254. ' -webkit-box-shadow: 0px 1px 1px rgba(0,0,0,.1);' +
  255. ' -moz-box-shadow: 0px 1px 1px rgba(0,0,0,.1);' +
  256. ' box-shadow: 0px 1px 1px rgba(0,0,0,.1);' +
  257. '}' +
  258. '#cursive-toggler:active {' +
  259. ' -webkit-box-shadow: inset 0px 1px 2px rgba(0,0,0,.1);' +
  260. ' -moz-box-shadow: inset 0px 1px 2px rgba(0,0,0,.1);' +
  261. ' box-shadow: inset 0px 1px 2px rgba(0,0,0,.1);' +
  262. '}' +
  263. '#cursive-toggler.enabled {' +
  264. ' background-color: #D14836;' +
  265. ' background-image: -webkit-linear-gradient(top,#dd4b39,#d14836);' +
  266. ' background-image: -moz-linear-gradient(top,#dd4b39,#d14836);' +
  267. ' background-image: -ms-linear-gradient(top,#dd4b39,#d14836);' +
  268. ' background-image: -o-linear-gradient(top,#dd4b39,#d14836);' +
  269. ' background-image: linear-gradient(top,#dd4b39,#d14836);' +
  270. ' border: 1px solid transparent;' +
  271. ' color: white;' +
  272. ' text-shadow: 0 1px rgba(0, 0, 0, 0.1);' +
  273. '}' +
  274. '#cursive-toggler.enabled:hover {' +
  275. ' background-color: #C53727;' +
  276. ' background-image: -webkit-linear-gradient(top,#dd4b39,#c53727);' +
  277. ' background-image: -moz-linear-gradient(top,#dd4b39,#c53727);' +
  278. ' background-image: -ms-linear-gradient(top,#dd4b39,#c53727);' +
  279. ' background-image: -o-linear-gradient(top,#dd4b39,#c53727);' +
  280. ' background-image: linear-gradient(top,#dd4b39,#c53727);' +
  281. '}' +
  282. '#result_box[lang=ru].cursive {' +
  283. ' font-family: '+rctg_fontFamily+' !important;' +
  284. '}' +
  285. '#result_box[lang=ru].cursive {' +
  286. ' font-size: 35px !important;' +
  287. '}' +
  288. '#result_box[lang=ru].cursive.short_text {' +
  289. ' font-size: 45px !important;' +
  290. '}');
  291.  
  292. // Inject cursive font
  293. $('<link>')
  294. .attr('rel', 'stylesheet')
  295. .attr('href', rctg_fontCssUrl)
  296. .appendTo('head');
  297.  
  298. (function() {
  299. 'use strict';
  300.  
  301. // Add button to toggle cursive
  302. $('<button>')
  303. .attr('id', 'cursive-toggler')
  304. .attr('type', 'button')
  305. .appendTo('#gt-lang-right');
  306.  
  307. /**
  308. * Change state of button
  309. * @param {boolean} arg
  310. */
  311. function setAsEnabled(arg){
  312. var btn = $('#cursive-toggler');
  313. var txt = $('#result_box');
  314. if(arg){
  315. btn.addClass('enabled')
  316. .text('Disable cursive');
  317. txt.addClass('cursive');
  318. GM_setValue('rctg_cursiveToggler', true);
  319. }else{
  320. btn.removeClass('enabled')
  321. .text('Enable cursive');
  322. txt.removeClass('cursive');
  323. GM_setValue('rctg_cursiveToggler', false);
  324. }
  325. }
  326.  
  327. // Prepare button
  328. setAsEnabled(GM_getValue('rctg_cursiveToggler', false));
  329.  
  330. // Handle clicking of button
  331. $('#cursive-toggler').click(function(){
  332. setAsEnabled(!GM_getValue('rctg_cursiveToggler', false));
  333. });
  334. })();