PageSourceSearch

https://rolamix.com/wp-content/plugins/proradio-reaktions/js/proradio-reaktions.js

js rolamix.com collected 2026-10-03 00:57:55 UTC 9,406 bytes, 254 lines download raw bytes

1/**
2 * @package ReAktions
3 * Script for the Qantumthemes Love It plugin
4 */
5
6(function($) {
7	"use strict";
8	$.qtWebsiteObj = {};
9	$.qtWebsiteObj.body = $("body");
10
11	$.qtWebsiteObj.isMobile = function(){
12		var isMobile = false; //initiate as false
13		// device detection
14		if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) 
15			|| /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.
15substr(0,4))) { 
16			isMobile = true;
17		}
18		return isMobile;
19	}
20
21
22
23	// Share counter 2020 april 04
24	// =================================================
25
26	$.fn.ttgReaktionsShareitAjax = function(){
27		var post_id, heart;
28		$.qtWebsiteObj.body.off("click","[data-ttgreaktions-shareboxfull]");
29		$.qtWebsiteObj.body.on("click","[data-ttgreaktions-shareboxfull]", function(e){
30			e.preventDefault();
31
32			var button = $(this),
33				linkdata = button.data('ttgreaktions-shareboxfull');
34
35			// 2. Increment the number
36			$.ajax({
37				type: "post",
38				url: ajax_var.url,
39				// the action requires validation from proradio-reaktions.php
40				// wp_ajax_nopriv_ttg_share_submit
41				data: "action=ttg_share_submit&nonce="+ajax_var.nonce+"&post_share=&post_id="+linkdata.id,
42				success: function(count){
43					if( $.qtWebsiteObj.isMobile && navigator.share ){
44						if (navigator.share) {
45							navigator.share({
46								text: linkdata.title,
47								title: linkdata.title,
48								url: linkdata.shared
49							});
50						}
51					} else {
52						$.qtWebsiteObj.body.append('<div class="proradio-reaktions-modal" id="proradio-reaktions-modal"></div>');
53						$.qtWebsiteObj.body.addClass('proradio-reaktions-blockScroll');
54						var modal = $.qtWebsiteObj.body.find('#proradio-reaktions-modal');
55						$.ajax({ 
56							 url: linkdata.finalUrl,   
57							 success : function(text)
58							 {
59							 	modal.addClass('open').animate({'width':"100vw"}, 300, function(){
60									modal.append(text+'<span class="proradio-reaktions-close proradio-btn proradio-btn__r" data-proradio-reaktions-close><i class="material-icons">close</i></span>')
61									.find('.proradio-reaktions-sharebox').css({opacity: 0}).animate({opacity: 1}, 300);
62								});
63							 }
64						});
65						$.qtWebsiteObj.body.on("click",'[data-proradio-reaktions-close], #proradio-reaktions-modal', function(e){
66							modal.removeClass('open').delay(300).promise().done(function(){
67								modal.remove();
68							});
69						});
70					}
71
72
73					// 1. Open the popup: get the HTML created by sharebod-fullpage.php and place it in the modal window
74					if(count){
75						if(count !== "already" && count !== '' && count !== false) {
76							button.find(".count").html(count);
77						}
78					} else {
79						console.log('Ajax error:'+count);
80					}
81					e.stopPropagation();
82					return;
83				},
84				error: function(e){
85					console.log(e);
86					e.stopPropagation();
87					return;
88				}
89			});
90			
91			return false;
92		});
93	};
94
95
96	// Love counter
97	$.fn.ttgReaktionsLoveitAjax = function(){
98		var post_id, heart;
99		// $.qtWebsiteObj.body.off("click","a.proradio_reaktions-link");
100		$.qtWebsiteObj.body.on("click","[data-ttgreaktions-lovelink]", function(e){
101			e.preventDefault();
102			var heart = $(this);
103			// Retrieve post ID from data attribute
104			var post_id = heart.data("post_id");
105			// Ajax call
106			$.ajax({
107				type: "post",
108				url: ajax_var.url,
109				data: "action=post-like&nonce="+ajax_var.nonce+"&post_like=&post_id="+post_id,
110				success: function(count){
111					// If vote successful
112					if(count != "already") {
113						heart.addClass("proradio-reaktions-btn-disabled");
114						heart.find(".count").text(count);
115						heart.find('i').removeClass('reakticons-heart').addClass('reakticons-heart-full');
116					}
117				}
118			});
119			return false;
120		});
121	};
122
123
124	 $.fn.ttgRatingCounterAjax = function(){
125		var post_id, rating, single, multi, container, label;
126		$.qtWebsiteObj.viewCounterAjax = $(".ttg-reactions-viewconuterajax");
127		if($.qtWebsiteObj.viewCounterAjax == 0){
128			return;
129		}
130		$.qtWebsiteObj.body.on("change","input[name='proradio-reaktions-star']", function(e){
131			e.preventDefault();
132			var that = $(this),
133				form = that.closest("form"),
134				post_id = form.attr("data-postid"),
135				rating = that.attr("value");
136			var data =  "action=ttg_rating_submit&nonce="+ajax_var.nonce+"&ttg_rating_submit="+rating+"&post_id="+post_id;
137			var ajaxurl = ajax_var.url;
138			var responsearray, avg, count, label_novote,rating_container, before, rating_feedback,feedback_msg;
139			$.ajax({
140				type: "post",
141				url: ajaxurl,
142				data: data,
143				success: function(response){
144					container = $(".ttg-Ratings-Amount");
145					rating_container =  $(".ttg-Ratings-Avg");
146					rating_feedback = $(".ttg-Ratings-Feedback");
147					label_novote = container.attr("data-novote");
148					responsearray = response.split("|avg=");
149					label = container.attr("data-single");
150					before = container.attr("data-before");
151					feedback_msg = rating_feedback.attr("data-thanks");
152					if(response === 'novote'){
153						// container.html(label_novote);
154						 rating_feedback.html(label_novote);
155						return;
156					}
157					count = responsearray[0];
158					avg = responsearray[1];
159					if(count > 1){
160						label = container.attr("data-multi");
161					}
162					rating_container.html(parseFloat(avg).toFixed(2)  );
163					rating_feedback.html(feedback_msg);
164					container.html(before+' '+count+ ' ' +label);
165				},
166				error: function(result){
167					// console.log("Ajax rating error");
168				}
169			});
170		});
171	}
172	$.fn.ttgViewCounterAjax = function(){
173		$.qtWebsiteObj.viewCounterAjax = $(".ttg-reactions-viewconuterajax");
174		var single, multi, container, label;
175		if($.qtWebsiteObj.viewCounterAjax.length == 0){
176			return;
177		}
178		var post_id = $.qtWebsiteObj.viewCounterAjax.attr("data-id");
179		var data =  "action=ttg_post_views&nonce="+ajax_var.nonce+"&ttg_post_views=&post_id="+post_id;
180		var ajaxurl = ajax_var.url;
181
182		$.ajax({
183			type: "post",
184			url: ajaxurl,
185			data: data,
186			success: function(count){
187				container = $(".proradio-reaktions-Views-Amount");
188				label = container.attr("data-single");
189				if(count > 1){
190					label = container.attr("data-multi");
191				}
192				container.html(count+ ' ' +label);
193			},
194			error: function(result){
195				// console.log("Ajax count error");
196			}
197		});
198	}
199
200	/* activates
201	*  Adds and removes the class "wpcast-active" from the target item  
202	====================================================================*/
203   $.fn.ttgReactionsActivates= function(){
204	   
205		var t, // target
206			o = $.qtWebsiteObj,
207			s = false;
208		o.body.off("click", "[data-proradio-reaktions-activates]");
209		o.body.on("click", "[data-proradio-reaktions-activates]", function(e){
210			e.preventDefault();
211			s = $(this).attr("data-proradio-reaktions-activates")
212			t = $(s);
213			if(!s || s === ''){
214				t = $(this);
215			}
216			if( s == 'parent'){
217				t = $(this).parent();
218			}
219			t.toggleClass("proradio-reaktions-active");
220			return;
221		});
222	},
223
224   
225
226  
227
228	/**====================================================================
229	 *
230	 * 
231	 *  Popup opener (requires library component) 
232	 *  
233	 * 
234	 ====================================================================*/
235	// $.fn.ttgReaktionPopupwindow = function() {
236	// 	if(typeof($.fn.popupwindow) !== "undefined"){
237	// 	   $.fn.popupwindow();
238	// 	}
239	// };
240	$.fn.ttgReaktionsInit = function(){
241		// $.fn.ttgReaktionPopupwindow();
242		$.fn.ttgReaktionsLoveitAjax();
243		$.fn.ttgViewCounterAjax();
244		$.fn.ttgRatingCounterAjax();
245		$.fn.ttgReaktionsShareitAjax(); // 2020 04 04
246		$.fn.ttgReactionsActivates();
247
248	}
249	$(document).ready(function() {
250		$.fn.ttgReaktionsInit();
251	});
252
253
254})(jQuery);

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.