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 36 $.qtWebsiteObj.body.append('<div class="proradio-reaktions-modal" id="proradio-reaktions-modal"><div class="proradio-reaktions-sharebox proradio-reaktions-sharebox--fp"><div class="proradio-reaktions-sharebox--fp__c"><i class="material-icons proradio-spin">cached</i></div></div></div>'); 37 $.qtWebsiteObj.body.addClass('proradio-reaktions-blockScroll'); 38 var modal = $.qtWebsiteObj.body.find('#proradio-reaktions-modal'); 39 40 41 modal.addClass('open').animate({'width':"100vw"}, 300, function(){ 42 43 // 2. Increment the number 44 $.ajax({ 45 type: "post", 46 url: ajax_var.url, 47 cache: false, 48 // the action requires validation from proradio-reaktions.php 49 // wp_ajax_nopriv_ttg_share_submit 50 data: "action=ttg_share_submit&nonce="+ajax_var.nonce+"&post_share=&post_id="+linkdata.id, 51 success: function(count){ 52 53 if( $.qtWebsiteObj.isMobile && navigator.share && $(window).width() < 1199 ){ 54 navigator.share({ 55 text: linkdata.title, 56 title: linkdata.title, 57 url: linkdata.shared 58 }); 59 modal.removeClass('open').delay(300).promise().done(function(){ 60 modal.remove(); 61 }); 62 } else { 63 $.ajax({ 64 url: linkdata.finalUrl, 65 success : function(text) { 66 modal.html(text+'<span class="proradio-reaktions-close proradio-btn proradio-btn__r" data-proradio-reaktions-close><i class="material-icons">close</i></span>').find('.proradio-reaktions-sharebox').css({opacity: 0}).animate({opacity: 1}, 300); 67 $.ProRadioMainObj.fn.popupLink(); 68 } 69 }); 70 $.qtWebsiteObj.body.on("click",'[data-proradio-reaktions-close], #proradio-reaktions-modal', function(e){ 71 modal.removeClass('open').delay(300).promise().done(function(){ 72 modal.remove(); 73 }); 74 }); 75 } 76 // 1. Open the popup: get the HTML created by sharebod-fullpage.php and place it in the modal window 77 if(count){ 78 if(count !== "already" && count !== '' && count !== false) { 79 button.find(".count").html(count); 80 } 81 } else { 82 console.log('Ajax error:'+count); 83 } 84 e.stopPropagation(); 85 return; 86 }, 87 error: function(e){ 88 console.log(e); 89 return; 90 } 91 }); 92 }); 93 94 return false; 95 }); 96 }; 97 98 99 // Love counter 100 $.fn.ttgReaktionsLoveitAjax = function(){ 101 var post_id, heart; 102 // $.qtWebsiteObj.body.off("click","a.proradio_reaktions-link"); 103 $.qtWebsiteObj.body.on("click","[data-ttgreaktions-lovelink]", function(e){ 104 e.preventDefault(); 105 var heart = $(this); 106 // Retrieve post ID from data attribute 107 var post_id = heart.data("post_id"); 108 // Ajax call 109 $.ajax({ 110 type: "post", 111 url: ajax_var.url, 112 cache: false, 113 data: "action=post-like&nonce="+ajax_var.nonce+"&post_like=&post_id="+post_id+'&nocache='+Math.floor(Math.random() * 999999999999), 114 success: function(count){ 115 // If vote successful 116 if(count != "already") { 117 heart.addClass("proradio-reaktions-btn-disabled"); 118 heart.find(".count").text(count); 119 heart.find('i').removeClass('reakticons-heart').addClass('reakticons-heart-full'); 120 } 121 if(count){ 122 if(count !== "already" && count !== "Nan" && count !== '' && count !== false) { 123 heart.addClass("proradio-reaktions-btn-disabled"); 124 // heart.find(".count").html(count); 125 heart.find('i').removeClass('reakticons-heart').addClass('reakticons-heart-full'); 126 } 127 } else { 128 console.log('Ajax error:'+count); 129 } 130 e.stopPropagation(); 131 }, 132 error: function(e){ 133 console.log(e); 134 e.stopPropagation(); 135 return; 136 } 137 }); 138 return false;
139 }); 140 }; 141 142 143 $.fn.ttgRatingCounterAjax = function(){ 144 var post_id, rating, single, multi, container, label; 145 $.qtWebsiteObj.viewCounterAjax = $(".ttg-reactions-viewconuterajax"); 146 if($.qtWebsiteObj.viewCounterAjax == 0){ 147 return; 148 } 149 $.qtWebsiteObj.body.on("change","input[name='proradio-reaktions-star']", function(e){ 150 e.preventDefault(); 151 var that = $(this), 152 form = that.closest("form"), 153 post_id = form.attr("data-postid"), 154 rating = that.attr("value"); 155 var data = "action=ttg_rating_submit&nonce="+ajax_var.nonce+"&ttg_rating_submit="+rating+"&post_id="+post_id; 156 var ajaxurl = ajax_var.url; 157 var responsearray, avg, count, label_novote,rating_container, before, rating_feedback,feedback_msg; 158 159 $.ajax({ 160 type: "post", 161 url: ajaxurl, 162 data: data, 163 success: function(response){ 164 // console.log( response ); 165 166 167 container = $(".ttg-Ratings-Amount"); 168 rating_container = $(".ttg-Ratings-Avg"); 169 rating_feedback = $(".ttg-Ratings-Feedback"); 170 label_novote = container.attr("data-novote"); 171 responsearray = response.split("|avg="); 172 label = container.attr("data-single"); 173 before = container.attr("data-before"); 174 feedback_msg = rating_feedback.attr("data-thanks"); 175 if(response === 'novote'){ 176 // container.html(label_novote); 177 rating_feedback.html(label_novote); 178 return; 179 } 180 if(response === 'Illegal token.'){ 181 // container.html(label_novote);
182 rating_feedback.html('Thank you'); 183 return; 184 } 185 186 187 188 count = responsearray[0]; 189 avg = responsearray[1]; 190 if(count > 1){ 191 label = container.attr("data-multi"); 192 } 193 rating_container.html(parseFloat(avg).toFixed(2) ); 194 // console.log( rating_container ); 195 rating_feedback.html(feedback_msg); 196 container.html(before+' '+count+ ' ' +label); 197 }, 198 error: function(result){ 199 // console.log( result ); 200 return; 201 // console.log("Ajax rating error"); 202 }, 203 complete: function(e){ 204 // console.log(e); 205 } 206 }); 207 }); 208 } 209 $.fn.ttgViewCounterAjax = function(){ 210 211 212 213 // console.log('trigger counter'); 214 $.qtWebsiteObj.viewCounterAjax = $(".ttg-reactions-viewconuterajax"); 215 var single, multi, container, label; 216 if($.qtWebsiteObj.viewCounterAjax.length == 0){ 217 return; 218 } 219 var post_id = $.qtWebsiteObj.viewCounterAjax.attr("data-id"); 220 221 var newPostid = jQuery('body').attr("class").match(/postid[\w-]*\b/); 222 var newPageid = jQuery('body').attr("class").match(/page-id[\w-]*\b/); 223 if(newPostid !== null ){ 224 post_id = newPostid[0].split('postid-').join(''); 225 // console.log('post_id 1'+post_id); 226 } else if(newPageid !== null ){ 227 post_id = newPageid[0].split('page-id-').join(''); 228 // console.log('post_id 2'+post_id); 229 } else { 230 // console.log('No ID to increment'); 231 return; 232 } 233 234 235 var data = "action=ttg_post_views&nonce="+ajax_var.nonce+"&ttg_post_views=1&post_id="+post_id; 236 237 // console.log(data); 238 239 var ajaxurl = ajax_var.url; 240 241 $.ajax({ 242 type: "post", 243 url: ajaxurl, 244 data: data, 245 cache: false, 246 success: function(count){ 247 container = $(".proradio-reaktions-Views-Amount"); 248 label = container.attr("data-single"); 249 if(count > 1){ 250 label = container.attr("data-multi"); 251 } 252 container.html(count+ ' ' +label); 253 254 // console.log('Done: '+count); 255 }, 256 error: function(result){ 257 console.log("Ajax count error"); 258 console.log( result ); 259 } 260 }); 261 } 262 263 /* activates 264 * Adds and removes the class "wpcast-active" from the target item 265 ====================================================================*/ 266 $.fn.ttgReactionsActivates= function(){ 267 268 var t, // target 269 o = $.qtWebsiteObj, 270 s = false; 271 o.body.off("click", "[data-proradio-reaktions-activates]"); 272 o.body.on("click", "[data-proradio-reaktions-activates]", function(e){ 273 e.preventDefault(); 274 s = $(this).attr("data-proradio-reaktions-activates") 275 t = $(s); 276 if(!s || s === ''){ 277 t = $(this); 278 } 279 if( s == 'parent'){ 280 t = $(this).parent(); 281 } 282 t.toggleClass("proradio-reaktions-active"); 283 return; 284 }); 285 }, 286 287 288 289 290 291 /**==================================================================== 292 * 293 * 294 * Popup opener (requires library component) 295 * 296 * 297 ====================================================================*/ 298 // $.fn.ttgReaktionPopupwindow = function() { 299 // if(typeof($.fn.popupwindow) !== "undefined"){ 300 // $.fn.popupwindow(); 301 // } 302 // }; 303 $.fn.ttgReaktionsInit = function(){ 304 // $.fn.ttgReaktionPopupwindow(); 305 $.fn.ttgReaktionsLoveitAjax(); 306 $.fn.ttgViewCounterAjax(); 307 $.fn.ttgRatingCounterAjax(); 308 $.fn.ttgReaktionsShareitAjax(); // 2020 04 04 309 $.fn.ttgReactionsActivates(); 310 311 } 312 $(document).ready(function() { 313 $.fn.ttgReaktionsInit(); 314 }); 315 316 317})(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.