PageSourceSearch

https://www.bauer-netz.de/typo3conf/ext/webx_gamification/Resources/Public/Js/script.js?1776259009

js bauer-netz.de collected 2026-10-04 10:40:48 UTC 8,081 bytes, 268 lines download raw bytes

1$(document).ready(function () {
2    Gamification.initgame();
3
4    $('[data-action="homepage"]').on('click',function(){
5        window.location.href = '/';
6    });
7
8
9    $('#BasicDataNext').on('click',function(){
10        var goahead = true;
11       if( ! $('[name="gf-firstname"]').val() ){
12           $('[name="gf-firstname"]').prev('.gf-errormsg').show();
13           $('html, body').animate({
14               scrollTop: $('[name="gf-firstname"]').offset().top - 100
15           }, 400);
16           goahead = false;
17       }else{
18           $('[name="gf-firstname"]').prev('.gf-errormsg').hide();
19
20       }
21
22       if($('.gf-form .sex-selected').length < 1){
23            $('.gf-sexselection').find('.gf-errormsg').show();
24           goahead = false;
25       }else{
26           $('.gf-sexselection').find('.gf-errormsg').hide();
27       }
28
29       /* VALID GEB DATA
30        if( ! $('[name="gf-geb"]').val() ){
31            $('[name="gf-geb"]').prev('.gf-errormsg').show();
32            $('html, body').animate({
33                scrollTop: $('[name="gf-geb"]').offset().top - 100
34            }, 400);
35            goahead = false;
36        }else{
37            $('[name="gf-geb"]').prev('.gf-errormsg').hide();
38        }
39        */
40
41       if(goahead){
42
43           Gamification.goToNextStep( $(this).closest('.gf-step') );
44       }
45    });
46
47    // Close Overlay
48    $('[data-action="cloes-overlay"]').on('click',function (){
49        $(this).closest('.gf-overlay').removeClass('gf-overlay-open');
50    });
51    // goToFirstNotSolved
52    $('#NotSolvedOverlayOkButton').on('click',function (){
53
54        $('.gf-activeStep').removeClass('gf-activeStep');
55        $('.gf-game[data-solved="0"]').eq(0).addClass('gf-activeStep');
56
57    });
58
59    // Try Next Stept
60    $('[data-action="next"]').on('click',function (){
61
62      //  $(this).closest('.gf-game').find('.gf-overlay').removeClass('gf-overlay-open');
63        // check if game is solved
64        if( $(this).closest('.gf-game').data('solved') ){
65            Gamification.openOverlay( $(this).closest('.gf-game') );
66        }else if( ! $(this).closest('.gf-game').data('solved') ){
67            Gamification.openErrorOverlay( $(this).closest('.gf-game') );
68        }else{
69            alert("no game -> nextaction");
70        }
71
72    });
73
74    // Force Next Stept
75    $('[data-action="forcenext"]').on('click',function (){
76        $(this).closest('.gf-game').find('.gf-overlay').removeClass('gf-overlay-open');
77
78        // IF LAST GAME
79        if( $(this).closest('.gf-game').hasClass('gf-is-last-game') ){
80
81            if( Gamification.checkIfAllGamesSolved()){
82                Gamification.successfulFinished();
83            }else{
84                //   Gamification.successfulFinished();
85                alert("Not all games solved! - Message should not appear.");
86            }
87
88        }else{
89            Gamification.goToNextStep( $(this).closest('.gf-step') );
90            if( $(this).closest('.gf-step').next().data('game') == "GamePuzzle"){
91                //alert("sd");
92                initPuzzle();
93            }
94            if( $(this).closest('.gf-step').next().data('game') == "GameMemory"){
95
96                initMemory();
97            }
98
99
100        }
101    });
102
103
104
105    // TRY AGAIN
106    $('[data-action="tryagain"]').on('click',function (){
107        $(this).closest('.gf-game').find('.gf-overlay-error').removeClass('gf-overlay-open');
108    });
109
110
111    // Go To first step
112
113    setTimeout(function(){
114        Gamification.goToNextStep( $('.gf-activeStep').eq(0) );
115    },3000);
116
117
118    // Go To Prev Stept
119    $('[data-action="prev"]').on('click',function (){
120        Gamification.goToPrevStep( $(this).closest('.gf-step') );
121    });
122
123
124
125
126    //START-GAME
127    $('[data-action="startgame"]').on('click',function(){
128        $(this).addClass('gf-button-inactive');
129        Gamification.startCountdown(5, function(){
130            Gamification.startTime();
131            $('#Countdown').hide();
132            Gamification.goToFirstGame();
133        });
134
135    });
136
137
138
139
140    // DiffSpot
141    $('[data-game="GameSpotdiff"]').each(function () {
142        var thisSpotdiffGame = $(this);
143
144        thisSpotdiffGame.find('.diffimg-grid-item').on('click', function () {
145            $(this).toggleClass('diffimg-grid-selected');
146
147            var solved = 1;
148
149            thisSpotdiffGame.find('.diffimg-grid-item').each(function () {
150                var griditem = $(this);
151
152                if( parseInt( griditem.data('it') ) &&  ! griditem.hasClass('diffimg-grid-selected')){
153                    solved = 0;
154                }
155                if( ! parseInt( griditem.data('it') )   && griditem.hasClass('diffimg-grid-selected')){
156                    solved = 0;
157                }
158            });
159
160            thisSpotdiffGame.data('solved',solved).attr('data-solved',solved);
161
162            if(solved){
163                Gamification.openOverlay( thisSpotdiffGame );
164            }
165        });
166    });
167
168
169    // Multichoice
170    $('[data-game="GameMultichoice"]').each(function () {
171        var thisMcGame = $(this);
172
173        thisMcGame.find('.gf-multichoice-answer').on('click', function () {
174
175            // alert( $(this).index() );
176            //alert("sd");
177            $(this).toggleClass('gf-mc-answer-selected');
178
179            var solved = 1;
180
181            thisMcGame.find('.gf-multichoice-answer').each(function () {
182                var answer = $(this);
183
184                if( parseInt( answer.data('it') ) &&  ! answer.hasClass('gf-mc-answer-selected')){
185                    solved = 0;
186                }
187                if( ! parseInt( answer.data('it') )   && answer.hasClass('gf-mc-answer-selected')){
188                    solved = 0;
189                }
190            });
191
192            thisMcGame.data('solved',solved).attr('data-solved',solved);
193            if(solved){
194                Gamification.openOverlay( thisMcGame );
195            }
196
197
198            //alert(thisMcGame.data('solved'));
199        });
200
201    });
202
203
204    // Area-Selection Slider
205    $('.gf-optionslider').each(function (){
206       var thisSlider = $(this);
207        thisSlider.append("<div class='gf-optionslider-points' />")
208        thisSlider.find('.gf-optionslider-item').each(function (){
209            var thisSliderItem = $(this);
210            thisSlider.find('.gf-optionslider-points').append("<div class='gf-optionslider-point' />");
211        });
212
213        thisSlider.find('.gf-optionslider-item').hide();
214        thisSlider.find('.gf-optionslider-item').eq(0).show();
215        thisSlider.find('.gf-optionslider-point').eq(0).addClass('gf-optionslider-pactive');
216
217        thisSlider.find('.gf-optionslider-point').on('click',function(){
218            var pindex = $(this).index();
219            thisSlider.find('.gf-optionslider-item').hide();
220            thisSlider.find('.gf-optionslider-point').removeClass('gf-optionslider-pactive');
221            $(this).addClass('gf-optionslider-pactive');
222            //alert(pindex);
223            thisSlider.find('.gf-optionslider-item').eq(pindex).show();
224        });
225
226    });
227
228
229    // Memory
230
231    function initMemory() {
232        $("#gf-memory").memoryGame({
233
234            onPairDisclosed : function(game){
235                if(game.finished){
236                    var memoryGame  = $("#gf-memory").closest('.gf-game');
237                    memoryGame.data('solved',true).attr('data-solved',1);
238                    Gamification.openOverlay( memoryGame );
239                }
240
241            },
242            maxCardMargin: 2,
243            autoResize: true,
244            maxRotation : 0
245        });
246    }
247
248
249    // PUZZLE
250    function initPuzzle() {
251        puzzle = new Puzzle({ container: "forPuzzle" });
252        autoStart = false;
253
254        setTimeout(function (){
255            autoStart = true;
256        },2000);
257
258        loadInitialFile( $('#forPuzzle').data('filename') );
259        requestAnimationFrame(animate);
260
261
262
263
264    }
265
266
267});
268

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.