HWM MailToTemplate

В новом письме заполняет тему и текст сообщения из URL

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name        HWM MailToTemplate
// @namespace   Zeleax
// @description В новом письме заполняет тему и текст сообщения из URL
// @include /https?:\/\/(www.heroeswm.ru|178.248.235.15|www.lordswm.com)\/(sms-create.php\?mailto=.*)/
// @version     1.1
// @grant       none
// ==/UserScript==
// Пример использования: https://www.heroeswm.ru/sms-create.php?mailto=MyFriend&subject=Моя тема письма&msg=Мой текст письма
var url=window.location.href;

res=/&subject=([^&.]+)/.exec(url);
if(subjectText=res[1]) document.getElementsByName("subject")[0].setAttribute('value',decodeURI(subjectText));

res=/&msg=([^&.]+)/.exec(url);
if((msgText=res[1]) && (msgEl = document.getElementsByName("msg")[0])) msgEl.innerHTML=decodeURI(msgText);

function getI(xpath,elem){return document.evaluate(xpath,(!elem?document:elem),null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);}