Ikariam CR Converter

By holyschmidt Last update Dec 20, 2012 — Installed 1,431,523 times.

Merge With Message Formatter

in
Subscribe to Merge With Message Formatter 7 posts, 2 voices



Massimo Mors... User
FirefoxWindows

As proposed here, http://userscripts.org/scripts/discuss/62003

would be nice a merge with other script "Ikariam Message Formatter", 'cause many people allready use CR Converter, but HTML messages are beautifull :-)

just implement <messageformatter></messageformatter> tag on CR Converter

 
holyschmidt Script's Author
FirefoxWindows

This is something I've planned to do, but finding time has been difficult, as an unofficial server war has broken out on my world... I will try and get this done soon.

 
holyschmidt Script's Author
FirefoxWindows

http://userscripts.org/topics/37406?page=1#post...

 
Massimo Mors... User
FirefoxWindows

thank you very much. Use are the same as Message Formatter ? with <messageformatter></messageformatter> tag ?

 
holyschmidt Script's Author
FirefoxWindows

Yep (should be Ü).

 
Massimo Mors... User
FirefoxWindows

Hi ! I've done a little merge with bbcode routine from this script http://userscripts.org/scripts/review/56129. bbcode is a simplest way to post image, and as add-on we get very usefull clickable links :-)
// JavaScript Document
// ==UserScript==
// @name           Ikariam Message Formatter
// @author         holyschmidt (http://userscripts.org/users/holyschmidt)
// @license        GNU GPL v3 (http://www.gnu.org/copyleft/gpl.html)
// @homepage       http://userscripts.org/scripts/show/62003
// @description    Ability to send & receive in-game messaging with html formatting 
// @include        http://s*.ikariam.*/*
// @require        http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js
// @require        http://userscripts.org/scripts/source/57756.user.js
// @version        1.01
// @exclude        http://board.ikariam.*/*
// @exclude        http://support*.ikariam.*/*
//
// @history        1.01 Added format()
// @history        1.00 Initial Version
//
// ==/UserScript==

//ScriptUpdater.check(62003, "1.01");


// ************************* ADD ******************************
function parseBBCode(str)
{
   var ret;
   ret=str;
   ret=ret.replace(/(
|
|\b|^)((ftp|http|https|file):\/\/[\w\.\/\?;&=\$\-_\.\+!\*'\(\)]+)(
|
|\b|$)/gim, '/$2$4'); ret=ret.replace(/(\{b\}|\[b\])(.*?)(\{\/b\}|\[\/b\])/gi,'$2'); ret=ret.replace(/(\{i\}|\[i\])(.*?)(\{\/i\}|\[\/b\])/gi,'$2'); ret=ret.replace(/(\{u\}|\[u\])(.*?)(\{\/u\}|\[\/u\])/gi,'$2'); ret=ret.replace(/(\{color=|\[color=)(.*?)(\}|\])(.*?)(\{\/color\}|\[\/color\])/gi,'$4'); ret=ret.replace(/(\{size=|\[size=)(.*?)(\}|\])(.*?)(\{\/size\}|\[\/size\])/gi,'$4'); ret=ret.replace(/(\{font=|\[font=)(.*?)(\}|\])(.*?)(\{\/font\}|\[\/font\])/gi,'$4'); ret=ret.replace(/(\{align=|\[align=)(.*?)(\}|\])(.*?)(\{\/align\}|\[\/align\])/gi,'

$4

'); ret=ret.replace(/(\{url\}|\[url\])\/(.*?)(\{\/url\}|\[\/url\])/gi,'$2'); ret=ret.replace(/(\{url=|\[url=)\/(.*?)(\]|\})(.*?)(\{\/url\}|\[\/url\])/gi,'$4'); ret=ret.replace(/(\{img\}|\[img\])\/(.*?)(\{\/img\}|\[\/img\])/gi,'$2'); ret=ret.replace(/\/((ftp|http|https|file):\/\/[\w\.\/\?;&=\$\-_\.\+!\*'\(\)]+)(
|
|\b|$)/gim, '$1$3'); return ret; } // ******************************************************* MessageFormatter = { init:function() { switch($('body').attr('id')) { case 'diplomacyAdvisor': case 'diplomacyAdvisorOutBox': MessageFormatter.parseMessages(); break; default: break; } }, format:function(html) { return '<MessageFormatter>' + html + '</MessageFormatter>'; }, parseMessages:function() { $("td.msgText div").each(function() { while ($(this)[0].innerHTML.match(/<MessageFormatter>/) && $(this)[0].innerHTML.match(/<\/MessageFormatter>/)) { message = $(this)[0].innerHTML; start = message.indexOf('<MessageFormatter>'); count = message.indexOf('<\/MessageFormatter>') + 25 - start; htmlMessage = message.substr(start, count); htmlMessage = htmlMessage.replace(/<MessageFormatter>/, '').replace(/<\/MessageFormatter>/, ''); htmlMessage = htmlMessage.replace(/</g, '<').replace(/>/g, '>'); $(this)[0].innerHTML = message.substr(0, start) + htmlMessage + message.substr(start + count); } // ************************* ADD ****************************** $(this)[0].innerHTML=parseBBCode($(this)[0].innerHTML); // ******************************************************* }); } } MessageFormatter.init()
 
holyschmidt Script's Author
FirefoxWindows

I'll take a look at this sometime this week. Thanks!