PageSourceSearch

https://ajbm.qc.ca/global/module/comment/ressources/javascript/comment.js?v=20260909_202231107

js ajbm.qc.ca collected 2026-09-26 04:52:34 UTC 9,156 bytes, 246 lines download raw bytes

1;(function($) {
2    var commentMethods = {
3        init: function() {
4            return $(this).each(function() {
5				
6                var $this = $(this),
7                data =  $this.data('comment');
8				
9                if (!data) {
10                    $(this).data('comment', {
11                        target : $this
12                    });
13                    $this.hover(function(e) {
14                        e.stopImmediatePropagation();
15                        //$this.closest(".na_comment").find(".commentDeleteLink:visible").hide();
16                        $this.closest(".na_comment").find(".commentDeleteLink:first").show();
17                    }, function(e) {
18                        e.stopImmediatePropagation();
19                        $this.find(".commentDeleteLink:visible").hide();
20                    });
21					$(this).find('.commentDeleteLink').click(function() {
22						$(this).closest('.na_comment').comment('_remove');
23						return false;
24					});
25                }
26            });
27        },
28		_remove: function() {
29			var container = this;
30            var url = (typeof url_root != "undefined" ?  url_root : "" ) + '/global/module/comment/ressources/ajax/ajax_deleteComment.php'
31			$.post(url, { id : $(this).find('.commentDeleteLink').attr('id') }, function() {
32				container.animate({opacity: 0}, function(){
33					$(this).wrap('<div/>').parent().slideUp('fast', function() {
34						$(this).remove();
35					});
36				});
37				
38				return false;
39			});
40		}
41    };
42
43    $.fn.comment = function(method) {
44        if ( commentMethods[method] )
45        {
46            return commentMethods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
47        }
48        else if ( typeof method === 'object' || ! method )
49        {
50            return commentMethods.init.apply( this, arguments );
51        }
52        else
53        {
54            $.error( 'Method ' +  method + ' does not exist on jQuery.comment' );
55        }
56    };
57	
58    /* Pour le formulaire */
59    var commentFormMethods = {
60        init: function() {
61            return $(this).each(function() {
62                var $this = $(this),
63                data =  $this.data('commentForm');
64			
65                if (!data) {
66                    $(this).data('commentForm', {
67                        target : $this,
68                        justOne: $this.find("input[name=justOne]").val(),
69                        wall:  $this.find("input[name=wall]").val()
70                    });
71					 
72                    $(".commentButton:not(.noHide)").keydown(function() {
73                        $(this).slideUp();
74                    });
75                }
76            });
77        },
78			
79        postComment: function () {
80            return $(this).each(function() {
81                var $this = $(this),
82                params = $this.data('commentForm');
83				
84                if ($this.find('.commentFormTxt').is(":visible") && !$this.find('.commentFormTxt').val().length)
85                {
86                    alert('Vous ne pouvez pas poster un commentaire vide!');
87                    return false;
88                }
89                else if ($this.find('.commentFormUrl').is(":visible") && !$this.find('.commentFormUrl').val().length)
90                {
91                    alert('Vous ne pouvez pas publier une url vide!');
92                    return false;
93                }
94				$('.invitePublish').addClass('disabled');
95
96                var data = $this.serialize();
97                data = data.replace(/(%E2%80%93|%E2%80%94)/g, '-');
98				data = data.replace(/%E2%80%99/g, "'");
99				data = data.replace(/(%E2%80%9C|%E2%80%9D|%E2%80%92)/g, '"');
100				data = data.replace(/%E2%80%A6/g, '...');
101				data = data.replace(/%C5%93/g, 'oe');
102                var url = (typeof url_root != "undefined" ?  url_root : "" ) + '/global/module/comment/ressources/ajax/ajax_postComment.php'
103                $.post(url, data, function(data) {
104                    $('.invitePublish').removeClass('disabled');
105					$this.find(".preview").slideUp("1000");
106					
107					
108                    if (params.justOne != 'false')
109                    {
110                        $('.na_comment').slideUp("1000").remove();
111                        ncomment = $(data);
112                        ncomment.find('.likeLine').like();
113                        $(data).hide().comment().insertBefore($this).slideDown();
114                    }
115                    else
116                    {
117                        if (params.wall != "0") // Si on est sur une publication avancée type wall
118                        {
119                            ncomment = $(data);
120                            ncomment.find('.likeLine').like();
121                            ncomment.hide().comment().insertAfter($this).slideDown().find(".commentForm").commentForm().commentFormMagic();
122                        }							
123                        else
124                        {
125                            ncomment = $(data);
126                            ncomment
127                            .find('.likeLine')
128                            .like();
129                            ncomment
130                            .hide()
131                            .comment();
132                                                
133                            if ($this.closest(".Wall_reactions").length) // Si on est effectivement sur un wall on l'insère dans le wall
134                            {
135                                ncomment.prependTo($this.closest(".Wall_reactions")).slideDown();
136                            }
137                                                        
138                            else // Sinon (cas des news)
139                            {
140                                                    
141                                ncomment.insertBefore($this.parent('.form_area')).slideDown();
142                            }
143                        }
144                    }					
145                }, 'html');
146                $this.find('.commentFormTxt').val($this.find('.commentFormTxt').attr("default"));
147                $this.find('.commentFormUrl').val($this.find('.commentFormUrl').attr("default"));
148
149                return true;
150            });
151        }
152    };
153	
154
155    $.fn.commentForm = function(method) {
156        if ( commentFormMethods[method] )
157        {
158            return commentFormMethods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
159        }
160        else if ( typeof method === 'object' || ! method )
161        {
162            return commentFormMethods.init.apply( this, arguments );
163        }
164        else
165        {
166            $.error( 'Method ' +  method + ' does not exist on jQuery.commentForm' );
167        }
168    };
169	
170})(jQuery);
171
172function shareComment(content){
173    var url = (typeof url_root != "undefined" ?  url_root : "" ) + '/global/generpx_xdcomm.html'
174		
175    RPXNOW.init({
176        appId: 'animhabgcoigmcedhnjg',
177        xdReceiver: url
178    });
179
180    RPXNOW.loadAndRun(['Social'], function () {
181        var activity = new RPXNOW.Social.Activity(
182            "Partager",
183            content,
184            "<?php echo URL_ROOT; ?>");
185        RPXNOW.Social.publishActivity(activity);
186    });
187}
188
189UTF8 = {
190    encode: function(s){
191        for(var c, i = -1, l = (s = s.split("")).length, o = String.fromCharCode; ++i < l;
192            s[i] = (c = s[i].charCodeAt(0)) >= 127 ? o(0xc0 | (c >>> 6)) + o(0x80 | (c & 0x3f)) : s[i]
193        );
194        return s.join("");
195    },
196    decode: function(s){
197        for(var a, b, i = -1, l = (s = s.split("")).length, o = String.fromCharCode, c = "charCodeAt"; ++i < l;
198            ((a = s[i][c](0)) & 0x80) &&
199            (s[i] = (a & 0xfc) == 0xc0 && ((b = s[i + 1][c](0)) & 0xc0) == 0x80 ?
200                o(((a & 0x03) << 6) + (b & 0x3f)) : o(128), s[++i] = "")
201        );
202        return s.join("");
203    }
204};
205
206function deleteComment(id, elem)
207{
208    
209	if (confirm('Êtes-vous sur(e) de vouloir supprimer ce commentaire ?'))
210    {
211	var url = (typeof url_root != "undefined" ?  url_root : "" ) + '/global//module/comment/ressources/ajax/ajax_deleteComment.php'
212
213    	$.post(url, 'id='+id);
214    	$(elem).closest('tr').hide('slow');
215    	decompteComment();
216    }
217    return false;
218}
219
220function validerComment(id, elem)
221{    
222	if (confirm('Êtes-vous sur(e) de vouloir valider ce commentaire ?'))
223    {
224	var url = (typeof url_root != "undefined" ?  url_root : "" ) + '/module/comment/ressources/ajax/ajax_valideComment.php'
225    	$.post(url, 'id='+id);
226    	$(elem).closest('a').hide('slow');
227    }
228    return false;
229}
230
231function decompteComment(){
232	var nb = parseInt($('#resultat_nombre').html()) - 1;
233	$('#resultat_nombre').html(nb);
234	if(nb > 1)
235    	$('#resultat_texte').html('résultats');
236	else
237		$('#resultat_texte').html('résultat');
238}
239			
240$(function() {
241    if( $(".na_comment").length ) 
242        $(".na_comment").comment();
243    
244    if( $(".commentForm").length ) 
245        $(".commentForm").commentForm().commentFormMagic();
246});

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.