PageSourceSearch

https://stellarium-gornergrat.ch/wp-content/plugins/wp-slim-mvc-framework/public/js/lib/event-toggle-class.js

js stellarium-gornergrat.ch collected 2026-10-06 05:53:03 UTC 2,396 bytes, 89 lines download raw bytes

1(function(window){
2    // You can enable the strict mode commenting the following line  
3    // 'use strict';
4  
5    // This function will contain all our code
6    function etcLibrary(){
7      var etc = {};
8      
9     etc.checkrequirements = function(){
10    if($ == "undefined"){
11      console.error('evet-toggle-class needs jQuery');
12      return false;
13    }else{
14      return true;
15    }
16  }
17  etc.init = function(){
18    var reqsmet = etc.checkrequirements();
19    if(reqsmet){
20      etc.addeventlisteners();
21    }else{
22      console.error("etc.js requirements not met");
23    }
24  
25  };
26  
27  etc.addeventlisteners = function(){
28  $(document).ready(function(){
29      $(document).on('click', "[onclick-toggle-class]", function () {
30  
31          var json = JSON.parse(($(this).attr("onclick-toggle-class")).replaceAll_custom("'",'"'));
32          for(var key in json){
33              var val = json[key];
34              if(key == "this"){
35                  key = this;
36              }
37              $(key).toggleClass(val);
38          }
39        });
40  
41        $(document).on('click', "[onclick-add-class]", function () {
42  
43          var json = JSON.parse(($(this).attr("onclick-add-class")).replaceAll_custom("'",'"'));
44          for(var key in json){
45              var val = json[key];
46              if(key == "this"){
47                  key = this;
48              }
49              $(key).addClass(val);
50          }
51        });
52  
53        $(document).on('click', "[onclick-remove-class]", function () {
54  
55          var json = JSON.parse(($(this).attr("onclick-remove-class")).replaceAll_custom("'",'"'));
56          for(var key in json){
57              var val = json[key];
58              if(key == "this"){
59                  key = this;
60              }
61              $(key).removeClass(val);
62          }
63        });
64        
65        String.prototype.replaceAll_custom = function(search, replacement) {var target = this;return target.replace(new RegExp(search, 'g'), replacement);};
66  });
67  
68  }
69  
70      etc.init();
71    
72      // We will add functions to our library here !
73  
74      return etc;
75    }
76  
77    // We need that our library is globally accesible, then we save in the window
78    if(typeof(window.etc) === 'undefined'){
79      window.etc = etcLibrary();
80    }
81  })(window); // We send the window variable withing our function
82  
83  
84  // Then we can call it using
85  console.log(etc);
86  
87  
88  
89  

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.