PageSourceSearch

https://asesoresaragon.org/site/60880/js/ch_default_01.js

js asesoresaragon.org collected 2026-10-10 01:19:54 UTC 6,854 bytes, 235 lines download raw bytes

1var onload = false;
2
3window.onload = function() {
4  
5  var onload = true;
6  
7  console.log('load default.js')
8  
9  var lang = App.Localization.getLang();
10  
11  $(document).on("click", ".remove-post[data-id]", function() {
12    var $elem = $(this);
13    chil.dialogs.confirmDialog({
14      message: lang.removePostWarning,
15      ok: function(){
16        id = $elem.attr("data-id");
17        $.ajax({
18          type: "POST",
19          url: "/remove-post/{0}".format($elem.attr("data-id"))
20        })
21        $('[data-postid="'+id+'"]').slideToggle(function(){
22          $(this).remove();
23        });
24      }
25    })
26  });
27  
28  $(document).on("click", ".edit-post[data-id]", function() {
29    var $elem = $(this);
30    var id = $elem.attr("data-id");
31    window.open('/edit-post/' + id, '_blank');
32  });
33  
34  $(document).on("click", ".remove-comment[data-id]", function() {
35    var $elem = $(this);
36    chil.dialogs.confirmDialog({
37      message: lang.removeCommentWarning,
38      ok: function(){
39        id = $elem.attr("data-id");
40        $.ajax({
41          type: "POST",
42          url: "/remove-comment/{0}".format($elem.attr("data-id"))
43        })
44        $('[data-commentid="'+id+'"]').slideToggle(function(){
45          $(this).remove();
46        });
47      }
48    })
49  });
50  
51  $(document).on("click", ".publish-comment[data-id]", function() {
52    var $this = $(this);
53    var id = $this.attr("data-id");
54    
55    $.ajax({
56			type: "POST",
57			url: "/publish-comment/{0}".format(id),
58			data: {
59				objectType: $this.attr("data-ot"),
60				objectId: $this.attr("data-id")
61			},
62			success: function(response){
63				if (response.ok){
64          var c = parseInt(response.data.CommentsCount);
65          $('[data-commentid="'+id+'"] .waiting-warning').hide(400);
66          $('[data-commentid="'+id+'"] .publish-comment').hide(400);
67				}						
68			}
69		});
70  });
71  
72  /*LIKES*/
73  $(document).on("click", ".iconremove-like[data-obj-id]", clickRemoveLike);
74	$(document).on("click", ".iconadd-like[data-obj-id]", clickAddLike);
75  
76  
77  $('a.big-img').on('click',function(){
78    event.preventDefault();
79    var url_img = $(this).attr('href');
80    $('body').addClass('image-veil').prepend('<div class="img-veil-holder"><img src="'+url_img+'"></div>');
81  });
82  
83  $('body').on('click','.img-veil-holder',function(){
84    $('body').removeClass('image-veil');
85    $('.img-veil-holder').remove();
86  });
87  
88  $('#show-menu').on('click',function(){
89    $('#main-nav').slideToggle(400);
90  });
91  
92  $('.dropdown-click').on('click', function(){
93  	$(this).next('.dropdown-item').slideToggle(400);
94  });
95  
96  
97  //setup contact form
98  var $contactForm = $("#contact-form");
99  $contactForm.validate();
100  $contactForm.ajaxForm({
101    data: {
102      subject: site.social.CONTACT_SUBJECT,
103      to: $site_id
104    },
105    beforeSubmit: function(){
106      chil.ui.showToast("Enviando email...");
107      return true;
108    },
109    success: function(r){
110      $contactForm.clearForm();
111      
112      $contactForm.find('.ch-warning-right').show();
113      
114      setTimeout(function(){
115        chil.ui.hideToast();
116        $contactForm.closest(".mail-holder").hide();
117      }, 0);
118    }
119  });
120  
121  
122};
123
124function clickAddLike(e) {
125  var $elem = $(this);
126  var objectId = $elem.attr("data-obj-id");
127  var objectType = $elem.attr("data-obj-type");
128  if (objectId){
129    $.ajax({
130      url: "/add-like/{0}/{1}".format(objectType, objectId),
131      type: "POST",
132      success: function(response){
133        if (response.ok) {
134          
135          var likesCountHTML = "<span data-obj-id=\"" + objectId + "\">" + response.data.likesCount + "</span>";
136          $(".likes-count[data-obj-id='" + objectId + "']").html(likesCountHTML);
137          
138          $(".iconadd-like[data-obj-id='" + objectId + "']")
139          .attr("title", "Unlike")
140          .unbind("click")	
141          .bind("click", {}, clickRemoveLike)
142          .removeClass("iconadd-like")
143          .addClass("iconremove-like");
144          
145        } else if (response.error){
146          console.log('click')
147          chil.dialogs.alertDialog({
148            message: response.error.msg,
149            type: chil.dialogs.AlertType.ERROR
150          });
151        }
152      }
153    });
154  };
155}
156function clickRemoveLike (e) {
157	var $elem = $(this);
158  var objectId = $elem.attr("data-obj-id");
159  var objectType = $elem.attr("data-obj-type");
160  if (objectId){
161    $.ajax({
162      url: "/remove-like/{0}/{1}".format(objectType, objectId),
163      type: "POST",
164      success: function(response){
165        if (response.ok) {
166          
167          var likesCountHTML = "<span data-obj-id=\"" + objectId + "\">" + response.data.likesCount + "</span>";
168          $(".likes-count[data-obj-id='" + objectId + "']").html(likesCountHTML);
169          
170          $(".iconremove-like[data-obj-id='" + objectId + "']")
171          .attr("title", "Like")
172          .unbind("click")	
173          .bind("click", {}, clickAddLike)
174          .removeClass("iconremove-like")
175          .addClass("iconadd-like");
176          
177        } else if (response.error){
178          console.log('click')
179          chil.dialogs.alertDialog({
180            message: response.error.msg,
181            type: chil.dialogs.AlertType.ERROR
182          });
183        }
184      }
185    });
186  }
187}
188
189function setCalendar(items) {
190  
191  var months_lang;
192  var first_day = 1;
193  var days_lang = ['Do','Lu','Ma','Mi','Ju','Vi','Sá'];
194  
195  if (typeof _lang !== 'undefined') {
196    switch(_lang){
197      case 'CA':
198        months_lang = [ "Gener","Febrer","Març","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre" ]
199        break;
200      case 'EN':
201        months_lang = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", 	"October", "
201November", "December" ];
202        days_lang = ['Su','Mo','Tu','We','Th','Fr','Sa'],
203    first_day = 0;
204        break;
205      case 'ES':
206        months_lang = [ "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", 	"Octubre", "Noviembre", "Diciembre" ];
207        break;
208      case 'FR':
209        months_lang = [ "Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre" ];
210        days_lang = ["Di","Lu","Ma","Me","Je","Ve","Sa"];
211    }
212  }else{
213    months_lang = [ "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", 	"Octubre", "Noviembre", "Diciembre" ];
214  }
215  
216  $("#calendar").datepicker({
217    monthNames: months_lang,
218    dayNamesMin: days_lang,
219    firstDay: first_day,
220    beforeShowDay: function(date) {
221      var item = items[date];
222      if (item) {       
223        return [true, item.className, item.text];
224      }else{
225        return [true, '',''];
226      }
227    },
228    onSelect: function(date){
229      var date = new Date(date);
230      var item = items[date];
231      document.location.href = item.url;
232    }	
233  });
234}
235

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.