PageSourceSearch

https://www.paralel44.com/wp-content/plugins/comment-rating/ck-karma_ver-4.5.2.js

js paralel44.com collected 2026-09-27 03:43:40 UTC 6,155 bytes, 154 lines download raw bytes

1/*
2   Plugin Name: Comment Rating
3	Plugin URI: http://wealthynetizen.com/wordpress-plugin-comment-rating/
4	Description: Allows visitors to rate the comments on your blog in a Like vs. Dislike fashion.  Clickable images and ratings are automatically inserted into each comment.  Comments disliked too much by readers will be hidden in a click-to-show link. 
5	Author: Bob King
6	Author URI: http://wealthynetizen.com
7	Version: 2.3.2
8	*/ 
9
10	/*
11	This program is free software; you can redistribute it and/or modify
12	it under the terms of the GNU General Public License as published by
13	the Free Software Foundation; either version 2 of the License, or
14	(at your option) any later version.
15
16	This program is distributed in the hope that it will be useful,
17	but WITHOUT ANY WARRANTY; without even the implied warranty of
18	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19	GNU General Public License for more details.
20	
21	You should have received a copy of the GNU General Public License
22	along with this program; if not, write to the Free Software
23	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24	*/
25
26function ckratingcreateXMLHttpRequest(){
27    var xmlhttp = null;
28    try {
29        // Moz supports XMLHttpRequest. IE uses ActiveX.
30        // browser detction is bad. object detection works for any browser
31        xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
32    } catch (e) {
33        // browser doesn’t support ajax. handle however you want
34        //document.getElementById("errormsg").innerHTML = "Your browser doesnt support XMLHttpRequest.";
35        // This won't help ordinary users.  Turned off
36        // alert("Your browser does not support the XMLHttpRequest Object!");
37    }
38    return xmlhttp;
39}
40
41var ckratingXhr = ckratingcreateXMLHttpRequest();
42
43function ckratingKarma(id, action, path, imgIndex){
44    ckratingXhr.open('get', 'http\://'+ path +'ck-processkarma.php?id='+ id +'&action='+ action +'&path='+ path +'&imgIndex='+imgIndex);
45    ckratingXhr.onreadystatechange = ckratingHandleResponse;
46    ckratingXhr.send(null);
47}
48
49function ckratingHandleResponse(){
50    if(ckratingXhr.readyState == 4){
51        var response = ckratingXhr.responseText.split('|');
52        
53        if(response[0] == 'done'){
54            if(response[1]){
55                //Changes the thumbs to dull gray and disable the action
56                if (response[4] == 'down') {
57                  if ( document.getElementById("down-"+response[1]) != null ) { 
58                      document.getElementById("down-"+response[1]).src = "http://"+response[3]+'images/'+response[6]+'checkmark.png';
59                  }
60                }
61                else {
62                  if ( document.getElementById("down-"+response[1]) != null ) {
63                      document.getElementById("down-"+response[1]).src = "http://"+response[3]+'images/'+response[6]+'gray_down.png';
64                  }
65                }
66                if ( document.getElementById("down-"+response[1]) != null ) {
67                   document.getElementById("down-"+response[1]).onclick    = '';
68                }
69                if (response[4] == 'up') {
70                   if ( document.getElementById("up-"+response[1]) != null ) {
71                      document.getElementById("up-"+response[1]).src   = "http://"+response[3]+'images/'+response[6]+'checkmark.png';
72                   }
73                }
74                else {
75                   if ( document.getElementById("up-"+response[1]) != null ) {
76                      document.getElementById("up-"+response[1]).src   = "http://"+response[3]+'images/'+response[6]+'gray_up.png';
77                   }
78                }
79                if ( document.getElementById("up-"+response[1]) != null ) {
80                   document.getElementById("up-"+response[1]).onclick      = '';
81                }
82                //Update the karma number display
83                if(!response[2]){
84                	alert("Response has no value");
85                }
86                var karmanumber = response[2];
87                //The below line is commented out because there is no karma number atm.
88                if (document.getElementById("karma-"+response[1]+"-"+response[4]) != null) {
89                   document.getElementById("karma-"+response[1]+"-"+response[4]).innerHTML = karmanumber;
90                }
91                // deal with the single value total
92                if (document.getElementById("karma-"+response[1]+"-total") != null) {
93                   document.getElementById("karma-"+response[1]+"-total").innerHTML = response[5];
94                }
95            } else {
96                alert("WTF ?");
97            }
98        }
99        else if(response[0] == 'error')
100        {
101            var error = 'Error: '+response[1];
102            alert(error);
103        } else {
104           /*  This causes unnecessary error messages when the icon
105            *  is double clicked.
106        	   alert("Reponse: "+response[0]);
107            alert("Karma not changed, please try again later.");
108            */
109        }
110    }
111}
112
113var crToggleComment = 0;
114
115function crSwitchDisplay(id) {
116   if (crToggleComment % 2 == 0) { crShowdiv(id); }
117   else { crHidediv(id); }
118   crToggleComment++;
119}
120
121// hide <div id='a2' style="display:none;"> tagged div ID blocks
122function crHidediv(id) {
123	//safe function to hide an element with a specified id
124	if (document.getElementById) { // DOM3 = IE5, NS6
125		document.getElementById(id).style.display = 'none';
126	}
127	else {
128		if (document.layers) { // Netscape 4
129			document.id.display = 'none';
130		}
131		else { // IE 4
132			document.all.id.style.display = 'none';
133		}
134	}
135}
136
137// show <div id='a2' style="display:none;"> tagged div ID blocks
138// <a href="javascript:crShowdiv('a2');">show a2</a>
139
140function crShowdiv(id) {
141	//safe function to show an element with a specified id
142		  
143	if (document.getElementById) { // DOM3 = IE5, NS6
144		document.getElementById(id).style.display = 'block';
145	}
146	else {
147		if (document.layers) { // Netscape 4
148			document.id.display = 'block';
149		}
150		else { // IE 4
151			document.all.id.style.display = 'block';
152		}
153	}
154}

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.