PageSourceSearch

https://pro-bazissoft.com/wp-content/plugins/wpsn-instant-social-network/js/wpsn.js?ver=1.0.0

js pro-bazissoft.com collected 2026-10-09 23:46:56 UTC 4,580 bytes, 144 lines download raw bytes

1// SHARED 
2
3/* Interval for refreshing avatar dot */
4
5wpsn_update_avatar_dot();
6const intervalId_chat = setInterval(wpsn_update_avatar_dot, 5000);
7function wpsn_update_avatar_dot() {
8	
9	var uid = jQuery('#wpsn_viewing_user_id').html();
10	if (uid > 0 && jQuery('.wpsn-home-page-avatar-dot').length) {
11		
12		jQuery.ajax({
13			url : wpsn_ajax.ajaxurl,
14			data : {
15				security: 	wpsn_ajax.security,
16				action : 	'wpsn_get_user_status',
17				uid :		uid
18			},
19			method : 'POST',
20			success : function(response) {
21				response = JSON.parse(response);
22				if (response.status != 'ok') {
23					alert(response.text);
24				} else {
25					jQuery('.wpsn-home-page-avatar-dot').removeClass('wpsn_active_none').removeClass('wpsn_active_amber').removeClass('wpsn_active_green');
26					jQuery('.wpsn-home-page-avatar-dot').addClass(response.dot_class);
27				}
28			},
29			error: function(jqXHR, textStatus, errorThrown) {
30				//alert('wpsn_update_avatar_dot/'+textStatus+'/'+errorThrown);
31			}
32			
33		});
34	}
35
36}
37
38/* Event listener for paste event on textarea */
39
40jQuery('#wpsn-feed-post-input').on('paste', function(event) {
41	var items = (event.clipboardData || event.originalEvent.clipboardData).items;
42	for (var i = 0; i < items.length; i++) {
43	  if (items[i].type.indexOf('image') !== -1) {
44			var blob = items[i].getAsFile();
45			var reader = new FileReader();
46			reader.onload = function(e) {
47				var dataURL = e.target.result;
48				var fileList = jQuery('#wpsn-fileList');
49				fileList.append('<div class="wpsn-edit-image"><img src="' + dataURL + '" alt="Pasted Image"><div class="wpsn-overlay-delete"><i class="fa-solid fa-trash-can"></i></div></div>');
50			};
51			reader.readAsDataURL(blob);
52		}
53	}
54});
55
56// LIBRARY
57
58function isEmail(email) {
59    // regex from https://emailregex.com
60    //var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
61    var regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
62    return regex.test(email);
63}
64
65function wpsn_page(page) {
66	var id = 'wpsn_'+page.replace(/-/g, '_');
67	var url = document.getElementById("wpsn_home_url").innerHTML;
68	var element = document.getElementById(id);
69	if (element) {
70		url = element.innerHTML;
71	}
72	return url;
73}
74
75// Function to get URL parameter by name
76function wpsnGetUrlParam(parameter, defaultvalue){
77    var urlParameter = defaultvalue;
78    if(window.location.href.indexOf(parameter) > -1){
79        urlParameter = wpsnGetUrlVars()[parameter];
80    }
81    return urlParameter;
82}
83
84// Function to parse URL parameters
85function wpsnGetUrlVars(){
86    var vars = {};
87    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
88        vars[key] = value;
89    });
90    return vars;
91}
92
93function wpsnRemoveUrlParameter(url, parameter) {
94    var urlParts = url.split('?');
95    if (urlParts.length >= 2) {
96        var prefix = encodeURIComponent(parameter) + '=';
97        var params = urlParts[1].split(/[&;]/g);
98
99        // Reverse iteration to safely remove the parameter
100        for (var i = params.length; i-- > 0;) { 
101            if (params[i].lastIndexOf(prefix, 0) !== -1) { 
102                params.splice(i, 1);
103            }
104        }
105
106        url = urlParts[0] + (params.length > 0 ? '?' + params.join('&') : '');
107        return url;
108    } else {
109        return url;
110    }
111}
112
113function getYouTubeVideoId(url) {
114    var pattern = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=))([\w-]{10,12})$/;
115    
116    var matches = url.match(pattern);
117    if (matches) {
118        return matches[1];
119    }
120    return null;
121}
122
123function convertUrlsToLinks(text) {
124    // Regular expression to match URLs without whitespace
125    var pattern = /(?<!["'])\b(?:https?:\/\/|www\.)\S+\/?\b(?![^<>]*>|[^>]*<\/a>)/gi;
126
127    // Replace URLs with anchor tags
128    text = text.replace(pattern, function(match) {
129        var url = match.trim(); // Remove leading and trailing whitespace
130        // Add http:// prefix if missing
131        if (!/^https?:\/\//i.test(url)) {
132            url = "http://" + url;
133        }
134		url = url.replace(/<[^>]*>?/gm, '');
135        
136        // Check if the URL includes the current domain
137        var target = (url.indexOf(window.location.hostname) === -1) ? " target='_blank'" : "";
138        
139        return "<a href='" + url + "'" + target + ">" + match + "</a>";
140    });
141    
142    return text;
143}
144

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.