aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCallum Macrae <callum@lynxphp.com>2011-09-25 16:02:26 +0100
committerIgor Wiedler <igor@wiedler.ch>2012-03-31 02:09:17 +0200
commit0e55b2393dffa269a724f3090469dad563217dff (patch)
tree3991c8ba0779bb8e76676778ef5bc02fbf13385e
parent818d98916873945d7e0e7bf2855e982496c7fe35 (diff)
downloadforums-0e55b2393dffa269a724f3090469dad563217dff.tar
forums-0e55b2393dffa269a724f3090469dad563217dff.tar.gz
forums-0e55b2393dffa269a724f3090469dad563217dff.tar.bz2
forums-0e55b2393dffa269a724f3090469dad563217dff.tar.xz
forums-0e55b2393dffa269a724f3090469dad563217dff.zip
[ticket/10270] Removed all the inline language and HTML from the JS.
PHPBB3-10270
-rw-r--r--phpBB/assets/javascript/core.js23
-rw-r--r--phpBB/language/en/common.php2
-rw-r--r--phpBB/styles/prosilver/template/ajax.js12
-rw-r--r--phpBB/styles/prosilver/template/overall_footer.html13
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html2
-rw-r--r--phpBB/viewtopic.php2
6 files changed, 30 insertions, 24 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index 7337a7fbc0..d685d28c81 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -25,7 +25,7 @@ phpbb.loading_alert = function() {
setTimeout(function() {
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);
});
@@ -45,7 +45,9 @@ phpbb.loading_alert = function() {
* @returns object Returns the div created.
*/
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) {
e.stopPropagation();
@@ -54,7 +56,7 @@ phpbb.alert = function(title, msg, fadedark) {
dark.one('click', function(e) {
var fade = (typeof fadedark !== 'undefined' && !fadedark) ? div : dark;
fade.fadeOut(100, function() {
- div.remove();
+ div.hide();
});
return false;
});
@@ -101,15 +103,14 @@ phpbb.alert = function(title, msg, fadedark) {
* @returns object Returns the div created.
*/
phpbb.confirm = function(msg, callback, fadedark) {
- var div = $('<div class="jalert"><p>' + msg + '</p>\
- <input type="button" class="jalertbut button1" value="Yes" />&nbsp;\
- <input type="button" class="jalertbut button2" value="No" /></div>');
+ var div = $('#jalert_confirm');
+ div.find('p').html(msg);
div.find('.jalertbut').bind('click', function() {
var res = this.value === 'Yes';
var fade = (typeof fadedark !== 'undefined' && !fadedark && res) ? div : dark;
fade.fadeOut(100, function() {
- div.remove();
+ div.hide();
});
callback(res);
return false;
@@ -227,7 +228,7 @@ phpbb.ajaxify = function(options, refresh, callback) {
}
dark.fadeOut(100, function() {
- alert.remove();
+ alert.hide();
});
}, 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 \ No newline at end of file
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index e8fff96e5a..ff3d229915 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -179,10 +179,12 @@ $lang = array_merge($lang, array(
'ERR_CONNECTING_SERVER' => 'Error connecting to the server.',
'ERR_JAB_AUTH' => 'Could not authorise on 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_UNWATCHING' => 'An error occured while trying to unsubscribe.',
'ERR_WATCHING' => 'An error occured while trying to subscribe.',
'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path specified appears to be invalid.',
+ 'ERROR' => 'Error',
'EXPAND_VIEW' => 'Expand view',
'EXTENSION' => 'Extension',
'EXTENSION_CONTROLLER_MISSING' => 'The extension <strong>%s</strong> is missing a controller class and cannot be accessed through the front-end.',
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 38233ad0e0..58b765779e 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -10,18 +10,6 @@ phpbb.add_ajax_callback('post_delete', function(el) {
$(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) {
$(el).parents((act === 'approve') ? '.rules' : '.post').fadeOut(function() {
$(this).remove();
diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html
index a89cd7f04e..362f8bc1cc 100644
--- a/phpBB/styles/prosilver/template/overall_footer.html
+++ b/phpBB/styles/prosilver/template/overall_footer.html
@@ -8,9 +8,9 @@
<ul class="linklist">
<li class="icon-home"><a href="{U_INDEX}" accesskey="h">{L_INDEX}</a></li>
<!-- 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 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_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 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="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="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 -->
<!-- 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>
@@ -29,6 +29,13 @@
<div id="darken">&nbsp;</div>
<div class="jalert" id="loadingalert"><h3>{L_LOADING}</h3><p>{L_PLEASE_WAIT}</p></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>
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index 5e095d0a0d..3aff6b30ca 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -90,7 +90,7 @@
</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">
<a id="top" accesskey="t"></a>
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 1ce80568b6..a43edee5da 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -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") : '',
'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_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") : '',