PageSourceSearch

https://testyourself.psychtests.com/js/getMoreTests.js

js psychtests.com collected 2026-10-03 22:26:27 UTC 15,795 bytes, 310 lines download raw bytes

1function getMoreTests(category,idSite,idClient,idLanguage,numpage,maxpage){
2    currentpage = currentpage + 1;
3    
4    if (currentpage == maxpage) {
5        document.getElementById('buttonViewMoreDiv').style.display="none";
6    }
7    
8    if (currentpage > maxpage) {
9        document.getElementById('buttonViewMoreDiv').style.display="none";
10        return;
11    }		
12    
13    var data = {
14        "action": "getMoreTests",
15        "category": category,
16        "idSite": idSite,
17        "idClient": idClient,
18        "idLanguage": idLanguage,
19        "numpage": numpage,        
20        "currentpage": currentpage
21    };
22    
23    data = $(this).serialize() + "&" + $.param(data);
24    $.ajax({
25        type: "POST",
26        dataType: "json",
27        url: "../tests/getMore.php", 
28        data: data,
29        success: function(data) {
30           
31            var json = data["json"]
32            var obj = JSON.parse(json);
33            var arr = obj.data;
34            
35            var text_out = "";
36            
37            var ind = 0;
38            for (var prop in arr) {
39                var isFree = 'Free report';
40                if (arr[prop].price > 0){
41                    isFree = 'Free snapshot report';
42                }
43                text_out += '<table width="100%" border="0" cellspacing="0"><tr><td>';
44                text_out += '	<div class="card">';
45                text_out += '	    <div class="row no-gutters">';
46                text_out += '	        <div class="col-md-5 d-flex align-items-center justify-content-center p-0 p-sm-1">';
47                text_out += '               <a href="/testid/' + arr[prop].URL + '">';
48                text_out += '                   <img class="img-fluid w-100" alt="' + arr[prop].ALT + '" title="' + arr[prop].ALT + '"  src="/images/categoryPage/' + arr[prop].URL + '.jpg">';
49                text_out += '               </a>';
50                text_out += '           </div>';
51                text_out += '           <div class="col-md-7">';
52                text_out += '               <div class="card-body h-100 d-flex flex-column">';                
53                text_out += '                   <h5 class="card-title"><a href="/testid/' + arr[prop].URL + '">'  + arr[prop].test_name + '</a></h5>';
54                text_out += '                   <p class="card-text">';
55                text_out += '                       ' + arr[prop].promo;
56                text_out += '                   </p>';
57                text_out += '                   <div class="test-info d-flex flex-row mb-1">';
58                if ( arr[prop].testInfoPathTrue == 1 ){
59                    text_out += '                   <div class="pl-2">';
60                    text_out += '                       <span style="cursor:pointer;" onClick="showInfo(\'' + arr[prop].testPath + '/'  + arr[prop].info_page + '\');" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Click for more information on this test">';
61                    text_out += '                           <img src="/images/images_myprofile/icon_info.gif" alt="Click for more information on this test" style="margin-top: 1p
61x;">';
62                    text_out += '                       </span>';
63                    text_out += '                   </div>';
64                }
65                text_out += '                       <div class="pl-2">';
66                text_out += '                           <img style="margin-top: -1px;" height="27" width="34" border="0" alt="" src="' + arr[prop].questionCountImg + '"/>';
67                text_out += '                       </div>'
68                text_out += '                       <div class="pl-2">'
69                text_out += '                             <img border="0"  alt="" src="' + arr[prop].durationImg + '" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Test duration"/>';
70                text_out += '                       </div>';
71                text_out += '                       <div class="pl-2">'
72                text_out += '                             <p class="mb-0 text-blue" style="font-size: 12px;">' + isFree + '</p>';
73                text_out += '                       </div>';
74                text_out += '                   </div>';
75
76                if ( arr[prop].idRegisteredAbrTrue == 1 ){
77                    text_out += '                   <p class="mt-auto mb-0">';
78                    text_out += '                       <a class="float-left pt-3" href="/testid/' + arr[prop].idRegistered_abr + '" style="font-size:12px;color:#6F8EC1;">Take the free abridged version</a>';
79                    text_out += '                       <a href="/testid/' + arr[prop].URL + '" class="btn btn-outline-success float-right">Take test</a>';
80                    text_out += '                   </p>';
81                } else {
82                    text_out += '                   <p class="mt-auto text-right mb-0">';
83                    text_out += '                       <a href="/testid/' + arr[prop].URL + '" class="btn btn-outline-success">Take test</a>';
84                    text_out += '                   </p>';
85                }
86                text_out += '               </div>';
87                text_out += '           </div>';
88                text_out += '       </div>';
89                text_out += '   </div>';
90                text_out += '</td></tr></table>';
91            }
92            
93            if (document.getElementById('list_of_tests')) {
94                document.getElementById('list_of_tests').innerHTML  = text_out; 
95            }
96            
97            if (getBrowserName() != 'Safari') {    //Safari       
98                $( document ).ready(function() {
99                    tippy('[title]'); //turn on tips
100            
101                });
102            }
103        }
104    });
105}
106
107function getMostViewed(idSite,idClient,idLanguage,numpage,maxpage){
108    currentpage = currentpage + 1;
109    
110    if (currentpage == maxpage) {
111        document.getElementById('buttonViewMoreDiv').style.display="none";
112    }
113    
114    if (currentpage > maxpage) {
115        document.getElementById('buttonViewMoreDiv').style.display="none";
116        return;
117    }		
118    
119    var data = {
120        "action": "getMostViewed",
121        "idSite": idSite,
122        "idClient": idClient,
123        "idLanguage": idLanguage,
124        "numpage": numpage,        
125        "currentpage": currentpage
126    };
127    
128    data = $(this).serialize() + "&" + $.param(data);
129    $.ajax({
130        type: "POST",
131        dataType: "json",
132        url: "../tests/getMore.php", 
133        data: data,
134        success: function(data) {
135           
136            var json = data["json"];
137            var obj = JSON.parse(json);
138            var arr = obj.data;
139                        
140            //var text_out = "";
141            //var text_out_v2 = "";
142            var text_out_v3 = "";
143
144            var ind = 0;
145            /*v2 start
146            for (var prop in arr) {
147                text_out_v2 += '<table width="100%" border="0" cellspacing="0"><tr><td>';
148                text_out_v2 += '	<div class="card w-100" ' +
149                    'style="background: url(/images/categoryPage/' + arr[prop].URL + '.jpg) no-repeat center center rgba(33,150,243,.3);  background-size: cover; min-height: 300px;">';
150                text_out_v2 += '        <div class="rgba-orange-light">';
151                text_out_v2 += '	        <div class="h-100" style="min-height: 300px;">';
152                text_out_v2 += '	            <h3 class="rgba-orange-strong-top w-100 p-2 pt-1 pb-5">' +
153                    '<a class="text-white" href="/testid/' + arr[prop].URL + '">'  + arr[prop].test_name + '</a>' +
154                    '</h3>';
155                text_out_v2 += '	        <p class="rgba-orange-strong-bottom p-2 pt-3 pb-1 text-white mb-0 w-100" style="position: absolute; bottom: 0;">' + arr[prop].promo + '</p>';
156                text_out_v2 += '	        </div>';
157                text_out_v2 += '        </div>';
158                text_out_v2 += '	</div>';
159
160                text_out_v2 += '</td></tr></table>';
161            }
162            v2 stop */
163
164            // v3 start
165            for (var prop in arr) {
166                text_out_v3 += '<div class="card w-100 card-popular cursor-pointer" onclick="location.href=\'\/testid/' + arr[prop].URL + '\';">' +
167                        '<div class="card-popular-image" ' +
168                    'style="background: url(/images/categoryPage/' + arr[prop].URL + '.jpg) no-repeat center center rgba(33,150,243,.3);background-size: cover;"></div>';
169                text_out_v3 += '<h3 class="rgba-blue-strong-top w-100 pt-1 pb-4 px-2 text-white">' + arr[prop].test_name + '</h3>';
170                text_out_v3 += '<p class="rgba-white-strong-bottom pb-1 pt-5 px-2 mb-0 w-100">' + arr[prop].promo + '</p>';
171                text_out_v3 += '</div>';
172            }
173            //v3 stop
174
175            /*v1 start
176            for (var prop in arr) {
177                text_out += '<table width="100%" border="0" cellspacing="0"><tr><td>';
178                text_out += '	<div class="card">';
179                text_out += '	    <div class="row no-gutters">';
180                text_out += '	        <div class="col-md-5 d-flex align-items-center justify-content-center p-0 p-sm-1">';
181                text_out += '               <a href="/testid/' + arr[prop].URL + '">';
182                text_out += '                   <img class="img-fluid w-100" alt="' + arr[prop].ALT + '" title="' + arr[prop].ALT + '"  src="/images/categoryPage/' + arr[prop].URL + '.jpg">';
183                text_out += '               </a>';
184                text_out += '           </div>';
185                text_out += '           <div class="col-md-7">';
186                text_out += '               <div class="card-body h-100 d-flex flex-column">';                
187                text_out += '                   <h5 class="card-title"><a href="/testid/' + arr[prop].URL + '">'  + arr[prop].test_name + '</a></h5>';
188                text_out += '                   <p class="card-text">';
189                text_out += '                       ' + arr[prop].promo;
190                text_out += '                   </p>';
191                text_out += '                   <div class="test-info d-flex flex-row mb-1">';
192                if ( arr[prop].testInfoPathTrue == 1 ){
193                    text_out += '                   <div class="pl-2">';
194                    text_out += '                       <span style="cursor:pointer;" onClick="showInfo(\'' + arr[prop].testPath + '/'  + arr[prop].info_page + '\');" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Click for more information on this test">';
195                    text_out += '                           <img src="/images/images_myprofile/icon_info.gif" alt="Click for more information on this test" style="margin-top: 1p
195x;">';
196                    text_out += '                       </span>';
197                    text_out += '                   </div>';
198                }
199                text_out += '                       <div class="pl-2">';
200                text_out += '                           <img style="margin-top: -1px;" height="27" width="34" border="0" alt="" src="' + arr[prop].questionCountImg + '"/>';
201                text_out += '                       </div>'
202                text_out += '                       <div class="pl-2">'
203                text_out += '                             <img border="0"  alt="" src="' + arr[prop].durationImg + '" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="Test duration"/>';
204                text_out += '                       </div>';
205                if ( arr[prop].idRegisteredAbrTrue == 1 ){
206                    text_out += '                   <div class="pl-2 pt-1">';
207                    text_out += '                       <a class="PopUp" href="/testid/' + arr[prop].idRegistered_abr + '" style="text-decoration:none;font-size:12px;color:#6F8EC1;"><i>Abridged Version</i></a>';
208                    text_out += '                   </div>';
209                }
210                
211                text_out += '                   </div>';
212                text_out += '                   <p class="mt-auto text-right mb-0">';
213                text_out += '                       <a href="/testid/' + arr[prop].URL + '" class="btn btn-outline-success">Take test</a>';
214                text_out += '                   </p>';
215                text_out += '               </div>';
216                text_out += '           </div>';
217                text_out += '       </div>';
218                text_out += '   </div>';
219                text_out += '</td></tr></table>';
220            }
221            v1 stop */
222
223
224            if (document.getElementById('list_of_tests')) {
225                document.getElementById('list_of_tests').innerHTML  = text_out_v3;
226            }
227            
228            if (getBrowserName() != 'Safari') {    //Safari       
229                $( document ).ready(function() {
230                    tippy('[title]'); //turn on tips
231            
232                });
233            }
234        }
235    });
236}
237
238function getBrowserName(){
239    var nVer = navigator.appVersion;
240    var nAgt = navigator.userAgent;
241    var browserName  = navigator.appName;
242    
243    var nameOffset,verOffset,ix;
244    
245    // In Opera, the true version is after "Opera" or after "Version"
246    if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
247    browserName = "Opera";
248    }
249    // In MSIE, the true version is after "MSIE" in userAgent
250    else if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
251    browserName = "Microsoft Internet Explorer";
252    }
253    // In Chrome, the true version is after "Chrome" 
254    else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
255    browserName = "Chrome";
256    }
257    // In Safari, the true version is after "Safari" or after "Version" 
258    else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
259    browserName = "Safari";
260    fullVersion = nAgt.substring(verOffset+7);
261    }
262    // In Firefox, the true version is after "Firefox" 
263    else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
264        browserName = "Firefox";
265    }
266    // In most other browsers, "name/version" is at the end of userAgent 
267    else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) ) {
268        browserName = nAgt.substring(nameOffset,verOffset);
269        if (browserName.toLowerCase()==browserName.toUpperCase()) {
270        browserName = navigator.appName;
271        }
272    }
273    return browserName;
274}
275
276function regLogInGuest(uName, uPass){
277    var uName = document.getElementById('email').value;
278    var uPass = document.getElementById('password').value;
279    
280    var data = {
281        "action": "regLogInGuest",
282        "user": uName,
283        "pass": uPass
284    };
285    
286    data = $(this).serialize() + "&" + $.param(data);
287    $.ajax({
288        type: "POST",
289        dataType: "json",
290        url: "../tests/getMore.php", 
291        data: data,
292        success: function(data) {
293            var json = data["json"]
294            var obj = JSON.parse(json);
295            var arr = obj.data;
296            
297            var text_out = "";
298            
299            var ind = 0;
300            
301            if (arr['isLogged'] == 1){
302                document.getElementById("loginForm").submit(); 
303            }
304            else{
305                document.getElementById("errorMsgDiv").style.display="block";
306            }
307             
308        }
309    });
310}

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.