[ticket/10270] Removed all the inline language and HTML from the JS.

PHPBB3-10270
This commit is contained in:
Callum Macrae 2011-09-25 16:02:26 +01:00 committed by Igor Wiedler
parent 818d989168
commit 0e55b2393d
6 changed files with 30 additions and 24 deletions

View file

@ -25,7 +25,7 @@ phpbb.loading_alert = function() {
setTimeout(function() { setTimeout(function() {
if (loading_alert.is(':visible')) if (loading_alert.is(':visible'))
{ {
phpbb.alert('Error', 'Error processing your request. Please try again.'); phpbb.alert($('body').data('l-err'), $('body').data('l-err-processing-req'));
} }
}, 5000); }, 5000);
}); });
@ -45,7 +45,9 @@ phpbb.loading_alert = function() {
* @returns object Returns the div created. * @returns object Returns the div created.
*/ */
phpbb.alert = function(title, msg, fadedark) { phpbb.alert = function(title, msg, fadedark) {
var div = $('<div class="jalert"><h3>' + title + '</h3><p>' + msg + '</p></div>'); var div = $('#jalert_alert');
div.find('h3').html(title);
div.find('p').html(msg);
div.bind('click', function(e) { div.bind('click', function(e) {
e.stopPropagation(); e.stopPropagation();
@ -54,7 +56,7 @@ phpbb.alert = function(title, msg, fadedark) {
dark.one('click', function(e) { dark.one('click', function(e) {
var fade = (typeof fadedark !== 'undefined' && !fadedark) ? div : dark; var fade = (typeof fadedark !== 'undefined' && !fadedark) ? div : dark;
fade.fadeOut(100, function() { fade.fadeOut(100, function() {
div.remove(); div.hide();
}); });
return false; return false;
}); });
@ -101,15 +103,14 @@ phpbb.alert = function(title, msg, fadedark) {
* @returns object Returns the div created. * @returns object Returns the div created.
*/ */
phpbb.confirm = function(msg, callback, fadedark) { phpbb.confirm = function(msg, callback, fadedark) {
var div = $('<div class="jalert"><p>' + msg + '</p>\ var div = $('#jalert_confirm');
<input type="button" class="jalertbut button1" value="Yes" />&nbsp;\ div.find('p').html(msg);
<input type="button" class="jalertbut button2" value="No" /></div>');
div.find('.jalertbut').bind('click', function() { div.find('.jalertbut').bind('click', function() {
var res = this.value === 'Yes'; var res = this.value === 'Yes';
var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark; var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark;
fade.fadeOut(100, function() { fade.fadeOut(100, function() {
div.remove(); div.hide();
}); });
callback(res); callback(res);
return false; return false;
@ -227,7 +228,7 @@ phpbb.ajaxify = function(options, refresh, callback) {
} }
dark.fadeOut(100, function() { dark.fadeOut(100, function() {
alert.remove(); alert.hide();
}); });
}, res.REFRESH_DATA.time * 1000); }, res.REFRESH_DATA.time * 1000);
} }
@ -296,5 +297,11 @@ phpbb.add_ajax_callback = function(id, callback)
} }
phpbb.add_ajax_callback('alt_text', function(el) {
var alt_text = $(el).data('alt-text');
$(el).data('alt-text', $(el).text());
$(el).text(el.title = alt_text);
});
})(jQuery); // Avoid conflicts with other libraries })(jQuery); // Avoid conflicts with other libraries

View file

@ -179,10 +179,12 @@ $lang = array_merge($lang, array(
'ERR_CONNECTING_SERVER' => 'Error connecting to the server.', 'ERR_CONNECTING_SERVER' => 'Error connecting to the server.',
'ERR_JAB_AUTH' => 'Could not authorise on Jabber server.', 'ERR_JAB_AUTH' => 'Could not authorise on Jabber server.',
'ERR_JAB_CONNECT' => 'Could not connect to Jabber server.', 'ERR_JAB_CONNECT' => 'Could not connect to Jabber server.',
'ERR_PROCESSING_REQ' => 'There was an error processing your request. Please try again.',
'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.', 'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.',
'ERR_UNWATCHING' => 'An error occured while trying to unsubscribe.', 'ERR_UNWATCHING' => 'An error occured while trying to unsubscribe.',
'ERR_WATCHING' => 'An error occured while trying to subscribe.', 'ERR_WATCHING' => 'An error occured while trying to subscribe.',
'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path specified appears to be invalid.', 'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path specified appears to be invalid.',
'ERROR' => 'Error',
'EXPAND_VIEW' => 'Expand view', 'EXPAND_VIEW' => 'Expand view',
'EXTENSION' => 'Extension', 'EXTENSION' => 'Extension',
'EXTENSION_CONTROLLER_MISSING' => 'The extension <strong>%s</strong> is missing a controller class and cannot be accessed through the front-end.', 'EXTENSION_CONTROLLER_MISSING' => 'The extension <strong>%s</strong> is missing a controller class and cannot be accessed through the front-end.',

View file

@ -10,18 +10,6 @@ phpbb.add_ajax_callback('post_delete', function(el) {
$(this).remove(); $(this).remove();
}); });
} }
}).add_ajax_callback('bookmark', function(el, res) {
var text = (res.MESSAGE_TEXT.indexOf('Removed') === -1);
text = (text) ? 'Remove from bookmarks' : 'Bookmark topic';
$(el).text(el.title = text);
}).add_ajax_callback('topic_subscribe', function(el) {
$(el).text(el.title = 'Unsubscribe topic');
}).add_ajax_callback('topic_unsubscribe', function(el) {
$(el).text(el.title = 'Subscribe forum');
}).add_ajax_callback('forum_subscribe', function(el) {
$(el).text(el.title = 'Unsubscribe topic');
}).add_ajax_callback('forum_unsubscribe', function(el) {
$(el).text(el.title = 'Subscribe forum');
}).add_ajax_callback('post_approve', function(el, res, act) { }).add_ajax_callback('post_approve', function(el, res, act) {
$(el).parents((act === 'approve') ? '.rules' : '.post').fadeOut(function() { $(el).parents((act === 'approve') ? '.rules' : '.post').fadeOut(function() {
$(this).remove(); $(this).remove();

View file

@ -8,9 +8,9 @@
<ul class="linklist"> <ul class="linklist">
<li class="icon-home"><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a></li> <li class="icon-home"><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a></li>
<!-- IF not S_IS_BOT --> <!-- IF not S_IS_BOT -->
<!-- IF S_WATCH_FORUM_LINK --><li <!-- IF S_WATCHING_FORUM -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{S_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-ajax="forum_<!-- IF S_WATCHING_FORUM -->un<!-- ENDIF -->subscribe">{S_WATCH_FORUM_TITLE}</a></li><!-- ENDIF --> <!-- IF S_WATCH_FORUM_LINK --><li <!-- IF S_WATCHING_FORUM -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{S_WATCH_FORUM_LINK}" title="{S_WATCH_FORUM_TITLE}" data-ajax="alt_text" data-alt-text="<!-- IF S_WATCHING_FORUM -->{L_START_WATCHING_FORUM}<!-- ELSE -->{L_STOP_WATCHING_FORUM}<!-- ENDIF -->">{S_WATCH_FORUM_TITLE}</a></li><!-- ENDIF -->
<!-- IF U_WATCH_TOPIC --><li <!-- IF S_WATCHING_TOPIC -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{U_WATCH_TOPIC}" title="{L_WATCH_TOPIC}" data-ajax="topic_<!-- IF S_WATCHING_TOPIC -->un<!-- ENDIF -->subscribe">{L_WATCH_TOPIC}</a></li><!-- ENDIF --> <!-- IF U_WATCH_TOPIC --><li <!-- IF S_WATCHING_TOPIC -->class="icon-unsubscribe"<!-- ELSE -->class="icon-subscribe"<!-- ENDIF -->><a href="{U_WATCH_TOPIC}" title="{L_WATCH_TOPIC}" data-ajax="alt_text" data-alt-text="<!-- IF S_WATCHING_TOPIC -->{L_START_WATCHING_TOPIC}<!-- ELSE -->{L_STOP_WATCHING_TOPIC}<!-- ENDIF -->">{L_WATCH_TOPIC}</a></li><!-- ENDIF -->
<!-- IF U_BOOKMARK_TOPIC --><li class="icon-bookmark"><a href="{U_BOOKMARK_TOPIC}" title="{L_BOOKMARK_TOPIC}" data-ajax="bookmark">{L_BOOKMARK_TOPIC}</a></li><!-- ENDIF --> <!-- IF U_BOOKMARK_TOPIC --><li class="icon-bookmark"><a href="{U_BOOKMARK_TOPIC}" title="{L_BOOKMARK_TOPIC}" data-ajax="alt_text" data-alt-text="<!-- IF S_BOOKMARKED_TOPIC -->{L_BOOKMARK_TOPIC_REAL}<!-- ELSE -->{L_BOOKMARK_TOPIC_REMOVE}<!-- ENDIF -->">{L_BOOKMARK_TOPIC}</a></li><!-- ENDIF -->
<!-- IF U_BUMP_TOPIC --><li class="icon-bump"><a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}" data-ajax="true">{L_BUMP_TOPIC}</a></li><!-- ENDIF --> <!-- IF U_BUMP_TOPIC --><li class="icon-bump"><a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}" data-ajax="true">{L_BUMP_TOPIC}</a></li><!-- ENDIF -->
<!-- ENDIF --> <!-- ENDIF -->
<li class="rightside"><!-- IF U_TEAM --><a href="{U_TEAM}">{L_THE_TEAM}</a> &bull; <!-- ENDIF --><!-- IF not S_IS_BOT --><a href="{U_DELETE_COOKIES}" data-ajax="true" data-refresh="true">{L_DELETE_COOKIES}</a> &bull; <!-- ENDIF -->{S_TIMEZONE}</li> <li class="rightside"><!-- IF U_TEAM --><a href="{U_TEAM}">{L_THE_TEAM}</a> &bull; <!-- ENDIF --><!-- IF not S_IS_BOT --><a href="{U_DELETE_COOKIES}" data-ajax="true" data-refresh="true">{L_DELETE_COOKIES}</a> &bull; <!-- ENDIF -->{S_TIMEZONE}</li>
@ -29,6 +29,13 @@
<div id="darken">&nbsp;</div> <div id="darken">&nbsp;</div>
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div> <div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></div>
</div> </div>
<div id="jalert_alert" class="jalert"><h3></h3><p></p></div>
<div id="jalert_confirm" class="jalert">
<p></p>
<input type="button" class="jalertbut button1" value="Yes" />&nbsp;
<input type="button" class="jalertbut button2" value="No" />
</div>
</div> </div>
</div> </div>

View file

@ -90,7 +90,7 @@
</head> </head>
<body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}"> <body id="phpbb" class="section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}" data-l-err="{L_ERROR}" data-l-err-processing-req="{L_ERR_PROCESSING_REQ}">
<div id="wrap"> <div id="wrap">
<a id="top" accesskey="t"></a> <a id="top" accesskey="t"></a>

View file

@ -655,6 +655,8 @@ $template->assign_vars(array(
'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&amp;bookmark=1&amp;hash=' . generate_link_hash("topic_$topic_id") : '', 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&amp;bookmark=1&amp;hash=' . generate_link_hash("topic_$topic_id") : '',
'L_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], 'L_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'],
'L_BOOKMARK_TOPIC_REAL' => $user->lang['BOOKMARK_TOPIC'],
'S_BOOKMARKED_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? true : false,
'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=post&amp;f=$forum_id") : '', 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=post&amp;f=$forum_id") : '',
'U_POST_REPLY_TOPIC' => ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&amp;f=$forum_id&amp;t=$topic_id") : '', 'U_POST_REPLY_TOPIC' => ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&amp;f=$forum_id&amp;t=$topic_id") : '',