summaryrefslogtreecommitdiff
path: root/extensions/Spoilers/js/spoilers.js
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/Spoilers/js/spoilers.js')
-rw-r--r--extensions/Spoilers/js/spoilers.js25
1 files changed, 13 insertions, 12 deletions
diff --git a/extensions/Spoilers/js/spoilers.js b/extensions/Spoilers/js/spoilers.js
index b05bf86..fbe8cb8 100644
--- a/extensions/Spoilers/js/spoilers.js
+++ b/extensions/Spoilers/js/spoilers.js
@@ -1,12 +1,13 @@
-/**
- * Created by Telshin on 10/22/13.
- */
-$( '.spoilers-button' ).toggle( function() {
- $( this ).parents( '.spoilers' ).find( '.spoilers-body' ).show();
- $( this ).children( '.spoilers-show' ).hide();
- $( this ).children( '.spoilers-hide' ).show();
-}, function() {
- $( this ).parents( '.spoilers' ).find( '.spoilers-body' ).hide();
- $( this ).children( '.spoilers-show' ).show();
- $( this ).children( '.spoilers-hide' ).hide();
-});
+(function($) {
+ 'use strict';
+
+ function init() {
+ $('.spoilers-button').show();
+ $('.spoilers-button').click(function() {
+ $(this).parents('.spoilers').children('.spoilers-body').toggle();
+ $(this).children().toggle();
+ });
+ }
+
+ $(init);
+}(this.jQuery));