diff options
author | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-08-17 19:07:51 +0300 |
---|---|---|
committer | Vjacheslav Trushkin <cyberalien@gmail.com> | 2013-09-14 10:10:44 +0300 |
commit | 4b27ec441ae5fce40733462100431f901c1db8a9 (patch) | |
tree | 6039fc024a9f2f0a02d60cc3aa645abdfe39f1dc /phpBB/styles | |
parent | e4874c180a847dc69459e381398e315998626cb0 (diff) | |
download | forums-4b27ec441ae5fce40733462100431f901c1db8a9.tar forums-4b27ec441ae5fce40733462100431f901c1db8a9.tar.gz forums-4b27ec441ae5fce40733462100431f901c1db8a9.tar.bz2 forums-4b27ec441ae5fce40733462100431f901c1db8a9.tar.xz forums-4b27ec441ae5fce40733462100431f901c1db8a9.zip |
[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
Diffstat (limited to 'phpBB/styles')
-rw-r--r-- | phpBB/styles/prosilver/template/forum_fn.js | 58 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/memberlist_im.html | 72 |
2 files changed, 59 insertions, 71 deletions
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 4b02093b3e..fc6c418b2e 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -304,6 +304,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 */ (function($) { diff --git a/phpBB/styles/prosilver/template/memberlist_im.html b/phpBB/styles/prosilver/template/memberlist_im.html index 68aed0b3dd..8e7842e631 100644 --- a/phpBB/styles/prosilver/template/memberlist_im.html +++ b/phpBB/styles/prosilver/template/memberlist_im.html @@ -3,7 +3,7 @@ <!-- MSNM info from http://www.cdolive.net/ - doesn't seem to work with MSN Messenger --> <h2 class="solo">{L_SEND_IM}</h2> -<form method="post" action="{S_IM_ACTION}"> +<form method="post" action="{S_IM_ACTION}" data-lang-im-msnm-connect="{L_IM_MSNM_CONNECT|e('html_attr')}" data-lang-im-msnm-browser="{L_IM_MSNM_BROWSER|e('html_attr')}"> <div class="panel bg2"> <div class="inner"> @@ -85,74 +85,4 @@ <a href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a> -<script type="text/javascript"> -// <![CDATA[ - - /** The following will not work with Windows Vista **/ - - var app = document.getElementById('objMessengerApp'); - - /** - * Check whether the browser supports this and whether MSNM is connected - */ - function msn_supported() - { - // Does the browser support the MSNM object? - if (app.MyStatus) - { - // Is MSNM connected? - if (app.MyStatus == 1) - { - alert('{LA_IM_MSNM_CONNECT}'); - return false; - } - } - else - { - alert('{LA_IM_MSNM_BROWSER}'); - return false; - } - return true; - } - - /** - * Add to your contact list - */ - function add_contact(address) - { - if (msn_supported()) - { - // Could return an error while MSNM is connecting, don't want that - try - { - app.AddContact(0, address); - } - catch (e) - { - return; - } - } -} - -/** -* Write IM to contact -*/ -function im_contact(address) -{ - if (msn_supported()) - { - // Could return an error while MSNM is connecting, don't want that - try - { - app.InstantMessage(address); - } - catch (e) - { - return; - } - } -} -// ]]> -</script> - <!-- INCLUDE simple_footer.html --> |