aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/assets/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/assets/javascript')
-rw-r--r--phpBB/assets/javascript/core.js25
1 files changed, 25 insertions, 0 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