1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 11:13:59 +02:00

[ticket/11795] Move MSN scripts to forum_fn.js

Move MSN scripts to forum_fn.js
Rewrite MSN scripts to remove duplicate code

PHPBB3-11795
This commit is contained in:
Vjacheslav Trushkin
2013-08-17 19:07:51 +03:00
parent e4874c180a
commit 4b27ec441a
2 changed files with 59 additions and 71 deletions

View File

@@ -303,6 +303,64 @@ function apply_onkeypress_event() {
jQuery(document).ready(apply_onkeypress_event);
/**
* Run MSN action
*/
function msn_action(action, address)
{
// Does the browser support the MSNM object?
var app = document.getElementById('objMessengerApp');
if (!app || !app.MyStatus) {
var lang = $('form[data-lang-im-msnm-browser]');
if (lang.length) {
alert(lang.attr('data-lang-im-msnm-browser'));
}
return false;
}
// Is MSNM connected?
if (app.MyStatus == 1) {
var lang = $('form[data-lang-im-msnm-connect]');
if (lang.length) {
alert(lang.attr('data-lang-im-msnm-connect'));
}
return false;
}
// Do stuff
try {
switch (action) {
case 'add':
app.AddContact(0, address);
break;
case 'im':
app.InstantMessage(address);
break;
}
}
catch (e) {
return;
}
}
/**
* Add to your contact list
*/
function add_contact(address)
{
msn_action('add', address);
}
/**
* Write IM to contact
*/
function im_contact(address)
{
msn_action('im', address);
}
/**
* Run onload functions
*/