aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-04-18 17:03:24 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-04-29 12:33:55 +0200
commit53a47fdcc323a5d7dc3696215cc47285a0c99042 (patch)
tree1991f0352796f78abdf0d38257c230407ab5f8e8 /phpBB
parent286aebd93bd49eac2ff80c3a6930f7f692a4c3ef (diff)
downloadforums-53a47fdcc323a5d7dc3696215cc47285a0c99042.tar
forums-53a47fdcc323a5d7dc3696215cc47285a0c99042.tar.gz
forums-53a47fdcc323a5d7dc3696215cc47285a0c99042.tar.bz2
forums-53a47fdcc323a5d7dc3696215cc47285a0c99042.tar.xz
forums-53a47fdcc323a5d7dc3696215cc47285a0c99042.zip
[ticket/10811] Make subscribe/unsubscribe repeatable with AJAX
PHPBB3-10811
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/assets/javascript/core.js25
-rw-r--r--phpBB/styles/prosilver/template/overall_footer.html4
2 files changed, 27 insertions, 2 deletions
diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js
index 74c71fca79..3c1e39fca6 100644
--- a/phpBB/assets/javascript/core.js
+++ b/phpBB/assets/javascript/core.js
@@ -446,5 +446,30 @@ phpbb.add_ajax_callback('alt_text', function() {
el.text(alt_text);
});
+/**
+ * This callback is based on the alt_text callback.
+ *
+ * It replaces the current text with the text in the alt-text data attribute,
+ * and replaces the text in the attribute with the current text so that the
+ * process can be repeated.
+ * Additionally it replaces the icon of the link and changes the link itself.
+ */
+phpbb.add_ajax_callback('toggle_subscribe', function() {
+ var el = $(this),
+ alt_text;
+
+ phpbb.ajax_callbacks['alt_text'].call(this);
+
+ if (el.attr('href').indexOf('unwatch') !== -1)
+ {
+ el.attr('href', el.attr('href').replace('unwatch', 'watch'));
+ el.parent().attr('class', 'icon-subscribe');
+ }
+ else
+ {
+ el.attr('href', el.attr('href').replace('watch', 'unwatch'));
+ el.parent().attr('class', 'icon-unsubscribe');
+ }
+});
})(jQuery); // Avoid conflicts with other libraries
diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html
index 2cb721073f..972d90305e 100644
--- a/phpBB/styles/prosilver/template/overall_footer.html
+++ b/phpBB/styles/prosilver/template/overall_footer.html
@@ -8,8 +8,8 @@
<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="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 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="toggle_subscribe" 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="toggle_subscribe" 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 -->